Debian Codegraph @

docs/ref/rst/mathematics.rst

raw
1 .. include:: ../../header2.rst
2
3 ============================
4 LaTeX syntax for mathematics
5 ============================
6
7 .. role:: m(math)
8 .. default-role:: math
9 .. |latex| replace:: L\ :sup:`A`\ T\ :sub:`E`\ X
10
11 :abstract: Docutils supports mathematical content with a `"math"
12 directive`__ and `role`__. The input format is *LaTeX math
13 syntax*\ [#math-syntax]_ with support for literal Unicode symbols.
14
15 .. sectnum::
16 .. contents::
17
18 __ https://docutils.sourceforge.io/docs/ref/rst/directives.html#math
19 __ https://docutils.sourceforge.io/docs/ref/rst/roles.html#math
20
21 Inline formulas and displayed equations
22 =======================================
23
24 The **math role** can be used for inline mathematical expressions:
25 ``:math:`\psi(r) = \exp(-2r)``` will produce :m:`\psi(r)=\exp(-2r)`.
26 Inside the backtics you can write anything you would write between dollar
27 signs in a LaTeX document. [#math-syntax]_
28  
29 .. tip::
30
31 If you put ``.. default-role:: math`` at the top of your
32 document, you can write ```x^2``` instead of the longer
33 version: ``:math:`x^2```. You can also introduce an
34 abbreviation like this ``.. role:: m(math)``. That will allow
35 you to write ``:m:`x^2``` or ```x^2`:m:``.
36
37
38 The **math directive** is used for displayed equations. It corresponds to
39 an ``equation*`` or ``align*`` environment in a LaTeX document. If you
40 write::
41
42 .. math:: \psi(r) = e^{-2r}
43
44 you will get:
45
46 .. math:: \psi(r) = e^{-2r}
47
48 A more complex example is the definition of the `Fourier transform`_::
49
50 .. math::
51 :name: Fourier transform
52
53 (\mathcal{F}f)(y)
54 = \frac{1}{\sqrt{2\pi}^{\ n}}
55 \int_{\mathbb{R}^n} f(x)\,
56 e^{-\mathrm{i} y \cdot x} \,\mathrm{d} x.
57
58 which is rendered as:
59
60 .. math::
61 :name: Fourier transform
62
63 (\mathcal{F}f)(y)
64 = \frac{1}{\sqrt{2\pi}^{\ n}}
65 \int_{\mathbb{R}^n} f(x)\,
66 e^{-\mathrm{i} y \cdot x} \,\mathrm{d} x.
67
68 The ``:name:`` option puts a label on the equation that can be
69 linked to by `hyperlink references`_.
70
71 Displayed equations can use ``\\`` and ``&`` for line shifts and alignments::
72
73 .. math::
74
75 a &= (x + y)^2 & b &= (x - y)^2 \\
76 &= x^2 + 2xy + y^2 & &= x^2 - 2xy + y^2
77
78 LaTeX output will wrap it in an ``align*`` environment.
79 The result is:
80
81 .. math::
82
83 a & = (x + y)^2 & b & = (x - y)^2 \\
84 & = x^2 + 2xy + y^2 & & = x^2 - 2xy + y^2
85
86 The ``aligned`` environment can be used as a component in a containing
87 expression. E.g., ::
88
89 .. math::
90 \left.
91 \begin{aligned}
92 B' & = -\partial\times E, \\
93 E' & = \partial\times B - 4\pi j,
94 \end{aligned}
95 \right\}
96 \qquad \text{Maxwell’s equations}
97
98 results in
99
100 .. math::
101 \left.
102 \begin{aligned}
103 B' & = -\partial\times E \\
104 E' & = \partial\times B - 4\pi j
105 \end{aligned}
106 \;\right\}
107 \qquad \text{Maxwell’s equations.}
108
109
110 .. [#math-syntax] The supported LaTeX commands include AMS extensions
111 (see, e.g., the `Short Math Guide`_). Some of the shown symbols
112 require the "amssymb" `LaTeX package`_ (or another package providing
113 the AMS symbol macros) when exported with the "latex" writer.
114
115 The support is limited to a subset of *LaTeX math* by the conversion
116 required for many output formats. For HTML, the `math_output`_
117 configuration setting (or the corresponding ``--math-output`` command
118 line option) selects between alternative output formats with different
119 subsets of supported elements. If a writer does not support math
120 typesetting, the content is inserted verbatim.
121
122 .. _hyperlink references:
123 ../ref/rst/restructuredtext.html#hyperlink-references
124 .. _Short Math Guide:
125 https://mirrors.ctan.org/info/short-math-guide/short-math-guide.pdf
126 .. _math_output:
127 https://docutils.sourceforge.io/docs/user/config.html#math-output
128 .. _LaTeX package:
129 ../../user/latex.html#latex-document-classes-and-packages
130
131
132 Mathematical symbols
133 ====================
134
135 The following tables are adapted from the first edition of
136 "The LaTeX Companion" (Goossens, Mittelbach, Samarin) and the
137 AMS `Short Math Guide`_.
138
139
140 Accents and embellishments
141 --------------------------
142
143 The "narrow" accents are intended for a single-letter base.
144
145 .. class:: colwidths-auto
146
147 =========== ============= ============ ============== ============== ================ ========= ===========
148 `\acute{x}` ``\acute{x}`` `\dot{t}` ``\dot{t}`` `\grave{x}` ``\grave{x}`` `\vec{x}` ``\vec{x}``
149 `\bar{v}` ``\bar{v}`` `\ddot{t}` ``\ddot{t}`` `\hat{x}` ``\hat{x}``
150 `\breve{x}` ``\breve{x}`` `\dddot{t}` ``\dddot{t}`` `\mathring{x}` ``\mathring{x}``
151 `\check{x}` ``\check{x}`` `\ddddot{t}` ``\ddddot{t}`` `\tilde{n}` ``\tilde{n}``
152 =========== ============= ============ ============== ============== ================ ========= ===========
153
154 When adding an accent to an i or j in math, dotless variants can be
155 obtained with ``\imath`` and ``\jmath``: `\hat \imath`, `\vec{\jmath}`.
156
157 For embellishments that span multiple symbols, use:
158
159 .. class:: colwidths-auto
160
161 ========================== ============================ =========================== =============================
162 `\widetilde{gbi}` ``\widetilde{gbi}`` `\widehat{gbi}` ``\widehat{gbi}``
163 `\overline{gbi}` ``\overline{gbi}`` `\underline{gbi}` ``\underline{gbi}``
164 `\overbrace{gbi}` ``\overbrace{gbi}`` `\underbrace{gbi}` ``\underbrace{gbi}``
165 `\overleftarrow{gbi}` ``\overleftarrow{gbi}`` `\underleftarrow{gbi}` ``\underleftarrow{gbi}``
166 `\overrightarrow{gbi}` ``\overrightarrow{gbi}`` `\underrightarrow{gbi}` ``\underrightarrow{gbi}``
167 `\overleftrightarrow{gbi}` ``\overleftrightarrow{gbi}`` `\underleftrightarrow{gbi}` ``\underleftrightarrow{gbi}``
168 ========================== ============================ =========================== =============================
169
170
171 Binary operators
172 ----------------
173 .. class:: colwidths-auto
174
175 ================== ==================== ================= =================== ================== ====================
176 `*` ``*`` `\circledast` ``\circledast`` `\ominus` ``\ominus``
177 `+` ``+`` `\circledcirc` ``\circledcirc`` `\oplus` ``\oplus``
178 `-` ``-`` `\circleddash` ``\circleddash`` `\oslash` ``\oslash``
179 `:` ``:`` `\cup` ``\cup`` `\otimes` ``\otimes``
180 `\Cap` ``\Cap`` `\curlyvee` ``\curlyvee`` `\pm` ``\pm``
181 `\Cup` ``\Cup`` `\curlywedge` ``\curlywedge`` `\rightthreetimes` ``\rightthreetimes``
182 `\amalg` ``\amalg`` `\dagger` ``\dagger`` `\rtimes` ``\rtimes``
183 `\ast` ``\ast`` `\ddagger` ``\ddagger`` `\setminus` ``\setminus``
184 `\bigcirc` ``\bigcirc`` `\diamond` ``\diamond`` `\smallsetminus` ``\smallsetminus``
185 `\bigtriangledown` ``\bigtriangledown`` `\div` ``\div`` `\sqcap` ``\sqcap``
186 `\bigtriangleup` ``\bigtriangleup`` `\divideontimes` ``\divideontimes`` `\sqcup` ``\sqcup``
187 `\boxdot` ``\boxdot`` `\dotplus` ``\dotplus`` `\star` ``\star``
188 `\boxminus` ``\boxminus`` `\doublebarwedge` ``\doublebarwedge`` `\times` ``\times``
189 `\boxplus` ``\boxplus`` `\gtrdot` ``\gtrdot`` `\triangleleft` ``\triangleleft``
190 `\boxtimes` ``\boxtimes`` `\intercal` ``\intercal`` `\triangleright` ``\triangleright``
191 `\bullet` ``\bullet`` `\leftthreetimes` ``\leftthreetimes`` `\uplus` ``\uplus``
192 `\cap` ``\cap`` `\lessdot` ``\lessdot`` `\vee` ``\vee``
193 `\cdot` ``\cdot`` `\ltimes` ``\ltimes`` `\veebar` ``\veebar``
194 `\centerdot` ``\centerdot`` `\mp` ``\mp`` `\wedge` ``\wedge``
195 `\circ` ``\circ`` `\odot` ``\odot`` `\wr` ``\wr``
196 ================== ==================== ================= =================== ================== ====================
197
198
199 Extensible delimiters
200 ---------------------
201 Unless you indicate otherwise, delimiters in math formulas remain at the
202 standard size regardless of the height of the enclosed material. To get
203 adaptable sizes, use ``\left`` and ``\right`` prefixes, for example
204 `g(A,B,Y) = f \left(A,B,X=h^{[X]}(Y)\right)` or
205
206 .. math:: a_n = \left(\frac{1}{2}\right)^n
207
208 Use ``.`` for "empty" delimiters:
209
210 .. math:: A = \left . \frac{1}{1-n}\, \right |_{n=0}^\infty
211
212 See also the commands for fixed `delimiter sizes`_ below.
213
214 The following symbols extend when used with ``\left`` and ``\right``:
215
216 Pairing delimiters
217 ~~~~~~~~~~~~~~~~~~
218 .. class:: colwidths-auto
219
220 =============== ================= ========================= ===========================
221 `( )` ``( )`` `\langle \rangle` ``\langle \rangle``
222 `[ ]` ``[ ]`` `\lceil \rceil` ``\lceil \rceil``
223 `\{ \}` ``\{ \}`` `\lfloor \rfloor` ``\lfloor \rfloor``
224 `\lvert \rvert` ``\lvert \rvert`` `\lgroup \rgroup` ``\lgroup \rgroup``
225 `\lVert \rVert` ``\lVert \rVert`` `\lmoustache \rmoustache` ``\lmoustache \rmoustache``
226 =============== ================= ========================= ===========================
227
228
229 Nonpairing delimiters
230 ~~~~~~~~~~~~~~~~~~~~~
231 .. class:: colwidths-auto
232
233 ==== ====== ============ ============== ============ ==============
234 `|` ``|`` `\vert` ``\vert`` `\arrowvert` ``\arrowvert``
235 `\|` ``\|`` `\Vert` ``\Vert`` `\Arrowvert` ``\Arrowvert``
236 `/` ``/`` `\backslash` ``\backslash`` `\bracevert` ``\bracevert``
237 ==== ====== ============ ============== ============ ==============
238
239 The use of ``|`` and ``\|`` for pairs of vertical bars may produce
240 incorrect spacing, e.g., ``|k|=|-k|`` produces `|k| = |−k|` and
241 ``|\sin(x)|`` produces `|\sin(x)|`. The pairing delimiters, e.g.
242 `\lvert -k\rvert` and `\lvert\sin(x)\rvert`, prevent this problem.
243
244
245 Extensible vertical arrows
246 --------------------------
247 .. class:: colwidths-auto
248
249 =============================== ======================================
250 `\uparrow` ``\uparrow`` `\Uparrow` ``\Uparrow``
251 `\downarrow` ``\downarrow`` `\Downarrow` ``\Downarrow``
252 `\updownarrow` ``\updownarrow`` `\Updownarrow` ``\Updownarrow``
253 =============================== ======================================
254
255
256 Functions (named operators)
257 ---------------------------
258 .. class:: colwidths-auto
259
260 ========= =========== ========= =========== ============= ================
261 `\arccos` ``\arccos`` `\gcd` ``\gcd`` `\Pr` ``\Pr``
262 `\arcsin` ``\arcsin`` `\hom` ``\hom`` `\projlim` ``\projlim``
263 `\arctan` ``\arctan`` `\inf` ``\inf`` `\sec` ``\sec``
264 `\arg` ``\arg`` `\injlim` ``\injlim`` `\sin` ``\sin``
265 `\cos` ``\cos`` `\ker` ``\ker`` `\sinh` ``\sinh``
266 `\cosh` ``\cosh`` `\lg` ``\lg`` `\sup` ``\sup``
267 `\cot` ``\cot`` `\lim` ``\lim`` `\tan` ``\tan``
268 `\coth` ``\coth`` `\liminf` ``\liminf`` `\tanh` ``\tanh``
269 `\csc` ``\csc`` `\limsup` ``\limsup`` `\varlimsup` ``\varlimsup``
270 `\deg` ``\deg`` `\ln` ``\ln`` `\varliminf` ``\varliminf``
271 `\det` ``\det`` `\log` ``\log`` `\varprojlim` ``\varprojlim``
272 `\dim` ``\dim`` `\max` ``\max`` `\varinjlim` ``\varinjlim``
273 `\exp` ``\exp`` `\min` ``\min``
274 ========= =========== ========= =========== ============= ================
275
276 Named operators outside the above list can be typeset with
277 ``\operatorname{name}``, e.g.
278
279 .. math:: \operatorname{sgn}(-3) = -1.
280
281 .. TODO: \operatorname* for function name with limits.
282
283 The ``\DeclareMathOperator`` command can only be used in the
284 `LaTeX preamble`_.
285
286 .. _LaTeX preamble: latex.html#latex-preamble
287
288
289 Greek letters
290 -------------
291
292 Greek letters that have Latin look-alikes are rarely used in math
293 formulas and not supported by LaTeX.
294
295 .. class:: colwidths-auto
296
297 ========== ============ ========== ============ ========== ============ ============== ===============
298 `\Gamma` ``\Gamma`` `\alpha` ``\alpha`` `\mu` ``\mu`` `\omega` ``\omega``
299 `\Delta` ``\Delta`` `\beta` ``\beta`` `\nu` ``\nu`` `\digamma` ``\digamma``
300 `\Lambda` ``\Lambda`` `\gamma` ``\gamma`` `\xi` ``\xi`` `\varepsilon` ``\varepsilon``
301 `\Phi` ``\Phi`` `\delta` ``\delta`` `\pi` ``\pi`` `\varkappa` ``\varkappa``
302 `\Pi` ``\Pi`` `\epsilon` ``\epsilon`` `\rho` ``\rho`` `\varphi` ``\varphi``
303 `\Psi` ``\Psi`` `\zeta` ``\zeta`` `\sigma` ``\sigma`` `\varpi` ``\varpi``
304 `\Sigma` ``\Sigma`` `\eta` ``\eta`` `\tau` ``\tau`` `\varrho` ``\varrho``
305 `\Theta` ``\Theta`` `\theta` ``\theta`` `\upsilon` ``\upsilon`` `\varsigma` ``\varsigma``
306 `\Upsilon` ``\Upsilon`` `\iota` ``\iota`` `\phi` ``\phi`` `\vartheta` ``\vartheta``
307 `\Xi` ``\Xi`` `\kappa` ``\kappa`` `\chi` ``\chi``
308 `\Omega` ``\Omega`` `\lambda` ``\lambda`` `\psi` ``\psi``
309 ========== ============ ========== ============ ========== ============ ============== ===============
310
311 In LaTeX, the default font for capital Greek letters is upright/roman.
312 *Italic* capital Greek letters can be obtained by loading a `package
313 providing the "ISO" math style`__. They are used by default in MathML.
314
315 Individual Greek italic capitals can also be achieved preceding the
316 letter name with ``var`` like ``\varPhi``:
317 `\varGamma\ \varDelta\ \varLambda\ \varPhi\ \varPi\ \varPsi\ \varSigma\
318 \varTheta\ \varUpsilon\ \varXi\ \varOmega`
319
320
321 __ https://mirrors.ctan.org/macros/latex/contrib/isomath/isomath.html#table-2
322
323
324 Letterlike symbols
325 ------------------
326 .. class:: colwidths-auto
327
328 ============= =============== ========== ============ ========== ============ =========== =============
329 `\forall` ``\forall`` `\aleph` ``\aleph`` `\hbar` ``\hbar`` `\ell` ``\ell``
330 `\complement` ``\complement`` `\beth` ``\beth`` `\hslash` ``\hslash`` `\wp` ``\wp``
331 `\exists` ``\exists`` `\gimel` ``\gimel`` `\Im` ``\Im`` `\Re` ``\Re``
332 `\Finv` ``\Finv`` `\daleth` ``\daleth`` `\imath` ``\imath`` `\circledR` ``\circledR``
333 `\Game` ``\Game`` `\partial` ``\partial`` `\jmath` ``\jmath`` `\circledS` ``\circledS``
334 `\mho` ``\mho`` `\eth` ``\eth`` `\Bbbk` ``\Bbbk``
335 ============= =============== ========== ============ ========== ============ =========== =============
336
337
338 .. _math alphabet:
339
340 Math alphabets
341 --------------
342
343 The TeX *math alphabet* macros are intended for mathematical variables
344 where style variations are important semantically.
345 They style letters and numbers with a combination of font attributes
346 (shape, weight, family) --- non-alphanumerical symbols, function names,
347 and mathematical text are left unchanged.
348
349 MathML uses the *mathvariant* `style attribute`_ or pre-styled characters
350 from the `Mathematical Alphanumeric Symbols`_ Unicode block.
351
352 .. class:: colwidths-auto
353
354 =============== ============================ ==========================
355 command example result
356 =============== ============================ ==========================
357 ``\mathrm`` ``s_\mathrm{out}`` `s_\mathrm{out}`
358 ``\mathbf`` ``\mathbf{r}^2=x^2+y^2`` `\mathbf{r}^2=x^2+y^2`
359 ``\mathit`` ``\mathit{\sin\Gamma}`` `\mathit{\sin\Gamma}`
360 ``\mathcal`` ``\mathcal{F}f(x)`` `\mathcal{F}f(x)`
361 ``\mathbb`` ``\mathbb{R \subset C}`` `\mathbb{R \subset C}`
362 ``\mathfrak`` ``\mathfrak{a+b}`` `\mathfrak{a+b}`
363 ``\mathsf`` ``\mathsf x`` `\mathsf x`
364 ``\mathtt`` ``\mathtt{0.12}`` `\mathtt{0.12}`
365 =============== ============================ ==========================
366
367 The set of characters in a given "math alphabet" varies.
368 LaTeX may produce garbage for unsupported characters.
369 Additional math alphabets are defined in LaTeX packages, e.g.,
370
371 * ``\mathbfit`` from isomath_ allows vector symbols in line with the
372 International Standard [ISO-80000-2]_.
373 E.g., ``\mathbfit{r}^2=x^2+y^2`` becomes `\mathbfit{r}^2=x^2+y^2`.
374
375 * Several packages, e.g. mathrsfs_, define ``\mathscr`` that selects a
376 differently shaped "script" alphabet.
377
378 The listing below shows the characters supported by Unicode and
379 Docutils with math_output_ MathML. [#italic-digits]_
380
381 default:
382 `{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz\ ı\jmath}`
383 `{ΓΔΘΛΞΠΣΥΦΨΩ\ αβγδεζηθικλμνξπρςστυφχψω\ ϵϑϕϰϱϖϜϝ\ \partial∇}`
384 `{0123456789}`
385 mathrm:
386 `\mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz\ ı\jmath}`
387 `\mathrm{ΓΔΘΛΞΠΣΥΦΨΩ\ αβγδεζηθικλμνξπρςστυφχψω\ ϵϑϕϰϱϖϜϝ\ \partial∇}`
388 `\mathrm{0123456789}`
389 mathbf:
390 `\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}`
391 `\mathbf{ΓΔΘΛΞΠΣΥΦΨΩ\ αβγδεζηθικλμνξπρςστυφχψω\ ϵϑϕϰϱϖϜϝ\ \partial∇}`
392 `\mathbf{0123456789}`
393 mathit:
394 `\mathit{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz\ ı\jmath}`
395 `\mathit{ΓΔΘΛΞΠΣΥΦΨΩ\ αβγδεζηθικλμνξπρςστυφχψω\ ϵϑϕϰϱϖ\ \partial∇}`
396 `\mathit{0123456789}` [#italic-digits]_
397 mathbfit:
398 `\mathbfit{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}`
399 `\mathbfit{ΓΔΘΛΞΠΣΥΦΨΩ\ αβγδεζηθικλμνξπρςστυφχψω\ ϵϑϕϰϱϖ\ \partial∇}`
400 mathcal:
401 `\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}`
402 mathscr:
403 `\mathscr{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}`
404 mathbb:
405 `\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}`
406 `\mathbb{ΓΠΣ\ γπ}`
407 `\mathbb{0123456789}`
408 mathfrak:
409 `\mathfrak{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}`
410 mathsf:
411 `\mathsf{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}`
412 `\mathsf{0123456789}`
413 mathsfit:
414 `\mathsfit{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}`
415 mathsfbfit:
416 `\mathsfbfit{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}`
417 `\mathsfbfit{ΓΔΘΛΞΠΣΥΦΨΩ\ αβγδεζηθικλμνξπρςστυφχψω\ ϵϑϕϰϱϖ\ \partial∇}`
418 mathtt:
419 `\mathtt{ABCDEFGHIJKLMNOPQRSTUVWXYZ\ abcdefghijklmnopqrstuvwxyz}`
420 `\mathtt{0123456789}`
421
422 .. [#italic-digits] Italic digits are not defined in Unicode
423 but work in LaTeX.
424
425 In contrast to the *math alphabet* selectors, ``\boldsymbol`` only
426 changes the *font weight*. It can be used to get a bold version of
427 any mathematical symbol:
428
429 .. math::
430 V_i x \pm \cos(\alpha) \approx 3\Gamma \quad \forall x\in\mathbb{R}
431
432 \boldsymbol{V_i x \pm \cos(\alpha) \approx 3\Gamma \quad \forall x\in\mathbb{R}}
433
434 It is usually ill-advised to apply ``\boldsymbol`` to more than one symbol
435 at a time.
436
437 .. _style attribute: https://www.w3.org/TR/mathml4/#presm_commatt
438 .. _Mathematical Alphanumeric Symbols:
439 https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols
440 .. _isomath: https://www.ctan.org/pkg/isomath
441 .. _mathrsfs: https://www.ctan.org/pkg/mathrsfs
442 .. _unicode-math: https://www.ctan.org/pkg/unicode-math
443
444
445 Miscellaneous symbols
446 ---------------------
447
448 .. class:: colwidths-auto
449
450 ==================== ====================== ================ ================== ================= ===================
451 `\#` ``\#`` `\clubsuit` ``\clubsuit`` `\neg` ``\neg``
452 `\&` ``\&`` `\diamondsuit` ``\diamondsuit`` `\nexists` ``\nexists``
453 `\angle` ``\angle`` `\emptyset` ``\emptyset`` `\prime` ``\prime``
454 `\backprime` ``\backprime`` `\exists` ``\exists`` `\sharp` ``\sharp``
455 `\bigstar` ``\bigstar`` `\flat` ``\flat`` `\spadesuit` ``\spadesuit``
456 `\blacklozenge` ``\blacklozenge`` `\forall` ``\forall`` `\sphericalangle` ``\sphericalangle``
457 `\blacksquare` ``\blacksquare`` `\heartsuit` ``\heartsuit`` `\square` ``\square``
458 `\blacktriangle` ``\blacktriangle`` `\infty` ``\infty`` `\surd` ``\surd``
459 `\blacktriangledown` ``\blacktriangledown`` `\lozenge` ``\lozenge`` `\top` ``\top``
460 `\bot` ``\bot`` `\measuredangle` ``\measuredangle`` `\triangle` ``\triangle``
461 `\diagdown` ``\diagdown`` `\nabla` ``\nabla`` `\triangledown` ``\triangledown``
462 `\diagup` ``\diagup`` `\natural` ``\natural`` `\varnothing` ``\varnothing``
463 ==================== ====================== ================ ================== ================= ===================
464
465
466 Punctuation
467 -----------
468 .. class:: colwidths-auto
469
470 === ===== ======== =============== ======== ==========
471 `.` ``.`` `!` ``!`` `\vdots` ``\vdots``
472 `/` ``/`` `?` ``?`` `\dotsb` ``\dotsb``
473 `|` ``|`` `\colon` ``\colon`` [#]_ `\dotsc` ``\dotsc``
474 `'` ``'`` `\cdots` ``\cdots`` `\dotsi` ``\dotsi``
475 `;` ``;`` `\ddots` ``\ddots`` `\dotsm` ``\dotsm``
476 `:` ``:`` `\ldots` ``\ldots`` `\dotso` ``\dotso``
477 === ===== ======== =============== ======== ==========
478
479 .. [#] Punctuation (not ratio):
480 Compare spacing in `a\colon b\to c` to `a:b = c`.
481
482
483 Relation symbols
484 ----------------
485
486 Arrows
487 ~~~~~~
488 .. class:: colwidths-auto
489
490 ====================== ======================== ===================== =======================
491 `\circlearrowleft` ``\circlearrowleft`` `\circlearrowright` ``\circlearrowright``
492 `\curvearrowleft` ``\curvearrowleft`` `\curvearrowright` ``\curvearrowright``
493 `\hookleftarrow` ``\hookleftarrow`` `\hookrightarrow` ``\hookrightarrow``
494 `\leftarrow` ``\leftarrow`` `\rightarrow` ``\rightarrow``
495 `\Leftarrow` ``\Leftarrow`` `\Rightarrow` ``\Rightarrow``
496 `\leftarrowtail` ``\leftarrowtail`` `\rightarrowtail` ``\rightarrowtail``
497 `\leftharpoondown` ``\leftharpoondown`` `\rightharpoondown` ``\rightharpoondown``
498 `\leftharpoonup` ``\leftharpoonup`` `\rightharpoonup` ``\rightharpoonup``
499 `\leftleftarrows` ``\leftleftarrows`` `\rightrightarrows` ``\rightrightarrows``
500 `\leftrightarrow` ``\leftrightarrow`` `\Leftrightarrow` ``\Leftrightarrow``
501 `\leftrightarrows` ``\leftrightarrows`` `\rightleftarrows` ``\rightleftarrows``
502 `\leftrightharpoons` ``\leftrightharpoons`` `\rightleftharpoons` ``\rightleftharpoons``
503 `\leftrightsquigarrow` ``\leftrightsquigarrow`` `\rightsquigarrow` ``\rightsquigarrow``
504 `\Lleftarrow` ``\Lleftarrow`` `\Rrightarrow` ``\Rrightarrow``
505 `\longleftarrow` ``\longleftarrow`` `\longrightarrow` ``\longrightarrow``
506 `\Longleftarrow` ``\Longleftarrow`` `\Longrightarrow` ``\Longrightarrow``
507 `\longleftrightarrow` ``\longleftrightarrow`` `\Longleftrightarrow` ``\Longleftrightarrow``
508 `\looparrowleft` ``\looparrowleft`` `\looparrowright` ``\looparrowright``
509 `\Lsh` ``\Lsh`` `\Rsh` ``\Rsh``
510 `\mapsto` ``\mapsto`` `\longmapsto` ``\longmapsto``
511 `\multimap` ``\multimap``
512 `\nleftarrow` ``\nleftarrow`` `\nrightarrow` ``\nrightarrow``
513 `\nLeftarrow` ``\nLeftarrow`` `\nRightarrow` ``\nRightarrow``
514 `\nleftrightarrow` ``\nleftrightarrow`` `\nLeftrightarrow` ``\nLeftrightarrow``
515 `\nwarrow` ``\nwarrow`` `\nearrow` ``\nearrow``
516 `\swarrow` ``\swarrow`` `\searrow` ``\searrow``
517 `\twoheadleftarrow` ``\twoheadleftarrow`` `\twoheadrightarrow` ``\twoheadrightarrow``
518 `\upharpoonleft` ``\upharpoonleft`` `\upharpoonright` ``\upharpoonright``
519 `\downharpoonleft` ``\downharpoonleft`` `\downharpoonright` ``\downharpoonright``
520 `\upuparrows` ``\upuparrows`` `\downdownarrows` ``\downdownarrows``
521 ====================== ======================== ===================== =======================
522
523 Synonyms: `\gets` ``\gets``, `\to` ``\to``, `\restriction` ``\restriction``.
524
525 Comparison
526 ~~~~~~~~~~
527
528 .. class:: colwidths-auto
529
530 ================ ================== ============= =============== ============= =============== =============== =================
531 `<` ``<`` `\geq` ``\geq`` `\ll` ``\ll`` `\prec` ``\prec``
532 `=` ``=`` `\geqq` ``\geqq`` `\lll` ``\lll`` `\precapprox` ``\precapprox``
533 `>` ``>`` `\geqslant` ``\geqslant`` `\lnapprox` ``\lnapprox`` `\preccurlyeq` ``\preccurlyeq``
534 `\approx` ``\approx`` `\gg` ``\gg`` `\lneq` ``\lneq`` `\preceq` ``\preceq``
535 `\approxeq` ``\approxeq`` `\ggg` ``\ggg`` `\lneqq` ``\lneqq`` `\precnapprox` ``\precnapprox``
536 `\asymp` ``\asymp`` `\gnapprox` ``\gnapprox`` `\lnsim` ``\lnsim`` `\precneqq` ``\precneqq``
537 `\backsim` ``\backsim`` `\gneq` ``\gneq`` `\ncong` ``\ncong`` `\precnsim` ``\precnsim``
538 `\backsimeq` ``\backsimeq`` `\gneqq` ``\gneqq`` `\neq` ``\neq`` `\precsim` ``\precsim``
539 `\bumpeq` ``\bumpeq`` `\gnsim` ``\gnsim`` `\ngeq` ``\ngeq`` `\risingdotseq` ``\risingdotseq``
540 `\Bumpeq` ``\Bumpeq`` `\gtrapprox` ``\gtrapprox`` `\ngeqq` ``\ngeqq`` `\sim` ``\sim``
541 `\circeq` ``\circeq`` `\gtreqless` ``\gtreqless`` `\ngeqslant` ``\ngeqslant`` `\simeq` ``\simeq``
542 `\cong` ``\cong`` `\gtreqqless` ``\gtreqqless`` `\ngtr` ``\ngtr`` `\succ` ``\succ``
543 `\curlyeqprec` ``\curlyeqprec`` `\gtrless` ``\gtrless`` `\nleq` ``\nleq`` `\succapprox` ``\succapprox``
544 `\curlyeqsucc` ``\curlyeqsucc`` `\gtrsim` ``\gtrsim`` `\nleqq` ``\nleqq`` `\succcurlyeq` ``\succcurlyeq``
545 `\doteq` ``\doteq`` `\leq` ``\leq`` `\nleqslant` ``\nleqslant`` `\succeq` ``\succeq``
546 `\doteqdot` ``\doteqdot`` `\leqq` ``\leqq`` `\nless` ``\nless`` `\succnapprox` ``\succnapprox``
547 `\eqcirc` ``\eqcirc`` `\leqslant` ``\leqslant`` `\nprec` ``\nprec`` `\succneqq` ``\succneqq``
548 `\eqsim` ``\eqsim`` `\lessapprox` ``\lessapprox`` `\npreceq` ``\npreceq`` `\succnsim` ``\succnsim``
549 `\eqslantgtr` ``\eqslantgtr`` `\lesseqgtr` ``\lesseqgtr`` `\nsim` ``\nsim`` `\succsim` ``\succsim``
550 `\eqslantless` ``\eqslantless`` `\lesseqqgtr` ``\lesseqqgtr`` `\nsucc` ``\nsucc`` `\thickapprox` ``\thickapprox``
551 `\equiv` ``\equiv`` `\lessgtr` ``\lessgtr`` `\nsucceq` ``\nsucceq`` `\thicksim` ``\thicksim``
552 `\fallingdotseq` ``\fallingdotseq`` `\lesssim` ``\lesssim`` `\triangleq` ``\triangleq``
553 ================ ================== ============= =============== ============= =============== =============== =================
554
555 The commands ``\lvertneqq`` and ``\gvertneqq`` are not supported
556 with MathML output, as there is no corresponding Unicode character.
557
558 Synonyms: `\ne` ``\ne``, `\le` ``\le``, `\ge` ``\ge``,
559 `\Doteq` ``\Doteq``, `\llless` ``\llless``, `\gggtr` ``\gggtr``.
560
561 Symbols can be negated prepending ``\not``, e.g.
562 `\not=` ``\not=``, `\not\equiv` ``\not\equiv``,
563 `\not\gtrless` ``\not\gtrless``, `\not\lessgtr` ``\not\lessgtr``.
564
565 Miscellaneous relations
566 ~~~~~~~~~~~~~~~~~~~~~~~
567 .. class:: colwidths-auto
568
569 ===================== ======================= =================== ===================== =================== =====================
570 `\backepsilon` ``\backepsilon`` `\ntrianglelefteq` ``\ntrianglelefteq`` `\subseteq` ``\subseteq``
571 `\because` ``\because`` `\ntriangleright` ``\ntriangleright`` `\subseteqq` ``\subseteqq``
572 `\between` ``\between`` `\ntrianglerighteq` ``\ntrianglerighteq`` `\subsetneq` ``\subsetneq``
573 `\blacktriangleleft` ``\blacktriangleleft`` `\nvdash` ``\nvdash`` `\subsetneqq` ``\subsetneqq``
574 `\blacktriangleright` ``\blacktriangleright`` `\nVdash` ``\nVdash`` `\supset` ``\supset``
575 `\bowtie` ``\bowtie`` `\nvDash` ``\nvDash`` `\Supset` ``\Supset``
576 `\dashv` ``\dashv`` `\nVDash` ``\nVDash`` `\supseteq` ``\supseteq``
577 `\frown` ``\frown`` `\parallel` ``\parallel`` `\supseteqq` ``\supseteqq``
578 `\in` ``\in`` `\perp` ``\perp`` `\supsetneq` ``\supsetneq``
579 `\mid` ``\mid`` `\pitchfork` ``\pitchfork`` `\supsetneqq` ``\supsetneqq``
580 `\models` ``\models`` `\propto` ``\propto`` `\therefore` ``\therefore``
581 `\ni` ``\ni`` `\shortmid` ``\shortmid`` `\trianglelefteq` ``\trianglelefteq``
582 `\nmid` ``\nmid`` `\shortparallel` ``\shortparallel`` `\trianglerighteq` ``\trianglerighteq``
583 `\notin` ``\notin`` `\smallfrown` ``\smallfrown`` `\varpropto` ``\varpropto``
584 `\nparallel` ``\nparallel`` `\smallsmile` ``\smallsmile`` `\vartriangle` ``\vartriangle``
585 `\nshortmid` ``\nshortmid`` `\smile` ``\smile`` `\vartriangleleft` ``\vartriangleleft``
586 `\nshortparallel` ``\nshortparallel`` `\sqsubset` ``\sqsubset`` `\vartriangleright` ``\vartriangleright``
587 `\nsubseteq` ``\nsubseteq`` `\sqsubseteq` ``\sqsubseteq`` `\vdash` ``\vdash``
588 `\nsubseteqq` ``\nsubseteqq`` `\sqsupset` ``\sqsupset`` `\Vdash` ``\Vdash``
589 `\nsupseteq` ``\nsupseteq`` `\sqsupseteq` ``\sqsupseteq`` `\vDash` ``\vDash``
590 `\nsupseteqq` ``\nsupseteqq`` `\subset` ``\subset`` `\Vvdash` ``\Vvdash``
591 `\ntriangleleft` ``\ntriangleleft`` `\Subset` ``\Subset``
592 ===================== ======================= =================== ===================== =================== =====================
593
594 Synonyms: `\owns` ``\owns``.
595
596 Symbols can be negated prepending ``\not``, e.g.
597 `\not\in` ``\not\in``, `\not\ni` ``\not\ni``.
598
599 The commands ``\varsubsetneq``, ``\varsubsetneqq``, ``\varsupsetneq``,
600 and ``\varsupsetneqq`` are not supported with MathML output as there is no
601 corresponding Unicode character.
602
603
604 Variable-sized operators
605 ------------------------
606 .. class:: colwidths-auto
607
608 ========================= ========================= ========================= ===========================
609 `\sum` ``\sum`` `\prod` ``\prod`` `\bigcap` ``\bigcap`` `\bigodot` ``\bigodot``
610 `\int` ``\int`` `\coprod` ``\coprod`` `\bigcup` ``\bigcup`` `\bigoplus` ``\bigoplus``
611 `\oint` ``\oint`` `\bigwedge` ``\bigwedge`` `\biguplus` ``\biguplus`` `\bigotimes` ``\bigotimes``
612 `\smallint` ``\smallint`` `\bigvee` ``\bigvee`` `\bigsqcup` ``\bigsqcup``
613 ========================= ========================= ========================= ===========================
614
615 Larger symbols are used in displayed formulas, sum-like symbols have
616 indices above/below the symbol:
617
618 .. math:: \sum_{n=1}^N a_n \qquad
619 \int_0^1f(x)\,dx \qquad
620 \prod_{i=1}^{10} b_i \ldots
621
622
623 Notations
624 =========
625
626 Top and bottom embellishments
627 -----------------------------
628
629 See `Accents and embellishments`_.
630
631
632 Extensible arrows
633 -----------------
634
635 \xleftarrow and \xrightarrow produce arrows that extend automatically to
636 accommodate unusually wide subscripts or superscripts. These commands
637 take one optional argument (the subscript) and one mandatory argument
638 (the superscript, possibly empty)::
639
640 A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C
641
642 results in
643
644 .. math:: A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C
645
646
647 Affixing symbols to other symbols
648 ---------------------------------
649
650 In addition to the standard `accents and embellishments`_, other symbols
651 can be placed above or below a base symbol with the ``\overset`` and
652 ``\underset`` commands. The symbol is set in "scriptstyle" (smaller font
653 size). For example, writing ``\overset{*}{X}`` becomes `\overset{*}{X}`
654 and ``\underset{+}{M}`` becomes `\underset{+}{M}`.
655
656
657 Matrices
658 --------
659
660 The ``matrix`` and ``cases`` environments can also contain ``\\`` and
661 ``&``::
662
663 .. math::
664 \left ( \begin{matrix} a & b \\ c & d \end{matrix}\right)
665
666 Result:
667
668 .. math::
669 \left ( \begin{matrix} a & b \\ c & d \end{matrix} \right)
670
671 The environments ``pmatrix``, ``bmatrix``, ``Bmatrix``, ``vmatrix``, and
672 ``Vmatrix`` have (respectively) ( ), [ ], { }, \| \|, and `\Vert\ \Vert`
673 delimiters built in, e.g.
674
675 .. math:: \begin{pmatrix} a & b \\ c & d \end{pmatrix} \qquad
676 \begin{bmatrix} a & b \\ c & d \end{bmatrix} \qquad
677 \begin{Vmatrix} a & b \\ c & d \end{Vmatrix}
678
679 To produce a small matrix suitable for use in text, there is a
680 ``smallmatrix`` environment
681 `\bigl(\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}\bigr)`
682 that comes closer to fitting within a single text line than a normal
683 matrix.
684
685
686 For piecewise function definitions there is a ``cases`` environment:
687
688 .. math:: \mathrm{sgn}(x) = \begin{cases}
689 -1 & x<0\\
690 \phantom{-}1 & x>0
691 \end{cases}
692
693
694 Spacing commands
695 ----------------
696
697 Horizontal spacing of elements can be controlled with the following
698 commands:
699
700 .. class:: colwidths-auto
701
702 ====================== ======== ===================== ===================
703 :m:`3\qquad 4` ``3\qquad 4`` = 2em
704 :m:`3\quad 4` ``3\quad 4`` = 1em
705 :m:`3~4` ``3~4`` ``3\nobreakspace 4``
706 :m:`3\ 4` ``3\ 4`` escaped space
707 :m:`3\;4` ``3\;4`` ``3\thickspace 4``
708 :m:`3\:4` ``3\:4`` ``3\medspace 4``
709 :m:`3\,4` ``3\,4`` ``3\thinspace 4``
710 :m:`3 4` ``3 4`` regular space [#]_
711 :m:`3\!4` ``3\!4`` ``3\negthinspace 4`` negative space [#]_
712 :m:`3\negmedspace 4` ``3\negmedspace 4``
713 :m:`3\negthickspace 4` ``3\negthickspace 4``
714 `3\hspace{1ex}4` ``3\hspace{1ex}4`` custom length
715 `3\mspace{20mu}4` ``3\mspace{20mu}4`` custom length [#]_
716 ====================== ======== ===================== ===================
717
718 .. [#] Whitespace characters are ignored in LaTeX math mode.
719 .. [#] Negative spacing does not work with MathML (last tested in Firefox 115).
720 .. [#] In LaTeX, the unit must be 'mu' (1 mu = 1/18em).
721
722 There are also three commands that leave a space equal to the height and
723 width of its argument. For example ``\phantom{XXX}`` results in space as
724 wide and high as three X’s:
725
726 .. math:: \frac{\phantom{XXX}+1}{XXX-1}
727
728 The commands ``\hphantom`` and ``\vphantom`` insert space with the
729 width or height of the argument. They are not supported with `math_output`_
730 MathML.
731
732
733 Modular arithmetic and modulo operation
734 ---------------------------------------
735
736 The commands ``\bmod``, ``\pmod``, ``\mod``, and ``\pod`` deal with the
737 special spacing conventions of the “mod” notation. [#]_
738
739 .. class:: colwidths-auto
740
741 ========= =========================== =========================
742 command example result
743 ========= =========================== =========================
744 ``\bmod`` ``\gcd(n,m \bmod n)`` `\gcd(n,m \bmod n)`
745 ``\pmod`` ``x\equiv y \pmod b`` `x\equiv y \pmod b`
746 ``\mod`` ``x\equiv y \mod c`` `x\equiv y \mod c`
747 ``\pod`` ``x\equiv y \pod d`` `x\equiv y \pod d`
748 .. ``\operatorname{mod}(m,n)`` `\operatorname{mod}(m,n)`
749 ========= =========================== =========================
750
751 .. [#] Currently `not supported`__ by the "HTML" math_output_ option
752 of the HTML writer.
753
754 __ https://sourceforge.net/p/docutils/feature-requests/93/
755
756
757 Roots
758 -----
759
760 .. class:: colwidths-auto
761
762 ========= ==================== ==================
763 command example result
764 ========= ==================== ==================
765 ``\sqrt`` ``\sqrt{x^2-1}`` `\sqrt{x^2-1}`
766 .. ``\sqrt[3n]{x^2-1}`` `\sqrt[3n]{x^2-1}`
767 .. ``\sqrt\frac{1}{2}`` `\sqrt\frac{1}{2}`
768 ========= ==================== ==================
769
770
771 Boxed formulas
772 --------------
773
774 The command ``\boxed`` puts a box around its argument:
775
776 .. math:: \boxed{\eta \leq C(\delta(\eta) +\Lambda_M(0,\delta))}
777
778
779 Fractions and related constructions
780 ===================================
781
782 The ``\frac`` command takes two ar guments, numerator and denominator,
783 and typesets them in normal fraction form. For example, ``U = \frac{R}{I}``
784 produces `U = \frac{R}{I}`. Use ``\dfrac`` or ``\tfrac`` to
785 force text style and display style respectively.
786
787 .. math:: \frac{x+1}{x-1} \quad
788 \dfrac{x+1}{x-1} \quad
789 \tfrac{x+1}{x-1}
790
791 and in text: `\frac{x+1}{x-1}`, `\dfrac{x+1}{x-1}`, `\tfrac{x+1}{x-1}`.
792
793 For binomial expressions such as `\binom{n}{k}`,
794 there are ``\binom``, ``\dbinom`` and ``\tbinom`` commands::
795
796 2^k-\binom{k}{1}2^{k-1}+\binom{k}{2}2^{k-2}
797
798 prints
799
800 .. math:: 2^k-\binom{k}{1}2^{k-1}+\binom{k}{2}2^{k-2}
801
802 The ``\cfrac`` command for continued fractions uses displaystyle and
803 padding for sub-fractions:
804
805 .. math:: \frac{\pi}{4} = 1 + \cfrac{1^2}{
806 2 + \cfrac{3^2}{
807 2 + \cfrac{5^2}{
808 2 + \cfrac{7^2}{2 + \cdots}
809 }}}
810 \qquad \text{vs.}\qquad
811 \frac{\pi}{4} = 1 + \frac{1^2}{
812 2 + \frac{3^2}{
813 2 + \frac{5^2}{
814 2 + \frac{7^2}{2 + \cdots}
815 }}}
816
817 The optional argument ``[l]`` or ``[r]`` for left or right placement of
818 the numerator is `not supported by MathML Core`__:
819
820 .. math:: \cfrac[l]{x}{x-1} \quad
821 \cfrac{x}{x-1} \quad
822 \cfrac[r]{x}{x-1}
823
824 __ https://github.com/w3c/mathml/issues/30
825
826
827 Delimiter sizes
828 ===============
829
830 Besides the automatic scaling of `extensible delimiters`_ with ``\left``
831 and ``\right``, there are four commands to manually select delimiters of
832 fixed size:
833
834 .. class:: colwidths-auto
835
836 ========= ============== ============== ============== ============== =============== ===============
837 Sizing no ``\left`` ``\bigl`` ``\Bigl`` ``\biggl`` ``\Biggl``
838 command ``\right`` ``\bigr`` ``\Bigr`` ``\biggr`` ``\Biggr``
839 --------- -------------- -------------- -------------- -------------- --------------- ---------------
840 Result `\displaystyle `\displaystyle `\displaystyle `\displaystyle `\displaystyle `\displaystyle
841 (b) \left(b\right) \bigl(b\bigr) \Bigl(b\Bigr) \biggl(b\biggr) \Biggl(b\Biggr)
842 (\frac{c}{d})` \left(\frac{c} \bigl(\frac{c} \Bigl(\frac{c} \biggl(\frac{c} \Biggl(\frac{c}
843 {d}\right)` {d}\bigr)` {d}\Bigr)` {d}\biggr)` {d}\Biggr)`
844 ========= ============== ============== ============== ============== =============== ===============
845
846 There are two or three situations where the delimiter size is commonly
847 adjusted using these commands:
848
849 The first kind of adjustment is done for cumulative operators with
850 limits, such as summation signs. With ``\left`` and ``\right`` the
851 delimiters usually turn out larger than necessary, and using the ``Big``
852 or ``bigg`` sizes instead gives better results:
853
854 .. math::
855 \left[\sum_i a_i\left\lvert\sum_j x_{ij}\right\rvert^p\right]^{1/p}
856 \text{ versus }
857 \biggl[\sum_i a_i\Bigl\lvert\sum_j x_{ij}\Bigr\rvert^p\biggr]^{1/p}
858
859 The second kind of situation is clustered pairs of delimiters, where
860 \left and \right make them all the same size (because that is adequate to
861 cover the encompassed material), but what you really want is to make some
862 of the delimiters slightly larger to make the nesting easier to see.
863
864 .. math:: \left((a_1 b_1) - (a_2 b_2)\right)
865 \left((a_2 b_1) + (a_1 b_2)\right)
866 \quad\text{versus}\quad
867 \bigl((a_1 b_1) - (a_2 b_2)\bigr)
868 \bigl((a_2 b_1) + (a_1 b_2)\bigr)
869
870 The third kind of situation is a slightly oversize object in running
871 text, such as `\left|\frac{b'}{d'}\right|` where the delimiters produced
872 by ``\left`` and ``\right`` cause too much line spreading. [#]_ In that case
873 ``\bigl`` and ``\bigr`` can be used to produce delimiters that are larger
874 than the base size but still able to fit within the normal line spacing:
875 `\bigl|\frac{b'}{d'}\bigr|`.
876
877 .. [#] With MathML, an example would be parentheses
878 around a ``smallmatrix`` environment
879 `\left(\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}\right)`
880 vs. `\Bigl(\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}\Bigr)`.
881
882
883 Text
884 ====
885
886 The main use of the command ``\text`` is for words or phrases in a
887 display. It is similar to ``\mbox`` in its effects but, unlike ``\mbox``,
888 automatically produces subscript-size text if used in a subscript,
889 ``k_{\text{B}}T`` becomes `k_{\text{B}}T`.
890
891 Whitespace is kept inside the argument:
892
893 .. Math:: f_{[x_{i-1},x_i]} \text{ is monotonic for } i = 1,\,…,\,c+1
894
895
896 The text may contain math commands wrapped in ``$`` signs, e.g.
897
898 .. math:: (-1)^{n_i} = \begin{cases} -1 \quad \text{if $n_i$ is odd,} \\
899 +1 \quad \text{if $n_i$ is even.}
900 \end{cases}
901
902 .. TODO ignore {}, handle text-mode commands
903
904
905 Integrals and sums
906 ==================
907
908 The limits on integrals, sums, and similar symbols are placed either to
909 the side of or above and below the base symbol, depending on convention
910 and context. In inline formulas and fractions, the limits on sums, and
911 similar symbols like
912
913 .. math:: \lim_{n\to\infty} \sum_1^n \frac{1}{n}
914
915 move to index positions: `\lim_{n\to\infty} \sum_1^n \frac{1}{n}`.
916
917
918 Altering the placement of limits
919 --------------------------------
920
921 The commands ``\intop`` and ``\ointop`` produce integral signs with
922 limits as in sums and similar: `\intop_0^1`, `\ointop_c` and
923
924 .. math:: \intop_0^1 \quad \ointop_c
925 \quad \text{vs.} \quad
926 \int^1_0 \quad \oint_c
927
928 The commands ``\limits`` and ``\nolimits`` override the default placement
929 of the limits for any operator; ``\displaylimits`` forces standard
930 positioning as for the \sum command. They should follow immediately after
931 the operator to which they apply.
932
933 Compare the same term with default positions, ``\limits``, and
934 ``\nolimits`` in inline and display mode: `\lim_{x\to0}f(x)`,
935 `\lim\limits_{x\to0}f(x)`, `\lim\nolimits_{x\to0}f(x)`, vs.
936
937 .. math:: \lim_{x\to0}f(x), \quad
938 \lim\limits_{x\to0}f(x) \quad
939 \lim\nolimits_{x\to0}f(x).
940
941 .. TODO: \substack
942
943 .. TODO: \sideset
944
945
946 Changing the size of elements in a formula
947 ==========================================
948
949 The declarations [#]_ ``\displaystyle``, ``\textstyle``,
950 ``\scriptstyle``, and ``\scriptscriptstyle``, select a symbol size and
951 spacing that would be applied in display math, inline
952 math, first-order subscript, or second-order subscript, respectively
953 even when the current context would normally yield some other size.
954
955 For example ``:math:`\displaystyle \sum_{n=0}^\infty
956 \frac{1}{n}``` is printed as `\displaystyle \sum_{n=0}^\infty \frac{1}{n}`
957 rather than `\sum_{n=0}^\infty \frac{1}{n}` and ::
958
959 \frac{\scriptstyle\sum_{n > 0} z^n}
960 {\displaystyle\prod_{1\leq k\leq n} (1-q^k)}
961
962 yields
963
964 .. math::
965
966 \frac{\scriptstyle\sum_{n > 0} z^n}
967 {\displaystyle\prod_{1\leq k\leq n} (1-q^k)}
968 \text{ instead of the default }
969 \frac{\sum_{n > 0} z^n}
970 {\prod_{1\leq k\leq n} (1-q^k)}.
971
972 .. [#] "Declarations" are commands that affect processing of the current
973 "group". In particular, notice where the braces fall that delimit the
974 effect of the command: Right: ``{\displaystyle ...}`` Wrong:
975 ``\displaystyle{...}``.
976
977 With math_output_ MathML, the declaration must be the first element
978 after the opening bracket.
979
980
981 .. [ISO-80000-2] :title:`Quantities and units – Part 2: Mathematical signs
982 and symbols to be used in the natural sciences and technology`:
983 http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=31887.