BookML test: mathtools user guide

Morten Høgholm, Lars Madsen and the 3 project

2026-03-02

BookML

v0.29.4

0.8.8

2018/12/01

1 Tools for mathematical typesetting

1.0.1 A complement to \smash, \llap, and \rlap

X=1ijnXijX=\sum_{1\leq i\leq j\leq n}X_{ij}
X=1ijnXijX=\sum_{\mathclap{1\leq i\leq j\leq n}}X_{ij}

1.0.2 Forcing a cramped style

equation (1) (1)
a2<b2<ca2<b2<c\sum_{\mathclap{a^{2}<b^{2}<c}}\qquad\sum_{a^{2}<b^{2}<c}
a2<b2<ca2<b2<c\sum_{\mathclap{a^{2}<b^{2}<c}}\qquad\sum_{a^{2}<b^{2}<c}
x2x2x2x2\cramped{x^{2}}\leftrightarrow x^{2}\quad\cramped[\scriptstyle]{x^{2}}% \leftrightarrow{\scriptstyle x^{2}}

The 2005 Euro conference is held in Abbaye des Prémontrés, France, marking the 16th (2222^{2^{2}}) anniversary of both Dante and GUTenberg (the German and French users group resp.).

The 2005 Euro conference is held in Abbaye des Prémontrés, France, marking the 16th (222\cramped{2^{2^{2}}}) anniversary of both Dante and GUTenberg (the German and French users group resp.).

equation (1*) (1*)
a2<b2<c\sum_{\mathclap{a^{2}<b^{2}<c}}
a2<b2<ca2<b2<c\sum_{\begin{subarray}{c}a^{2}<b^{2}<c\end{subarray}}\qquad\sum_{a^{2}<b^{2}<c}
\crampedsubstacka2<b2<ca2<b2<c\sum_{\crampedsubstack{a^{2}<b^{2}<c}}\qquad\sum_{a^{2}<b^{2}<c}

1.0.3 Smashing an operator

V=1ijnVijX=1ijn3456XijY=1ijnYijZ=𝑇1ijnZijV=\sum_{1\leq i\leq j\leq n}^{\infty}V_{ij}\quad X=\smashoperator[]{\sum_{1% \leq i\leq j\leq n}^{3456}}X_{ij}\quad Y=\smashoperator[r]{\sum_{1\leq i\leq j% \leq n}^{}}Y_{ij}\quad Z=\smashoperator[l]{\mathop{T}_{1\leq i\leq j\leq n}^{}% }Z_{ij}

1.0.4 Adjusting limits of operators

a)limnmaxpnb)limnmaxp2nc)limnsupp2nKd)lim supnmaxpn\text{a)}\lim_{n\to\infty}\max_{p\geq n}\quad\text{b)}\lim_{n\to\infty}\max_{p% ^{2}\geq n}\quad\text{c)}\lim_{n\to\infty}\sup_{p^{2}\geq nK}\quad\text{d)}% \limsup_{n\to\infty}\max_{p\geq n}
a)limnmaxpnb)limnmaxp2nc)limnsupp2nKd)lim supnmaxpn\text{a)}\adjustlimits{\lim}_{n\to\infty}{\max}_{p\geq n}\quad\text{b)}% \adjustlimits{\lim}_{n\to\infty}{\max}_{p^{2}\geq n}\quad\text{c)}% \adjustlimits{\lim}_{n\to\infty}{\sup}_{p^{2}\geq nK}\quad\text{d)}% \adjustlimits{\limsup}_{n\to\infty}{\max}_{p\geq n}

1.0.5 Swapping space above AmS display math environments

A\displaystyle A
=B\displaystyle{}=B
A\displaystyle\SwapAboveDisplaySkip A
=B\displaystyle{}=B

1.1 Controlling tags

equation [2] [2]
Emc3E\neq mc^{3}
equation [3] [3]
Emc3E\neq mc^{3}

1.1.1 Showing only referenced tags

equation Q&A Q&A
a=ba=b

See Q&A or is it better with Q&A?

equation [4] [4]
a=a\displaystyle a=a
equation [**] [**]
b=b\displaystyle b=b

This should refer to the equation containing a=aa=a: [4]. Then a switch of tag forms.

equation (5) (5)
c\displaystyle c
=c\displaystyle{}=c
equation (6) (6)
d\displaystyle d
=d\displaystyle{}=d

This should refer to the equation containing d=dd=d: (6).

equation (7) (7)
e=ee=e

Back to normal.

equation (8) (8)
f=ff=f

1.2 Extensible symbols

AunderoverBA\xLeftarrow[under]{over}B
A\displaystyle A
belowaboveB\displaystyle{}\xleftrightarrow[below]{above}B
A\displaystyle A
belowaboveB\displaystyle{}\xRightarrow[below]{above}B
A\displaystyle A
belowaboveB\displaystyle{}\xLeftarrow[below]{above}B
A\displaystyle A
belowaboveB\displaystyle{}\xLeftrightarrow[below]{above}B
A\displaystyle A
belowaboveB\displaystyle{}\xhookleftarrow[below]{above}B
A\displaystyle A
belowaboveB\displaystyle{}\xhookrightarrow[below]{above}B
A\displaystyle A
belowaboveB\displaystyle{}\xmapsto[below]{above}B
A\displaystyle A
belowaboveB\displaystyle{}\xrightharpoondown[below]{above}B
A\displaystyle A
belowaboveB\displaystyle{}\xrightharpoonup[below]{above}B
A\displaystyle A
belowaboveB\displaystyle{}\xleftharpoondown[below]{above}B
A\displaystyle A
belowaboveB\displaystyle{}\xleftharpoonup[below]{above}B
A\displaystyle A
belowaboveB\displaystyle{}\xrightleftharpoons[below]{above}B
A\displaystyle A
belowaboveB\displaystyle{}\xleftrightharpoons[below]{above}B
A\displaystyle A
B\displaystyle{}\longrightarrow B
A\displaystyle A
B\displaystyle{}\longleftarrow B

1.2.1 Braces and brackets

xxxyyyzzzandxxxyyyzzz\underbracket{xxx\ yyy}_{zzz}\quad\text{and}\quad\underbracket{xxx\ yyy}_{zzz}
n f o o f zzz\mathop{{\color[rgb]{0,0,1}\hbox{\lower 10.00012pt\hbox{\vbox{\hrule height=0.% 4pt\hbox{\set@color$\displaystyle{\normalcolor\displaystyle\sum}$}\hrule heigh% t=0.4pt}}}}}_{n}\mathop{{\color[rgb]{0,0,1}\hbox{\lower 2.0pt\hbox{\vbox{% \hrule height=0.4pt\hbox{\set@color$\displaystyle{\normalcolor\displaystyle% \underbrace{{\color[rgb]{0,1,0}\hbox{\lower 1.94444pt\hbox{\vbox{\hrule height% =0.4pt\hbox{\set@color$\displaystyle{\normalcolor\displaystyle foof}$}\hrule h% eight=0.4pt}}}}}}$}\hrule height=0.4pt}}}}}_{zzz}
n f o o f zzz\mathop{{\color[rgb]{0,0,1}\hbox{\lower 24.88033pt\hbox{\vbox{\hrule height=0.% 4pt\hbox{\set@color$\displaystyle{\normalcolor\displaystyle\sum}$}\hrule heigh% t=0.4pt}}}}}_{n}\mathop{{\color[rgb]{0,0,1}\hbox{\lower 2.0pt\hbox{\vbox{% \hrule height=0.4pt\hbox{\set@color$\displaystyle{\normalcolor\displaystyle% \underbrace{{\color[rgb]{0,1,0}\hbox{\lower 4.83777pt\hbox{\vbox{\hrule height% =0.4pt\hbox{\set@color$\displaystyle{\normalcolor\displaystyle foof}$}\hrule h% eight=0.4pt}}}}}}$}\hrule height=0.4pt}}}}}_{zzz}
n f o o f zzz\mathop{{\color[rgb]{0,0,1}\hbox{\lower 8.0001pt\hbox{\vbox{\hrule height=0.4% pt\hbox{\set@color$\displaystyle{\normalcolor\displaystyle\sum}$}\hrule height% =0.4pt}}}}}_{n}\mathop{{\color[rgb]{0,0,1}\hbox{\lower 2.0pt\hbox{\vbox{\hrule h% eight=0.4pt\hbox{\set@color$\displaystyle{\normalcolor\displaystyle\underbrace% {{\color[rgb]{0,1,0}\hbox{\lower 1.55556pt\hbox{\vbox{\hrule height=0.4pt\hbox% {\set@color$\displaystyle{\normalcolor\displaystyle foof}$}\hrule height=0.4pt% }}}}}}$}\hrule height=0.4pt}}}}}_{zzz}

1.3 New mathematical building blocks

1.3.1 Matrices

(1324)\begin{pmatrix}[r]-1&3\\ 2&-4\end{pmatrix}
[abcd][abcd]\begin{bmatrix}a&-b\\ -c&d\end{bmatrix}\begin{bmatrix}[r]a&-b\\ -c&d\end{bmatrix}
[abcd][abcd]\begin{bmatrix}a&-b\\ -c&d\end{bmatrix}\begin{bmatrix}[r]a&-b\\ -c&d\end{bmatrix}

1.3.2 The multlined environment

A=firstlastBA=\begin{multlined}{}\framebox[113.81102pt]{first}\\ {}\framebox[113.81102pt]{last}\end{multlined}{}\framebox[113.81102pt]{first}\\ {}\framebox[113.81102pt]{last}B
First lineSecond lineL+E+F+TR+I+G+H+TL+E+F+TR+I+G+H+TLast line\begin{multlined}{}\framebox[281.85034pt]{First line}\\ {}\framebox[216.81pt]{Second line}\\ {}L+E+F+T\\ {}R+I+G+H+T\\ {}\kern 28.45274ptL+E+F+T\\ {}R+I+G+H+T\kern 64.65291pt\\ {}\framebox[281.85034pt]{Last line}\end{multlined}{}\framebox[281.85034pt]{% First line}\\ {}\framebox[216.81pt]{Second line}\\ {}L+E+F+T\\ {}R+I+G+H+T\\ {}\kern 28.45274ptL+E+F+T\\ {}R+I+G+H+T\kern 64.65291pt\\ {}\framebox[281.85034pt]{Last line}
firstlast=B\begin{multlined}{}\framebox[113.81102pt]{first}\\ {}\framebox[113.81102pt]{last}\end{multlined}{}\framebox[113.81102pt]{first}\\ {}\framebox[113.81102pt]{last}=B

1.3.3 More cases-like environments

