Introduction

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

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:

The compiled output centers both lines with the equals signs aligned and a number on each line:

x+2=5(1)x=3(2)\begin{aligned} x + 2 &= 5 \qquad (1) \\ x &= 3 \qquad (2) \end{aligned}
Suppressing Numbers with \nonumber

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).

Now only the final line carries a number:

2x+4=102x=6x=3(1)\begin{aligned} 2x + 4 &= 10 \\ 2x &= 6 \\ x &= 3 \qquad (1) \end{aligned}
Adding Text Annotations with \text{}

In published proofs and derivations, authors often annotate individual steps with short phrases like "by assumption" or "since x>0x > 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.

The output keeps the algebra aligned at the equals sign while the annotations sit to the right:

a+b=c(by assumption)2a=cb(since a=b)
Building a Complete Derivation

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 nn positive integers:

The compiled result:

S=1+2++n(1)2S=(n+1)+(n+1)++(n+1)(pairing terms)2S=n(n
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.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal