# LaTeX syntax for mathematics

Abstract

Docutils supports mathematical content with a "math" directive and role. The input format is LaTeX math syntax with support for literal Unicode symbols.

## 1 Inline formulas and displayed equations

The math role can be used for inline mathematical expressions: :math:\psi(r) = \exp(-2r) will produce $\psi \left(r\right)=\mathrm{exp}\left(-2r\right)$. Inside the backtics you can write anything you would write between dollar signs in a LaTeX document. 

The math directive is used for displayed equations. It corresponds to an equation* or align* environment in a LaTeX document. If you write:

.. math:: \psi(r) = e^{-2r}

you will get:

$\psi \left(r\right)={e}^{-2r}$

A more complex example is the definition of the Fourier transform:

.. math::
:name: Fourier transform

(\mathcal{F}f)(y)
= \frac{1}{\sqrt{2\pi}^{\ n}}
\int_{\mathbb{R}^n} f(x)\,
e^{-\mathrm{i} y \cdot x} \,\mathrm{d} x.

which is rendered as:

$\left(\mathcal{F}f\right)\left(y\right)=\frac{1}{{\sqrt{2\pi }}^{\phantom{\rule{0.25em}{0ex}}n}}{\int }_{{\mathbb{R}}^{n}}f\left(x\right)\phantom{\rule{0.1667em}{0ex}}{e}^{-\mathrm{i}y\cdot x}\phantom{\rule{0.1667em}{0ex}}\mathrm{d}x.$

The :name: option puts a label on the equation that can be linked to by hyperlink references.

Displayed equations can use \\ and & for line shifts and alignments:

.. math::

a &= (x + y)^2         &  b &= (x - y)^2 \\
&= x^2 + 2xy + y^2   &    &= x^2 - 2xy + y^2

LaTeX output will wrap it in an align* environment. The result is:

$\begin{array}{rlrl}a& =\left(x+y{\right)}^{2}& b& =\left(x-y{\right)}^{2}\\ & ={x}^{2}+2xy+{y}^{2}& & ={x}^{2}-2xy+{y}^{2}\end{array}$

## 2 Mathematical symbols

The following tables are adapted from the first edition of "The LaTeX Companion" (Goossens, Mittelbach, Samarin) and the AMS Short Math Guide.

### 2.1 Accents and embellishments

The "narrow" accents are intended for a single-letter base.

 $\stackrel{´}{x}$ \acute{x} $\stackrel{˙}{t}$ \dot{t} $\stackrel{ˆ}{x}$ \hat{x} $\stackrel{ˉ}{v}$ \bar{v} $\stackrel{¨}{t}$ \ddot{t} $\stackrel{˚}{x}$ \mathring{x} $\stackrel{˘}{x}$ \breve{x} $\stackrel{\cdots }{t}$ \dddot{t} $\stackrel{˜}{n}$ \tilde{n} $\stackrel{ˇ}{x}$ \check{x} $\stackrel{}{x}$ \grave{x} $\stackrel{\to }{x}$ \vec{x}

When adding an accent to an i or j in math, dotless variants can be obtained with \imath and \jmath: $\stackrel{ˆ}{ı}$, $\stackrel{\to }{ȷ}$.

For embellishments that span multiple symbols, use:

 $\stackrel{~}{gbi}$ \widetilde{gbi} $\stackrel{^}{gbi}$ \widehat{gbi} $\stackrel{_}{gbi}$ \overline{gbi} $\underset{_}{gbi}$ \underline{gbi} $\stackrel{⏞}{gbi}$ \overbrace{gbi} $\underset{⏟}{gbi}$ \underbrace{gbi} $\stackrel{←}{gbi}$ \overleftarrow{gbi} $\underset{←}{gbi}$ \underleftarrow{gbi} $\stackrel{\to }{gbi}$ \overrightarrow{gbi} $\underset{\to }{gbi}$ \underrightarrow{gbi} $\stackrel{↔}{gbi}$ \overleftrightarrow{gbi} $\underset{↔}{gbi}$ \underleftrightarrow{gbi}

### 2.2 Binary operators

 $*$ * $⊛$ \circledast $\ominus$ \ominus $+$ + $⊚$ \circledcirc $\oplus$ \oplus $-$ - $⊝$ \circleddash $\oslash$ \oslash $:$ : $\cup$ \cup $\otimes$ \otimes $⋒$ \Cap $⋎$ \curlyvee $±$ \pm $⋓$ \Cup $⋏$ \curlywedge $⋌$ \rightthreetimes $⨿$ \amalg $†$ \dagger $⋊$ \rtimes $\ast$ \ast $‡$ \ddagger $⧵$ \setminus $◯$ \bigcirc $\diamond$ \diamond $\setminus$ \smallsetminus $▽$ \bigtriangledown $÷$ \div $\sqcap$ \sqcap $△$ \bigtriangleup $\divideontimes$ \divideontimes $\bigsqcup$ \sqcup $⊡$ \boxdot $\dotplus$ \dotplus $\star$ \star $\boxminus$ \boxminus $⩞$ \doublebarwedge $×$ \times $⊞$ \boxplus $⋗$ \gtrdot $◃$ \triangleleft $⊠$ \boxtimes $⊺$ \intercal $▹$ \triangleright $•$ \bullet $⋋$ \leftthreetimes $\uplus$ \uplus $\cap$ \cap $⋖$ \lessdot $\vee$ \vee $\cdot$ \cdot $⋉$ \ltimes $⊻$ \veebar $⬝$ \centerdot $\mp$ \mp $\wedge$ \wedge $\circ$ \circ $\odot$ \odot $\wr$ \wr

### 2.3 Extensible delimiters

Unless you indicate otherwise, delimiters in math formulas remain at the standard size regardless of the height of the enclosed material. To get adaptable sizes, use \left and \right prefixes, for example $g\left(A,B,Y\right)=f\left(A,B,X={h}^{\left[X\right]}\left(Y\right)\right)$ or

${a}_{n}={\left(\frac{1}{2}\right)}^{n}$

