graphic with four colored squares
Cover page images (keys)


12 Aug 2005

Ivan Herman, W3C


These slides are in XHTML, and follow the approach described on a separate page for presentation. That page describes the minimum environment you should have to display these slides with the proper MathML content.

Table of Content:

  1. Why MathML?
  2. Why MathML? (cont.)
  3. What is MathML?
  4. Who developed MathML?
  5. A Flavour of MathML: Quadratic formula in MathML
  6. A Bit of History
  7. MathML structure
  8. Same Formula in Different Markups
  9. Why two markups?
  10. Presentation Elements
  11. Main Token Presentation Elements
  12. Controlling the Rendering
  13. Controlling the Rendering (cont.)
  14. General Layout
  15. General Layout (cont.)
  16. Script and Limits
  17. Tables and Matrices
  18. Tables and Matrices (cont.)
  19. Enlivening Expressions
  20. Content Markup
  21. Content Markup Details
  22. Content Markup
  23. Fundamental Content Elements
  24. Fundamental Content Elements (cont.)
  25. Fundamental Content Elements
  26. Fundamental Content Elements
  27. Content Operators and Functions
  28. Content Operators and Functions
  29. Mixing Content and Presentation Markups
  30. Semantics of Content Elements
  31. Adding semantics to an expression
  32. Using MathML with Other Markups
  33. Embedding MathML
  34. Using “object”
  35. Full XML Based Usage: Namespaces
  36. Full XML Based Usage: Common Approach
  37. Further Information

Why MathML?

Current solutions to display math on the Web:

eg: ai (a<sub>i</sub>))
  • HTML is not rich enough
  • typesetting mathematical formulae is hard!
Use embedded images
eg: quadratic formula
  • requires specialized editors
  • difficult to position/size the image properly
  • not searchable
  • accessibility problems (what should a voice browser do?)

Why MathML? (cont.)

What is MathML?

Who developed MathML?

A Flavour of MathML: Quadratic formula in MathML

  <mi>x</mi> <mo>=</mo>

A Bit of History

MathML structure

XML Elements in MathML are:

Presentation markup elements:
Describing the notation directly (see previous example): rows, fractions, operators, etc. It captures the notational structure.
Content markup elements:
Explicit encoding of the mathematical content. It captures the mathematical structure.
The (only) interface element:
math element, which binds a formula to the surrounding XML (eg., XHTML)

Note: earlier versions relied on XML Entities for special signs (integrals, greek letters, etc), but Unicode has taken over…

Same Formula in Different Markups

Presentation Markup Content Markup

Why two markups?

Presentation Elements

Presentation elements fall in two categories:

Token elements
Individual symbols, names, numbers, alignment control, ...
Layout elements
Rows, fractions, square roots, superscripts, tables, ...

Main Token Presentation Elements

identifier, number
<mi>a</mi> <mn>2</mn>
operator, separator, or accent
<mtext>Theorem 1:</mtext>

Controlling the Rendering

Attributes to control the precise rendering, eg,

<mo> ( </mo>
<mo maxsize="1"> ( </mo>

Controlling the Rendering (cont.)

General Layout

square root

General Layout (cont.)

surround content
<mfenced open="[" separators=";">

Script and Limits

tensor indices

Tables and Matrices

<mrow><mo> [ </mo> <mtable>
</mtable> <mo> ] </mo></mrow>

Tables and Matrices (cont.)

  groupalign="decimalpoint left ...">
        <mn> 8.44 </mn>
        <mi> x </mi>
        <mn> 3.1 </mn>
        <mi> x </mi>

Enlivening Expressions

<maction actiontype="toggle" selection="2">

Other possible action types (depending on the rendering engine)

Content Markup

Content markup reflects the structure of formulae:

schematic view of the structure of an integr120al expression

Content Markup Details

Content markup reflects the structure of formulae:


MathML does not define the exact mapping from content markup to rendering (only a "Default Rendering" is defined).

Content Markup

Fundamental Content Elements

<cn type="complex-cartesian">
Apply construct
Numeric interval
<interval closure="open-closed">

Fundamental Content Elements (cont.)

Functions and operators
Inverse function

Fundamental Content Elements

        <ci type="set">B</ci>
        <ci type="set">C</ci>

Fundamental Content Elements

     <cn> 1 </cn> <cn> 2 </cn>
     <cn> 3 </cn> <cn> 4 </cn>
      <ci> x </ci>
      <ci> x </ci>
      <cn> 0 </cn>

Content Operators and Functions

Arithmetic, Algebra, Logic
quotient, exp, max, min, root, and, xor, forall, exists, floor ...
eq, neq, equivalent, ...
ln, int, partialdiff, diff, limit, laplacian ...
Set theory
list, union, intersect, cartesian product ...

Content Operators and Functions

Sequences and series
sum, product, ...
mean, variance, moment ...
sin, arccos, ...
Linear algebra
vector, matrix, vector product, ...
integers, reals, pi, infinity, ...

Altogether cca. 100 elements!

Mixing Content and Presentation Markups


Semantics of Content Elements

<!-- reference to OpenMath definition of Bessel function -->
  <csymbol encoding="OpenMath"

Adding semantics to an expression

  <annotation encoding="Mathematica">
       N[123/456, 39]
  <annotation encoding="Maple">
       evalf(123/456, 39);
  <annotation-xml encoding="OpenMath">
    <OMA xmlns="">
	  <OMS cd="arith1" name="divide"/>

Using MathML with Other Markups

Embedding MathML

<embed src="mmls/mixExample.mml" height="60" width="110" />

Using “object”

<object type="application/mathml+xml"
   height="60" width="110"></object>

Full XML Based Usage: Namespaces

Using XHTML, the math content should be directly includable:

  <p>Bla bla bla</p>
  <m:math xmlns:m="">

Full XML Based Usage: Common Approach

    <?xml version="1.0" encoding="iso-8859-1" ?>
    <?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
    <html xmlns="">

Further Information

These slides are at:
W3C MathML Activity Page:
The latest release of the Recommendation
More information about W3C:
Contact information:
Mail me: