| 1 |
================================== |
| 2 |
Using LaTeX syntax for mathematics |
| 3 |
================================== |
| 4 |
|
| 5 |
.. role:: m(math) |
| 6 |
.. default-role:: math |
| 7 |
.. |latex| replace:: L\ :sup:`A`\ T\ :sub:`E`\ X |
| 8 |
|
| 9 |
.. contents:: |
| 10 |
|
| 11 |
|
| 12 |
Introduction |
| 13 |
============ |
| 14 |
|
| 15 |
Since version 0.8, Docutils supports mathematical content with a `"math" |
| 16 |
directive`__ and `role`__. |
| 17 |
The input format is *LaTeX math syntax*\ [#math-syntax]_ with support for |
| 18 |
Unicode symbols. |
| 19 |
|
| 20 |
|
| 21 |
.. [#math-syntax] The supported LaTeX commands include AMS extensions |
| 22 |
(see, e.g., the `Short Math Guide`_). |
| 23 |
|
| 24 |
The support is limited to a subset of *LaTeX math* by the conversion |
| 25 |
required for many output formats. For HTML, the `math_output`_ |
| 26 |
configuration setting (or the corresponding ``--math-output`` command |
| 27 |
line option) select between alternative output formats with different |
| 28 |
subsets of supported elements. If a writer does not support math |
| 29 |
typesetting at all, the content is inserted verbatim. |
| 30 |
|
| 31 |
__ https://docutils.sourceforge.io/docs/ref/rst/directives.html#math |
| 32 |
__ https://docutils.sourceforge.io/docs/ref/rst/roles.html#math |
| 33 |
.. _Short Math Guide: |
| 34 |
http://mirrors.ctan.org/info/short-math-guide/short-math-guide.pdf |
| 35 |
.. _math_output: |
| 36 |
https://docutils.sourceforge.io/docs/user/config.html#math-output |
| 37 |
|
| 38 |
|
| 39 |
Role and directive |
| 40 |
================== |
| 41 |
|
| 42 |
The ``math`` role can be used for inline mathematical expressions: |
| 43 |
``:math:`\psi(r) = \exp(-2r)``` will produce :m:`\psi(r)=\exp(-2r)`. |
| 44 |
Inside the backtics you can write anything you would write between dollar |
| 45 |
signs in a LaTeX document. |
| 46 |
|
| 47 |
For producing displayed math (like an ``equation*`` environment in a |
| 48 |
LaTeX document) there is a ``math`` directive. If you write:: |
| 49 |
|
| 50 |
.. math:: \psi(r) = e^{-2r} |
| 51 |
|
| 52 |
you will get: |
| 53 |
|
| 54 |
.. math:: \psi(r) = e^{-2r} |
| 55 |
|
| 56 |
A more complex example is the definition of the Fourier transform |
| 57 |
|
| 58 |
.. math:: |
| 59 |
|
| 60 |
(\mathcal{F}f)(y) = |
| 61 |
\frac{1}{\sqrt{2\pi}^{\ n}} |
| 62 |
\int_{\mathbb{R}^n} f(x)\,e^{-\mathrm{i} y \cdot x} \,\mathrm{d} x. |
| 63 |
|
| 64 |
|
| 65 |
.. tip:: |
| 66 |
|
| 67 |
If you put ``.. default-role:: math`` at the top of your |
| 68 |
document, then you can write ```x^2``` instead of the longer |
| 69 |
version: ``:math:`x^2```. You can also introduce an |
| 70 |
abreviation like this ``.. role:: m(math)``. That will allow |
| 71 |
you to write ``:m:`x^2``` or ```x^2`:m:``. |
| 72 |
|
| 73 |
|
| 74 |
Not *all* math syntax constructs work with every output format, but basic |
| 75 |
everyday-math should work. |
| 76 |
|
| 77 |
If a command or a special symbol is not desribed in this document, then |
| 78 |
it is probably not implemented in the internal LaTeX -> MathML converter. |
| 79 |
|
| 80 |
|
| 81 |
Commands |
| 82 |
======== |
| 83 |
|
| 84 |
|
| 85 |
.. class:: colwidths-auto |
| 86 |
|
| 87 |
===================== ============================== ============================ |
| 88 |
command example result |
| 89 |
===================== ============================== ============================ |
| 90 |
``\sqrt`` ``\sqrt{x^2-1}`` `\sqrt{x^2-1}` |
| 91 |
``\frac`` ``\frac{1}{2}`` `\frac{1}{2}` |
| 92 |
``\left``, ``\right`` ``\left(\frac{1}{2}\right)^n`` `\left(\frac{1}{2}\right)^n` |
| 93 |
===================== ============================== ============================ |
| 94 |
|
| 95 |
|
| 96 |
Environments |
| 97 |
============ |
| 98 |
|
| 99 |
Displayed math can use ``\\`` and ``&`` for line shifts and alignments:: |
| 100 |
|
| 101 |
.. math:: |
| 102 |
|
| 103 |
a & = (x + y)^2 \\ |
| 104 |
& = x^2 + 2xy + y^2 |
| 105 |
|
| 106 |
LaTeX output will wrap it in an ``align*`` environment. |
| 107 |
The result is: |
| 108 |
|
| 109 |
.. math:: |
| 110 |
|
| 111 |
a & = (x + y)^2 \\ |
| 112 |
& = x^2 + 2xy + y^2 |
| 113 |
|
| 114 |
The ``matrix`` and ``cases`` environments can also contain ``\\`` and |
| 115 |
``&``:: |
| 116 |
|
| 117 |
.. math:: |
| 118 |
|
| 119 |
\left(\begin{matrix} a & b \\ c & d \end{matrix}\right) |
| 120 |
|
| 121 |
Result: |
| 122 |
|
| 123 |
.. math:: |
| 124 |
|
| 125 |
\left(\begin{matrix} a & b \\ c & d \end{matrix}\right) |
| 126 |
|
| 127 |
|
| 128 |
Mathematical symbols |
| 129 |
==================== |
| 130 |
|
| 131 |
The following tables are adapted from the first edition of |
| 132 |
"The LaTeX Companion" (Goossens, Mittelbach, Samarin). |
| 133 |
|
| 134 |
Accents |
| 135 |
------- |
| 136 |
.. class:: colwidths-auto |
| 137 |
|
| 138 |
=========== ============= =========== ============= ============== ================ |
| 139 |
`\acute{x}` ``\acute{x}`` `\dot{t}` ``\dot{t}`` `\hat{H}` ``\hat{H}`` |
| 140 |
`\bar{v}` ``\bar{v}`` `\ddot{t}` ``\ddot{t}`` `\mathring{x}` ``\mathring{x}`` |
| 141 |
`\breve{x}` ``\breve{x}`` `\dddot{t}` ``\dddot{t}`` `\tilde{n}` ``\tilde{n}`` |
| 142 |
`\check{x}` ``\check{x}`` `\grave{x}` ``\grave{x}`` `\vec{x}` ``\vec{x}`` |
| 143 |
=========== ============= =========== ============= ============== ================ |
| 144 |
|
| 145 |
When adding an accent to an i or j in math, dotless variants can be |
| 146 |
obtained with ``\imath`` and ``\jmath``: `\bar \imath`, `\hat{\jmath}` |
| 147 |
(MathML drops the dot automatically). |
| 148 |
|
| 149 |
For adornment that span multiple symbols, see `top and bottom |
| 150 |
embellishments`_. |
| 151 |
|
| 152 |
Font switches |
| 153 |
------------- |
| 154 |
|
| 155 |
TeX’s *math alphabets* correspond to the |
| 156 |
:t:`mathematical alphanumeric symbols` block in Unicode and the |
| 157 |
"mathvariant" `style attribute`__ in MathML. They are “to be used for |
| 158 |
mathematical variables where style variations are important |
| 159 |
semantically”. |
| 160 |
|
| 161 |
__ https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute |
| 162 |
|
| 163 |
.. class:: colwidths-auto |
| 164 |
|
| 165 |
=============== ============================ ========================== |
| 166 |
command example result |
| 167 |
=============== ============================ ========================== |
| 168 |
``\mathbf`` ``\mathbf{r}^2=x^2+y^2+z^2`` `\mathbf{r}^2=x^2+y^2+z^2` |
| 169 |
``\mathbb`` ``\mathbb{R \subset C}`` `\mathbb{R \subset C}` |
| 170 |
``\mathcal`` ``\mathcal{F}f(x)`` `\mathcal{F}f(x)` |
| 171 |
``\mathfrak`` ``\mathfrak{a}`` `\mathfrak{a}` |
| 172 |
``\mathit`` ``\mathit{\Gamma}`` `\mathit{\Gamma}` |
| 173 |
``\mathrm`` ``s_\mathrm{out}`` `s_\mathrm{out}` |
| 174 |
``\mathsf`` ``\mathsf x`` `\mathsf x` |
| 175 |
``\mathtt`` ``\mathtt{0.12}`` `\mathtt{0.12}` |
| 176 |
=============== ============================ ========================== |
| 177 |
|
| 178 |
Additional alphabets are defined in LaTeX packages, e.g. |
| 179 |
|
| 180 |
.. class:: colwidths-auto |
| 181 |
|
| 182 |
=========== ============= ====================== |
| 183 |
TeX command LaTeX package MathML "mathvariant" |
| 184 |
=========== ============= ====================== |
| 185 |
mathbfit isomath_ bold-italic |
| 186 |
mathsfit isomath_ sans-serif-italic |
| 187 |
mathsfbfit isomath_ sans-serif-bold-italic |
| 188 |
mathscr mathrsfs_ script |
| 189 |
=========== ============= ====================== |
| 190 |
.. _isomath: https://www.ctan.org/pkg/isomath |
| 191 |
.. _mathrsfs: https://www.ctan.org/pkg/mathrsfs |
| 192 |
|
| 193 |
This can be used to typeset vector symbols in **bold** *italic* |
| 194 |
in line with the International Standard [ISO-80000-2]. |
| 195 |
``\mathbfit{r}^2=x^2+y^2+z^2`` becomes |
| 196 |
|
| 197 |
.. math:: \mathbfit{r}^2=x^2+y^2+z^2. |
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
In contrast to the math alphabet selectors, ``\boldsymbol`` only changes |
| 202 |
the *font weight*. In LaTeX, it can be used to get a bold version of any |
| 203 |
mathematical symbol (for other output formats, results are mixed): |
| 204 |
|
| 205 |
.. math:: |
| 206 |
\boldsymbol{abs(x) \pm \alpha \approx 3 \Gamma \quad \forall x \in R} |
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
Arrows |
| 212 |
------ |
| 213 |
.. class:: colwidths-auto |
| 214 |
|
| 215 |
===================== ======================= ===================== ======================= |
| 216 |
`\leftarrow` ``\leftarrow`` `\Leftarrow` ``\Leftarrow`` |
| 217 |
`\rightarrow` ``\rightarrow`` `\Rightarrow` ``\Rightarrow`` |
| 218 |
`\leftrightarrow` ``\leftrightarrow`` `\Leftrightarrow` ``\Leftrightarrow`` |
| 219 |
`\uparrow` ``\uparrow`` `\Uparrow` ``\Uparrow`` |
| 220 |
`\downarrow` ``\downarrow`` `\Downarrow` ``\Downarrow`` |
| 221 |
`\updownarrow` ``\updownarrow`` `\Updownarrow` ``\Updownarrow`` |
| 222 |
|
| 223 |
`\longleftarrow` ``\longleftarrow`` `\Longleftarrow` ``\Longleftarrow`` |
| 224 |
`\longrightarrow` ``\longrightarrow`` `\Longrightarrow` ``\Longrightarrow`` |
| 225 |
`\longleftrightarrow` ``\longleftrightarrow`` `\Longleftrightarrow` ``\Longleftrightarrow`` |
| 226 |
|
| 227 |
`\nearrow` ``\nearrow`` `\leftharpoonup` ``\leftharpoonup`` |
| 228 |
`\searrow` ``\searrow`` `\rightharpoonup` ``\rightharpoonup`` |
| 229 |
`\swarrow` ``\swarrow`` `\leftharpoondown` ``\leftharpoondown`` |
| 230 |
`\nwarrow` ``\nwarrow`` `\rightharpoondown` ``\rightharpoondown`` |
| 231 |
|
| 232 |
`\mapsto` ``\mapsto`` `\hookleftarrow` ``\hookleftarrow`` |
| 233 |
`\longmapsto` ``\longmapsto`` `\hookrightarrow` ``\hookrightarrow`` |
| 234 |
===================== ======================= ===================== ======================= |
| 235 |
|
| 236 |
|
| 237 |
Binary operators |
| 238 |
---------------- |
| 239 |
.. class:: colwidths-auto |
| 240 |
|
| 241 |
================== ==================== ================= =================== ================== ==================== |
| 242 |
`*` ``*`` `\circledast` ``\circledast`` `\ominus` ``\ominus`` |
| 243 |
`+` ``+`` `\circledcirc` ``\circledcirc`` `\oplus` ``\oplus`` |
| 244 |
`-` ``-`` `\circleddash` ``\circleddash`` `\oslash` ``\oslash`` |
| 245 |
`:` ``:`` `\cup` ``\cup`` `\otimes` ``\otimes`` |
| 246 |
`\Cap` ``\Cap`` `\curlyvee` ``\curlyvee`` `\pm` ``\pm`` |
| 247 |
`\Cup` ``\Cup`` `\curlywedge` ``\curlywedge`` `\rightthreetimes` ``\rightthreetimes`` |
| 248 |
`\amalg` ``\amalg`` `\dagger` ``\dagger`` `\rtimes` ``\rtimes`` |
| 249 |
`\ast` ``\ast`` `\ddagger` ``\ddagger`` `\setminus` ``\setminus`` |
| 250 |
`\bigcirc` ``\bigcirc`` `\diamond` ``\diamond`` `\smallsetminus` ``\smallsetminus`` |
| 251 |
`\bigtriangledown` ``\bigtriangledown`` `\div` ``\div`` `\sqcap` ``\sqcap`` |
| 252 |
`\bigtriangleup` ``\bigtriangleup`` `\divideontimes` ``\divideontimes`` `\sqcup` ``\sqcup`` |
| 253 |
`\boxdot` ``\boxdot`` `\dotplus` ``\dotplus`` `\star` ``\star`` |
| 254 |
`\boxminus` ``\boxminus`` `\doublebarwedge` ``\doublebarwedge`` `\times` ``\times`` |
| 255 |
`\boxplus` ``\boxplus`` `\gtrdot` ``\gtrdot`` `\triangleleft` ``\triangleleft`` |
| 256 |
`\boxtimes` ``\boxtimes`` `\intercal` ``\intercal`` `\triangleright` ``\triangleright`` |
| 257 |
`\bullet` ``\bullet`` `\leftthreetimes` ``\leftthreetimes`` `\uplus` ``\uplus`` |
| 258 |
`\cap` ``\cap`` `\lessdot` ``\lessdot`` `\vee` ``\vee`` |
| 259 |
`\cdot` ``\cdot`` `\ltimes` ``\ltimes`` `\veebar` ``\veebar`` |
| 260 |
`\centerdot` ``\centerdot`` `\mp` ``\mp`` `\wedge` ``\wedge`` |
| 261 |
`\circ` ``\circ`` `\odot` ``\odot`` `\wr` ``\wr`` |
| 262 |
================== ==================== ================= =================== ================== ==================== |
| 263 |
|
| 264 |
|
| 265 |
Braces |
| 266 |
------ |
| 267 |
.. class:: colwidths-auto |
| 268 |
|
| 269 |
============ ============ ============ ============== ======================== |
| 270 |
`(` ``(`` `[` ``[`` `|` ``|`` `\{` ``\{`` `\langle` ``\langle`` |
| 271 |
`)` ``)`` `]` ``]`` `|` ``|`` `\}` ``\}`` `\rangle` ``\rangle`` |
| 272 |
============ ============ ============ ============== ======================== |
| 273 |
|
| 274 |
|
| 275 |
Greek letters |
| 276 |
------------- |
| 277 |
.. class:: colwidths-auto |
| 278 |
|
| 279 |
========== ============ ========== ============ ========== ============ ============== =============== |
| 280 |
`\Gamma` ``\Gamma`` `\alpha` ``\alpha`` `\mu` ``\mu`` `\omega` ``\omega`` |
| 281 |
`\Delta` ``\Delta`` `\beta` ``\beta`` `\nu` ``\nu`` `\backepsilon` ``\backepsilon`` |
| 282 |
`\Lambda` ``\Lambda`` `\gamma` ``\gamma`` `\xi` ``\xi`` `\digamma` ``\digamma`` |
| 283 |
`\Omega` ``\Omega`` `\delta` ``\delta`` `\pi` ``\pi`` `\varepsilon` ``\varepsilon`` |
| 284 |
`\Phi` ``\Phi`` `\epsilon` ``\epsilon`` `\rho` ``\rho`` `\varkappa` ``\varkappa`` |
| 285 |
`\Pi` ``\Pi`` `\zeta` ``\zeta`` `\sigma` ``\sigma`` `\varphi` ``\varphi`` |
| 286 |
`\Psi` ``\Psi`` `\eta` ``\eta`` `\tau` ``\tau`` `\varpi` ``\varpi`` |
| 287 |
`\Sigma` ``\Sigma`` `\theta` ``\theta`` `\upsilon` ``\upsilon`` `\varrho` ``\varrho`` |
| 288 |
`\Theta` ``\Theta`` `\iota` ``\iota`` `\phi` ``\phi`` `\varsigma` ``\varsigma`` |
| 289 |
`\Upsilon` ``\Upsilon`` `\kappa` ``\kappa`` `\chi` ``\chi`` `\vartheta` ``\vartheta`` |
| 290 |
`\Xi` ``\Xi`` `\lambda` ``\lambda`` `\psi` ``\psi`` |
| 291 |
========== ============ ========== ============ ========== ============ ============== =============== |
| 292 |
|
| 293 |
|
| 294 |
Letterlike symbols |
| 295 |
------------------ |
| 296 |
.. class:: colwidths-auto |
| 297 |
|
| 298 |
======= ========== ============= =============== ========= =========== ========== ============ |
| 299 |
`\Im` ``\Im`` `\forall` ``\forall`` `\aleph` ``\aleph`` `\eth` ``\eth`` |
| 300 |
`\Re` ``\Re`` `\exists` ``\exists`` `\beth` ``\beth`` `\hbar` ``\hbar`` |
| 301 |
`\mho` ``\mho`` `\complement` ``\complement`` `\gimel` ``\gimel`` `\hslash` ``\hslash`` |
| 302 |
`\Bbbk` ``\Bbbk`` `\Finv` ``\Finv`` `\daleth` ``\daleth`` `\imath` ``\imath`` |
| 303 |
`\ell` ``\ell`` `\Game` ``\Game`` `\nabla` ``\nabla`` `\partial` ``\partial`` |
| 304 |
`\wp` ``\wp`` |
| 305 |
======= ========== ============= =============== ========= =========== ========== ============ |
| 306 |
|
| 307 |
|
| 308 |
Miscellaneous symbols |
| 309 |
--------------------- |
| 310 |
.. class:: colwidths-auto |
| 311 |
|
| 312 |
======== =============== =========== ============= ============== ================ ========== ============ |
| 313 |
`\angle` ``\angle`` `\emptyset` ``\emptyset`` `\clubsuit` ``\clubsuit`` `\flat` ``\flat`` |
| 314 |
`\colon` ``\colon`` [#]_ `\infty` ``\infty`` `\diamondsuit` ``\diamondsuit`` `\natural` ``\natural`` |
| 315 |
`\cdots` ``\cdots`` `\neg` ``\neg`` `\heartsuit` ``\heartsuit`` `\sharp` ``\sharp`` |
| 316 |
`\ddots` ``\ddots`` `\bot` ``\bot`` `\spadesuit` ``\spadesuit`` |
| 317 |
`\ddots` ``\ddots`` `\top` ``\top`` |
| 318 |
======== =============== =========== ============= ============== ================ ========== ============ |
| 319 |
|
| 320 |
.. [#] Punctuation (not ratio): |
| 321 |
Compare spacing in `a\colon b\to c` and `a:b = c`. |
| 322 |
|
| 323 |
|
| 324 |
Named operators |
| 325 |
--------------- |
| 326 |
.. class:: colwidths-auto |
| 327 |
|
| 328 |
========= =========== ====== ======== ====== ======== ======= ========= |
| 329 |
`\arccos` ``\arccos`` `\csc` ``\csc`` `\ker` ``\ker`` `\sec` ``\sec`` |
| 330 |
`\arcsin` ``\arcsin`` `\deg` ``\deg`` `\lg` ``\lg`` `\sin` ``\sin`` |
| 331 |
`\arctan` ``\arctan`` `\det` ``\det`` `\lim` ``\lim`` `\sinh` ``\sinh`` |
| 332 |
`\arg` ``\arg`` `\dim` ``\dim`` `\ln` ``\ln`` `\sup` ``\sup`` |
| 333 |
`\cos` ``\cos`` `\exp` ``\exp`` `\log` ``\log`` `\tan` ``\tan`` |
| 334 |
`\cosh` ``\cosh`` `\gcd` ``\gcd`` `\max` ``\max`` `\tanh` ``\tanh`` |
| 335 |
`\cot` ``\cot`` `\hom` ``\hom`` `\min` ``\min`` |
| 336 |
`\coth` ``\coth`` `\inf` ``\inf`` `\Pr` ``\Pr`` |
| 337 |
========= =========== ====== ======== ====== ======== ======= ========= |
| 338 |
|
| 339 |
Named operators outside the above list can be typeset with |
| 340 |
``\operatorname{name}``, e.g. `\operatorname{sgn}(-3) = -1`. |
| 341 |
|
| 342 |
|
| 343 |
Relation symbols |
| 344 |
---------------- |
| 345 |
.. class:: colwidths-auto |
| 346 |
|
| 347 |
================================ ================================ ================================ ================================ |
| 348 |
`\Join` ``\Join`` `\approx` ``\approx`` `\asymp` ``\asymp`` `\bowtie` ``\bowtie`` |
| 349 |
`\cong` ``\cong`` `\dashv` ``\dashv`` `\doteq` ``\doteq`` `\equiv` ``\equiv`` |
| 350 |
`\frown` ``\frown`` `\ge` ``\ge`` `\geq` ``\geq`` `\gg` ``\gg`` |
| 351 |
`\in` ``\in`` `\le` ``\le`` `\leq` ``\leq`` `\ll` ``\ll`` |
| 352 |
`\mid` ``\mid`` `\models` ``\models`` `\neq` ``\neq`` `\ni` ``\ni`` |
| 353 |
`\parallel` ``\parallel`` `\perp` ``\perp`` `\prec` ``\prec`` `\precsim` ``\precsim`` |
| 354 |
`\propto` ``\propto`` `\sim` ``\sim`` `\simeq` ``\simeq`` `\smile` ``\smile`` |
| 355 |
`\sqsubset` ``\sqsubset`` `\sqsubseteq` ``\sqsubseteq`` `\sqsupset` ``\sqsupset`` `\sqsupseteq` ``\sqsupseteq`` |
| 356 |
`\subset` ``\subset`` `\subseteq` ``\subseteq`` `\succ` ``\succ`` `\succsim` ``\succsim`` |
| 357 |
`\supset` ``\supset`` `\supseteq` ``\supseteq`` `\vdash` ``\vdash`` |
| 358 |
================================ ================================ ================================ ================================ |
| 359 |
|
| 360 |
negated relations |
| 361 |
.. class:: colwidths-auto |
| 362 |
|
| 363 |
============================= =================== |
| 364 |
`\not\in` ``\not\in`` `\not =` ``\not =`` |
| 365 |
`\not \equiv` ``\not \equiv`` |
| 366 |
============================= =================== |
| 367 |
|
| 368 |
|
| 369 |
Variable-sized symbols |
| 370 |
---------------------- |
| 371 |
.. class:: colwidths-auto |
| 372 |
|
| 373 |
================= =========================== ========================= ========================= ===================== |
| 374 |
`\sum` ``\sum`` `\bigodot` ``\bigodot`` `\bigcap` ``\bigcap`` `\bigwedge` ``\bigwedge`` `\prod` ``\prod`` |
| 375 |
`\int` ``\int`` `\bigoplus` ``\bigoplus`` `\bigcup` ``\bigcup`` `\bigvee` ``\bigvee`` `\coprod` ``\coprod`` |
| 376 |
`\oint` ``\oint`` `\bigotimes` ``\bigotimes`` `\biguplus` ``\biguplus`` |
| 377 |
================= =========================== ========================= ========================= ===================== |
| 378 |
|
| 379 |
Larger symbols are used in displayed formulas: |
| 380 |
|
| 381 |
.. math:: |
| 382 |
|
| 383 |
\sum\ \int\ \oint \bigcap \prod \ldots |
| 384 |
|
| 385 |
Extensible delimiters |
| 386 |
--------------------- |
| 387 |
Unless you indicate otherwise, delimiters in math formulas remain at the |
| 388 |
standard size regardless of the height of the enclosed material. To get |
| 389 |
adaptable sizes, use ``\left`` and ``\right`` prefixes. |
| 390 |
|
| 391 |
.. math:: |
| 392 |
|
| 393 |
g(A,B,Y) = f \left(A,B,X=h^{[X]}(Y)\right) |
| 394 |
|
| 395 |
Use ``.`` for "empty" delimiters: |
| 396 |
|
| 397 |
.. math:: |
| 398 |
|
| 399 |
A = \left . \frac{1}{1-n}\, \right |_{n=0}^\infty |
| 400 |
|
| 401 |
|
| 402 |
Top and bottom embellishments |
| 403 |
----------------------------- |
| 404 |
|
| 405 |
Visually similar to accents_ but generally applied to multiple symbols. |
| 406 |
|
| 407 |
.. class:: colwidths-auto |
| 408 |
|
| 409 |
========================== ============================ =========================== ============================= |
| 410 |
`\widetilde{abi}` ``\widetilde{abi}`` `\widehat{abi}` ``\widehat{abi}`` |
| 411 |
`\overline{abi}` ``\overline{abi}`` `\underline{abi}` ``\underline{abi}`` |
| 412 |
`\overbrace{abi}` ``\overbrace{abi}`` `\underbrace{abi}` ``\underbrace{abi}`` |
| 413 |
`\overleftarrow{abi}` ``\overleftarrow{abi}`` `\underleftarrow{abi}` ``\underleftarrow{abi}`` |
| 414 |
`\overrightarrow{abi}` ``\overrightarrow{abi}`` `\underrightarrow{abi}` ``\underrightarrow{abi}`` |
| 415 |
`\overleftrightarrow{abi}` ``\overleftrightarrow{abi}`` `\underleftrightarrow{abi}` ``\underleftrightarrow{abi}`` |
| 416 |
========================== ============================ =========================== ============================= |
| 417 |
|
| 418 |
Extensible arrows |
| 419 |
----------------- |
| 420 |
|
| 421 |
TODO |
| 422 |
|
| 423 |
|
| 424 |
Text |
| 425 |
==== |
| 426 |
|
| 427 |
The main use of the command ``\text`` is for words or phrases in a |
| 428 |
display. It is similar to ``\mbox`` in its effects but, unlike ``\mbox``, |
| 429 |
automatically produces subscript-size text if used in a subscript, |
| 430 |
``k_{\text{B}}T`` becomes `k_{\text{B}}T`. |
| 431 |
|
| 432 |
Whitespace is kept inside the argument: |
| 433 |
|
| 434 |
.. Math:: f_{[x_{i-1},x_i]} \text{ is monotonic for } i = 1,\,…,\,c+1 |
| 435 |
|
| 436 |
|
| 437 |
Currently, math in text is not supported by LaTeX2MathML. |
| 438 |
|
| 439 |
Horizontal space |
| 440 |
================ |
| 441 |
|
| 442 |
.. class:: colwidths-auto |
| 443 |
|
| 444 |
================= ================== ============= |
| 445 |
:m:`|\qquad|` ``|\qquad|`` 2 em |
| 446 |
:m:`|\quad|` ``|\quad|`` 1 em |
| 447 |
:m:`|\;|` ``|\;|`` thick |
| 448 |
:m:`|\ |` ``|\ |`` standard |
| 449 |
:m:`|\:|` ``|\:|`` medium |
| 450 |
:m:`|\,|` ``|\,|`` thin |
| 451 |
:m:`| |` ``| |`` none |
| 452 |
:m:`|\!|` ``|\!|`` thin negative |
| 453 |
`|\hspace{1ex}|` ``|\hspace{1ex}|`` custom |
| 454 |
================= ================== ============= |
| 455 |
|
| 456 |
ToDo |
| 457 |
==== |
| 458 |
|
| 459 |
internal LaTeX2MathML |
| 460 |
|
| 461 |
* Math inside text: ``n - 1 \text{if $n$ is odd}``. |
| 462 |
* Remove circular refs. |
| 463 |
* Decimal numbers. |
| 464 |
|
| 465 |
* Shorthands for combined named operators |
| 466 |
|
| 467 |
========== ============ ============= =============== ================== |
| 468 |
`\liminf` ``\liminf`` `\varliminf` ``\varliminf`` `\underline{\lim}` |
| 469 |
`\limsup` ``\limsup`` `\varlimsup` ``\varlimsup`` `\overline{\lim}` |
| 470 |
`\injlim` ``\injlim`` `varinjlim` ``\varinjlim`` |
| 471 |
`\projlim` ``\projlim`` `varprojlim` ``\varprojlim`` |
| 472 |
========== ============ ============= =============== ================== |
| 473 |
|
| 474 |
* Implement ``\circledS``? (in short-math-guide.pdf but not in mathematical Unicode characters) |
| 475 |
|
| 476 |
|
| 477 |
Tests |
| 478 |
========== |
| 479 |
|
| 480 |
Font changes |
| 481 |
------------ |
| 482 |
|
| 483 |
Math alphabet macros change the default alphabet ("mathvariant" in |
| 484 |
MathML), leaving some symbols unchanged: |
| 485 |
|
| 486 |
:normal: `abs(x) \pm \alpha \approx 3 \Gamma \quad \forall x \in R` |
| 487 |
:mathrm: `\mathrm{abs(x) \pm \alpha \approx 3 \Gamma \quad \forall x \in R}` |
| 488 |
:mathit: `\mathit{abs(x) \pm \alpha \approx 3 \Gamma \quad \forall x \in R}` |
| 489 |
:mathsf: `\mathsf{abs(x) \pm \alpha \approx 3 \Gamma \quad \forall x \in R}` |
| 490 |
:mathbb: `\mathbb{abs(x) \pm \alpha \approx 3 \Gamma \quad \forall x \in R}` |
| 491 |
:mathbf: `\mathbf{abs(x) \pm \alpha \approx 3 \Gamma \quad \forall x \in R` |
| 492 |
|
| 493 |
Unicode supports the following blackboard-bold characters: |
| 494 |
`\mathbb{a \ldots z A \ldots Z 0 \ldots 9 |
| 495 |
\mathbb\Gamma \mathbb{\Pi} \mathbb {\Sigma}\mathbb\gamma \mathbb\pi}`. |
| 496 |
|
| 497 |
The package mathrsfs_ (and some drop-in replacements) define the ``\mathscr`` |
| 498 |
macro that selects a differently shaped "script" alphabet. |
| 499 |
Compare `\mathscr{A, B, …, Z, a, b, …, z}` |
| 500 |
with `\mathcal{A, B, …, Z, a, b, …, z}`. |
| 501 |
|
| 502 |
.. _rsfs: https://ctan.org/pkg/mathrsfs |
| 503 |
|
| 504 |
Inferred <mrow>s in MathML |
| 505 |
~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 506 |
|
| 507 |
The elements <msqrt>, <mstyle>, <merror>, <mpadded>, <mphantom>, <menclose>, |
| 508 |
<mtd, mscarry>, and <math> treat their contents as a single inferred mrow |
| 509 |
formed from all their children. |
| 510 |
|
| 511 |
.. math:: a = \sqrt 2, b = \sqrt{1+x^2}, c = \sqrt\frac{sin(x)}{23} |
| 512 |
|
| 513 |
inline: :math:`a = \sqrt 2, b = \sqrt{1+x^2}, c = \sqrt\frac{sin(x)}{23}`. |
| 514 |
|
| 515 |
Accents vs. embellishments |
| 516 |
-------------------------- |
| 517 |
|
| 518 |
MathML drops dots on "i" and "j" with accents: |
| 519 |
|
| 520 |
.. math:: \vec i \ne \overrightarrow i |
| 521 |
\text{ and } \vec\lim \ne \overrightarrow\lim. |
| 522 |
|
| 523 |
Accents should be nearer to the base (in Firefox 78, it's vice versa!): |
| 524 |
|
| 525 |
.. math:: \vec a \vec l \ne \overrightarrow a \overrightarrow l |
| 526 |
|
| 527 |
\bar a \bar l \ne \overline a \overline l |