Daniel I. Scully

A Beginner's Guide to MathML

Sub-scripts & Super-scripts

Sub/Super-scripts are used in MathML not just for powers or indices, they are also used for limits.

Sub-scripts

Sub-Scripts are denoted with the <msub> tag. It accepts exactly 2 child elements, the first is the 'base', the second is the sub-script.

1. <msub>
2.  <mi>x</mi>
3.  <mi>i</mi>
4. </msub>
${x}_{i}$

As usual, you can use grouping elements, such as <mrow>, to group multiple tags so that there are only two child elements within the <msub>.

Super-scripts

The <msup> behaves in exactly the same way as for sub-scripts.

1. <msup>
2.  <mi>e</mi>
3.  <mrow>
4.  <mi>x</mi>
5.  <mo>+</mo>
6.  <mn>2</mn>
7.  </mrow>
8. </msup>
${e}^{x+2}$

Sub-script Super-script pair

For the frequently encountered case when you need both sub and super-scripts we can use the <msubsup> tag:

1. <msubsup>
2.  <mi>x</mi>
3.  <mi>2</mi>
4.  <mn>i</mn>
5. </msubsup>
${x}_{2}^{i}$

Note that this is different to nesting sub/super scripts:

1. <msup>
2.  <msub>
3.  <mi>x</mi>
4.  <mn>i</mn>
5.  </msub>
6.  <mn>2</mn>
7. </msup>
${{x}_{i}}^{2}$

Integration

1. <msubsup>
2.  <mo>&Integral;</mo>
3.  <mn>0</mn>
4.  <mn>1</mn>
5. </msubsup>
6. <mi>x</mi>
7. <mrow>
8.  <mo>&DifferentialD;</mo>
9.  <mi>x</mi>
10. </mrow>
${\int }_{0}^{1}xdx$

Under and Over Scripts

Exaclty like the sub and super scripts, we can place things above and below using three similar tags: <munder>, <mover> and <munderover>

1. <munder>
2.  <mi>x</mi>
3.  <mo>⏟</mo>
4. </munder>
5. <mo>+</mo>
6. <mover>
7.  <mi>y</mi>
8.  <mo>^</mo>
9. </mover>
$\underset{⏟}{x}+\stackrel{^}{y}$
1. <munderover>
2.  <mi>&Sum;</mi>
3.  <mrow>
4.  <mi>x</mi>
5.  <mo>=</mo>
6.  <mn>0</mn>
7.  </mrow>
8.  <mi>n</mi>
9. </munderover>
10. <mrow>
11.  <mn>2</mn> <mi>x</mi>
12.  <mo>+</mo>
13.  <mn>1</mn>
14. </mrow>
$\sum _{x=0}^{n}2x+1$

As you can see from this second example, this is a suitable way to write summations.