LaTeX Cheat Sheet

The essentials: a document is \documentclass{article} plus \begin{document} … \end{document}; \section{} makes headings; \textbf{} and \textit{} style text; math goes between $ … $ inline or \[ … \] on its own line; ^ and _ make superscripts and subscripts; \frac{a}{b} is a fraction. The table below has the rest.

Most-used commands

  • \documentclass{article}
    Text mode, no math preview

    First line of every document (article, report, book, beamer).

  • \usepackage{amsmath}
    Text mode, no math preview

    Load a package in the preamble; amsmath for most math.

  • \section{Title} \subsection{Title}
    Text mode, no math preview

    Numbered headings; \section* without a number.

  • \textbf{bold} \textit{italic} \underline{text}
    Text mode, no math preview

    Bold, italic, underlined text.

  • \begin{itemize} \item ... \end{itemize}
    Text mode, no math preview

    Bullet list; enumerate for numbers.

  • \\ and a blank line
    Text mode, no math preview

    Line break; new paragraph.

  • $x^2$ and \[ x^2 \]
    Text mode, no math preview

    Inline and display math.

  • x^{2}\ x_{i}
    x 2   x i

    Superscript and subscript.

  • \frac{a}{b}
    a b

    Fraction.

  • \sqrt{x}\ \sqrt[3]{x}
    x   x 3

    Square and nth root.

  • \sum_{i=1}^{n}\ \prod_{i=1}^{n}
    ∑ i = 1 n   ∏ i = 1 n

    Sum and product with limits.

  • \int_{a}^{b} f(x)\,dx
    ∫ a b f ( x ) d x

    Integral with a thin space before dx.

  • \lim_{x \to 0}
    lim x → 0

    Limit.

  • \alpha\ \beta\ \pi\ \theta\ \Omega
    α   β   π   θ   Ω

    Greek letters; capitalize the name for capitals.

  • \le\ \ge\ \neq\ \approx\ \equiv
    ≤   ≥   ≠   ≈   ≡

    Relations.

  • \in\ \subset\ \cup\ \cap\ \emptyset
    ∈   ⊂   ∪   ∩   ∅

    Set symbols.

  • \to\ \Rightarrow\ \iff
    →   ⇒   ⟺

    Arrows and logic.

  • \infty\ \partial\ \nabla\ \pm
    ∞   ∂   ∇   ±

    Common symbols.

  • \begin{pmatrix} a & b \\ c & d \end{pmatrix}
    ( a b c d )

    Matrix with parentheses (bmatrix for brackets).

  • \left( \frac{a}{b} \right)
    ( a b )

    Brackets sized to the content.

  • \mathbb{R}\ \mathcal{F}\ \mathbf{v}
    R   F   v

    Blackboard, calligraphic, bold letters.

  • \text{if } x > 0
    if  x > 0

    Normal text inside math.

Try it live

Change the formula and the preview redraws as you type. Copy the LaTeX, download a PNG or SVG, copy it for Word, or use Edit here on any example below to load it.

Templates

LaTeX cheat sheet examples

Each result below is drawn from the LaTeX under it. Copy the code, edit it on this page, or open it in the full editor.

  • Quadratic formula

    x = − b ± b 2 − 4 a c 2 a
    LaTeX
    x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
  • Gaussian integral

    ∫ − ∞ ∞ e − x 2 d x = π
    LaTeX
    \int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}
  • Sum of a series

    ∑ n = 1 ∞ 1 n 2 = π 2 6
    LaTeX
    \sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}
  • Piecewise function

    f ( x ) = { x 2 x ≥ 0 − x x < 0
    LaTeX
    f(x) = \begin{cases} x^2 & x \ge 0 \\ -x & x < 0 \end{cases}
  • Matrix

    A = [ 1 0 0 1 ]
    LaTeX
    A = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}
  • Aligned steps

    ( a + b ) 2 = a 2 + 2 a b + b 2 ( a − b ) 2 = a 2 − 2 a b + b 2
    LaTeX
    \begin{aligned} (a+b)^2 &= a^2 + 2ab + b^2 \\ (a-b)^2 &= a^2 - 2ab + b^2 \end{aligned}

In a LaTeX document

These commands work in the text of a .tex document (Overleaf, TeX Live, MiKTeX), not inside math. The box on the right shows what the compiled PDF looks like.

  • Minimal document

    LaTeX
    \documentclass{article}
    \usepackage{amsmath}
    \title{My Notes}
    \author{Your Name}
    \begin{document}
    \maketitle
    \section{Introduction}
    Inline math $a^2 + b^2 = c^2$ and a display:
    \[ E = mc^2 \]
    \end{document}

How to use this sheet

Each line of the table is the short form; every topic has its own page in the LaTeX reference with variants, mistakes and how it behaves in Overleaf, MathJax and Word. Paste any formula from the table into the editor on this page to see it rendered.

To print the sheet, use your browser's print command; the table and examples print in order.

The five rules that prevent most errors

Math commands only work in math mode. Braces group: x^{10}, not x^10. Special characters # $ % & _ { } ~ ^ \ must be escaped in text. Every \begin{…} needs its \end{…}. Packages go in the preamble, before \begin{document}.

Common mistakes

  • Without braces only the first character is raised.

    Instead of
    x^10
    Write
    x^{10}
  • % starts a comment; the rest of the line disappears.

    Instead of
    50% of cases
    Write
    50\% of cases
  • Math commands outside math mode stop with "Missing $ inserted".

    Instead of
    \alpha + \beta  (in text)
    Write
    $\alpha + \beta$

In Overleaf, MathJax and Word

  • Overleaf and pdfLaTeX

    Everything on this sheet compiles in Overleaf with \usepackage{amsmath} and \usepackage{amssymb} in the preamble.

  • MathJax and KaTeX

    The math rows work in MathJax and KaTeX (Notion, Obsidian, Jupyter, GitHub). Document commands such as \section and lists do not.

  • Microsoft Word

    Word for Microsoft 365 accepts most math rows in LaTeX input mode (Equation › LaTeX). Copy for Word in the editor here pastes them as editable equations.

Already have the whole document?

Move complete papers between PDF, Word and LaTeX without retyping; every equation stays editable.

Single printed formulas are free: 3 a day without an account, 6 with a free account. New accounts get 30 credits to try handwriting, pages and documents; failed conversions return their credits. See plans and credit prices.

LaTeX cheat sheet in LaTeX: questions

What are the most important LaTeX commands?
\documentclass, \usepackage, \section, \textbf, itemize, and in math ^, _, \frac, \sqrt, \sum and \int.
Is there a printable LaTeX cheat sheet?
Print this page from your browser; the table and examples print in order.
Where can I find all LaTeX symbols?
The LaTeX symbols page lists relations, operators, arrows, Greek letters and more with their commands.

Have the formula as a picture?

Paste a screenshot or photo of the equation and get its LaTeX, ready to copy or open in the editor.

Convert an image to LaTeX