Skip to content

Math in LaTeX: the basics

Put short formulas in the text between $ ... $, and give larger ones their own line with \[ ... \]. Inside, ^ raises and _ lowers, \frac{a}{b} makes a fraction and \sqrt{x} a square root.

Inline and display math

Math in the running text goes between dollar signs, or between \( and \). A formula on its own centred line goes between \[ and \].

Inline math and display math

Einstein's formula $E = mc^2$ fits in a sentence.
So does \(a^2 + b^2 = c^2\). Larger formulas get a line
of their own:
\[
  x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
\]
Rendered by Scissor LaTeX: Inline math and display math

$$ ... $$ works too, but \[ ... \] is the form recommended for LaTeX. To number a formula, use the equation environment; see Equations, alignment and numbering.

Spaces in math are ignored: LaTeX spaces formulas by itself. $a+b$ and $a + b$ look the same.

Superscripts and subscripts

^ raises the next character and _ lowers it. For more than one character, use braces.

Superscripts and subscripts

x^2 \qquad x_i \qquad x^{10} \qquad a_{ij} \qquad
e^{-x^2} \qquad x_1^2 \qquad {}^{14}\mathrm{C}

Without braces, x^10 gives x¹0: only the 1 is raised.

Fractions and roots

WriteFor
\frac{a}{b}a fraction; smaller in inline math
\dfrac{a}{b}a fraction in full size, also inline
\tfrac{a}{b}a small fraction, also in display math
\sqrt{x}a square root
\sqrt[3]{x}a cube root, or any other root
\binom{n}{k}a binomial coefficient

Fractions, roots and binomials

\frac{1}{2} + \frac{a+b}{c} \qquad \sqrt{2} \qquad
\sqrt[3]{x^2+1} \qquad \binom{44}{2} = 946

Sums, integrals and limits

Big operators take their limits with _ and ^. In display math the limits go below and above; inline, they go to the side to save space.

Sums, products, integrals and limits

Inline: $\sum_{k=1}^{n} k = \frac{n(n+1)}{2}$.
\[
  \sum_{k=1}^{n} k^2 \qquad \prod_{i=1}^{n} x_i \qquad
  \int_0^\infty e^{-x}\,dx = 1 \qquad
  \lim_{x \to 0} \frac{\sin x}{x} = 1
\]
Rendered by Scissor LaTeX: Sums, products, integrals and limits

\, before dx adds the thin space that is usual in integrals. Function names such as \sin, \log, \exp and \lim are set upright; for a name LaTeX does not know, write \operatorname{rank} or define it with \DeclareMathOperator (see Your own commands). All symbols are listed in the symbols reference.

Text inside formulas

Letters in math are set in italic as variables, and spaces are dropped. For words, use \text{...}; for upright letters such as units or a "d", use \mathrm{...}.

Words and upright letters in a formula

f(x) = x^2 \quad \text{for all } x > 0, \qquad
v = 44\,\mathrm{km/h}, \qquad \frac{\mathrm{d}y}{\mathrm{d}x}

Greek letters and symbols

Greek letters are commands with their names: \alpha, \beta, \pi, and capitals such as \Gamma and \Omega. See the Greek letters page for all of them.

Greek letters and a few symbols

\alpha + \beta = \gamma, \quad \Delta x \to 0, \quad
\forall \varepsilon > 0, \quad x \in \mathbb{R}, \quad
a \leq b \neq c \approx 44

Brackets that grow

Plain brackets keep their size. \left( and \right) make a pair that grows with what is between them. This works for ( ), [ ], \{ \} and |.

Brackets with \left and \right

(\frac{1}{2}) \qquad \left(\frac{1}{2}\right) \qquad
\left[ \sum_{i=1}^{n} x_i \right]^2 \qquad
\left\{ x : x > 0 \right\}

For absolute values, plain |x| gives the tightest spacing in Scissor LaTeX; \left| x \right| and \lvert x \rvert work but add a little space inside the bars. Angle brackets are \langle and \rangle, which also grow with \left and \right.

When a formula cannot be read

If a formula contains a command that Scissor LaTeX does not know, that formula is shown as red source code, and the Problems tab names it with its line. The rest of the document typesets normally.

An unknown math command: this formula is shown in red

The vector $\symbf{v}$ is not available,
but $\boldsymbol{v}$ is.

Shown in red: the formula cannot be read, so its source is shown instead.

Commands known to show a red formula include \sideset, \symbf, \qedhere and the commands of the physics package such as \abs and \dv.

A formula never stops the whole document. \partial, \langle, \rangle, \cap, \oplus, \otimes, \hbar and Vmatrix, which did in earlier versions, typeset as in LaTeX; see When the whole document does not typeset.

Typing the Unicode character directly works too: ∂ for \partial, ⟨ and ⟩ for the angle brackets, ⊕ for \oplus.

Unicode characters for \partial, \langle and \oplus

The gradient is
$\frac{∂ f}{∂ x}$, the inner product $⟨ u, v ⟩$,
and the direct sum $U ⊕ V$.
Rendered by Scissor LaTeX: Unicode characters for \partial, \langle and \oplus

Typed characters work in XeLaTeX and LuaLaTeX with the unicode-math package, but not with plain pdfLaTeX. If you will compile the document elsewhere with pdfLaTeX, use the commands.

What differs from a TeX installation

What works from the math packages is listed on the amsmath and amssymb pages. The full manuals are at ctan.org/pkg/amsmath and ctan.org/pkg/amsfonts.

Questions and answers

How do I write a fraction in LaTeX?

Write \frac{numerator}{denominator}, for example $\frac{1}{2}$. Use \dfrac for a full-size fraction in a line of text.

How do I write a superscript with more than one character?

Put it in braces: x^{10}. Without braces, only the first character is raised.

Why is my formula shown in red?

It contains a command that Scissor LaTeX cannot read. Check the commands in that formula against the symbols reference, or replace the command.

Every example on this page is typeset by Scissor LaTeX when the site is built. Last updated 2026-11-07.