User’s Guide for the amsmath Package
(Version 2.0)
American Mathematical Society
1999/12/13
ii
CONTENTS
Contents
1 Introduction
2 Options for the amsmath package
3 Displayed equations
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1
. . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 Single equations
. . . . . . . . . . . . . . . . .
3.3 Split equations without alignment
3.4 Split equations with alignment
. . . . . . . . . . . . . . . . . . .
3.5 Equation groups without alignment . . . . . . . . . . . . . . . . .
3.6 Equation groups with mutual alignment . . . . . . . . . . . . . .
3.7 Alignment building blocks . . . . . . . . . . . . . . . . . . . . . .
3.8 Adjusting tag placement . . . . . . . . . . . . . . . . . . . . . . .
3.9 Vertical spacing and page breaks in multiline displays
. . . . . .
3.10 Interrupting a display . . . . . . . . . . . . . . . . . . . . . . . .
3.11 Equation numbering . . . . . . . . . . . . . . . . . . . . . . . . .
4 Miscellaneous mathematical features
4.1 Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Math spacing commands . . . . . . . . . . . . . . . . . . . . . . .
4.3 Dots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4 Nonbreaking dashes
. . . . . . . . . . . . . . . . . . . . . . . . .
4.5 Accents in math . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6 Roots
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.7 Boxed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.8 Over and under arrows . . . . . . . . . . . . . . . . . . . . . . . .
4.9 Extensible arrows . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.10 Affixing symbols to other symbols
. . . . . . . . . . . . . . . . .
4.11 Fractions and related constructions . . . . . . . . . . . . . . . . .
4.12 Continued fractions . . . . . . . . . . . . . . . . . . . . . . . . . .
4.13 Smash options
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.14 Delimiters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5 Operator names
5.1 Defining new operator names . . . . . . . . . . . . . . . . . . . .
5.2 \mod and its relatives . . . . . . . . . . . . . . . . . . . . . . . . .
6 The \text command
1
2
3
3
3
5
5
6
6
7
8
8
9
9
10
10
11
11
12
12
13
13
13
13
13
14
15
15
15
17
17
18
18
CONTENTS
7 Integrals and sums
7.1 Multiline subscripts and superscripts . . . . . . . . . . . . . . . .
7.2 The \sideset command . . . . . . . . . . . . . . . . . . . . . . .
7.3 Placement of subscripts and limits
. . . . . . . . . . . . . . . . .
7.4 Multiple integral signs . . . . . . . . . . . . . . . . . . . . . . . .
8 Commutative diagrams
9 Using math fonts
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1
9.2 Recommended use of math font commands
. . . . . . . . . . . .
9.3 Bold math symbols . . . . . . . . . . . . . . . . . . . . . . . . . .
9.4
Italic Greek letters . . . . . . . . . . . . . . . . . . . . . . . . . .
10 Error messages and output problems
10.1 General remarks
. . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2 Error messages . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.3 Warning messages
. . . . . . . . . . . . . . . . . . . . . . . . . .
10.4 Wrong output . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11 Additional information
11.1 Converting existing documents
. . . . . . . . . . . . . . . . . . .
11.2 Technical notes . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3 Getting help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.4 Of possible interest . . . . . . . . . . . . . . . . . . . . . . . . . .
Bibliography
Index
iii
19
19
19
20
20
20
21
21
21
22
23
23
23
23
29
29
30
30
30
30
31
31
33
iv
CONTENTS
1
—1—
Introduction
The amsmath package is a LATEX package that provides miscellaneous enhance-
ments for improving the information structure and printed output of documents
that contain mathematical formulas. Readers unfamiliar with LATEX should refer
to [7]. If you have an up-to-date version of LATEX, the amsmath package is nor-
mally provided along with it. Upgrading when a newer version of the amsmath
package is released can be done via http://www.ams.org/tex/amsmath.html
or ftp://ftp.ams.org/pub/tex/.
This documentation describes the features of the amsmath package and dis-
cusses how they are intended to be used. It also covers some ancillary packages:
amsbsy
amscd
amsopn
amstext
amsxtra
These all have something to do with the contents of math formulas. For infor-
mation on extra math symbols and math fonts, see [1] and http://www.ams.
org/tex/amsfonts.html. For documentation of the amsthm package or AMS
document classes (amsart, amsbook, etc.) see [3] or [2] and http://www.ams.
org/tex/author-info.html.
If you are a long-time LATEX user and have lots of mathematics in what you
write, then you may recognize solutions for some familiar problems in this list
of amsmath features:
• A convenient way to define new ‘operator name’ commands analogous to
\sin and \lim, including proper side spacing and automatic selection of
the correct font style and size (even when used in sub- or superscripts).
• Multiple substitutes for the eqnarray environment to make various kinds
of equation arrangements easier to write.
• Equation numbers automatically adjust up or down to avoid overprinting
on the equation contents (unlike eqnarray).
• Spacing around equals signs matches the normal spacing in the equation
environment (unlike eqnarray).
• A way to produce multiline subscripts as are often used with summation
or product symbols.
• An easy way to substitute a variant equation number for a given equation
instead of the automatically supplied number.
• An easy way to produce subordinate equation numbers of the form (1.3a)
(1.3b) (1.3c) for selected groups of equations.
The amsmath package is distributed together with some small auxiliary pack-
ages:
amsmath Primary package, provides various features for displayed equations and
other mathematical constructs.
2
2. OPTIONS FOR THE AMSMATH PACKAGE
amstext Provides a \text command for typesetting a fragment of text inside
a display.
amsopn Provides \DeclareMathOperator for defining new ‘operator names’ like
\sin and \lim.
amsbsy For backward compatibility this package continues to exist but use of
the newer bm package that comes with LATEX is recommended instead.
amscd Provides a CD environment for simple commutative diagrams (no support
for diagonal arrows).
amsxtra Provides certain odds and ends such as \fracwithdelims and \ac-
centedsymbol, for compatibility with documents created using version
1.1.
The amsmath package incorporates amstext, amsopn, and amsbsy. The fea-
tures of amscd and amsxtra, however, are available only by invoking those
packages separately.
—2—
Options for the amsmath package
The amsmath package has the following options:
centertags (default) For a split equation, place equation numbers vertically
centered on the total height of the equation.
tbtags ‘Top-or-bottom tags’: For a split equation, place equation numbers level
with the last (resp. first) line, if numbers are on the right (resp. left).
sumlimits (default) Place the subscripts and superscripts of summation sym-
bols above and below, in displayed equations. This option also affects
other symbols of the same type—,,,, and so forth—but exclud-
ing integrals (see below).
nosumlimits Always place the subscripts and superscripts of summation-type
symbols to the side, even in displayed equations.
intlimits Like sumlimits, but for integral symbols.
nointlimits (default) Opposite of intlimits.
namelimits (default) Like sumlimits, but for certain ‘operator names’ such as
det, inf, lim, max, min, that traditionally have subscripts placed under-
neath when they occur in a displayed equation.
nonamelimits Opposite of namelimits.
To use one of these package options, put the option name in the optional ar-
gument of the \usepackage command—e.g., \usepackage[intlimits]{amsmath}.
The amsmath package also recognizes the following options which are nor-
mally selected (implicitly or explicitly) through the \documentclass command,
and thus need not be repeated in the option list of the \usepackage{amsmath}
statement.
3.2. SINGLE EQUATIONS
3
leqno Place equation numbers on the left.
reqno Place equation numbers on the right.
fleqn Position equations at a fixed indent from the left margin rather than
centered in the text column.
—3—
Displayed equations
Introduction
3.1
The amsmath package provides a number of additional displayed equation struc-
tures beyond the ones provided in basic LATEX. The augmented set includes:
equation
gather
multline
split
equation*
gather*
multline*
align
flalign
alignat
align*
flalign*
alignat*
(Although the standard eqnarray environment remains available, it is better to
use align or equation+split instead.)
Except for split, each environment has both starred and unstarred forms,
where the unstarred forms have automatic numbering using LATEX’s equation
counter. You can suppress the number on any particular line by putting \notag
before the \\; you can also override it with a tag of your own using \tag{label},
where label means arbitrary text such as $*$ or ii used to “number” the
equation. There is also a \tag* command that causes the text you supply to
be typeset literally, without adding parentheses around it. \tag and \tag*
can also be used within the unnumbered versions of all the amsmath alignment
structures. Some examples of the use of \tag may be found in the sample files
testmath.tex and subeqn.tex provided with the amsmath package.
The split environment is a special subordinate form that is used only inside
one of the others. It cannot be used inside multline, however.
In the structures that do alignment (split, align and variants), relation
symbols have an & before them but not after—unlike eqnarray. Putting the
& after the relation symbol will interfere with the normal spacing; it has to go
before.
3.2 Single equations
The equation environment is for a single equation with an automatically gen-
erated number. The equation* environment is the same except for omitting
the number.1
1Basic LATEX doesn’t provide an equation* environment, but rather a functionally equiv-
alent environment named displaymath.
4
3. DISPLAYED EQUATIONS
Table 3.1. Comparison of displayed equation environments (vertical lines in-
dicating nominal margins)
\begin{equation*}
a=b
\end{equation*}
\begin{equation}
a=b
\end{equation}
\begin{equation}\label{xx}
\begin{split}
a& =b+c-d\\
& \quad +e-f\\
& =g+h\\
& =i
\end{split}
\end{equation}
\begin{multline}
a+b+c+d+e+f\\
+i+j+k+l+m+n
\end{multline}
\begin{gather}
a_1=b_1+c_1\\
a_2=b_2+c_2-d_2+e_2
\end{gather}
\begin{align}
a_1& =b_1+c_1\\
a_2& =b_2+c_2-d_2+e_2
\end{align}
\begin{align}
a_{11}& =b_{11}&
a_{12}& =b_{12}\\
a_{21}& =b_{21}&
a_{22}& =b_{22}+c_{22}
\end{align}
\begin{flalign*}
a_{11}& =b_{11}&
a_{12}& =b_{12}\\
a_{21}& =b_{21}&
a_{22}& =b_{22}+c_{22}
\end{flalign*}
(1)
(2)
a = b
a = b
a = b + c − d
+ e − f
= g + h
= i
(3) a + b + c + d + e + f
+ i + j + k + l + m + n
(4)
(5)
(6)
(7)
(8)
(9)
a1 = b1 + c1
a2 = b2 + c2 − d2 + e2
a1 = b1 + c1
a2 = b2 + c2 − d2 + e2
a11 = b11
a21 = b21
a12 = b12
a22 = b22 + c22
a11 = b11
a21 = b21
a12 = b12
a22 = b22 + c22