# Defines single-line math-related tests
#
# Input format is:
#
# LaTeX (interpreted inside $...$)
# Resulting child content of MathML <math/> element
# ==== (divider)
#
# Lines starting with '#' are documentation and are stripped out when running tests
#
## Normal tests
1
<mn>1</mn>
====
-1
<mn>-1</mn>
====
- 1
<mn>-1</mn>
====
\alpha
<mi>&#x3b1;</mi>
=====
1.6
<mn>1.6</mn>
====
x
<mi>x</mi>
====
-x
<mo>-</mo><mi>x</mi>
====
1+x
<mn>1</mn><mo>+</mo><mi>x</mi>
====
1\pm x
<mn>1</mn><mo>&#xb1;</mo><mi>x</mi>
====
x = 3
<mi>x</mi><mo>=</mo><mn>3</mn>
====
x \not= 3
<mi>x</mi><mo>&#x2260;</mo><mn>3</mn>
====
2x
<mn>2</mn><mi>x</mi>
====
\sin x
<mi>sin</mi><mi>x</mi>
====
2\alpha
<mn>2</mn>
<mi>&#x3b1;</mi>
====
2x+4
<mn>2</mn>
<mi>x</mi>
<mo>+</mo>
<mn>4</mn>
====
2\alpha - \sin y + x
<mn>2</mn>
<mi>&#x3b1;</mi>
<mo>-</mo>
<mi>sin</mi>
<mi>y</mi>
<mo>+</mo>
<mi>x</mi>
====
\frac{1}{2}
<mfrac>
  <mn>1</mn>
  <mn>2</mn>
</mfrac>
====
\frac{x+y}{2}
<mfrac>
  <mrow>
    <mi>x</mi>
    <mo>+</mo>
    <mi>y</mi>
  </mrow>
  <mn>2</mn>
</mfrac>
====
1 \over 2
<mfrac>
  <mn>1</mn>
  <mn>2</mn>
</mfrac>
====
1 \over 2 + x
<mfrac>
  <mn>1</mn>
  <mrow>
    <mn>2</mn>
    <mo>+</mo>
    <mi>x</mi>
  </mrow>
</mfrac>
====
1 \over
<mfrac><mn>1</mn><mrow/></mfrac>
====
\over 2
<mfrac><mrow/><mn>2</mn></mfrac>
====
\sqrt{x}
<msqrt><mi>x</mi></msqrt>
====
\sqrt x
<msqrt><mi>x</mi></msqrt>
====
\sqrt x y
<msqrt><mi>x</mi></msqrt><mi>y</mi>
====
\sqrt[n]{x}
<mroot><mi>x</mi><mi>n</mi></mroot>
====
x^2
<msup>
  <mi>x</mi>
  <mn>2</mn>
</msup>
====
x^2 + 1
<msup>
  <mi>x</mi>
  <mn>2</mn>
</msup>
<mo>+</mo>
<mn>1</mn>
====
## These don't generate <msup>
x%ub2
<mi>x</mi><mo>&#xb2;</mo>
====
## The 3 fraction characters currently generate numbers, though I'm not
## convinced this is the best treatment...!
%ubc
<mn>&#xbc;</mn>
====
a_1
<msub>
  <mi>a</mi>
  <mn>1</mn>
</msub>
====
x__1
<mi>x</mi><mo>_</mo><mo>_</mo><mn>1</mn>
====
x___
<mi>x</mi><mo>_</mo><mo>_</mo><mo>_</mo>
====
a_{b_1}
<msub>
  <mi>a</mi>
  <msub>
    <mi>b</mi>
    <mn>1</mn>
  </msub>
</msub>
====
x_1^2
<msubsup>
  <mi>x</mi>
  <mn>1</mn>
  <mn>2</mn>
</msubsup>
====
x^2_1
<msubsup>
  <mi>x</mi>
  <mn>1</mn>
  <mn>2</mn>
</msubsup>
====
x^{2_1}
<msup>
  <mi>x</mi>
  <msub>
    <mn>2</mn>
    <mn>1</mn>
  </msub>
