LaTeX is the gold standard for typesetting mathematics in academic papers, theses, and textbooks. But the jump from "I need a fraction" to "I need a system of aligned partial differential equations" can feel daunting. This guide takes you from the basics all the way to advanced formulas — with copy-paste examples you can use right now.
Inline Math vs. Display Math
LaTeX has two math modes, and choosing the right one affects readability:
- Inline math — wraps math in
$...$or\(...\), placed within a sentence. Example:$E = mc^2$renders inside the text flow. - Display math — uses
\[...\]or environments likeequation, placing the formula on its own centered line. Use this for anything important or complex.
% Inline: fits in a sentence
The energy is $E = mc^2$ according to Einstein.
% Display: stands alone, centered
The energy-mass equivalence is given by:
\[ E = mc^2 \]
As a rule of thumb, use inline math for short expressions (variables, simple relations) and display math for anything readers need to study.
Fractions: \frac, \dfrac, and \cfrac
Fractions are probably the first thing you'll need. LaTeX offers three commands, each with a different use case:
\frac{numerator}{denominator}
The standard fraction. In inline math, LaTeX shrinks it to fit the line height; in display math, it renders at full size.
% Inline (small)
The ratio is $\frac{a}{b}$.
% Display (full size)
\[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]
\dfrac — Force display-style fractions
Sometimes you want a full-size fraction even in inline mode. Use \dfrac (from amsmath):
\usepackage{amsmath}
The result is $\dfrac{a + b}{c + d}$ which is larger than $\frac{a + b}{c + d}$.
\cfrac — Continued fractions
For nested fractions (common in number theory and analysis), \cfrac keeps proper vertical spacing:
\[ \cfrac{1}{1 + \cfrac{1}{2 + \cfrac{1}{3 + \cfrac{1}{4}}}} \]
For a deeper dive, see our complete guide to writing fractions in LaTeX.
Greek Letters and Common Symbols
Greek letters are essential in STEM writing. Here's a quick reference:
| LaTeX | Output | LaTeX | Output |
|---|---|---|---|
\alpha | α | \beta | β |
\gamma | γ | \delta | δ |
\epsilon | ε | \theta | θ |
\lambda | λ | \mu | μ |
\sigma | σ | \omega | ω |
\Gamma | Γ | \Delta | Δ |
For uppercase variants, capitalize the first letter (e.g. \Sigma for Σ). Browse our full common LaTeX symbols reference for arrows, operators, and relations.
Integrals, Sums, and Products
These "big operators" are the backbone of scientific notation:
% Definite integral
\[ \int_{0}^{\infty} e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2} \]
% Double integral
\[ \iint_{D} f(x,y) \, dA \]
% Summation
\[ \sum_{n=1}^{N} a_n = a_1 + a_2 + \cdots + a_N \]
% Product
\[ \prod_{i=1}^{n} x_i = x_1 \cdot x_2 \cdots x_n \]
Use \, before dx to add a thin space — it's a subtle typographic convention that makes integrals look professional.
Aligned Equations
When you have multi-step derivations or systems of equations, the align environment (from amsmath) is indispensable. The & character marks the alignment point:
\usepackage{amsmath}
\begin{align}
f(x) &= (x + 1)^2 \\
&= x^2 + 2x + 1 \\
&= (x + 1)(x + 1)
\end{align}
This aligns all three lines at the = sign. Use align* (with an asterisk) to suppress equation numbers:
\begin{align*}
\nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0} \\
\nabla \cdot \mathbf{B} &= 0 \\
\nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\
\nabla \times \mathbf{B} &= \mu_0 \mathbf{J} + \mu_0 \epsilon_0 \frac{\partial \mathbf{E}}{\partial t}
\end{align*}
For more alignment patterns (multi-column, cases, sub-equations), see our guide to aligning equations in LaTeX.
Matrices
The amsmath package provides several matrix environments:
% Plain matrix (no brackets)
\begin{matrix} a & b \\ c & d \end{matrix}
% Parentheses
\begin{pmatrix} a & b \\ c & d \end{pmatrix}
% Square brackets
\begin{bmatrix} a & b \\ c & d \end{bmatrix}
% Determinant (vertical bars)
\begin{vmatrix} a & b \\ c & d \end{vmatrix}
% Augmented matrix (for linear systems)
\left[\begin{array}{cc|c}
1 & 0 & 3 \\
0 & 1 & 5
\end{array}\right]
Equation Numbering and Cross-References
Numbered equations let readers (and reviewers) reference specific results:
\begin{equation}
\label{eq:euler}
e^{i\pi} + 1 = 0
\end{equation}
As shown in Equation~\eqref{eq:euler}, the five fundamental constants are connected.
Use \eqref instead of \ref for equations — it automatically adds parentheses. To selectively suppress numbering for one line in an align block, add \nonumber or \notag before the \\.
Practical Tips
- Load
amsmathin every document — it's the standard math package and providesalign,\dfrac,\text{}, and dozens of other essentials. - Use
\text{}for words inside math —$x_{\text{max}}$looks correct;$x_{max}$italicizes "max" as if it were three variables. - Prefer
\left(and\right)for auto-sizing brackets —\left( \frac{a}{b} \right)scales the parentheses to fit the fraction. - Use
\DeclareMathOperatorfor custom operators — e.g.\DeclareMathOperator{\argmin}{arg\,min}gives you upright, properly spaced text.
The Faster Way: AI-Powered Equation Editing
Remembering every command is impractical — even experienced LaTeX users look up syntax constantly. Bibby AI's equation tools let you describe formulas in plain English and get correct LaTeX instantly. Type "integral of e to the negative x squared from zero to infinity" and the AI generates the exact \int expression for you.
Ready to write equations faster? Try Bibby AI free — AI-powered equation generation, symbol search, and instant compilation so you can focus on the math, not the markup.