Aligning equations
此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
English
Lining equations up
- When you show working, readers like the
=signs to line up. Thealign*environment does this:
\begin{align*}
y &= 2(x + 3) \\
y &= 2x + 6
\end{align*}
- The
&marks where to align (just before each=), and\\ends each line.

English
Numbered or not
align*(with the star) gives no equation numbers.- Drop the star —
align— and LaTeX numbers each line(1),(2), … for you to refer to.
English
Matrices
amsmathalso gives matrices.bmatrixdraws square brackets:
\[
\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}
\]
- Again
&separates columns and\\separates rows — the same idea as alignment.
English
Common mistakes
alignwithoutamsmath. LaTeX stops with! LaTeX Error: Environment align undefined.- A blank line inside
align. It gives! Paragraph ended before \align was complete.Keep the lines together;\\already starts a new row. - The
&in different places. Put it just before the symbol to line up, usually&=, on every line.
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
Show the two steps lined up at the = sign. Put them in an align* environment, with & just before each = and \\ between the lines.
点击“运行”编译并预览 PDF。
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
Draw a 2×2 matrix with bmatrix (square brackets). Separate columns with & and rows with \\, e.g. \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}.
点击“运行”编译并预览 PDF。
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
Solve $2x + 3 = 11$ in three lines inside align*, lined up at =: 2x + 3 &= 11, then 2x &= 8, then x &= 4. End the first two lines with \\.
点击“运行”编译并预览 PDF。