Examples

Supported MathML Elements

Superscripts and Subscripts <msup>, <msub>, <msubsup>


_images/examples_1_0.svg

MathML
<math>
    <msup>
      <mi>x</mi>
      <mn>2</mn>
    </msup>
</math>

Square Root <msqrt>


_images/examples_2_0.svg

MathML
<math>
    <msqrt>
        <mi>x</mi>
    </msqrt>
</math>

N-root <mroot>


_images/examples_3_0.svg

MathML
<math>
<mroot>
    <mi>x</mi>
    <mn>n</mn>
</mroot>
</math>

Fractions <mfrac>


_images/examples_4_0.svg

MathML
<math>
<mfrac>
    <mrow>
        <mi>x</mi>
        <mo>+</mo>
        <mn>1</mn>
    </mrow>
    <mrow>
        <mi>y</mi>
    </mrow>
</mfrac>
</math>

Over/Under <mover>, <munder>


_images/examples_5_0.svg

MathML
<math>
<mover accent="true">
  <mrow>
    <mi> x </mi>
    <mo> + </mo>
    <mi> y </mi>
    <mo> + </mo>
    <mi> z </mi>
  </mrow>
  <mo> &#x23DE; <!--TOP CURLY BRACKET--> </mo>
</mover>
</math>

Fenced <mfenced>


_images/examples_6_0.svg

MathML
<math>
<mfenced>
    <mn>a</mn>
    <mn>b</mn>
    <mn>c</mn>
</mfenced>
</math>

Tables <mtable>


_images/examples_7_0.svg

MathML
<math>
<mfenced>
    <mtable>
       <mtr>
          <mtd> <mn>x</mn> </mtd>
       </mtr>
       <mtr>
          <mtd> <mn>y</mn> </mtd>
       </mtr>
       <mtr>
          <mtd> <mn>z</mn> </mtd>
       </mtr>
    </mtable>
</mfenced>
</math>

Enclosures <menclose>

notation=”box”


_images/examples_8_0.svg

MathML
<math>
    <menclose notation="box">
        <msup><mi>a</mi><mn>2</mn></msup>
        <mo>+</mo>
        <msup><mi>b</mi><mn>2</mn></msup>
    </menclose>
</math>

notation=”updiagonalstrike downdiagonalstrike”


_images/examples_9_0.svg

MathML
<math>
<mfrac>
    <mrow><mn>1</mn></mrow>
    <mrow>
        <msup><mi>a</mi><mn>2</mn></msup>
        <mo>+</mo>
        <menclose notation="updiagonalstrike downdiagonalstrike">
            <msup><mi>b</mi><mn>2</mn></msup>
        </menclose>
    </mrow>
</mfrac>
</math>

Color and Highlight attributes

mathcolor


_images/examples_10_0.svg

MathML
<math>
  <msup>
    <mi>e</mi>
    <mrow mathcolor='#cc0000'>
      <mn>2</mn>
      <mi>x</mi>
      <mo>+</mo>
      <mn>1</mn>
    </mrow>
  </msup>
</math>

mathbackground


_images/examples_11_0.svg

MathML
<math>
<mfrac>
    <mrow mathbackground="yellow">
        <mi>a</mi>
        <mo>+</mo>
        <mi>b</mi>
    </mrow>
    <mi>c</mi>
</mfrac>
</math>

Latex

zm.Math.fromlatex(r'x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}')
_images/examples_12_0.svg

zm.Math.fromlatex(r'i \hbar \frac{\partial}{\partial t}\Psi(\mathbf{r},t) = \hat H \Psi(\mathbf{r},t)')
_images/examples_13_0.svg

zm.Math.fromlatex(r'\Delta v = v_e \, \ln \frac{m_0}{m_f} = I_{sp} \, g_0 \, \ln \frac{m_0}{m_f}')
_images/examples_14_0.svg