Menu
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
<math>
<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>
</math>

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
<math>
  <mi>x</mi>
  <munder>
    <mo>&#x2192;</mo>
    <mtext>maps to</mtext>
  </munder>
  <mi>y</mi>
</math>

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 amazon.com

More Graphics Design Tips:
• Inkscpe Snap Controls Bar
• History of Type Development and Type Terminology
• Paint.Net Ink Sketch, Oil Painting, and Pencil Sketch Artistic Effects
• Inkscape Preferences
• Find Free Stock Photos You'll Actually Want to Use For Your Website or Blog
• HTML5 Canvas
• How to Remove PNG and JPEG EXIF Metadata
• Graphics Design for Beginners - Cropping Images
• Inkscape Grouping
• MathML Element to Display a Fraction