HTML and CSS Reference

In-Depth Information

Syntax

MathML has presentational, content, and mixing markup elements. There are two types of flavor for MathML markup.

The first one focuses on the display of equations, known as
Presentation MathML
. The second,
Content MathML
,

stresses the semantic meaning of the mathematical annotation.

Similar to XHTML, there are two types of elements in MathML: the ones with the start and end tags and the

empty elements that are self-closing. However, the ratio of empty elements is much higher in MathML than in

XHTML. Elements can have optional attributes that consist of a name and a value (the latter one is quoted in double

or single quotes). The majority of MathML attribute values must be in a predetermined format such as a positive

integer or the keyword
true
.

In MathML there are
container elements
such as
mrow
(a group of subexpressions) and
token elements
such as
mi

(identifier; i.e., a name of a constant, a variable, or a function). The element
mo
represents an operator (e.g.,
+
), a fence

(e.g.,
{
), or a separator (e.g.,
,
). Numeric literals are specified by
mn
. The proper use of
mi
,
mo
, and
mn
is vital to provide

adequate information for rendering engines to apply the correct typographic rules. Containers can contain other

elements only while token elements delimit plain-text characters, special entity references, or symbols (the smallest

units with meaning). Listing 3-57 shows an example.

Listing 3-57.
A Simple Example for Container and Token Elements in MathML

<mrow>

<mi>a</mi>

<mo>+</mo>

<mi>b</mi>

</mrow>

Entity references begin with an ampersand (
&
) and end with a semicolon (
;
). Beyond keywords such as
α
,

a numeric format referring to the Unicode codepoint of the symbol is also allowed. More than 1,800 symbols are

supported.

The MathML namespace is
http://www.w3.org/1998/Math/MathML
. It can be declared in two ways: using the

xmlns
attribute or an attribute with an
xmlns
prefix. In the first case, the default namespace applies to the element on

which it is provided, as well as all child elements (Listing 3-58).

Listing 3-58.
A Presentation MathML Document Fragment Applying the MathML Namespace

<math mode="display"
xmlns="
http://www.w3.org/1998/Math/MathML
"
>

<mrow>

<mi>x</mi>

<mo>=</mo>

<mfrac>

<mrow>

<mrow>

<mo>-</mo>

<mi>b</mi>

</mrow>

<mo>±<!--PLUS-MINUS SIGN--></mo>

<msqrt>

<mrow>

<msup>

<mi>b</mi>

<mn>2</mn>

</msup>

Search WWH ::

Custom Search