Welcome to the final lesson of Advanced Math Notation! Across the previous five lessons, you have added accents and diacritics to symbols, auto-sized delimiters around tall expressions, combined notation elements into layered formulas, typeset big operators with limits, and created numbered display equations with labels and cross-references. That toolkit already covers a wide range of mathematical writing needs.
There is one common scenario it does not yet handle, though: multi-line derivations. In the last lesson, the equation environment gave us numbered single-line formulas. This lesson introduces the align environment, which lets us stack multiple related lines with precise alignment, controlled line breaks, selective numbering, and explanatory text annotations — everything we need to typeset step-by-step mathematical arguments.
When One Line Is Not Enough
Mathematical reasoning rarely fits on a single line. When we solve an equation, simplify an expression, or develop a proof, the work naturally unfolds as a chain of steps. On a whiteboard or in a notebook, we instinctively stack those steps so the equals signs line up vertically, making it easy to scan downward and follow the logic.
Published textbooks and journal articles follow the same convention. A neatly aligned column of equals signs signals to the reader that each line transforms the previous one, while the left-hand and right-hand sides stay easy to compare. Without that alignment, even a straightforward three-step derivation can look cluttered and hard to follow.
The align environment brings this convention into LaTeX. It handles vertical alignment, spacing, centering, and numbering automatically, so we can focus on the mathematics rather than manual formatting.
The align Environment
Suppressing Numbers with \nonumber
Adding Text Annotations with \text{}
Building a Complete Derivation
Conclusion and Next Steps
In this lesson, we explored the align environment and the tools that make it work: & for alignment points, \\ for line breaks, \nonumber for suppressing numbers on selected lines, align* for fully unnumbered blocks, and \text{} for adding explanatory annotations. Combined with the labeling and cross-referencing workflow from the previous lesson, these features give us everything we need to typeset clean, publication-ready multi-line derivations.
This wraps up the entire Advanced Math Notation course! From math accents in lesson one to fully aligned, annotated equation arrays here in lesson six, you now have a comprehensive LaTeX math typesetting toolkit. Head into the practice exercises to craft multi-line derivations of your own — the kind that would look right at home in a published paper.
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal
The align environment is provided by the amsmath package, so make sure \usepackage{amsmath} appears in the preamble — we have been loading it since earlier in this course. The syntax relies on two special characters: the ampersand &, which marks the alignment point on each line so that LaTeX lines them up vertically, and the double backslash \\, which creates a line break to move to the next line.
Here is a two-line example that solves a simple equation:
\begin{align}x + 2 &= 5 \\x &= 3\end{align}
The compiled output centers both lines with the equals signs aligned and a number on each line:
x+2x=5(1)=3(2)
The & placed before each = tells LaTeX to line those positions up vertically. Everything to the left of & is pushed rightward, and everything after & is pushed leftward, creating a tidy two-column layout. Keep these practical details in mind:
Every line except the last needs a \\. Adding \\ after the final line can produce an unwanted blank row.
By default, align numbers every line, just as equation numbers a single formula.
All the math commands you already know — \frac, \sqrt, \sum, Greek letters, accents — work inside align without changes.
Numbering every line of a long derivation can create visual clutter. Often only the final result, or a few key intermediate steps, deserve a number. The \nonumber command tells LaTeX to skip the number on a particular line. Place it anywhere on the line before the \\ (or at the end of the last line if that line should be unnumbered).
We can mix and match \nonumber on whichever lines we like, keeping numbers only on the steps worth referencing later. If we want no line numbers at all, the starred variant align* suppresses numbering on every line automatically — the same pattern we saw with equation* in the previous lesson.
In published proofs and derivations, authors often annotate individual steps with short phrases like "by assumption" or "since x>0." The \text{} command from amsmath lets us insert normal-font text inside math mode, and a \quad before it adds a comfortable gap between the formula and the note.
\begin{align}a + b &= c \quad \text{(by assumption)} \nonumber \\2a &= c - b \quad \text{(since $a = b$)} \nonumber \\a &= \frac{c - b}{2}\end{align}
The output keeps the algebra aligned at the equals sign while the annotations sit to the right:
a+b2aa=c(by assumption)=c−b(since a=b)=2c−b(1)
Notice that we can embed inline math inside \text{} by using dollar signs, as in \text{since $a = b$}. The text renders in the document's regular upright font, making annotations visually distinct from the math italics around them.
When formulas have different widths, the annotations may not line up horizontally. To fix this, we can use multiple & characters to create additional alignment columns. In align, ampersands alternate roles between alignment points and column separators. Placing && before each annotation starts a second column pair whose alignment point lines up every note at the same horizontal position:
\begin{align}a + b &= c && \text{(by assumption)} \nonumber \\2a &= c - b && \text{(since $a = b$)} \nonumber \\a &= \frac{c - b}{2}\end{align}
Here the first & aligns the equals signs, the second & acts as a column separator, and the third & (which together with the second looks like &&) aligns all the annotations. The result is a neatly organized block where both the math and the reasoning are easy to scan.
Let us combine alignment, selective numbering, labels, and annotations in one realistic example. The derivation below proves the classic formula for the sum of the first n positive integers:
Lines 1 and 4 are numbered and carry \label tags, so we could write Equation~\eqref{eq:result} elsewhere in the document and LaTeX would insert the correct number automatically. Lines 2 and 3 use \nonumber to keep the output clean, while line 2 also includes a text annotation explaining the key insight. This single block brings together alignment, fractions, selective numbering, labeling, and annotations — the full power of align.