MathML mtext Element to Display Plain Text

The tag elements used in MathML allow the MathML processor to display the different mathematical items properly. Also, they allow a mathmatical expression parcer to properly process the different items. But what if you just want to add some general text to an expression? One place text would be used in a mathmatical expression is in a conditional statement.

The mtext element is used to display plain text. Shown below is an example of a conditional statement.

if n is a positive integer then ( n 2 - n + 41 ) is a prime number
     <mtext>if</mtext><mspace width="0.5ex"/>
     <mi>n</mi><mspace width="0.5ex"/>
     <mtext>is a positive integer</mtext>
  <mspace linebreak='newline'/>
     <mtext>then</mtext><mspace width="0.5ex"/>
     <mo>)</mo><mspace width="0.5ex"/>
     <mtext>is a prime number</mtext>

When using the mtext element, it is common to need to add some space before and after the text. Note the use of the mspace element in the code. Each mspace element has a with attribute that specifies how much space to put. The unit that I used for this is the ex unit. The ex unit is the height of a lowercase letter.

By the way, in the conditional statement shownabove, in the case where n=41 the statement is false, so the statement is false.

x maps to y
    <mtext>maps to</mtext>

The example below shows how to use the munder element and mtext to place text under a symbol. &#x2192; is hex character code for a right arrow. Note how the mo stretched horizontally to cover the size of the text.

Shown below are the character codes for some other arrow symbols.

Symbol Meaning Character Code
Right Arrow &#x2192;
Left Arrow &#x2190;
Double Arrow &#x2194;

Learn more at

More Graphics Design Tips:
• SVG Example Code to Skew Elements
• HTML5 Canvas
• MathML Element to Display a Radical
• The Browser Safe Palette
• How to Create Radial Gradients in Inkscape
• How to Make a Video Game for your Xbox for Free
• How to Create a Simple Video with Windows Movie Maker
• MathML mo Element Operators
• Introduction to X3D (Extensible 3D)
• Find Free Stock Photos You'll Actually Want to Use For Your Website or Blog