Use . for "empty" delimiters:

$A={\frac{1}{1-n}\phantom{\rule{0.1667em}{0ex}}|}_{n=0}^{\infty }$

The following symbols extend when used with \left and \right:

#### 2.3.1 Pairing delimiters

 $\left(\right)$ ( ) $⟨⟩$ \langle \rangle $\left[\right]$ [ ] $⌈⌉$ \lceil \rceil $\left\{\right\}$ \{ \} $⌊⌋$ \lfloor \rfloor $||$ \lvert \rvert $⟮⟯$ \lgroup \rgroup $‖‖$ \lVert \rVert $⎰⎱$ \lmoustache \rmoustache

#### 2.3.2 Nonpairing delimiters

 $|$ | $|$ \vert $⏐$ \arrowvert $‖$ \| $‖$ \Vert $‖$ \Arrowvert $/$ / $\$ \backslash $⎪$ \bracevert

The use of | and \| for pairs of vertical bars may produce incorrect spacing, e.g., |k|=|-k| produces $|k|=|-k|$ and |\sin(x)| produces $|\mathrm{sin}\left(x\right)|$. The pairing delimiters, e.g. $|-k|$ and $|\mathrm{sin}\left(x\right)|$, prevent this problem.

### 2.4 Extensible vertical arrows

 $↑$ \uparrow $⇑$ \Uparrow $↓$ \downarrow $⇓$ \Downarrow $↕$ \updownarrow $⇕$ \Updownarrow

### 2.5 Functions (named operators)

 $\mathrm{arccos}$ \arccos $\mathrm{gcd}$ \gcd $\mathrm{Pr}$ \Pr $\mathrm{arcsin}$ \arcsin $\mathrm{hom}$ \hom $\mathrm{proj lim}$ \projlim $\mathrm{arctan}$ \arctan $inf$ \inf $\mathrm{sec}$ \sec $\mathrm{arg}$ \arg $\mathrm{inj lim}$ \injlim $\mathrm{sin}$ \sin $\mathrm{cos}$ \cos $\mathrm{ker}$ \ker $\mathrm{sinh}$ \sinh $\mathrm{cosh}$ \cosh $\mathrm{lg}$ \lg $sup$ \sup $\mathrm{cot}$ \cot $lim$ \lim $\mathrm{tan}$ \tan $\mathrm{coth}$ \coth $\mathrm{lim inf}$ \liminf $\mathrm{tanh}$ \tanh $\mathrm{csc}$ \csc $\mathrm{lim sup}$ \limsup $\overline{\mathrm{lim}}$ \varlimsup $\mathrm{deg}$ \deg $\mathrm{ln}$ \ln $\underset{_}{\mathrm{lim}}$ \varliminf $\mathrm{det}$ \det $\mathrm{log}$ \log $\underset{←}{\mathrm{lim}}$ \varprojlim $\mathrm{dim}$ \dim $max$ \max $\underset{\to }{\mathrm{lim}}$ \varinjlim $\mathrm{exp}$ \exp $min$ \min

Named operators outside the above list can be typeset with \operatorname{name}, e.g.

$\mathrm{sgn}\left(-3\right)=-1.$

The \DeclareMathOperator command can only be used in the LaTeX preamble.

### 2.6 Greek letters

Greek letters that have Latin look-alikes are rarely used in math formulas and not supported by LaTeX.

 $\Gamma$ \Gamma $\alpha$ \alpha $\mu$ \mu $\omega$ \omega $\Delta$ \Delta $\beta$ \beta $\nu$ \nu $ϝ$ \digamma $\Lambda$ \Lambda $\gamma$ \gamma $\xi$ \xi $\epsilon$ \varepsilon $\Phi$ \Phi $\delta$ \delta $\pi$ \pi $\varkappa$ \varkappa $\Pi$ \Pi $ϵ$ \epsilon $\rho$ \rho $\phi$ \varphi $\Psi$ \Psi $\zeta$ \zeta $\sigma$ \sigma $\varpi$ \varpi $\Sigma$ \Sigma $\eta$ \eta $\tau$ \tau $\varrho$ \varrho $\Theta$ \Theta $\theta$ \theta $\upsilon$ \upsilon $\varsigma$ \varsigma $Υ$ \Upsilon $\iota$ \iota $\varphi$ \phi $\vartheta$ \vartheta $\Xi$ \Xi $\kappa$ \kappa $\chi$ \chi $\Omega$ \Omega $\lambda$ \lambda $\psi$ \psi

In LaTeX, the default font for capital Greek letters is upright/roman. Italic capital Greek letters can be obtained by loading a package providing the "ISO" math style. They are used by default in MathML.

Individual Greek italic capitals can also be achieved preceding the letter name with var like \varPhi: $𝛤\phantom{\rule{0.25em}{0ex}}𝛥\phantom{\rule{0.25em}{0ex}}𝛬\phantom{\rule{0.25em}{0ex}}𝛷\phantom{\rule{0.25em}{0ex}}𝛱\phantom{\rule{0.25em}{0ex}}𝛹\phantom{\rule{0.25em}{0ex}}𝛴\phantom{\rule{0.25em}{0ex}}𝛩\phantom{\rule{0.25em}{0ex}}𝛶\phantom{\rule{0.25em}{0ex}}𝛯\phantom{\rule{0.25em}{0ex}}𝛺$

### 2.7 Letterlike symbols

 $\forall$ \forall $\aleph$ \aleph $\hslash$ \hbar $\ell$ \ell $\complement$ \complement $\beth$ \beth $\hslash$ \hslash $\wp$ \wp $\exists$ \exists $\gimel$ \gimel $\Im$ \Im $\Re$ \Re $Ⅎ$ \Finv $\daleth$ \daleth $ı$ \imath $Ⓡ$ \circledR $⅁$ \Game $\partial$ \partial $ȷ$ \jmath $Ⓢ$ \circledS $\mho$ \mho $ð$ \eth $𝕜$ \Bbbk