a={E=mc2Nothing to see herex3dxIntegral is text stylea=\begin{cases}E=mc^{2}&\text{Nothing to see here}\\ \int x-3\,dx&\text{Integral is text style}\end{cases}
{E=mc2c3.00×108m/sx3dxIntegral is display style\begin{dcases}E=mc^{2}&c\approx 3.00\times 10^{8}\,\mathrm{m}/\mathrm{s}\\ \int x-3\,dx&\text{Integral is display style}\end{dcases}
a={E=mc2Nothing to see herex3dxIntegral is display stylea=\begin{dcases*}E=mc^{2}&Nothing to see here\\ \int x-3\,dx&Integral is display style\end{dcases*}
x2for x>0x3else}\begin{rcases*}x^{2}&for $x>0$\\ x^{3}&else\end{rcases*}\quad\Rightarrow\cdots

1.3.4 Emulating indented lines in alignments

Long first line
=2nd line\displaystyle{}=\framebox[170.71652pt][c]{2nd line}
\displaystyle{}\leq\dots
Long first line
=\displaystyle={}
2nd line
+last part\displaystyle{}+\framebox[113.81102pt][c]{last part}

1.3.5 Boxing a single line in an alignment

f(x)\displaystyle f(x)
=h(x)𝑑x\displaystyle{}=\int h(x)\,dx
=g(x)\displaystyle{}=g(x)
f(x)\displaystyle f(x)
=0\displaystyle{}=0
g(x)\displaystyle g(x)
=b\displaystyle{}=b
h(x)\displaystyle h(x)
i(x)\displaystyle{}i(x)

1.3.6 Adding arrows between lines in an alignment

equation (9) (9)
=\displaystyle{}=\framebox[85.35826pt]{}
equation (10) (10)
=\displaystyle{}=\framebox[56.9055pt]{}
=\displaystyle{}=\framebox[85.35826pt]{}
[]\displaystyle*[\Downarrow]\framebox[42.67912pt]{}
=\displaystyle{}=\framebox[56.9055pt]{}

1.3.7 Centered vdots

=\displaystyle{}=\framebox[85.35826pt]{}
\displaystyle{}\vdots
=\displaystyle{}=\framebox[85.35826pt]{}
a\displaystyle a
=b\displaystyle{}=b
\displaystyle{}\mathmakebox[\widthof{{}={}}][c]{\vdots}
=c\displaystyle{}=c
\displaystyle{}\mathmakebox[\widthof{{}={}}][c]{\vdots}
=d\displaystyle{}=d
A\displaystyle A
+B\displaystyle{}+B
=C\displaystyle{}=C
+D\displaystyle{}+D
\displaystyle{}\mathmakebox[\widthof{{}+{}}][c]{\vdots}
\displaystyle{}\mathmakebox[\widthof{{}+{}}][c]{\vdots}
C\displaystyle C
+D\displaystyle{}+D
=Y\displaystyle{}=Y
+K\displaystyle{}+K

1.4 Intertext and short intertext

equation (11) (11)
a\displaystyle a
=b\displaystyle{}=b
Some text
equation (12) (12)
c\displaystyle c
=d\displaystyle{}=d
equation (13) (13)
a\displaystyle a
=b\displaystyle{}=b
Some text
equation (14) (14)
c\displaystyle c
=d\displaystyle{}=d

1.5 Paired delimiters

|ab|\lvert\frac{a}{b}\rvert
|ab|\left\lvert\frac{a}{b}\right\rvert
|ab|\Bigg{\lvert}\frac{a}{b}\Bigg{\rvert}
A,12B|k|C\left\langle A,\frac{1}{2}\right\rangle\quad\Big{\langle}B\,\Big{|}\,\mathopen% {}\sum_{k}\,\Big{|}\,\mathopen{}C\Big{\rangle}
{xX|xx2+1>1}\left\{x\in X\>\middle|\allowbreak\>\mathopen{}\frac{\sqrt{x}}{x^{2}+1}>1\right\}

1.6 Special symbols

1.6.1 Vertically centered colon

a:=ba:=b

1.6.2 A few additional symbols

lima0f(a)×nXn×k=17BkΩ2\lim_{a\ndownarrow 0}f(a)\neq\bigtimes_{n}X_{n}\qquad\frac{\bigtimes_{k=1}^{7}% B_{k}\nuparrow\Omega}{2}

1.7 Mathematics within italic text

Compare these lines:

Subset of VV and subset of AA.

Subset of VV and subset of AA.

1.8 Left sub/superscripts

𝐂25+124𝐂25+214𝐂25+124𝐂25+14𝐂25+2{}^{4}_{12}\mathbf{C}^{5+}_{2}\quad\prescript{14}{2}{\mathbf{C}}^{5+}_{2}\quad% \prescript{4}{12}{\mathbf{C}}^{5+}_{2}\quad\prescript{14}{}{\mathbf{C}}^{5+}_{% 2}\quad\prescript{}{2}{\mathbf{C}}^{5+}_{2}
X𝐙AY𝐙𝟐A4+α𝟐4\prescript{A}{Z}{X}\to\prescript{A-4}{Z-2}{Y}+\prescript{4}{2}{\alpha}

1.9 Spreading equations

Large spaces between the lines.

equation (15) (15)
a=b\displaystyle a=b
equation (16) (16)
c=d\displaystyle c=d

Back to normal spacing.

equation (17) (17)
a=b\displaystyle a=b
equation (18) (18)
c=d\displaystyle c=d

1.10 Gathered environments

equation (19) (19)
x=1,x+1=2y=2\begin{lgathered}{}x=1,\quad x+1=2\\ {}y=2\end{lgathered}{}x=1,\quad x+1=2\\ {}y=2
equation (22) (22)
1 x=1,x+1=2 2 y=2 \displaystyle\begin{gathered}\text{}x=1,\quad x+1=2\\ \text{}y=2\end{gathered}

1.11 Split fractions

a=xy+xy+xy+xy+xy+xy+xy+xy+xyz=xy+xy+xy+xy+xy+xy+xy+xy+xyza=\frac{\begin{multlined}{}xy+xy+xy+xy+xy\\ {}+xy+xy+xy+xy\end{multlined}{}xy+xy+xy+xy+xy\\ {}+xy+xy+xy+xy}{z}=\frac{\displaystyle\begin{multlined}{}xy+xy+xy+xy+xy\\ {}+xy+xy+xy+xy\end{multlined}{}xy+xy+xy+xy+xy\\ {}+xy+xy+xy+xy}{z}
xy+xy+xy+xy+xyxy+xy+xy+xy+xy+xy+xy+xy+xyz=xy+xy+xy+xy+xyxy+xy+xy+xy+xy+xy+xy+xy+xyz\frac{\begin{multlined}{}xy+xy+xy+xy+xy\\ {}\begin{multlined}{}xy+xy+xy+xy+xy\\ {}+xy+xy+xy+xy\end{multlined}{}xy+xy+xy+xy+xy\\ {}+xy+xy+xy+xy\end{multlined}{}xy+xy+xy+xy+xy\\ {}\begin{multlined}{}xy+xy+xy+xy+xy\\ {}+xy+xy+xy+xy\end{multlined}{}xy+xy+xy+xy+xy\\ {}+xy+xy+xy+xy}{z}=\frac{\begin{multlined}{}xy+xy+xy+xy+xy\\ {}\begin{multlined}{}\mathstrut xy+xy+xy+xy+xy\\ {}+xy+xy+xy+xy\end{multlined}{}\mathstrut xy+xy+xy+xy+xy\\ {}+xy+xy+xy+xy\end{multlined}{}xy+xy+xy+xy+xy\\ {}\begin{multlined}{}\mathstrut xy+xy+xy+xy+xy\\ {}+xy+xy+xy+xy\end{multlined}{}\mathstrut xy+xy+xy+xy+xy\\ {}+xy+xy+xy+xy}{z}

2 New additions