| 1 |
Math Conversion Tests |
| 2 |
===================== |
| 3 |
|
| 4 |
.. default-role:: math |
| 5 |
|
| 6 |
Math alphabet / Mathvariant |
| 7 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 8 |
|
| 9 |
TeX's *math alphabet* macros change font features of (some) letters and |
| 10 |
digits. Non-alphanumerical symbols, function names, and mathematical text |
| 11 |
are left unchanged. |
| 12 |
|
| 13 |
:default: `V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 14 |
\quad \forall x \in \mathbb{R}` |
| 15 |
:mathrm: `\mathrm{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 16 |
\quad \forall x \in \mathbb{R}}` |
| 17 |
:mathbf: `\mathbf{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 18 |
\quad \forall x \in \mathbb{R}}` |
| 19 |
:mathit: `\mathit{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 20 |
\quad \forall x \in \mathbb{R}}` |
| 21 |
:mathbfit: `\mathbfit{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 22 |
\quad \forall x \in \mathbb{R}}` |
| 23 |
:mathbb: `\mathbb{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 24 |
\quad \forall x \in \mathbb{R}}` |
| 25 |
:mathcal: `\mathcal{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 26 |
\quad \forall x \in \mathbb{R}}` |
| 27 |
:mathscr: `\mathscr{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 28 |
\quad \forall x \in \mathbb{R}}` |
| 29 |
:mathfrak: `\mathfrak{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 30 |
\quad \forall x \in \mathbb{R}}` |
| 31 |
:mathsf: `\mathsf{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 32 |
\quad \forall x \in \mathbb{R}}` |
| 33 |
:mathsfit: `\mathsfit{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 34 |
\quad \forall x \in \mathbb{R}}` |
| 35 |
:mathsfbfit: `\mathsfbfit{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 36 |
\quad \forall x \in \mathbb{R}}` |
| 37 |
:mathbfsfit: `\mathbfsfit{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 38 |
\quad \forall x \in \mathbb{R}}` |
| 39 |
:mathtt: `\mathtt{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma |
| 40 |
\quad \forall x \in \mathbb{R}}` |
| 41 |
|
| 42 |
MathML 4 defines the *mathvariant* `style attribute`_, in MathML core, |
| 43 |
characters from the `Mathematical Alphanumeric Symbols`_ Unicode block |
| 44 |
are used. |
| 45 |
|
| 46 |
The mathvariants *bold-script*, *bold-fraktur*, and *sans-bold* are |
| 47 |
rarely used. They are currently not supported by Docutils's native MathML |
| 48 |
output. In LaTeX, ``\mathbfscr`` and ``\mathbffrac`` is supported by the |
| 49 |
`mathalpha`_ package. |
| 50 |
|
| 51 |
Bold variants of any symbol can be achieved in combination with the |
| 52 |
``\boldsymbol`` command, e.g. |
| 53 |
|
| 54 |
:bold-fraktur: `\boldsymbol{\mathfrak{V_R x}}` |
| 55 |
|
| 56 |
Note, that ``\boldsymbol`` emboldens also non-alphanumerical symbols. |
| 57 |
|
| 58 |
|
| 59 |
Complex Example |
| 60 |
""""""""""""""" |
| 61 |
|
| 62 |
From the baskervaldx_ package documentation: |
| 63 |
|
| 64 |
Simplest form of the *Central Limit Theorem*: |
| 65 |
Let `X_1, X_2,\cdots` be a sequence of iid random variables with mean `0` |
| 66 |
and variance `1` on a probability space `(\Omega,\mathcal{F},\mathbb{P})`. |
| 67 |
Then |
| 68 |
|
| 69 |
.. math:: \mathbb{P}\left(\frac{X_1+\cdots+X_n}{\sqrt{n}} \le y\right) |
| 70 |
\to\mathfrak{N}(y) |
| 71 |
\coloneq \int_{-\infty}^y |
| 72 |
\frac{\mathrm{e}^{-t^2/2}}{\sqrt{2\mathrm{\pi}}}\, \mathrm{d}t |
| 73 |
\quad\mbox{as $n\to\infty$,} |
| 74 |
|
| 75 |
or, equivalently, letting `S_n\coloneq\sum_1^n X_k`, |
| 76 |
|
| 77 |
.. math:: \mathbb{E} f\left(S_n/\sqrt{n}\right) |
| 78 |
\to \int_{-\infty}^\infty f(t) |
| 79 |
\frac{\mathrm{e}^{-t^2/2}}{\sqrt{2\mathrm{\pi}}}\, \mathrm{d}t |
| 80 |
\quad\mbox{as $n\to\infty$, |
| 81 |
for every $f\in\mathrm{b} \mathcal{C}(\mathbb{R})$.} |
| 82 |
|
| 83 |
|
| 84 |
Inferred <mrow>s in MathML |
| 85 |
~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 86 |
|
| 87 |
The elements <msqrt>, <mstyle>, <merror>, <mpadded>, <mphantom>, <menclose>, |
| 88 |
<mtd>, <mscarry>, and <math> treat their contents as a single inferred mrow |
| 89 |
formed from all their children. |
| 90 |
|
| 91 |
.. math:: a = \sqrt 2 + x,\quad |
| 92 |
b = \sqrt{1+x^2},\quad |
| 93 |
c = \sqrt\frac{\sin(x)}{23}, |
| 94 |
|
| 95 |
inline: :math:`a = \sqrt 2 + x, b = \sqrt{1+x^2}, c = \sqrt\frac{\sin(x)}{23}`. |
| 96 |
|
| 97 |
|
| 98 |
Scripts and Limits |
| 99 |
~~~~~~~~~~~~~~~~~~ |
| 100 |
|
| 101 |
Accents should be nearer to the base: |
| 102 |
`\bar a \overline a, \bar l \overline l, \bar i \overline i`, |
| 103 |
`\vec{r}` `\overrightarrow{r}`. |
| 104 |
|
| 105 |
Sub- and superscript may be given in any order: |
| 106 |
`x_i^j = x^j_i` and `\int_0^1 = \int^1_0`. |
| 107 |
|
| 108 |
Double exponent: `x^{10^4}`, `r_{T_\mathrm{in}}` and `x_i^{n^2}`. |
| 109 |
|
| 110 |
|
| 111 |
Nested groups |
| 112 |
~~~~~~~~~~~~~ |
| 113 |
|
| 114 |
tex-token returns "{" for nested groups: |
| 115 |
|
| 116 |
.. math:: \text{das ist ein {toller} text (unescaped \{ and \} is |
| 117 |
ignored by LaTeX)} |
| 118 |
|
| 119 |
|
| 120 |
Big delimiters and symbols |
| 121 |
~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 122 |
Compare automatic sizing with fixed sizes: |
| 123 |
|
| 124 |
.. math: \left( \frac{\frac1x}{\frac{1}{n}}\right) &= \Biggl(\text{Bigg}\Biggr)\\ |
| 125 |
|
| 126 |
|
| 127 |
.. math:: |
| 128 |
\left( 3 \right) |
| 129 |
\left( f(x) \right) |
| 130 |
\left( \bar x \right) |
| 131 |
\left( \overline x \right) |
| 132 |
\left( n_i \right) &= () \\ |
| 133 |
\left( \underline x \right) &= \bigl(\text{big}\bigr)\\ |
| 134 |
\left( 3^2 \right) |
| 135 |
\left( \sqrt{3} \right) |
| 136 |
\left( \sqrt{3^2} \right) |
| 137 |
\left( \sum \right) |
| 138 |
\left( \bigotimes \right) |
| 139 |
\left( \prod \right) &= \Bigl(\text{Big}\Bigr)\\ |
| 140 |
\left( \frac{3 }{2} \right) |
| 141 |
\left( \frac{3^2}{2^4} \right) |
| 142 |
\binom{3 }{2} |
| 143 |
\begin{pmatrix} a & b \\ c & d \end{pmatrix} |
| 144 |
\left( \frac{1}{\sqrt 2} \right) |
| 145 |
\left( \int \right) |
| 146 |
\left( \int_0 \right) |
| 147 |
\left( \int^1 \right) |
| 148 |
\left( \int_0^1 \right) &= \biggl(\text{bigg}\biggr)\\ |
| 149 |
\left( \frac{\sqrt 2}{2} \right) |
| 150 |
\left( \sum_0 \right) |
| 151 |
\left( \sum^1 \right) |
| 152 |
\left( \sum_0^1 \right) |
| 153 |
\left( \frac{\frac1x}{\frac{1}{n}}\right) &= \Biggl(\text{Bigg}\Biggr)\\ |
| 154 |
\left( \intop_0 \right) |
| 155 |
\left( \intop^1 \right) |
| 156 |
\left( \intop_0^1 \right) |
| 157 |
|
| 158 |
And in text: |
| 159 |
|
| 160 |
:`()`: `\left(3 \right) |
| 161 |
\left( f(x) \right) |
| 162 |
\left( \bar x \right) |
| 163 |
\left( \overline x \right) |
| 164 |
\left( n_i \right) |
| 165 |
\left( \sum \right) |
| 166 |
\left( \sum_0 \right) |
| 167 |
\left( \prod \right)` |
| 168 |
|
| 169 |
|
| 170 |
:`\bigl(\text{big}\bigr)`: `\left(\underline x \right) |
| 171 |
\left( 3^2 \right) |
| 172 |
\binom{3}{2} |
| 173 |
\left(\begin{smallmatrix} a & b \\ |
| 174 |
c & d \end{smallmatrix} \right) |
| 175 |
\left( \bigotimes \right)` |
| 176 |
|
| 177 |
:`\Bigl(\text{Big}\Bigr)`: `\left(\sqrt{3} \right) |
| 178 |
\left( \sqrt{3^2} \right) |
| 179 |
\left( \frac{3}{2} \right) |
| 180 |
\left( \frac{3^2}{2^4} \right) |
| 181 |
\left( \frac{\sqrt 2}{2} \right) |
| 182 |
\left( \int \right) |
| 183 |
\left( \int_0 \right) |
| 184 |
\left( \int^1 \right) |
| 185 |
\left( \int_0^1 \right) |
| 186 |
\left( \sum^1 \right) |
| 187 |
\left( \sum_0^1 \right) |
| 188 |
\left( \frac{\frac1x}{\frac{1}{n}}\right)` |
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
Test ``\left``, ``\right``, and the \bigl/\bigr, … size commands |
| 195 |
with all extensible delimiters. |
| 196 |
|
| 197 |
pairing: |
| 198 |
|
| 199 |
.. math:: |
| 200 |
\left.( b \right) \ \bigl( b \Bigr) \ \biggl( b \Biggr) |
| 201 |
\quad |
| 202 |
\left.[ b \right] \ \bigl[ b \Bigr] \ \biggl[ b \Biggr] |
| 203 |
\quad |
| 204 |
\left.\{ b \right\} \ \bigl\{ b \Bigr\} \ \biggl\{ b \Biggr\} |
| 205 |
\quad |
| 206 |
\left.\langle b \right\rangle \ \bigl\langle b \Bigr\rangle \ \biggl\langle b \Biggr\rangle |
| 207 |
|
| 208 |
\left.\lceil b \right\rceil \ \bigl\lceil b \Bigr\rceil \ \biggl\lceil b \Biggr\rceil |
| 209 |
\quad |
| 210 |
\left.\lfloor b \right\rfloor \ \bigl\lfloor b \Bigr\rfloor \ \biggl\lfloor b \Biggr\rfloor |
| 211 |
\quad |
| 212 |
\left.\lvert b \right\rvert \ \bigl\lvert b \Bigr\rvert \ \biggl\lvert b \Biggr\rvert |
| 213 |
\quad |
| 214 |
\left.\lVert b \right\rVert \ \bigl\lVert b \Bigr\rVert \ \biggl\lVert b \Biggr\rVert |
| 215 |
|
| 216 |
\left.\lgroup b \right\rgroup \ \bigl\lgroup b \Bigr\rgroup \ \biggl\lgroup b \Biggr\rgroup |
| 217 |
\quad |
| 218 |
\left.\lmoustache b \right\rmoustache \ \bigl\lmoustache b \Bigr\rmoustache \ \biggl\lmoustache b \Biggr\rmoustache |
| 219 |
\quad |
| 220 |
\left./ b \right\backslash \ \bigl/ b \Bigr\backslash \ \biggl/ b \Biggr\backslash |
| 221 |
|
| 222 |
non-pairing: |
| 223 |
|
| 224 |
.. math:: |
| 225 |
\left.| b \right| \ \bigl| b \Bigr| \ \biggl| b \Biggr| |
| 226 |
\quad |
| 227 |
\left.\vert b \right\vert \ \bigl\vert b \Bigr\vert \ \biggl\vert b \Biggr\vert |
| 228 |
\quad |
| 229 |
\left.\| b \right\| \ \bigl\| b \Bigr\| \ \biggl\| b \Biggr\| |
| 230 |
\quad |
| 231 |
\left.\Vert b \right\Vert \ \bigl\Vert b \Bigr\Vert \ \biggl\Vert b \Biggr\Vert |
| 232 |
|
| 233 |
\left.\arrowvert b \right\arrowvert \ \bigl\arrowvert b \Bigr\arrowvert \ \biggl\arrowvert b \Biggr\arrowvert |
| 234 |
\quad |
| 235 |
\left.\Arrowvert b \right\Arrowvert \ \bigl\Arrowvert b \Bigr\Arrowvert \ \biggl\Arrowvert b \Biggr\Arrowvert |
| 236 |
\quad |
| 237 |
\left.\bracevert b \right\bracevert \ \bigl\bracevert b \Bigr\bracevert \ \biggl\bracevert b \Biggr\bracevert |
| 238 |
|
| 239 |
Variable-sized operators: |
| 240 |
|
| 241 |
Inline: `\int\ \iint\ \iiint\ \iiiint\ \idotsint \oint\ \smallint\ |
| 242 |
\sum\ \prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\ \biguplus\ |
| 243 |
\bigsqcup\ \bigodot\ \bigoplus\ \bigotimes` and Display: |
| 244 |
|
| 245 |
.. math:: \int\ \iint\ \iiint\ \iiiint\ \idotsint\ \oint\ \smallint\ |
| 246 |
\sum\ \prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\ |
| 247 |
\biguplus\ \bigsqcup\ \bigodot\ \bigoplus\ \bigotimes |
| 248 |
|
| 249 |
.. math:: \int_1 f\ \intop_1 f\ \iint_1 f\ \smallint_1 f\ \sum_1\ |
| 250 |
\prod_1\ \bigwedge_1\ \bigcap_1\ \biguplus_1\ \bigodot_1\ \int^N\ |
| 251 |
\intop^N\ \iiiint^N\ \oint^N\ \smallint^N\ \sum^N\ \coprod^N\ |
| 252 |
\bigvee^N\ \bigcup^N\ \bigsqcup^N\ \bigotimes^N |
| 253 |
|
| 254 |
.. math:: \int_1^N\ \intop_1^N\ \iint_1^N\ \iiint_1^N\ \iiiint_1^N\ |
| 255 |
\idotsint_1^N\ \oint_1^N\ \smallint_1^N\ \sum_1^N\ \prod_1^N\ |
| 256 |
\coprod_1^N\ \bigwedge_1^N\ \bigvee_1^N\ \bigcap_1^N\ \bigcup_1^N |
| 257 |
\ \biguplus_1^N\ \bigsqcup_1^N\ \bigodot_1^N\ \bigoplus_1^N\ |
| 258 |
\bigotimes_1^N |
| 259 |
|
| 260 |
|
| 261 |
Text |
| 262 |
~~~~ |
| 263 |
|
| 264 |
The text may contain non-ASCII characters: `n_\text{Stoß}`. |
| 265 |
|
| 266 |
Some text-mode LaTeX commands are supported with math_output_ "html". |
| 267 |
In other output formats, use literal Unicode: `\text{ç é è ë ê ñ ů ž ©}` |
| 268 |
to get the result of the accent macros |
| 269 |
`\text{\c{c} \'e \`e \"e \^e \~n \r{u} \v{z} \textcircled{c}}`. |
| 270 |
|
| 271 |
|
| 272 |
.. _math_output: |
| 273 |
https://docutils.sourceforge.io/docs/user/config.html#math-output |
| 274 |
.. _style attribute: https://www.w3.org/TR/mathml4/#presm_commatt |
| 275 |
.. _Mathematical Alphanumeric Symbols: |
| 276 |
http://www.unicode.org/charts/PDF/U1EE00.pdf |
| 277 |
.. _mathalpha: https://www.ctan.org/pkg/mathalpha |
| 278 |
.. _baskervaldx: https://www.ctan.org/pkg/baskervaldx |