</msup>
====
a\in A
<mi>a</mi>
<mo>&#x2208;</mo>
<mi>A</mi>
====
a\not\in A
<mi>a</mi>
<mo>&#x2209;</mo>
<mi>A</mi>
====
a\not \in A
<mi>a</mi>
<mo>&#x2209;</mo>
<mi>A</mi>
====
\neg A
<mo>&#xac;</mo>
<mi>A</mi>
====
# Tests of fence inference. This has changed significantly in SnuggleTeX 1.1
# and now does a generally better job.
()
<mfenced open='(' close=')'/>
====
(1)
<mfenced open='(' close=')'><mn>1</mn></mfenced>
====
# Missing closer
(1
<mrow><mo>(</mo><mn>1</mn></mrow>
====
# Missing opener
1)
<mrow><mn>1</mn><mo>)</mo></mrow>
====
[1)
<mfenced open='[' close=')'><mn>1</mn></mfenced>
====
(1,2,3]
<mfenced open='(' close=']'>
  <mn>1</mn>
  <mn>2</mn>
  <mn>3</mn>
</mfenced>
====
(1,2,3)
<mfenced open='(' close=')'>
  <mn>1</mn>
  <mn>2</mn>
  <mn>3</mn>
</mfenced>
====
\{1+x,2+y,3+z\}
<mfenced open='{' close='}'>
  <mrow>
    <mn>1</mn>
    <mo>+</mo>
    <mi>x</mi>
  </mrow>
  <mrow>
    <mn>2</mn>
    <mo>+</mo>
    <mi>y</mi>
  </mrow>
  <mrow>
    <mn>3</mn>
    <mo>+</mo>
    <mi>z</mi>
  </mrow>
</mfenced>
====
((1,2),(3,4,5))
<mfenced open='(' close=')'>
  <mfenced open='(' close=')'>
    <mn>1</mn>
    <mn>2</mn>
  </mfenced>
  <mfenced open='(' close=')'>
    <mn>3</mn>
    <mn>4</mn>
    <mn>5</mn>
  </mfenced>
</mfenced>
====
([1,2],[3,4,5])
<mfenced open='(' close=')'>
  <mfenced open='[' close=']'>
    <mn>1</mn>
    <mn>2</mn>
  </mfenced>
  <mfenced open='[' close=']'>
    <mn>3</mn>
    <mn>4</mn>
    <mn>5</mn>
  </mfenced>
</mfenced>
====
(1,2,3]
<mfenced open='(' close=']'>
  <mn>1</mn>
  <mn>2</mn>
  <mn>3</mn>
