Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
Typesetting multiline equations in LaTeX is a foundational requirement for academic manuscripts across mathematics, physics, engineering, computer science, and quantitative social sciences. Long mathematical expressions, multi-step algebraic derivations, systems of simultaneous equations, and multi-line definitions frequently exceed the horizontal width of standard single-column and double-column journal formats. Attempting to fit these expressions onto a single line forces margin overflow, disrupts text pagination, and obscures mathematical logic.
The standard modern mechanism for handling multiple-line mathematical displays in LaTeX is the amsmath package, maintained by The LaTeX Project and the American Mathematical Society (AMS). Rather than relying on legacy or obsolete constructs, amsmath provides dedicated environments—primarily align, split, multline, and gather—engineered to align relation symbols, balance horizontal margins, and enforce consistent equation numbering.
What it is used for in research
In scientific research and technical writing, multiline equations are used whenever an expression or derivation cannot cleanly fit on a single line of a printed column. In peer-reviewed publishing, page layouts commonly adhere to rigid column constraints (often 3.25 to 3.5 inches in two-column formats like IEEE, ACM, or Elsevier, and 5.5 to 6.5 inches in single-column journals). Researchers use LaTeX multiline equations to solve several distinct formatting challenges:
- Multi-step mathematical derivations: Showing intermediate algebraic, analytical, or statistical steps aligned at the equality symbol (
=) or inequality symbols (≤,≥,<,>) to allow reviewers and readers to follow deductive flow. - Long single equations: Breaking lengthy expressions—such as high-order polynomials, Hamiltonian operators, or multivariate likelihood functions—across two or more lines with structured indents.
- Simultaneous systems of equations: Grouping multiple coupled equations (such as boundary conditions or system dynamics) with independent equation numbers for precise cross-referencing.
- Annotated derivations: Aligning mathematical operations alongside textual commentary or side conditions in adjacent columns.
- Unifying grouped relations: Displaying distinct equations stacked without vertical alignment points while sharing common numbering schemes.
Modern workflows that integrate LaTeX into reproducible research often pair equation typesetting with other markup patterns, such as LaTeX equation labels and cross-referencing, defining custom macros with \newcommand, or annotating expressions with underbrace and underset.
Install or access
The amsmath package is an essential component of the AMS-LaTeX collection and is included by default in all standard TeX distributions, including TeX Live, MacTeX, and MiKTeX. It is also pre-installed in cloud-based web LaTeX editors such as Overleaf.
Preamble configuration
To use multiline equation environments in your LaTeX document, declare the amsmath package in your document preamble (between documentclass{...} and egin{document}):
documentclass[11pt,a4paper]{article}
usepackage{amsmath}
usepackage{amssymb} % Optional: provides extended mathematical symbols
begin{document}
% Document content with multiline equations
end{document}
When compiling with modern engines (such as pdflatex, xelatex, or lualatex), no additional external binaries or package flags are required. The package is distributed under the LaTeX Project Public License (LPPL) version 1.3c.
Step-by-step task
Selecting the correct amsmath environment depends on whether you have a single equation spanning multiple lines or multiple distinct equations, and whether the lines require vertical alignment. Follow these step-by-step procedures for each standard research scenario.
1. Typesetting a single long equation across multiple lines using split
When you have one single equation that is too long for a single column and requires alignment at an equals sign, nest the split environment inside an equation environment. This generates exactly one vertically centered equation number for the entire block:
begin{equation}
label{eq:variational_bound}
begin{split}
ln p(x) &= int q(z) ln p(x, z) , dz - int q(z) ln q(z) , dz + D_{KL}(q(z) parallel p(z|x)) \
&ge mathbb{E}_{q}[ln p(x, z)] - mathbb{E}_{q}[ln q(z)] \
&= mathcal{L}(q)
end{split}
end{equation}
Key rules for split:
- Use an ampersand (
&) immediately before the relation operator where vertical alignment should occur. - Use a double backslash (
\) to terminate each line except the final line. - The
label{...}must be placed on the outerequationenvironment, not insidesplit.
2. Aligning multiple equations with independent numbers using align
When typesetting a system of multiple equations where each line represents a distinct statement requiring its own equation number, use the align environment:
begin{align}
nabla cdot mathbf{E} &= frac{rho}{varepsilon_0} label{eq:maxwell1} \
nabla cdot mathbf{B} &= 0 label{eq:maxwell2} \
nabla times mathbf{E} &= -frac{partial mathbf{B}}{partial t} label{eq:maxwell3} \
nabla times mathbf{B} &= mu_0 mathbf{J} + mu_0 varepsilon_0 frac{partial mathbf{E}}{partial t} label{eq:maxwell4}
end{align}
To suppress numbering on all lines, use the unnumbered variant align*. If you need numbers on most lines but want to omit a number on a specific intermediate derivation line, place notag (or nonumber) immediately before the line break:
begin{align}
f(x) &= (x + 2)^2 - 4 notag \
&= x^2 + 4x + 4 - 4 notag \
&= x^2 + 4x label{eq:final_simplified}
end{align}
3. Typesetting long unaligned expressions with multline
When an algebraic expression is too wide for one line and has no natural relation symbol or alignment point (such as a long polynomial summation), use the multline environment (or multline* for unnumbered):
begin{multline}
label{eq:polynomial_expansion}
P(x, y) = a_0 + a_1 x + a_2 y + b_{11} x^2 + b_{12} xy + b_{22} y^2 \
+ c_{111} x^3 + c_{112} x^2 y + c_{122} x y^2 + c_{222} y^3 \
+ d_{1111} x^4 + d_{1112} x^3 y + d_{2222} y^4 + mathcal{O}(|(x,y)|^5)
end{multline}
Under multline, the first line is positioned flush left, the final line is positioned flush right, and any intermediate lines are automatically centered. By default, the single equation number is set on the last line.
4. Stacking unaligned independent equations with gather
If you have several equations that should be stacked together without horizontal column alignment, use gather (or gather*). Each line is centered independently within the display column:
begin{gather}
E = mc^2 label{eq:mass_energy} \
int_{-infty}^{infty} e^{-x^2} , dx = sqrt{pi} label{eq:gaussian_int}
end{gather}
5. Aligning multiple columns with side-by-side explanations
The align environment also supports multiple horizontal equation columns. In multi-column displays, odd-numbered ampersands mark the alignment point within each column, and even-numbered ampersands separate consecutive columns:
begin{align}
x &= r costheta, & y &= r sintheta, & z &= z quad text{(cylindrical)} \
x &= rho sinphi costheta, & y &= rho sinphi sintheta, & z &= rho cosphi quad text{(spherical)}
end{align}
Output and how to read it
When compiling multiline equations in LaTeX, verify the rendered output against standard mathematical typography conventions:
- Alignment points: In
alignandsplit, the alignment tab&placed immediately before relation operators ensures that equal signs (=) or relation symbols align along an exact vertical axis. Operators retain standard binary relation spacing. - Equation numbering hierarchy: Confirm whether the mathematical logic requires line-by-line referencing or block-level referencing. A multi-step proof where readers must cite step 2 independently requires
alignwith line numbers. A single theorem statement broken across lines for page margins requiresequationwrapped aroundsplit. - Column margins and overflow: In two-column research articles, inspect the right margin for black overfull hbox slug warnings. If an equation line breaches the column margin, insert an additional line break
\and split the term before an additive operator (+or-). - Multi-page display breaks: LaTeX display math environments do not break across page boundaries by default. For extensive multi-page derivations, insert
displaybreakbefore the line break where a page split is acceptable, or enable global display breaks in the preamble usingallowdisplaybreaks[1].
Troubleshooting
The following table outlines common errors encountered when authoring multiline equations in LaTeX and their documented solutions from official AMS documentation:
| Error Message / Issue | Root Cause | Documented Fix |
|---|---|---|
! Paragraph ended before align was complete |
A blank line was included inside an align, gather, or multline environment. |
Remove all blank lines inside the math environment. Use \ for line breaks and comments (%) for visual spacing in source code. |
! Misplaced alignment tab character & |
An ampersand (&) was used inside an environment that does not support column alignment, such as multline or standard equation. |
Remove & from multline. If alignment is required, switch to align or wrap split inside equation. |
Overly wide spacing around = symbols |
Using the obsolete LaTeX eqnarray environment instead of align. |
Replace begin{eqnarray} with begin{align}. eqnarray applies hardcoded arraycolsep table spacing that violates mathematical standards. |
| Two equation numbers printed on one equation | Nesting align inside equation. |
Do not nest align within equation. To split a single numbered equation, nest split inside equation. |
Package amsmath Error: tag not allowed here |
Attempting to use tag{...} inside a subsidiary environment like split or aligned. |
Attach tag{...} or label{...} to the outer enclosing display environment (such as equation or align). |
Free alternatives
While LaTeX with amsmath remains the gold standard for formal mathematical and physical science research manuscripts, several modern open-source alternatives exist for drafting, web rendering, and preprint preparation:
| Tool / System | Multiline Equation Syntax | Best Research Use Case | License |
|---|---|---|---|
| LaTeX (amsmath) | begin{align} ... end{align}, split, multline |
Formal journal publication, thesis writing, arXiv preprints, camera-ready conference papers. | LPPL 1.3c |
| Typst | $ a &= b &= c $ |
Fast modern markup typesetting, technical reports, and emerging academic preprint authoring. | Apache 2.0 |
| MathJax / KaTeX | Subset of amsmath (supports align*, aligned, gathered) |
Web rendering of scientific content, interactive notebooks, and digital research portals. | Apache 2.0 / MIT |
| LibreOffice Math | newline operator, matrix alignment blocks |
Basic office documents and non-LaTeX institutional documentation. | MPL 2.0 |
| AsciiMath | Plain text expressions parsed into MathML | Lightweight web calculators, educational blogs, and markdown wikis. | MIT |
FAQ
When should I use split instead of align for a multiline equation in LaTeX?
Use split (wrapped inside an equation environment) when a single logical equation or derivation spans multiple lines and should receive exactly one equation number. Use align when typesetting multiple distinct equations or steps where each individual line requires its own referenceable equation number.
How do I break a long multiline equation in LaTeX without aligning symbols?
Use the multline environment (or multline* for unnumbered). In multline, the first line aligns to the left margin, intermediate lines are centered, and the final line aligns to the right margin, providing a balanced layout for long polynomials or expressions without an equality sign.
Why is eqnarray discouraged for multiline equations in LaTeX?
The legacy eqnarray environment uses TeX table formatting with arraycolsep spacing around the central column, producing unnaturally wide and inconsistent horizontal spaces around relation symbols. Furthermore, eqnarray handles line-breaking and equation numbers poorly, frequently causing number collisions that amsmath environments prevent.
How do I suppress equation numbers on specific lines in a multiline equation?
Inside an align, gather, or multline environment, place the command notag (or nonumber) immediately before the line-terminating double backslash (\) on any line you wish to remain unnumbered.
Can I allow page breaks inside multiline equations in LaTeX?
Yes. By default, LaTeX forbids page breaks inside display math environments. You can permit a page break at a specific line break by placing displaybreak before \, or enable automatic page breaks across an entire document by adding allowdisplaybreaks in your preamble.
Sources
- American Mathematical Society. (2020). User’s Guide for the amsmath Package (Version 2.1). The LaTeX Project. https://www.latex-project.org/help/documentation/amsldoc.pdf (read 2026-11-08).
- Overleaf. (2026). Aligning equations with amsmath. Overleaf Documentation. https://www.overleaf.com/learn/latex/Aligning_equations_with_amsmath (read 2026-11-08).
- Comprehensive TeX Archive Network (CTAN). (2026). amsmath: AMS mathematical facilities for LaTeX. CTAN Package Repository. https://ctan.org/pkg/amsmath (read 2026-11-08).
- Knuth, D. E. (1984). The TeXbook. Addison-Wesley Professional; Lamport, L. (1994). LaTeX: A Document Preparation System (2nd ed.). Addison-Wesley.







