- Not to be confused with Office MathML (an ISO/IEC standard XML format)
|Mathematical Markup Language|
|Filename extension||.xml +|
|Developed by||World Wide Web Consortium +|
|File formats category -|
Mathematical Markup Language (MathML) is an application of XML for describing mathematical notations and capturing both its structure and content. It aims at integrating mathematical formulas into World Wide Web documents. It is a recommendation of the W3C math working group. Its recommended namespace URI is http://www.w3.org/1998/Math/MathML.
Presentation and semantics Edit
MathML deals not only with the presentation but also the meaning of formula components (the latter part of MathML is known as “Content MathML”). Because the meaning of the equation is preserved separate from the presentation, how the content is communicated can be left up to the user. For example, web pages with MathML embedded in them can be viewed as normal web pages with many browsers but visually impaired users can also have the same MathML read to them through the use of screen readers.
Presentation MathML focuses on the display of an equation, and has about 30 elements, and 50 attributes. The elements all begin with
m and include token element:
<mi>x</mi> - identifiers;
<mn>2</mn> - number. Tokens are combined using layout elements that include:
<mrow> - a row;
<msup> - superscripts;
mfrac - fractions. The attributes mainly control fine details of the presentation. A large number of entities are available that represent letters
→ and some non-visible character such as
⁢ representing multiplication.
For valid XML documents as per the W3C specifications, a MathML file must have a doctype declaration:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
Thus, the expression $ a x^2+b x+c $ could be represented in a valid MathML file as:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>a</mi> <mo>⁢<!-- ⁢ --></mo> <msup> <mi>x</mi> <mn>2</mn> </msup> <mo>+</mo> <mi>b</mi> <mo>⁢<!-- ⁢ --></mo> <mi>x</mi> <mo>+</mo> <mi>c</mi> </mrow> </math>
Content MathML focuses on the semantic meaning of the expression. Central to Content MathML is the
<apply> element that represents a function or operator, given in the first child, applied to the remaining child elements. For example
<apply><sin/><ci>x</ci></apply> represents $ \sin(x) $ and
<apply><plus/><ci>x</ci><cn>5</cn></apply> represents x+5. The
<ci> element represents an identifier,
<cn> a number, and there are over a hundred different elements for different functions and operators. Content MathML uses only a few attributes.
The expression $ a x^2+b x+c $ could be represented as
<math> <apply> <plus/> <apply> <times/> <ci>a</ci> <apply> <power/> <ci>x</ci> <cn>2</cn> </apply> </apply> <apply> <times/> <ci>b</ci> <ci>x</ci> </apply> <ci>c</ci> </apply> </math>