The following should look like the quadratic formula:
If it just looks like a single row of letters and numbers, MathML is not supported. Upgrade to a browser that does support it, such as Firefox or Safari.
The three tokens you will use most are
<mn>. They represent identifiers, operators and numbers.
<math><mi>x</mi> <mo>+</mo> <mn>5</mn></math>
You can use special symbols as operators by writing out their entities, such as
± (±). You may also insert text into an expression using the
<math><mtext>This is the speed of light:</mtext> <mi>c</mi> <mo>=</mo> <mn>299792458</mn> <mo rspace="thickmathspace">⁢</mo> <mi mathvariant="normal">m</mi><mo>/</mo><mi mathvariant="normal">s</mi></math>
mathvariant property can change the look of a token. It is "normal" by default, except in
<mi>, where it is "italic". We override it in this example, because units are written upright. For symbols that are spoken but sometimes aren't written, such as the multiplication sign (
⁢) or the comma in subscripts (
⁣), we use special entities. This is to ensure correct pronunciation by screen readers. Since
InvisibleTimes has no width, we use
rspace to add a space to the right of it.
Layout elements take a number of arguments, either tokens or other layout elements, and lay them out in a specific way.
Lays its arguments out vertically. If a layout element only takes one argument, it's implicitly treated as one big
mrow. Its use is like a block statement in programming languages.
Takes any number of arguments. Draws braces around its content and separates each argument with a comma. The advantage over writing
<mo>(</mo> is that the braces grow to fit their content. You can choose which braces and separator to use with the
Takes two arguments, dividend and divisor.
Takes two arguments, one for the token being super/subscripted and the super/subscript itself.
<math><mfrac><mn>1</mn><mrow><mn>2</mn><mo>⁢</mo><mi>x</mi></mrow></mfrac> <mo>=</mo> <msup><mfenced><mrow><mn>2</mn><mo>⁢</mo><mi>x</mi></mrow></mfenced><mn>-1</mn></msup></math>
<msubsup> is a combination of
<msup>, with the first argument being the token being sub and superscripted, then the subscript and finally the superscript.
Works similar to
<msubsup>, but prescripts can be added after the separator
<mprescripts/>. Takes either two or five arguments depending om the presence of the separator. Use
<none/> to omit an argument.
Works similarly to the sup/sub elements, but places its arguments directly above and/or below the base.
<math><munderover><mo>Σ</mo><mrow><mi>x</mi><mo>=</mo><mn>1</mn></mrow><mn>6</mn></munderover><msup><mi>x</mi><mn>2</mn></msup> <mo>=</mo> <mn>91</mn></math>
Symbols stretch to be as wide as the argument it's placed under.
<msqrt> takes a single argument, while
<mroot> takes the index as a second argument.
<mtable> is analogous to HTML's
<table> element. It contains rows (
<mtr>) which contain cells (
Cycles through its arguments on click. The
selection paramater determines which of its arguments should be displayed initially.
<math><maction actiontype="toggle" selection="2"><mi>x</mi><mi>y</mi><mi>z</mi></maction></math>
Shows some text on hover. Since tooltips usually can only cotain text, it is recommended to use only
<mtext> as the second argument.
<math><mi>z</mi><mo>=</mo><maction actiontype="tooltip"><mi>r</mi><mtext>radius</mtext></maction><mo>⁢</mo><mi>cos</mi><mo>⁡</mo><maction actiontype="tooltip"><mi>θ</mi><mtext>inclination</mtext></maction></math>
Similar to tooltip, but displays in the browser's status bar.
Using the href attribute, you can link math elements.
The spec is the ultimate reference guide for MathML. You may also want to visit the homepage of MathML.