### 2.8 Mathematical Alphabets

Mathematical alphabets select a combination of font attributes (shape, weight, family) . They are intended for mathematical variables where style variations are important semantically.

command

example

result

\mathbf

\mathbf{r}^2=x^2+y^2+z^2

${\mathbf{r}}^{2}={x}^{2}+{y}^{2}+{z}^{2}$

\mathbb

\mathbb{R \subset C}

$R\subset C$

\mathcal

\mathcal{F}f(x)

$\mathcal{F}f\left(x\right)$

\mathfrak

\mathfrak{a}

$\mathfrak{a}$

\mathit

\mathit{\Gamma}

$\mathit{\Gamma }$

\mathrm

s_\mathrm{out}

${s}_{\mathrm{out}}$

\mathsf

\mathsf x

$\mathsf{x}$

\mathtt

\mathtt{0.12}

$0.12$

Additional alphabets are defined in LaTeX packages, e.g.

TeX command

LaTeX package

MathML "mathvariant"

mathbfit

isomath

bold-italic

mathsfit

isomath

sans-serif-italic

mathsfbfit

isomath

sans-serif-bold-italic

mathscr

mathrsfs

script

This can be used to typeset vector symbols in bold italic in line with the International Standard [ISO-80000-2].

The package mathrsfs (and some drop-in replacements) define the \mathscr macro that selects a differently shaped "script" alphabet. Compare $A,B,\dots ,Z,a,b,\dots ,z$ with $A,B,\dots ,Z,a,b,\dots ,z$.

In contrast to the math alphabet selectors, \boldsymbol only changes the font weight. In LaTeX, it can be used to get a bold version of any mathematical symbol (for other output formats, results are mixed):

$\mathrm{cos}\left(x\right)±\alpha \approx 3\Gamma \phantom{\rule{1em}{0ex}}\forall x\in \mathbb{R}$

### 2.9 Miscellaneous symbols

 $#$ \# $♣$ \clubsuit $¬$ \neg $&$ \& $♢$ \diamondsuit $\nexists$ \nexists $\angle$ \angle $\varnothing$ \emptyset $\prime$ \prime $‵$ \backprime $\exists$ \exists $♯$ \sharp $★$ \bigstar $♭$ \flat $♠$ \spadesuit $⧫$ \blacklozenge $\forall$ \forall $\sphericalangle$ \sphericalangle $◼$ \blacksquare $♡$ \heartsuit $◻$ \square $▴$ \blacktriangle $\infty$ \infty $\surd$ \surd $▾$ \blacktriangledown $◊$ \lozenge $\top$ \top $\perp$ \bot $\measuredangle$ \measuredangle $△$ \triangle $⟍$ \diagdown $\nabla$ \nabla $▽$ \triangledown $⟋$ \diagup $♮$ \natural $⌀$ \varnothing

