Français

<mi>

Write variables, numbers and operators

  • MathML
  • accessibility
  • semantics

<mi> + <mn> + <mo> — Variables, numbers and operators

<mi> represents an identifier: a variable, function name, or constant. <mn> represents a number. <mo> represents an operator such as +, -, = or &#xD7;. These are the building blocks of any MathML expression.

When to use it

You want to write a mathematical expression that machines can read. Each symbol has its role: <mi>x</mi> for the variable, <mn>42</mn> for the number, <mo>=</mo> for the operator. A single character in <mi> is rendered in italics by default (mathematical convention).

What you gain

Accessibility: screen readers distinguish variables from numbers and operators. "x plus 2" is clearer than "x + 2" read as plain text.

Code example

<math>
  <mrow>
    <mi>f</mi>
    <mo>(</mo>
    <mi>x</mi>
    <mo>)</mo>
    <mo>=</mo>
    <mn>2</mn>
    <mi>x</mi>
    <mo>+</mo>
    <mn>1</mn>
  </mrow>
</math>

Further reading