<< Chapter < Page | Chapter >> Page > |
The authoritative reference for Content MathML is Section 4 of the MathML 2.0 Specification . The World Wide Web Consortium (W3C) is the body that wrote the specification forMathML. The text is very readable and it is easy to find what you are looking for. Look there for answers to questions thatare not answered in this tutorial or when you need more elaboration. This tutorial is based on MathML 2.0.
In this document, the
m
prefix is used to
denote tags in the MathML namespace. Thus the
<apply>
tag is referred to as
<m:apply>
. Remember all markup in
the MathML namespace must be surrounded by
<m:math>
tags.
The fundamental concept to grasp about Content MathML is that
it consists of applying a series of functions and operators toother elements. To do this, Content MathML uses prefix
notation.
Prefix notation is when the operator
comes first and is followed by the operands. Here is how towrite "2 plus 3".
<m:math>
<m:apply>
<m:plus/>
<m:cn>2</m:cn>
<m:cn>3</m:cn>
</m:apply>
</m:math>
This would display as
.
There are three types of elements in the Content MathML
example shown above. First, there is the
apply
tag, which indicates that an operator (or function) is about
to be applied to the operands. Second, there is the functionor operator to be applied. In this case the operator,
plus
, is being applied. Third, the operands
follow the operator. In this case the operands are thenumbers being added. In summary, the apply tag applies the
function (which could be sin or
, etc.) or operator (which
could be plus or minus, etc.) to the elements that follow it.
Content MathML has three tokens:
ci
,
cn
, and
csymbol
. A
token is basically the lowest level element.
The tokens denote what kind of element you are acting on.The
cn tag indicates that the content of the
tag is a number. The
ci tag indicates that the
content of the tag is an identifier. An
identifier could be any variable or function;
,
, and
are examples of identifiers.
In addition,
ci
elements can contain
Presentation MathML. Tokens, especially
ci
and
cn
, are used profusely in Content MathML.
Every number, variable, or function is marked by a token.
csymbol is a different type of token from
ci
and
cn
. It is used to create a
new object whose semantics is defined externally. It cancontain plain text or Presentation MathML. If you find that
you need something, such as an operator or function, that isnot defined in Content MathML, then you can use csymbol to
create it.
Both
ci
and
csymbol
can use
Presentation MathML to determine how an identifier or a newsymbol will be rendered. To learn more about Presentation
MathML see
Section 3
of the MathML 2.0 Specification . For example, to
denote "
with a subscript 2",
where the 2 does not have a more semantic meaning, you woulduse the following code.
<m:math>
<m:ci>
<m:msub>
<m:mi>x</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
</m:math>
This would display as
.
Notification Switch
Would you like to follow the 'Cnxml tutorial' conversation and receive update notifications?