# Numbers

(Excerpt from "The MathML Handbook" by Pavi Sandhu)

The mn element is used to represent numbers, or more precisely numeric literals. A numeric literal is any sequence of characters that represents an unsigned integer or real number. Here are some examples:

``````<mn>1</mn>
<mn>6.67</mn>
<mn>2002</mn>
<mn>1.6e-19</mn>
<mn>0xAEFF</mn>
<mn>1100101</mn>``````

Negative numbers can be represented by including a "-" sign before the numeric literal in the same <mn> element, as shown below:

``<mn>-1</mn>``

However, it is preferable to place the minus sign in a separate mo element so that you provide additional information about the meaning of the markup for use by processing applications, as shown here:

``<mo>-</mo><mn>1</mn>``

A mn element is rendered as the characters in its content with no extra spacing around them. By default, the content is rendered in an unslanted font. However, you can specify a different rendering using the style attributes available for token elements.

Not all numbers should be represented using mn. For example, fractions are represented using the mfrac element, as shown here: ``<mfrac><mn>1</mn><mn>2</mn></mfrac>``

A named symbolic constant, such as , is represented by an entity reference enclosed in an mi element, as shown below:

``<mi>&pi;</mi>``

Complex numbers are represented as an mrow element, which contains separate arguments for the real part, the imaginary part, and the operator between them, as shown here (note the use of the entity reference &InvisibleTimes; to denote multiplication between the imaginary part and the symbolic number i):

3.4 + 5i

``````<mrow>
<mn>3.4</mn>
<mo>+</mo>
<mrow>
<mn>5</mn>
<mo>&InvisibleTimes;</mo>
<mi>&ImaginaryI;</mi>
</mrow>
</mrow>
``````

 Tipp der data2type-Redaktion: Zum Thema MathML bieten wir auch folgende Schulungen zur Vertiefung und professionellen Fortbildung an: