About MathML
- Origins:
- Introduced in 1998
- One of the first applications of XML
- Versions:
- MathML 2.0 - 2001 (revised 2003)
- XML Entity Definitions for Characters - 2010 (revised 2014)
- MathML 3.0 - 2010 (revised 2014)
- Today:
- MathML is included in HTML5
- MathML is not included in all browsers
- Some browsers (and some dynamic uses) require the
XML namespace (xmlns="http://www.w3.org/1998/Math/MathML ")
Some History
- Purpose:
- Change the relative position of elements
- Some Uses:
- Subscripts and superscripts
- Mathematical accents
- Stacking
The Top-Level math
Element
- Requirements:
- Contains one instance of MathML markup
- Must not contain another
math
element
- Attributes:
-
display
can be "block"
or
"inline"
-
overflow
can be "linebreak"
,
"scroll"
, "elide" (i.e., abbreviate)
,
"truncate"
, or "scale"
-
alttext
provides a text alternative as a
fall-back
Presentation Markup - Basics
- Foundational Elements:
-
mi
- an identifier
-
mo
- an operator
-
mn
- a number
- Examples:
-
htmlexamples/mathml/basics.html
Presentation Markup - Sub-Expressions
- Motivation:
- Some MathML elements must contain a particular number
of elements in a fixed order (e.g., a fraction contains a
numerator and a denominator)
- Hence, one must be able to create sub-expressions
(i.e., "horizontal" groupings)
- Grouping Elements:
Presentation Markup - Sub-Expressions (cont.)
- Preferred Groupings:
- Sub-expressions should be grouped in the same way they are
grouped in the mathematical interpretation
(e.g., the expression \(ax + b\) should be in an
<mrow>
that contains an
<mrow>
for the sub-expression \(ax\))
- Examples:
-
htmlexamples/mathml/rows.html
Presentation Markup - Positioning
- Purpose:
- Change the relative position of elements
- Some Uses:
- Subscripts and superscripts
- Mathematical accents
- Stacking
Presentation Markup - Positioning (cont.)
- Elements:
-
msup
or msub
- superscript or
subscript
-
msubsup
- subscript and superscript
-
mover
or munder
- above or
below
-
munderover
- below and above
- Examples:
-
htmlexamples/mathml/positioning.html
Presentation Markup - Fractions
- The
mfrac
Element:
- First child is the numerator
- Second child is the denominator
- Examples:
-
htmlexamples/mathml/fraction.html
Presentation Markup - Other Things
-
msqrt
and mroot
for radicals
-
mtable
(containing mtr
and mtd
)
for matrices and vectors
-
mlongdiv
for long division (e.g.,
to explain division)
-
mscarries
for carries, borrows, and crossouts (e.g.,
to explain elementary arithmetic)
Content Markup
- Motivation:
- It is difficult to infer semantics from presentation
- Approach:
There's Always More to Learn