The Ultimate LaTeX Equations Cheat Sheet PDF: A Comprehensive Guide

LaTeX equations cheat sheet: inline and display math, align and cases, fractions, Greek letters, symbols, matrices, and a minimal document to compile to PDF.

By Scholarly16 min read

This is a LaTeX equations cheat sheet you can keep open while you write: how to switch into math mode, which amsmath environment to use for multi-line equations, and the commands for fractions, roots, sums, integrals, Greek letters, relations, arrows, set and logic symbols, accents, matrices, brackets, spacing and equation numbers. Every command below is standard LaTeX (most need only the amsmath and amssymb packages). This page has no math renderer, so each table describes the output in words or with a plain character. To keep a PDF copy, use your browser's Print to PDF, or paste the minimal document below into Overleaf or a local LaTeX install and compile it, which gives you a PDF where every equation is actually typeset.

The Ultimate LaTeX Equations Cheat Sheet PDF: A Comprehensive Guide editorial illustration

Write your first equation in LaTeX

If you have never typed an equation in LaTeX, these steps get you from nothing to a compiled PDF.

  1. Pick where to compile. The quickest start is Overleaf, which runs LaTeX in the browser. To work offline, install a distribution: TeX Live (Windows, macOS as MacTeX, Linux) or MiKTeX (Windows). The Windows install guide walks through MiKTeX and TeX Live step by step.
  2. Start a document and load amsmath. Put \usepackage{amsmath} in the preamble (between \documentclass and \begin{document}). It provides align, cases, \text and most of what follows. Add amssymb for symbols such as the blackboard bold R.
  3. Write an inline equation. Inside a sentence, wrap the math in single dollar signs: The area is $A = \pi r^2$. You can also write \(A = \pi r^2\), which does the same thing.
  4. Write a displayed equation. For an equation on its own centered line, use \[ ... \] (no number) or the equation environment (numbered).
  5. Use braces for grouping. x^2 puts only the 2 in the exponent, but x^{10} needs braces to raise both digits. The same rule applies to subscripts and to the arguments of \frac and \sqrt.
  6. Compile and read the log. In Overleaf press Recompile. Locally run pdflatex main.tex or latexmk -pdf main.tex. If compilation stops, the first error in the log is the one to fix; later errors are often caused by it.
  7. Compile twice for references. \ref and \eqref show ?? on the first run. A second run fills in the numbers (latexmk and Overleaf do this for you).

A complete minimal document

Copy this into a file named main.tex and compile it with pdflatex. It uses only packages that ship with TeX Live, MiKTeX and Overleaf.

\documentclass{article}
\usepackage{amsmath}   % align, cases, \text, \eqref
\usepackage{amssymb}   % \mathbb, extra symbols

\DeclareMathOperator{\Var}{Var}

\begin{document}

The roots of $ax^2 + bx + c = 0$ are
\[
  x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}.
\]

\begin{equation}
  \int_0^1 x^2 \, dx = \frac{1}{3}
  \label{eq:integral}
\end{equation}

Equation~\eqref{eq:integral} is numbered automatically.

\begin{align}
  (a + b)^2 &= a^2 + 2ab + b^2 \\
  \Var(X)   &= \mathbb{E}[X^2] - \bigl(\mathbb{E}[X]\bigr)^2
\end{align}

\[
  |x| =
  \begin{cases}
    x  & \text{if } x \ge 0, \\
    -x & \text{if } x < 0.
  \end{cases}
\]

\[
  A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix},
  \qquad
  \sum_{k=1}^{n} k = \frac{n(n+1)}{2}
\]

\end{document}

The ~ before \eqref is a non-breaking space, so the word "Equation" never ends a line with its number on the next one.

Inline math vs display math

You type What you get
$ ... $ Inline math inside a sentence, set small so it fits the line
\( ... \) The same inline math, with delimiters that are easier to search for
\[ ... \] A displayed equation on its own centered line, no number
\begin{equation} ... \end{equation} A displayed equation with an automatic number at the right margin
\begin{equation*} ... \end{equation*} A displayed equation with no number (needs amsmath)
$$ ... $$ Plain TeX display math. It works, but LaTeX documentation discourages it because spacing around it can be wrong; use \[ ... \]

Two rules prevent most beginner errors: math commands like \frac and ^ only work inside math mode, and a blank line is not allowed inside display math.

Multi-line equations: amsmath environments

All of these need \usepackage{amsmath}. In each one, \\ ends a line. In align, split and aligned, & marks the alignment point, and in cases it separates each value from its condition. gather and multline take no & (their lines are centered, or set left and right), and an & there stops the compile with an error. Add * to the name (align*, gather*, multline*) to drop the numbers.

Environment Use it for Numbering
align Several equations lined up at the &, usually just before = One number per line
gather Several equations, each centered, no alignment One number per line
multline One long equation broken over lines; first line sits left, last line sits right One number for the whole equation
split One equation over several aligned lines, placed inside equation One number for the whole block
cases A piecewise definition with a left brace, placed inside math Takes the number of the surrounding environment
aligned An aligned block inside another display, for example next to a brace Takes the number of the surrounding environment

Examples you can copy:

\begin{align}
  f(x) &= (x + 1)^2 \\
       &= x^2 + 2x + 1 \nonumber
\end{align}

\begin{equation}
  \begin{split}
    (a + b)^3 &= (a + b)(a + b)^2 \\
              &= a^3 + 3a^2 b + 3a b^2 + b^3
  \end{split}
\end{equation}

\begin{multline}
  p(x) = 3x^6 + 14x^5 + 590x^4 + 19x^3 \\
         - 12x^2 - 4x + 12 - 4x^7
\end{multline}

\[
  f(x) =
  \begin{cases}
    0 & \text{if } x < 0, \\
    1 & \text{otherwise.}
  \end{cases}
\]

\nonumber (or its synonym \notag) removes the number from one line of an align. Never use the old eqnarray environment: its spacing around the equals sign is visibly wrong, and align replaces it.

Fractions, roots, subscripts and superscripts

You type What you get
x^2 x squared
x^{2n} x to the power 2n (braces group more than one character)
a_i, a_{ij} a with subscript i, a with subscript ij
x_i^2 x with subscript i and superscript 2, stacked
e^{-x^2} e to the power minus x squared (nested exponent)
\frac{a}{b} a over b as a stacked fraction
\dfrac{a}{b} A full-size fraction even inside inline math (amsmath)
\tfrac{a}{b} A small fraction even in display math (amsmath)
\binom{n}{k} The binomial coefficient n choose k (amsmath)
\sqrt{x} Square root of x
\sqrt[3]{x} Cube root of x
x', x'' x prime, x double prime

Sums, integrals and limits

You type What you get
\sum_{i=1}^{n} a_i Sigma summation from i = 1 to n
\prod_{i=1}^{n} a_i Capital pi product from i = 1 to n
\int_a^b f(x)\,dx Integral from a to b, with a thin space before dx
\iint, \iiint Double and triple integral signs (amsmath)
\oint Contour integral sign
\lim_{x \to 0} f(x) Limit as x approaches 0, with the condition under "lim"
\sum\limits_{i=1}^{n} Forces the limits above and below the sigma, even inline
\displaystyle \sum_{i=1}^{n} Switches the rest of the formula to display size inline
\infty Infinity
\partial Partial derivative symbol
\nabla Nabla (del)

In display math, the limits of \sum, \prod and \lim sit above and below the symbol. In inline math they move to the side so the line spacing stays even. Integral limits sit to the side in both cases unless you write \int\limits.

LaTeX symbols

When you cannot find a symbol here, two free resources cover nearly everything:

  • Detexify: draw the symbol with your mouse or finger and it suggests the command and the package it needs.
  • The Comprehensive LaTeX Symbol List by Scott Pakin, on CTAN as symbols-a4.pdf. It lists thousands of symbols with the package each one comes from. If you have TeX Live installed, texdoc symbols-a4 opens your local copy.

Overleaf and TeXstudio also have a symbol palette you can click to insert a command.

Greek letters

Lowercase Uppercase Variant forms
\alpha (α), \beta (β), \gamma (γ), \delta (δ) \Gamma (Γ), \Delta (Δ) \varepsilon (ε, the curly epsilon)
\epsilon (ϵ), \zeta (ζ), \eta (η), \theta (θ) \Theta (Θ) \vartheta (ϑ)
\iota (ι), \kappa (κ), \lambda (λ), \mu (μ) \Lambda (Λ) \varkappa (ϰ, amssymb)
\nu (ν), \xi (ξ), \pi (π), \rho (ρ) \Xi (Ξ), \Pi (Π) \varpi (ϖ), \varrho (ϱ)
\sigma (σ), \tau (τ), \upsilon (υ), \phi (ϕ) \Sigma (Σ), \Upsilon (Υ), \Phi (Φ) \varsigma (ς), \varphi (φ)
\chi (χ), \psi (ψ), \omega (ω) \Psi (Ψ), \Omega (Ω)

There is no \Alpha, \Beta or \omicron: capital alpha looks like A, so you type A, and omicron is just o. Uppercase Greek is upright by default; \varGamma and similar (amsmath) give the italic versions.

Binary operators and relations

You type What you get You type What you get
\times Multiplication cross \leq or \le Less than or equal to
\cdot Centered dot \geq or \ge Greater than or equal to
\div Division sign \neq or \ne Not equal to
\pm Plus or minus \approx Approximately equal
\mp Minus or plus \equiv Identical to, congruent (three bars)
\circ Composition ring \sim Tilde relation, "distributed as"
\ast Centered asterisk \simeq Asymptotically equal
\oplus Circled plus \cong Congruent (isomorphic)
\otimes Circled times \propto Proportional to
\wedge Wedge \ll, \gg Much less than, much greater than
\vee Vee \perp, \parallel Perpendicular, parallel
\setminus Set difference backslash \leqslant, \geqslant Slanted less or equal, greater or equal (amssymb)

Function names such as \sin, \cos, \tan, \log, \ln, \exp, \max, \min, \det and \gcd are already defined and print upright, which is the standard for function names. Typing sin x without the backslash prints s, i, n as three italic variables.

Arrows

You type What you get
\to or \rightarrow Right arrow (also used for "tends to")
\leftarrow or \gets Left arrow
\leftrightarrow Double-headed arrow
\Rightarrow Double right arrow
\Leftarrow Double left arrow
\Leftrightarrow Double left-right arrow
\implies, \iff Long double arrows for "implies" and "if and only if", with extra space (\implies needs amsmath)
\mapsto "Maps to" arrow with a bar at its tail
\longrightarrow Long right arrow
\uparrow, \downarrow Up and down arrows
\xrightarrow{f} Right arrow that stretches under the label f (amsmath)

Sets and logic

