Docutils | Overview | About | Users | Reference | Developers

LaTeX syntax for mathematics

Abstract

Docutils supports mathematical content with a "math" directive and role. The input format is LaTeX math syntax[1] 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 ψ(r)=exp(2r)\psi(r)=\exp(-2r). Inside the backtics you can write anything you would write between dollar signs in a LaTeX document. [1]

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:

ψ(r)=e2r\psi(r) = 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:

(f)(y)=12πnnf(x)eiyxdx.(\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.

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:

a=(x+y)2b=(xy)2=x2+2xy+y2=x22xy+y2\begin{aligned} a & = (x + y)^2 & b & = (x - y)^2 \\ & = x^2 + 2xy + y^2 & & = x^2 - 2xy + y^2\end{aligned}

The aligned environment can be used as a component in a containing expression. E.g.,

.. math::
  \left.
    \begin{aligned}
      B' & = -\partial\times E,         \\
      E' & = \partial\times B - 4\pi j,
    \end{aligned}
  \right\}
  \qquad \text{Maxwell’s equations}

results in

B=×EE=×B4πj}Maxwell’s equations.\left. \begin{aligned} B' & = -\partial\times E \\ E' & = \partial\times B - 4\pi j \end{aligned} \;\right\} \qquad \text{Maxwell’s equations.}

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.

x́\acute{x}

\acute{x}

ṫ\dot{t}

\dot{t}

x̀\grave{x}

\grave{x}

x\vec{x}

\vec{x}

v\bar{v}

\bar{v}

ẗ\ddot{t}

\ddot{t}

x̂\hat{x}

\hat{x}

x̆\breve{x}

\breve{x}

t\dddot{t}

\dddot{t}

x̊\mathring{x}

\mathring{x}

x̌\check{x}

\check{x}

t\ddddot{t}

\ddddot{t}

ñ\tilde{n}

\tilde{n}

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

For embellishments that span multiple symbols, use:

gbĩ\widetilde{gbi}

\widetilde{gbi}

gbî\widehat{gbi}

\widehat{gbi}

gbi¯\overline{gbi}

\overline{gbi}

gbi_\underline{gbi}

\underline{gbi}

gbi\overbrace{gbi}

\overbrace{gbi}

gbi\underbrace{gbi}

\underbrace{gbi}

gbi\overleftarrow{gbi}

\overleftarrow{gbi}

gbi\underleftarrow{gbi}

\underleftarrow{gbi}

gbi\overrightarrow{gbi}

\overrightarrow{gbi}

gbi\underrightarrow{gbi}

\underrightarrow{gbi}

gbi\overleftrightarrow{gbi}

\overleftrightarrow{gbi}

\underleftrightarrow{gbi}

\underleftrightarrow{gbi}

2.2 Binary operators

**

*

\circledast

\circledast

\ominus

\ominus

++

+

\circledcirc

\circledcirc

\oplus

\oplus

-

-

\circleddash

\circleddash

\oslash

\oslash

::

:

\cup

\cup

\otimes

\otimes

\Cap

\Cap

\curlyvee

\curlyvee

±\pm

\pm

\Cup

\Cup

\curlywedge

\curlywedge

\rightthreetimes

\rightthreetimes

\amalg

\amalg

\dagger

\dagger

\rtimes

\rtimes

*\ast

\ast

\ddagger

\ddagger

\\setminus

\setminus

\bigcirc

\bigcirc

\diamond

\diamond

\smallsetminus

\smallsetminus

\bigtriangledown

\bigtriangledown

÷\div

\div

\sqcap

\sqcap

\bigtriangleup

\bigtriangleup

\divideontimes

\divideontimes

\sqcup

\sqcup

\boxdot

\boxdot

\dotplus

\dotplus

\star

\star

\boxminus

\boxminus

\doublebarwedge

\doublebarwedge

×\times

\times

\boxplus

\boxplus

\gtrdot

\gtrdot

\triangleleft

\triangleleft

\boxtimes

\boxtimes

\intercal

\intercal

\triangleright

\triangleright

\bullet

\bullet

\leftthreetimes

\leftthreetimes

\uplus

\uplus

\cap

\cap

\lessdot

\lessdot

\vee

\vee

\cdot

\cdot

\ltimes

\ltimes

\veebar

\veebar

\centerdot

\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(A,B,Y)=f(A,B,X=h[X](Y))g(A,B,Y) = f \left(A,B,X=h^{[X]}(Y)\right) or

an=(12)na_n = \left(\frac{1}{2}\right)^n

Use . for "empty" delimiters:

A=11n|n=0A = \left . \frac{1}{1-n}\, \right |_{n=0}^\infty

See also the commands for fixed delimiter sizes below.

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

2.3.1 Pairing delimiters

()( )

( )

\langle \rangle

\langle \rangle

[][ ]

[ ]

\lceil \rceil

\lceil \rceil

{}\{ \}

\{ \}

\lfloor \rfloor

\lfloor \rfloor

||\lvert \rvert

\lvert \rvert

\lgroup \rgroup

\lgroup \rgroup

\lVert \rVert

\lVert \rVert

\lmoustache \rmoustache

\lmoustache \rmoustache

2.3.2 Nonpairing delimiters

||

|

|\vert

\vert

\arrowvert

\arrowvert

\|

\|

\Vert

\Vert

\Arrowvert

\Arrowvert

//

/

\backslash

\backslash

\bracevert

\bracevert

The use of | and \| for pairs of vertical bars may produce incorrect spacing, e.g., |k|=|-k| produces |k|=|k||k| = |-k| and |\sin(x)| produces |sin(x)||\sin(x)|. The pairing delimiters, e.g. |k|\lvert -k\rvert and |sin(x)|\lvert\sin(x)\rvert, prevent this problem.

2.4 Extensible vertical arrows

\uparrow \uparrow

\Uparrow \Uparrow

\downarrow \downarrow

\Downarrow \Downarrow

\updownarrow \updownarrow

\Updownarrow \Updownarrow

2.5 Functions (named operators)

arccos\arccos

\arccos

gcd\gcd

\gcd

Pr\Pr

\Pr

arcsin\arcsin

\arcsin

hom\hom

\hom

\projlim

\projlim

arctan\arctan

\arctan

inf\inf

\inf

sec\sec

\sec

arg\arg

\arg

\injlim

\injlim

sin\sin

\sin

cos\cos

\cos

ker\ker

\ker

sinh\sinh

\sinh

cosh\cosh

\cosh

lg\lg

\lg

sup\sup

\sup

cot\cot

\cot

lim\lim

\lim

tan\tan

\tan

coth\coth

\coth

liminf\liminf

\liminf

tanh\tanh

\tanh

csc\csc

\csc

limsup\limsup

\limsup

\varlimsup

\varlimsup

deg\deg

\deg

ln\ln

\ln

\varliminf

\varliminf

det\det

\det

log\log

\log

\varprojlim

\varprojlim

dim\dim

\dim

max\max

\max

\varinjlim

\varinjlim

exp\exp

\exp

min\min

\min

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

sgn(3)=1.\operatorname{sgn}(-3) = -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

\digamma

Λ\Lambda

\Lambda

γ\gamma

\gamma

ξ\xi

\xi

ε\varepsilon

\varepsilon

Φ\Phi

\Phi

δ\delta

\delta

π\pi

\pi

𝜘\varkappa

\varkappa

Π\Pi

\Pi

ϵ\epsilon

\epsilon

ρ\rho

\rho

φ\varphi

\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

\Upsilon

ι\iota

\iota

ϕ\phi

\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: \varGamma\ \varDelta\ \varLambda\ \varPhi\ \varPi\ \varPsi\ \varSigma\ \varTheta\ \varUpsilon\ \varXi\ \varOmega

2.7 Letterlike symbols

\forall

\forall

\aleph

\aleph

\hbar

\hbar

\ell

\ell

\complement

\complement

\beth

\beth

\hslash

\hslash

\wp

\wp

\exists

\exists

\gimel

\gimel

\Im

\Im

\Re

\Re

\Finv

\Finv

\daleth

\daleth

ı\imath

\imath

®\circledR

\circledR

\Game

\Game

\partial

\partial

ȷ\jmath

\jmath

\circledS

\circledS

\mho

\mho

ð\eth

\eth

𝕜\Bbbk

\Bbbk

2.8 Math alphabets

The TeX math alphabet macros are intended for mathematical variables where style variations are important semantically. They style letters and numbers with a combination of font attributes (shape, weight, family) --- non-alphanumerical symbols, function names, and mathematical text are left unchanged.

MathML uses the mathvariant style attribute or pre-styled characters from the Mathematical Alphanumeric Symbols Unicode block.

command

example

result

\mathrm

s_\mathrm{out}

souts_\mathrm{out}

\mathbf

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

𝐫2=x2+y2\mathbf{r}^2=x^2+y^2

\mathit

\mathit{\sin\Gamma}

sin𝛤\mathit{\sin\Gamma}

\mathcal

\mathcal{F}f(x)

f(x)\mathcal{F}f(x)

\mathbb

\mathbb{R \subset C}

\mathbb{R \subset C}

\mathfrak

\mathfrak{a+b}

𝔞+𝔟\mathfrak{a+b}

\mathsf

\mathsf x

𝗑\mathsf x

\mathtt

\mathtt{0.12}

0.12\mathtt{0.12}

The set of characters in a given "math alphabet" varies. LaTeX may produce garbage for unsupported characters. Additional math alphabets are defined in LaTeX packages, e.g.,

  • \mathbfit from isomath allows vector symbols in line with the International Standard [ISO-80000-2]. E.g., \mathbfit{r}^2=x^2+y^2 becomes 𝒓2=x2+y2\mathbfit{r}^2=x^2+y^2.

  • Several packages, e.g. mathrsfs, define \mathscr that selects a differently shaped "script" alphabet.

The listing below shows the characters supported by Unicode and Docutils with math_output MathML. [2]

default:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzıȷ{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz\ \imath \jmath} ΓΔΘΛΞΠΣΥΦΨΩαβγδεζηθικλμνξπρςστυφχψωϵϑϕ𝜘𝜚ϖϜϝ{\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega \ \alpha \beta \gamma \delta \varepsilon \zeta \eta \theta \iota \kappa \lambda \mu \nu \xi \pi \rho \varsigma \sigma \tau \upsilon \varphi \chi \psi \omega \ \epsilon \vartheta \phi \varkappa \varrho \varpi Ϝ\digamma \ \partial\nabla } 0123456789{0123456789}

mathrm:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzıȷ\mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz\ \imath \jmath} ΓΔΘΛΞΠΣΥΦΨΩαβγδεζηθικλμνξπρςστυφχψωϵϑϕ𝜘𝜚ϖϜϝ\mathrm{\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega \ \alpha \beta \gamma \delta \varepsilon \zeta \eta \theta \iota \kappa \lambda \mu \nu \xi \pi \rho \varsigma \sigma \tau \upsilon \varphi \chi \psi \omega \ \epsilon \vartheta \phi \varkappa \varrho \varpi Ϝ\digamma \ \partial\nabla } 0123456789\mathrm{0123456789}

mathbf:

𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐚𝐛𝐜𝐝𝐞𝐟𝐠𝐡𝐢𝐣𝐤𝐥𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐭𝐮𝐯𝐰𝐱𝐲𝐳\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz} 𝚪𝚫𝚯𝚲𝚵𝚷𝚺𝚼𝚽𝚿𝛀𝛂𝛃𝛄𝛅𝛆𝛇𝛈𝛉𝛊𝛋𝛌𝛍𝛎𝛏𝛑𝛒ς𝛔𝛕𝛖𝛗𝛘𝛙𝛚𝛜𝛝𝛟𝜘𝜚ϖ𝟊ϝ\mathbf{\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega \ \alpha \beta \gamma \delta \varepsilon \zeta \eta \theta \iota \kappa \lambda \mu \nu \xi \pi \rho \varsigma \sigma \tau \upsilon \varphi \chi \psi \omega \ \epsilon \vartheta \phi \varkappa \varrho \varpi Ϝ\digamma \ \partial\nabla } 0123456789\mathbf{0123456789}

mathit:

𝐴𝐵𝐶𝐷𝐸𝐹𝐺𝐻𝐼𝐽𝐾𝐿𝑀𝑁𝑂𝑃𝑄𝑅𝑆𝑇𝑈𝑉𝑊𝑋𝑌𝑍𝑎𝑏𝑐𝑑𝑒𝑓𝑔h𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟𝑠𝑡𝑢𝑣𝑤𝑥𝑦𝑧ıȷ\mathit{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz\ \imath \jmath} 𝛤𝛥𝛩𝛬𝛯𝛱𝛴𝛶𝛷𝛹𝛺𝛼𝛽𝛾𝛿𝜀𝜁𝜂𝜃𝜄𝜅𝜆𝜇𝜈𝜉𝜋𝜌ς𝜎𝜏𝜐𝜑𝜒𝜓𝜔𝜖𝜗𝜙𝜘𝜚ϖ\mathit{\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega \ \alpha \beta \gamma \delta \varepsilon \zeta \eta \theta \iota \kappa \lambda \mu \nu \xi \pi \rho \varsigma \sigma \tau \upsilon \varphi \chi \psi \omega \ \epsilon \vartheta \phi \varkappa \varrho \varpi \ \partial\nabla } 0123456789\mathit{0123456789} [2]