</mfenced>
====
# Explicit fencing
\left( 1,2 \right(
<mfenced open='(' close='('>
  <mn>1</mn>
  <mn>2</mn>
</mfenced>
====
\left\{ x \right\}
<mfenced open='{' close='}'>
  <mi>x</mi>
</mfenced>
====
\left( x \right.
<mfenced open='(' close=''>
  <mi>x</mi>
</mfenced>
====
\left( (1,2) \right)
<mfenced open='(' close=')'>
  <mfenced open='(' close=')'>
    <mn>1</mn>
    <mn>2</mn>
  </mfenced>
</mfenced>
====
\left( x, \left( x,2 \right) \right)
<mfenced open='(' close=')'>
  <mi>x</mi>
  <mfenced open='(' close=')'>
    <mi>x</mi>
    <mn>2</mn>
  </mfenced>
</mfenced>
====
\left[ x, \left\{ x,2 \right) \right)
<mfenced open='[' close=')'>
  <mi>x</mi>
  <mfenced open='{' close=')'>
    <mi>x</mi>
    <mn>2</mn>
  </mfenced>
</mfenced>
====
\left\vert x \right\vert
<mfenced open='|' close='|'>
  <mi>x</mi>
</mfenced>
====
\vert
<mo>|</mo>
====
\left< x \right>
<mfenced open='&#x27e8;' close='&#x27e9;'>
  <mi>x</mi>
</mfenced>
====
|x|
<mo>|</mo><mi>x</mi><mo>|</mo>
====
a|b
<mi>a</mi><mo>|</mo><mi>b</mi>
====
a\not|b
<mi>a</mi><mo>&#x2224;</mo><mi>b</mi>
====
\left| x \right|
<mfenced open='|' close='|'>
  <mi>x</mi>
</mfenced>
====
## Test inference of fences including \vert which can't be inferred
(1 + \vert x-[a-b] \vert)
<mfenced open='(' close=')'>
  <mrow>
    <mn>1</mn>
    <mo>+</mo>
    <mo>|</mo>
    <mi>x</mi>
    <mo>-</mo>
    <mfenced open='[' close=']'>
      <mrow>
        <mi>a</mi>
        <mo>-</mo>
        <mi>b</mi>
      </mrow>
    </mfenced>
    <mo>|</mo>
  </mrow>
</mfenced>
====
\,
<mspace width="0.167em"/>
====
\:
<mspace width="0.222em"/>
====
\;
<mspace width="0.278em"/>
====
\!
<mspace width="-0.167em"/>
====
\mbox{A}
<mrow><mtext>A</mtext></mrow>
====
\mbox{A }
<mrow><mtext>A</mtext><mspace width="1ex"/></mrow>
====
\mbox{ A}
<mrow><mspace width="1ex"/><mtext>A</mtext></mrow>
====
\mbox{ A }
<mrow><mspace width="1ex"/><mtext>A</mtext><mspace width="1ex"/></mrow>
====
\mbox{  A B     }
<mrow><mspace width="1ex"/><mtext>A B</mtext><mspace width="1ex"/></mrow>
====
## Regression: handling of whitespace only content was broken until 1.2.0.
\mbox{ }
<mrow><mspace width="1ex"/></mrow>
====
\mbox{  }
<mrow><mspace width="1ex"/></mrow>
====
\textrm{A }
<mstyle mathvariant="normal"><mtext>A</mtext><mspace width="1ex"/></mstyle>
====
\textrm{ }
<mstyle mathvariant="normal"><mspace width="1ex"/></mstyle>
====
## Regression: empty \textrm generated empty <mstyle/> until 1.2.0.
## Was replaced with empty <mrow/> in 1.2.1,
## then nothing at all in 1.3.0
x\textrm{}
<mi>x</mi>
====
\mbox{\mbox{A}}
<mrow><mrow><mtext>A</mtext></mrow></mrow>
====
\mbox{if $x=1$}
<mrow><mtext>if</mtext><mspace width="1ex"/><mrow><mi>x</mi><mo>=</mo><mn>1</mn></mrow></mrow>
====
\mbox{if $x=1$ or $x=2$}
<mrow>
  <mtext>if</mtext>
  <mspace width="1ex"/>
  <mrow>
    <mi>x</mi>
    <mo>=</mo>
    <mn>1</mn>
  </mrow>
  <mspace width="1ex"/>
  <mtext>or</mtext>
  <mspace width="1ex"/>
  <mrow>
    <mi>x</mi>
    <mo>=</mo>
    <mn>2</mn>
  </mrow>
</mrow>
====
\mbox{if $x\mbox{is}3$}
<mrow>
  <mtext>if</mtext>
  <mspace width="1ex"/>
  <mrow>
    <mi>x</mi>
    <mrow>
      <mtext>is</mtext>
    </mrow>
    <mn>3</mn>
  </mrow>
</mrow>
====
\mbox{A\par B}
<mrow><mtext>A</mtext><mspace width="1ex"/><mtext>B</mtext></mrow>
====
## Special units handling
3\units{kg}
<mn>3</mn>
<mi mathvariant="normal" class="MathML-Unit">kg</mi>
====
########################
# Tests various "empty" cases
\frac{}{}
<mfrac><mrow/><mrow/></mfrac>
====
{}_{1}
<msub><mrow/><mn>1</mn></msub>
====
{}_{}
<msub><mrow/><mrow/></msub>
====
### This accent is safe for MathML
\hat{a}
<mi>&#xe2;</mi>
====
### This accent is assumed unsafe so is converted to an operator
\hat{x}
<mover accent="true"><mi>x</mi><mo>&#x302;</mo></mover>
====
### Composite accents are always done as operators
\hat{ab}
<mover accent="true"><mrow><mi>a</mi><mi>b</mi></mrow><mo>&#x302;</mo></mover>
====
\stackrel{a}{+}
<mover><mo>+</mo><mi>a</mi></mover>
====
\overset{a}{+}
<mover><mo>+</mo><mi>a</mi></mover>
====
\underset{a}{+}
<munder><mo>+</mo><mi>a</mi></munder>
====
x'
<msup><mi>x</mi><mi>'</mi></msup>
====
x'y'
<msup><mi>x</mi><mi>'</mi></msup><msup><mi>y</mi><mi>'</mi></msup>
====
v_{\mbox{\rm av}}
<msub><mi>v</mi><mrow><mstyle mathvariant="normal"><mtext>av</mtext></mstyle></mrow></msub>
====
1 \\ 2
<mn>1</mn><mtext>&#x0a;</mtext><mn>2</mn>
====
## This one tests precedence of bracket groupings over powers.
\left[x\right]^2
<msup>
  <mfenced open="[" close="]">
    <mi>x</mi>
  </mfenced>
  <mn>2</mn>
</msup>
====
## Precedence test
\left[1\over 2\right]
<mfenced open="[" close="]">
  <mfrac>
    <mn>1</mn>
    <mn>2</mn>
  </mfrac>
</mfenced>
====
## Test certain characters in Math mode
\%
<mi>%</mi>
====
\$
<mi>$</mi>
====
\#
<mi>#</mi>
====
\&
<mi>&amp;</mi>
====
\_
<mi>_</mi>
====
## \backslash is treated as an operator as of SnuggleTeX 1.3.0
\backslash
<mo>\</mo>
====
\begin{array}{lc} 1 & 2 \\ 3 & 4 \end{array}
<mtable>
  <mtr>
    <mtd columnalign="left"><mn>1</mn></mtd>
    <mtd columnalign="center"><mn>2</mn></mtd>
  </mtr>
  <mtr>
    <mtd columnalign="left"><mn>3</mn></mtd>
    <mtd columnalign="center"><mn>4</mn></mtd>
  </mtr>
</mtable>
====
\begin{matrix} 1 & 2 \\ 3 & 4 \end{matrix}
<mtable>
  <mtr>
    <mtd><mn>1</mn></mtd>
    <mtd><mn>2</mn></mtd>
  </mtr>
  <mtr>
    <mtd><mn>3</mn></mtd>
    <mtd><mn>4</mn></mtd>
  </mtr>
</mtable>
====
\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}
<mfenced open='(' close=')'>
  <mtable>
    <mtr>
      <mtd><mn>1</mn></mtd>
      <mtd><mn>2</mn></mtd>
    </mtr>
    <mtr>
      <mtd><mn>3</mn></mtd>
      <mtd><mn>4</mn></mtd>
    </mtr>
  </mtable>
</mfenced>
====
\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}
<mfenced open='[' close=']'>
  <mtable>
    <mtr>
      <mtd><mn>1</mn></mtd>
      <mtd><mn>2</mn></mtd>
    </mtr>
    <mtr>
      <mtd><mn>3</mn></mtd>
      <mtd><mn>4</mn></mtd>
    </mtr>
  </mtable>
</mfenced>
====
\begin{Bmatrix} 1 & 2 \\ 3 & 4 \end{Bmatrix}
<mfenced open='{' close='}'>
  <mtable>
    <mtr>
      <mtd><mn>1</mn></mtd>
      <mtd><mn>2</mn></mtd>
    </mtr>
    <mtr>
      <mtd><mn>3</mn></mtd>
      <mtd><mn>4</mn></mtd>
    </mtr>
  </mtable>
</mfenced>
====
\begin{vmatrix} 1 & 2 \\ 3 & 4 \end{vmatrix}
<mfenced open='|' close='|'>
  <mtable>
    <mtr>
      <mtd><mn>1</mn></mtd>
      <mtd><mn>2</mn></mtd>
    </mtr>
    <mtr>
      <mtd><mn>3</mn></mtd>
      <mtd><mn>4</mn></mtd>
    </mtr>
  </mtable>
</mfenced>
====
\begin{Vmatrix} 1 & 2 \\ 3 & 4 \end{Vmatrix}
<mfenced open='&#x2225;' close='&#x2225;'>
  <mtable>
    <mtr>
      <mtd><mn>1</mn></mtd>
      <mtd><mn>2</mn></mtd>
    </mtr>
    <mtr>
      <mtd><mn>3</mn></mtd>
      <mtd><mn>4</mn></mtd>
    </mtr>
  </mtable>
</mfenced>
====
\begin{cases} 1 & \mbox{if $x>0$,} \\ 2 & \mbox{otherwise.} \end{cases}
<mfenced open='{' close=''>
  <mtable>
    <mtr>
      <mtd>
        <mn>1</mn>
      </mtd>
      <mtd>
        <mrow>
          <mtext>if</mtext>
          <mspace width="1ex"/>
          <mrow>
            <mi>x</mi>
            <mo>&gt;</mo>
            <mn>0</mn>
          </mrow>
          <mtext>,</mtext>
        </mrow>
      </mtd>
    </mtr>
    <mtr>
      <mtd>
        <mn>2</mn>
      </mtd>
      <mtd>
        <mrow>
          <mtext>otherwise.</mtext>
        </mrow>
      </mtd>
    </mtr>
  </mtable>
</mfenced>
====
## Regression: can't do small-caps in Math mode so we just ignore this
\mbox{\sc Hello}
<mrow><mrow><mtext>Hello</mtext></mrow></mrow>
====
## We now support applying sub/super-scripts without an LHS, to be consistent with LaTeX
^2
<msup><mrow/><mn>2</mn></msup>
====
_2
<msub><mrow/><mn>2</mn></msub>
====
_2^3
<msubsup><mrow/><mn>2</mn><mn>3</mn></msubsup>
====
## HSpace tests
\hspace{1cm}
<mspace width="1.0cm"/>
====
\hspace{1pt}
<mspace width="1.0pt"/>
====
\hspace{65536sp}
<mspace width="1.0pt"/>
====
\hspace{36bp}
<mspace width="0.5in"/>
====
## Styling tests
\mathbf{A}
<mstyle mathvariant="bold"><mi>A</mi></mstyle>
====
\mathrm{A+B}
<mstyle mathvariant="normal"><mi>A</mi><mo>+</mo><mi>B</mi></mstyle>
====
## \rm behaves in the same way as \mathrm
{\rm A+B}
<mstyle mathvariant="normal"><mi>A</mi><mo>+</mo><mi>B</mi></mstyle>
====
## \textrm behaves differently in that its content is parsed in text mode
\textrm{A+B}
<mstyle mathvariant="normal"><mtext>A+B</mtext></mstyle>
====
## Greek variant commands
\varsigma\varphi\varkappa
<mi>&#x3c2;</mi><mi>&#x1d711;</mi><mi>&#x3f0;</mi>
====
## Ellipsis aliases
\dots\ldots
<mi>&#x2026;</mi><mi>&#x2026;</mi>
====
## Triangle symbol
\triangle
<mi>&#x25b3;</mi>
====
## Common relation aliases
\to\lt\gt\implies
<mo>&#x2192;</mo><mo>&lt;</mo><mo>&gt;</mo><mo>&#x21d2;</mo>
====
## Display style declaration
\displaystyle x
<mi>x</mi>
====
## Bold math aliases
\boldsymbol{x}\mathbit{y}
<mstyle mathvariant="bold"><mi>x</mi></mstyle><mstyle mathvariant="bold"><mi>y</mi></mstyle>
====
## Greek letter commands
\alpha\beta\gamma\Gamma\delta\Delta\epsilon\varepsilon\zeta\eta\theta\vartheta\Theta\iota\kappa\lambda\Lambda\mu\nu\xi\Xi\pi\Pi\rho\varrho\sigma\Sigma\tau\upsilon\Upsilon\phi\varphi\Phi\chi\psi\Psi\omega\Omega
<mi>&#x3b1;</mi><mi>&#x3b2;</mi><mi>&#x3b3;</mi><mi>&#x393;</mi><mi>&#x3b4;</mi><mi>&#x394;</mi><mi>&#x3f5;</mi><mi>&#x3b5;</mi><mi>&#x3b6;</mi><mi>&#x3b7;</mi><mi>&#x3b8;</mi><mi>&#x3d1;</mi><mi>&#x398;</mi><mi>&#x3b9;</mi><mi>&#x3ba;</mi><mi>&#x3bb;</mi><mi>&#x39b;</mi><mi>&#x3bc;</mi><mi>&#x3bd;</mi><mi>&#x3be;</mi><mi>&#x39e;</mi><mi>&#x3c0;</mi><mi>&#x3a0;</mi><mi>&#x3c1;</mi><mi>&#x3f1;</mi><mi>&#x3c3;</mi><mi>&#x3a3;</mi><mi>&#x3c4;</mi><mi>&#x3c5;</mi><mi>&#x3a5;</mi><mi>&#x3c6;</mi><mi>&#x1d711;</mi><mi>&#x3a6;</mi><mi>&#x3c7;</mi><mi>&#x3c8;</mi><mi>&#x3a8;</mi><mi>&#x3c9;</mi><mi>&#x3a9;</mi>
====
## Calligraphic and related stuff is (optionally) helped via character mappings
\mathcal{F}
<mi mathvariant="script">&#x2131;</mi>
====
\mathcal{a+b}
<mi mathvariant="script">a</mi><mo>+</mo><mi mathvariant="script">b</mi>
====
\mathcal{F F}
<mi mathvariant="script">&#x2131;</mi><mi mathvariant="script">&#x2131;</mi>
====
## \ensuremath does nothing when we're already in Math mode
\ensuremath{a+\ensuremath{b}}
<mi>a</mi><mo>+</mo><mi>b</mi>
====
## Regression: silly bug in DOMBuilding code for 'array' was messing up everything that followed
\begin{array}{c} 1 \end{array} + 3
<mtable><mtr><mtd columnalign="center"><mn>1</mn></mtd></mtr></mtable><mo>+</mo><mn>3</mn>
====
## Silly Regression: with the old handling of numbers, this was treated as 1 juxtaposed with -2 !
1-2
<mn>1</mn><mo>-</mo><mn>2</mn>
====
5!
<mn>5</mn><mo>!</mo>
====
x/2
<mi>x</mi><mo>/</mo><mn>2</mn>
====
3*5
<mn>3</mn><mo>*</mo><mn>5</mn>
====
## The '<' and '>' operators are polymorphic in that they may be relations or
## may be brackets!
1 < x < 2
<mn>1</mn>
<mo>&lt;</mo>
<mi>x</mi>
<mo>&lt;</mo>
<mn>2</mn>
====
\left< 1 \right>
<mfenced open="&#x27e8;" close="&#x27e9;">
  <mn>1</mn>
</mfenced>
====
1 \not< 2
<mn>1</mn>
<mo>&#x226e;</mo>
<mn>2</mn>
====
1 \not> 2
<mn>1</mn>
<mo>&#x226f;</mo>
<mn>2</mn>
====
1 \not\leq 2
<mn>1</mn>
<mo>&#x2270;</mo>
<mn>2</mn>
====
1 \not\geq 2
<mn>1</mn>
<mo>&#x2271;</mo>
<mn>2</mn>
====
## Unicode input support
%u03b1
<mi>&#x3b1;</mi>
====
%u222b
<mo>&#x222b;</mo>
====
%u222b_0^1 f
<msubsup><mo>&#x222b;</mo><mn>0</mn><mn>1</mn></msubsup><mi>f</mi>
====
## Input macros for certain characters
\mathdollar
<mi>$</mi>
====
## Command aliases
\le
<mo>&#x2264;</mo>
====
\lor
<mo>&#x2228;</mo>
====
## Brace handling in MATH mode (redone in SnuggleTeX 1.3)
\neg{A\vee B}
<mo>&#xac;</mo>
<mrow>
  <mi>A</mi>
  <mo>&#x2228;</mo>
  <mi>B</mi>
</mrow>
====
\sin{}
<mi>sin</mi>
<mrow/>
====
{{{{A}}}}
<mi>A</mi>
====
\sin{{{{A}}}}
<mi>sin</mi>
<mrow>
  <mi>A</mi>
</mrow>
====