You type What you get
\in, \notin Element of, not an element of
\subset, \subseteq Subset, subset or equal
\supset, \supseteq Superset, superset or equal
\cup, \cap Union, intersection
\bigcup_{i}, \bigcap_{i} Large union and intersection with limits, like a sum
\emptyset, \varnothing Empty set; the second is the round form (amssymb)
\{ 1, 2, 3 \} Literal curly braces (plain { only groups)
\{ x \mid x > 0 \} Set-builder notation with a correctly spaced vertical bar
\mathbb{R}, \mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{C} Blackboard bold number sets (amssymb)
\forall, \exists, \nexists For all, there exists, there does not exist (\nexists needs amssymb)
\neg or \lnot Logical not
\land, \lor Logical and, logical or
\therefore, \because Three-dot "therefore" and "because" (amssymb)

Accents and fonts

You type What you get
\hat{x} x with a caret (estimators, unit vectors)
\widehat{xy} A wide caret spanning xy
\bar{x} x with a short bar (sample mean)
\overline{AB} A bar over the whole expression AB
\vec{v} v with a small arrow
\overrightarrow{AB} An arrow over AB
\dot{x}, \ddot{x} x with one dot, two dots (time derivatives)
\tilde{x}, \widetilde{xy} x with a tilde, a wide tilde
\mathbf{v} Upright bold v (does not bolden Greek lowercase)
\bm{\alpha} Bold italic alpha (bm package)
\mathcal{L} Calligraphic L
\mathrm{d} Upright d, as some fields write the differential

Matrices

All matrix environments need amsmath. Columns are separated by & and rows by \\.

Environment Delimiters
matrix None
pmatrix Round parentheses
bmatrix Square brackets
Bmatrix Curly braces
vmatrix Single vertical bars (a determinant)
Vmatrix Double vertical bars (a norm)
\[
  \begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc,
  \qquad
  I_3 = \begin{bmatrix}
          1 & 0 & 0 \\
          0 & 1 & 0 \\
          0 & 0 & 1
        \end{bmatrix},
  \qquad
  A = \begin{pmatrix}
        a_{11} & \cdots & a_{1n} \\
        \vdots & \ddots & \vdots \\
        a_{m1} & \cdots & a_{mn}
      \end{pmatrix}
\]

\cdots, \vdots and \ddots are the horizontal, vertical and diagonal dots for omitted entries; \ldots sits on the baseline, for lists like 1, 2, and so on. For a matrix with vertical rules or custom column alignment, use the array environment, which takes a column specification like a table. The LaTeX tables guide covers that syntax.

Brackets that scale

Plain ( and [ stay one size. Around a tall fraction or sum they look too small.

You type What you get
\left( \frac{a}{b} \right) Parentheses that grow to fit the fraction
\left[ ... \right] Square brackets that grow
\left\{ ... \right\} Curly braces that grow
\left. ... \right\rvert_{x=0} An invisible left delimiter with a growing bar on the right, for "evaluated at"
\big( \Big( \bigg( \Bigg( Four fixed sizes, each larger than the last (pair with \big) and so on)
\langle x, y \rangle Angle brackets for inner products
\lfloor x \rfloor, \lceil x \rceil Floor and ceiling brackets
\lvert x \rvert, \lVert x \rVert Absolute value bars and norm bars, spaced as delimiters (amsmath)

Every \left needs a matching \right in the same line, and in align they cannot straddle an & or a \\. That is why a bracket that spans a line break uses fixed \big sizes instead. Manual sizes are also the better choice when \left and \right make brackets slightly too large, which happens often around sums.

Text and spacing in math

LaTeX ignores the spaces you type in math mode and sets its own. To add words or control spacing:

You type What you get
\text{for all } x Upright text inside an equation, in the surrounding font (amsmath); include spaces inside the braces
\quad A space of 1 em, about the width of a capital M
\qquad Twice \quad
\, Thin space, used before dx in integrals
\: Medium space
\; Thick space
\! Negative thin space, pulls symbols closer
\ (backslash followed by a space) One normal interword space

Example: f(x) = x^2 \quad \text{for } x > 0.

Numbering, labels and references

You type What it does
\label{eq:energy} Names the equation; put it inside the equation or on the align line
\ref{eq:energy} Prints the number alone, such as 3
\eqref{eq:energy} Prints the number in parentheses, such as (3), in upright type (amsmath)
\tag{*} Replaces the automatic number with your own label (amsmath)
\nonumber or \notag Removes the number from one line
\numberwithin{equation}{section} In the preamble, numbers equations 1.1, 1.2, 2.1 by section (amsmath)

The eq: prefix is only a naming convention, but it keeps equation labels apart from fig: and tab: labels in a long document.

Define your own operators and shortcuts

\DeclareMathOperator (amsmath, preamble only) creates a function name that prints upright and gets correct spacing, the way \sin does:

\DeclareMathOperator{\Tr}{Tr}           % trace: \Tr(A)
\DeclareMathOperator*{\argmax}{arg\,max} % star puts limits underneath in display
\newcommand{\R}{\mathbb{R}}              % shortcut: \R for the real numbers

Writing \operatorname{Tr} inside one formula does the same thing without a preamble entry. Use \newcommand for any notation you repeat, so a change of notation is one edit instead of fifty.

Packages worth knowing

Package What it adds Notes
amsmath align, gather, multline, split, cases, matrices, \text, \eqref, \DeclareMathOperator Load it in every document with math
amssymb \mathbb, \varnothing, \leqslant, \therefore and hundreds more symbols Loads amsfonts for you
mathtools Fixes and extends amsmath: \coloneqq (colon equals), dcases, \DeclarePairedDelimiter for auto-sized pairs such as absolute values Loads amsmath itself, so use it in place of amsmath
bm \bm{...} for bold symbols, including Greek Better than \boldsymbol in most cases
physics Shorthands such as \dv{f}{x} for derivatives, \abs{x}, and bra-ket notation Use with care: it has not been updated in many years, it redefines some standard commands (its \div means divergence, not the division sign), and its automatic bracket sizing can surprise you. Many people define the few macros they need with \newcommand instead
siunitx \SI{9.81}{\metre\per\second\squared} (or \qty in version 3) for numbers with correctly spaced units Standard in physics and engineering

Common mistakes, and the fix

Mistake Fix
Missing $ inserted A math command or _ or ^ is outside math mode, or there is a blank line inside display math
Undefined control sequence A typo in the command, or the package that defines it is not loaded (for example \mathbb without amssymb)
x^10 prints x to the power 1, followed by 0 Use braces: x^{10}
Word "if" in a cases line prints in italics with no spaces Wrap it: \text{if }
Huge gaps around = in a multi-line equation Replace eqnarray with align
?? where a reference should be Compile again; the first pass only records the labels
Brackets too small around a fraction Use \left( ... \right) or a \big size

Get this cheat sheet as a PDF

There are two honest ways. The first is to print this page from your browser and choose Save as PDF; you get the tables and code exactly as you see them here. The second gives you real typeset math: paste the minimal document above (and any snippets from the tables you want to keep) into Overleaf or a local .tex file and compile it. Overleaf has a Download PDF button above the preview; locally, latexmk -pdf main.tex writes main.pdf next to the source. The guide to converting LaTeX equations to PDF covers single-equation PDFs, cropping, and turning an equation into an image for Word or slides.

Equations for an exam are a different job

Typesetting equations for a paper calls for LaTeX itself. Collecting equations for an exam calls for something much shorter. If revision is your goal, a formula sheet generator writes the formulas for the subject and topics you list, grouped by topic, and a cheat sheet maker turns your own notes, slides or PDF into a one- or two-page sheet of formulas, definitions and rules. If you already have a lecture PDF full of equations, Scholarly can also turn it into flashcards for practice. Scholarly does not open or compile your own .tex files; for the document itself, use Overleaf, TeXstudio or VS Code with LaTeX Workshop.