mathbfit:

𝑨𝑩𝑪𝑫𝑬𝑭𝑮𝑯𝑰𝑱𝑲𝑳𝑴𝑵𝑶𝑷𝑸𝑹𝑺𝑻𝑼𝑽𝑾𝑿𝒀𝒁𝒂𝒃𝒄𝒅𝒆𝒇𝒈𝒉𝒊𝒋𝒌𝒍𝒎𝒏𝒐𝒑𝒒𝒓𝒔𝒕𝒖𝒗𝒘𝒙𝒚𝒛\mathbfit{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz} 𝜞𝜟𝜣𝜦𝜩𝜫𝜮𝜰𝜱𝜳𝜴𝜶𝜷𝜸𝜹𝜺𝜻𝜼𝜽𝜾𝜿𝝀𝝁𝝂𝝃𝝅𝝆ς𝝈𝝉𝝊𝝋𝝌𝝍𝝎𝝐𝝑𝝓𝜘𝜚ϖ\mathbfit{\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega \ \alpha \beta \gamma \delta \varepsilon \zeta \eta \theta \iota \kappa \lambda \mu \nu \xi \pi \rho \varsigma \sigma \tau \upsilon \varphi \chi \psi \omega \ \epsilon \vartheta \phi \varkappa \varrho \varpi \ \partial\nabla }

mathcal:

𝒜𝒞𝒟𝒢𝒥𝒦𝒩𝒪𝒫𝒬𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵𝒶𝒷𝒸𝒹𝒻𝒽𝒾𝒿𝓀𝓁𝓂𝓃𝓅𝓆𝓇𝓈𝓉𝓊𝓋𝓌𝓍𝓎𝓏\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}

mathscr:

𝒜𝒞𝒟𝒢𝒥𝒦𝒩𝒪𝒫𝒬𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵𝒶𝒷𝒸𝒹𝒻𝒽𝒾𝒿𝓀𝓁𝓂𝓃𝓅𝓆𝓇𝓈𝓉𝓊𝓋𝓌𝓍𝓎𝓏\mathscr{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}

mathbb:

𝔸𝔹𝔻𝔼𝔽𝔾𝕀𝕁𝕂𝕃𝕄𝕆𝕊𝕋𝕌𝕍𝕎𝕏𝕐𝕒𝕓𝕔𝕕𝕖𝕗𝕘𝕙𝕚𝕛𝕜𝕝𝕞𝕟𝕠𝕡𝕢𝕣𝕤𝕥𝕦𝕧𝕨𝕩𝕪𝕫\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz} Σ\mathbb{\Gamma \Pi \Sigma \ \gamma \pi } 0123456789\mathbb{0123456789}

mathfrak:

𝔄𝔅𝔇𝔈𝔉𝔊𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔𝔖𝔗𝔘𝔙𝔚𝔛𝔜𝔞𝔟𝔠𝔡𝔢𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪𝔫𝔬𝔭𝔮𝔯𝔰𝔱𝔲𝔳𝔴𝔵𝔶𝔷\mathfrak{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}

mathsf:

𝖠𝖡𝖢𝖣𝖤𝖥𝖦𝖧𝖨𝖩𝖪𝖫𝖬𝖭𝖮𝖯𝖰𝖱𝖲𝖳𝖴𝖵𝖶𝖷𝖸𝖹𝖺𝖻𝖼𝖽𝖾𝖿𝗀𝗁𝗂𝗃𝗄𝗅𝗆𝗇𝗈𝗉𝗊𝗋𝗌𝗍𝗎𝗏𝗐𝗑𝗒𝗓\mathsf{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz} 0123456789\mathsf{0123456789}

mathsfit:

𝘈𝘉𝘊𝘋𝘌𝘍𝘎𝘏𝘐𝘑𝘒𝘓𝘔𝘕𝘖𝘗𝘘𝘙𝘚𝘛𝘜𝘝𝘞𝘟𝘠𝘡𝘢𝘣𝘤𝘥𝘦𝘧𝘨𝘩𝘪𝘫𝘬𝘭𝘮𝘯𝘰𝘱𝘲𝘳𝘴𝘵𝘶𝘷𝘸𝘹𝘺𝘻\mathsfit{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}

mathsfbfit:

\mathsfbfit{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz} \mathsfbfit{ΓΔΘΛΞΠΣΥΦΨΩ\ αβγδεζηθικλμνξπρςστυφχψω\ ϵϑϕϰϱϖ\ \partial∇}

mathtt:

𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉𝚊𝚋𝚌𝚍𝚎𝚏𝚐𝚑𝚒𝚓𝚔𝚕𝚖𝚗𝚘𝚙𝚚𝚛𝚜𝚝𝚞𝚟𝚠𝚡𝚢𝚣\mathtt{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz} 0123456789\mathtt{0123456789}

In contrast to the math alphabet selectors, \boldsymbol only changes the font weight. It can be used to get a bold version of any mathematical symbol:

Vix±cos(α)3ΓxV_i x \pm \cos(\alpha) \approx 3\Gamma \quad \forall x\in\mathbb{R}
𝐕𝐢𝐱±cos(𝛂)3𝚪𝐱\boldsymbol{V_i x \pm \cos(\alpha) \approx 3\Gamma \quad \forall x\in\mathbb{R}}

It is usually ill-advised to apply \boldsymbol to more than one symbol at a time.

2.9 Miscellaneous symbols

#\#

\#

\clubsuit

\clubsuit

¬\neg

\neg

&\&

\&

\diamondsuit

\diamondsuit

\nexists

\nexists

\angle

\angle

\emptyset

\emptyset

\prime

\prime

\backprime

\backprime

\exists

\exists

\sharp

\sharp

\bigstar

\bigstar

\flat

\flat

\spadesuit

\spadesuit

\blacklozenge

\blacklozenge

\forall

\forall

\sphericalangle

\sphericalangle

\blacksquare

\blacksquare

\heartsuit

\heartsuit

\square

\square

\blacktriangle

\blacktriangle

\infty

\infty

\surd

\surd

\blacktriangledown

\blacktriangledown

\lozenge

\lozenge

\top

\top

\bot

\bot

\measuredangle

\measuredangle

\triangle

\triangle

\diagdown

\diagdown

\nabla

\nabla

\triangledown

\triangledown

\diagup

\diagup

\natural

\natural

\varnothing

\varnothing

2.10 Punctuation

..

.

!!

!

\vdots

\vdots

//

/

??

?

\dotsb

\dotsb

||

|

:\colon

\colon [3]

\dotsc

\dotsc

'

'

\cdots

\cdots

\dotsi

\dotsi

;;

;

\ddots

\ddots

\dotsm

\dotsm

::

:

\ldots

\ldots

\dotso

\dotso

2.11 Relation symbols

2.11.1 Arrows

\circlearrowleft

\circlearrowleft

\circlearrowright

\circlearrowright

\curvearrowleft

\curvearrowleft

\curvearrowright

\curvearrowright

\hookleftarrow

\hookleftarrow

\hookrightarrow

\hookrightarrow

\leftarrow

\leftarrow

\rightarrow

\rightarrow

\Leftarrow

\Leftarrow

\Rightarrow

\Rightarrow

\leftarrowtail

\leftarrowtail

\rightarrowtail

\rightarrowtail

\leftharpoondown

\leftharpoondown

\rightharpoondown

\rightharpoondown

\leftharpoonup

\leftharpoonup

\rightharpoonup

\rightharpoonup

\leftleftarrows

\leftleftarrows

\rightrightarrows

\rightrightarrows

\leftrightarrow

\leftrightarrow

\Leftrightarrow

\Leftrightarrow

\leftrightarrows

\leftrightarrows

\rightleftarrows

\rightleftarrows

\leftrightharpoons

\leftrightharpoons

\rightleftharpoons

\rightleftharpoons

\leftrightsquigarrow

\leftrightsquigarrow

\rightsquigarrow

\rightsquigarrow

\Lleftarrow

\Lleftarrow

\Rrightarrow

\Rrightarrow

\longleftarrow

\longleftarrow

\longrightarrow

\longrightarrow

\Longleftarrow

\Longleftarrow

\Longrightarrow

\Longrightarrow

\longleftrightarrow

\longleftrightarrow

\Longleftrightarrow

\Longleftrightarrow

\looparrowleft

\looparrowleft

\looparrowright

\looparrowright

\Lsh

\Lsh

\Rsh

\Rsh

\mapsto

\mapsto

\longmapsto

\longmapsto

\multimap

\multimap

\nleftarrow

\nleftarrow

\nrightarrow

\nrightarrow

\nLeftarrow

\nLeftarrow

\nRightarrow

\nRightarrow

\nleftrightarrow

\nleftrightarrow

\nLeftrightarrow

\nLeftrightarrow

\nwarrow

\nwarrow

\nearrow

\nearrow

\swarrow

\swarrow

\searrow

\searrow

\twoheadleftarrow

\twoheadleftarrow

\twoheadrightarrow

\twoheadrightarrow

\upharpoonleft

\upharpoonleft

\upharpoonright

\upharpoonright

\downharpoonleft

\downharpoonleft

\downharpoonright

\downharpoonright

\upuparrows

\upuparrows

\downdownarrows

\downdownarrows

Synonyms: \gets \gets, \to \to, \restriction \restriction.

2.11.2 Comparison

<<

<

\geq

\geq

\ll

\ll

\prec

\prec

==

=

\geqq

\geqq

\lll

\lll

\precapprox

\precapprox

>>

>

\geqslant

\geqslant

\lnapprox

\lnapprox

\preccurlyeq

\preccurlyeq

\approx

\approx

\gg

\gg

\lneq

\lneq

\preceq

\preceq

\approxeq

\approxeq

\ggg

\ggg

\lneqq

\lneqq

\precnapprox

\precnapprox

\asymp

\asymp

\gnapprox

\gnapprox

\lnsim

\lnsim

\precneqq

\precneqq

\backsim

\backsim

\gneq

\gneq

\ncong

\ncong

\precnsim

\precnsim

\backsimeq

\backsimeq

\gneqq

\gneqq

\neq

\neq

\precsim

\precsim

\bumpeq

\bumpeq

\gnsim

\gnsim

\ngeq

\ngeq

\risingdotseq

\risingdotseq

\Bumpeq

\Bumpeq

\gtrapprox

\gtrapprox

\ngeqq

\ngeqq

\sim

\sim

\circeq

\circeq

\gtreqless

\gtreqless

\ngeqslant

\ngeqslant

\simeq

\simeq

\cong

\cong

\gtreqqless

\gtreqqless

\ngtr

\ngtr

\succ

\succ

\curlyeqprec

\curlyeqprec

\gtrless

\gtrless

\nleq

\nleq

\succapprox

\succapprox

\curlyeqsucc

\curlyeqsucc

\gtrsim

\gtrsim

\nleqq

\nleqq

\succcurlyeq

\succcurlyeq

\doteq

\doteq

\leq

\leq

\nleqslant

\nleqslant

\succeq

\succeq

\doteqdot

\doteqdot

\leqq

\leqq

\nless

\nless

\succnapprox

\succnapprox

\eqcirc

\eqcirc

\leqslant

\leqslant

\nprec

\nprec

\succneqq

\succneqq

\eqsim

\eqsim

\lessapprox

\lessapprox

\npreceq

\npreceq

\succnsim

\succnsim

\eqslantgtr

\eqslantgtr

\lesseqgtr

\lesseqgtr

\nsim

\nsim

\succsim

\succsim

\eqslantless

\eqslantless

\lesseqqgtr

\lesseqqgtr

\nsucc

\nsucc

\thickapprox

\thickapprox

\equiv

\equiv

\lessgtr

\lessgtr

\nsucceq

\nsucceq

\thicksim

\thicksim

\fallingdotseq

\fallingdotseq

\lesssim

\lesssim

\triangleq

\triangleq

The commands \lvertneqq and \gvertneqq are not supported with MathML output, as there is no corresponding Unicode character.

Synonyms: \ne \ne, \le \le, \ge \ge, \Doteq \Doteq, \llless \llless, \gggtr \gggtr.

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

2.11.3 Miscellaneous relations

϶\backepsilon

\backepsilon

\ntrianglelefteq

\ntrianglelefteq

\subseteq

\subseteq

\because

