LaTeX syntax for maths, physics and chemistry
Quick reference guide for common LaTeX notations.
43 copy-and-paste snippets, each one rendered so you can see what it produces.
Basics
Inline maths
A formula sitting inside a line of text.
$E = mc^2$Display maths
A formula on its own centred line.
$$e^{i\pi} + 1 = 0$$Superscript
Upper index. Wrap in braces when it is more than one character.
x^{2n}Subscript
Lower index, for sequences and matrix entries.
a_{i,j}Fraction
Use \dfrac to keep an inline fraction full size.
\frac{a}{b}Square root
The radical stretches to fit what is inside it.
\sqrt{x}Nth root
The degree goes in square brackets.
\sqrt[n]{x}Auto-sized brackets
\left and \right always pair up, even when one side is a dot.
\left( \frac{a}{b} \right)Words inside maths
Without \text each letter is treated as a variable and set in italics.
\text{area} = \pi r^2Calculus and operators
Definite integral
\, is the thin space before dx; without it the d runs into the formula.
\int_{a}^{b} f(x) \,dxSummation
Limits sit above and below in display, beside it inline.
\sum_{i=1}^{n} a_iProduct
Limits work exactly as they do for a sum.
\prod_{k=1}^{n} kLimit
Use \to rather than typing ->.
\lim_{x \to 0} \frac{\sin x}{x}Partial derivative
\partial is ∂, which is not a plain letter d.
\frac{\partial f}{\partial x}Derivative notation
Primes for derivatives; \dot and \ddot for time derivatives.
f'(x), \ddot{y}Double integral
\iiint for triple, \oint for a closed contour.
\iint_{D} g(x,y) \,dAInfinity
Usually a limit: \int_{0}^{\infty}.
\inftyGreek letters and symbols
Lowercase Greek
The letter’s English name, with a backslash in front.
\alpha, \beta, \gamma, \theta, \piUppercase Greek
Capitalise the first letter. Ones identical to Latin have no command.
\Gamma, \Delta, \Theta, \Sigma, \OmegaComparisons
\neq is ≠; \equiv is ≡, used for congruence.
\le, \ge, \neq, \approx, \equivLogic
\implies and \iff are the long arrows for implication and equivalence.
\land, \lor, \neg, \implies, \iffSet notation
\mathbb{R} for the reals, \varnothing for the empty set.
\in, \notin, \subset, \cup, \capArrows
Capitalise for a double arrow: \Rightarrow differs from \rightarrow.
\to, \gets, \Rightarrow, \leftrightarrowAngles and degrees
^\circ is the degree sign; do not use a raised letter o.
\angle ABC, 30^\circVectors and segments
\overrightarrow{AB} for a vector named by its endpoints.
\vec{v}, \overline{AB}Matrices and alignment
Round-bracket matrix
& separates columns, \\ starts a new row.
\begin{pmatrix} a & b \\ c & d \end{pmatrix}Square-bracket matrix
Change the leading letter for the bracket style: p, b, v, V, B.
\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}Determinant
Vertical bars. \begin{Vmatrix} gives double bars.
\begin{vmatrix} x & y \\ z & w \end{vmatrix}Multi-line alignment
Put & immediately before the = so the lines line up.
\begin{aligned} f(x) &= (x+1)^2 \\ &= x^2 + 2x + 1 \end{aligned}System of equations
The brace sizes itself to the number of rows.
\begin{cases} x + y = 1 \\ x - y = 3 \end{cases}Binomial coefficient
The n-choose-k notation.
\binom{n}{k}Chemistry
Molecular formula
Subscripts happen automatically; no _ for each number.
\ce{H2O}Reaction equation
-> for one direction, <=> for an equilibrium.
\ce{2H2 + O2 -> 2H2O}Charged ion
The charge follows ^, number before sign.
\ce{SO4^2-}Reaction conditions
Conditions go in square brackets right after the arrow.
\ce{CaCO3 ->[\Delta] CaO + CO2}Precipitate and gas
v is the down arrow (precipitate), ^ the up arrow (gas).
\ce{AgCl v}, \ce{H2 ^}Isotope
Mass number above, atomic number below, before the symbol.
\ce{^{14}_{6}C}Physics and units
Variable with an index
v_0 is initial velocity — the index is a zero, not a letter o.
v = v_0 + atFormula with a fraction
A product needs no times sign; the spacing is automatic.
F = G\frac{m_1 m_2}{r^2}Change and constants
Capital \Delta for a change; \nu is a nu, not a v.
\Delta E = h\nuUnits
\mathrm keeps units upright. {,} stops a decimal comma being read as a separator.
9{,}8\ \mathrm{m/s^2}Scientific notation
\times for a cross, \cdot for a centred dot.
1{,}6 \times 10^{-19}Vector quantity
With an arrow it is a vector; without, a magnitude.
\vec{F} = m\vec{a}