# MathML mtext Element to Display Plain Text by Stephen Bucaro

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.

$\text{if}\phantom{\rule{0.5ex}{0ex}}n\phantom{\rule{0.5ex}{0ex}}\text{is a positive integer}\phantom{\rule{0ex}{0ex}}\text{then}\phantom{\rule{0.5ex}{0ex}}\left({n}^{2}-n+41\right)\phantom{\rule{0.5ex}{0ex}}\text{is a prime number}$
$<mrow> <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> <msup> <mi>n</mi> <mn>2</mn> </msup> <mo>-</mo> <mi>n</mi> <mo>+</mo> <mn>41</mn> <mo>)</mo><mspace width="0.5ex"/> <mtext>is a prime number</mtext> </mrow>$


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\underset{\text{maps to}}{\to }y$
$<mi>x</mi> <munder> <mo>&#x2192;</mo> <mtext>maps to</mtext> </munder> <mi>y</mi>$


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 → ← Left Arrow ← ↔ Double Arrow ↔