# Math Conversion Tests

## Math alphabet / Mathvariant

TeX's math alphabet macros change font features of (some) letters and digits. Non-alphanumerical symbols, function names, and mathematical text are left unchanged.

default:

  V R x±cos(α out)≈3 Γ∀x∈ℝ V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}

mathrm:

  V R x±cos(α out)≈3 Γ∀x∈ℝ\mathrm{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

mathbf:

  𝐕 𝐑 𝐱±cos(𝛂 out)≈3 𝚪∀𝐱∈ℝ\mathbf{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

mathit:

  𝑉 𝑅 𝑥±cos(𝛼 out)≈3 𝛤∀𝑥∈ℝ\mathit{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

mathbfit:

  𝑽 𝑹 𝒙±cos(𝜶 out)≈3 𝜞∀𝒙∈ℝ\mathbfit{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

mathbb:

  𝕍 ℝ 𝕩±cos(α out)≈3 ℾ∀𝕩∈ℝ\mathbb{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

mathcal:

  𝒱 ℛ 𝓍±cos(α out)≈3 Γ∀𝓍∈ℝ\mathcal{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

mathscr:

  𝒱 ℛ 𝓍±cos(α out)≈3 Γ∀𝓍∈ℝ\mathscr{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

mathfrak:

  𝔙 ℜ 𝔵±cos(α out)≈3 Γ∀𝔵∈ℝ\mathfrak{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

mathsf:

  𝖵 𝖱 𝗑±cos(α out)≈3 Γ∀𝗑∈ℝ\mathsf{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

mathsfit:

  𝘝 𝘙 𝘹±cos(α out)≈3 Γ∀𝘹∈ℝ\mathsfit{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

mathsfbfit:

  \mathsfbfit{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

  System Message: WARNING/2 (../../functional/input/data/math_experiments.rst, line 35)

  TeX to MathML converter `pandoc` failed:

  [WARNING] Could not convert TeX math '\mathsfbfit{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma

        \quad \forall x \in \mathbb{R}}', rendering as TeX:
        \mathsfbfit{V_R x \pm \cos(\alpha_\text{

  ^ unexpected "{" expecting "%", "\\label", "\\nonumber" or whitespace

mathbfsfit:

  𝙑 𝙍 𝙭±cos(𝞪 out)≈3 𝞒∀𝙭∈ℝ\mathbfsfit{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

mathtt:

  𝚅 𝚁 𝚡±cos(α out)≈3 Γ∀𝚡∈ℝ\mathtt{V_R x \pm \cos(\alpha_\text{out}) \approx 3 \Gamma \quad \forall x \in \mathbb{R}}

MathML 4 defines the mathvariant style attribute, in MathML core, characters from the Mathematical Alphanumeric Symbols Unicode block are used.

The mathvariants bold-script, bold-fraktur, and sans-bold are rarely used. They are currently not supported by Docutils's native MathML output. In LaTeX, \mathbfscr and \mathbffrac is supported by the mathalpha package.

Bold variants of any symbol can be achieved in combination with the \boldsymbol command, e.g.

bold-fraktur:

  𝔙 ℜ 𝔵\boldsymbol{\mathfrak{V_R x}}

Note, that \boldsymbol emboldens also non-alphanumerical symbols.

### Complex Example

From the baskervaldx package documentation:

Simplest form of the Central Limit Theorem:

  Let X 1, X 2,⋯X_1, X_2,\cdots be a sequence of iid random variables with mean 0 0 and variance 1 1 on a probability space (Ω, ℱ, ℙ)(\Omega,\mathcal{F},\mathbb{P}). Then

  ℙ(X 1+⋯+X n n≤y)→𝔑(y)≔∫−∞y e−t 2/2 2 π d t as n→∞,\mathbb{P}\left(\frac{X_1+\cdots+X_n}{\sqrt{n}} \le y\right) \to\mathfrak{N}(y) \coloneq \int_{-\infty}^y \frac{\mathrm{e}^{-t^2/2}}{\sqrt{2\mathrm{\pi}}}\, \mathrm{d}t \quad\mbox{as $n\to\infty$,}

  or, equivalently, letting S n≔∑1 n X k S_n\coloneq\sum_1^n X_k,

  𝔼 f(S n/n)→∫−∞∞f(t)e−t 2/2 2 π d t as n→∞, for every f∈b 𝒞(ℝ).\mathbb{E} f\left(S_n/\sqrt{n}\right) \to \int_{-\infty}^\infty f(t) \frac{\mathrm{e}^{-t^2/2}}{\sqrt{2\mathrm{\pi}}}\, \mathrm{d}t \quad\mbox{as $n\to\infty$, for every $f\in\mathrm{b} \mathcal{C}(\mathbb{R})$.}

## Inferred <mrow>s in MathML

The elements <msqrt>, <mstyle>, <merror>, <mpadded>, <mphantom>, <menclose>, <mtd>, <mscarry>, and <math> treat their contents as a single inferred mrow formed from all their children.

    a = \sqrt 2 + x,\quad
    b = \sqrt{1+x^2},\quad
    c = \sqrt\frac{\sin(x)}{23},

System Message: WARNING/2 (../../functional/input/data/math_experiments.rst, line 91)

TeX to MathML converter `pandoc` failed:

[WARNING] Could not convert TeX math 'a = \sqrt 2 + x,\quad

      b = \sqrt{1+x^2},\quad
      c = \sqrt\frac{\sin(x)}{23},', rendering as TeX:

c = \sqrt\frac{\sin(x)}{23}, ^ unexpected "{" expecting "%", "\\label", "\\nonumber" or whitespace

inline: a = \sqrt 2 + x, b = \sqrt{1+x^2}, c = \sqrt\frac{\sin(x)}{23}.

System Message: WARNING/2 (../../functional/input/data/math_experiments.rst, line 95)

TeX to MathML converter `pandoc` failed:

[WARNING] Could not convert TeX math 'a = \sqrt 2 + x, b = \sqrt{1+x^2}, c = \sqrt\frac{\sin(x)}{23}', rendering as TeX:

      ^2}, c = \sqrt\frac{\sin(x)}{23}
                         ^

unexpected "{" expecting "%", "\\label", "\\nonumber" or whitespace

## Scripts and Limits

Accents should be nearer to the base: a‾a¯,l‾l¯,i‾i¯\bar a \overline a, \bar l \overline l, \bar i \overline i, r⃗\vec{r} r⃗\overrightarrow{r}.

Sub- and superscript may be given in any order: x i j=x i j x_i^j = x^j_i and ∫0 1=∫0 1\int_0^1 = \int^1_0.

Double exponent: x 10 4 x^{10^4}, r T i n r_{T_\mathrm{in}} and x i n 2 x_i^{n^2}.

## Nested groups

tex-token returns "{" for nested groups:

das ist ein toller text (unescaped {and }is ignored by LaTeX)\text{das ist ein {toller} text (unescaped \{ and \} is ignored by LaTeX)}

## Big delimiters and symbols

Compare automatic sizing with fixed sizes:

    \left( 3                          \right)
    \left( f(x)                       \right)
    \left( \bar x                     \right)
    \left( \overline x                \right)
    \left( n_i                        \right) &= () \\
    \left( \underline x               \right) &= \bigl(\text{big}\bigr)\\
    \left( 3^2                        \right)
    \left( \sqrt{3}                   \right)
    \left( \sqrt{3^2}                 \right)
    \left( \sum                       \right)
    \left( \bigotimes                 \right)
    \left( \prod                      \right) &= \Bigl(\text{Big}\Bigr)\\
    \left( \frac{3  }{2}              \right)
    \left( \frac{3^2}{2^4}            \right)
    \binom{3  }{2}
    \begin{pmatrix} a & b \\ c & d \end{pmatrix}
    \left( \frac{1}{\sqrt 2}          \right)
    \left( \int                       \right)
    \left( \int_0                     \right)
    \left( \int^1                     \right)
    \left( \int_0^1                   \right) &= \biggl(\text{bigg}\biggr)\\
    \left( \frac{\sqrt 2}{2}          \right)
    \left( \sum_0                     \right)
    \left( \sum^1                     \right)
    \left( \sum_0^1                   \right)
    \left( \frac{\frac1x}{\frac{1}{n}}\right) &= \Biggl(\text{Bigg}\Biggr)\\
    \left( \intop_0                   \right)
    \left( \intop^1                   \right)
    \left( \intop_0^1                 \right)

System Message: WARNING/2 (../../functional/input/data/math_experiments.rst, line 127)

TeX to MathML converter `pandoc` failed:

[WARNING] Could not convert TeX math '\begin{aligned}

      \left( 3                          \right)
      \left( f(x)                       \right)

\left( \bar x \right) \left( \overline x \right) \left( n_i \right) &= () \\ \left( \underline x \right) &= \bigl(\text{big}\bigr)\\ \left( 3^2 \right) \left( \sqrt{3} \right) \left( \sqrt{3^2} \right) \left( \sum \right) \left( \bigotimes \right) \left( \prod \right) &= \Bigl(\text{Big}\Bigr)\\ \left( \frac{3 }{2} \right) \left( \frac{3^2}{2^4} \right) \binom{3 }{2} \begin{pmatrix} a & b \\ c & d \end{pmatrix} \left( \frac{1}{\sqrt 2} \right) \left( \int \right) \left( \int_0 \right) \left( \int^1 \right) \left( \int_0^1 \right) &= \biggl(\text{bigg}\biggr)\\ \left( \frac{\sqrt 2}{2} \right) \left( \sum_0 \right) \left( \sum^1 \right) \left( \sum_0^1 \right) \left( \frac{\frac1x}{\frac{1}{n}}\right) &= \Biggl(\text{Bigg}\Biggr)\\ \left( \intop_0 \right) \left( \intop^1 \right) \left( \intop_0^1 \right)\end{aligned}', rendering as TeX: \right) &= \Bigl(\text{Big}\Bigr ^ unexpected "\\" expecting "&", "\\\\", white space or "\\end"

And in text:

()():

  (3)(f(x))(x‾)(x¯)(n i)(∑)(∑0)(∏)\left(3 \right) \left( f(x) \right) \left( \bar x \right) \left( \overline x \right) \left( n_i \right) \left( \sum \right) \left( \sum_0 \right) \left( \prod \right)

(big)\bigl(\text{big}\bigr):

  (x _)(3 2)(3 2)(a b c d)(⨂)\left(\underline x \right) \left( 3^2 \right) \binom{3}{2} \left(\begin{smallmatrix} a & b \\ c & d \end{smallmatrix} \right) \left( \bigotimes \right)

\Bigl(\text{Big}\Bigr):

  (3)(3 2)(3 2)(3 2 2 4)(2 2)(∫)(∫0)(∫1)(∫0 1)(∑1)(∑0 1)(1 x 1 n)\left(\sqrt{3} \right) \left( \sqrt{3^2} \right) \left( \frac{3}{2} \right) \left( \frac{3^2}{2^4} \right) \left( \frac{\sqrt 2}{2} \right) \left( \int \right) \left( \int_0 \right) \left( \int^1 \right) \left( \int_0^1 \right) \left( \sum^1 \right) \left( \sum_0^1 \right) \left( \frac{\frac1x}{\frac{1}{n}}\right)

  System Message: WARNING/2 (../../functional/input/data/math_experiments.rst, line 177)

  TeX to MathML converter `pandoc` failed:

  [WARNING] Could not convert TeX math '\Bigl(\text{Big}\Bigr)', rendering as TeX:

        \Bigl(\text{Big}\Bigr)
             ^

  unexpected "(" expecting "%", "\\label", "\\nonumber" or whitespace

Test \left, \right, and the bigl/bigr, … size commands with all extensible delimiters.

pairing:

(b)(b)(b)[b][b][b]{b}{b}{b}⟨b⟩⟨b⟩⟨b⟩\left.( b \right) \ \bigl( b \Bigr) \ \biggl( b \Biggr) \quad \left.[ b \right] \ \bigl[ b \Bigr] \ \biggl[ b \Biggr] \quad \left.\{ b \right\} \ \bigl\{ b \Bigr\} \ \biggl\{ b \Biggr\} \quad \left.\langle b \right\rangle \ \bigl\langle b \Bigr\rangle \ \biggl\langle b \Biggr\rangle
⌈b⌉⌈b⌉⌈b⌉⌊b⌋⌊b⌋⌊b⌋|b||b||b|∥b∥∥b∥∥b∥\left.\lceil b \right\rceil \ \bigl\lceil b \Bigr\rceil \ \biggl\lceil b \Biggr\rceil \quad \left.\lfloor b \right\rfloor \ \bigl\lfloor b \Bigr\rfloor \ \biggl\lfloor b \Biggr\rfloor \quad \left.\lvert b \right\rvert \ \bigl\lvert b \Bigr\rvert \ \biggl\lvert b \Biggr\rvert \quad \left.\lVert b \right\rVert \ \bigl\lVert b \Bigr\rVert \ \biggl\lVert b \Biggr\rVert

    \left.\lgroup b \right\rgroup \ \bigl\lgroup b \Bigr\rgroup \ \biggl\lgroup b \Biggr\rgroup
    \quad
    \left.\lmoustache b \right\rmoustache \ \bigl\lmoustache b \Bigr\rmoustache \ \biggl\lmoustache b \Biggr\rmoustache
    \quad
    \left./           b \right\backslash  \ \bigl/           b \Bigr\backslash  \ \biggl/           b \Biggr\backslash

System Message: WARNING/2 (../../functional/input/data/math_experiments.rst, line 199)

TeX to MathML converter `pandoc` failed:

[WARNING] Could not convert TeX math '\left.\lgroup b \right\rgroup \ \bigl\lgroup b \Bigr\rgroup \ \biggl\lgroup b \Biggr\rgroup

      \quad
      \left.\lmoustache b \right\rmoustache \ \bigl\lmoustache b \Bigr\rmoustache \ \biggl\lmoustache b \Biggr\rmoustache

\quad \left./ b \right\backslash \ \bigl/ b \Bigr\backslash \ \biggl/ b \Biggr\backslash', rendering as TeX: up b \right\rgroup \ \bigl\lgroup b \Big ^ unexpected "\\" expecting "%", "\\label", "\\nonumber" or whitespace

non-pairing:

|b||b||b||b||b||b|∥b∥∥b∥∥b∥‖b‖‖b‖‖b‖\left.| b \right| \ \bigl| b \Bigr| \ \biggl| b \Biggr| \quad \left.\vert b \right\vert \ \bigl\vert b \Bigr\vert \ \biggl\vert b \Biggr\vert \quad \left.\| b \right\| \ \bigl\| b \Bigr\| \ \biggl\| b \Biggr\| \quad \left.\Vert b \right\Vert \ \bigl\Vert b \Bigr\Vert \ \biggl\Vert b \Biggr\Vert

    \left.\arrowvert b \right\arrowvert \ \bigl\arrowvert b \Bigr\arrowvert \ \biggl\arrowvert b \Biggr\arrowvert
    \quad
    \left.\Arrowvert b \right\Arrowvert \ \bigl\Arrowvert b \Bigr\Arrowvert \ \biggl\Arrowvert b \Biggr\Arrowvert
    \quad
    \left.\bracevert b \right\bracevert \ \bigl\bracevert b \Bigr\bracevert \ \biggl\bracevert b \Biggr\bracevert

System Message: WARNING/2 (../../functional/input/data/math_experiments.rst, line 224)

TeX to MathML converter `pandoc` failed:

[WARNING] Could not convert TeX math '\left.\arrowvert b \right\arrowvert \ \bigl\arrowvert b \Bigr\arrowvert \ \biggl\arrowvert b \Biggr\arrowvert

      \quad
      \left.\Arrowvert b \right\Arrowvert \ \bigl\Arrowvert b \Bigr\Arrowvert \ \biggl\Arrowvert b \Biggr\Arrowvert

\quad \left.\bracevert b \right\bracevert \ \bigl\bracevert b \Bigr\bracevert \ \biggl\bracevert b \Biggr\bracevert', rendering as TeX: \left.\arrowvert b \right\arrowvert \ \b ^ unexpected "b" expecting "%", "\\label", "\\nonumber" or whitespace

Variable-sized operators:

Inline: \int\ \iint\ \iiint\ \iiiint\ \idotsint \oint\ \smallint\ \sum\ \prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\ \biguplus\ \bigsqcup\ \bigodot\ \bigoplus\ \bigotimes and Display:

System Message: WARNING/2 (../../functional/input/data/math_experiments.rst, line 241)

TeX to MathML converter `pandoc` failed:

[WARNING] Could not convert TeX math '\int\ \iint\ \iiint\ \iiiint\ \idotsint \oint\ \smallint\

      \sum\ \prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\ \biguplus\
      \bigsqcup\ \bigodot\ \bigoplus\ \bigotimes', rendering as TeX:

\iiiint\ \idotsint \oint\ \smallint\ ^ unexpected "\\" expecting "%", "\\label", "\\nonumber" or whitespace

    \int\ \iint\ \iiint\ \iiiint\ \idotsint\ \oint\ \smallint\
    \sum\ \prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\
    \biguplus\ \bigsqcup\ \bigodot\ \bigoplus\ \bigotimes

System Message: WARNING/2 (../../functional/input/data/math_experiments.rst, line 245)

TeX to MathML converter `pandoc` failed:

[WARNING] Could not convert TeX math '\int\ \iint\ \iiint\ \iiiint\ \idotsint\ \oint\ \smallint\

      \sum\ \prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\
      \biguplus\ \bigsqcup\ \bigodot\ \bigoplus\ \bigotimes', rendering as TeX:

\iiiint\ \idotsint\ \oint\ \smallint\ ^ unexpected "\\" expecting "%", "\\label", "\\nonumber" or whitespace

    \int_1 f\ \intop_1 f\ \iint_1 f\ \smallint_1 f\ \sum_1\
    \prod_1\ \bigwedge_1\ \bigcap_1\ \biguplus_1\ \bigodot_1\ \int^N\
    \intop^N\ \iiiint^N\ \oint^N\ \smallint^N\ \sum^N\ \coprod^N\
    \bigvee^N\ \bigcup^N\ \bigsqcup^N\ \bigotimes^N

System Message: WARNING/2 (../../functional/input/data/math_experiments.rst, line 249)

TeX to MathML converter `pandoc` failed:

[WARNING] Could not convert TeX math '\int_1 f\ \intop_1 f\ \iint_1 f\ \smallint_1 f\ \sum_1\

      \prod_1\ \bigwedge_1\ \bigcap_1\ \biguplus_1\ \bigodot_1\ \int^N\
      \intop^N\ \iiiint^N\ \oint^N\ \smallint^N\ \sum^N\ \coprod^N\

\bigvee^N\ \bigcup^N\ \bigsqcup^N\ \bigotimes^N', rendering as TeX: \int_1 f\ \intop_1 f\ \iint_1 f\ \smalli ^ unexpected "_" expecting "%", "\\label", "\\nonumber" or whitespace

    \int_1^N\ \intop_1^N\ \iint_1^N\ \iiint_1^N\ \iiiint_1^N\
    \idotsint_1^N\ \oint_1^N\ \smallint_1^N\ \sum_1^N\ \prod_1^N\
    \coprod_1^N\ \bigwedge_1^N\ \bigvee_1^N\ \bigcap_1^N\ \bigcup_1^N
    \ \biguplus_1^N\ \bigsqcup_1^N\ \bigodot_1^N\ \bigoplus_1^N\
    \bigotimes_1^N

System Message: WARNING/2 (../../functional/input/data/math_experiments.rst, line 254)

TeX to MathML converter `pandoc` failed:

[WARNING] Could not convert TeX math '\int_1^N\ \intop_1^N\ \iint_1^N\ \iiint_1^N\ \iiiint_1^N\

      \idotsint_1^N\ \oint_1^N\ \smallint_1^N\ \sum_1^N\ \prod_1^N\
      \coprod_1^N\ \bigwedge_1^N\ \bigvee_1^N\ \bigcap_1^N\ \bigcup_1^N

\ \biguplus_1^N\ \bigsqcup_1^N\ \bigodot_1^N\ \bigoplus_1^N\ \bigotimes_1^N', rendering as TeX: \int_1^N\ \intop_1^N\ \iint_1^N\ \iiint_ ^ unexpected "_" expecting "%", "\\label", "\\nonumber" or whitespace

## Text

The text may contain non-ASCII characters: n Stoß n_\text{Stoß}.

Some text-mode LaTeX commands are supported with math_output "html". In other output formats, use literal Unicode: ç é è ë ê ñ ů ž ©\text{ç é è ë ê ñ ů ž ©} to get the result of the accent macros \text{\c{c} \'e \`e \"e \^e \~n \r{u} \v{z} \textcircled{c}}.

System Message: WARNING/2 (../../functional/input/data/math_experiments.rst, line 266)

TeX to MathML converter `pandoc` failed:

[WARNING] Could not convert TeX math '\text{\c{c} \'e \`e \"e \^e \~n \r{u} \v{z} \textcircled{c}}', rendering as TeX:

      'e \`e \"e \^e \~n \r{u} \v{z} \textcirc
                         ^

unexpected "\\" expecting text, "}", "{", "$", "$$", "\\(" or "\\["