### 2.10 Punctuation

 $.$ . $!$ ! $⋮$ \vdots $/$ / $?$ ? $\cdots$ \dotsb $|$ | $:$ \colon  $\dots$ \dotsc $\text{'}$ ' $\cdots$ \cdots $\cdots$ \dotsi $;$ ; $\ddots$ \ddots $\cdots$ \dotsm $:$ : $\dots$ \ldots $\dots$ \dotso

### 2.11 Relation symbols

#### 2.11.1 Arrows

 $↺$ \circlearrowleft $↻$ \circlearrowright $↶$ \curvearrowleft $↷$ \curvearrowright $↩$ \hookleftarrow $↪$ \hookrightarrow $←$ \leftarrow $\to$ \rightarrow $⇐$ \Leftarrow $⇒$ \Rightarrow $↢$ \leftarrowtail $↣$ \rightarrowtail $↽$ \leftharpoondown $⇁$ \rightharpoondown $↼$ \leftharpoonup $⇀$ \rightharpoonup $⇇$ \leftleftarrows $⇉$ \rightrightarrows $↔$ \leftrightarrow $⇔$ \Leftrightarrow $⇆$ \leftrightarrows $⇄$ \rightleftarrows $⇋$ \leftrightharpoons $⇌$ \rightleftharpoons $↭$ \leftrightsquigarrow $⇝$ \rightsquigarrow $⇚$ \Lleftarrow $⇛$ \Rrightarrow $⟵$ \longleftarrow $⟶$ \longrightarrow $⟸$ \Longleftarrow $⟹$ \Longrightarrow $⟷$ \longleftrightarrow $⟺$ \Longleftrightarrow $↫$ \looparrowleft $↬$ \looparrowright $↰$ \Lsh $↱$ \Rsh $↦$ \mapsto $⟼$ \longmapsto $⊸$ \multimap $↚$ \nleftarrow $↛$ \nrightarrow $⇍$ \nLeftarrow $⇏$ \nRightarrow $↮$ \nleftrightarrow $⇎$ \nLeftrightarrow $↖$ \nwarrow $↗$ \nearrow $↙$ \swarrow $↘$ \searrow $↞$ \twoheadleftarrow $↠$ \twoheadrightarrow $↿$ \upharpoonleft $↾$ \upharpoonright $⇃$ \downharpoonleft $⇂$ \downharpoonright $⇈$ \upuparrows $⇊$ \downdownarrows

Synonyms: $←$ \gets, $\to$ \to, $↾$ \restriction.

#### 2.11.2 Comparison

 $<$ < $\ge$ \geq $\ll$ \ll $\prec$ \prec $=$ = $\geqq$ \geqq $⋘$ \lll $⪷$ \precapprox $>$ > $⩾$ \geqslant $⪉$ \lnapprox $\preccurlyeq$ \preccurlyeq $\approx$ \approx $\gg$ \gg $⪇$ \lneq $⪯$ \preceq $\approxeq$ \approxeq $⋙$ \ggg $\lneqq$ \lneqq $⪹$ \precnapprox $\asymp$ \asymp $⪊$ \gnapprox $⋦$ \lnsim $⪵$ \precneqq $\backsim$ \backsim $⪈$ \gneq $\ncong$ \ncong $⋨$ \precnsim $\backsimeq$ \backsimeq $\gneqq$ \gneqq $\ne$ \neq $\precsim$ \precsim $\bumpeq$ \bumpeq $⋧$ \gnsim $\ngeqq$ \ngeq $\risingdotseq$ \risingdotseq $\Bumpeq$ \Bumpeq $⪆$ \gtrapprox $\geqq ̸$ \ngeqq $\sim$ \sim $\circeq$ \circeq $⋛$ \gtreqless $⩾̸$ \ngeqslant $\simeq$ \simeq $\cong$ \cong $⪌$ \gtreqqless $\ngtr$ \ngtr $\succ$ \succ $⋞$ \curlyeqprec $\gtrless$ \gtrless $\nleqq$ \nleq $⪸$ \succapprox $⋟$ \curlyeqsucc $\gtrsim$ \gtrsim $\leqq ̸$ \nleqq $\succcurlyeq$ \succcurlyeq $\doteq$ \doteq $\le$ \leq $⩽̸$ \nleqslant $⪰$ \succeq $\doteqdot$ \doteqdot $\leqq$ \leqq $\nless$ \nless $⪺$ \succnapprox $\eqcirc$ \eqcirc $⩽$ \leqslant $\nprec$ \nprec $⪶$ \succneqq $\eqsim$ \eqsim $⪅$ \lessapprox $⋠$ \npreceq $⋩$ \succnsim $⪖$ \eqslantgtr $⋚$ \lesseqgtr $\nsim$ \nsim $\succsim$ \succsim $⪕$ \eqslantless $⪋$ \lesseqqgtr $\nsucc$ \nsucc $\approx$ \thickapprox $\equiv$ \equiv $\lessgtr$ \lessgtr $⋡$ \nsucceq $\sim$ \thicksim $\fallingdotseq$ \fallingdotseq $\lesssim$ \lesssim $\triangleq$ \triangleq

The commands \lvertneqq and \gvertneqq are not supported by LateX2MathML, as there is no corresponding Unicode character.

Synonyms: $\ne$ \ne, $\le$ \le, $\ge$ \ge, $\doteqdot$ \Doteq, $⋘$ \llless, $⋙$ \gggtr.

Symbols can be negated prepending \not, e.g. $\ne$ \not=, $\not\equiv$ \not\equiv, $\not\gtrless$ \not\gtrless, $\not\lessgtr$ \not\lessgtr.

#### 2.11.3 Miscellaneous relations

 $∍$ \backepsilon $⋬$ \ntrianglelefteq $\subseteq$ \subseteq $\because$ \because $⋫$ \ntriangleright $⫅$ \subseteqq $\between$ \between $⋭$ \ntrianglerighteq $⊊$ \subsetneq $◂$ \blacktriangleleft $⊬$ \nvdash $⫋$ \subsetneqq $▸$ \blacktriangleright $⊮$ \nVdash $\supset$ \supset $\bowtie$ \bowtie $⊭$ \nvDash $⋑$ \Supset $⊣$ \dashv $⊯$ \nVDash $\supseteq$ \supseteq $⌢$ \frown $\parallel$ \parallel $⫆$ \supseteqq $\in$ \in $⟂$ \perp $⊋$ \supsetneq $\mid$ \mid $⋔$ \pitchfork $⫌$ \supsetneqq $\vDash$ \models $\propto$ \propto $\therefore$ \therefore $\ni$ \ni $\mid$ \shortmid $⊴$ \trianglelefteq $\nmid$ \nmid $\parallel$ \shortparallel $⊵$ \trianglerighteq $\notin$ \notin $⌢$ \smallfrown $\propto$ \varpropto $\nparallel$ \nparallel $⌣$ \smallsmile $▵$ \vartriangle $\nmid$ \nshortmid $⌣$ \smile $⊲$ \vartriangleleft $\nparallel$ \nshortparallel $⊏$ \sqsubset $⊳$ \vartriangleright $⊈$ \nsubseteq $⊑$ \sqsubseteq $⊢$ \vdash $⫅̸$ \nsubseteqq $⊐$ \sqsupset $⊩$ \Vdash $⊉$ \nsupseteq $⊒$ \sqsupseteq $\models$ \vDash $⫆̸$ \nsupseteqq $\subset$ \subset $\Vvdash$ \Vvdash $⋪$ \ntriangleleft $⋐$ \Subset

Synonyms: $\ni$ \owns.

Symbols can be negated prepending \not, e.g. $\notin$ \not\in, $\not\ni$ \not\ni.

The commands \varsubsetneq, \varsubsetneqq, \varsupsetneq, and \varsupsetneqq are not supported by LateX2MathML, as there is no corresponding Unicode character.

### 2.12 Variable-sized operators

 $\sum$ \sum $\prod$ \prod $\bigcap$ \bigcap $⨀$ \bigodot $\int$ \int $\coprod$ \coprod $\bigcup$ \bigcup $⨁$ \bigoplus $\oint$ \oint $\bigwedge$ \bigwedge $⨄$ \biguplus $⨂$ \bigotimes $\int$ \smallint $\bigvee$ \bigvee $⨆$ \bigsqcup

Larger symbols are used in displayed formulas, sum-like symbols have indices above/below the symbol (see also scripts and limits):

$\sum _{n=1}^{N}{a}_{n}\phantom{\rule{2em}{0ex}}{\int }_{0}^{1}f\left(x\right)\phantom{\rule{0.1667em}{0ex}}dx\phantom{\rule{2em}{0ex}}\prod _{i=1}^{10}{b}_{i}\dots$

## 3 Notations

### 3.2 Extensible arrows

xleftarrow and xrightarrow produce arrows that extend automatically to accommodate unusually wide subscripts or superscripts. These commands take one optional argument (the subscript) and one mandatory argument (the superscript, possibly empty):

A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C

results in

$A\stackrel{n+\mu -1}{⟵}B\underset{T}{\overset{n±i-1}{⟶}}C$

### 3.3 Affixing symbols to other symbols

In addition to the standard accents and embellishments, other symbols can be placed above or below a base symbol with the \overset and \underset commands. The symbol is set in "scriptstyle" (smaller font size). For example, writing \overset{*}{X} becomes $\stackrel{*}{X}$ and \underset{+}{M} becomes $\underset{+}{M}$.

### 3.4 Matrices

The matrix and cases environments can also contain \\ and &:

.. math::
\left ( \begin{matrix} a & b \\ c & d \end{matrix}\right)

Result:

$\left(\begin{array}{cc}a& b\\ c& d\end{array}\right)$

The environments pmatrix, bmatrix, Bmatrix, vmatrix, and Vmatrix have (respectively) ( ), [ ], { }, | |, and $‖\phantom{\rule{0.25em}{0ex}}‖$ delimiters built in, e.g.

$\left(\begin{array}{cc}a& b\\ c& d\end{array}\right)\phantom{\rule{2em}{0ex}}\left[\begin{array}{cc}a& b\\ c& d\end{array}\right]\phantom{\rule{2em}{0ex}}‖\begin{array}{cc}a& b\\ c& d\end{array}‖$

To produce a small matrix suitable for use in text, there is a smallmatrix environment $\left(\begin{array}{cc}a& b\\ c& d\end{array}\right)$ that comes closer to fitting within a single text line than a normal matrix.

For piecewise function definitions there is a cases environment:

$\mathrm{sgn}\left(x\right)=\left\{\begin{array}{ll}-1& x<0\\ \phantom{-}1& x>0\end{array}$

### 3.5 Spacing commands

Horizontal spacing of elements can be controlled with the following commands:

 $3\phantom{\rule{2em}{0ex}}4$ 3\qquad 4 = 2em $3\phantom{\rule{1em}{0ex}}4$ 3\quad 4 = 1em 3~4 3\nobreakspace 4 $3\phantom{\rule{0.25em}{0ex}}4$ 3\ 4 escaped space $3\phantom{\rule{0.2778em}{0ex}}4$ 3\;4 3\thickspace 4 $3\phantom{\rule{0.2222em}{0ex}}4$ 3\:4 3\medspace 4 $3\phantom{\rule{0.1667em}{0ex}}4$ 3\,4 3\thinspace 4 $34$ 3 4 regular space  $3\phantom{\rule{-0.1667em}{0ex}}4$ 3\!4 3\negthinspace 4 negative space  $3\phantom{\rule{-0.2222em}{0ex}}4$ 3\negmedspace 4 $3\phantom{\rule{-0.2778em}{0ex}}4$ 3\negthickspace 4 $3\phantom{\rule{1ex}{0ex}}4$ 3\hspace{1ex}4 custom length $3\phantom{\rule{1.1111111111111112em}{0ex}}4$ 3\mspace{20mu}4 custom length 

There are also three commands that leave a space equal to the height and width of its argument. For example \phantom{XXX} results in space as wide and high as three X’s:

$\frac{\phantom{XXX}+1}{XXX-1}$

The commands \hphantom and \vphantom insert space with the width or height of the argument. They are not supported with math_output MathML.

### 3.6 Modular arithmetic and modulo operation

The commands \bmod, \pmod, \mod, and \pod deal with the special spacing conventions of the “mod” notation. 

command

example

result

\bmod

\gcd(n,m \bmod n)

$\mathrm{gcd}\left(n,mmodn\right)$

\pmod

x\equiv y \pmod b

$x\equiv y\phantom{\rule{0.444em}{0ex}}\left(\mathrm{mod}\phantom{\rule{0.333em}{0ex}}b\right)$

\mod

x\equiv y \mod c

$x\equiv y\phantom{\rule{0.667em}{0ex}}\mathrm{mod}\phantom{\rule{0.333em}{0ex}}c$

\pod

x\equiv y \pod d

$x\equiv y\phantom{\rule{0.444em}{0ex}}\left(d\right)$

\operatorname{mod}(m,n)

$\mathrm{mod}\left(m,n\right)$

### 3.7 Roots

command

example

result

\sqrt

\sqrt{x^2-1}

$\sqrt{{x}^{2}-1}$

\sqrt[3n]{x^2-1}

$\sqrt[3n]{{x}^{2}-1}$

\sqrt\frac{1}{2}

$\sqrt{\frac{1}{2}}$

### 3.8 Boxed formulas

The command \boxed puts a box around its argument:

$\overline{)\eta \le C\left(\delta \left(\eta \right)+{\Lambda }_{M}\left(0,\delta \right)\right)}$

## 5 Delimiter sizes

Besides the automatic scaling of extensible delimiters with \left and \right, there are four commands to manually select delimiters of fixed size:

 Sizing no \left \bigl \Bigl \biggl \Biggl command \right \bigr \Bigr \biggr \Biggr Result $\left(b\right)\left(\frac{c}{d}\right)$ $\left(b\right)\left(\frac{c}{d}\right)$ $\left(b\right)\left(\frac{c}{d}\right)$ $\left(b\right)\left(\frac{c}{d}\right)$ $\left(b\right)\left(\frac{c}{d}\right)$ $\left(b\right)\left(\frac{c}{d}\right)$

There are two or three situations where the delimiter size is commonly adjusted using these commands:

The first kind of adjustment is done for cumulative operators with limits, such as summation signs. With \left and \right the delimiters usually turn out larger than necessary, and using the Big or bigg sizes instead gives better results:

The second kind of situation is clustered pairs of delimiters, where left and right make them all the same size (because that is adequate to cover the encompassed material), but what you really want is to make some of the delimiters slightly larger to make the nesting easier to see.

$\left(\left({a}_{1}{b}_{1}\right)-\left({a}_{2}{b}_{2}\right)\right)\left(\left({a}_{2}{b}_{1}\right)+\left({a}_{1}{b}_{2}\right)\right)\phantom{\rule{1em}{0ex}}\text{versus}\phantom{\rule{1em}{0ex}}\left(\left({a}_{1}{b}_{1}\right)-\left({a}_{2}{b}_{2}\right)\right)\left(\left({a}_{2}{b}_{1}\right)+\left({a}_{1}{b}_{2}\right)\right)$

The third kind of situation is a slightly oversize object in running text, such as $|\frac{b\text{'}}{d\text{'}}|$ where the delimiters produced by \left and \right cause too much line spreading.  In that case \bigl and \bigr can be used to produce delimiters that are larger than the base size but still able to fit within the normal line spacing: $|\frac{b\text{'}}{d\text{'}}|$.

## 6 Text

The main use of the command \text is for words or phrases in a display. It is similar to \mbox in its effects but, unlike \mbox, automatically produces subscript-size text if used in a subscript, k_{\text{B}}T becomes ${k}_{\text{B}}T$.

Whitespace is kept inside the argument:

The text may contain math commands wrapped in \$ signs, e.g.

## 7 Integrals and sums

The limits on integrals, sums, and similar symbols are placed either to the side of or above and below the base symbol, depending on convention and context. In inline formulas and fractions, the limits on sums, and similar symbols like

$\underset{n\to \infty }{lim}\sum _{1}^{n}\frac{1}{n}$

move to index positions: $\underset{n\to \infty }{lim}\sum _{1}^{n}\frac{1}{n}$.

### 7.1 Altering the placement of limits

The commands \intop and \ointop produce integral signs with limits as in sums and similar: $\underset{0}{\overset{1}{\int }}$, $\underset{c}{\oint }$ and

$\underset{0}{\overset{1}{\int }}\phantom{\rule{1em}{0ex}}\underset{c}{\oint }\phantom{\rule{1em}{0ex}}\text{vs.}\phantom{\rule{1em}{0ex}}{\int }_{0}^{1}\phantom{\rule{1em}{0ex}}{\oint }_{c}$

The commands \limits and \nolimits override the default placement of the limits for any operator; \displaylimits forces standard positioning as for the sum command. They should follow immediately after the operator to which they apply.

Compare the same term with default positions, \limits, and \nolimits in inline and display mode: $\underset{x\to 0}{lim}f\left(x\right)$, $\underset{x\to 0}{lim}f\left(x\right)$, ${lim}_{x\to 0}f\left(x\right)$, vs.

$\underset{x\to 0}{lim}f\left(x\right),\phantom{\rule{1em}{0ex}}\underset{x\to 0}{lim}f\left(x\right)\phantom{\rule{1em}{0ex}}{lim}_{x\to 0}f\left(x\right).$

## 8 Changing the size of elements in a formula

The declarations  \displaystyle, \textstyle, \scriptstyle, and \scriptscriptstyle, select a symbol size and spacing that would be applied in (respectively) display math, inline math, first-order subscript, or second-order subscript, even when the current context would normally yield some other size.

For example :math:\displaystyle \sum_{n=0}^\infty \frac{1}{n} is printed as $\sum _{n=0}^{\infty }\frac{1}{n}$ rather than $\sum _{n=0}^{\infty }\frac{1}{n}$ and

\frac{\scriptstyle\sum_{n > 0} z^n}
{\displaystyle\prod_{1\leq k\leq n} (1-q^k)}

yields

## 9 Appendix

### 9.1 Tests

#### 9.1.1 Font changes

Math alphabet macros change the default alphabet ("mathvariant" in MathML), leaving some symbols unchanged:

normal:

$abs\left(x\right)±\alpha \approx 3\Gamma \phantom{\rule{1em}{0ex}}\forall x\in R$

mathrm:

$abs\left(x\right)±\alpha \approx 3\Gamma \phantom{\rule{1em}{0ex}}\forall x\in R$

mathit:

$abs\left(x\right)±\alpha \approx 3\Gamma \phantom{\rule{1em}{0ex}}\forall x\in R$

mathsf:

$abs\left(x\right)±\alpha \approx 3\Gamma \phantom{\rule{1em}{0ex}}\forall x\in R$

mathbb:

$abs\left(x\right)±\alpha \approx 3\Gamma \phantom{\rule{1em}{0ex}}\forall x\in R$

mathbf:

$abs\left(x\right)±\alpha \approx 3\Gamma \phantom{\rule{1em}{0ex}}\forall x\in R$

mathcal:

$abs\left(x\right)±\alpha \approx 3\Gamma \phantom{\rule{1em}{0ex}}\forall x\in R$

mathscr:

$abs\left(x\right)±\alpha \approx 3\Gamma \phantom{\rule{1em}{0ex}}\forall x\in R$

Without additional packages, LaTeX supports "blackboard-bold" only for capital Latin letters. Unicode supports also small Latin letters, some Greek letters, and digits: $A\dots Za\dots z\mathbb{ℾ}\mathbb{ℿ}\mathbb{⅀}\mathbb{ℽ}\mathbb{ℼ}0\dots 9$.

#### 9.1.2 Inferred <mrow>s in MathML

The elements <msqrt>, <mstyle>, <merror>, <mpadded>, <mphantom>, <menclose>, <mtd>, <mscarry>, and [itex] treat their contents as a single inferred mrow formed from all their children.

$a=\sqrt{2}+x,\phantom{\rule{1em}{0ex}}b=\sqrt{1+{x}^{2}},\phantom{\rule{1em}{0ex}}c=\sqrt{\frac{\mathrm{sin}\left(x\right)}{23}},$

inline: $a=\sqrt{2}+x,b=\sqrt{1+{x}^{2}},c=\sqrt{\frac{\mathrm{sin}\left(x\right)}{23}}$.

#### 9.1.3 Scripts and Limits

Accents should be nearer to the base: $\stackrel{ˉ}{a}\stackrel{_}{a},\stackrel{ˉ}{l}\stackrel{_}{l},\stackrel{ˉ}{i}\stackrel{_}{i}$, $\stackrel{\to }{r}$ $\stackrel{\to }{r}$.

Sub- and superscript may be given in any order: ${x}_{i}^{j}={x}_{i}^{j}$ and ${\int }_{0}^{1}={\int }_{0}^{1}$.

Double exponent: ${x}^{{10}^{4}}$, ${r}_{{T}_{\mathrm{in}}}$ and ${x}_{i}^{{n}^{2}}$.

#### 9.1.4 Nested groups

tex-token returns "{" for nested groups:

$\text{das ist ein {toller} text (unescaped \{ and \} is ignored by LaTeX)}$

#### 9.1.5 Big delimiters and symbols

Compare automatic sizing with fixed sizes:

$\begin{array}{rl}\left(3\right)\left(f\left(x\right)\right)\left(\stackrel{ˉ}{x}\right)\left(\stackrel{_}{x}\right)\left({n}_{i}\right)& =\left(\right)\\ \left(\underset{_}{x}\right)& =\left(\text{big}\right)\\ \left({3}^{2}\right)\left(\sqrt{3}\right)\left(\sqrt{{3}^{2}}\right)\left(\sum \right)\left(⨂\right)\left(\prod \right)& =\left(\text{Big}\right)\\ \left(\frac{3}{2}\right)\left(\frac{{3}^{2}}{{2}^{4}}\right)\left(\genfrac{}{}{0}{}{3}{2}\right)\left(\begin{array}{cc}a& b\\ c& d\end{array}\right)\left(\frac{1}{\sqrt{2}}\right)\left(\int \right)\left({\int }_{0}\right)\left({\int }^{1}\right)\left({\int }_{0}^{1}\right)& =\left(\text{bigg}\right)\\ \left(\frac{\sqrt{2}}{2}\right)\left(\sum _{0}\right)\left(\sum ^{1}\right)\left(\sum _{0}^{1}\right)\left(\frac{\frac{1}{x}}{\frac{1}{n}}\right)& =\left(\text{Bigg}\right)\\ \left(\underset{0}{\int }\right)\left(\stackrel{1}{\int }\right)\left(\underset{0}{\overset{1}{\int }}\right)\end{array}$

And in text:

$\left(\right)$:

$\left(3\right)\left(f\left(x\right)\right)\left(\stackrel{ˉ}{x}\right)\left(\stackrel{_}{x}\right)\left({n}_{i}\right)\left(\sum \right)\left(\sum _{0}\right)\left(\prod \right)$

$\left(\text{big}\right)$:

$\left(\underset{_}{x}\right)\left({3}^{2}\right)\left(\genfrac{}{}{0}{}{3}{2}\right)\left(\begin{array}{cc}a& b\\ c& d\end{array}\right)\left(⨂\right)$

$\left(\text{Big}\right)$:

$\left(\sqrt{3}\right)\left(\sqrt{{3}^{2}}\right)\left(\frac{3}{2}\right)\left(\frac{{3}^{2}}{{2}^{4}}\right)\left(\frac{\sqrt{2}}{2}\right)\left(\int \right)\left({\int }_{0}\right)\left({\int }^{1}\right)\left({\int }_{0}^{1}\right)\left(\sum ^{1}\right)\left(\sum _{0}^{1}\right)\left(\frac{\frac{1}{x}}{\frac{1}{n}}\right)$

Test \left, \right, and the bigl/bigr, … size commands with all extensible delimiters.

$\left(b\right)\phantom{\rule{0.25em}{0ex}}\left(b\right)\phantom{\rule{0.25em}{0ex}}\left(b\right)\phantom{\rule{1em}{0ex}}\left[b\right]\phantom{\rule{0.25em}{0ex}}\left[b\right]\phantom{\rule{0.25em}{0ex}}\left[b\right]\phantom{\rule{1em}{0ex}}\left\{b\right\}\phantom{\rule{0.25em}{0ex}}\left\{b\right\}\phantom{\rule{0.25em}{0ex}}\left\{b\right\}\phantom{\rule{1em}{0ex}}⟨b⟩\phantom{\rule{0.25em}{0ex}}⟨b⟩\phantom{\rule{0.25em}{0ex}}⟨b⟩$
$⌈b⌉\phantom{\rule{0.25em}{0ex}}⌈b⌉\phantom{\rule{0.25em}{0ex}}⌈b⌉\phantom{\rule{1em}{0ex}}⌊b⌋\phantom{\rule{0.25em}{0ex}}⌊b⌋\phantom{\rule{0.25em}{0ex}}⌊b⌋\phantom{\rule{1em}{0ex}}|b|\phantom{\rule{0.25em}{0ex}}|b|\phantom{\rule{0.25em}{0ex}}|b|\phantom{\rule{1em}{0ex}}‖b‖\phantom{\rule{0.25em}{0ex}}‖b‖\phantom{\rule{0.25em}{0ex}}‖b‖$
$⟮b⟯\phantom{\rule{0.25em}{0ex}}⟮b⟯\phantom{\rule{0.25em}{0ex}}⟮b⟯\phantom{\rule{1em}{0ex}}⎰b⎱\phantom{\rule{0.25em}{0ex}}⎰b⎱\phantom{\rule{0.25em}{0ex}}⎰b⎱\phantom{\rule{1em}{0ex}}/b\\phantom{\rule{0.25em}{0ex}}/b\\phantom{\rule{0.25em}{0ex}}/b\$
$|b‖\phantom{\rule{0.25em}{0ex}}|b‖\phantom{\rule{0.25em}{0ex}}|b‖\phantom{\rule{1em}{0ex}}|b‖\phantom{\rule{0.25em}{0ex}}|b‖\phantom{\rule{0.25em}{0ex}}|b‖\phantom{\rule{1em}{0ex}}⏐b‖\phantom{\rule{0.25em}{0ex}}⏐b‖\phantom{\rule{0.25em}{0ex}}⏐b‖\phantom{\rule{1em}{0ex}}⎪b⎪\phantom{\rule{0.25em}{0ex}}⎪b⎪\phantom{\rule{0.25em}{0ex}}⎪b⎪\phantom{\rule{1em}{0ex}}|b‖\phantom{\rule{0.25em}{0ex}}|b‖\phantom{\rule{0.25em}{0ex}}|b‖$

Variable-sized operators:

Inline: $\int \phantom{\rule{0.25em}{0ex}}\iint \phantom{\rule{0.25em}{0ex}}\iiint \phantom{\rule{0.25em}{0ex}}⨌\phantom{\rule{0.25em}{0ex}}\int \cdots \int \oint \phantom{\rule{0.25em}{0ex}}\int \phantom{\rule{0.25em}{0ex}}\sum \phantom{\rule{0.25em}{0ex}}\prod \phantom{\rule{0.25em}{0ex}}\coprod \phantom{\rule{0.25em}{0ex}}\bigwedge \phantom{\rule{0.25em}{0ex}}\bigvee \phantom{\rule{0.25em}{0ex}}\bigcap \phantom{\rule{0.25em}{0ex}}\bigcup \phantom{\rule{0.25em}{0ex}}⨄\phantom{\rule{0.25em}{0ex}}⨆\phantom{\rule{0.25em}{0ex}}⨀\phantom{\rule{0.25em}{0ex}}⨁\phantom{\rule{0.25em}{0ex}}⨂$ and Display:

$\int \phantom{\rule{0.25em}{0ex}}\iint \phantom{\rule{0.25em}{0ex}}\iiint \phantom{\rule{0.25em}{0ex}}⨌\phantom{\rule{0.25em}{0ex}}\int \cdots \int \phantom{\rule{0.25em}{0ex}}\oint \phantom{\rule{0.25em}{0ex}}\int \phantom{\rule{0.25em}{0ex}}\sum \phantom{\rule{0.25em}{0ex}}\prod \phantom{\rule{0.25em}{0ex}}\coprod \phantom{\rule{0.25em}{0ex}}\bigwedge \phantom{\rule{0.25em}{0ex}}\bigvee \phantom{\rule{0.25em}{0ex}}\bigcap \phantom{\rule{0.25em}{0ex}}\bigcup \phantom{\rule{0.25em}{0ex}}⨄\phantom{\rule{0.25em}{0ex}}⨆\phantom{\rule{0.25em}{0ex}}⨀\phantom{\rule{0.25em}{0ex}}⨁\phantom{\rule{0.25em}{0ex}}⨂$
${\int }_{1}f\phantom{\rule{0.25em}{0ex}}\underset{1}{\int }f\phantom{\rule{0.25em}{0ex}}{\iint }_{1}f\phantom{\rule{0.25em}{0ex}}{\int }_{1}f\phantom{\rule{0.25em}{0ex}}\sum _{1}\phantom{\rule{0.25em}{0ex}}\prod _{1}\phantom{\rule{0.25em}{0ex}}\underset{1}{\bigwedge }\phantom{\rule{0.25em}{0ex}}\bigcap _{1}\phantom{\rule{0.25em}{0ex}}\underset{1}{⨄}\phantom{\rule{0.25em}{0ex}}\underset{1}{⨀}\phantom{\rule{0.25em}{0ex}}{\int }^{N}\phantom{\rule{0.25em}{0ex}}\stackrel{N}{\int }\phantom{\rule{0.25em}{0ex}}{⨌}^{N}\phantom{\rule{0.25em}{0ex}}{\oint }^{N}\phantom{\rule{0.25em}{0ex}}{\int }^{N}\phantom{\rule{0.25em}{0ex}}\sum ^{N}\phantom{\rule{0.25em}{0ex}}\coprod ^{N}\phantom{\rule{0.25em}{0ex}}\stackrel{N}{\bigvee }\phantom{\rule{0.25em}{0ex}}\bigcup ^{N}\phantom{\rule{0.25em}{0ex}}\stackrel{N}{⨆}\phantom{\rule{0.25em}{0ex}}\stackrel{N}{⨂}$
${\int }_{1}^{N}\phantom{\rule{0.25em}{0ex}}\underset{1}{\overset{N}{\int }}\phantom{\rule{0.25em}{0ex}}{\iint }_{1}^{N}\phantom{\rule{0.25em}{0ex}}{\iiint }_{1}^{N}\phantom{\rule{0.25em}{0ex}}{⨌}_{1}^{N}\phantom{\rule{0.25em}{0ex}}\int \cdots {\int }_{1}^{N}\phantom{\rule{0.25em}{0ex}}{\oint }_{1}^{N}\phantom{\rule{0.25em}{0ex}}{\int }_{1}^{N}\phantom{\rule{0.25em}{0ex}}\sum _{1}^{N}\phantom{\rule{0.25em}{0ex}}\prod _{1}^{N}\phantom{\rule{0.25em}{0ex}}\coprod _{1}^{N}\phantom{\rule{0.25em}{0ex}}\underset{1}{\overset{N}{\bigwedge }}\phantom{\rule{0.25em}{0ex}}\underset{1}{\overset{N}{\bigvee }}\phantom{\rule{0.25em}{0ex}}\bigcap _{1}^{N}\phantom{\rule{0.25em}{0ex}}\bigcup _{1}^{N}\phantom{\rule{0.25em}{0ex}}\underset{1}{\overset{N}{⨄}}\phantom{\rule{0.25em}{0ex}}\underset{1}{\overset{N}{⨆}}\phantom{\rule{0.25em}{0ex}}\underset{1}{\overset{N}{⨀}}\phantom{\rule{0.25em}{0ex}}\underset{1}{\overset{N}{⨁}}\phantom{\rule{0.25em}{0ex}}\underset{1}{\overset{N}{⨂}}$

#### 9.1.6 Text

The text may contain non-ASCII characters: ${n}_{\text{Stoß}}$.

Some text-mode LaTeX commands are supported with math_output "html". In other output formats, use literal Unicode: $\text{ç é è ë ê ñ ů ž ©}$ to get the result of the accent macros $\text{\c{c} \'e \e \"e \^e \~n \r{u} \v{z} \textcircled{c}}$.