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 ( 2 r ) . 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 ) = e 2 r

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 ) = 1 2 π n n f ( x ) e i y x 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 ) 2 b = ( x y ) 2 = x 2 + 2 x y + y 2 = x 2 2 x y + y 2

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 ' = × E E ' = × B 4 π j } 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}

t ˙

\dot{t}

x `

\grave{x}

x

\vec{x}

v ˉ

\bar{v}

t ¨

\ddot{t}

x ˆ

\hat{x}

x ˘

\breve{x}

t ˙˙˙

\dddot{t}

x ˚

\mathring{x}

x ˇ

\check{x}

t ˙˙˙˙

\ddddot{t}

n ~

\tilde{n}

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

For embellishments that span multiple symbols, use:

g b i ~

\widetilde{gbi}

g b i ^

\widehat{gbi}

g b i _

\overline{gbi}

g b i _

\underline{gbi}

g b i

\overbrace{gbi}

g b i

\underbrace{gbi}

g b i

\overleftarrow{gbi}

g b i

\underleftarrow{gbi}

g b i

\overrightarrow{gbi}

g b i

\underrightarrow{gbi}

g b i

\overleftrightarrow{gbi}

g b i

\underleftrightarrow{gbi}

2.2 Binary operators

*

*

\circledast

\ominus

+

+

\circledcirc

\oplus

-

\circleddash

\oslash

:

\cup

\otimes

\Cap

\curlyvee

±

\pm

\Cup

\curlywedge

\rightthreetimes

⨿

\amalg

\dagger

\rtimes

\ast

\ddagger

\setminus

\bigcirc

\diamond

\smallsetminus

\bigtriangledown

÷

\div

\sqcap

\bigtriangleup

\divideontimes

\sqcup

\boxdot

\dotplus

\star

\boxminus

\doublebarwedge

×

\times

\boxplus

\gtrdot

\triangleleft

\boxtimes

\intercal

\triangleright

\bullet

\leftthreetimes

\uplus

\cap

\lessdot

\vee

\cdot

\ltimes

\veebar

\centerdot

\mp

\wedge

\circ

\odot

\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 ) ) or

a n = ( 1 2 ) n

Use . for "empty" delimiters:

A = 1 1 n | n = 0

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

[ ]

[ ]

\lceil \rceil

{ }

\{ \}

\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 | sin ( x ) | . The pairing delimiters, e.g. | k | and | sin ( x ) | , prevent this problem.

2.4 Extensible vertical arrows

\uparrow

\Uparrow

\downarrow

\Downarrow

\updownarrow

\Updownarrow

2.5 Functions (named operators)

arccos

\arccos

gcd

\gcd

Pr

\Pr

arcsin

\arcsin

hom

\hom

proj lim

\projlim

arctan

\arctan

inf

\inf

sec

\sec

arg

\arg

inj lim

\injlim

sin

\sin

cos

\cos

ker

\ker

sinh

\sinh

cosh

\cosh

lg

\lg

sup

\sup

cot

\cot

lim

\lim

tan

\tan

coth

\coth

lim inf

\liminf

tanh

\tanh

csc

\csc

lim sup

\limsup

lim ¯

\varlimsup

deg

\deg

ln

\ln

lim _

\varliminf

det

\det

log

\log

lim

\varprojlim

dim

\dim

max

\max

lim

\varinjlim

exp

\exp

min

\min

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

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

α

\alpha

μ

\mu

ω

\omega

Δ

\Delta

β

\beta

ν

\nu

ϝ

\digamma

Λ

\Lambda

γ

\gamma

ξ

\xi

ε

\varepsilon

Φ

\Phi

δ

\delta

π

\pi

ϰ

\varkappa

Π

\Pi

ϵ

\epsilon

ρ

\rho

φ

\varphi

Ψ

\Psi

ζ

\zeta

σ

\sigma

ϖ

\varpi

Σ

\Sigma

η

\eta

τ

\tau

ϱ

\varrho

Θ

\Theta

θ

\theta

υ

\upsilon

ς

\varsigma

Υ

\Upsilon

ι

\iota

ϕ

\phi

ϑ

\vartheta

Ξ

\Xi

κ

\kappa

χ

\chi

Ω

\Omega

λ

\lambda

ψ

\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: 𝛤 𝛥 𝛬 𝛷 𝛱 𝛹 𝛴 𝛩 𝛶 𝛯 𝛺

2.7 Letterlike symbols

\forall

\aleph

\hbar

\ell

\complement

\beth

\hslash

\wp

\exists

\gimel

\Im

\Re

\Finv

\daleth

ı

\imath

\circledR

\Game

\partial

ȷ

\jmath

\circledS

\mho

ð

\eth

𝕜

\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}

s out

\mathbf

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

𝐫 2 = x 2 + y 2

\mathit

\mathit{\sin\Gamma}

sin 𝛤

\mathcal

\mathcal{F}f(x)

f ( x )

\mathbb

\mathbb{R \subset C}

\mathfrak

\mathfrak{a+b}

𝔞 + 𝔟

\mathsf

\mathsf x

𝗑

\mathtt

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

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z ı ȷ Γ Δ Θ Λ Ξ Π Σ Υ Φ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ π ρ ς σ τ υ φ χ ψ ω ϵ ϑ ϕ ϰ ϱ ϖ Ϝ ϝ 0123456789

mathrm:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z ı ȷ Γ Δ Θ Λ Ξ Π Σ Υ Φ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ π ρ ς σ τ υ φ χ ψ ω ϵ ϑ ϕ ϰ ϱ ϖ Ϝ ϝ 0123456789

mathbf:

𝐀 𝐁 𝐂 𝐃 𝐄 𝐅 𝐆 𝐇 𝐈 𝐉 𝐊 𝐋 𝐌 𝐍 𝐎 𝐏 𝐐 𝐑 𝐒 𝐓 𝐔 𝐕 𝐖 𝐗 𝐘 𝐙 𝐚 𝐛 𝐜 𝐝 𝐞 𝐟 𝐠 𝐡 𝐢 𝐣 𝐤 𝐥 𝐦 𝐧 𝐨 𝐩 𝐪 𝐫 𝐬 𝐭 𝐮 𝐯 𝐰 𝐱 𝐲 𝐳 𝚪 𝚫 𝚯 𝚲 𝚵 𝚷 𝚺 𝚼 𝚽 𝚿 𝛀 𝛂 𝛃 𝛄 𝛅 𝛆 𝛇 𝛈 𝛉 𝛊 𝛋 𝛌 𝛍 𝛎 𝛏 𝛑 𝛒 𝛓 𝛔 𝛕 𝛖 𝛗 𝛘 𝛙 𝛚 𝛜 𝛝 𝛟 𝛞 𝛠 𝛡 𝟊 𝟋 𝛛 𝛁 𝟎𝟏𝟐𝟑𝟒𝟓𝟔𝟕𝟖𝟗

mathit:

𝐴 𝐵 𝐶 𝐷 𝐸 𝐹 𝐺 𝐻 𝐼 𝐽 𝐾 𝐿 𝑀 𝑁 𝑂 𝑃 𝑄 𝑅 𝑆 𝑇 𝑈 𝑉 𝑊 𝑋 𝑌 𝑍 𝑎 𝑏 𝑐 𝑑 𝑒 𝑓 𝑔 𝑖 𝑗 𝑘 𝑙 𝑚 𝑛 𝑜 𝑝 𝑞 𝑟 𝑠 𝑡 𝑢 𝑣 𝑤 𝑥 𝑦 𝑧 𝚤 𝚥 𝛤 𝛥 𝛩 𝛬 𝛯 𝛱 𝛴 𝛶 𝛷 𝛹 𝛺 𝛼 𝛽 𝛾 𝛿 𝜀 𝜁 𝜂 𝜃 𝜄 𝜅 𝜆 𝜇 𝜈 𝜉 𝜋 𝜌 𝜍 𝜎 𝜏 𝜐 𝜑 𝜒 𝜓 𝜔 𝜖 𝜗 𝜙 ϰ 𝜚 𝜛 𝜕 𝛻 0123456789 [2]

mathbfit:

𝑨 𝑩 𝑪 𝑫 𝑬 𝑭 𝑮 𝑯 𝑰 𝑱 𝑲 𝑳 𝑴 𝑵 𝑶 𝑷 𝑸 𝑹 𝑺 𝑻 𝑼 𝑽 𝑾 𝑿 𝒀 𝒁 𝒂 𝒃 𝒄 𝒅 𝒆 𝒇 𝒈 𝒉 𝒊 𝒋 𝒌 𝒍 𝒎 𝒏 𝒐 𝒑 𝒒 𝒓 𝒔 𝒕 𝒖 𝒗 𝒘 𝒙 𝒚 𝒛 𝜞 𝜟 𝜣 𝜦 𝜩 𝜫 𝜮 𝜰 𝜱 𝜳 𝜴 𝜶 𝜷 𝜸 𝜹 𝜺 𝜻 𝜼 𝜽 𝜾 𝜿 𝝀 𝝁 𝝂 𝝃 𝝅 𝝆 𝝇 𝝈 𝝉 𝝊 𝝋 𝝌 𝝍 𝝎 𝝐 𝝑 𝝓 𝝒 𝝔 𝝕 𝝏 𝜵

mathcal:

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

mathscr:

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

mathbb:

𝔸 𝔹 𝔻 𝔼 𝔽 𝔾 𝕀 𝕁 𝕂 𝕃 𝕄 𝕆 𝕊 𝕋 𝕌 𝕍 𝕎 𝕏 𝕐 𝕒 𝕓 𝕔 𝕕 𝕖 𝕗 𝕘 𝕙 𝕚 𝕛 𝕜 𝕝 𝕞 𝕟 𝕠 𝕡 𝕢 𝕣 𝕤 𝕥 𝕦 𝕧 𝕨 𝕩 𝕪 𝕫 𝟘𝟙𝟚𝟛𝟜𝟝𝟞𝟟𝟠𝟡

mathfrak:

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

mathsf:

𝖠 𝖡 𝖢 𝖣 𝖤 𝖥 𝖦 𝖧 𝖨 𝖩 𝖪 𝖫 𝖬 𝖭 𝖮 𝖯 𝖰 𝖱 𝖲 𝖳 𝖴 𝖵 𝖶 𝖷 𝖸 𝖹 𝖺 𝖻 𝖼 𝖽 𝖾 𝖿 𝗀 𝗁 𝗂 𝗃 𝗄 𝗅 𝗆 𝗇 𝗈 𝗉 𝗊 𝗋 𝗌 𝗍 𝗎 𝗏 𝗐 𝗑 𝗒 𝗓 𝟢𝟣𝟤𝟥𝟦𝟧𝟨𝟩𝟪𝟫

mathsfit:

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

mathsfbfit:

𝘼 𝘽 𝘾 𝘿 𝙀 𝙁 𝙂 𝙃 𝙄 𝙅 𝙆 𝙇 𝙈 𝙉 𝙊 𝙋 𝙌 𝙍 𝙎 𝙏 𝙐 𝙑 𝙒 𝙓 𝙔 𝙕 𝙖 𝙗 𝙘 𝙙 𝙚 𝙛 𝙜 𝙝 𝙞 𝙟 𝙠 𝙡 𝙢 𝙣 𝙤 𝙥 𝙦 𝙧 𝙨 𝙩 𝙪 𝙫 𝙬 𝙭 𝙮 𝙯 𝞒 𝞓 𝞗 𝞚 𝞝 𝞟 𝞢 𝞤 𝞥 𝞧 𝞨 𝞪 𝞫 𝞬 𝞭 𝞮 𝞯 𝞰 𝞱 𝞲 𝞳 𝞴 𝞵 𝞶 𝞷 𝞹 𝞺 𝞻 𝞼 𝞽 𝞾 𝞿 𝟀 𝟁 𝟂 𝟄 𝟅 𝟇 𝟆 𝟈 𝟉 𝟃 𝞩

mathtt:

𝙰 𝙱 𝙲 𝙳 𝙴 𝙵 𝙶 𝙷 𝙸 𝙹 𝙺 𝙻 𝙼 𝙽 𝙾 𝙿 𝚀 𝚁 𝚂 𝚃 𝚄 𝚅 𝚆 𝚇 𝚈 𝚉 𝚊 𝚋 𝚌 𝚍 𝚎 𝚏 𝚐 𝚑 𝚒 𝚓 𝚔 𝚕 𝚖 𝚗 𝚘 𝚙 𝚚 𝚛 𝚜 𝚝 𝚞 𝚟 𝚠 𝚡 𝚢 𝚣 𝟶𝟷𝟸𝟹𝟺𝟻𝟼𝟽𝟾𝟿

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:

V i x ± cos ( α ) 3 Γ x
V i x ± cos ( α ) 3 Γ x

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

2.9 Miscellaneous symbols

#

\#

\clubsuit

¬

\neg

&

\&

\diamondsuit

\nexists

\angle

\emptyset

\prime

\backprime

\exists

\sharp

\bigstar

\flat

\spadesuit

\blacklozenge

\forall

\sphericalangle

\blacksquare

\heartsuit

\square

\blacktriangle

\infty

\surd

\blacktriangledown

\lozenge

\top

\bot

\measuredangle

\triangle

\diagdown

\nabla

\triangledown

\diagup

\natural

\varnothing

2.10 Punctuation

.

.

!

!

\vdots

/

/

?

?

\dotsb

|

|

:

\colon [3]

\dotsc

'

'

\cdots

\dotsi

;

;

\ddots

\dotsm

:

\ldots

\dotso

2.11 Relation symbols

2.11.1 Arrows

\circlearrowleft

\circlearrowright

\curvearrowleft

\curvearrowright

\hookleftarrow

\hookrightarrow

\leftarrow

\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, \restriction.

2.11.2 Comparison

<

<

\geq

\ll

\prec

=

=

\geqq

\lll

\precapprox

>

>

\geqslant

\lnapprox

\preccurlyeq

\approx

\gg

\lneq

\preceq

\approxeq

\ggg

\lneqq

\precnapprox

\asymp

\gnapprox

\lnsim

\precneqq

\backsim

\gneq

\ncong

\precnsim

\backsimeq

\gneqq

\neq

\precsim

\bumpeq

\gnsim

\ngeq

\risingdotseq

\Bumpeq

\gtrapprox

≧̸

\ngeqq

\sim

\circeq

\gtreqless

⩾̸

\ngeqslant

\simeq

\cong

\gtreqqless

\ngtr

\succ

\curlyeqprec

\gtrless

\nleq

\succapprox

\curlyeqsucc

\gtrsim

≦̸

\nleqq

\succcurlyeq

\doteq

\leq

⩽̸

\nleqslant

\succeq

\doteqdot

\leqq

\nless

\succnapprox

\eqcirc

\leqslant

\nprec

\succneqq

\eqsim

\lessapprox

\npreceq

\succnsim

\eqslantgtr

\lesseqgtr

\nsim

\succsim

\eqslantless

\lesseqqgtr

\nsucc

\thickapprox

\equiv

\lessgtr

\nsucceq

\thicksim

\fallingdotseq

\lesssim

\triangleq

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

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

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

2.11.3 Miscellaneous relations

\backepsilon

\ntrianglelefteq

\subseteq

\because

\ntriangleright

\subseteqq

\between

\ntrianglerighteq

\subsetneq

\blacktriangleleft

\nvdash

\subsetneqq

\blacktriangleright

\nVdash

\supset

\bowtie

\nvDash

\Supset

\dashv

\nVDash

\supseteq

\frown

\parallel

\supseteqq

\in

\perp

\supsetneq

\mid

\pitchfork

\supsetneqq

\models

\propto

\therefore

\ni

\shortmid

\trianglelefteq

\nmid

\shortparallel

\trianglerighteq

\notin

\smallfrown

\varpropto

\nparallel

\smallsmile

\vartriangle

\nshortmid

\smile

\vartriangleleft

\nshortparallel

\sqsubset

\vartriangleright

\nsubseteq

\sqsubseteq

\vdash

⫅̸

\nsubseteqq

\sqsupset

\Vdash

\nsupseteq

\sqsupseteq

\vDash

⫆̸

\nsupseteqq

\subset

\Vvdash

\ntriangleleft

\Subset

Synonyms: \owns.

Symbols can be negated prepending \not, e.g. \not\in, \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

\prod

\bigcap

\bigodot

\int

\coprod

\bigcup

\bigoplus

\oint

\bigwedge

\biguplus

\bigotimes

\smallint

\bigvee

\bigsqcup

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

n = 1 N a n 0 1 f ( x ) d x i = 1 10 b i

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 n + μ 1 B T 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 X * and \underset{+}{M} becomes 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:

( a b c d )

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

( a b c d ) [ a b c d ] a b c d

To produce a small matrix suitable for use in text, there is a smallmatrix environment ( a b c d ) 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 ) = { 1 x < 0 1 x > 0

3.5 Spacing commands

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

3 4

3\qquad 4

= 2em

3 4

3\quad 4

= 1em

3   4

3~4

3\nobreakspace 4

3 4

3\ 4

escaped space

3 4

3\;4

3\thickspace 4

3 4

3\:4

3\medspace 4

3 4

3\,4

3\thinspace 4

3 4

3 4

regular space [4]

3 4

3\!4

3\negthinspace 4

negative space [5]

3 4

3\negmedspace 4

3 4

3\negthickspace 4

3 4

3\hspace{1ex}4

custom length

3 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:

X X X + 1 X X X 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 , m mod n )

\pmod

x\equiv y \pmod b

x y ( mod b )

\mod

x\equiv y \mod c

x y mod c

\pod

x\equiv y \pod d

x y ( d )

\operatorname{mod}(m,n)

mod ( m , n )

3.7 Roots

command

example

result

\sqrt

\sqrt{x^2-1}

x 2 1

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

x 2 1 3 n

\sqrt\frac{1}{2}

1 2

3.8 Boxed formulas

The command \boxed puts a box around its argument:

η C ( δ ( η ) + Λ M ( 0 , δ ) )

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 ) ( c d )

( b ) ( c d )

( b ) ( c d )

( b ) ( c d )

( b ) ( c d )

( b ) ( c d )

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:

[ i a i | j x i j | p ] 1 / p  versus  [ i a i | j x i j | p ] 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.

( ( a 1 b 1 ) ( a 2 b 2 ) ) ( ( a 2 b 1 ) + ( a 1 b 2 ) ) versus ( ( a 1 b 1 ) ( a 2 b 2 ) ) ( ( a 2 b 1 ) + ( a 1 b 2 ) )

The third kind of situation is a slightly oversize object in running text, such as | b ' d ' | 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: | b ' d ' | .

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 B T .

Whitespace is kept inside the argument:

f [ x i 1 , x i ]  is monotonic for  i = 1 , , c + 1

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

( 1 ) n i = { 1 if  n i  is odd, + 1 if  n i  is even.

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

lim n 1 n 1 n

move to index positions: lim n 1 n 1 n .

7.1 Altering the placement of limits

The commands \intop and \ointop produce integral signs with limits as in sums and similar: 0 1 , c and

0 1 c vs. 0 1 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: lim x 0 f ( x ) , lim x 0 f ( x ) , lim x 0 f ( x ) , vs.

lim x 0 f ( x ) , lim x 0 f ( x ) lim x 0 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 = 0 1 n rather than n = 0 1 n and

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

yields

n > 0 z n 1 k n ( 1 q k )  instead of the default  n > 0 z n 1 k 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.