MathML Basic Elements

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

MathML Basic Elements

The most basic elements of MathML are: mrow, mi, mo and mn.

Index Elements Descriptions
1) element The MathML element is used to group any number of sub expressions horizontally.
2) element The MathML element is used to specify an identifier.
3) element The MathML element is used to specify an operator in a broad sense.
4) element The MathML element is used to specify a numeric literal.

For example: To write x + y = 5, the equivalent MathML code are:

  1. <mrow>  
  2.   <mrow>  
  3.     <mi>x</mi>  
  4.     <mo>+</mo>  
  5.     <mi>y</mi>  
  6.   </mrow>  
  7.   <mo>=</mo>  
  8.   <mn>2</mn>  
  9. </mrow>  

<mrow> element:

The MathML <mrow> element is used to group any number of sub expressions horizontally.

<mi> element:

The MathML <mi> element is used to specify an identifier. For example: the name of a variable, a constant, a function, etc.

It automatically renders the identifier using an italic font, if the identifier is one character long; otherwise the name is rendered using a normal, upright font.

<mo> element:

The MathML <mo> element is used to specify an operator in a broad sense. For example: addition operator '+', a fence operator '{' or a separator ','

The appropriate amount of space is added on the left and on the right of an <mo> element depending on the textual contents of this element.

For example: if in the above expression you replace <mo>+</mo> by <mo>,</mo>, this will suppress the space at the left of the mo element.

<mn> element:

The MathML <mn> element is used to specify a numeric literal.

For example: PI should be specified as <mi>PI</mi> and not as <mn>PI</mn> while 3.14 should be specified as <mn>3.14</mn> and not as <mi>3.14</mi>.