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.
<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.
<math> <mi>x</mi> <munder> <mo>→</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. → 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 | ↔ |
More Graphics Design Tips:
• HTML5 Canvas
• Selecting Vertices Edges and Faces in Blender
• How to Trace an Image Using Inkscape
• RGB Vs CMYK
• XDdom 3D Axis and Coordinate System
• SVG For Responsive Web Design
• How to Trace an Image Using Photoshop
• MathML Element to Display a Fraction
• SVG Image Clipping
• Where To Find Free Stock Photography, Clip Art, And Other Graphics For Your Web Site