Latex Mathmode (PDFDrive)
Latex Mathmode (PDFDrive)
20
Herbert Voß∗
October 9, 2006
Abstract
It is often said that TEX was designed for mathematical or technical
purposes. This may be true when we remember the reasons why
Donald Knuth created TEX. But nowadays there are many examples in
which TEX is used for publications with no mathematical or technical
background content. However, writing publications with such material
is one of the important advantages of TEX. Because it seems impossible
to know all existing macros and options of (LA)TEX and the several
additional packages, especially of AMSmath. This is the reason why
I have attempted to gather all the relevant facts in this paper. An
advanced german version of this paper is available as a book [25].
∗
Thanks for the feedback to: Hendri Adriaens; Alexander Boronka; Walter Brown;
Christian Faulhammer; José Luis Gómez Dans; Zongbao Fang; Azzam Hassam; Henning
Heinze; Martin Hensel; Morten Høgholm; M. Kalidoss; Dan Lasley; Angus Leeming; Tim
Love; Dan Luecking; Hendrik Maryns; Heinz Mezera; David Neuway; Joachim Punter; Carl
Riehm; Will Robertson; Christoph Rumsmüller; José Carlos Santos; Arnaud Schmittbuhl;
Rainer Schöpf; Jens Schwaiger; Uwe Siart; Martin Sievers; Heiko Stamer; Uwe Stöhr;
Carsten Thiel; Juan Luis Varona; David Weenink; Philipp Wook; Michael Zedler; Zou
Yuan-Chuan; and last but not least a special thanks to Monika Hattenbach for her excellent
job of proofreading.
1
CONTENTS CONTENTS
Contents
Page
I Standard LATEX math mode 10
1 Introduction 10
2 The Inlinemode 10
2.1 Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2 Fraction command . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3 Math in Chapter/Section Titles . . . . . . . . . . . . . . . . . 11
2.4 Equation numbering . . . . . . . . . . . . . . . . . . . . . . . 12
2.5 Framed math . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.6 Linebreak . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.7 Whitespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.8 AMSmath for the inline mode . . . . . . . . . . . . . . . . . . 13
3 Displaymath mode 13
3.1 equation environment . . . . . . . . . . . . . . . . . . . . . . 13
3.2 eqnarray environment . . . . . . . . . . . . . . . . . . . . . . 14
3.2.1 Short commands . . . . . . . . . . . . . . . . . . . . . 15
3.3 Equation numbering . . . . . . . . . . . . . . . . . . . . . . . 16
3.3.1 Changing the style . . . . . . . . . . . . . . . . . . . . 16
3.3.2 Resetting a counter style . . . . . . . . . . . . . . . . . 16
3.3.3 Equation numbers on the left side . . . . . . . . . . . 17
3.3.4 Changing the equation number style . . . . . . . . . . 17
3.3.5 More than one equation counter . . . . . . . . . . . . 17
3.4 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.5 Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4 array environment 20
4.1 Cases structure . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.2 arraycolsep . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5 Matrix 22
7 Roots 25
Mathmode.tex 2
CONTENTS CONTENTS
8 Brackets, braces . . . 26
8.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
8.1.1 Braces over several lines . . . . . . . . . . . . . . . . . 28
8.1.2 Middle bar . . . . . . . . . . . . . . . . . . . . . . . . 29
8.2 New delimiters . . . . . . . . . . . . . . . . . . . . . . . . . . 29
8.3 Problems with parentheses . . . . . . . . . . . . . . . . . . . . 30
10 Font commands 31
10.1 Old-style font commands . . . . . . . . . . . . . . . . . . . . . 31
10.2 New-style font commands . . . . . . . . . . . . . . . . . . . . 31
11 Space 31
11.1 Math typesetting . . . . . . . . . . . . . . . . . . . . . . . . . 31
11.2 Additional horizontal spacing . . . . . . . . . . . . . . . . . . 33
11.3 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
11.4 Dot versus comma . . . . . . . . . . . . . . . . . . . . . . . . 34
11.5 Vertical whitespace . . . . . . . . . . . . . . . . . . . . . . . . 35
11.5.1 Before/after math expressions . . . . . . . . . . . . . . 35
11.5.2 Inside math expressions . . . . . . . . . . . . . . . . . 36
12 Styles 38
13 Dots 39
14 Accents 39
14.1 Over- and underbrackets . . . . . . . . . . . . . . . . . . . . . 40
14.1.1 Use of \underbracket{...} . . . . . . . . . . . . . . . 41
14.1.2 Overbracket . . . . . . . . . . . . . . . . . . . . . . . . 41
14.2 Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
16 Operators 43
17 Greek letters 44
18 Pagebreaks 45
19 \stackrel 45
20 \choose 46
Mathmode.tex 3
CONTENTS CONTENTS
22 Boldmath 47
22.1 Bold math titles and items . . . . . . . . . . . . . . . . . . . . 48
23 Multiplying numbers 48
24 Other macros 49
II AMSmath package 50
25 align environments 51
25.1 The default align environment . . . . . . . . . . . . . . . . . 52
25.2 alignat environment . . . . . . . . . . . . . . . . . . . . . . . 53
25.3 flalign environment . . . . . . . . . . . . . . . . . . . . . . . 54
25.4 xalignat environment . . . . . . . . . . . . . . . . . . . . . . 55
25.5 xxalignat environment . . . . . . . . . . . . . . . . . . . . . 56
25.6 aligned environment . . . . . . . . . . . . . . . . . . . . . . . 56
25.7 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
26 Other environments 57
26.1 gather environment . . . . . . . . . . . . . . . . . . . . . . . 57
26.2 gathered environment . . . . . . . . . . . . . . . . . . . . . . 57
26.3 multline environment . . . . . . . . . . . . . . . . . . . . . . 59
26.4 split environment . . . . . . . . . . . . . . . . . . . . . . . . 61
26.5 Specials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
26.6 cases environment . . . . . . . . . . . . . . . . . . . . . . . . 63
26.7 Matrix environments . . . . . . . . . . . . . . . . . . . . . . . 64
27 Vertical whitespace 65
28 Dots 65
29 fraction commands 66
29.1 Standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
29.2 Binoms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
30 Roots 68
30.1 Roots with \smash command . . . . . . . . . . . . . . . . . . 68
31 Accents 68
32 \mod command 69
33 Equation numbering 69
33.1 Subequations . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Mathmode.tex 4
CONTENTS CONTENTS
35 Limits 71
35.1 Multiple limits . . . . . . . . . . . . . . . . . . . . . . . . . . 72
35.2 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
35.3 \sideset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
36 Operator names 74
38 Extensible arrows 77
39 Frames 78
40 Greek letters 79
41 Miscellaneous commands 79
43 Length registers 82
43.1 \abovedisplayshortskip . . . . . . . . . . . . . . . . . . . . 82
43.2 \abovedisplayskip . . . . . . . . . . . . . . . . . . . . . . . 82
43.3 \belowdisplayshortskip . . . . . . . . . . . . . . . . . . . . 82
43.4 \belowdisplayskip . . . . . . . . . . . . . . . . . . . . . . . 82
43.5 \delimiterfactor . . . . . . . . . . . . . . . . . . . . . . . . 82
43.6 \delimitershortfall . . . . . . . . . . . . . . . . . . . . . . 83
43.7 \displayindent . . . . . . . . . . . . . . . . . . . . . . . . . 83
43.8 \displaywidth . . . . . . . . . . . . . . . . . . . . . . . . . . 84
43.9 \mathsurround . . . . . . . . . . . . . . . . . . . . . . . . . . 84
43.10\medmuskip . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
43.11\mkern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
43.12\mskip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
43.13\muskip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
43.14\muskipdef . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
43.15\nonscript . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
43.16\nulldelimiterspace . . . . . . . . . . . . . . . . . . . . . . 85
43.17\predisplaysize . . . . . . . . . . . . . . . . . . . . . . . . . 85
43.18\scriptspace . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Mathmode.tex 5
CONTENTS CONTENTS
43.19\thickmuskip . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
43.20\thinmuskip . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
43.21\medmuskip . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
45 Math macros 90
45.1 \above . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
45.2 \abovewithdelims . . . . . . . . . . . . . . . . . . . . . . . . 91
45.3 \atop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
45.4 \atopwithdelims . . . . . . . . . . . . . . . . . . . . . . . . . 91
45.5 \displaylimits . . . . . . . . . . . . . . . . . . . . . . . . . 91
45.6 \eqno . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
45.7 \everydisplay . . . . . . . . . . . . . . . . . . . . . . . . . . 92
45.8 \everymath . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
45.9 \left . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
45.10\leqno . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
45.11\limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
45.12\mathinner . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
45.13\nolimits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Mathmode.tex 6
CONTENTS CONTENTS
45.14\over . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
45.15\overline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
45.16\overwithdelims . . . . . . . . . . . . . . . . . . . . . . . . . 93
45.17\radical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
45.18\right . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
45.19\underline . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
45.20\vcenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
46 Math penalties 94
46.1 \binoppenalty . . . . . . . . . . . . . . . . . . . . . . . . . . 94
46.2 \displaywidowpenalty . . . . . . . . . . . . . . . . . . . . . 94
46.3 \postdisplaypenalty . . . . . . . . . . . . . . . . . . . . . . 95
46.4 \predisplaypenalty . . . . . . . . . . . . . . . . . . . . . . . 95
46.5 \relpenalty . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
IV Other packages 96
50 Palatino 110
Mathmode.tex 7
CONTENTS CONTENTS
52 cmbright 111
53 minion 111
55 Harpoons 113
60 Matrix 117
60.1 Identity matrix . . . . . . . . . . . . . . . . . . . . . . . . . . 117
60.2 System of linear equations . . . . . . . . . . . . . . . . . . . . 117
60.3 Matrix with comments on top . . . . . . . . . . . . . . . . . . 118
62 Arrays 119
62.1 Quadratic equation . . . . . . . . . . . . . . . . . . . . . . . . 120
62.2 Vectors and matrices . . . . . . . . . . . . . . . . . . . . . . . 121
62.3 Cases with (eqn)array environment . . . . . . . . . . . . . . . 121
62.4 Arrays inside arrays . . . . . . . . . . . . . . . . . . . . . . . 122
62.5 Colored cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
62.6 Boxed rows and columns . . . . . . . . . . . . . . . . . . . . . 124
Mathmode.tex 8
CONTENTS CONTENTS
64 Integrals 128
Bibliography 140
Index 142
Mathmode.tex 9
2 THE INLINEMODE
Part I
Standard LATEX math mode
1 Introduction
The following sections describe all the math commands which are available
without any additional package. Most of them also work with special packages
and some of them are redefined. At first some important facts for typesetting
math expressions.
2 The Inlinemode
As the name says this are always ´ b math expressions which are in a standard
textline, like this one: f (x) = a sinx x dx. There are no limitations for the
height of the math expressions, so that the layout may be very lousy
if you
a b c
insert a big matrix in an inline mode like this: A = d e f . In this
g h i
a b c
case it is better to use the \smallmatrix environment A = d e f from the
g h i
AMSmath package (see section 26.7 on page 64) or the displaymath mode
(section 3 on page 13).
This inline mode is possible with three different commands:
1. \( ... \) , the problem is that \( is not a robust macro (see sec- \(...\)
tion 2.3 on the following page).
2. $ ... $ $...$
Mathmode.tex 10
2.1 Limits 2 THE INLINEMODE
2.1 Limits
In the inline mode the limits are by default only in super or subscript mode
and 1
´ ∞ 1the fractions are always in the scriptstyle font size. For example:
1 x2 dx = 1, which is not too big for the textline. You can change this \limits
with the command \limits, which must follow a math operator2 like an \int
integral (\int), a sum (\sum), a product (\prod) or a limes (\lim). But this \lim
´∞ 1 \prod
x2
dx = 1 does not look very nice in a text line when it appears between \sum
1
two lines, especially when there are multiline limits.3
All commands which appear in positions like contents, index, header, ... must
be robust5 which is the case for $...$ but not for \(...\). If you do not
have any contents, index, a.s.o. you can write the mathstuff in \chapter,
\section, a.s.o without any restriction. Otherwise use \protect\( and
\protect\) or the $...$ version.
The whole math expression appears in the default font shape and not in
bold like the other text. Section 22.1 on page 48 describes how the math
expressions can be printed also in bold. \texorpdfstring
1
See section 12 on page 38.
2
To define a new operator see page 74
3
For more information about limits see section 6.1 on page 24 or section 35 on page 71.
4
For an abbreviation see section 29 on page 66, there is a special \dfrac macro.
5
robust means that the macro is not expanded before it is moved into for example the
tableofcontents file (*.toc). No robustness is often a problem, when a macro is part of
another macro.
Mathmode.tex 11
2.4 Equation numbering 2 THE INLINEMODE
There are problems with the hyperref package when there is no text
part in a title. It is possible with the command \texorpdfstring to tell
hyperref to use different commands, one for the title and another one for
the bookmarks:
1 \ fboxsep = 3 pt
2 \ fboxrule = .4 pt
Qn 1
The same is possible with the \colorbox f (x) = i=1 i− 2i from the
color package.
2.6 Linebreak
LATEX can break an inline formula only when a relation symbol (=, <, >, . . .)
or a binary operation symbol (+, −, . . .) exists and at least one of these
symbols appears at the outer level of a formula. Thus $a+b+c$ can be broken
across lines, but ${a+b+c}$ not.
• The same inside a group {...}: f (x) = an xn + an−1 xn−1 + an−2 xn−2 + . . . + ai xi + a2 x2 + a1 x1 +
Mathmode.tex 12
2.7 Whitespace 3 DISPLAYMATH MODE
If it is not possible to have any mathsymbol, then split the inline formula
in two or more pieces ($...$ $...$). If you do not want a linebreak for the
whole document, you can set in the preamble:
\relpenalty=9999
\binoppenalty=9999
2.7 Whitespace
LATEX defines the length \mathsurround with the default value of 0pt. This
length is added before and after an inlined math expression (see table 1).
´∞ 1
1 foo \ fbox {$ f ( x ) =\ int _1^{\ infty }\ frac {1}{ x
foo f (x) = 1 x2
dx = 1 bar ^2}\ ,\ mathrm { d } x =1 $} bar
3 Displaymath mode
This means, that every formula gets its own paragraph (line). There are some
differences in the layout to the one from the title of 2.3.
1 \ begin { equation }
n 2 f ( x ) =\ prod _{ i =1}^{ n }\ left (i -\ frac
Y 1 {1}{2 i }\ right )
f (x) = i− (1)
2i 3 \ end { equation }
i=1
Mathmode.tex 13
3.2 eqnarray environment 3 DISPLAYMATH MODE
2. \[...\]. (see above) the short form of a displayed formula, no number \[...\]
n
Y 1
f (x) = i−
2i
i=1
3. \begin{equation}...\end{equation} \begin{equation}
...
n
Y 1 \end{equation}
f (x) = i− (2)
2i
i=1
(a) There is only one equation number for the whole environment. \nonumber
(b) There exists no star-version of the equation environment because
\[. . . \] is the equivalent. With the tag \nonumber it is possible
to suppress the equation number:
1 \ begin { equation }
2 f ( x ) = [...] \ nonumber
f (x) = [...] 3 \ end { equation }
1 \ begin { eqnarray *}
2 \ mathrm { left } & \ mathrm { middle } & \
left middle right mathrm { right }\\
√ 3 \ frac {1}{\ sqrt { n }}= & \ frac {\ sqrt { n
1 n n
√ = n =
√ }}{ n }= & \ frac { n }{ n \ sqrt { n }}
n n n 4 \ end { eqnarray *}
Mathmode.tex 14
3.2 eqnarray environment 3 DISPLAYMATH MODE
1 \ begin { eqnarray }
2 y & = & d \ label { eq :2}\\
y = d (3) 3 y & = & cx + d \\
y = cx + d (4) 4 y & = & bx ^{2}+ cx + d \\
5 y & = & ax ^{3}+ bx ^{2}+ cx +
y = bx2 + cx + d (5) d \ label { eq :5}
y = ax3 + bx2 + cx + d (6) 6 \ end { eqnarray }
Toggling numbering off/on for all rows is possible with the starred version
of eqnarray.
1 \ begin { eqnarray *}
2 y & = & d \ label { eq :3}\\
y = d 3 y & = & cx + d \\
y = cx + d 4 y & = & bx ^{2}+ cx + d \\
5 y & = & ax ^{3}+ bx ^{2}+ cx + d \
y = bx2 + cx + d label { eq :4}
y = ax3 + bx2 + cx + d 6 \ end { eqnarray *}
Toggling off/on for single rows is possible with the above mentioned
\nonumber tag at the end of a row (before the newline command). For
example:
1 \ begin { eqnarray }
2 y & = & d \ nonumber \\
y = d 3 y & = & cx + d \ nonumber \\
y = cx + d 4 y & = & bx ^{2}+ cx + d \
nonumber \\
y = bx2 + cx + d 5 y & = & ax ^{3}+ bx ^{2}+ cx + d
3 2 \ end { eqnarray }
y = ax + bx + cx + d (7) 6
Mathmode.tex 15
3.3 Equation numbering 3 DISPLAYMATH MODE
Mathmode.tex 16
3.3 Equation numbering 3 DISPLAYMATH MODE
7
CTAN://macros/latex/unpacked/leqno.sty
Mathmode.tex 17
3.4 Labels 3 DISPLAYMATH MODE
1 \ begin { align }
2 f ( x ) &= \ int \ sin x \ ,\ mathrm { d } x \ label { eq :
arab 1}\\
ˆ 3 g ( x ) &= \ int \ frac {1}{ x }\ ,\ mathrm { d } x
f (x) = sin x dx (9) 4 \ end { align }
ˆ 5 %
1 6 \ setroem
g(x) = dx (10)
x 7 %
8 \ begin { align }
9 F ( x ) &= -\ cos x \\
F (x) = − cos x (i) 10 G ( x ) &=\ ln x \ label { eq : rom 1}
11 \ end { align }
G(x) = ln x (ii) 12 %
13 \ setarab
14 %
f 0 (x) = sin x (11) 15 \ begin { align }
1 16 f ^{\ prime } ( x ) &= \ sin x \\
g 0 (x) = (12) 17 g ^{\ prime } ( x ) &= \ frac {1}{ x }\ label { eq :
x arab 2}
18 \ end { align }
There can be references to these equations in the usual way, like eq.9, 12
and for the roman one eq.ii.
3.4 Labels
Every numbered equation can have a label to which a reference is possible.
• There is one restriction for the label names, they cannot include one of
LATEX’s command characters.8
• The label names are replaced by the equation number.
\tag
If you do not want a reference to the equation number but to a self defined
name then use the AMSmath command \tag..., which is described in
section 34 on page 71.
3.5 Frames
Similiar to the inline mode, displayed equations can also be framed with
the \fbox command, like equation 13. The only difference is the fact, that
the equation must be packed into a parbox or minipage. It is nearly the
same for a colored box, where the \fbox{...} has to be replaced with
\colorbox{yellow}{...}. The package color.sty must be loaded and
–important – the calc package to get a correct boxwidth.
ˆ ∞
1
f (x) = 2
dx = 1 (13)
1 x
8
$_ˆ\&%{}
Mathmode.tex 18
3.5 Frames 3 DISPLAYMATH MODE
f (x) = x2 + x (14)
f (x) = x2 + x (15)
f (x) = x2 + x (16)
f (x) = x2 + x (17)
Mathmode.tex 19
4 ARRAY ENVIRONMENT
If you are using the AMSmath package, then try the solutions from
section 39 on page 78.
4 array environment
\begin{array}
This is simply the same as the eqnarray environment only with the possibility ...
of variable rows and columns and the fact, that the whole formula has \end{array}
only one equation number and that the array environment can only be
part of another math environment, like the equation environment or the
displaymath environment. With @{} before the first and after the last colomn
the additional space \arraycolsep is not used, which maybe important when
using left aligned equations.
a) y = c (constant)
b) y = cx + d (linear)
Polynomes (18)
c) y = bx2 + cx + d (square)
d) y = ax3 + bx2 + cx + d (cubic)
1 \ begin { equation }
2 \ left . %
3 \ begin { array }{ @ {} r@ {\ quad } ccrr@ {}}
4 \ textrm { a }) & y & = & c & ( constant ) \\
5 \ textrm { b }) & y & = & cx + d & ( linear ) \\
6 \ textrm { c }) & y & = & bx ^{2}+ cx + d & ( square ) \\
7 \ textrm { d }) & y & = & ax ^{3}+ bx ^{2}+ cx + d & ( cubic )
8 \ end { array } %
9 \ right \} \ textrm { Polynomes }
10 \ end { equation }
The horizontal alignment of the columns is the same as the one from the
tabular environment.
For arrays with delimiters see section 47.9 on page 103.
Mathmode.tex 20
4.2 arraycolsep 4 ARRAY ENVIRONMENT
1 \begin{equation}
2 x=\left\{ \begin{array}{cl}
3 0 & \textrm{if A=...}\\
4 1 & \textrm{if B=...}\\
5 x & \textrm{this runs with as much text as you like, but without an
raggeright text.}\end{array}\right.
6 \end{equation}
0 if A=...
x= 1 if B=...
x this runs with as much text as you like, but without an raggeright text.
(19)
It is obvious, that we need a \parbox if the text is longer than the possible
linewidth.
1 \begin{equation}
2 x = \left\{%
3 \begin{array}{l>{\raggedright}p{.5\textwidth}}%
4 0 & if A=...\tabularnewline
5 1 & if B=...\tabularnewline
6 x & \parbox{0.5\columnwidth}{this runs with as much text as you like
, %
7 because an automatic linebreak is given with %
8 a raggedright text. Without this %
9 \raggedright command, you’ll get a formatted %
10 text like the following one ... but with a parbox ... it works}
11 \end{array}%
12 \right. %
13 \end{equation}
0 if A=...
1 if B=...
this runs with as much text as you
like, because an automatic linebreak is
x= (20)
given with a raggedright text.
x
Without this command, you’ll get a
formatted text like the following one
... but with a parbox ... it works
4.2 arraycolsep
\arraycolsep
All the foregoing math environments use the array to typeset the math
expression. The predefined separation between two columns is the length
\arraycolsep|, which is set by nearly all document classes to 5pt, which
seems to be too big. The following equation is typeset with the default value
and the second one with \arraycolsep=1.4pt
ˆ
sin x
f (x) = dx
x
Mathmode.tex 21
5 MATRIX
ˆ
sin x
f (x) = dx
x
If this modification should be valid for all arrays/equations, then write
it into the preamble, otherwise put it into a group or define your own
environment as done in section 3.2.1 on page 15.
1 \ bgroup
2 \ arraycolsep =1.4 pt
3 \ begin { eqnarray }
4 f ( x ) & = & \ int \ frac {\ sin x }{ x }\ ,\ mathrm { d } x
5 \ end { eqnarray }
6 \ egroup
1 \ makeatletter
2 \ newcommand {\ be }{ %
3 \ begingroup
4 \ setlength {\ arraycolsep }{1.4 pt }
5 [ ... ]
5 Matrix
\begin{matrix}
TEX knows two macros and LATEX one more for typesetting a matrix: ...
\end{matrix}
1 $\begin{matrix} \bordermatrix
A B C 2 A & B & C \\
d e f 3 d & e & f \\
4 1 & 2 & 3 \\
1 2 3 5 \end{matrix}$
1 $\bordermatrix{%
0 1 2 2 & 0 & 1 & 2 \cr
0 & A & B & C \cr
3
0 A B C
4 1 & d & e & f \cr
1 d e f 5 2 & 1 & 2 & 3 \cr
2 1 2 3 6 }$
The first two macros are listed here for some historical reason, because
the array environment or especially the AMSmath package offers the same
or better macros/environments. Nevertheless it is possible to redefine the
\bordermatrix macro to get other parentheses and a star version which takes
the left top part as matrix:
1 $\bordermatrix{%
1 2 2 & 1 & 2 \cr
1 & x1 & x2 \cr
3
1 x1 x2
4 2 & x3 & x4 \cr
2 x3 x4 5 3 & x5 & x6
3 x5 x6 6 }$
Mathmode.tex 22
5 MATRIX
1 $\bordermatrix[{[]}]{%
1 2 2 & 1 & 2 \cr
1 & x1 & x2 \cr
3
1 x1 x2
4 2 & x3 & x4 \cr
2 x3 x4 5 3 & x5 & x6
3 x5 x6 6 }$
1 $\bordermatrix[\{\}]{%
1 2 2 & 1 & 2 \cr
3 1 & x1 & x2 \cr
1 x1 x2
4 2 & x3 & x4 \cr
2 x3 x4 5 3 & x5 & x6
3 x5 x6
6 }$
1 $\bordermatrix*{%
2 x1 & x2 & 1 \cr
x1 x2 1 3 x3 & x4 & 2 \cr
x3 x4 2 4 x5 & x6 & 3 \cr
5 1 & 2
x5 x6 3 6 }$
1 2
1 $\bordermatrix*[{[]}]{%
2 x1 & x2 & 1 \cr
x1 x2 1 3 x3 & x4 & 2 \cr
x3 x4 2 4 x5 & x6 & 3 \cr
5 1 & 2
x5 x6 3 6 }$
1 2
1 $\bordermatrix*[\{\}]{%
2 x1 & x2 & 1 \cr
x1 x2 1 3 x3 & x4 & 2 \cr
x3 x4 2 4 x5 & x6 & 3 \cr
5 1 & 2
x5 x6 3 6 }$
1 2
There is now an optional argument for the parenthesis with () as the
default one. To get such a behaviour, write into the preamble:
1 \ makeatletter
2 \ newif \ if@borderstar
3 \ def \ bordermatrix {\ @ifnextchar *{ %
4 \ @borderstartrue \ @bordermatrix@i }{\ @borderstarfalse \ @bordermatrix@i
*} %
5 }
6 \ def \ @bordermatrix@i *{\ @ifnextchar [{\ @bordermatrix@ii }{\
@bordermatrix@ii [() ]}}
7 \ def \ @bordermatrix@ii [#1]#2{ %
8 \ begingroup
9 \ m@th \ @tempdima 8.75\ p@ \ setbox \ z@ \ vbox { %
10 \ def \ cr {\ crcr \ noalign {\ kern 2\ p@ \ global \ let \ cr \ endline }} %
11 \ ialign {$##$\ hfil \ kern 2\ p@ \ kern \ @tempdima & \ thinspace %
12 \ hfil $##$\ hfil && \ quad \ hfil $##$\ hfil \ crcr \ omit \ strut %
13 \ hfil \ crcr \ noalign {\ kern -\ baselineskip }#2\ crcr \ omit %
Mathmode.tex 23
6 SUPER/SUBSCRIPT AND LIMITS
14 \ strut \ cr }} %
15 \ setbox \ tw@ \ vbox {\ unvcopy \ z@ \ global \ setbox \ @ne \ lastbox } %
16 \ setbox \ tw@ \ hbox {\ unhbox \ @ne \ unskip \ global \ setbox \ @ne \ lastbox } %
17 \ setbox \ tw@ \ hbox { %
18 $\ kern \ wd \ @ne \ kern -\ @tempdima \ left \ @firstoftwo #1 %
19 \ if@borderstar \ kern 2 pt \ else \ kern -\ wd \ @ne \ fi %
20 \ global \ setbox \ @ne \ vbox {\ box \ @ne \ if@borderstar \ else \ kern 2\ p@ \ fi } %
21 \ vcenter {\ if@borderstar \ else \ kern -\ ht \ @ne \ fi %
22 \ unvbox \ z@ \ kern -\ if@borderstar 2\ fi \ baselineskip } %
23 \ if@borderstar \ kern -2\ @tempdima \ kern 2\ p@ \ else \ ,\ fi \ right \
@secondoftwo #1 $ %
24 }\ null \;\ vbox {\ kern \ ht \ @ne \ box \ tw@ } %
25 \ endgroup
26 }
27 \ makeatother
The matrix environment macro cannot be used together with the AMSmath
package, it redefines this environment (see section 26.7 on page 64).
• $a_{\max}: amin and amax . Both are predefined operators (see sec-
tion 16 on page 43).
Mathmode.tex 24
6.2 Problems 7 ROOTS
\shortstack
which is not the best solution because the space between the lines is too
big. The AMSmath package provides several commands for limits (section 35
on page 71) and the \underset and \overset commands (see section 41 on
page 79).
6.2 Problems
X
aij bjk cki (22)
1≤j≤p
1≤j≤q
1≤k≤r
1 \ begin { equation }
2 \ sum _{\ makebox [0 pt ]{$ %
3 {{\ scriptscript style 1\ le j \ le p \ atop { %
4 {1\ le j \ le q \ atop 1\ le k \ le r }}}} %
5 $}} a _{ ij } b _{ jk } c _{ ki }
6 \ end { equation }
7 Roots
The square root \sqrt is the default for LATEX and the n-th root can be
inserted with the optional parameter \sqrt[n]{...}. . \sqrt
√
\sqrt{x} x
√
3
\sqrt[3]{x} x
Mathmode.tex 25
8 BRACKETS, BRACES . . .
1 \begin{equation}
2 \sqrt{a}\,%
√ √ q 3 \sqrt{T}\,%
a T 2αkB1 T i (24) 4 \sqrt{2\alpha k_{B_1}T^i}\label{eq:root1}
5 \end{equation}
1 \begin{equation}\label{eq:root2}
q q q 2 \sqrt{a\vphantom{k_{B_1}T^i}}\,%
3 \sqrt{T\vphantom{k_{B_1}T^i}}\,%
a T 2αkB1 T i (25) 4 \sqrt{2\alpha k_{B_1}T^i}
5 \end{equation}
The typesetting looks much better, especially when the formula has
different roots in a row, like equation 24. Using AMSmath with the \smash
command9 gives some more possibilities for the typesetting of roots (see
section 30 on page 68).
Mathmode.tex 26
8 BRACKETS, BRACES . . .
1 \begin{align}
a
× × (26) 2 \biggl)\times \frac{a}{b} \times\biggr(
b 3 \end{align}
4 \begin{align}
a 5 \bigg)\times \frac{a}{b} \times\bigg(
× × (27) 6 \end{align}
b
1 3 1 $\bigg(\dfrac{1}{3}\bigg|\dfrac
{3}{4}\bigg)$
34
1 3 1 $\bigg(\dfrac{1}{3}\biggm|\dfrac
{3}{4}\bigg)$
34
Table 2: Difference between the default \bigg and the \biggm command
Mathmode.tex 27
8.1 Examples 8 BRACKETS, BRACES . . .
8.1 Examples
8.1.1 Braces over several lines
The following equation in the single line mode looks like
1 X
∆(fij f ij ) = 2 χij (σi − σj )2 + f ij ∇j ∇i (∆f ) + ∇k fij ∇k f ij + f ij f k [2∇i Rjk − ∇k Rij ]
2
i<j
(28)
and is too long for the text width and the equation number has to be placed
under the equation.11 With the array environment the formula can be split
in two smaller pieces:
X
1 ij χij (σi − σj )2 + f ij ∇j ∇i (∆f )+
2 ∆(fij f ) = 2 (29)
i<j
+∇k fij ∇k f ij + f ij f k [2∇i Rjk − ∇k Rij ]
X
1 ij
2 ∆(fij f ) =2 χij (σi − σj )2 + f ij ∇j ∇i (∆f )+
i<j ! (30)
+∇k fij ∇k f ij + f ij f k [2∇ i Rjk − ∇k Rij ]
11
In standard LATEX the equation and the number are printed one over the other for
too long formulas. Only AMSmath puts it one line over (left numbers) or under (right
numbers) the formula.
Mathmode.tex 28
8.2 New delimiters 8 BRACKETS, BRACES . . .
1 {\ arraycolsep =2 pt
2 \ begin { equation }
3 \ begin { array }{ rcl }
4 \ frac {1}{2}\ Delta ( f _{ ij } f ^{ ij }) & = & 2\ Bigg ({\
displaystyle
5 \ sum _{ i < j }}\ chi _{ ij }(\ sigma _{ i } -\ sigma _{ j }) ^{2}+ f ^{ ij } %
6 \ nabla _{ j }\ nabla _{ i }(\ Delta f ) +\\
7 & & +\ nabla _{ k } f _{ ij }\ nabla ^{ k } f ^{ ij }+ f ^{ ij } f ^{ k }[2
8 \ nabla _{ i } R _{ jk } -\ nabla _{ k } R _{ ij }]\ Bigg )
9 \ end { array }
10 \ end { equation }
11 }
Section 26.5 on page 63 shows another solution for getting the right size
for parentheses when breaking the equation in smaller pieces.
" ∞
µ X Re n
B(r, φ, λ) = Jn Pn (sφ)
r r
n=2
n
!#
Re n
X
+ (Cnm cos mλ + Snm sin mλ)Pnm (sφ)
r
m=1
1 \ begin { align *}
2 B (r ,\ phi ,\ lambda ) = & \ ,\ dfrac {\ mu }{ r }
3 \ Bigg [\ sum _{ n =2}^{\ infty } \ Bigg ( \ left ( \ dfrac { R _ e }{ r } \
right ) ^ n J _ nP _ n ( s \ phi ) \\
4 & +\ sum _{ m =1}^ n \ left ( \ dfrac { R _ e }{ r } \ right ) ^ n
5 ( C _{ nm }\ cos m \ lambda + S _{ nm }\ sin m \ lambda ) P _{ nm }( s \ phi ) \
Bigg ) \ Bigg ]
6 \ end { align *}
The character number 3E16 (decimal 62) from the cmex10 font is the
small thick vertical rule. Now the new delimiter \Norm can be used in the
usual way:
Mathmode.tex 29
8.3 Problems with parentheses 9 TEXT IN MATH MODE
∗BLA∗
1 $\left\Norm *BLA* \right\Norm$
∗BLA∗
2
∗BLU B∗
3 $\left\Norm \dfrac{*BLA*}{*BLUB*} \right\Norm$
The problem is that TEX controlls the height of the parenthesis with
\delimitershortfall and \delimiterfactor, with the default values
\delimitershortfall=5pt
\delimiterfactor=901
\delimiterfactor/1000 is the relative size of the parenthesis for a given
formula environment. They could be of \delimitershortfall too short.
These values are valid at the end of the formula, the best way is to set them
straight before the math environment or globally for all in the preamble.
{\delimitershortfall=-1pt
ˆ ˆ β
1
2 \[
F 0 (z)dz = F0 γ(t) ·γ 0 (t)dt
3 \int_\gamma F’(z) dz =\int_\alpha^\beta
γ α 4 F’\left(\gamma (t)\right)\cdot\gamma ’(t)dt
5 \]}
Mathmode.tex 30
11 SPACE
1 \ begin { eqnarray }
2 a + b + c + d + ef & = & g + h + i + j + k %
3 \ qquad \ textrm {\ parbox [ t ]{.25\ linewidth }{ %
4 this is a very long description of a formula } %
5 }
6 \ end { eqnarray }
10 Font commands
10.1 Old-style font commands
Should never be used, but are still present and supported by LATEX. The
default syntax for the old commands is
1 {\ XX test }
Table 4 shows what has to be replaced for the XX. The major difference to
the new style is that these \XX are toggling the actual math mode into the
“XX” one, whereas the new commands start a group which switches back to
the mode before at its end.
\bf test \cal T EST \it test \rm test \tt test
12
For more information see: http://www.tug.org/utilities/plain/cseq.html
13
see fontmath.ltx
Mathmode.tex 31
11.1 Math typesetting 11 SPACE
Command Test
default ABCDEF GHIJKLM N OP QRST U V W XY Z
abcdef ghijklmnopqrstuvwxyz
\mathfrak ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
\mathcala ABCDEFGHIJ KLMN OPQRST UVWX YZ
\mathsf ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
\mathbba ABCDEFGHIJKLMNOPQRSTUVWXYZ
\mathtt ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
\mathit ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
\mathrm ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
\mathbf ABCDEFGHIJKLMNOPQRSTUVWXYZ
\mathdsb
!#"$%'&)(+*-,
abcdefghijklmnopqrstuvwxyz
a Not available for lower letters. For mathcal exists a non free font for lower letters
(http://www.yandy.com)
b Needs package dsfont.sty
These lengths can have all glue and are used for the horizontal spacing
in math expressions where TEX puts spaces between symbols and operators.
The meaning of these different horizontal skips is shown in table 6. For a
better typesetting LATEX inserts different spaces between the symbols.
Mathmode.tex 32
11.2 Additional horizontal spacing 11 SPACE
\def\>{\mskip\medmuskip}
\def\;{\mskip\thickmuskip}
\def\!{\mskip-\thinmuskip}
In math mode there is often a need for additional tiny spaces between
di di
variables, e.g., L written with a tiny space between L and looks nicer:
dt dt
di
L . Table 7 shows a list of all commands for horizontal space which can be
dt
used in math mode. The “space” is seen “between” the boxed a and b. For
all examples a is \boxed{a} and b is \boxed{b}. The short forms for some
spaces may cause problems with other packages. In this case use the long \hspace
form of the commands. \hphantom
\kern
11.3 Problems
Using \hphantom in mathmode depends to on object. \hphantom reserves only
the space of the exact width without any additional space. In the following
Mathmode.tex 33
11.4 Dot versus comma 11 SPACE
This only works when the math symbol is a mathrel one, otherwise you
have to change the horizontal space to \medmuskip or \thinmuskip or to
use an empty group after the \hphantom command. For more informations
about the math objects look into fontmath.ltx or amssymb or use the \show
macro, which prints out the type of the mathsymbol, e.g., \show\rightarrow
with the output:
1 > \ rightarrow =\ mathchar "3221.
2 l .20 \ show \ rightarrow
14
CTAN://macros/latex/contrib/numprint/
Mathmode.tex 34
11.5 Vertical whitespace 11 SPACE
\DeclareMathSymbol{,}{\mathpunct}{letters}{"3B}
\DeclareMathSymbol{.}{\mathord}{letters}{"3A}
The short skips are used if the formula starts behind the end of the foregoing
last line. Only for demonstration the shortskips are set to 0pt in the following
examples and the normal skips to 20pt without any glue:
The line ends before. ˆ
sin x
f (x) = dx (35)
x
The line doesn’t end before the formula.
ˆ
sin x
f (x) = dx (36)
x
And the next line starts as usual with some text ...
15
Located in texmf/tex/latex/base/
16
CTAN:// macros/latex/contrib/was/
Mathmode.tex 35
11.5 Vertical whitespace 11 SPACE
1 \ a b o v e d i s p l a y s h o r t s k i p =0 pt
2 \ b e l o w d i s p l a y s h o r t s k i p =0 pt
3 \ abovedisplayskip =20 pt
4 \ belowdisplayskip =20 pt
5 \ noindent The line ends before .
6 \ begin { equation }
7 f ( x ) = \ int \ frac {\ sin x }{ x }\ ,\ mathrm { d } x
8 \ end { equation }
9 \ noindent The line doesn ’ t end before the formula .
10 \ begin { equation }
11 f ( x ) = \ int \ frac {\ sin x }{ x }\ ,\ mathrm { d } x
12 \ end { equation }
13 \ noindent And the next line starts as usual with some text
...
fleqn class
When using the fleqn classoption for left aligned equations the math option
environments equation and \[. . . \] are typeset as a list. This is the rea-
son why the vertical space is defined by the length registers for a list, es-
pecially \topsep, instead of \abovedisplayskip and \belowdisplayskip.
This doesn’t effect the eqnarray environment.
\newdimen\jot \jot=3pt
The following three formulas show this for the default value, \setlength\jot{0pt}
and \setlength\jot{10pt}.
y = d
y = d y = d
1 1 1
y = c +d y = c +d y = c +d
x x x
1 1 1
y = b 2 + cx + d y = b 2 + cx + d y = b + cx + d
x x x2
Mathmode.tex 36
12 STYLES
4 }{ %
5 \ i g n o re s p a c e s af t e r e n d %
6 }
\arraystretch
\arraystretch The vertical space between the lines for all math expressions
which contain an array environment can be changed with the command
\arraystretch, which is predefined as
\renewcommand\arraystretch{1}
\vskip Another spacing for single lines is possible with the \vskip macro:
1 \[
2 \begin{pmatrix}
3 0 & 1 & 1 & 0 & 0 & 1 \\
0 1 1 0 0 1
4 1 & 0 & 0 & 1 & 1 & 0 \\
1 0 0 1 1 0 5 \noalign{\vskip2pt}
1 6 0 & 1 & 1 & 0 & \dfrac{1}{\sqrt{2}} & 1\\
0 1 1 0 √ 1
2
7 \noalign{\vskip2pt}
1 0 1 0 1 0 8 1 & 0 & 1 & 0 & 1 & 0 \\
0 1 0 1 0 1 9 0 & 1 & 0 & 1 & 0 & 1 \\
10 \end{pmatrix}
11 \]
Package setspace To have all formulas with another vertical spacing, one
can choose the package setspace and redefining some of the math macros,
e.g.,
1 \ newcommand *\ Array [2][1]{\ setstretch {#1}\ array {#2}}
2 \ let \ endArray \ endarray
1 \[
2 \begin{Array}[2]{cc}
a= b 3 a =&b\\
4 a =&b\\
a= b 5 a =&b
6 \end{Array}
7 \]
a= b 8
9 text $\begin{Array}{cc}
10 a =&b\\
a= b
11 a =&b\\
text a = b text 12 a =&b
a= b 13 \end{Array}$ text
Mathmode.tex 37
12 STYLES
\scriptscriptstyle T ´ 1 dt
T ´
f (t)= 2π
sin ω
t f (t)= 2π 1 dt
sin ω
t
´
\textstyle f (t) = T 1
dt T
´ 1
2π sin ωt f (t) = dt
2π sin ωt
12 Styles
This depends on the environment in which they are used. An inline formula
has a default math fontsize called \textstyle, which is smaller than the \textstyle
one for a display formula (see section 3), which is called \displaystyle. \displaystyle
Beside this predefinition there are two other special fontstyles for math, \scriptstyle
\scriptstyle and \scriptscriptstyle. They are called “style” in difference \scripscriptstyle
to “size”, because they have a dynamic character, their real fontsize belongs to
the environment in which they are used. A fraction for example is by default
in scriptstyle when it is in an inline formula like this ab , which can be changed
a
to . This may be in some cases useful but it looks in general ugly because
b
the line spacing is too big. These four styles are predefined and together in a
logical relationship. It is no problem to use the other styles like large, \Large,
. . . outside the math environment. For example a fraction written with
\Huge:
a (\Huge$\frac{a}{b}$). This may cause some problems when
b
you want to write a displayed formula in another fontsize, because it also
affects the interline spacing of the preceding part of the paragraph. If you
end the paragraph, you get problems with spacing and page breaking above
the equations. So it is better to declare the font size and then restore the
baselines: ˆ 2 1
dx = 0.5 (37)
1 x2
1 \ makeatletter
2 \ newenvironment { smallequation }[1]{ %
3 \ skip@ =\ baselineskip
4 #1 %
5 \ baselineskip =\ skip@
Mathmode.tex 38
14 ACCENTS
6 \ equation
7 }{\ endequation \ i g n o re spacesafterend }
8 \ makeatother
9
10 \ begin { smallequation }{\ tiny }
11 \ int _1^2\ ,\ frac {1}{ x ^2}\ ,\ mathrm { d } x =0.5
12 \ end { smallequation }
If you use this the other way round for huge fontsizes, don’t forget to load
package exscale (see section 47.13 on page 105). Also see this section for
diffent symbol sizes.
13 Dots
\cdots
In addition to the above decorations there are some more different dots which \dots
are single commands and not by default over/under a letter. It is not easy \dotsb
to see the differences between some of them. Dots from lower left to upper \dotsc
. \dotsi
right are possible with \reflectbox{$\ddots$} . . \dotsm
\dotso
..
\cdots · · · \ddots . \dotsb · · · \dotsc . . . \dotsi · · · \ldots
. \vdots
\dotsm ··· \dotso ... \ldots ... \vdots ..
14 Accents
The letter “a” is only for demonstration. The table 10 shows all in standard
LATEX available accents and also the ones placed under a character. With
package amssymb it is easy to define new accents. For more information see
section 31 on page 68 or other possibilities at section 47.1 on page 96.
Mathmode.tex 39
14.1 Over- and underbrackets 14 ACCENTS
The letters i and j can be substituted with the macros \imath and \jmath
when an accents is placed over these letters and the dot should disappear:
...
~ı ($\vec{\imath}\ \dddot{\jmath}$).
Accents can be used in different ways, e.g., strike a single character with a
horizontal line like $\mathaccent‘-A$: A- or $\mathaccent\mathcode‘-A$:
− In section 47.7 on page 100 is a better solution for more than one character.
A.
x2 + 2x + 1 = f (x) (38)
| {z }
(x + 1)2
Mathmode.tex 40
14.2 Vectors 14 ACCENTS
using without any parameters gives the same values for thickness and height
as predefined for the \underbrace command.
1. $\underbracket{foo~bar}$ f oo bar
2. $\underbracket[2pt]{foo~bar}$ f oo bar
14.1.2 Overbracket
In addition to the underbracket an overbracket is also useful, which can be
used in more ways than \overbrace{...}. For example:
using without any parameters gives the same values for thickness and height
as predefined for the \overbrace command.
Mathmode.tex 41
14.2 Vectors 15 EXPONENTS AND INDICES
\vv{...} \overrightarrow{...}
#»
a →
−
a
#» −→
abc abc
#»
ı →
−
ı
#» →
−
Ax Ax
Table 11: Vectors with package esvec (in the right column the default one
from LATEX)
14.2 Vectors
Especially for vectors there is the package esvect17 package, which looks
better than the \overrightarrow, e.g.,
Look into the documentation for more details about the package esvect.
1 (( x ^2) ^3) ^4 =
2 {({( x ^2) }^3) }^4 =
3 {\ left ({\ left ( x ^2\ right ) }^3\ right ) }^4
For variables with both exponent and indice index the order is not
important, $a_1^2$ is exactly the same than $a^2_1$: a21 = a21 . By default
all exponents and indices are set as italic characters. It is possible to change
this behaviour to get upright characters. The following example shows this
for the indices.
1 $A_{abc_{xyz}123def}^{abc123def}aa$
2
3 \makeatletter
Aabc123def
abcxyz 123def aa 4 \catcode‘\_\active
5 \def_#1{\sb{\operator@font#1}}
Aabc123def
abcxyz 123def aa 6 \makeatother
7
8 $A_{abc_{xyz}123def}^{abc123def}aa$
17
CTAN://macros/latex/contrib/esvect/
Mathmode.tex 42
16 OPERATORS
16 Operators
They are written in upright font shape and are placed with some additional
space before and after for a better typesetting. With the AMSmath package it
is possible to define one’s own operators (see section 36 on page 74). Table 12
and 13 show a list of the predefined ones for standard LATEX.
` W V
\coprod U \bigvee T \bigwedge S
\biguplus ´ \bigcap ´ \bigcup Q
\intop P \int N \prod L
\sum J \bigotimes ¸ \bigoplus ¸
\bigodot F \ointop \oint
\bigsqcup \smallint ∫
The difference between \intop and \int is that the first one has by default
over/under limits and the second subscript/superscript limits. Both can be
changed with the \limits or \nolimits command. The same behaviour
happens to the \ointop and \oint Symbols.
For more predefined operator names see table 20 on page 98. It is easy to
define a new operator with
1 \ makeatletter
2 \ newcommand \ foo {\ mathop {\ operator@font foo }\ nolimits }
3 \ makeatother
Mathmode.tex 43
17 GREEK LETTERS
In this example \foo is defined with \nolimits, means that limits are placed
in superscript/subscript mode and not over under. This is still possible with
\limits in the definition or the equation:
2
\[ \foo\limits_1^2 = x^2 \]
foo = x2
1
17 Greek letters
The AMSmath package simulates a bold font for the greek letters, it writes
a greek character twice with a small kerning. The \mathbf{<character>}
doesn’t work with lower greek character. See section 40 on page 79 for the
\pmb macro, which makes it possible to print bold lower greek letters. Not
all upper case letters have own macro names. If there is no difference to
the roman font, then the default letter is used, e.g., A for the upper case
of α. Table 14 shows only those upper case letters which have own macro
names. Some of the lower case letters have an additional var option for an
alternative.
lower default upper default \mathbf \mathit
\alpha α
\beta β
\gamma γ \Gamma Γ Γ Γ
\delta δ \Delta ∆ ∆ ∆
\epsilon
\varepsilon ε
\zeta ζ
\eta η
\theta θ \Theta Θ Θ Θ
\vartheta ϑ
\iota ι
\kappa κ
\lamda λ \Lambda Λ Λ Λ
\mu µ
\nu ν
\xi ξ \Xi Ξ Ξ Ξ
\pi π \Pi Π Π Π
\varpi $
\rho ρ
\varrho %
\sigma σ \Sigma Σ Σ Σ
\varsigma ς
Mathmode.tex 44
19 \STACKREL
Bold greek letters are possible with the package bm (see section 47.5 on
page 99) and if they should also be upright with the package upgreek:
$\bm{\upalpha}, \bm{\upbeta} ... $ α, β...
A useful definition maybe:
1 \ usepackage { upgreek }
2 \ makeatletter
3 \ newcommand {\ bfgreek }[1]{\ bm {\ @nameuse { up #1}}}
4 \ makeatother
18 Pagebreaks
\allowdisplaybreaks
By default a displayed formula cannot have a pagebreak. This makes some
sense, but sometimes it gives a better typesetting when a pagebreak is
possible.
\allowdisplaybreaks
19 \stackrel
\stackrel puts a character on top of another one which may be important if
∧
a used symbol is not predefined. For example “ =” (\stackrel{\wedge}{=}).
The syntax is \stackrel
1 \ stackrel { top }{ base }
Mathmode.tex 45
21 COLOR IN MATH EXPRESSIONS
1 \ newcommand {\ eqdef }{ %
2 \ ensuremath { %
3 \ stackrel {\ mathrm { def }}{=} %
4 }%
5 }
With the \ensuremath command we can use the new \eqdef command in
text and in math mode, LATEX switches automatically in math mode, which
saves some keystrokes like the following command, which is written without
def
the delimiters ($...$) for the math mode = , only \eqdef with a space at
the end. In math mode together with another material it may look like
def
~x = (x1 , . . . , xn ) and as command sequence
1 $\ vec { x }\ eqdef \ left ( x _{1} ,\ ldots , x _{ n }\ right ) $
The fontsize of the top is one size smaller than the one from the base, but
it is no problem to get both the same size, just increase the top or decrease
the base.
20 \choose
\choose is like \atop with delimiters or like \frac without the fraction line
and also with delimiters. It is often used for binoms and has the following
syntax: \choose
1 { above \ choose below }
The two braces are not really important but it is safe to use them.
m+1 m m
= + (40)
n n k−1
1 {{ m +1 \ choose n }}={{ m \ choose n }}+{{ m \ choose k -1}}\ label { eq :
choose }
See section 29.2 on page 67 for the AMSmath equivalents and enhance-
ments.
\usepackage{color}
Mathmode.tex 46
22 BOLDMATH
22 Boldmath
\mathversion
Writing a whole formula in bold is possible with the command sequence \boldmath
\boldmath ... \unboldmath, which itself must be written in textmode (out- \unboldmath
side the formula) or with the command {\mathversion{bold} ... }.
X X
aij bjk cki aij bjk cki
1≤j≤p 1≤j≤p
1≤j≤q 1≤j≤q
1≤k≤r 1≤k≤r
1 \ boldmath
2 \[
3 \ sum _{ %
4 \ makebox [0 pt ]{$ %
5 {{\ scriptscriptstyle 1\ le j \ le p \ atop { %
6 {1\ le j \ le q \ atop 1\ le k \ le r }}}} %
7 $} %
8 } a _{ ij } b _{ jk } c _{ ki }
9 \]
10 \ unboldmath
The \mathversion macro defines a math style which is valid for all
following math expressions. If you want to have all math in bold then use
this macro instead of \boldmath. But it is no problem to put \mathversion
inside a group to hold the changes locally.
1 {\ mathversion { bold } %
2 \ begin { equation }
3 y ( x ) = ax ^3+ bx ^2+ cx + d
4 \ end { equation }}
Mathmode.tex 47
22.1 Bold math titles and items 23 MULTIPLYING NUMBERS
Single characters inside a formula can be written in bold with \mathbf, but
only in upright mode, which is in general not useful as shown in equation 43.
It is better to use package bm (see section 47.5 on page 99).
X
aij bjk cki (43)
1≤j≤p
1≤j≤q
1≤k≤r
22 Function f (x) = x2
This is y = f (x) Only a demonstration.
22 Function f (x) = x2
This is y = f (x) Only a demonstration.
23 Multiplying numbers
When the dot is used as the decimal marker as in the United States, the
preferred sign for the multiplication of numbers or values of quantities is a
cross (\times × ), not a half-high and centered dot (\cdot · ).
Mathmode.tex 48
24 OTHER MACROS
When the comma is used as the decimal marker as in Europe, the preferred
sign for the multiplication of numbers is the half-high dot. The multiplication
of quantity symbols (or numbers in parentheses or values of quantities in
parentheses) may be indicated in one of the following ways: ab, a · b, a × b.
For more information see “Nist Guide to SI Units -More on Printing and
Using Symbols and Numbers in Scientific and Technical Documents” 18 or the
German DIN 1304, Teil 1.
24 Other macros
\everymath
There are some other macros which are not mentioned in the foregoing text. \everydisplay
Here comes a not really complete list of these macros. \underline
\everymath puts the argument before any inlined math expression, e.g.,
\everymath{\small}.
\underline underlines a math expression and has to be used inside the math
mode. ˆ
F (x) = f (x) dx
18
http://physics.nist.gov/Pubs/SP811/sec10.html
Mathmode.tex 49
Part II
AMSmath package
In general the AMS packages are at least a collection of three different ones:
1. amsmath.sty
2. amssymb.sty
3. amsfonts.sty
In the following only the first one is described in detail.
The AMSmath has the following options:
To use one of these package options, put the option name in the optional
argument, e.g., \usepackage[intlimits]{amsmath}. The AMSmath also
recognises the following options which are normally selected (implicitly or
explicitly) through the documentclass command, and thus need not be
repeated in the option list of the \usepackage{amsmath} statement.
Mathmode.tex 50
25 ALIGN ENVIRONMENTS
All math environments are displayed ones, so there is no special inline math.
25 align environments
There are four different align environments, described in the following subsec-
tions. Their behaviour is shown in table 15. The symbolic code for all align
environments is:
1 \ begin { < name >}
2 < name > &= x & x &= x \\
3 < name > &= x & x &= x
4 \ end { < name >}
Table 15: Comparison between the different align environments with the
same code, where the first three can have an equation number
align = x x = x
align = x x = x
alignat = x x = x
alignat = x x = x
flalign = x x = x
flalign = x x = x
xalignat = x x = x
xalignat = x x = x
xxalignat = x x = x
xxalignat = x x = x
Mathmode.tex 51
25.1 The default align environment 25 ALIGN ENVIRONMENTS
by only one ampersand in two parts. In general the ampersand should be be-
fore the symbol to get the right spacing, e.g., y &= x. Compare the following
three equations, the second one has a wrong spacing.
y=x 1 y &= x
y =x 2 y =& x
3 y ={}& x
y=x
y=d (44)
y = cx + d (45)
y12 = bx2 + cx + d (46)
3 2
y(x) = ax + bx + cx + d (47)
• The align environment takes the whole horizontal space if you have
more than two columns:
Mathmode.tex 52
25.2 alignat environment 25 ALIGN ENVIRONMENTS
This means “align at several places” and is something like more than two
align environment side by side. Parameter is the number of the align
environments, which is not important for the user. The above last align
example looks like:
With the alignat environment one can easily align equations vertically
at more than one marker:
Mathmode.tex 53
25.3 flalign environment 25 ALIGN ENVIRONMENTS
As seen, the equations are not really left aligned, when they have only
one ampersand. In this case flalign has the same behaviour as the align
environment.
When there are more than one tabbing characters (&), then the equations
are really left aligned. This is also an easy way to get an equation with only
one ampersand left aligned, see equation II-63 below.
Mathmode.tex 54
25.4 xalignat environment 25 ALIGN ENVIRONMENTS
This environment can be used to mix centered and left aligned equations
without using the document wide valid option fleqn.
ˆ
1
f (x) = dx (II-62)
x2
ˆ
1
f (x) = dx (II-63)
x2
Equation II-63 is left aligned in fact of the second tabbing character &.
1 \ begin { align }\ label { eq : centered }
2 f ( x ) & = \ int \ frac {1}{ x ^2}\ ,\ mathrm { d } x
3 \ end { align }
4
5 \ begin { flalign }\ label { eq : leftaligned }
6 f ( x ) & = \ int \ frac {1}{ x ^2}\ ,\ mathrm { d } x &
7 \ end { flalign }
Another case is placing text left aligned, whereas the formulas should be
right aligned.
1 \ begin { flalign *}
2 && 12( x -1) +20( y -3) +14( z -2) &= 0\\
3 \ text { same as } && 6 x +10 y +7 z &= 0
4 \ end { flalign *}
Mathmode.tex 55
25.5 xxalignat environment 25 ALIGN ENVIRONMENTS
2x + 3 = 7 2x + 3 − 3 = 7 − 3
2x 4
2x = 4 = (II-66)
2 2
x=2
1 \ begin { equation }
2 \ begin { aligned }
3 2 x +3 &= 7 & 2 x +3 -3 &= 7 -3 \\
4 2x &= 4 & \ frac {2 x }2 &= \ frac 42\\
5 x &= 2
6 \ end { aligned }
7 \ end { equation }
25.7 Problems
When using one of the align environments, there should be no \\ at the end
of the last line, otherwise you’ll get another equation number for this “empty”
line:
Mathmode.tex 56
26 OTHER ENVIRONMENTS
1 \begin{align}
2x + 3 = 7 (II-67) 2 2x+3 &= 7\\
(II-68) 3 \end{align}
1 \begin{align}
2 2x+3 &= 7
2x + 3 = 7 (II-69) 3 \end{align}
26 Other environments
26.1 gather environment
\begin{gather}
This is like a multi line environment with no special horizontal alignment. ...
All rows are centered and can have an own equation number: \end{gather}
i11 = 0.25
1
i21 = i11 (II-72)
3
i31 = 0.33i22
Mathmode.tex 57
26.2 gathered environment 26 OTHER ENVIRONMENTS
1 \ begin { align }
2 \ rule {2 cm }{1 pt }
3 \ begin { gathered }
4 \ quad i _{11}=0.25\\
5 \ quad i _{21}=\ frac {1}{3} i _{11}\\
6 \ quad i _{31}=0.33 i _{22}
7 \ end { gathered }
8 \ rule {2 cm }{1 pt }
9 \ end { align }
The optional argument can be used for setting the vertical alignment
which is by default c (centered). It can also be t for top or b for bottom.
A=a
A=a B=b
A=a B=b C=c (II-73)
B=b C=c
C=c
1 \ begin { align }
2 \ rule {1 cm }{1 pt }
3 \ begin { gathered }[ t ]
4 \ quad A = a \\
5 \ quad B = b \\
6 \ quad C = c
7 \ end { gathered }
8 %
9 \ begin { gathered }[ c ]
10 \ quad A = a \\
11 \ quad B = b \\
12 \ quad C = c
13 \ end { gathered }
14 %
15 \ begin { gathered }[ b ]
16 \ quad A = a \\
17 \ quad B = b \\
18 \ quad C = c
19 \ end { gathered }
20 \ \ rule {1 cm }{1 pt }
21 \ end { align }
Mathmode.tex 58
26.3 multline environment 26 OTHER ENVIRONMENTS
1 \ begin { align }
2 \ begin { gathered }
3 [ A ]\ quad A = a \\
4 [ B ]\ quad B = b \\
5 [ C ]\ quad C = c
6 \ end { gathered }
7 \ end { align }
The [A] is completely ignored, which can be avoided by using the optional
argument [c] or at least an empty one directly after the \begin{gather}.
Another possibility is using the package empheq, which fixes this behaviour
by default.
[A] A = a
[B] B = b (II-75)
[C] C = c
1 \ begin { align }
2 \ begin { gathered }[]
3 [ A ]\ quad A = a \\
4 [ B ]\ quad B = b \\
5 [ C ]\ quad C = c
6 \ end { gathered }
7 \ end { align }
19
It is no typo, the name of the environment is multline, no missing i here!
Mathmode.tex 59
26.3 multline environment 26 OTHER ENVIRONMENTS
A = lim ∆x a2 + a2 + 2a∆x + (∆x)2
n→∞
+ a2 + 2 · 2a∆x + 22 (∆x)2
+ a2 + 2 · 3a∆x + 32 (∆x)2
+ ...
+ a2 + 2 · (n − 1)a∆x + (n − 1)2 (∆x)2
1 3
b − a3 (II-76)
=
3
x
x
x
x
x
x (II-77)
Figure 1: multline Alignment demo (the fourth row is shifted to the right
with \shoveright)
\multlinegap= \multlinegap=
10.0pt (II-78) 0.0pt (II-79)
Mathmode.tex 60
26.4 split environment 26 OTHER ENVIRONMENTS
The split environment is like the multline or array environment for equa-
tions longer than the column width. Just like the array environment and
in contrast to multline, split can only be used as part of another en-
vironment. split itself has no own numbering, this is given by the other
environment. Without an ampersand all lines in the split environment are
right-aligned and can be aligned at a special point by using an ampersand. In
difference to the aligned environment (section 25.6 on page 56), the split
environment permits more than one horizontal alignment.
It is important that the split environment has another behaviour when
used inside one of the “old” LATEX environments \[...\] or \begin{equation}
... \end{equation}, in this case more than one horizontal alignment tabs
are possible.
\[
\begin{split}
x \framebox[0.35\columnwidth]{x}\\
x \framebox[0.75\columnwidth]{x}\\
\framebox[0.65\columnwidth]{x}\\
x \framebox[0.95\columnwidth]{x}
x \end{split}
\]
\[
\begin{split}
~a = x \vec{a} = {}&\framebox[0.35\columnwidth]{x}\\
x &\framebox[0.75\columnwidth]{x}\\
&\framebox[0.65\columnwidth]{x}\\
x &\framebox[0.95\columnwidth]{x}
x \end{split}
\]
The following example shows the split environment as part of the
equation environment:
Mathmode.tex 61
26.4 split environment 26 OTHER ENVIRONMENTS
ˆ 1 ˆ 2
A1 = (f (x) − g(x)) dx + (g(x) − h(x)) dx
0 1
ˆ 1 ˆ 2
2 2
= (x − 3x) dx + (x − 5x + 6) dx
0 1
3 1 3 2
x 3 2 x 5 2
= − x + − x + 6x
(II-80)
3 2 0 3 2
1
1 3 8 20 1 5
= − + − + 12 − − + 6
3 2 3 2 3 2
7 14 23 7 5
= − + − = + = 2 FE
6 3 6 6 6
1 \ begin { equation }
2 \ begin { split }
3 A _{1} & = \ left | \ int _{0}^{1}( f ( x ) -g ( x ) ) \ ,\ mathrm { d } x \ right | +\ left |
4 \ int _{1}^{2}( g ( x ) -h ( x ) ) \ ,\ mathrm { d } x \ right | \\
5 & = \ left | \ int _{0}^{1}( x ^{2} -3 x ) \ ,\ mathrm { d } x \ right | +\ left |
6 \ int _{1}^{2}( x ^{2} -5 x +6) \ ,\ mathrm { d } x \ right | \\
7 & = \ left | \ frac { x ^{3}}{3} -\ frac {3}{2} x ^{2}\ right | _{0}^{1}+
8 \ left | \ frac { x ^{3}}{3} -
9 \ frac {5}{2} x ^{2}+6 x \ right | _{1}^{2}\\
10 & = \ left | \ frac {1}{3} -\ frac {3}{2}\ right | +\ left |
11 \ frac {8}{3} -\ frac {20}{2}+12 -
12 \ left ( \ frac {1}{3} -\ frac {5}{2}+6\ right ) \ right | \\
13 & = \ left | -\ frac {7}{6}\ right | +\ left | \ frac {14}{3} -\ frac {23}{6}
14 \ right | =\ frac {7}{6}+\ frac {5}{6}=2\ , \ textrm { FE }
15 \ end { split }
16 \ end { equation }
´ ´
1 2
A1 = 0 (f (x) − g(x)) dx + 1 (g(x) − h(x)) dx
´ ´
1 2
= 0 (x2 − 3x) dx + 1 (x2 − 5x + 6) dx
1 3 2
(II-81)
3
= x3 − 32 x2 + x3 − 52 x2 + 6x
1 3 08 20 1
= 3 − 2 + 3 − 2 + 12 − 13 − 52 + 6
= − 76 + 14 23 7 5
3 − 6 = 6 + 6 = 2 FE
Mathmode.tex 62
26.5 Specials 26 OTHER ENVIRONMENTS
1 X
∆(fij f ij ) = 2 χij (σi − σj )2 + f ij ∇j ∇i (∆f )+
2
i<j
+ ∇k fij ∇k f ij + f ij f k [2∇i Rjk − ∇k Rij ] (II-82)
1 X
∆(fij f ij ) = 2 χij (σi − σj )2 + f ij ∇j ∇i (∆f )+
2
i<j
1 \ begin { multline }
2 \ frac {1}{2}\ Delta ( f _{ ij } f ^{ ij }) =
3 2\ left (\ sum _{ i < j }\ chi _{ ij }(\ sigma _{ i } -
4 \ sigma _{ j }) ^{2}+ f ^{ ij }\ nabla _{ j }\ nabla _{ i }(\ Delta f ) +\ right .\\
5 \ left .+\ nabla _{ k } f _{ ij }\ nabla ^{ k } f ^{ ij }+
6 f ^{ ij } f ^{ k }\ left [2\ nabla _{ i } R _{ jk } -
7 \ nabla _{ k } R _{ ij }\ right ]\ vphantom {\ sum _{ i < j }}\ right )
8 \ end { multline }
Mathmode.tex 63
26.7 Matrix environments 26 OTHER ENVIRONMENTS
$x=\begin{cases}
0 & \text{if A=...}\\
1 & \text{if B=...}\\
x & \textrm{this runs with as much text as you like,
but without an automatic linebreak, it runs out
of page....}
\end{cases}$
0 if A=...
x = 1 if B=... (II-84)
x this runs with as much text as you like, but without a linebreak, it runs out of page....
In this case it is better to use a parbox for the text part with a flushleft
command for a better view.
0 if A=...
1 if B=...
x= this runs with as much text as (II-85)
x you like, but without an
automatic linebreak, it runs
out of page....
1 \ begin { equation }
2 x =\ begin { cases }
3 0 & \ text { if A =...}\\
4 1 & \ text { if B =...}\\
5 x & \ parbox {5 cm }{ %
6 \ flushleft %
7 this runs with as much text as you like ,
8 but without an automatic linebreak ,
9 it runs out of page ....} %
10 \ end { cases }
11 \ end { equation }
Mathmode.tex 64
28 DOTS
a b
a b a b
\Vmatrix
c
\Bmatrix \matrix
d
c d c d
a b a b a b
\vmatrix
c \bmatrix \pmatrix
d c d c d
\smallmatrix a b
c d
By default all cells have a centered alignment, which is often not the best
when having different decimal numbers or plus/minus values. Changing the
alignment to right (not for the smallmatrix) is possible with matrix
vmatrix
1 \ makeatletter
Vmatrix
2 \ def \ env@matrix {\ hskip -\ arraycolsep
3 \ let \ @ifnextchar \ new@ifnextchar bmatrix
4 \ array {*\ c@MaxMatrixCols r }} Bmatrix
5 \ makeatother pmatrix
smallmatrix
The special matrix environment smallmatrix, which decreases horizontal
and vertical space is typeset in scriptstyle. The smallmatrix environment
makes some sense in the inline mode to decrease the line height. For dots
over several columns look for \hdotsfor in the following section.
27 Vertical whitespace
See section 11.5 on page 35 for the lengths which control the vertical whites-
pace. There is no difference to AMSmath.
28 Dots
In addition to section 13 on page 39 AMSmath has two more commands for
dots: \dddot{...}23 and \ddddot{...}
...
$\dddot{y}$: y
....
$\ddddot{y}$: y
Another interesting dot command is \hdotsfor with the syntax:
1 \ hdotsfor [ < spacing factor >]{ < number of columns >}
With the spacing factor the width of the dots can be stretched or shrinked.
The number of columns allows a continuing dotted line over more columns.
Equation 86 shows the definition of a tridiagonal matrix.
23
already mentioned in section 14
Mathmode.tex 65
29 FRACTION COMMANDS
a11 a12 0 ... ... ... 0
a21 a22 a23 0 ... ... 0
0 a32 a33 a34 0 ... 0
.. .. .. .. .. .. ..
. . . . . . .
A=
.....................................................
(86)
.. .. .. .. .. .. ..
. . . . . . .
0 ... 0 an−2,n−3 an−2,n−2 an−2,n−1 0
0 ... ... 0 qn−1,n−2 an−1,n−1 an−1,n
0 ... ... ... 0 an,n−1 ann
1 \ begin { equation }
2 \ underline { A }=\ left [\ begin { array }{ ccccccc }
3 a _{11} & a _{12} & 0 & \ ldots & \ ldots & \ ldots & 0\\
4 a _{21} & a _{22} & a _{23} & 0 & \ ldots & \ ldots & 0\\
5 0 & a _{32} & a _{33} & a _{34} & 0 & \ ldots & 0\\
6 \ vdots & \ vdots & \ vdots & \ vdots & \ vdots & \ vdots & \ vdots \\
7 \ hdotsfor {7}\ cr \ vdots & \ vdots & \ vdots & \ vdots & \ vdots & \ vdots & \ vdots
\\
8 0 & \ ldots & 0 & a _{ n -2 ,n -3} & a _{ n -2 ,n -2} & a _{ n -2 ,n -1} & 0\\
9 0 & \ ldots & \ ldots & 0 & q _{ n -1 ,n -2} & a _{ n -1 ,n -1} & a _{ n -1 , n }\\
10 0 & \ ldots & \ ldots & \ ldots & 0 & a _{ n ,n -1} & a _{ nn }
11 \ end { array }\ right ]
12 \ end { equation }
29 fraction commands
29.1 Standard
Additional to the font size problem described in subsection 2.2 on page 11
AMSmath supports some more commands for fractions. The \frac command
described in [7], does no more exist in AMSmath.
where thickness can have any length with a valid unit like
2 +x+1
genfrac{}{}{1pt}{}{x^2+x+1}{3x-2} → x 3x−2
Mathmode.tex 66
29.2 Binoms 29 FRACTION COMMANDS
1
(87)
√ 1
2+
√ 1
3+
√ 1
4+
...
which looks with the default \frac command like
1
√ 1
(88)
2+ √
3+ √1
1
4+ ...
where the mathstyle decreases for every new level in the fraction. The
\cfrac command can be called with an optional parameter which
defines the placing of the nominator, which can be [l]eft, [r]ight or
[c]enter (the default - see equation 87):
1 1
√ 1 √ 1
2+ 2+
√ 1 √ 1
3+ 3+
√ 1 √ 1
4+ 4+
... ...
• \dfrac which takes by default the displaystyle, so that fractions in
1
inline mode have the same size than in display mode.
2
• \tfrac (vice versa to \dfrac) which takes by default the scriptstyle, so
that fractions in display mode have the same size than in inline mode.
2
3 \tfrac{2}{3}
2
\frac{2}{3}
3
29.2 Binoms
\binom
They are like fractions without a rule and its syntax is different to the \choose \dbinom
command from standard LATEX (see section 2.2 on page 11). AMSmath \tbinom
provides three different commands for binoms just like the ones for fractions.
Mathmode.tex 67
31 ACCENTS
30 Roots
The typesetting for roots is sometimes not the best. Some solutions for
better typesetting are described in section 7 on page 25 for standard LATEX. \leftroot
AMSmath has some more commands for the n-th root: \uproot
1 \ sqrt [\ leftroot { < number >}\ uproot { < number >} < root >]{ < ... >}
<number> indicates a value for the points24 of which the root can be adjusted
√
to the left and/or to the top, e.g., kn a ($\sqrt[k_n]{a}$) has a too deep
√
exponent, whereas kn a $\sqrt[\uproot{2}k_n]{a}$ looks nicer.
31 Accents
With the macro \mathaccent it is easy to define new accent types, for example
1 \ def \ dotcup {$\ mathaccent \ cdot \ cup $}
24
In PostScript units (bp – Big Points).
25
In latex.ltx \smash is defined without an optional argument.
Mathmode.tex 68
33 EQUATION NUMBERING
∪·
Overwriting of two symbols is also possible:
xyx
y
In this case the second symbol has to be shifted to the left for a length of
5mu (mu: math unit).
1 \ def \ c ur v ea rr o wl e ft ri g ht { %
2 \ ensuremath { %
3 \ mathaccent \ curvearrowright {\ mkern -5 mu \ curvearrowleft
}%
4 }%
5 }
For other possibilities to define new accents see section 47.1 on page 96.
32 \mod command
In standard LATEX the modulo command is not an operator, though it is
often used in formulas. AMSmath provides two (three) different commands
for modulo, which are listed in tabular 18.
• They all insert some useful space before and behind the mod-operator.
a\mod{nˆ2}=b → a mod n2 = b
a\pmod{nˆ2}=b → a (mod n2 ) = b
a\pod{nˆ2}=b → a (n2 ) = b
33 Equation numbering
See section 3.3 on page 16 for equation numbering. It is mostly the same, \numberwithin
only one command is new to AMSmath. If you want a numbering like “44”
then write either in the preamble or like this example anywhere in your doc:
1 \ numberwithin { equation }{ section }
From now on the numbering looks like equation 44 on page 52. For
the book-class you can get the same for chapters.
If you want to get rid of the parentheses then write in the preamble:
1 \ makeatletter
2 \ def \ tagform@ #1{\ maketag@@@ {\ ignorespaces #1\ unskip \
@@italiccorr }}
3 \ makeatother
Mathmode.tex 69
33.1 Subequations 33 EQUATION NUMBERING
33.1 Subequations
Amsmath supports this with the environment subequation. For example:
y=d 33.89a
y = cx + d 33.89b
2
y = bx + cx + d 33.89c
3 2
y = ax + bx + cx + d 33.89d
1 \ begin { subequations }
2 \ begin { align }
3 y & = d \\
4 y & = cx + d \\
5 y & = bx ^{2}+ cx + d \\
6 y & = ax ^{3}+ bx ^{2}+ cx + d
7 \ end { align }
8 \ end { subequations }
y=d (33.90-1)
y = cx + d (33.90-2)
2
y = bx + cx + d (33.90-3)
y = ax3 + bx2 + cx + d (33.90-4)
Mathmode.tex 70
35 LIMITS
1 \ begin { align }
2 f ( x ) & = a \ tag { linear }\ label { eq : linear }\\
3 g ( x ) & =\ ,\ mathrm { d } x ^{2}+ cx + b \ tag { quadratic }\ label { eq :
quadratic }\\
4 h ( x ) & =\ sin x \ tag *{ trigonometric }
5 \ end { align }
35 Limits
By default the sum/prod has the limits above/below and the integral at the
side. To get the same behaviour for all symbols which can have limits load
the package AMSmath in the preamble as
Mathmode.tex 71
35.1 Multiple limits 35 LIMITS
There exist also options for the vice versa (see page 50). See also section 41
for the additional commands \underset and \overset.
35.2 Problems
There are still some problems with limits and the following math expression.
For example:
X
X= Xij
1≤i≤j≤n
1 \[
2 X = \ sum _{1\ le i \ le j \ le n } X _{ ij }
3 \]
Mathmode.tex 72
35.3 \sideset 35 LIMITS
does not look nice because of the long limit. Using a \makebox also does not
really solve the problem, because \makebox is in TEX horizontal mode and
knows nothing about the appropriate math font size, because limits have a
smaller font size. It is better to define a \mathclap macro, similiar to the two
macros \llap and \rlap and uses the also new defined \mathclap macro:
1 \ def \ mathllap {\ mathpalette \ mathllapinternal }
2 \ def \ mathllapinternal #1#2{ %
3 \ llap {$\ mathsurround =0 pt #1{#2}$} % $
4 }
5 \ def \ clap #1{\ hbox to 0 pt {\ hss #1\ hss }}
6 \ def \ mathclap {\ mathpalette \ mathclapinternal }
7 \ def \ mathclapinternal #1#2{ %
8 \ clap {$\ mathsurround =0 pt #1{#2}$} %
9 }
10 \ def \ mathrlap {\ mathpalette \ mathrlapinternal }
11 \ def \ mathrlapinternal #1#2{ %
12 \ rlap {$\ mathsurround =0 pt #1{#2}$} % $
13 }
Now we can write limits which have a boxwidth of 0pt and the right font
size and the following math expression appears just behind the symbol:
X
X= Xij
1≤i≤j≤n
1 \[
2 X = \ sum _{\ mathclap {1\ le i \ le j \ le n }} X _{ ij }
3 \]
This case is not easy to handle when some other math expressions are
around the braces which should be on the same baseline. However, the
following may help in some cases to get better looking braces.
1 \begin{align}
"X # 2 foo \left[\begin{array}{@{}c@{}}
... 3 \displaystyle\sum_{\substack{i,j\\i>j}} \dots
f oo i,j
bar (35.3)
4 \end{array}\right] bar
i>j
5 \end{align}
35.3 \sideset
This is a command for a very special purpose, to combine over/under limits
with superscript/subscripts for the sum-symbol. For example: it is not \sideset
Mathmode.tex 73
36 OPERATOR NAMES
possible to place the prime for the equation 35.4 near to the sum symbol,
because it becomes an upper limit when writing without an preceeding {}.
X
0
nEn (35.4)
n<k
n odd
1 \[
2 \ sideset {_{ LowerLeft }^{ UpperLeft }}{_{ LowerRight }^{ UpperRight
}}\ sum _{ B }^{ T }
3 \]
Now it is possible to write the equation 35.4 in a proper way with the
command \sideset{}{’} before the sum symbol:
X0
nEn (35.5)
n<k
n odd
36 Operator names
\operatorname
By default variables are written in italic and operator names in upright mode,
like y = sin(x).26 This happens only for the known operator names, but
creating a new one is very easy with:
1 \ newcommand {\ mysin }{\ operatorname { mysin }}
Now \mysin is also written in upright mode y = mysin(x) and with some
additional space before and behind.
It is obvious, that only those names can be defined as new operator names
which are not commands in another way. Instead of using the new definition
as an operator, it is also possible to use the text mode. But it is better to
have all operators of the same type, so that changing the style will have an
effect for all operators. \operatornamewithlimi
The new defined operator names cannot have limits, only superscript/sub-
script is possible. amsopn.sty has an additional command \operatornamewithlimits,
which supports over/under limits like the one from \int or \sum. \mathop
26
See section 16 on page 43, where all the standard LATEX known operator names are
listed. Package AMSmath has some more (see documentation).
Mathmode.tex 74
37 TEXT IN MATH MODE
With this definition it is possible to use \sideset for a forgoing index, which
is only possible for an operator.
For a real LATEX definition have a look at section 16 on page 43.
Atext
text A text
text Atext
text A text
text
1 $\ boxed { f ( x ) = x \ quad \ text { this was math }}$
2
3 {\ sffamily \ huge
4 $ A ^{\ mbox { text }}_{\ mbox { text }}$\ quad
5 $ A ^{\ text { text }}_{\ text { text }}$\ quad
6 $ A ^{\ textnormal { text }}_{\ textnormal { text }}$\ quad
7 $ A ^{\ mathrm { text }}_{\ mathrm { text }}$
8 }
The \text macro can be used at any place and can be in some cases a
better solution as \intertext (see section 37.2).
Mathmode.tex 75
37.2 \intertext command 37 TEXT IN MATH MODE
1 \ begin { flalign *}
2 && 12( x -1) + 20( y -3) + 14( z -2) & = 0 &&\\
3 \ text { and } && 6 x + 10 y + 7 z & = 0 &&
4 \ end { flalign *}
5
6 \ begin { align }
7 && 12( x -1) + 20( y -3) + 14( z -2) & = 0\\
8 \ text { and } && 6 x + 10 y + 7 z & = 0
9 \ end { align }
ˆ 1 ˆ 2
A1 = (f (x) − g(x)) dx + (g(x) − h(x)) dx
0 1
ˆ 1 ˆ 2
2 2
= (x − 3x) dx + (x − 5x + 6) dx
0 1
1 \ begin { equation }
2 \ begin { split }
3 A _{1} & = \ left | \ int _{0}^{1}( f ( x ) -g ( x ) ) \ ,\ mathrm { d } x \ right | +\ left | \
int _{1}^{2}( g ( x ) -h ( x ) ) \ ,\ mathrm { d } x \ right | \\
4 & = \ left | \ int _{0}^{1}( x ^{2} -3 x ) \ ,\ mathrm { d } x \ right | +\ left | \
int _{1}^{2}( x ^{2} -5 x +6) \ ,\ mathrm { d } x \ right | \\
5 \ intertext { Now the limits of the integrals are used }
6 & = \ left | \ frac { x ^{3}}{3} -\ frac {3}{2} x ^{2}\ right | _{0}^{1}+\ left |
\ frac { x ^{3}}{3} -
7 \ frac {5}{2} x ^{2}+6 x \ right | _{1}^{2}\\
8 & = \ left | \ frac {1}{3} -\ frac {3}{2}\ right | +\ left | \ frac {8}{3} -\
frac {20}{2}+12 -
Mathmode.tex 76
38 EXTENSIBLE ARROWS
38 Extensible arrows
\xrightarrow
above the arrow
To write something like −−−−−−−−−−→ ubelow you can use the following macro \xleftarrow
\xmapsto
$\xrightarrow[\text{below}]{\text{above the arrow}}$
and the same with \xleftarrow. You can define your own extensible arrow
macros if you need other than these two predefined ones. To get a doublelined
extensible arrow like $\Longleftrightarrow$ (⇐⇒) but with the same
behaviour as an extensible one, write in the preamble
1 \ newcommand \ x Lo ng L ef t RightArrow [2][]{ %
2 \ ext@arrow 0055{\ L o n gL ef tR ig ht Ar ro wf il l@ }{#1}{#2}}
3 \ def \ L o n g L e f t R i g h t A r r o wf il l@ { %
4 \ arrowfill@ \ Leftarrow \ Relbar \ Rightarrow }
5 \ newcommand \ x lo ng l ef t rightarrow [2][]{ %
6 \ ext@arrow 0055{\ l o n gl ef tr ig ht ar ro wf il l@ }{#1}{#2}}
7 \ def \ l o n g l e f t r i g h t a r r o wf il l@ { %
8 \ arrowfill@ \ leftarrow \ relbar \ rightarrow }
Mathmode.tex 77
39 FRAMES
over
$\ext@arrow 0000$ 7−−−→ uunder
over
$\ext@arrow 9000$ 7−−−→ u under
over
$\ext@arrow 0900$ 7−−−→ uunder
over
$\ext@arrow 0009$ 7−−−−→ uunder
over
$\ext@arrow 0090$ 7−−−−→ uunder
over
$\ext@arrow 0099$ 7−−−−→ uunder
over
$\ext@arrow 9999$ 7−−−−→ u under
• 1st digit: space left
39 Frames
\boxed
AMSmath knows the macro \boxed which can be used for inline a b + c
and displayed math expressions:
ˆ ∞
1
f (x) = dt = 1 (39.1)
1 x2
1 \ begin { align }
2 \ boxed { f ( x ) =\ int _1^{\ infty }\ frac {1}{ x ^2}\ , dt =1}
3 \ end { align }
For coloured boxes use package empheq. For an example see section 47.10
on page 103.
Mathmode.tex 78
42 PROBLEMS WITH AMSMATH
40 Greek letters
\pmb
The AMSmath package simulates a bold font for the greek letters by writing
a greek character twice with a small kerning. This is done with the macro
\pmb{<letter>}. The \mathbf{<character>} doesn’t work with lower greek
character.
α α
β β
γ γ
δ δ
... ...
41 Miscellaneous commands
There are several commands which can be used in math mode: \overset
Some examples are shown in table 19. \underset
\boxed
$\underset{under}{baseline}$ baseline
under
over
$\overset{over}{baseline}$ baseline
Mathmode.tex 79
42 PROBLEMS WITH AMSMATH
m2 = m02 + m002
V20 V200
= + 00
v20 v2
v20
⇒ m2 v20 = V − V200 + V200
v200
m2 = m02 + m002
V20 V200
= + 00
v20 v2
v20
⇒ m2 v20 = V − V200 + V200
v200
1 \begin{gather*}
2 \begin{align*}
3 m_2 &= m_2’ + m_2’’\\
4 &= \frac{V_2’}{v_2’} + \frac{V_2’’}{v_2’’}
5 \end{align*}\\
6 \Rightarrow m_2 v_2’ = V - V_2’’ + V_2’’\frac{v_2’}{v_2’’}\\
7 \end{gather*}
8 \begin{gather*}
9 \begin{align*}
10 m_2 &= m_2’ + m_2’’\\
11 &= \frac{V_2’}{v_2’} + \frac{V_2’’}{v_2’’} & %<<<====
12 \end{align*}\\
13 \Rightarrow m_2 v_2’ = V - V_2’’ + V_2’’\frac{v_2’}{v_2’’}\\
14 \end{gather*}
This effect depends to the horizontal width, which is wrong in the first
example, in fact of a missing tag or number the right whitespace is cut, but
the left one is still there. The additional ampersand prevents AMSmath to
change the right margin.
Another kind of curiousity is the following example, which depends to
the same problem of cutting whitespace only on one side.
Mathmode.tex 80
42 PROBLEMS WITH AMSMATH
a=b
c=d
a=b
c=d
1 \fbox{%
2 \begin{minipage}{10cm}
3 \begin{align*}
4 a&=b \\ c&=d
5 \end{align*}
6 \end{minipage}}
7
8 \fbox{%
9 \begin{minipage}{10cm}
10 \noindent\begin{align*}
11 a&=b \\ c&=d
12 \end{align*}
13 \end{minipage}}
Mathmode.tex 81
43 LENGTH REGISTERS
Part III
TEX and math
There is in general no need to use the TEX macros, because the ones defined
with LATEX or with AMSmath are much more useful. Nevertheless there may
be situations, where someone has to use one of the TEX macros or special
TEX math length. One can not expect, that all macros work in the usual way,
a lot of them are redefined by LATEX or AMSmath. On the other hand some
of these basic macros or length definitions are used in the TEX way, so it
might be interesting to have all declared in a short way for some information.
43 Length registers
43.1 \abovedisplayshortskip
A length with glue, see section 11.5.1 for an example.
43.2 \abovedisplayskip
A length with glue, see section 11.5.1 for an example.
43.3 \belowdisplayshortskip
A length with glue, see section 11.5.1 for an example.
43.4 \belowdisplayskip
A length with glue, see section 11.5.1 for an example.
43.5 \delimiterfactor
The height of a delimiter is often not optimally calculated by TEX. In some
cases it is too short. With \delimiterfactor one can correct this height.
The delimiterheight is < calculated height > · < #1 > /1000 where #1 is the
parameter of \delimiterfactor. The default value is 901.
1 \[
2 y = \left\{%
2 3 \begin{array}{ll}
x + 2x if x < 0, 4 x^2+2x &\textrm{if }x<0,\\
3
x^3 &\textrm{if }0\le x<1,\\
x if 0 ≤ x < 1, 5
y= 6 x^2+x &\textrm{if }1\le x<2,\\
x2 + x if 1 ≤ x < 2, 7 x^3-x^2 &\textrm{if }2\le x.
3
x − x2 if 2 ≤ x. 8 \end{array}%
9 \right.
10 \]
Mathmode.tex 82
43.6 \delimitershortfall 43 LENGTH REGISTERS
1 \[
2 \delimiterfactor=1500
3 y = \left\{%
4 \begin{array}{ll}
x2 + 2x
if x < 0, 5 x^2+2x &\textrm{if }x<0,\\
3
x if 0 ≤ x < 1, 6 x^3 &\textrm{if }0\le x<1,\\
y=
x2 + x if 1 ≤ x < 2, 7 x^2+x &\textrm{if }1\le x<2,\\
x3 − x2 if 2 ≤ x. x^3-x^2 &\textrm{if }2\le x.
8
9 \end{array}%
10 \right.
11 \]
43.6 \delimitershortfall
Additionally to the forgoing \delimiterfactor one can modify the height
of the delimiter with another value. TEX makes the delimiter larger than
the values of < calculated height > · < delimiterfactor > /1000 and <
calculated height > − < delimitershortfall >. This makes it possible to
always get different heights of a sequence of delimiters.
1 $x\cdot\left(\left(x^2-y^2\right)-3\right)$\\[7
x · x2 − y 2 − 3
pt]
2
3 $
x· 2 2
x −y −3 4 \delimitershortfall-1pt
5 x\cdot\left(\left(x^2-y^2\right)-3\right)$
1 $\left(\left(\left(A\right)\right)\right)$\\[7pt]
(((A))) 2
3 $\delimitershortfall-1pt
(A) 4 \left(\left(\left(A\right)\right)\right)$
43.7 \displayindent
This is the left shift amount of a line holding displayed equation. By default
it is 0pt but gets the value of an indented paragraph when there is an
environment like the quotation one.
The following formula is typeset in the usual way without modifying
anything.
ˆ
sin x
f (x) = dx
x
Now we start a quotation environment which sets \labelwidth to new
values for a greater left margin.
Mathmode.tex 83
43.8 \displaywidth 43 LENGTH REGISTERS
• Now we write the same equation, but now with modifying displayindent,
it is set to the negative \labelwidth:
ˆ
sin x
f (x) = dx
x
1 \[
2 \ displayindent = -\ leftskip
3 f ( x ) = \ int \ frac {\ sin x }{ x }\ ,\ mathrm { d } x
4 \]
43.8 \displaywidth
The width of the line holding a displayed equation, which is by default
\linewidth. In the second example the formula is centered for a display
width of 0.5\linewidth.
ˆ
sin x
f (x) = dx
x
ˆ
sin x
f (x) = dx
x
1 \[ f ( x ) = \ int \ frac {\ sin x }{ x }\ ,\ mathrm { d } x \]
2 \[
3 \ displaywidth =0.5\ linewidth
4 f ( x ) = \ int \ frac {\ sin x }{ x }\ ,\ mathrm { d } x
5 \]
43.9 \mathsurround
Extra space added when switching in and out of the inline math mode (see
section 11.5).
43.10 \medmuskip
See section 11.1 for an example.
43.11 \mkern
Similiar to \kern, but adds a math kern item to the current math list. Length
must be a math unit.
43.12 \mskip
Similiar to \skip, but adds math glue to the current math list. Length must
be a math unit.
Mathmode.tex 84
43.13 \muskip 43 LENGTH REGISTERS
43.13 \muskip
Assigns a length with a math unit to one of the 256 \muskip register.
43.14 \muskipdef
Defines a symbolic name for a \muskip register.
43.15 \nonscript
Ignores immediately following glue or kern in script and scriptscript styles,
which makes a redefinition of \mathchoice superfluous.
43.16 \nulldelimiterspace
This is the width of a null or missing delimiter, e.g., \right. or for the left
one.
43.17 \predisplaysize
Is the effective width of the line preceeding a displayed equation, whether
\abovedisplayskip or abovedisplayshortskip is used for the vertical skip.
43.18 \scriptspace
The space inserted after an exponent or index, predefined as \scriptspace=0.5pt
43.19 \thickmuskip
See section 11.1.
43.20 \thinmuskip
The short version for positive skip is defined as \def\,{\mskip\thinmuskip}
and the one for a negative skip as \def\!{\mskip-\thinmuskip} (see also
section 11.1).
√ √
√ 2x – √2 x
1 $\sqrt 2 x$ -- $\sqrt 2\,x$\\
log x – log x 2 $\sqrt{\log x}$ -- $\sqrt{\,\log x}$\\
√ √ 3 $P\left({1/\sqrt n}\right)$ -- $P\left({1/ \
P (1/ n) – P (1/ n ) sqrt n}\,\right)$\\[8pt]
4 $[0,1)$ -- $[\,0,1)$\\
[0, 1) – [ 0, 1) 5 $x^2/2$ -- $x^2\!/2$\\
x2 /2 – x2/2
Mathmode.tex 85
43.21 \medmuskip 44 MATH FONT MACROS
43.21 \medmuskip
See section 11.1.
44.2 \delimiter
Every character can be declared as a delimiter, but TEX must know which
characters should be used for the default and the big size. For LATEX the
macro \DeclareMathDelimiter should be used (see section 8.2 on page 29).
In the following example \tdela is the character 0x22 (↑) from font
number 2 (csmy) and character 0x78 from font number 3 (cmex) for the big
version. \tdelb is the same vice versa (↓).
1 \def\tdela{\delimiter"4222378\relax}
↑x − y↓(x + y) = x2 − y 2 2 \def\tdelb{\delimiter"5223379\relax}
3
∞
X 1 2 4 $\tdela x-y\tdelb(x+y)=x^2-y^2$
↑ ↓ =4
2n 5
n=0 6 \[\tdela\sum_{n=0}^\infty {1\over2^n}\tdelb
2 ^2 = 4\]
∞
x
7
X 1
=4
8 \[\left\tdela\sum_{n=0}^\infty {1\over2^n}\
n
2 y
n=0 right\tdelb^2 = 4\]
44.3 \displaystyle
See section 12 for an example.
Mathmode.tex 86
44.4 \fam 44 MATH FONT MACROS
44.4 \fam
When TEX switches into the math mode, it typesets everything using one
of the 16 possible families of fonts. \fam in an internal register where other
macros can check which font is the actual one. At the beginning TEX starts
with \fam=-1.
\fam=-1 123abcABCαβγ
\fam=0 123abcABCfffifl
\fam=1 abcABCαβγ
\fam=2 ∞∈3abcABC
\fam=3 abc
\fam=4 123abcABC
\fam=5 123aABC
1 $\mathrm{123abcABC\alpha\beta\gamma (\the\fam)
}$\\[5pt]
123abcABCfffifl(0) 2 $\mathbf{123abcABC\alpha\beta\gamma (\the\fam)
123abcABCfffifl(13) }$\\[5pt]
3 $\mathit{123abcABC\alpha\beta\gamma (\the\fam)
123abcABCfffifl(14) }$\\[5pt]
4 $\mathtt{123abcABC\alpha\beta\gamma (\the\fam)
123abcABC↑↓'(15) }$\\[5pt]
5 $\mathsf{123abcABC\alpha\beta\gamma (\the\fam)
123abcABCαβγ(−1)
}$\\[5pt]
abcABCαβγ() 6 $\mathnormal{123abcABC\alpha\beta\gamma (\the\
fam)}$
44.5 \mathaccent
Requires three parameter as one number, the class, the font family and the
character.
1 \def\dA{\mathaccent"7015\relax}
Ă 2 {\Large $\dA{A}$}
44.6 \mathbin
Declares a following character as a binary symbol with another spacing before
and behind such a symbol.
1 {\Large
a|b a | b 2 $a|b \quad a\mathbin| b$}
44.7 \mathchar
Declares a math character by three integer numbers as Parameters, giving
its class, font family, and font position. In the following example \mathchar
Mathmode.tex 87
44.8 \mathchardef 44 MATH FONT MACROS
∞ ∞
X 1 {\Large
P
a b a b 2 $a\sum\limits_{i=1}^{\infty} b \quad
3 a\mathchar"1358\limits_{i=1}^{\infty} b$}
i=1 i=1
44.8 \mathchardef
This is in principle the same as \mathchar, it only allows to make such
definitions permanent.
∞ 1 \bgroup
X √ 2 \mathchardef\sum="1358
a i+1
3 $a\sum\limits_{i=1}^{\infty}\sqrt{i+1}$\\[5pt]
i=1
4 \egroup
∞ √
P 5
a i+1 6 $a\sum\limits_{i=1}^{\infty}\sqrt{i+1}$
i=1
44.9 \mathchoice
Specifies specific subformula sizes for the 4 main styles: \displaystyle –
\textstyle – \scriptstyle – \scriptscriptstyle.
1 \Large
2 \def\myRule{{%
3 \color{red}%
∞ √ 4 \mathchoice{\rule{2pt}{20pt}}{\rule{1pt}{10pt}}%
P i+1
i2 5 {\rule{0.5pt}{5pt}}{\rule{0.25pt}{2.5pt}}%
i=1 6 \mkern2mu}}
7 $\myRule\sum\limits_{\myRule i=1}^{\myRule\infty}%
8 \myRule\frac{\myRule\sqrt{\myRule i+1}}{\myRule i^2}$
44.10 \mathclose
Assigns class 5 (closing character) to the following parameter, which can hold
a single character or a subformula.
B 1 {\large
A: C
:D
2 $A:\frac{B}{C}:D$\\[5pt]
A: B
C
:D 3 $A\mathopen:\frac{B}{C}\mathclose: D $}
44.11 \mathcode
A math font is far different from a text font. A lot of the characters has
to be defined with \mathcode, which defines the character with its class,
font family and character number, e.g., \mathcode‘\<="313C. It defines the
character “<” as a realtion symbol (class 3) from the font family 1 and the
character number 0x3C, which is 60 decimal.
Mathmode.tex 88
44.12 \mathop 44 MATH FONT MACROS
44.12 \mathop
Assigns class 1 (large operator) to the parameter, which can be a single
character or a subformula.
A∞
i=1 1 \[ A_{i=1}^{\infty} \]
∞ 2 \[ \mathop{A}_{i=1}^{\infty} \]
A
i=1
44.13 \mathopen
Vice versa to \mathclose (see section 44.10).
44.14 \mathord
Assigns class 0 (ordinary character) to the following parameter, which can be
a single character or a subformula.
1 {\large
y = f (x) 2 $y = f(x)$\\[5pt]
y=f (x) 3 $y \mathord= f(x)$}
44.15 \mathpunct
Assigns class 6 (punctuation) to the following parameter, which can be a
single character or a subformula (see section 11.4 for an example).
44.16 \mathrel
Assigns class 3 (relation) to the following parameter, which can be a single
character or a subformula.
44.17 \scriptfont
Specifies the scriptstyle font (used for super/subscript) for a family.
1 $A_1$
2 \font\tenxii=cmr12
A1 A1 3 \scriptfont0=\tenxii
4 $A_1$
44.18 \scriptscriptfont
Specifies the scriptscriptstyle font for a family.
Mathmode.tex 89
44.19 \scriptscriptstyle 45 MATH MACROS
44.19 \scriptscriptstyle
Selects scriptscript style for the following characters.
44.20 \scriptstyle
Selects script style for the following characters.
44.21 \skew
Especially for italic characters double accents are often misplaced. \skew has
three arguments
horizontal shift: A value in math units for the additional shift of the accent.
the character: This is in general a single character, but can also include
itself an accent.
AMSmath redefines the setting of double accents. This is the reason why
there are only a few cases where someone has to use \skew when the package
amsmath is loaded, like in this document.
1 \large
ĩ Ã 2 $\tilde i$ \qquad $\tilde{A}$\\[5pt]
3 $\skew{3}{\tilde}{i}$ \qquad $\skew{7}{\tilde}{A}$
ĩ Ã
44.22 \skewchar
Is -1 or the character (reference symbol) used to fine-tune the positioning of
math accents.
44.23 \textfont
Specifies the text font for a family.
44.24 \textstyle
Selects the text style for the following characters.
45 Math macros
45.1 \above
Mathmode.tex 90
45.2 \abovewithdelims 45 MATH MACROS
a
b 1 $a\above0pt b$\\[8pt]
2
a
b 3 ${a\above1pt b}$\\[8pt]
4
a
5 ${a\above2.5pt b}$\\[8pt]
b
6
a 7 $\displaystyle{a\above0pt b}$
b
45.2 \abovewithdelims
1 $a\abovewithdelims()0pt b$\\[8pt]
a
2
b
a 3 \def\fdelimA{\abovewithdelims\{)1.0pt}
4 ${a\fdelimA b}$\\[8pt]
b
5
a
6 \def\fdelimB{\abovewithdelims[]2.0pt}
b 7 ${a\fdelimB b}$\\[8pt]
a 8
9 \def\fdelimC{\abovewithdelims\{.0pt}
b 10 $\displaystyle{a\fdelimC b}$
45.3 \atop
a
b 1 $a\atop b$\\[8pt]
2
( nk ) = n!
k!(n−k)! 3 $({n \atop k}) = {n!\above1pt k!(n-k)!}$\\[8pt]
4
a 5 $\displaystyle{a\atop b}$
b
45.4 \atopwithdelims
a
1 $a\atopwithdelims() b$\\[8pt]
b
2
n n!
k = k!(n−k)! 3 ${n \atopwithdelims() k} = {n!\above1pt k!(n-k)!}$\\[8pt
]
4
a
5 $\displaystyle{a\atopwithdelims\{. b}$
b
45.5 \displaylimits
Resets the conventions for using limits with operators to the standard for the
used environment.
Mathmode.tex 91
45.6 \eqno 45 MATH MACROS
45.6 \eqno
Puts an equation number at the right margin, the parameter can hold anything.
\eqno places only the parameter, but doesn’t increase any equation counter.
1 \[ y=f(x) \eqno{(A12)} \]
y = f (x) (A12)
45.7 \everydisplay
Inserts the parameter at the start of every switch to display math mode.
ˆ
sin x 1 \everydisplay{\color{red}
f (x) = dx
x 2 }
3 \[ f(x) = \int \frac{\sin x}{x}\,\mathrm{
ˆ 2 d}x \]
sin x 4 \[ g(x) = \int \frac{\sin^2 x}{x^2}\,\
g(x) = dx
x2 mathrm{d}x \]
45.8 \everymath
Same as \everydisplay, but now for the inline mode. In the following
example the displaystyle is used (besides using color red) for every inline
math expression.
ˆ 1 \everymath{\color{red}%
sin x
f (x) = dx 2 \displaystyle}
x 3 \[ f(x) = \int \frac{\sin x}{x}\,\
mathrm{d}x \]
sin x cos x 4 Instead of $\frac{\sin x}{x}$
Instead of now with :
xˆ x 5 now with $\frac{\cos x}{x}$:
cos x 6 \[ g(x) = \int \frac{\cos x}{x}\,\
g(x) = dx mathrm{d}x \]
x
Pay attention for side effects on footnotes and other macros which use
the math mode for superscript and other math related modes. In this case
you’ll get the footnotes also in red.
45.9 \left
TEX calculates the size of the following delimiter needed at the left side of a
formula. Requires an additional right.
45.10 \leqno
Vice versa to \eqno (see section 45.6).
45.11 \limits
Typesets limits above and/or below operators (see section 6 on page 24).
Mathmode.tex 92
45.12 \mathinner 45 MATH MACROS
45.12 \mathinner
Defines the following parameter as subformula.
45.13 \nolimits
The opposit of \limits, instead of above/below limits are placed to the right
of large operators (class 1).
45.14 \over
Is equivalent to the fraction macro of LATEX and equivalent to the \overwithdelims,
see section 45.16.
m
a n
b a+b 1 $ {a\over b} \qquad {{m\over n}\over{a+b}} $
m
n
2 \[ {m\over n}\over{a+b} \]
a+b
45.15 \overline
Puts a line over the following character or subformula and has the same
problems with different heights as underlines (see section 45.19).
1 $\overline{x}+\overline{y}=\overline{z}$\\
x+y =z 2 \let\ol\overline
x+A=z 3 $ \ol{x} + \ol{A} = \ol{z} $\\[5pt]
4 \def\yPh{\vphantom{A}}
x+A=z 5 $ \ol{x\yPh} + \ol{A} = \ol{z\yPh} $
45.16 \overwithdelims
Is a generalized fraction command with preset fraction bar thickness.
m
a
n 1 $ {a\overwithdelims() b} \qquad {{m\over n}\
b a+b
m overwithdelims[]{a+b}} $
n 2 \[ {m\over n}\overwithdelims\{.{a+b} \]
a+b
45.17 \radical
Makes a radical atom from the delimiter (27-bit number) and the math field.
Mathmode.tex 93
45.18 \right 46 MATH PENALTIES
q 1 \def\mySqrt{\radical"0270371\relax}
1
7 2 $ \mySqrt{\frac{1}{7}} $\\[5pt]
r 3
1 4 \def\mySqrt{\radical"0270372\relax}
7 5 $ \mySqrt{\frac{1}{7}} $\\[5pt]
s 6
1 7 \def\mySqrt{\radical"0270373\relax}
7 8 $ \mySqrt{\frac{1}{7}} $\\[5pt]
9
v
t 10 \def\mySqrt{\radical"0270374\relax}
1
7 11 $ \mySqrt{\frac{1}{7}} $\\[5pt]
45.18 \right
Opposite to \left, makes TEX calculate the size of the delimiter needed at
the right of a formula.
45.19 \underline
When there is a combination of variables with and without an index, the
underlines are typeset with a different depth. Using \vphantom in this case
is a good choice.
1 $\underline{x}+\underline{y}=\underline{z}$\\
2
x+y =z 3 \let\ul\underline
x+y =z 4 \def\yPh{\vphantom{y}}
5 $ \ul{x\yPh} + \ul{y} = \ul{z\yPh} $\\
x1 + y2 = z3
6
7 $ \ul{x_1} + \ul{y_2} = \ul{z_3} $
45.20 \vcenter
Centers vertical material with respect to the axis.
46 Math penalties
46.1 \binoppenalty
A penalty for breaking math expressions between lines in a paragraph. TeX
breaks lines only when the binary symbol is not the last one and when the
penalty is below 10,000.
46.2 \displaywidowpenalty
The penalty which is added after the penultimate line immediately preceeding
a display math formula.
Mathmode.tex 94
46.3 \postdisplaypenalty 46 MATH PENALTIES
46.3 \postdisplaypenalty
Is added immediately after a math display ends.
46.4 \predisplaypenalty
Is added immediately before a math display starts.
46.5 \relpenalty
The penalty for a line break after a relation symbol (if a break is possible).
Mathmode.tex 95
47 LIST OF AVAILABLE MATH PACKAGES
Part IV
Other packages
The following sections are not a replacement for the package documentation!
47.1 accents
If you want to write for example an underlined M, then you can do it by
\underline{$M$} M
\underbar{$M$} M
\underaccent{\bar}{M} M
¯
Mathmode.tex 96
47.2 amscd – commutative47diagrams
LIST OF AVAILABLE MATH PACKAGES
1 \[
2 \ begin { CD }
3 R \ times S \ times T @ >\ text { restriction } > > S \ times T \\
4 @VprojVV @VVprojV \\
5 R \ times S @ < <\ text { inclusion } < S
6 \ end { CD }
7 \]
47.3 amsopn
With the amsopn package it is very easy to declare new math operators, which
are written in upright mode:
Res versus Res
s=p s=p
47.4 bigdel
This is a very useful package together with the multirow package. In the
following example we need additional parentheses for a different number of
27
CTAN://macros/latex/required/amslatex/math/amscd.dtx
Mathmode.tex 97
47.4 bigdel 47 LIST OF AVAILABLE MATH PACKAGES
rows. This is also possible with the array environment, but not as easy as
with the bigdelim package. The trick is that you need one separate column
for a big delimiter, but with empty cells in all rows, which the delimiter
spans.
x11 x12 ... x1p
x21 x22 ... x2p
.. some text
text .
xn1 1 xn1 2 ... xn1 p
xn1 +1,1 xn1 +1,2 . . . xn1 +1,p
.. some more text
.
xn1 +n2 ,1 xn1 +n2 ,2 . . . xn1 +n2 ,p
..
.
1 \[
2 \ begin { pmatrix }
3 & x _{11} & x _{12} & \ dots & x _{1 p } & \ rdelim \}{4}{3 cm }[ some text ]\\
4 \ ldelim [{5}{1 cm }[ text ] & x _{21} & x _{22} & \ dots & x _{2 p } \\
5 & \ vdots \\
6 & x _{ n _1 1}& x _{ n _1 2} & \ dots & x _{ n _1 p }\\
7 & x _{ n _1+1 ,1}& x _{ n _1+1 ,2} & \ dots & x _{ n _1+1 , p } &
8 \ rdelim \}{3}{3 cm }[ some more text ]\\
9 & \ vdots \\
10 & x _{ n _1+ n _2 , 1} & x _{ n _1+ n _2 ,2} & \ dots & x _{ n _1+ n _2 , p }\\
11 & \ vdots \\
12 \ end { pmatrix }
13 \]
As seen in the above listing the left big delimiter is placed in the first
column, all other rows start with second column. It is possible to use all
Mathmode.tex 98
47.5 bm 47 LIST OF AVAILABLE MATH PACKAGES
columns above and below the delimiter. For the array environment there
must be two more columns defined, in case of a big delimiter left and right.
The syntax of \ldelim and \rdelim is:
47.5 bm
By default the math macro \mathbf writes everything in bold and in upright
mode y = f (x) ($\mathbf{y=f(x)}$), but it should be in italic mode espe-
cially for variables y = f (x) ($\bm{y=f(x)}$), which is possible with the
package bm. For writing a whole formula in bold have a look at section 22 on
page 47.
47.6 braket
It is available at CTAN://macros/latex/contrib/other/misc/braket.sty and
provides several styles for writing math expressions inside brakets. For
example:
5
x ∈ R|0 < |x| <
3
1 \[ \ left \{ x \ in \ mathbf { R } | 0 <{| x |} <\ frac {5}{3}\ right \} \]
looks not quit right and it is not really easy to get the first vertical line in
the same size as the outer braces. Some solution may be using \vphantom:
5
x ∈ R 0 < |x| <
3
1 \[
2 \ left \{\ vphantom {\ frac {5}{3}} x \ in \ mathbf { R } \ right |\ left .
0 <{| x |} <\ frac {5}{3}\ right \}
3 \]
Mathmode.tex 99
47.7 cancel 47 LIST OF AVAILABLE MATH PACKAGES
and the same with a leading lower letter, which are not really interesting.
5
x ∈ R|0 < |x| <
3
x ∈ R|0 < |x| < 5
3
5
x ∈ R 0 < x <
3
5
x ∈ R 0 < |x| <
3
5
x ∈ R 0 < |x| <
3
1 \[ \ Bra { x \ in \ mathbf { R } | 0 <| x | <\ frac {5}{3}} \]
2 \[ \ Ket { x \ in \ mathbf { R } | 0 <| x | <\ frac {5}{3}} \]
3 \[ \ Braket { x \ in \ mathbf { R } | 0 <| x | <\ frac {5}{3}} \]
4 \[ \ Braket { x \ in \ mathbf { R } | 0 <\ vert x \ vert <\ frac {5}{3}} \]
5 \[ \ Set { x \ in \ mathbf { R } | 0 <| x | <\ frac {5}{3}} \]
The difference between the \Set and the \Braket macro is the handling
of the vertical lines. In \Set only the first one gets the same size as the
braces and in \Braket all.
2
∂
φ 2 ψ
∂t
2
∂
φ 2 |ψ
∂t
1 \[\ Braket {\ phi | \ frac {\ partial ^2}{\ partial t ^2} | \ psi }\]
2 \[\ Set {\ phi | \ frac {\ partial ^2}{\ partial t ^2} | \ psi }\]
47.7 cancel
This is a nice package for canceling anything in mathmode with a slash,
backslash or a X. To get a horizontal line we can define an additional macro
called \hcancel with an optional argument for the line color (requires package
color):
1 \ newcommand \ hcancel [2][ black ]{\ setbox 0=\ hbox {#2} %
2 \ rlap {\ raisebox {.45\ ht 0}{\ textcolor {#1}{\ rule {\ wd 0}{1 pt
}}}}#2}
Mathmode.tex 100
47.8 cool 47 LIST OF AVAILABLE MATH PACKAGES
\bcancel: 3A 1234567
hhhh
\hcancel: 3 1234567
47.8 cool
The cool package defines a lot of special mathematical expressions to use
them by the macro name. The following list shows only some of them, for
more informations look at the example file, which comes with the package.
\Sin{x} sin(x)
\Cos{x} cos(x)
\Tan{x} tan(x)
\Csc{x} csc(x)
\Sec{x} sec(x)
\Cot{x} cot(x)
\Style{ArcTrig=inverse} (default)
\Style{ArcTrig=arc}
\ArcSin{x} arcsin(x)
\ArcCos{x} arccos(x)
\ArcTan{x} arctan(x)
\ArcCsc{x} csc−1 (x)
\ArcSec{x} sec−1 (x)
\ArcCot{x} cot−1 (x)
Mathmode.tex 101
47.8 cool 47 LIST OF AVAILABLE MATH PACKAGES
\Factorial{n} n!
\DblFactorial{n} n!!
n
\Binomial{n}{k}
k
\Multinomial{1,2,3,4} (10; 1, 2, 3, 4)
\GammaFunc{x} Γ(x)
\IncGamma{a}{x} Γ(a, x)
\GenIncGamma{a}{x}{y} Γ(a, x, y)
\RegIncGamma{a}{x} Q(a, x)
\RegIncGammaInv{a}{x} Q−1 (a, x)
\GenRegIncGamma{a}{x}{y} Q(a, x, y)
\GenRegIncGammaInv{a}{x}{y} Q−1 (a, x, y)
\Pochhammer{a}{n} (a)n
\LogGamma{x} logΓ(x)
\Hypergeometric{0}{0}{}{}{x} 0 F0 (; ; x)
\Hypergeometric{0}{1}{}{b}{x} 0 F1 (; b; x)
\RegHypergeometric{0}{0}{}{}{x} 0 F̃ 0 (; ; x)
\RegHypergeometric{0}{1}{}{b}{x} 0 F̃ 1 (; b; x)
\MeijerG[a,b]{n}{p}{m}{q}{x}
m,n
a1 , . . . , an , an+1 , . . . , ap
Gp,q x
b1 , . . . , bm , bm+1 , . . . , bq
\MeijerG{1,2,3,4}{5,6}{3,6,9}{12,15,18,21,24}{x}
3,4 1, 2, 3, 4, 5, 6
G6,8 x
3, 6, 9, 12, 15, 18, 21, 24
\RiemannZeta{s} ζ(s)
\Zeta{s} ζ(s)
\HurwitzZeta{s}{a} ζ(s, a)
\Zeta{s,a} ζ(s, a)
\RiemannSiegelTheta{x} ϑ(x)
\RiemannSiegelZ{x} Z(x)
\StieltjesGamma{n} γn
\MathieuC{a}{q}{z} Ce(a, q, z)
\MathieuS{a}{q}{z} Se(a, q, z)
\MathieuCharacteristicA{r}{q} ar (q)
\MathieuCharisticA{r}{q} ar (q)
\MathieuCharacteristicB{r}{q} br (q)
\MathieuCharisticB{r}{q} br (q)
\MathieuCharacteristicExponent{a}{q} r(a, q)
\MathieuCharisticExp{a}{q} r(a, q)
Mathmode.tex 102
47.9 delarray 47 LIST OF AVAILABLE MATH PACKAGES
47.9 delarray
Package delarray28 supports different delimiters which are defined together
with the beginning of an array:
1 \ begin { array } < delLeft >{ cc } < delRight >
2 ...
The delarray package expects a pair of delimiters. If you need only one
(like the cases structure) then use the dot for an “empty” delimiter, e.g.,
1 \[
2 A =\ begin { array }\{{ cc }.
3 a & b \\ a b
4 c & d A=
5 \ end { array }
c d
6 \]
47.10 empheq
This package supports different frames for math environments of the AMSmath
package. It doesn’t support all the environments from standard LATEX which
are not modified by AMSmath, e.g., eqnarray environment.
With the optional argument of the empheq environment the preferred box
type can be specified. A simple one is \fbox
ˆ ∞
1
f (x) = dt = 1 (47.1)
1 x2
28
CTAN://macros/latex/required/tools/delarray.dtx
Mathmode.tex 103
47.11 esint 47 LIST OF AVAILABLE MATH PACKAGES
ˆ ∞
1
f (x) = dt = 1 (47.2)
1 x2
1 \ begin { empheq }[ box ={\ fboxsep =10 pt \ colorbox { yellow }}]{ align }
2 f ( x ) =\ int _1^{\ infty }\ frac {1}{ x ^2}\ , dt =1
3 \ end { empheq }
The key box can hold any possible LATEX command sequence. Boxing
subequations is also no problem, the empheq environment works in the same
way:
ˆ ∞
1
f (x) = dt = 1 (47.3a)
x1
ˆ 1
∞
1
f (x) = dt = 0.25 (47.3b)
2 x2
1 \ begin { subequations }
2 \ begin { empheq }[ box ={\ fboxsep =10 pt \ colorbox { cyan }}]{ align }
3 f ( x ) & =\ int _1^{\ infty }\ frac {1}{ x ^2}\ , dt =1\\
4 f ( x ) & =\ int _2^{\ infty }\ frac {1}{ x ^2}\ , dt =0.25
5 \ end { empheq }
6 \ end { subequations }
47.11 esint
This is a very useful package when you want nice double or triple integral or
curve integral symbols. The ones from the wasysym package29 are not the
best. esint30 supports the following symbols:
ˆ
\int : (47.4)
¨
\iint : (47.5)
˚
\iiintop : (47.6)
˘
\iiiintop : (47.7)
29
CTAN://macros/latex/contrib/wasysym/
30
CTAN://macros/latex/contrib/esint/ CTAN://fonts/ps-type1/esint/
Mathmode.tex 104
47.12 eucal and euscript
47 LIST OF AVAILABLE MATH PACKAGES
˙
\dotsintop : (47.8)
˛
\ointop : (47.9)
‹
\oiint : (47.10)
“
\sqint : (47.11)
„
\sqiint : (47.12)
‰
\ointctrclockwise : (47.13)
\ointclockwise : (47.14)
fi
\varointclockwise : (47.15)
ffi
\varointctrclockwise : (47.16)
\fint : (47.17)
"
\varoiint : (47.18)
$
\landupint : (47.19)
&
\landdownint : (47.20)
\mathscr{...} ABCDEFGHIJKLMNOPQRSTUVWXYZ
47.13 exscale
The following formula is written with the default fontsize where everything
looks more or less well:
31
CTAN://fonts/amsfonts/latex/euscript.sty
Mathmode.tex 105
47.14 mathtools 47 LIST OF AVAILABLE MATH PACKAGES
ˆ +1 n
f (x) πX 2i − 1
√ dx ≈ f cos
−1 1 − x2 n 2n
i=1
Writing the same with the fontsize \huge gives a surprising result, which
belongs to the historical development of LATEX, the \int and \sum symbols
are not stretched. This extreme fontsize is often needed for slides and not
only written “just for fun”.
+1 √f (x) dx ≈ π X 2i − 1
n
cos
Z
f
−1 2
1−x n i=1 2n
Using the exscale package32 package, which should be part of any local
TEX installation, all symbols get the right size.
ˆ +1 n
f (x) π X 2i − 1
√ dx ≈ f cos
−1 1 − x2 n i=1 2n
47.14 mathtools
This package comes with a lot of additional features for typesetting math
code. Sometimes it is useful when only such equations are numbered which
are referenced in the text. This is possible with the switch \showonlyrefs.
Matrices are set by default with a centered horizontal alignment, which is
often not the best way. The mathtools package provides a starred version of
the matrix environments which allow an optional argument for the horizontal
alignment:
1 −1 0
−1 1 −1
1 −1 0
−11 11 −11
1 \[
2 \ begin { pmatrix *}[ r ]
3 1 & -1 & 0 \\
4 -1 & 1 & -1 \\
5 1 & -1 & 0 \\
6 -11 & 11 & -11 \\
32
CTAN://macros/latex/base/
Mathmode.tex 106
47.15 nicefrac 47 LIST OF AVAILABLE MATH PACKAGES
7 \ end { pmatrix *}
8 \]
47.15 nicefrac
Typesetting fractions in the inline mode is often a bad choice, the vertical
spacing increases in fact of the fraction. The nicefrac package defines the
macro \nicefrac, which is used in the same way as the \frac command, but
it typesets the fraction with a less height: 2/3 \nicefrac{2}{3}. The package is
part of the units package bundle and can be found in the directory of units.
47.16 relsize
Often consecutives math operators are used, like two sum symbols, e.g.,
n
XX
i2
i=1
As seen the sums are of the same size. To increase the first operator size,
someone can use the \scalebox macro from package graphicx environment
and write an own macro \Sum, e.g.,
1 \ def \ Sum {\ ensuremath \ mathop {\ scalebox {1.2}{$\ displaystyle \ sum
$}}}
2 \[ \ Sum _{ j =1}\ sum _{ i =1}^\ infty i \]
∞
XX
i
j=1 i=1
Mathmode.tex 107
47.17 xypic 47 LIST OF AVAILABLE MATH PACKAGES
47.17 xypic
The \xymatrix macro is part of the xypic package34 which can be loaded
with several options which are not so important here.35 .
AA B C (47.22)
O AA
O AA
O AA
D E /o o/ o/ F
> ~ ~> ~>
>~
G H I
This matrix was created with
1 \[
2 \ xymatrix { A \ POS [];[ d ]**\ dir {~} ,[];[ dr ]**\ dir { -} & B & C \\
3 D & E \ POS [];[ l ]**\ dir {.} ,[];[ r ]**\ dir {~} & F \ POS [];[ dl
]**\ dir {~}\\
4 G & H & I}
5 \]
33
CTAN://macros/latex/ltxmisc/
34
CTAN://macros/generic/diagrams/xypic/xy-3.7/
35
For more information look at the package documentation or the package xy itself,
which is often saved in /usr/share/texmf/tex/generic
Mathmode.tex 108
49 LATIN MODERN
Part V
Math fonts
Typesetting text and math is far different. There exist a lot of free text fonts
without additional math characters. This is the reason why we have to buy a
commercial math font, e. g. Palatino (pamath) or Helvetica (hvmath), or to
combine the free text font with another free math font.
48 Computer modern
This is the default font, designed by Knuth. For the PDF output the Type 1
fonts cm-super and BlueSkye were used.
wobei C ⊂ D\{a} ein geschlossener Weg mit n(C, a) = 1 ist (z.B. ein entgegen
dem Uhrzeigersinn durchlaufener Kreis).
AΛ∆∇BCDΣEFΓGHIJKLMNOΘΩfPΦΠΞQRSTUVWXYΥΨZ
aαbβc∂dδeεf ζξgγh~}ιiıjkκκl`λmnηθϑoσςφϕ℘pρ%qrstτ πuµνvυwω$
xχyψz∞ ∝ ∅∅dð
49 Latin modern
This is the new designed font which comes with an own Type 1 version.lm
wobei C ⊂ D\{a} ein geschlossener Weg mit n(C, a) = 1 ist (z.B. ein entgegen
dem Uhrzeigersinn durchlaufener Kreis).
AΛ∆∇BCDΣEFΓGHIJKLMNOΘΩfPΦΠΞQRSTUVWXYΥΨZ
aαbβc∂dδeεf ζξgγh~}ιiıjkκκl`λmnηθϑoσςφϕ℘pρ%qrstτ πuµνvυwω$
xχyψz∞ ∝ ∅∅dð
Mathmode.tex 109
51 PALATINO – MICROIMP
50 Palatino
There is a free package mathpazo.mathpazo
1
Z
Res f (z) = Res f = f (z) dz ,
z= a a 2πi
C
wobei C ⊂ D \{ a} ein geschlossener Weg mit n(C, a) = 1 ist (z.B. ein entgegen
dem Uhrzeigersinn durchlaufener Kreis).
AΛ∆∇BCDΣEFΓGHIJKLMNOΘΩfPΦΠΞQRSTUVWXYΥΨZ
aαbβc∂dδeeε f ζξgγhh̄}ιiıjkκ κ l `λmnηθϑoσςφϕ℘ pρ$qrstτπuµνvυwωv
xχyψz∞ ∝ ∅∅dð
51 Palatino – microimp
There is the package pamath for the nonfree palatino font.mathpazo
wobei C ⊂ D\{a} ein geschlossener Weg mit n(C, a) = 1 ist (z.B. ein entgegen
dem Uhrzeigersinn durchlaufener Kreis).
AΛ∆∇BCDΣEFΓ GHIJKLMNOΘΩfPΦΠΞQRSTUVWXYΥ ΨZ
aαbβc∂dδeεfζξgγhħ}ιiıjkκκl`λmnηθϑoσςφϕ℘pρ%qrstτπuµνvυwω$
xχyψz∞ ∝ ∅∅dð
Mathmode.tex 110
53 MINION
52 cmbright
wobei C ⊂ D\{a} ein geschlossener Weg mit n(C, a) = 1 ist (z.B. ein entgegen dem
Uhrzeigersinn durchlaufener Kreis).
AΛ∆∇BCDΣEFΓ GHIJKLMNOΘΩfPΦΠΞQRSTUVWXYΥΨZ
aαbβc∂dδeεf ζξgγh~}ιi ıjkκκl`λmnηθϑoσςφϕ℘pρ%qr stτ πuµνv υw ω$
xχy ψz∞ ∝ ∅∅dð
53 minion
∫
1
Res f(z) = Res f = f(z) dz ,
z=a a 2πi
C
wobei C ⊂ Da ein geschlossener Weg mit n(C, a) = 1 ist (z.B. ein entgegen dem
Uhrzeigersinn durchlaufener Kreis).
AΛ∆∇BCDΣEFΓGHIJKLMNOΘΩΩPΦΠΞQRSTUVWXYΥΨZ
aαbβc∂dδeєε fζξgγhħħιiı jȷkκϰlℓλmnηθϑoσςϕφ³pρρqrstτπuµνvυwωϖ
xχyψzª ggdðэ
Mathmode.tex 111
54 INTEGRAL SYMBOLS
Part VI
Special symbols
In this section only those symbols are defined, which are not part of the list of
all available symbols: CTAN://info/symbols/comprehensive/symbols-a4.pdf.
With fontmath.ltx LATEX itself defines the following special symbols for
using inside math:
Name Meaning
\mathparagraph ¶
\mathsection §
\mathdollar $
\mathsterling £
\mathunderscore
\mathellipsis ...
54 Integral symbols
Name Symbol
´
\dashint −
´
\ddashint =
´
\clockint
´
\counterint
For all new integral symbols limits can be used in the usual way:
ˆ ˆ ˛∞ ˆ ˆ
=1=−0< = (54.1)
0 1 A
−∞
1 \ ddashint _01=\ dashint _10 <\ oint \ limits _{ -\ infty }^\ infty = \
clockint \ counterint _ A
Put the following definitions into the preamble to use one or all of these
new integral symbols.
1 \ def \ Xint #1{\ mathchoice
2 {\ XXint \ displaystyle \ textstyle {#1}} %
3 {\ XXint \ textstyle \ scriptstyle {#1}} %
4 {\ XXint \ scriptstyle \ scriptscriptstyle {#1}} %
5 {\ XXint \ scriptscriptstyle \ scriptscriptstyle {#1}} %
6 \!\ int }
7 \ def \ XXint #1#2#3{{\ setbox 0=\ hbox {$#1{#2#3}{\ int }$}
8 \ vcenter {\ hbox {$#2#3$}}\ kern -.5\ wd 0}}
Mathmode.tex 112
55 HARPOONS
55 Harpoons
LATEX knows no stretchable harpoon symbols, like \xrightarrow. The
following code defines several harpoon symbols. \xrightharpoondown
\xrightharpoonup
1 \ def \ r i g h t h a r p o o n d o w n f ill@ { %
\xleftharpoondown
2 \ arrowfill@ \ relbar \ relbar \ rightharpoondown }
3 \ def \ r ig h th ar p oo n up fi l l@ { % \xleftharpoonup
4 \ arrowfill@ \ relbar \ relbar \ rightharpoonup } \xleftrightharpoons
5 \ def \ l e f t ha r p o o n d ow n f i ll@ { % \xrightleftharpoons
6 \ arrowfill@ \ leftharpoondown \ relbar \ relbar }
7 \ def \ le fth arp oon up fil l@ { %
8 \ arrowfill@ \ leftharpoonup \ relbar \ relbar }
9 \ newcommand {\ xrightharpoondown }[2][]{ %
10 \ ext@arrow 0359\ r i ght harpoondow nfill@ {#1}{#2}}
11 \ newcommand {\ xrightharpoonup }[2][]{ %
12 \ ext@arrow 0359\ r ightharpoonupfill@ {#1}{#2}}
13 \ newcommand {\ xleftharpoondown }[2][]{ %
14 \ ext@arrow 3095\ l e ftharpoondownfill@ {#1}{#2}}
15 \ newcommand {\ xleftharpoonup }[2][]{ %
16 \ ext@arrow 3095\ le ftharpoonupfill@ {#1}{#2}}
17 \ newcommand {\ xl eft rig htharpoons }[2][]{\ mathrel { %
18 \ raise .22 ex \ hbox { %
19 $\ ext@arrow 3095\ leftharpoonupfill@ {\ phantom
{#1}}{#2}$} %
20 \ setbox 0=\ hbox { %
21 $\ ext@arrow 0359\ right harpoondo wnfill@ {#1}{\ phantom
{#2}}$} %
22 \ kern -\ wd 0 \ lower .22 ex \ box 0} %
23 }
24 \ newcommand {\ xr igh tle ftharpoons }[2][]{\ mathrel { %
25 \ raise .22 ex \ hbox { %
26 $\ ext@arrow 3095\ rightharpoonupfill@ {\ phantom
{#1}}{#2}$} %
27 \ setbox 0=\ hbox { %
28 $\ ext@arrow 0359\ leftharpoondownfill@ {#1}{\ phantom
{#2}}$} %
29 \ kern -\ wd 0 \ lower .22 ex \ box 0} %
30 }
Mathmode.tex 113
57 STACKED EQUAL SIGN
over
\xrightharpoondown[under]{over} −−−+ uunder
over
\xrightharpoonup[under]{over} −−−* uunder
over
\xleftharpoondown[under]{over} )−−− u under
over
\xleftharpoonup[under]{over} (−−− u under
over
\xleftrightharpoons[under]{over} −−
(−
− −+
− uunder
over
\xrightleftharpoons[under]{over} −
)−
−−−*
− uunder
This uses the \mathrlap definition from section 35.2 on page 72. With
this definition a huge symbol is also possible: {\Huge\bijmap} →.
57 Stacked equal sign
There are several symbols stacked with an equal sign, e.g., \doteq, \equiv
.
or \cong (=, ≡ , ∼
= ). But there are still some missing, which are shown in
table 22 and the following definitions.
def
\eqdef =
!
\eqexcl =
\eqhat =
b
Mathmode.tex 114
58 OTHER SYMBOLS
58 Other symbols
1 \ newcommand *{\ threesim }{ %
2 \ mathrel {\ vcenter {\ offinterlineskip
3 \ hbox {$\ sim $}\ vskip -.35 ex \ hbox {$\ sim $}\ ∼
∼
∼ ABC
vskip -.35 ex \ hbox {$\ sim $}}}}
4 $\ threesim ABC $
Mathmode.tex 115
59 TUNING MATH TYPESETTING
Part VII
Examples
59 Tuning math typesetting
Chapter 18 of the TEXbook is named "‘Fine Points of Mathematics Typ-
ing"’ [12] and it shows on 20 pages some more or less important facts when
typesetting mathematical expressions. Often inline formulas contain a punc-
tuation character like a dot, comma, colon, etc.. It is a general rule to write
those characters outside the math mode. Compare
a, b, c, d, e, and f 1 $a, b, c, d, e, \textrm{and }f$ \\[5pt]
2 $a$, $b$, $c$, $d$, $e$, and $f$
a, b, c, d, e, and f
Having such math as single expressions enables TEX to insert a linebreak
at several places (see Section 2.6 on page 12).
Writing an ellipses as three single dots, doesn’t look very nice, one should
always use the \ldots command:
1, ..., 10 1 $1,...,10$\\[5pt]
2 $1,\ldots,10$
1, . . . , 10
This is correct as long as on the left and right are a comma as a separator.
For sums the \cdot command should be used instead:
1 + 2 + · · · + 10 1 $1+2+\cdots+10$\\[5pt]
2 $x_n=x_{n-1}=\cdots=n_0=1$
xn = xn−1 = · · · = n0 = 1
For a multiplication it is important which character is used, in european
countries often a centered dot. In such a case it is appropriate not to use the
\cdots command for a ellipsis.
For typesetting integrals or differential equations it makes sense to define
the following short macros:
1 \ newcommand *\ dy {\ ,\ mathrm { d } y }
2 \ newcommand *\ dx {\ ,\ mathrm { d } x }
3 \ newcommand *\ dyx {\ ,\ frac {\ mathrm { d } y }{\ mathrm { d } x }}
4 \ newcommand *\ ds {\ ,\ mathrm { d } s }
5 \ newcommand *\ dt {\ ,\ mathrm { d } t }
6 \ newcommand *\ dst {\ ,\ frac {\ mathrm { d } s }{\ mathrm { d } t }}
ˆ
1 \begin{align*}
F (x) = f (x) dx
2 F(x) &= \int\!f(x)\dx\\
ds 3 v(t) &= \dst\\
v(t) = 4 a(t) &= \frac{\mathrm{d}^2s}{\mathrm{d}t
dt ^2}
d2 s 5 \end{align*}
a(t) = 2
dt
Mathmode.tex 116
60 MATRIX
ˆ ˆ
G(t) = · · · dx dy . . . 1 \begin{align*}
2 G(t) &= \underbrace{\,\int\cdots\!\int
| {z } \!\!}_D\;\dx\dy\ldots\\
ˆ D 3 u_C(t) &= \int\!\,i_C(t)\dt
uC (t) = iC (t) dt 4 \end{align*}
60 Matrix
60.1 Identity matrix
There are several possibilities to write this matrix. Here is a solution with
the default array environment.
1 \[
2 \left(
3 \begin{array}{ccccc}
1 4 1\\
1 0
5
6
& 1 & & \text{{\huge{0}}}\\
& & 1\\
1
7 & \text{{\huge{0}}} & & 1\\
0
1 8 & & & & 1
1 9 \end{array}
10 \right)
11 \]
Mathmode.tex 117
60.3 Matrix with comments on top 61 CASES STRUCTURE
←−−−
←−−−
←−−−
\rb{text1}&\rb{text1}&\rb{text1}&\rb{text
text1
text1
text1
text1
4
1}\\
5 \end{matrix}$\\
Xx Yx Zx Tx 6 $\begin{bmatrix}
Xy Yy Zy Ty 7 X_x & Y_x & Z_x & T_x \\
Xz Yz Zz Tz 8 X_y & Y_y & Z_y & T_y \\
9 X_z & Y_z & Z_z & T_z \\
0 0 0 1 10 0 & 0 & 0 & 1
11 \end{bmatrix}$
12 \end{tabular}
61 Cases structure
Sometimes it is better to use the array environment instead of amsmath’s
cases environment. To get optimal horizontal spacing for the conditions, there
are two matrixes in series, one 3 × 1 followed by 3 × 3 matrix. To minimize
the horizontal space around the variable z a
1 \ addtolength {\ arraycolsep }{ -3 pt }
is a useful command.
D +z
−D ≤ z ≤ −p
z2
I(z) = δ0 D − 21 p − p −p ≤ z ≤ p (61.1)
D−z p ≤z≤ D
1 \ addtolength {\ arraycolsep }{ -3 pt }
2 I ( z ) =\ delta _{0}\ left \{ %
3 \ begin { array }{ lcrcl }
4 D + z & \ quad & -D & \ le z \ le & -p \\
5 D -\ frac {1}{2}\ left (p -\ frac { z ^{2}}{ p }\ right ) %
6 & \ quad & -p & \ le z \ le & \ phantom { -} p \\
7 D - z & \ quad & p & \ le z \ le & \ phantom { -} D
8 \ end { array }\ right .
9 \ end { equation }
Mathmode.tex 118
62 ARRAYS
x = 2 if y > 2 (61.2)
some text here
x = 3 if y ≤ 2 (61.3)
1 \ begin { tabular }{ rc }
2 \ ldelim \{{2}{2.75 cm }[ some text here ] &
3 \ parbox {{\ linewidth -3 cm -4\ tabcolsep }}{
4 \ vspace *{1 ex }
5 \ begin { flalign }
6 x & = 2\ quad \ text { if } y >2 &\\
7 x & = 3\ quad \ text { if } y \ le 2&
8 \ end { flalign }}
9 \ end { tabular }
x = 2 if y > 2 (61.4)
some text here
x = 3 if y ≤ 2 (61.5)
x = 2 if y > 2 (61.6)
some text here
x = 3 if y ≤ 2 (61.7)
1 \[
2 \ begin { array }{ rc@ {\ qquad } c }
3 \ ldelim \{{2}{2.75 cm }[ some text here ]
4 & x = 2\ quad \ text { if } y > 2 & \ refstepcounter { equation }(\
theequation ) \\
5 & x = 3\ quad \ text { if } y \ le 2& \ refstepcounter { equation }(\
theequation )
6 \ end { array }
7 \]
62 Arrays
There is a general rule that a lot of mathematical stuff should be divided in
smaller pieces. But sometimes it is difficult to get a nice horizontal alignment
when splitting a formula. The following ones uses the array environment to
get a proper alignment.
Mathmode.tex 119
62.1 Quadratic equation 62 ARRAYS
Mathmode.tex 120
62.2 Vectors and matrices 62 ARRAYS
1 \ begin { equation }
2 \ begin { array }{ rcl }
3 \ underline { RS } & = & \ left (\ begin { array }{ cccccccc }
4 01 & a 4 & 55 & 87 & 5 a & 58 & db & 9 e \\
5 a 4 & 56 & 82 & f 3 & 1 e & c 6 & 68 & e 5\\
6 02 & a 1 & fc & c 1 & 47 & ae & 3 d & 19\\
7 a 4 & 55 & 87 & 5 a & 58 & db & 9 e & 03\ end { array }\ right ) \\
8 \\
9 \ left (\ begin { array }{ c }
10 s _{ i ,0}\\
11 s _{ i ,1}\\
12 s _{ i ,2}\\
13 s _{ i ,3}
14 \ end { array }\ right ) & = & \ underline { RS }\ cdot %
15 \ left (\ begin { array }{ c }
16 m _{8 i +0}\\
17 m _{8 i +1}\\
18 \ cdots \\
19 m _{8 i +6}\\
20 m _{8 i +7}
21 \ end { array }\ right ) \\
22 \\
23 S _{ i } & = & \ sum _{ j =0}^{3} s _{ i , j }\ cdot 2^{8 j }\ qquad i =0 ,1 ,... , k -1\\
24 \\
25 S & = & \ left ( S _{ k -1} , S _{ k -2} ,... , S _{1} , S _{0}\ right )
26 \ end { array }
27 \ end { equation }
Mathmode.tex 121
62.4 Arrays inside arrays 62 ARRAYS
divergent q ≤ −1
0 |q| < 1
lim q n =
n−>∞
1 q = 1
∞ q > 1
1 \[
2 \ left (
3 \ begin { array }{ c@ {} c@ {} c }
4 \ begin { array }{| cc |}\ hline
5 a _{11} & a _{12} \\
6 a _{21} & a _{22} \\\ hline
7 \ end { array } & \ mathbf {0} & \ mathbf {0} \\
8 \ mathbf {0} &
9 \ begin { array }{| ccc |}\ hline
10 b _{11} & b _{12} & b _{13}\\
11 b _{21} & b _{22} & b _{23}\\
12 b _{31} & b _{32} & b _{33}\\\ hline
13 \ end { array } & \ mathbf {0} \\
14 \ mathbf {0} & \ mathbf {0} &
15 \ begin { array }{| cc |}\ hline
16 c _{11} & c _{12} \\
17 c _{21} & c _{22} \\\ hline
18 \ end { array } \\
19 \ end { array }
20 \ right )
21 \]
Mathmode.tex 122
62.5 Colored cells 62 ARRAYS
0 0 1 0
Y1 = 1 0 1 0
1 1 1 1
2 1 3 1
1 \[
2 Y ^1=
3 \ begin { array }{ c }
4 \ null \\[1 ex ] % only vor vertical alignment
5 \ left [\ begin { array }{ rrrr }
6 0 & 0 & 1 & 0\\
7 1 & 0 & 1 & 0\\
8 1 & 1 & 1 & 1
9 \ end { array }\ right ]\\[3 ex ]\ hline
10 \ begin { array }{ rrrr }
11 % \ hdotsfor {4}\\%( needs \ AmSmath ) instead of \\[3 ex ]\ hline
12 2 & 1 &3 & 1
13 \ end { array }
14 \ end { array }
15 \]
hk,1,0 (n) hk,1,1 (n) hk,1,2 (n) 0 0
hk,2,0 (n) hk,2,1 (n) hk,2,2 (n) 0 0
hk,3,0 (n) hk,3,1 (n) hk,3,2 (n) 0 0
hk,4,0 (n) hk,4,1 (n) hk,4,2 (n) 0 0
0 hk,1,0 (n − 1) hk,1,1 (n − 1) hk,1,2 (n − 1) 0
0 hk,2,0 (n − 1) hk,2,1 (n − 1) hk,2,2 (n − 1) 0
0 hk,3,0 (n − 1) hk,3,1 (n − 1) hk,3,2 (n − 1) 0
0 hk,4,0 (n − 1) hk,4,1 (n − 1) hk,4,2 (n − 1) 0
0 0 hk,1,0 (n − 2) hk,1,1 (n − 2) hk,1,2 (n − 2)
0 0 hk,2,0 (n − 2) hk,2,1 (n − 2) hk,2,2 (n − 2)
0 0 hk,3,0 (n − 2) hk,3,1 (n − 2) hk,3,2 (n − 2)
0 0 hk,4,0 (n − 2) hk,4,1 (n − 2) hk,4,2 (n − 2) 12×5
1 ...
2 \ usepackage { array }
3 \ usepackage { colortbl }
4 \ definecolor { umbra }{ rgb }{0.8 ,0.8 ,0.5}
5 \ def \ zero {\ multicolumn {1}{ >{\ columncolor { white }} c }{0}}
6 \ def \ colCell #1#2{\ multicolumn {1}{ >{\ columncolor {#1}} c }{#2}}
Mathmode.tex 123
62.6 Boxed rows and columns 62 ARRAYS
7 \ begin { document }
8 \[\ left [\ ,
9 \ begin { array }{*{5}{ >{\ columncolor [ gray ]{0.95}} c }}
10 h _{ k ,1 ,0}( n ) & h _{ k ,1 ,1}( n ) & h _{ k ,1 ,2}( n ) & \ zero & \ zero \\
11 h _{ k ,2 ,0}( n ) & h _{ k ,2 ,1}( n ) & h _{ k ,2 ,2}( n ) & \ zero & \ zero \\
12 h _{ k ,3 ,0}( n ) & h _{ k ,3 ,1}( n ) & h _{ k ,3 ,2}( n ) & \ zero & \ zero \\
13 h _{ k ,4 ,0}( n ) } & \ colCell { umbra }{ h _{ k ,4 ,1}( n ) } & h _{ k ,4 ,2}( n ) & \ zero
& \ zero \\
14 \ zero & h _{ k ,1 ,0}( n -1) & h _{ k ,1 ,1}( n -1) & h _{ k ,1 ,2}( n -1) & \ zero \\
15 \ zero & h _{ k ,2 ,0}( n -1) & h _{ k ,2 ,1}( n -1) & h _{ k ,2 ,2}( n -1) & \ zero \\
16 \ zero & h _{ k ,3 ,0}( n -1) & h _{ k ,3 ,1}( n -1) & h _{ k ,3 ,2}( n -1) & \ zero \\
17 \ zero & \ colCell { umbra }{ h _{ k ,4 ,0}( n -1) } & h _{ k ,4 ,1}( n -1) & h _{ k
,4 ,2}( n -1) & \ zero \\
18 \ zero & \ zero & h _{ k ,1 ,0}( n -2) & h _{ k ,1 ,1}( n -2) & h _{ k ,1 ,2}( n -2) \\
19 \ zero & \ zero & h _{ k ,2 ,0}( n -2) & h _{ k ,2 ,1}( n -2) & h _{ k ,2 ,2}( n -2) \\
20 \ zero & \ zero & h _{ k ,3 ,0}( n -2) & h _{ k ,3 ,1}( n -2) & h _{ k ,3 ,2}( n -2) \\
21 \ zero & \ zero & h _{ k ,4 ,0}( n -2) & h _{ k ,4 ,1}( n -2) & h _{ k ,4 ,2}( n -2)
22 \ end { array } \ ,\ right ]_{12\ times 5}\]
23 ...
1 \[
2 \overrightarrow{A}=\left[
3 \begin{array}{cc|c|c}\cline{3-3}
1 2 3 4 4 1 & 2 & 3 & 4\\
→
− 1 2 3 4 5 1 & 2 & 3 & 4\\
A =
1
2 3 4 6 1 & 2 & 3 & 4\\
1 2 3 4 7 1 & 2 & 3 & 4\\\cline{3-3}
8 \end{array}\right]
9 \]
1 \[
2 \overrightarrow{A}=\left[
3 \begin{array}{cc|c|c}\cline{3-3}
1 2 3 4 4 1 & 2 & 3 & 4\\
→
− 1 2 3 4 5 1 & 2 & 3 & 4\\\hline
A =
1
6 \multicolumn{1}{|c}{1} & 2 & 3 &
2 3 4 7 \multicolumn{1}{c|}{4}\\\hline
1 2 3 4 8 1 & 2 & 3 & 4\\\cline{3-3}
9 \end{array}\right]
10 \]
Mathmode.tex 124
63 OVER- AND UNDERBRACES
1 \[
2 z =\;\;\ underbrace { %
3 \ makebox [\ widthof {~$ x ^2+ y ^2$}][ r ]{ %
4 $\ sqrt { x ^2+ y ^2}$}}_{= z ^2}
5 \]
o
Overlapping under- and overbraces like | needs some
z }| {
{z } | {z }
u1 u2
tricky code, because we cannot have parts of the argument inside overbrace
and also underbrace. The following equation 63.1 is an example for such a
construction:
y = 2x2 − 3x + 5
=0
z }| {
2 2
3 3 3 5
= 2 x2 − x + − + (63.1)
2 4 4 2
| {z }| {z }
2 !
3 31
=2 x− +
4 16
3 2
31
y− = 2 x−
8 4
Mathmode.tex 125
63.3 Vertical alignment 63 OVER- AND UNDERBRACES
10 }%
11 \ underbrace { %
12 - \ left (\ frac {3}{4}\ right ) ^2 + \ frac {5}{2}} %
13 \ right ) \\
14 &= 2\ left (\ qquad \ textcolor { red }{\ left (x -\ frac {3}{4}\ right ) ^2}
15 \ qquad + \ \ frac {31}{16}\ qquad \ right ) \ nonumber \\
16 y \ textcolor { blue }{ -\ frac {31}{8}}
17 &= 2\ left ( x \ textcolor { cyan }{ -\ frac {3}{4}}\ right ) ^2\ nonumber
18 \ end { align }
1 \ begin { equation }
2 \ binom { x _ R }{ y _ R } = \ underbrace { r \ vphantom {\ binom { A }{ B
}}}_{\ text { Skaling }}\ cdot %
3 \ underbrace { %
4 \ begin { pmatrix }
5 \ sin \ gamma & -\ cos \ gamma \\
6 \ cos \ gamma & \ sin \ gamma \\
7 \ end { pmatrix } %
8 }_{\ text { Rotation }}
9 \ binom { x _ K }{ y _ K } +
10 \ underbrace {\ binom { t _ x }{ t _ y }}_{\ text { Translation }}
11 \ end { equation }
It is again the \vphantom macro which reserves the needed vertical space.
Nevertheless the horizontal space around the r of the first underbrace and
the last + should be decreased to get a better typesetting. This is possible
with \hspace or simply \kern:
xR sin γ − cos γ xK tx
= r· +
yR cos γ sin γ yK ty
|{z}| {z } | {z }
Skaling Rotation Translation
1 \[ \ binom { x _ R }{ y _ R } = %
2 \ kern -10 pt \ underbrace { r \ vphantom {\ binom { A }{ B }}}_{\ text { Skaling }}\
kern -10 pt %
3 \ cdot \ underbrace { %
4 \ begin { pmatrix }
5 \ sin \ gamma & -\ cos \ gamma \\
6 \ cos \ gamma & \ sin \ gamma \\
7 \ end { pmatrix } %
8 }_{\ text { Rotation }}
Mathmode.tex 126
63.4 Alignment 63 OVER- AND UNDERBRACES
9 \ binom { x _ K }{ y _ K } +\ kern -5 pt %
10 \ underbrace {\ binom { t _ x }{ t _ y }}_{\ text { Translation }} \]
300 29 19 9 8 1 1
7−→ 7−→ 7 →
− 7−→ 7 → . . . 7−→
− 7−→ . . . 7−→
5069 |{z} 490 | 321
{z } 152 | 135 {z } 16 | {z }1
∆a=271 ∆a=10 =h271i29 ∆a=1 =h10i9 ∆a=0=h1i1
∆b=4579 ∆b=169=h4579i490 ∆b=17=h169i152 ∆b=1=h17i16
1 iteration 2 iterations 8 iterations 8 iterations
Mathmode.tex 127
65 VERTICAL ALIGNMENT
64 Integrals
The first theorem of Green is:
˚ ‹
2 ∂v 2
u∇ v + (∇u, ∇v) d3 V =
u d A
∂n
G S
They are both written with the esint package36 , which gives nice integral
symbols. The LATEX code for the first equation is:
1 \[
2 \ underset {\ mathcal { G }\ quad }\ iiint \! %
3 \ left [ u \ nabla ^{2} v +\ left (\ nabla u ,\ nabla v \ right ) \ right ]\ mathrm { d
}^{3} V %
4 =\ underset {\ mathcal { S }\ quad }\ oiint u \ ,\ Q { v }{ n }\ ,\ ,\ mathrm { d }^{2} A
5 \]
with the following definition in the preamble for the partial derivation:
1 \ def \ Q #1#2{\ frac {\ partial #1}{\ partial #2}}
65 Vertical alignment
65.1 Example 1
Sometimes it may be useful to have a vertical alignment over the whole page
with a mix of formulas and text. Section 37 shows the use of \intertext.
There is another trick to get all formulas vertical aligned. Let’s have the
following formulas distributed over the whole page:
f (x) = a
g(x) = x2 − 4x
f (x) − g(x) = x2 + x3 + x
g = x2 + x3 + x4 + x5 + b
36
See section 64.
Mathmode.tex 128
65.1 Example 1 65 VERTICAL ALIGNMENT
They all have a different length of the left and right side. Now we want
to write some text and other objects between them, but let the alignment
untouched. We choose the longest left and the longest right side and take
them for scaling with the \hphantom command:
This is the first (empty) line in every equation where now all other lines
are aligned to this one. For example:
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah
f (x) = a (65.1)
2
g(x) = x − 4x (65.2)
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah
g(x) = x2 + x3 + x4 + x5 + b (65.4)
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah
The phantom line is empty but leaves the vertical space for a line. This
could be corrected with decreasing the \abovedisplayshortskip length and
done all inside a group.
1 \ newcommand {\ x }{ blah blah blah blah blah blah blah blah }
2 \ bgroup
3 \ addtolength \ a b o v e d i s p laysh ortskip { -0.5 cm } % decrease the skip
4 \ addtolength \ abovedisplayskip { -0.5 cm }
5 \x\x\x
6 \ begin { align }
7 \ hphantom {\ mbox {$ f ( x ) -g ( x ) $}} & \ hphantom {\ mbox {$= x ^2+ x ^3+ x ^4+ x ^5+ b
$}}\ nonumber \\
8 f ( x ) &= a \\
9 g ( x ) &= x ^2 -4 x
10 \ end { align }
11 %
12 \x\x\x
Mathmode.tex 129
65.2 Example 2 65 VERTICAL ALIGNMENT
13 \ begin { align }
14 \ hphantom {\ mbox {$ f ( x ) -g ( x ) $}} & \ hphantom {\ mbox {$= x ^2+ x ^3+ x ^4+ x ^5+ b
$}}\ nonumber \\
15 f ( x ) -g ( x ) &= x ^2+ x ^3+ x
16 \ end { align }
17 \x\x\x
18 %
19 \ begin { align }
20 \ hphantom {\ mbox {$ f ( x ) -g ( x ) $}} & \ hphantom {\ mbox {$= x ^2+ x ^3+ x ^4+ x ^5+ b
$}}\ nonumber \\
21 g ( x ) &= x ^2+ x ^3+ x ^4+ x ^5+ b
22 \ end { align }
23 \x\x\x
24 \ egroup
• first function X
P1 = ∈A
a
• or perhaps
P3 + P2 − P1 = blablub
1 \ newsavebox \ lW
2 \ sbox \ lW {$ P _{3}+ P _{2} - P _{1}$}
3
4 \ begin { itemize }
5 \ item first function \\
6 $\ displaystyle \ makebox [\ wd \ lW ][ r ]{$ P _1$}=\ sum _ a \ in A $
7 \ item but another one \\
8 $\ makebox [\ wd \ lW ][ r ]{$\ sin \ left ( P _1\ right ) $}= blabla $
9 \ item or perhaps \\
10 $ P _{3}+ P _{2} - P _{1}= blablub $
11 \ end { itemize }
65.2 Example 2
This one comes from Hartmut Henkel and offers a special form of placing
additional text between the equation and the equation number. This makes
only sense when you load the documentclass with the option fleqn. The
example places the additional text at 0.5\textwidth, changing this value is
no problem.
Mathmode.tex 130
65.2 Example 2 65 VERTICAL ALIGNMENT
text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text
text text text text text
a2 + b2 = c2 abc (65.6)
z=9 (65.7)
text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text
text text text text text
This solution works only with AMSmath, without you have to redefine
the LATEX macro, which creates the equation number.
1 \ newsavebox {\ myendhook } % for the tabulars
2 \ def \ tagform@ #1{{(\ maketag@@@ {\ ignorespaces #1\ unskip \ @@italiccorr ) }
3 \ makebox [0 pt ][ r ]{ % after the equation number
4 \ makebox [0.4\ textwidth ][ l ]{\ usebox {\ myendhook }} %
5 }%
6 \ global \ sbox {\ myendhook }{} % clear box content
7 }}
8 [ ... ]
9 \ sbox {\ myendhook }{ %
10 \ begin { footnotesize } %
11 \ begin { tabular }{ @ {} ll }
12 $ a _0$ & Bohrscher Radius ($\ mathrm {= 0{ ,}53\ ,\ mbox {\ AA }}$) \\
13 $ e $ & Elementarladung \\
14 $ N _{ si }$ & Anzahl der Siliziumatome \\
15 & pro Einheitsvolumen \\
16 $ m $ & Atomgewicht \\
17 $ Z $ & Kernladungszahl
18 \ end { tabular }
19 \ end { footnotesize }}
20 %
21 \ begin { equation }
22 \ varepsilon = \ frac { E \ cdot 4 \ cdot \ pi \ cdot \ varepsilon _{0}
23 \ cdot a _0 \ cdot \ left ( Z _ i ^{\ frac {2}{3}} + Z _{ Si }^{\ frac {2}{3}}
24 \ right ) ^{ -\ frac {1}{2}}} { Z _ i \ cdot Z _{ Si } \ cdot e 2 \ cdot \ left ( 1
Mathmode.tex 131
66 NODE CONNECTIONS
25 + \ frac { m _ i }{ m _{ Si }} \ right ) }\ ,;
26 \ end { equation }
27 %
28 \ sbox {\ myendhook }{ abc }
29 %
30 \ begin { equation } a 2+ b 2= c 2 \ end { equation }
31 %
32 \ begin { equation } z = 9 \ end { equation }
66 Node connections
This is a typical application for PSTricks and it needs the package pst-node
and doesn’t work with pdflatex. Use vlatex, ps4pdf or ps2pdf.
Die Bindungsenergie im Tröpfchenmodell setzt sich aus folgenden Teilen zu-
sammen:
• dem Oberflächenanteil
• dem Volumenanteil,
2
E = av A + − af A2/3 + − ac Z(Z−1)
A1/3
+ − as (A−2Z)
A
+ Ep (1)
• dem Coulomb-Anteil
• der Symmetrieenergie
1 \ psset { nodesep =3 pt }
2 \ definecolor { lila }{ rgb }{0.6 ,0.2 ,0.5}
3 \ definecolor { darkyellow }{ rgb }{1 ,0.9 ,0}
4 Die Bindungsenergie im Tr \" opfchenmodell setzt sich aus
5 folgenden Teilen zusammen :
6 \ begin { itemize }
7 \ item dem \ rnode { b }{ Oberfl \" achenanteil }
8 \ item dem \ rnode { a }{ Volumenanteil } ,\\[1 cm ]
9 \ def \ xstrut {\ vphantom {\ frac {( A ) ^1}{( B ) ^1}}}
10 \ begin { equation }
11 E =
12 \ rnode [ t ]{ ae }{\ psframebox *[ fillcolor = darkyellow ,
13 linestyle = none ]{\ xstrut a _ vA }} +
14 \ rnode [ t ]{ be }{\ psframebox *[ fillcolor = lightgray ,
15 linestyle = none ]{\ xstrut -a _ fA ^{2/3}}} +
16 \ rnode [ t ]{ ce }{\ psframebox *[ fillcolor = green ,
17 linestyle = none ]{\ xstrut -a _ c \ frac { Z (Z -1) }{ A ^{1/3}}}} +
Mathmode.tex 132
67 SPECIAL PLACEMENT
˛
Eds = 0 (67.1.a) ∇·B =0 (67.1.b)
c
a= (67.2.a) b=1 (67.2.b)
d
ˆ
c=1 (67.3.a) 2x dx = x2 + C (67.3.b)
The new environment mtabular has two arguments, one optional and one
which is the same as the one from the tabular environment. With the option
long it is possible to have all the formulas in a longtable environment,
which allows a pagebreak. The new macro \eqnCnt controls the counting of
Mathmode.tex 133
67.1 Formulas side by side 67 SPECIAL PLACEMENT
these equations as subequations for one tabular line. This macro can have
an optional argument for a label. At least it counts the equations. If the
equation number is not centered to the foregoing equation, then it needs
some more horizontal space in the tabular column.
\eqnCnt[<optional label>]
˛
Eds = 0 (67.5.a) ∇·B =0 (67.5.b)
c
a= (67.6.a) b=1 (67.6.b)
d
ˆ
c=1 (67.7.a) 2x dx = x2 + C (67.7.b)
Mathmode.tex 134
67.2 Itemize environment 67 SPECIAL PLACEMENT
˛
Eds = 0 (67.8.a) ∇·B =0 (67.8.b)
c
a= (67.9.a) b=1 (67.9.b)
d
ˆ
c=1 (67.10.a) 2x dx = x2 + C (67.10.b)
˛
Eds = 0 (67.11.a) ∇·B =0 (67.11.b)
c
a= (67.12.a) b=1 (67.12.b)
d
ˆ
c=1 (67.13.a) 2x dx = x2 + C (67.13.b)
˛
Eds = 0 (67.14.a) ∇·B =0 (67.14.b)
c
a= (67.15.a) b=1 (67.15.b)
d
ˆ
c=1 (67.16.a) 2x dx = x2 + C (67.16.b)
Mathmode.tex 135
67.2 Itemize environment 67 SPECIAL PLACEMENT
• f =l (67.18)
ˆ
• g(x) = f (x) dx (67.19)
Mathmode.tex 136
Part VIII
Lists, bibliography and index
Mathmode.tex 137
List of Figures
Figure Page
1 multline Alignment demo (the fourth row is shifted to the
right with \shoveright) . . . . . . . . . . . . . . . . . . . . . 60
2 Demonstration of \multlinegap (default is 0pt) . . . . . . . 60
Mathmode.tex 138
List of Tables
Table Page
1 Meaning of \mathsurround . . . . . . . . . . . . . . . . . . . 13
2 Difference between the default \bigg and the \biggm command 27
3 Use of the different parentheses for the “big” commands . . . 28
4 Old font style commands . . . . . . . . . . . . . . . . . . . . . 31
5 Fonts in math mode . . . . . . . . . . . . . . . . . . . . . . . 32
6 The meaning of the math spaces . . . . . . . . . . . . . . . . 32
7 Spaces in math mode . . . . . . . . . . . . . . . . . . . . . . . 33
8 Math styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
9 Dots in math mode . . . . . . . . . . . . . . . . . . . . . . . . 39
10 Accents in math mode . . . . . . . . . . . . . . . . . . . . . . 39
11 Vectors with package esvec (in the right column the default
one from LATEX) . . . . . . . . . . . . . . . . . . . . . . . . . 42
12 The predefined operators of fontmath.ltx . . . . . . . . . . . 43
13 The predefined operators of latex.ltx . . . . . . . . . . . . . 43
14 The greek letters . . . . . . . . . . . . . . . . . . . . . . . . . 45
15 Comparison between the different align environments with the
same code, where the first three can have an equation number 51
16 Matrix environments . . . . . . . . . . . . . . . . . . . . . . . 65
17 binom commands . . . . . . . . . . . . . . . . . . . . . . . . . 68
18 The modulo commands and their meaning . . . . . . . . . . . 69
19 Different mathcommands . . . . . . . . . . . . . . . . . . . . 79
20 The predefined operators of amsopn.sty . . . . . . . . . . . . 98
21 Predefined math symbols from fontmath.ltx . . . . . . . . . 112
22 New symbols in combination with the equal sign . . . . . . . 114
Mathmode.tex 139
References
[1] Paul W. Abrahams, Karl Berry, and Kathryn Hargreaves. TEX for the
Impatient. http://tug.org/ftp/tex/impatient/book.pdf, 2003.
[7] Michael Downes. Short Math Guide for LATEX. American Mathematical
Society, http://www.ams.org/tex/short-math-guide.html, 2002.
[10] Michel Goosens, Frank Mittelbach, and Alexander Samarin. The LATEX
Companion. Addison Wesley, 13 edition, 1994.
[11] George Grätzer. Math into LATEX. Birkhäuser Boston, third edition,
2000.
Mathmode.tex 140
[15] Johannes Küster. Designing Math Fonts.
http://www.typoma.com/publ/20040430-bachotex.pdf, apr 2004.
Vortrag auf der polnischen TeX-Konferenz »BachoTeX«.
[19] Luca Padovani. Mathml formatting with tex rules and tex fonts.
TUGboat Journal, 24(1):53–61, 2003.
[20] Sebastian Rahtz and Leonor Barroca. A style option for rotated objects
in LATEX. TUGboat Journal, 13(2):156–180, July 1992.
Mathmode.tex 141
Index
Symbols \bar, 39
$, 10–12 \belowdisplayshortskip, 35
\!, 107 \belowdisplayshortskip, 82
\(, 10 \belowdisplayskip, 35
\), 10 \belowdisplayskip, 36, 82
\„ 33 \bf, 31
\:, 33 \Big, 26
\;, 33 \big, 26
\[, 14, 36 Bigg, 28
\], 14, 36 \Bigg, 26
\bigg, 26
A \Biggm, 27
\above, 90 \biggm, 27
\abovedisplayshortskip, 35 \Bigl, 26
\abovedisplayshortskip, 82 \bigl, 26
\abovedisplayskip, 35 \Bigm, 27
\abovedisplayskip, 36, 82, 136 \bigm, 27
\abovewithdelims, 91 \bigr, 26
\acute, 39 Binom, 46
\acute, 39 \Binomial, 102
aligned, 57 \binoppenalty, 94
alignedat, 57 \Bmatrix, 65
Alignment \bmatrix, 65
– left, 54 Bold greek letters, 79
\allowdisplaybreaks, 45 \boldmath, 47
\ArcCos, 101 \boldmath, 47
\ArcCot, 101 \bordermatrix, 22
\ArcCsc, 101 \bordermatrix, 22
\ArcSec, 101 \boxed, 78
\ArcSin, 101 boxed inline math, 12
\ArcTan, 101 Braces, 100
array, 56 – Problems, 73
array, 22, 37, 97–99 \Braket, 100
\arraycolsep, 20, 21 \breve, 39
\arraystretch, 37 \breve, 39
Arrows, 77
\atop, 72 C
\atop, 24, 46, 91 \cal, 31
\atopwithdelims, 91 \cancel, 101
Cases
B
– numbered lines, 118
\bar, 39
142
\cases, 20, 63 \dfrac, 11
\catcode, 86 differential equation, 116
\cdot, 116 Display math mode, 10
\cdots, 39 \displaybreak, 45
\cdots, 116 displayindent, 84
centertags, 50 \displayindent, 83
\cfrac, 66 \displaylimits, 91
\chapter, 11 displaymath, 20
\check, 39 \displaystyle, 67
\check, 39 \displaystyle, 11, 38, 86, 88
\choose, 46 \displaywidowpenalty, 94
\clap, 73 \displaywidth, 84
cmex10, 29 dot, 34, 116
cmr, 109 \dot, 39
colon, 116 \dot, 39
Color, 46 \doteq, 114
color, 123 \dotsb, 39
\colorbox, 12 \dotsc, 39
\columncolor, 123 \dotsi, 39
comma, 34, 116 \dotsm, 39
Computer modern, 109 \dotso, 39
\cong, 114 double stroke, 31
\Cos, 101 dsfont, 31
\Cot, 101
\Csc, 101 E
ctagsplit, 71 ellipses, 116
empheq, 103, 104
D \ensuremath, 46
\DblFactorial, 102 Environment
\ddddot, 65 – array, 22, 37, 97–99
\dddot, 39, 65 – description, 48
\dddot, 39 – displaymath, 20
\ddot, 39 – empheq, 103, 104
\ddot, 39 – eqnarray, 15, 20, 36, 51, 103
\ddots, 39 – equation, 20, 36
decimal point, 34 – gathered, 107
\DeclareMathDelimiter, 86 – graphicx, 107
\delcode, 86 – lgathered, 107
Delimiter, 14, 29 – matrix, 24
\delimiter, 86 – tabular, 20
\delimiterfactor, 30, 82 \eqdef, 46
\delimitershortfall, 30, 83 eqnarray, 15, 20, 36, 51, 103
description, 48 \eqno, 92
\dfrac, 67 Equation
Mathmode.tex 143
– number, 71 greek, 45
– numbering, 69 – bold, 45
equation, 20, 36 – upright, 45
Equation number, 71
equation number, 130 H
\equiv, 114 Harpoon, 113
\everydisplay, 49 \hat, 39
\everydisplay, 92 \hat, 39
\everymath, 49 \hcancel, 100
\everymath, 92 \hdotsfor, 65
Exponent, 42 Helvetica, 109
Extensible arrows, 77 \hphantom, 33, 127
\hphantom, 33, 34
F \hspace, 33
\Factorial, 102 \Huge, 38
\fam, 87 \huge, 106
\fbox, 12, 18, 103 \HurwitzZeta, 102
\fboxrule, 12 \Hypergeometric, 102
\fboxsep, 12
fleqn, 50 I
fleqn, 36 \imath, 40
Font \IncGamma, 102
– cmex10, 29 Indentation, 54, 83
– lm, 109 Indice, 42
fontmath.ltx, 29 \int, 11, 43, 106
Fontsize, 38 Integral, 116
\frac, 46, 107 Integral symbols, 112
Fraction, 11, 66, 107 \intertext, 76
\frac, 66 intlimits, 50
Framed inline math, 12 \intop, 43
\it, 31
G Italic, 30, 74
\GammaFunc, 102 \item, 48
gather, 57 itemize, 135
gathered, 57
gathered, 107 J
\genfrac, 66 \jmath, 40
\GenIncGamma, 102 \jot, 36, 37
\GenRegIncGamma, 102
K
\GenRegIncGammaInv, 102
\kern, 33
graphicx, 107
\grave, 39 L
\grave, 39 Label, 18
Greek, 44 \label, 71
Mathmode.tex 144
\labelwidth, 83 – \Cot, 101
\Large, 38 – \Csc, 101
large, 38 – \DblFactorial, 102
Latin modern, 109 – \DeclareMathDelimiter, 86
\ldelim, 99 – \Factorial, 102
\ldots, 39 – \GammaFunc, 102
\ldots, 116 – \GenIncGamma, 102
\left, 26, 92, 99 – \GenRegIncGammaInv, 102
Left aligned, 55 – \GenRegIncGamma, 102
Length – \Huge, 38
– \abovedisplayskip, 36, 136 – \HurwitzZeta, 102
– \arraycolsep, 20, 21 – \Hypergeometric, 102
– \belowdisplayskip, 36 – \IncGamma, 102
– \delimitershortfall, 30 – \Large, 38
– \fboxrule, 12 – \LogGamma, 102
– \fboxsep, 12 – \MathieuCharacteristicA, 102
– \jot, 36, 37 – \MathieuCharacteristicB, 102
– \mathsurround, 13 – \MathieuCharacteristicExponent,
– \topsep, 36 102
leqno, 50 – \MathieuCharisticA, 102
\leqno, 92 – \MathieuCharisticB, 102
lgathered, 107 – \MathieuCharisticExp, 102
\lim, 11 – \MathieuC, 102
Limits, 24, 44, 72, 74 – \MathieuS, 102
limits, 11 – \MeijerG, 102
\limits, 11, 43, 92, 93 – \Multinomial, 102
lm, 109 – \Pochhammer, 102
\LogGamma, 102 – \RegHypergeometric, 102
longtable, 134 – \RegIncGammaInv, 102
– \RegIncGamma, 102
M – \RiemannSiegelTheta, 102
Macro – \RiemannSiegelZ, 102
– \ArcCos, 101 – \RiemannZeta, 102
– \ArcCot, 101 – \Sec, 101
– \ArcCsc, 101 – \Set, 100
– \ArcSec, 101 – \Sin, 101
– \ArcSin, 101 – \StieltjesGamma, 102
– \ArcTan, 101 – \Tan, 101
– \Biggm, 27 – \Zeta, 102
– \Bigl, 26 – \[, 14, 36
– \Bigm, 27 – \], 14, 36
– \Binomial, 102 – \acute, 39
– \Braket, 100 – \allowdisplaybreaks, 45
– \Cos, 101 – \arraystretch, 37
Mathmode.tex 145
– \atop, 24, 46 – \ldots, 116
– \bar, 39 – \left, 26, 99
– \biggm, 27 – \limits, 11, 43, 93
– \bigl, 26 – \lim, 11
– \bigm, 27 – \makebox, 25, 130
– \bigr, 26 – \mathbf, 48, 99
– \boldmath, 47 – \mathchar, 88
– \bordermatrix, 22 – \mathcode, 86
– \breve, 39 – \mathlarger, 108
– \cancel, 101 – \mathord, 35
– \catcode, 86 – \mathpunct, 35
– \cdots, 116 – \mathring, 39
– \cdot, 116 – \mathrlap, 114
– \chapter, 11 – \mathversion, 47
– \check, 39 – \mbox, 30
– \choose, 46 – \medmuskip, 32, 34
– \colorbox, 12 – \nicefrac, 107
– \cong, 114 – \nolimits, 43
– \dddot, 39 – \nonumber, 14–16
– \ddot, 39 – \ointop, 43
– \delimiterfactor, 30 – \oint, 43
– \dfrac, 11 – \overbrace, 39, 41
– \displaybreak, 45 – \overbracket, 40
– \displaystyle, 11, 38, 88 – \overleftarrow, 39
– \doteq, 114 – \overleftrightarrow, 39
– \dot, 39 – \overline, 39
– \ensuremath, 46 – \overrightarrow, 39
– \eqdef, 46 – \overset, 25
– \equiv, 114 – \parbox, 30
– \everydisplay, 92 – \part, 11
– \fbox, 12, 18, 103 – \pmb, 44
– \frac, 46, 107 – \prod, 11, 24
– \grave, 39 – \rdelim, 99
– \hat, 39 – \right, 26, 99
– \hcancel, 100 – \scalebox, 107
– \hphantom, 33, 34 – \scriptscriptstyle, 38, 88
– \huge, 106 – \scriptstyle, 38, 88
– \imath, 40 – \section, 11, 48
– \intop, 43 – \show, 34
– \int, 11, 43, 106 – \smash, 26
– \item, 48 – \sqrt, 25
– \jmath, 40 – \stackrel, 45
– \labelwidth, 83 – \sum, 11, 24, 106
– \ldelim, 99 – \texorpdfstring, 12
Mathmode.tex 146
– \textstyle, 30, 38, 88 \MathieuCharacteristicExponent, 102
– \thickmuskip, 33 \MathieuCharisticA, 102
– \thinmuskip, 32, 34 \MathieuCharisticB, 102
– \tilde, 39 \MathieuCharisticExp, 102
– \underbar, 39 \MathieuS, 102
– \underbrace, 39, 41 \mathindent, 50
– \underbracket, 40 \mathinner, 93
– \underleftarrow, 39 \mathit, 31
– \underleftrightarrow, 39 \mathlarger, 108
– \underline, 39 \mathop, 89
– \underrightarrow, 39 \mathopen, 89
– \underset, 25 mathopen symbol, 27
– \vec, 39 \mathord, 35, 89
– \vert, 29 \mathpunct, 35, 89
– \vphantom, 25, 99 \mathrel, 89
– \vskip, 37 \mathring, 39
– \widehat, 39 \mathring, 39
– \widetilde, 39 \mathrlap, 114
– \xymatrix, 108 \mathrm, 31, 75
\makebox, 25, 130 \mathsf, 31
\mapstofill, 77 \mathsurround, 13, 84
Math operator, 11 \mathtt, 31
Math unit, 69 \mathversion, 47
math unit, 32 \mathversion, 47
\mathaccent, 87 \matrix, 65
\mathbb, 31 matrix, 24
\mathbf, 31 \mbox, 75
\mathbf, 48, 99 \mbox, 30
\mathbin, 87 \medmuskip, 32, 34, 84
\mathcal, 31 \medspace, 33
\mathchar, 87, 88 \MeijerG, 102
\mathchardef, 88 \mkern, 84
\mathchoice, 88 \mskip, 84
\mathclap, 73, 127 \Multinomial, 102
\mathclose, 88 Multiple exponents, 42
\mathcode, 86, 88 multline, 61
\mathds, 31 \multlinegap, 60
\mathfrak, 31 \muskip, 85
Mathieu \muskipdef, 85
– Characteristics, 102
– Functions, 102 N
\MathieuC, 102 namelimits, 50
\MathieuCharacteristicA, 102 \negmedspace, 33
\MathieuCharacteristicB, 102 \negthickspace, 33
Mathmode.tex 147
\negthinspace, 33 – color, 100
\nicefrac, 107 – cool, 101
nointlimits, 50 – delarray, 103
\nolimits, 43, 93 – empheq, 104
nonamelimits, 50 – esint, 128
\nonscript, 85 – esvect, 42
\nonumber, 14–16 – eucal, 105
nosumlimits, 50 – exscale, 39, 106, 108
\nulldelimiterspace, 85 – hvmath, 109
– hyperref, 12
O – icomma, 35
\oint, 43 – leqno, 17
\ointop, 43 – mathpazo, 110
Operator, 43 – mathtools, 106, 107
– names, 74 – multirow, 97
– size, 107 – nicefrac, 107
\operatornamewithlimits, 74 – numprint, 34
\over, 93 – pamath, 109, 110
\overbrace, 39, 125 – pstricks, 97
\overbrace, 39, 41 – relsize, 108
\overbracket, 40 – remreset, 16
\overleftarrow, 39 – setspace, 37
\overleftarrow, 39 – units, 107
\overleftrightarrow, 39 – upgreek, 45
\overleftrightarrow, 39 – wasysym, 104
\overline, 39 – xypic, 97, 108
\overline, 39, 93 – xy, 108
\overrightarrow, 39, 42 Pagebreak, 45
\overrightarrow, 39 Palatino, 109, 110
\overset, 79 \parbox, 64
\overset, 25 \parbox, 30
\overwithdelims, 93 \part, 11
\phantom, 118
P
\pmatrix, 65
Package
\pmb, 79
– accent, 97
\pmb, 44
– amscd, 97
\Pochhammer, 102
– amsmath, 90
Polylogarithm, 102
– amsopn, 97
\postdisplaypenalty, 95
– amssymb, 34, 39
\predisplaypenalty, 95
– bigdelim, 98
\predisplaystyle, 85
– bm, 45, 48, 99
\prod, 11, 24
– braket, 29, 99
punctuation, 116
– calc, 18
Mathmode.tex 148
Q \smallmatrix, 65
\qquad, 33 \smash, 26
\quad, 33 Spacing
– vertical, 37
R Split equation, 56
\radical, 93 \sqrt, 25
\rdelim, 99 Stacked limits, 73
Reference, 18 \stackrel, 45
\reflectbox, 39 \StieltjesGamma, 102
\RegHypergeometric, 102 Style, 38
\RegIncGamma, 102 Subequations, 70
\RegIncGammaInv, 102 Subscript, 11
\relpenalty, 95 \substack, 72, 73, 127
reqno, 50 \sum, 74
\RiemannSiegelTheta, 102 \sum, 11, 24, 106
\RiemannSiegelZ, 102 sumlimits, 50
\RiemannZeta, 102 Superscript, 11
\right, 26, 94, 99
righttag, 71 T
\rm, 31 tabular, 20
Root, 25, 68 \tag, 18
\rowcolor, 123 \Tan, 101
tbtags, 50
S \texorpdfstring, 12
\scalebox, 107 Text, 30
\scriptfont, 89 – \parbox, 30
\scriptscriptfont, 89 \textfont, 90
\scriptscriptstyle, 38, 88, 90 \textstyle, 30, 38, 88, 90
\scriptspace, 85 \tfrac, 67
scriptstyle, 11 \thickmuskip, 33, 85
\scriptstyle, 11, 67 \thickspace, 33
\scriptstyle, 38, 88, 90 \thinmuskip, 32, 34, 85
\Sec, 101 \thinspace, 33
\section, 11, 48 \tilde, 39
\Set, 100 \tilde, 39
Set symbol, 31 \topsep, 36
\shoveright, 60 \tt, 31
\show, 34
\sideset, 74 U
\Sin, 101 \unboldmath, 47
Size \underbar, 39
– Operator, 107 \underbar, 39
\skew, 90 \underbrace, 39, 125, 127
\skewchar, 90 \underbrace, 39, 41
Mathmode.tex 149
\underbracket, 40 – Functions, 102
\underleftarrow, 39 – Hurwitz, 102
\underleftarrow, 39 – Riemann, 102
\underleftrightarrow, 39 \Zeta, 102
\underleftrightarrow, 39
\underline, 39, 49
\underline, 39, 94
\underrightarrow, 39
\underrightarrow, 39
\underset, 79, 128
\underset, 25
Upright letters, 42
\uproot, 68
V
\vcenter, 94
\vdots, 39
\vec, 39
\vec, 39
Vector, 42, 121
\vert, 29
Vertical spacing, 37
\Vmatrix, 65
\vmatrix, 65
\vphantom, 127
\vphantom, 25, 99
\vskip, 37
W
\widehat, 39
\widehat, 39
\widetilde, 39
\widetilde, 39
X
\xleftharpoondown, 113
\xleftharpoonup, 113
\xleftrightharpoons, 113
\xrightharpoondown, 113
\xrightharpoonup, 113
\xrightleftharpoons, 113
\xymatrix, 108
Z
Zeta, 102
Mathmode.tex 150