All guides
Basics

Writing mathematics

Inline and display math, numbered equations, aligned equations, fractions, sums and matrices.

Inline and display math

Math inside a sentence goes between \( and \) (or $…$). A formula on its own line goes between \[ and \]. Load amsmath — almost every paper does.

The energy is \(E = mc^2\), and
\[
  \int_0^\infty e^{-x}\,dx = 1 .
\]

Numbered equations

The equation environment numbers the formula; add a \label to refer to it with \eqref. Use align to line up several equations at the & sign.

\begin{equation}
  \mathrm{SNR} = 10 \log_{10} \frac{P_s}{P_n}
  \label{eq:snr}
\end{equation}
By~\eqref{eq:snr}, the ratio grows with the signal power.

\begin{align}
  y &= ax + b \\
    &= 2x + 1
\end{align}

Common building blocks

Fractions \frac{a}{b}, roots \sqrt{x}, sub- and superscripts x_i^2, sums \sum_{i=1}^{n}, Greek letters \alpha, \beta, and matrices with pmatrix or bmatrix. The ∑ button in the editor inserts many symbols for you.

\[
  \bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i , \qquad
  A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}
\]
Try it: the full example compiles as it is. Open as a project
Next guide
Figures and images