\because

\ntriangleright

\ntriangleright

\subseteqq

\subseteqq

\between

\between

\ntrianglerighteq

\ntrianglerighteq

\subsetneq

\subsetneq

\blacktriangleleft

\blacktriangleleft

\nvdash

\nvdash

\subsetneqq

\subsetneqq

\blacktriangleright

\blacktriangleright

\nVdash

\nVdash

\supset

\supset

\bowtie

\bowtie

\nvDash

\nvDash

\Supset

\Supset

\dashv

\dashv

\nVDash

\nVDash

\supseteq

\supseteq

\frown

\frown

\parallel

\parallel

\supseteqq

\supseteqq

\in

\in

\perp

\perp

\supsetneq

\supsetneq

\mid

\mid

\pitchfork

\pitchfork

\supsetneqq

\supsetneqq

\models

\models

\propto

\propto

\therefore

\therefore

\ni

\ni

\shortmid

\shortmid

\trianglelefteq

\trianglelefteq

\nmid

\nmid

\shortparallel

\shortparallel

\trianglerighteq

\trianglerighteq

\notin

\notin

\smallfrown

\smallfrown

\varpropto

\varpropto

\nparallel

\nparallel

\smallsmile

\smallsmile

\vartriangle

\vartriangle

\nshortmid

\nshortmid

\smile

\smile

\vartriangleleft

\vartriangleleft

\nshortparallel

\nshortparallel

\sqsubset

\sqsubset

\vartriangleright

\vartriangleright

\nsubseteq

\nsubseteq

\sqsubseteq

\sqsubseteq

\vdash

\vdash

\nsubseteqq

\nsubseteqq

\sqsupset

\sqsupset

\Vdash

\Vdash

\nsupseteq

\nsupseteq

\sqsupseteq

\sqsupseteq

\vDash

\vDash

\nsupseteqq

\nsupseteqq

\subset

\subset

\Vvdash

\Vvdash

\ntriangleleft

\ntriangleleft

\Subset

\Subset

Synonyms: \owns \owns.

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

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

2.12 Variable-sized operators

\sum \sum

\prod \prod

\bigcap \bigcap

\bigodot \bigodot

\int \int

\coprod \coprod

\bigcup \bigcup

\bigoplus \bigoplus

\oint \oint

\bigwedge \bigwedge

\biguplus \biguplus

\bigotimes \bigotimes

\smallint \smallint

\bigvee \bigvee

\bigsqcup \bigsqcup

Larger symbols are used in displayed formulas, sum-like symbols have indices above/below the symbol:

n=1Nan01f(x)dxi=110bi\sum_{n=1}^N a_n \qquad \int_0^1f(x)\,dx \qquad \prod_{i=1}^{10} b_i \ldots

3 Notations

3.1 Top and bottom embellishments

See Accents and embellishments.

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 \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm 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 X*\overset{*}{X} and \underset{+}{M} becomes M+\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:

(abcd)\left ( \begin{matrix} a & b \\ c & d \end{matrix} \right)

The environments pmatrix, bmatrix, Bmatrix, vmatrix, and Vmatrix have (respectively) ( ), [ ], { }, | |, and \Vert\ \Vert delimiters built in, e.g.

(abcd)[abcd]abcd\begin{pmatrix} a & b \\ c & d \end{pmatrix} \qquad \begin{bmatrix} a & b \\ c & d \end{bmatrix} \qquad \begin{Vmatrix} a & b \\ c & d \end{Vmatrix}

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

For piecewise function definitions there is a cases environment:

sgn(x)={1x<01x>0\mathrm{sgn}(x) = \begin{cases} -1 & x<0\\ \phantom{-}1 & x>0 \end{cases}

3.5 Spacing commands

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

343\qquad 4

3\qquad 4

= 2em

343\quad 4

3\quad 4

= 1em

343~4

3~4

3\nobreakspace 4

343\ 4

3\ 4

escaped space

343\;4

3\;4

3\thickspace 4

343\:4

3\:4

3\medspace 4

343\,4

3\,4

3\thinspace 4

343 4

3 4

regular space [4]

343\!4

3\!4

3\negthinspace 4

negative space [5]

3\negmedspace 4

3\negmedspace 4

3\negthickspace 4

3\negthickspace 4

3\hspace{1ex}4

3\hspace{1ex}4

custom length

343\mspace{20mu}4

3\mspace{20mu}4

custom length [6]

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:

XXX+1XXX1\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. [7]

command

example

result

\bmod

\gcd(n,m \bmod n)

gcd(n,mmodn)\gcd(n,m \bmod n)

\pmod

x\equiv y \pmod b

x\equiv y \pmod b

\mod

x\equiv y \mod c

xymodcx\equiv y \mod c

\pod

x\equiv y \pod d

x\equiv y \pod d

\operatorname{mod}(m,n)

mod(m,n)\operatorname{mod}(m,n)

3.7 Roots

command

example

result

\sqrt

\sqrt{x^2-1}

x21\sqrt{x^2-1}

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

x213n\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:

ηC(δ(η)+ΛM(0,δ))\boxed{\eta \leq C(\delta(\eta) +\Lambda_M(0,\delta))}

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

(b)(cd)\displaystyle (b) (\frac{c}{d})

(b)(cd)\displaystyle \left(b\right) \left(\frac{c} {d}\right)

(b)(cd)\displaystyle \bigl(b\bigr) \bigl(\frac{c} {d}\bigr)

\displaystyle \Bigl(b\Bigr) \Bigl(\frac{c} {d}\Bigr)

(b)(cd)\displaystyle \biggl(b\biggr) \biggl(\frac{c} {d}\biggr)

(b)(cd)\displaystyle \Biggl(b\Biggr) \Biggl(\frac{c} {d}\Biggr)

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:

\left[\sum_i a_i\left\lvert\sum_j x_{ij}\right\rvert^p\right]^{1/p}
\text{ versus }
\biggl[\sum_i a_i\Bigl\lvert\sum_j x_{ij}\Bigr\rvert^p\biggr]^{1/p}

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.

((a1b1)(a2b2))((a2b1)+(a1b2))versus((a1b1)(a2b2))((a2b1)+(a1b2))\left((a_1 b_1) - (a_2 b_2)\right) \left((a_2 b_1) + (a_1 b_2)\right) \quad\text{versus}\quad \bigl((a_1 b_1) - (a_2 b_2)\bigr) \bigl((a_2 b_1) + (a_1 b_2)\bigr)

The third kind of situation is a slightly oversize object in running text, such as |bd|\left|\frac{b'}{d'}\right| where the delimiters produced by \left and \right cause too much line spreading. [8] 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: |bd|\bigl|\frac{b'}{d'}\bigr|.

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 kBTk_{\text{B}}T.

Whitespace is kept inside the argument:

f[xi1,xi] is monotonic for i=1,,c+1f_{[x_{i-1},x_i]} \text{ is monotonic for } i = 1,\,\ldots ,\,c+1

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

(1)ni={1if ni is odd,+1if ni is even.(-1)^{n_i} = \begin{cases} -1 \quad \text{if $n_i$ is odd,} \\ +1 \quad \text{if $n_i$ is even.} \end{cases}

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

limn1n1n\lim_{n\to\infty} \sum_1^n \frac{1}{n}

move to index positions: limn1n1n\lim_{n\to\infty} \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: \intop_0^1, \ointop_c and

\intop_0^1 \quad \ointop_c
   \quad \text{vs.} \quad
\int^1_0   \quad \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: limx0f(x)\lim_{x\to0}f(x), limx0f(x)\lim\limits_{x\to0}f(x), limx0f(x)\lim\nolimits_{x\to0}f(x), vs.

limx0f(x),limx0f(x)limx0f(x).\lim_{x\to0}f(x), \quad \lim\limits_{x\to0}f(x) \quad \lim\nolimits_{x\to0}f(x).

8 Changing the size of elements in a formula

The declarations [9] \displaystyle, \textstyle, \scriptstyle, and \scriptscriptstyle, select a symbol size and spacing that would be applied in display math, inline math, first-order subscript, or second-order subscript, respectively 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 n=01n\displaystyle \sum_{n=0}^\infty \frac{1}{n} rather than n=01n\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

\frac{\scriptstyle\sum_{n > 0} z^n}
{\displaystyle\prod_{1\leq k\leq n} (1-q^k)}
\text{ instead of the default }
\frac{\sum_{n > 0} z^n}
{\prod_{1\leq k\leq n} (1-q^k)}.
[ISO-80000-2]

Quantities and units – Part 2: Mathematical signs and symbols to be used in the natural sciences and technology: http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=31887.