Daniel I. Scully

A Beginner's Guide to MathML

The 'Token' Elements

Numbers, Identifiers and Operators

The most numerous elements in any MathML expression you write are almost certainly going to be the 'token' elements, three of which we saw above:

  • <mn> - number token, contains unsigned integer or real numbers (eg: 2, 3.04)
  • <mi> - identifier token, contains variables, function names, and symbolic constants (eg: x, sin, π)
  • <mo> - operator token, mathematical operators (eg: +, -, ∑)

The use of these elements should be fairly self-evident, but here's an example to highlight a couple of subtelties:

  1. <mi>z</mi>
  2. <mo>=</mo>
  3. <mn>2</mn>
  4. <mo>-</mo>
  5. <mn>3</mn> <mi>&ImaginaryI;</mi>
z = 2 - 3

The first point here is that symbols such as the imaginary number (ⅈ), or pi (π), are deemed identifiers not numbers, even though they may represent specific numerical values. The second point is that negatives should be applied to numbers as operators and not be included in the <mn> element.


You may also find use for the <mtext> element:

  1. <mtext>Insert Text Here</mtext>
Insert Text Here

which is useful for annotating your equations.