Align equations in LaTeX: align, gather, cases
Use the equation environment for one numbered formula, and align for several lines aligned at &. Put \label{eq:name} inside and \eqref{eq:name} in the text prints the number in parentheses.
A numbered equation
The equation environment sets one formula on its own line with a number at the right. Add \label inside it, and refer to it with \eqref (number in parentheses) or \ref (number only).
A numbered equation and a reference to it
The energy of a body at rest is
\begin{equation}
E = mc^2 . \label{eq:energy}
\end{equation}
Equation~\eqref{eq:energy} links mass and energy;
\ref{eq:energy} is its number.equation* and \[ ... \] give the same layout without a number. The starred environments come from the amsmath package; load it in every document with math.
Aligning several lines
align lines up several lines at the & sign, usually just before =. End each line except the last with \\.
Lines aligned at the equals sign
\begin{align*}
(a+b)^2 &= (a+b)(a+b) \\
&= a^2 + ab + ba + b^2 \\
&= a^2 + 2ab + b^2
\end{align*}How numbering works here
Scissor LaTeX numbers equations as a TeX installation does: every line of an align or gather gets its own number.
| You write | TeX installation | Scissor LaTeX |
|---|---|---|
equation | one number | one number |
align, gather with three lines | three numbers | three numbers |
\nonumber or \notag on some lines | those lines unnumbered | those lines unnumbered |
\nonumber on every line | no numbers | no number |
align*, gather*, equation* | no numbers | no number |
two \label in one block | two labels | two labels |
\tag{A} | the tag "A" instead of a number | the tag "A" instead of a number |
\numberwithin{equation}{section} | (1.1), (1.2) | (1.1), (1.2) |
An align block: one number per line
\begin{align}
f(x) &= (x+1)^2 \label{eq:square} \\
&= x^2 + 2x + 1
\end{align}
By \eqref{eq:square}, $f(1) = 4$.One equation environment per numbered line
\begin{equation}
a + b = 44 \label{eq:sum}
\end{equation}
\begin{equation}
a - b = 2 \label{eq:diff}
\end{equation}
Adding \eqref{eq:sum} and \eqref{eq:diff} gives $a = 23$.gather: centred lines
gather centres several lines without aligning them.
Centred lines with gather*
\begin{gather*}
a^2 + b^2 = c^2 \\
e^{i\pi} + 1 = 0 \\
\sin^2 x + \cos^2 x = 1
\end{gather*}split: one long equation over several lines
Inside an equation, split breaks one long formula over several aligned lines that share one number.
A long equation split over two lines
\begin{equation}
\begin{split}
(x+y)^3 &= (x+y)(x+y)^2 \\
&= x^3 + 3x^2y + 3xy^2 + y^3
\end{split}
\end{equation}multline also breaks a long formula without alignment: its first line is set at the left and its last line at the right.
cases: definitions by cases
The cases environment puts a large brace in front of several lines. Separate the value and the condition with &.
A function defined by cases
\begin{equation*}
\operatorname{sign}(x) =
\begin{cases}
-1 & \text{if } x < 0, \\
0 & \text{if } x = 0, \\
1 & \text{if } x > 0.
\end{cases}
\end{equation*}aligned and gathered inside other math
aligned and gathered work like align* and gather*, but inside a formula, for example within \[ ... \] or next to a brace.
aligned inside display math
\[
\left.
\begin{aligned}
x + y &= 44 \\
x - y &= 4
\end{aligned}
\right\}
\quad \Rightarrow \quad x = 24,\ y = 20
\]Other environments
| Environment | In Scissor LaTeX |
|---|---|
equation, equation* | Works |
align, align* | Works, one number per line |
gather, gather* | Works, one number per line |
multline, multline* | Works |
split (inside equation) | Works |
cases, aligned, gathered | Works |
alignat, flalign | Works |
eqnarray | Works |
several & column pairs in one align line | Works |
\intertext{...} | Works |
What differs from a TeX installation
More on the package on the amsmath page and the mathtools page. The full manual of the package is at ctan.org/pkg/amsmath.
To try a single formula quickly, with a live preview, use the LaTeX equation editor.
Questions and answers
How do I align equations at the equals sign?
Use \begin{align*} ... \end{align*} and put & right before each =. End every line but the last with \\.
How do I remove the number from one equation?
Use equation*, align* or \[ ... \] for a formula without a number. To leave out the number of one line of an align, put \nonumber (or \notag) on that line, before its \\.
How do I number each line of an align?
align numbers every line by itself; put a \label on each line you want to refer to.
Every example on this page is typeset by Scissor LaTeX when the site is built. Last updated 2026-11-07.