<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML lang="en">
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.01 (Macintosh; I; PPC)
[Netscape]">
   <META NAME="PRAGMA" CONTENT="no-cache">
   <META NAME="Author" CONTENT="Bruce Smith (section 2.3 only)">
   <TITLE>Math Markup Language (Chapter 2)</TITLE>
   <link rel="stylesheet" type="text/css" media="screen" 
      href="/StyleSheets/TR/W3C-REC.css">
</HEAD>
<BODY>
<!-- navigation links -->
<TABLE WIDTH="100%">
<TR>
<TD ALIGN=LEFT>
Up: <A HREF="toc.html">Table of Contents</A></TD>
<TD ALIGN=RIGHT>
<I>REC-MathML-19980407; revised 19990707</I></TD>
</TABLE>

<HR>
<!-- end navigation links -->

<H1>
<A NAME="sec2."></A>2. MathML Fundamentals</H1>

<UL>

<LI>
<A HREF="#sec2.1">2.1 MathML Overview</A>
<UL>
<LI><A HREF="#sec2.1.1">2.1.1 Taxonomy of MathML Elements</A></LI>
<LI><A HREF="#sec2.1.2">2.1.2 Expression Trees and Token Elements</A></LI>
<LI><A HREF="#sec2.1.3">2.1.3 Presentation Markup</A></LI>
<LI><A HREF="#sec2.1.4">2.1.4 Content Markup</A></LI>
<LI><A HREF="#sec2.1.5">2.1.5 Mixing Presentation and Content</A></LI>
</UL></LI>

<LI>
<A HREF="#sec2.2">2.2 Some MathML Examples</A>
<UL>
<LI><A HREF="#sec2.2.1">2.2.1 Presentation Examples</A></LI>
<LI><A HREF="#sec2.2.2">2.2.2 Content Examples</A></LI>
<LI><A HREF="#sec2.2.3">2.2.3 Mixed Markup Examples</A></LI>
</UL></LI>

<LI>
<A HREF="#sec2.3">2.3 MathML Syntax and Grammar</A>
<UL>
<LI><A HREF="#sec2.3.1">2.3.1 An XML Syntax Primer</A></LI>
<LI><A HREF="#sec2.3.2">2.3.2 Children vs. Arguments</A></LI>

<LI><A HREF="#sec2.3.3">2.3.3 MathML Attribute Values</A>
<UL>
<LI><A HREF="#syntax-notations">Syntax notations used in the MathML specification</A></LI>
<LI><A HREF="#units">Attributes with units</A></LI>
<LI><A HREF="#css-compatible-attributes">CSS-compatible attributes</A></LI>
<LI><A HREF="#default-values">Default values of attributes</A></LI>
<LI><A HREF="#attributes-in-dtd">Attribute values in the MathML DTD</A></LI>
</UL></LI>

<LI><A HREF="#sec2.3.4">2.3.4 Attributes Shared by all MathML Elements</A></LI>
<LI><A HREF="#sec2.3.5">2.3.5 Collapsing Whitespace in Input</A></LI>
</UL></LI>

</UL>

<HR>

<h2><A NAME="sec2.1">MathML Overview</A></h2>

<P>This chapter introduces the basic ideas of MathML.  The first
section describes the overall design of MathML.  The second section
present a number of motivating examples, to give the reader something
concrete to refer to while reading subsequent chapters of the MathML
Specification.  The final section describes basic features of the
MathML syntax and grammar, which apply to all MathML markup.  In
particular, Section 2.3 should be read <EM>before</EM> Chapters 3, 4
and 5.</P>

<P>A fundamental challenge in defining a mathematics markup language for
the Web is reconciling the need to encode both the presentation of a
mathematical notation and the content of the mathematical idea or
object which it represents.</p>

<P>The relationship between a mathematical notation and a mathematical
idea is subtle and deep. On a formal level, the results of
mathematical logic raise unsettling questions about the correspondence
between symbolic logic systems and the phenomena they model. At a more
intuitive level, anyone who uses mathematical notation knows the
difference that a good choice of notation can make; the symbolic
structure of the notation suggests the logical structure. For example,
the Leibniz notation for derivatives "suggests" the chain rule of
calculus through the symbolic cancellation of fractions:</p>

<P>
<CENTER><IMG SRC="images/1_0.gif" ALT="df/dx dx/dt = df/dt" ></CENTER>

<P>Mathematicians and teachers understand this very well; part of their
expertise lies in choosing notation that emphasizes key aspects of a problem
while hiding or diminishing extraneous aspects. It is commonplace in math
and science to write one thing when technically something else is meant,
because long experience shows this actually communicates the idea better
at some higher level.</P>

<P>In many other settings, though, mathematical notation is used to
encode the full, precise meaning of a mathematical object.
Mathematical notation is capable of prodigious rigor, and when used
carefully, it is virtually free of ambiguity.  Moreover, it is
precisely this lack of ambiguity which makes it possible to describe
mathematical objects so that they can be used by software
applications such as computer algebra systems and voice renderers. In
situations where such inter-application communication is of paramount
importance, the nuances of visual presentation generally play a
minimal role.

<P>MathML allows authors to encode both the notation which
represents a mathematical object and the mathematical structure
of the object itself.  Moreover, authors can mix both kinds of
encoding in order to specify both the presentation and content of a
mathematical idea.  The remainder of this section gives a basic
overview of how MathML can be used in each of these ways.

<h3><A NAME="sec2.1.1">2.1.1 Taxonomy of MathML Elements</A></h3>

<P>All MathML elements fall into one of three categories: <A
HREF="chap3_1.html">presentation elements</A>, <A
HREF="chap4_1.html">content elements</A> and <A
HREF="chapter7.html">interface elements</A>.  Each of these categories
is described in detail in chapters 3, 4 and 7 respectively.</P>

<P>Presentation elements describe mathematical notation structure.
Typical examples are the <B>mrow</B> element, which is used to
indicate a horizontal row of characters, and the <B>msup</B> element,
which is used to indicate a base and superscript.  As a general rule,
each presentation element corresponds to a single kind of notational
"schema" such as a row, a superscript, an underscript and so on.
Since many notational schemata have a number of frequently occurring
variants, most presentation elements accept a number of attributes
which can be used to select between variants.  For example, the
superscript element accepts a "superscript shift" attribute which
specifies the minimum amount the superscript should shift upward.

<P>Content elements describe mathematical objects directly, as opposed
to describing the notation which represents them.  Typical examples
include the <B>plus</B> element, which denotes the usual addition
operator for real numbers, and the <B>vector</B> element, which
denotes a vector from linear algebra.  Each content element
corresponds to a carefully defined mathematical concept.  Some
elements represent mathematical objects like vectors, while others
represent functions or operations like addition.</P>

<P>Every MathML element but one is either a presentation element or a
content element.  The <B>math</B> element is neither, since
its role is to serve as a top-level, interface element.  One function
of the <B>math</B> element is to pass on parameters to a MathML
processor that affect an entire expression, such as style preferences.
A second function is to communicate parameters to a Web browser about
what software to use to render a MathML expression, and how the
expression should be integrated into the surrounding HTML page.  (As
XML support is added to browsers, it may ultimately be necessary to
introduce one or two more interface elements, to handle these
functions separately.  See <A HREF="chapter7.html">chapter 7</A> for
details.)


<h3><A NAME="sec2.1.2">2.1.2 Expression Trees and Token Elements</A></h3>

<P>Presentation and content expressions both share a number of formal
properties.  In both cases, most expressions naturally decompose into
pieces, or subexpressions.  For example, the expression

<BLOCKQUOTE>
(<I>a</I> + <I>b</I>)<SUP>2</SUP>
</BLOCKQUOTE>

naturally breaks into a "base," the (<I>a</I> + <I>b</I>), and a
"script," which is the single character '2' in this case.
Furthermore, as this example shows, the subexpressions may themselves
decompose into further subexpressions, and so on.  Of course, the
decomposition process eventually terminates with indivisible
expressions such as digits, letters, or other symbol characters.

<P>Although this particular example involves mathematical notation,
and hence presentation markup, the same observation applies equally
well to abstract mathematical objects, and hence to content markup.
For example, our superscript example would typically denote an
exponentiation operation that would require two operands: a "base" and
an "exponent."  This is no coincidence, since as a general rule,
mathematical notation closely mirrors the logical structure of the
underlying mathematical objects.

<P>The recursive nature of mathematical objects and notation is
strongly reflected in MathML markup.  Most presentation or content
elements contain some number of other MathML elements corresponding
to the constituent pieces out of which the original object is
recursively built.  The original schema is commonly called the
<EM>parent</EM> schema, and the constituent pieces are called
<EM>child</EM> schemata.  More generally, MathML expressions can be
regarded as trees, where each node corresponds to a MathML element,
the branches under a "parent" node correspond to its "children", and
the leaves in the tree correspond to indivisible notation or content
units such as numbers, characters, etc.

<P>Most leaf nodes in a MathML expression tree are either canonically
<EM>empty elements</EM>, or <EM>token elements</EM>.  Canonically empty
elements directly represent symbols in MathML, such as the content
element <b>plus</b>. MathML token elements are the only MathML elements
permitted to directly contain character data.  The character data may
consist of ASCII characters and MathML <em>entities</em>, which are
escape sequences of the form &amp;<I>entity_name</I>;.  MathML
entities typically denote non-ASCII Unicode characters such as
&amp;alpha;, &amp;rightarrow; and &amp;sum;.  A third kind of leaf node
permitted in MathML is the <B>annotation</B> element, which is 
used to hold data in a non-MathML format.

<P>The most important presentation token elements are <B>mi</B>,
<B>mn</B> and <B>mo</B> for representing identifiers, numbers and
operators respectively.  Typically a renderer will employ slightly
different typesetting styles for each of these kinds of character
data: numbers are usually in upright font, identifiers in italics, and
operators have extra space around them.  In content markup, there are
only two tokens, <B>ci</B> and <B>cn</B> for identifiers and numbers
respectively.  In content markup, separate elements are provided for
commonly used functions and operators. The <B>fn</B> element is
provided for user-defined extensions to the base set.

<P>In terms of markup, most MathML elements have a <EM>start</EM> tag and
an <EM>end</EM> tag, which enclose the markup for their contents.  In
the case of tokens, the content is character data, and in most other
cases, the content is the markup for child elements.  A third category
of elements, called canonically empty elements, don't require any
contents, and are marked up using a single tag of the form
&lt;element_name/&gt;.  An example of this kind of markup is the
content element <B>&lt;plus/&gt;</B>.

<P>Returning to the example of (<I>a</I> + <I>b</I>)<SUP>2</SUP>, we can now
see how the principles discussed above play out in practice.  One form of
presentation markup for this example is:

<PRE><B>
    &lt;msup>
      &lt;mfenced>
        &lt;mrow>
          &lt;mi>a&lt;/mi>
          &lt;mo>+&lt;/mo>
          &lt;mi>b&lt;/mi>
        &lt;/mrow>
      &lt;/mfenced>
      &lt;mn>2&lt;/mn>
    &lt;/msup>
</B></PRE>

The content markup for the same example is:

<PRE><B>
    &lt;apply>
      &lt;power/>
      &lt;apply>
        &lt;plus/>
        &lt;ci>a&lt;/ci>
        &lt;ci>b&lt;/ci>
      &lt;/apply>
      &lt;cn>2&lt;/cn>
    &lt;/apply>
</B></PRE>

While a full discussion of presentation and content markup must wait
until Chapters 3 and 4, the main features of these sample encodings
should now be relatively clear.

<h3><A NAME="sec2.1.3">2.1.3 Presentation Markup</A></h3>

<P>MathML presentation markup consists of 28 elements which accept
over 50 attributes.  Most of the elements correspond to <EM>layout
schemata</EM>, which contain other presentation elements.  Each layout
schema corresponds to a 2-dimensional notational
device, such as a super- or sub-script, fraction or table.
In addition, there are the
presentation token elements <B>mi</B>, <B>mn</B> and <B>mo</B>
introduced above, as well as several other less commonly used token
elements.  The remaining few presentation elements are empty elements,
and are used mostly in connection with alignment.

<P>The layout schemata fall into several classes.  One group of
elements is concerned with scripts, and contains elements such as
<B>msub</B>, <B>munder</B>, and <B>mmultiscripts</B>.  Another group
focuses on more general layout and includes <B>mrow</B>,
<B>mstyle</B>, and <B>mfrac</B>.  A third group deals with tables.
The <B>maction</B> element is a category by itself, and represents
various kinds of actions on notation, such as in an expression which
toggles between two pieces of notation.

<P>An important feature of many layout schemata is that the order of
child schemata is significant. For example, the first child of an
<B>mfrac</B> element is the numerator and the second child is the
denominator.  Since the order of child schemata is not enforced
at the XML level by the MathML DTD, the information added by ordering is
only available to
a MathML processor, as opposed to a generic XML processor.  When we
want to emphasize that a MathML element such as <B>mfrac</b> requires
children in a specific order, we will refer to them as
<EM>arguments</EM>, and think of the <B>mfrac</B> element as a
notational "constructor".

<h3><A NAME="sec2.1.4">2.1.4 Content Markup</A></h3>

<P>Content markup consists of about 75 elements accepting roughly a dozen
attributes.  The majority of these elements are empty elements
corresponding to a wide variety of operators, relations and named
functions.  Examples of this sort include <b>partialdiff</b>,
<b>leq</b> and <b>tan</b>.  Others such as
<b>matrix</b> and <B>set</B> are used to encode various mathematical
data types, and a third, important category of content elements such
as <B>apply</B> are used to make new mathematical objects from others.

<P>The <B>apply</B> element is perhaps the single most important
content element.  It is used to apply a function to a collection of
arguments.  The positions of the child schemata is again significant,
with the first child denoting the function to be applied, and the
remaining children denoting the arguments of the function, with order
preserved.  Note that the apply construct always uses prefix notation,
like the programming language LISP.  In particular, even binary
operations like subtraction are marked up by applying a prefix
subtraction operator to two arguments.  For example, <I>a</I> -
<I>b</I> would be marked up as

<PRE><B>
    &lt;apply>
       &lt;minus/>
       &lt;ci>a&lt;/ci>
       &lt;ci>b&lt;/ci>
    &lt;/apply>
</B></PRE>

<P>A number of functions and operations require one or more
quantifiers to be well-defined.  For example, in addition to an
integrand, a definite integral must specify the limits of integration
and the bound variable.  For this reason, there are several
<EM>qualifier</EM> schemata such as <B>bvar</B> and <B>lowlimit</B>.
They are used with operators such as <B>diff</B> and <B>int</B>.

<P>The <B>declare</B> construct is especially important for
content markup that might be evaluated by a computer algebra system.
The <B>declare</B> element provides a basic assignment mechanism,
where a variable can be declared to be of a certain type, with a
certain value.  Typically, declarations are ignored for visual
rendering, and are used when an expression is evaluated.

<h3><A NAME="sec2.1.5">2.1.5 Mixing Presentation and Content</A></h3>

<P>Different kinds of markup will be most appropriate for different
kinds of tasks.  Legacy data is probably best translated into pure
presentation markup, since semantic information about what the author
meant can only be guessed at heuristically.  By contrast, some
mathematical applications and pedagogically-oriented authoring
tools will likely choose to be entirely content-based.  However, the
majority of applications fall somewhere in between these extremes.
For these applications, the most appropriate markup is a mixture of
both presentation and content markup.

<P>The rules for mixing presentation and content markup derive from
the general principle that mixed content should only be allowed in
places where it makes sense. For content markup embedded in
presentation markup this basically means that any content fragments
should be semantically meaningful, and should not require additional
arguments or quantifiers to be fully specified.  For presentation
markup embedded in content markup, this usually means that
presentation markup must be contained in a content token element, so
that it will be treated as an indivisible notational unit used as a
variable or function name.

<P>Another option is to use a <B>semantics</B> element.  The
<B>semantics</B> element is used to bind MathML expressions to various
kinds of annotations.  One common use for the <B>semantics</B> element
is to bind a content expression to a presentation expression as a
semantic annotation.  In this way, an author can specify a
non-standard notation be used when displaying a particular content
expression.  Another use of the <B>semantics</B> element is to bind
some other kind of semantic specification, such as an <A
HREF="http://www.openmath.org/">OpenMath</A> expression, to a MathML
expression.  In this way, the <B>semantics</B> element can be used to
extend the scope of MathML content markup.


<H2>
<A NAME="sec2.2"></A>2.2 Some MathML Examples</H2>

<h3><A NAME="sec2.2.1">2.2.1 Presentation Examples</A></h3>

<BR><B>Notation:</B>&nbsp;<IMG SRC="images/2_1.gif" ALT="x^2 + 4x +4 = 0"
ALIGN="MIDDLE">

<P><B>Markup:</B>

<PRE><B>
&lt;mrow>
  &lt;mrow>
    &lt;msup>
      &lt;mi>x&lt;/mi>
      &lt;mn>2&lt;/mn>
    &lt;/msup>
    &lt;mo>+&lt;/mo>
    &lt;mrow>
      &lt;mn>4&lt;/mn>
      &lt;mo>&amp;InvisibleTimes;&lt;/mo>
      &lt;mi>x&lt;/mi>
    &lt;/mrow>
    &lt;mo>+&lt;/mo>
    &lt;mn>4&lt;/mn>
  &lt;/mrow>
  &lt;mo>=&lt;/mo>
  &lt;mn>0&lt;/mn>
&lt;/mrow>
</B></PRE>

Note the use of nested <B>mrow</B> elements to denote terms,
in this case the left-hand side of the equation functioning as an operand
of "=".  Marking terms greatly facilitates things like spacing
for visual rendering, voice rendering, and line breaking.

<P><B>Notation:</B>&nbsp;<IMG SRC="images/2_2.gif" ALT="x = (-b +-
sqrt(b^2 - 4ac)) / 2a"  ALIGN="MIDDLE">

<P><B>Markup:</B>

<PRE><B>
&lt;mrow>
  &lt;mi>x&lt;/mi>
  &lt;mo>=&lt;/mo>
  &lt;mfrac>
    &lt;mrow>
      &lt;mrow>
        &lt;mo>-&lt;/mo>
        &lt;mi>b&lt;/mi>
      &lt;/mrow>
      &lt;mo>&amp;PlusMinus;&lt;/mo>
      &lt;msqrt>
        &lt;mrow>
          &lt;msup>
            &lt;mi>b&lt;/mi>
            &lt;mn>2&lt;/mn>
          &lt;/msup>
          &lt;mo>-&lt;/mo>
          &lt;mrow>
            &lt;mn>4&lt;/mn>
            &lt;mo>&amp;InvisibleTimes;&lt;/mo>
            &lt;mi>a&lt;/mi>
            &lt;mo>&amp;InvisibleTimes;&lt;/mo>
            &lt;mi>c&lt;/mi>
          &lt;/mrow>
        &lt;/mrow>
      &lt;/msqrt>
    &lt;/mrow>
    &lt;mrow>
      &lt;mn>2&lt;/mn>
      &lt;mo>&amp;InvisibleTimes;&lt;/mo>
      &lt;mi>a&lt;/mi>
    &lt;/mrow>
  &lt;/mfrac>
&lt;/mrow>
</B></PRE>

Notice that the plus/minus sign is given by a special named entity
&amp;PlusMinus;.  MathML provides a very comprehensive list of entity
names for mathematical symbols. In addition to the mathematical
symbols needed for screen and print rendering, MathML provides symbols
to facilitate audio rendering.  For audio rendering, it is important
to be able to automatically determine whether

<PRE><B>
    &lt;mrow>
      &lt;mi>z&lt;/mi>
      &lt;mfenced>
        &lt;mrow>
          &lt;mi>x&lt;/mi>
          &lt;mo>+&lt;/mo>
          &lt;mi>y&lt;/mi>
        &lt;/mrow>
      &lt;/mfenced>
    &lt;/mrow>
</B></PRE>

should be read as "z times the quantity x plus y" or "z of x plus
y". The entities &amp;InvisibleTimes; and &amp;ApplyFunction; provide
a way for authors to directly encode the distinction for audio
renderers. For instance, in the first case &amp;InvisibleTimes; should
be inserted after the line containing the z. MathML also introduces
entities like &amp;dd; which represents a "differential d" which
renders with slightly different spacing in print, and is usually
rendered as "with respect to" in speech. Unless content tags, or some
other mechanism, are used to eliminate the ambiguity, authors should
always use these entities, in order to make their documents more
accessible.

<P><B>Notation:</B>&nbsp;<IMG SRC="images/2_3.gif" ALT="a simple
matrix" ALIGN="MIDDLE">

<P><B>Markup:</B>

<PRE><B>
&lt;mrow>
  &lt;mi>A&lt;/mi>
  &lt;mo>=&lt;/mo>
  &lt;mfenced open=&quot;[&quot; close=&quot;]&quot;>
    &lt;mtable>
      &lt;mtr>
         &lt;mtd>&lt;mi>x&lt;/mi>&lt;/mtd>
         &lt;mtd>&lt;mi>y&lt;/mi>&lt;/mtd>
      &lt;/mtr>
      &lt;mtr>
         &lt;mtd>&lt;mi>z&lt;/mi>&lt;/mtd>
         &lt;mtd>&lt;mi>w&lt;/mi>&lt;/mtd>
      &lt;/mtr>
    &lt;/mtable>
  &lt;/mfenced>
&lt;/mrow>
</B></PRE>

Most elements have a number of attributes that control the details of
their screen and print rendering. For example, there are several
attributes for the <B>mfenced</B> element that control what delimiters
should be used at the beginning and the end of the expression.  The
attributes for operator elements given using <B>&lt;mo&gt;</B> are set to
default values determined by a
dictionary.   (For the suggested MathML operator dictionary, see <A
HREF="appendixC.html">appendix C</A>.)


<h3><A NAME="sec2.2.2">2.2.2 Content Examples</A></h3>

<P><B>Notation:</B>&nbsp;<IMG SRC="images/2_1.gif" ALT="x^2 + 4x +4 = 0"
ALIGN="MIDDLE">

<P><B>Markup:</B>
<PRE><B>
&lt;reln>
  &lt;eq/>
  &lt;apply>
    &lt;plus/>
    &lt;apply>
      &lt;power/>
      &lt;ci>x&lt;/ci>
      &lt;cn>2&lt;/cn>
    &lt;/apply>
    &lt;apply>
      &lt;times/>
      &lt;cn>4&lt;/cn>
      &lt;ci>x&lt;/ci>
    &lt;/apply>
    &lt;cn>4&lt;/cn>
  &lt;/apply>
  &lt;cn>0&lt;/cn>
&lt;/reln>
</B></PRE>

Note that the <B>reln</B> element is used much like the <B>apply</B>
element, except that it is used with relations instead of operators
and functions.

<P><B>Notation:</B>&nbsp;<IMG SRC="images/2_2.gif" ALT="x = (-b +-
sqrt(b^2 - 4ac)) / 2a"  ALIGN="MIDDLE">

<P><B>Markup:</B>

<PRE><B>
&lt;reln>
  &lt;eq/>
  &lt;ci>x&lt;/ci>
  &lt;apply>
    &lt;divide/>
    &lt;apply>
      &lt;fn>&lt;mo>&amp;PlusMinus;&lt;/mo>&lt;/fn>
      &lt;apply>
        &lt;minus/>
        &lt;ci>b&lt;/ci>
      &lt;/apply>
      &lt;apply>
        &lt;root/>
        &lt;apply>
          &lt;minus/>
          &lt;apply>
            &lt;power/>
            &lt;ci>b&lt;/ci>
            &lt;cn>2&lt;/cn>
          &lt;/apply>
          &lt;apply>
            &lt;times/>
            &lt;cn>4&lt;/cn>
            &lt;ci>a&lt;/ci>
            &lt;ci>c&lt;/ci>
          &lt;/apply>
        &lt;/apply>
        &lt;cn>2&lt;/cn>
      &lt;/apply>
    &lt;/apply>
    &lt;apply>
      &lt;times/>
      &lt;cn>2&lt;/cn>
      &lt;ci>a&lt;/ci>
    &lt;/apply>
  &lt;/apply>
&lt;/reln>
</B></PRE>

MathML content markup does not directly contain an element for the
"plus or minus" operation.  Therefore, we use the <B>fn</B> element
to declare that we want the presentation markup for this operator to
act as a content operator.  This is a simple example of how
presentation and content markup can be mixed to extend content markup.


<P><B>Notation:</B>&nbsp;<IMG SRC="images/2_5.gif" ALT="a simple
matrix" ALIGN="MIDDLE">

<P><B>Markup:</B>

<PRE><B>
&lt;reln>
  &lt;eq/>
  &lt;ci>A&lt;/ci>
  &lt;matrix>
    &lt;matrixrow>
      &lt;ci>x&lt;/ci>
      &lt;ci>y&lt;/ci>
    &lt;/matrixrow>
    &lt;matrixrow>
      &lt;ci>z&lt;/ci>
      &lt;ci>w&lt;/ci>
    &lt;/matrixrow>
  &lt;/matrix>
&lt;/reln>
</B></PRE>

Note that by default, the rendering of the content element
<B>matrix</B> includes enclosing parentheses, so we need not directly
encode them.  This is quite different from the presentation element
<B>mtable</B> which may or may not refer to a matrix, and hence
requires explicit encoding of the parentheses if they are desired.

<h3><A NAME="sec2.2.3">2.2.3 Mixed Markup Examples</A></h3>

<P><B>Notation:</B>&nbsp;<IMG SRC="images/2_4.gif" ALT="integral"
ALIGN="MIDDLE">

<P><B>Markup:</B>

<PRE><B>
&lt;semantics>

  &lt;mrow>
    &lt;msubsup>
      &lt;mo>&amp;int;&lt;/mo>
      &lt;mn>0&lt;/mn>
      &lt;mi>t&lt;/mi>
    &lt;/msubsup>
    &lt;mfrac>
      &lt;mrow>
        &lt;mo>&amp;dd;&lt;/mo>
        &lt;mi>x&lt;/mi>
      &lt;/mrow>
      &lt;mi>x&lt;/mi>
    &lt;/mfrac>
  &lt;/mrow>

  &lt;annotation-xml encoding="MathML-Content">
    &lt;apply>
      &lt;int/>
      &lt;bvar>&lt;ci>x&lt;/ci>&lt;/bvar>
      &lt;lowlimit>&lt;cn>0&lt;/cn>&lt;/lowlimit>
      &lt;uplimit>&lt;ci>t&lt;/ci>&lt;/uplimit>
      &lt;apply>
        &lt;divide/>
        &lt;cn>1&lt;/cn>
        &lt;ci>x&lt;/ci>
      &lt;/apply>
    &lt;/apply>
  &lt;/annotation-xml>

&lt;/semantics>
</B></PRE>

In this example, we use the <B>semantics</B> element to provide a
MathML content expression to serve as a "semantic annotation" for a
presentation expression.  The <B>semantics</B> element has as its
first child the expression being annotated, and the subsequent
children are the annotations.  There is no restriction on the kind of
annotation that can be attached using the <B>semantics</B> element.
For example, one might give a TeX encoding, or computer algebra input
in an annotation.  The type of annotation is specified by the
<B>encoding</B> attribute and the <B>annotation</B> and
<B>annotation-xml</B> elements.

<P>Another common use of the <B>semantics</B> element arises when one
wants to use a content coding, and provide a suggestion for
its presentation.  In this case, we would have the markup:

<PRE><B>
&lt;semantics>

  &lt;apply>
    &lt;int/>
    &lt;bvar>&lt;ci>x&lt;/ci>&lt;/bvar>
    &lt;lowlimit>&lt;cn>0&lt;/cn>&lt;/lowlimit>
    &lt;uplimit>&lt;ci>t&lt;/ci>&lt;/uplimit>
    &lt;apply>
      &lt;divide/>
      &lt;cn>1&lt;/cn>
      &lt;ci>x&lt;/ci>
    &lt;/apply>
  &lt;/apply>

  &lt;annotation-xml encoding="MathML-Presentation">
    &lt;mrow>
      &lt;msubsup>
        &lt;mo>&amp;int;&lt;/mo>
        &lt;mn>0&lt;/mn>
        &lt;mi>t&lt;/mi>
      &lt;/msubsup>
      &lt;mfrac>
        &lt;mrow>
          &lt;mo>&amp;dd;&lt;/mo>
          &lt;mi>x&lt;/mi>
        &lt;/mrow>
        &lt;mi>x&lt;/mi>
      &lt;/mfrac>
    &lt;/mrow>
  &lt;/annotation-xml>

&lt;/semantics>
</B></PRE>

<P>This kind of annotation is useful when something other than the
default rendering of the content encoding is desired.  For example, by
default, some renderers might layout the integrand something like
"1/<I>x dx</I>".  Specifying that the integrand should by preference
render as "<I>dx</I> / <I>x</I>" instead can be accomplished with the
use of a MathML Presentation annotation as shown.  Be aware, however,
that renderers are not required to take into account information
contained in annotations, and what use is made of them, if any, will
depend on the renderer.


<h2><A NAME="sec2.3">2.3 MathML Syntax and Grammar</A></h2>

<P>MathML is an application of XML, or Extensible Markup
Language, and as such, its syntax is governed by the rules of XML
syntax, and its grammar is in part specified by a DTD, or Document
Type Definition.  In other words, the details of using tags,
attributes, entity references and so on are defined in the <A
HREF="http://www.w3.org/TR/REC-xml">XML language
specification</A>, and the details about MathML element and attribute
names, which elements can be nested inside each other, and so on are
specified in the <A HREF="appendixA.html">MathML DTD</A>.

<P>However, MathML also specifies some syntax and grammar rules in
addition to the general rules it inherits as an XML application.
These rules allow MathML to encode a great deal more information than
would ordinarily be possible with pure XML, without introducing many
more elements, and using a substantially more complex DTD.  A grammar
for content markup expressions is given in <A
HREF="appendixE.html">Appendix E</A>.  Of course, one drawback to
using MathML specific rules is that they are invisible to generic XML
processors and validators.

<P>There are basically two kinds of additional MathML grammar and
syntax rules.  One kind involves placing additional criteria on
attribute values.  For example, it is not possible in pure XML to
require that an attribute value be a positive integer.  The second
kind of rule specifies more detailed restrictions on the
child elements (for example on ordering) than are given in the DTD.
For example, it is not possible in XML to specify that the first child
be interpreted one way, and the second in another.

<P>The following sections discuss features both of XML syntax and
grammar in general, and of MathML in particular.  Throughout the
remainder of the MathML specification, we will usually take care to
distinguish between usage required by XML syntax and the MathML DTD
and usage required by MathML specific rules.  However, we will
frequently allude to "MathML errors" without identifying which part
of the specification is being violated.

<h3><A NAME="sec2.3.1">2.3.1 An XML Syntax Primer</A></h3>

<P>Since MathML is an application of XML, the MathML Specification
uses the terminology of XML to describe it. Briefly, XML data is
composed of Unicode characters (which include ordinary ASCII
characters), "entity references" (informally called "entities") such
as "&amp;nbsp;" which usually represent "extended characters", and
"elements" such as <code>&lt;mi fontstyle="normal"&gt; x
&lt;/mi&gt;</code>.  Elements enclose other XML data called their
"content" between a "start tag" (sometimes called a "begin tag")
and an "end tag", much like in
HTML. There are also "empty elements" such as
<code>&lt;plus/&gt;</code>, whose start tag ends with
<code>/&gt;</code> to indicate that the element has no content or end
tag.  The start tag can contain named parameters called "attributes",
such as <code>fontstyle="normal"</code> in the example above. For
further details on XML, consult <A
HREF="http://www.w3.org/TR/REC-xml">the XML specification</A>.

<P>As XML is case-sensitive, MathML element and attribute
names are case-sensitive. For reasons of legibility, the MathML
defines them almost all in lowercase.

<P>In formal discussions of XML markup a distinction is maintained
between an element, such as an <b>mrow</b> element, and the tags
<b>&lt;mrow&gt;</b> and <b>&lt;/mrow&gt;</b> marking it. What is
between the <b>&lt;mrow&gt;</b> start tag and the <b>&lt;/mrow&gt;</b>
end tag is the <b>mrow</b> element's content. An "empty element" such
as <b>none</b> is defined to have no content and so has a single tag
of the form <b>&lt;none/&gt;</b>.  Usually, the distinction between
elements and tags will not be so finely drawn in this specification.
For instance, we will often refer to the <b>&lt;mrow&gt;</b> and
<b>&lt;none/&gt;</b> elements, really meaning the elements whose tags
these are, in order that references to elements are visually
distinguishable from references to attributes.  However, the words
"element" and "tag" themselves will be used strictly in accordance
with XML terminology.

<h3><A NAME="sec2.3.2">2.3.2 Children vs. Arguments</A></h3>

<P>Many MathML elements require a specific number of child elements
and/or attach additional meanings to children in certain positions.  As
noted above, these kinds of requirements are MathML specific, and
cannot be specified entirely in terms of XML syntax and grammar.  When
the children of a given MathML element are subject to these
kinds of additional conditions, we will often refer to them as
<EM>arguments</EM> instead of merely children in order to emphasize
their MathML specific usage.  Note that especially in Chapter 3 the
term "argument" is usually used in this technical sense, unless
otherwise noted, and therefore refers to a child element.

<P>In the detailed discussions of element syntax given with each element
throughout the MathML specification, the number of required arguments
and their order is implicitly indicated by giving names for the
arguments at various positions. This information is also given
for presentation elements in the table of argument requirements in
<A HREF="chap3_1.html#sec3.1.3">Section 3.1.3</A>, and for content
elements in the EBNF grammar for content markup in
<A HREF="appendixE.html">appendix E</A>.

<P>A few elements have other requirements on the number or type of
arguments.  These additional requirements are described together
with the individual elements.

<h3><A NAME="sec2.3.3">2.3.3 MathML Attribute Values</A></h3>

<P>According to the XML language specification, attributes given to
elements must have one of the forms
<BLOCKQUOTE>
<code><I>attribute-name</I> = "<I>value</I>"</code>
</BLOCKQUOTE>
or
<BLOCKQUOTE>
<code><I>attribute-name</I> = '<I>value</I>'</code>
</BLOCKQUOTE>
where whitespace around the '=' is optional.

<P>Attribute names are generally shown in <b>bold</b> within descriptive text
in this specification, but not within examples.

<P>The attribute value, which in general in MathML can be a string of
arbitrary characters, must
be surrounded by a pair of either double quotes (<code>&quot;</code>)
or single quotes (<code>'</code>).  The kind of
quotes not used to surround the value may be included within it.

<P>MathML uses a more complicated syntax for attribute values than the
generic XML syntax required by the MathML DTD. These additional rules
are intended for use by MathML applications, and it is a MathML error
to violate them, though they are not enforced by
XML processing. The MathML syntax of each attribute value is specified
in the table of attributes provided with the
description of each element it can be used with,
using a notation described below.  In MathML applications these
attribute values should be further processed as follows, unless
otherwise specified: whitespace is ignored except to separate letter
and/or digit sequences into individual words or numbers; and the same
entity references (listed in <A HREF="chapter6.html">Chapter 6</A>)
which can be used within token elements to represent characters can be
used to represent those characters in attribute values (whenever those
characters would be permitted by that attribute value's syntax).

<P>In particular, the characters <code>&quot;</code>, <code>'</code>,
and <code>&amp;</code> can be included in MathML attribute values
(when permitted by the attribute value syntax) using the entity
references <code>&amp;quot;</code>, <code>&amp;apos;</code>, and
<code>&amp;amp;</code>, respectively. (<code>&amp;lt;</code> can also
be used for <code>&lt;</code>, but this is not required in attribute
values, only in token element content.)

<P> The MathML DTD provided in <A HREF="appendixA.html">Appendix A</A>
declares most attribute value types as CDATA strings. This permits
increased interoperability with existing SGML software and allows
extension to the lists of predefined values.


<BR><A NAME="syntax-notations"></A>
<H4>Syntax notations used in the MathML specification</H4>

<P>To describe the MathML-specific syntax of permissible attribute
values, the following conventions and notations are used in
the MathML specifications for most attributes.

</P>
<TABLE>
<TR>
<TD><b>Notation</b></TD>
<TD><b>what it matches</b></TD>
</TR>

<TR>
<TD><I>number</I>&nbsp;</TD>
<TD>decimal integer or real number (digits with one
decimal point), optionally starting with '-'</TD>
</TR>

<TR>
<TD><I>unsigned-number</I>&nbsp;</TD>
<TD>decimal integer or real number, no sign</TD>
</TR>

<TR>
<TD><I>integer</I>&nbsp;</TD>
<TD>decimal integer, optionally starting with '-'</TD>
</TR>

<TR>
<TD><I>positive-integer</I>&nbsp;</TD>
<TD>decimal integer, unsigned, not 0</TD>
</TR>

<TR>
<TD><i>string</i>&nbsp;</TD>
<TD>arbitrary string (always the entire attribute value)</TD>
</TR>

<TR>
<TD><i>character</i>&nbsp;</TD>
<TD>single non-whitespace character, or MathML entity reference;
whitespace separation is optional</TD>
</TR>

<TR>
<TD>#<i>rgb</i>&nbsp;</TD>
<TD>RGB color value</TD>
</TR>

<TR>
<TD>#<i>rrggbb</i>&nbsp;</TD>
<TD>RGB color value</TD>
</TR>

<TR>
<TD><i>h-unit</i>&nbsp;</TD>
<TD>unit of horizontal length (allowable units are listed below)</TD>
</TR>

<TR>
<TD><i>v-unit</i>&nbsp;</TD>
<TD>unit of vertical length (allowable units are listed below)</TD>
</TR>

<TR>
<TD><i>css-fontfamily</i>&nbsp;&nbsp;</TD>
<TD>explained in CSS subsection, below</TD>
</TR>

<TR>
<TD><i>html-color-name</i>&nbsp;&nbsp;</TD>
<TD>explained in CSS subsection, below</TD>
</TR>

<TR>
<TD>other italicized words&nbsp;&nbsp;</TD>
<TD>explained in the text for each attribute</TD>
</TR>

<TR>
<TD><i>form</i> +</TD>
<TD>one or more instances of <i>form</i><TD>
</TR>

<TR>
<TD><i>form</i> *</TD>
<TD>zero or more instances of <i>form</i><TD>
</TR>

<TR>
<TD><i>f1</i> <i>f2</i> ... <i>fn</i>&nbsp;&nbsp;</TD>
<TD>one instance of each form, in sequence, perhaps separated by whitespace<TD>
</TR>

<TR>
<TD><i>f1</i> | <i>f2</i> | ... | <i>fn</i>&nbsp;&nbsp;</TD>
<TD>any one of the specified forms<TD>
</TR>

<TR>
<TD>[ <i>form</i> ]</TD>
<TD>optional instance of <i>form</i><TD>
</TR>

<TR>
<TD>( <i>form</i> )</TD>
<TD>same as <i>form</i><TD>
</TR>

<TR>
<TD>word in plain text</TD>
<TD>that word, literally present in attribute value
(unless it is obviously part of an explanatory phrase)<TD>
</TR>

<TR>
<TD>quoted symbol</TD>
<TD>that symbol, literally present in attribute value (e.g. "+" or '+')<TD>
</TR>

</TABLE>

<P>The order of precedence of the syntax notation operators is,
from highest to lowest precedence:

<blockquote>
<i>form</i> + &nbsp;&nbsp;&nbsp;or&nbsp;&nbsp;&nbsp; <i>form</i> *
<BR><i>f1</i> <i>f2</i> ... <i>fn</i> &nbsp;&nbsp;&nbsp;(sequence of forms)
<BR><i>f1</i> | <i>f2</i> | ... | <i>fn</i> &nbsp;&nbsp;&nbsp;(alternative
forms)
</blockquote>

<P>A <i>string</i> can contain arbitrary characters which are
specifiable within XML CDATA attribute values; it
must use entity references for certain characters, as described
earlier.  It can contain XML-format entity or character
references for any of the characters listed in <A
HREF="chapter6.html">Chapter 6</A>. No syntax rule in MathML includes <i>string</i>
as only part of an attribute value, only as the entire value.
 
<P>A <i>character</i> consists of a
single non-whitespace character or entity reference.

<P>As a simple example, the permissible values of boolean attributes
are specified as <code>true | false</code>, meaning that the entire
attribute value should be either "true" or "false".

<P>Adjacent keywords and/or numbers must be separated by whitespace in
the actual attribute values, except for unit identifiers (symbolized
by <i>h-unit</i> or <i>v-unit</i> syntax symbols) following numbers.
Whitespace is not otherwise required, but is permitted between any of
the tokens listed above, except (for compatibility with CSS1)
immediately before unit identifiers, between the '-' signs
and digits of negative numbers, or between <code>#</code> and
<i>rgb</i> or <i>rrggbb</i>.

<P>Numeric attribute values for dimensions that should depend upon the
current font can be given in font-related units, or in named absolute
units (described in a <A HREF="#units">separate subsection</A>
below). Horizontal dimensions are conventionally given in "ems", and
vertical dimensions in "exs", by immediately following a number by
one of the unit identifiers <code>em</code> or <code>ex</code>. For
example, the horizontal spacing around an operator such as "+" is
conventionally given in "ems", though other units can be used. Using
font-related units is usually preferable to using absolute units,
since it allows renderings to grow or shrink proportionately to the
current font size.

<P>For most numeric attributes, only those in a subset of the
expressible values are sensible; values outside this subset are not
errors, unless otherwise specified, but rather are rounded up or down
(at the discretion of the renderer) to the closest value within the
allowed subset.  The set of allowed values may depend on the renderer,
and is not specified by MathML.

<P>If a numeric value within an attribute value syntax description is
declared to allow a minus sign ('-'), e.g. <i>number</i> or
<i>integer</i>, it is not a syntax error to provide one, even if a
negative value is not sensible.  Instead, the value should be handled
by the processing application as described in the preceding paragraph.
An explicit plus sign ('+') is not allowed as part of a numeric value
except when it is specifically listed in the syntax (as a quoted '+'
or "+"), and its presence can change the meaning of the attribute value
(as documented with each attribute which permits it).

<P>The symbols <i>h-unit</i>, <i>v-unit</i>, <i>css-fontfamily</i>,
and <i>html-color-name</i> are explained in the following
subsections.

<BR><A NAME="units"></A><H4>Attributes with units</H4>

<P>Some attributes accept horizontal or vertical lengths as numbers
followed by a "unit identifier" (often just called a
"unit"). The syntax symbols <i>h-unit</i> and <i>v-unit</i> refer to
a unit for horizontal or vertical length, respectively. The possible
units and the lengths they refer to are shown in the table below; they are
the same for horizontal and vertical lengths, but the syntax
symbols are distinguished in attribute syntaxes as a reminder of the
direction they are each used in.

<P>The unit identifiers and meanings are taken from <A
HREF="http://www.w3.org/TR/REC-CSS1">CSS1</A>. (However, the
syntax of numbers followed by unit identifiers in MathML is not
identical to the syntax of length values with units in CSS style
sheets, since numbers in CSS can't end with decimal points, and are
allowed to start with '+' signs.)

<P>The possible horizontal or vertical units in MathML are:

</P>
<TABLE>

<TR>
<TD></TD>
<TD><b>Unit identifier</b></TD>
<TD><b>Unit description</b></TD>
</TR>

<TR>
<TD></TD>
<TD>em&nbsp;</TD>
<TD>ems (font-relative unit traditionally used for horizontal lengths)</TD>
</TR>

<TR>
<TD></TD>
<TD>ex&nbsp;</TD>
<TD>exs (font-relative unit traditionally used for vertical lengths)</TD>
</TR>

<TR>
<TD></TD>
<TD>px&nbsp;</TD>
<TD>pixels, or pixel size of a "typical computer display"</TD>
</TR>

<TR>
<TD></TD>
<TD>in&nbsp;</TD>
<TD>inches (1 inch = 2.54 centimeters)</TD>
</TR>

<TR>
<TD></TD>
<TD>cm&nbsp;</TD>
<TD>centimeters</TD>
</TR>

<TR>
<TD></TD>
<TD>mm&nbsp;</TD>
<TD>millimeters</TD>
</TR>

<TR>
<TD></TD>
<TD>pt&nbsp;</TD>
<TD>points (1 point = 1/72 inch)</TD>
</TR>

<TR>
<TD></TD>
<TD>pc&nbsp;</TD>
<TD>picas (1 pica = 12 points)</TD>
</TR>

<TR>
<TD></TD>
<TD>%&nbsp;</TD>
<TD>percentage of default value</TD>
</TR>

</TABLE>

<P>The typesetting units <em>em</em> and <em>ex</em> are defined in
the <A HREF="appendixB.html">Glossary</A>, and discussed further
under "Additional notes", below.

<P><code>%</code> is a "relative unit"; when an attribute value is
given as "<i>nnn</i>%" (for any numeric value <i>nnn</i>), the value
being specified is the default value for the property being
controlled multiplied by <i>nnn</i> divided by 100. The default value
(or the way in which it is obtained, when it is not constant) is
listed in the table of attributes for each element, and its meaning
is described in the subsequent documentation about that attribute.
(The <b>&lt;mpadded&gt;</b> element has its own syntax for
<code>%</code> and does not allow it as a unit identifier.)

<P>For consistency with CSS, length units in MathML are rarely
optional. When they are, the unit symbol is enclosed in square
brackets in the attribute syntax, following the number it applies to,
e.g. <code><i>number</i> [ <i>h-unit</i> ]</code>. The meaning of
specifying no unit is given in the documentation for each attribute;
in general it is that the number given is a multiplier for the
default value of the attribute. (In such cases, specifying the number
<i>nnn</i> without a unit is equivalent to specifying the number
<i>nnn</i> times 100 followed by <code>%</code>. For example,
<code>&lt;mo maxsize="2"&gt; ( &lt;/mo&gt;</code> is equivalent to
<code>&lt;mo maxsize="200%"&gt; ( &lt;/mo&gt;</code>.)

<P>As a special exception (also consistent with CSS),
a numeric value equal to 0 need not be followed by a unit identifier
even if the syntax specified here requires one. In such cases,
the unit identifier (or lack of one) would not matter,
since 0 times any unit is 0.

<P>For most attributes, the typical unit which would be used to
describe them in typesetting is the same as the one used in that
attribute's default value in this specification; when a specific
default value is not given, the typical unit is usually mentioned in
the syntax table or in the documentation for that attribute. The
typical unit is usually <code>em</code> or <code>ex</code>.
However, any unit can be used, unless otherwise
specified for a specific attribute.

<H5>Additional notes about units</H5>

<P>Note that some attributes (e.g. <b>framespacing</b> on <b>&lt;mtable&gt;</b>)
can contain more than one numeric value, each followed by its own unit.

<P>It is conventional to use the font-relative unit
<code>ex</code> mainly for vertical lengths, and
<code>em</code> mainly for horizontal lengths, but this is not
required. These units are relative to the font and fontsize which
would be used for rendering the element in whose attribute value they
are specified, which means they should be interpreted <i>after</i>
attributes such as <b>fontfamily</b> and <b>fontsize</b> are
processed, if those occur on the same element, since changing the
current font or fontsize can change the length of these units.

<P>The definition of the length of each unit (but not the MathML
syntax for length values) is
<A HREF="http://www.w3.org/TR/REC-CSS1#length-units">as
specified in CSS1</A>, except that if a font provides specific values
for em and/or ex which differ from the values defined by CSS1 (the
font size and 'x'-height respectively), those values should be used.


<BR><A NAME="css-compatible-attributes"></A><H4>CSS-compatible attributes</H4>

<P>Several MathML attributes, listed below, correspond closely with
text rendering properties defined by Cascading Style Sheets, Level 1
(<A HREF="http://www.w3.org/TR/REC-CSS1">CSS1</A>).

<P>The names and acceptable values of these attributes have been
aligned with the CSS1 recommendation where possible. In general, the
MathML syntax for each attribute is intended to be a subset of the
CSS syntax for the corresponding property. Differences in detail,
where they exist, are explained with the documentation about each
attribute, in the sections of this specification listed in the table.

<P>The syntax of certain attributes is partially specified,
in the tables of attribute syntax in this specification,
using one of the symbols <i>css-fontfamily</i> or
<i>html-color-name</i>, as shown in the following table. These
symbols refer to syntaxes from other W3C Recommendations, and are
explained in the sections of this specification referred to in the
table.

</P>
<TABLE>

<TR>
<TD></TD>

<TD><B>MathML attribute</B>&nbsp;&nbsp;&nbsp;</TD>

<TD><B>CSS property</B>&nbsp;&nbsp;&nbsp;</TD>

<TD><B>syntax symbol</B>&nbsp;&nbsp;&nbsp;</TD>

<TD><B>MathML elements</B>&nbsp;&nbsp;&nbsp;</TD>

<TD><B>refer to</B></TD>
</TR>

<TR>
<TD></TD>

<TD>fontsize&nbsp;</TD>

<TD>font-size&nbsp;&nbsp;</TD>

<TD>-</TD>

<TD>presentation tokens; &lt;mstyle&gt;&nbsp;&nbsp;&nbsp;</TD>

<TD><A HREF="chap3_2.html#sec3.2.1">Section 3.2.1</A></TD>
</TR>


<TR>
<TD></TD>

<TD>fontweight&nbsp;</TD>

<TD>font-weight&nbsp;&nbsp;</TD>

<TD>-</TD>

<TD>presentation tokens; &lt;mstyle&gt;&nbsp;&nbsp;&nbsp;</TD>

<TD><A HREF="chap3_2.html#sec3.2.1">Section 3.2.1</A></TD>
</TR>

<TR>
<TD></TD>

<TD>fontstyle&nbsp;</TD>

<TD>font-style&nbsp;&nbsp;</TD>

<TD>-</TD>

<TD>presentation tokens; &lt;mstyle&gt;&nbsp;&nbsp;&nbsp;</TD>

<TD><A HREF="chap3_2.html#sec3.2.1">Section 3.2.1</A></TD>
</TR>

<TR>
<TD></TD>

<TD>fontfamily&nbsp;</TD>

<TD>font-family&nbsp;&nbsp;</TD>

<TD><i>css-fontfamily</i></TD>

<TD>presentation tokens; &lt;mstyle&gt;&nbsp;&nbsp;&nbsp;</TD>

<TD><A HREF="chap3_2.html#sec3.2.1">Section 3.2.1</A></TD>
</TR>

<TR>
<TD></TD>

<TD>color&nbsp;</TD>

<TD>color&nbsp;&nbsp;</TD>

<TD><i>html-color-name</i></TD>

<TD>presentation tokens; &lt;mstyle&gt;&nbsp;&nbsp;&nbsp;</TD>

<TD><A HREF="chap3_3.html#sec3.3.4">Section 3.3.4</A></TD>
</TR>

<TR>
<TD></TD>

<TD>background&nbsp;</TD>

<TD>background&nbsp;&nbsp;</TD>

<TD><i>html-color-name</i>&nbsp;&nbsp;&nbsp;</TD>

<TD>&lt;mstyle&gt;</TD>

<TD><A HREF="chap3_3.html#sec3.3.4">Section 3.3.4</A></TD>
</TR>

</TABLE>

<P>See also <A HREF="#sec2.3.4">Section 2.3.4</A> below for a discussion
of the <B>class</B>, <B>style</B>, and <B>id</B> attributes for use
with style sheets.


<H5>Order of processing attributes vs. style sheets</H5>

<P>CSS or analogous style sheets specify changes to rendering
properties of selected MathML elements (selecting the elements in
various ways). Either the properties listed above, or any other
MathML rendering attributes or properties supported by a style sheet
mechanism, can be affected, in principle for any element. Since
rendering properties can also be changed by attributes on an element,
or automatically (which can happen to <b>fontsize</b>, as explained
in the discussion on <b>scriptlevel</b> in <A
HREF="chap3_3.html#sec3.3.4">Section 3.3.4</A>), it is necessary to
specify the relative order in which changes from various sources
occur. In the case of "absolute" changes, i.e. setting a new property
value independent of the old value (as opposed to "relative" changes,
such as increments or multiplications by a factor), the absolute
change performed last will be the only absolute change which is
effective, so the sources of changes which should have the highest
priority must be processed last.

<P>In the case of CSS1, the order of processing of changes from various
sources which affect one MathML element's rendering properties should be
as follows:

<!-- The first and last items in the following &lt;UL&gt;
(which are parenthetical remarks about the order of that list)
are intentionally not &lt;LI&gt;s, but if this violates HTML 4.0 syntax
they can be turned into &lt;LI&gt;s. -->

</P>

<BLOCKQUOTE><i>(first changes; lowest priority)</i></BLOCKQUOTE>
<UL>
<LI>automatic changes to properties or attributes based on the type of the parent
element, and this element's position in the parent, as for the changes to
<b>fontsize</b>
in relation to <b>scriptlevel</b> mentioned above;
such changes will usually be implemented by the parent element itself
before it passes a set of rendering properties to this element</LI>
<LI>style sheet from reader: styles which are <em>not</em> declared
"<A HREF="http://www.w3.org/TR/REC-CSS1#important">important</A>"</LI>
<LI>explicit attribute settings on this MathML element</LI>
<LI>style sheet from author: styles which are <em>not</em> declared "important"</LI>
<LI>style sheet from reader: styles which <em>are</em> declared "important"</LI>
<LI>style sheet from author: styles which <em>are</em> declared "important"</LI>
</UL>
<BLOCKQUOTE><i>(last changes; highest priority)</i></BLOCKQUOTE>

<P>Note that the order of the various CSS-style sheet-derived changes
is <A
HREF="http://www.w3.org/TR/REC-CSS1#cascading-order">specified
by CSS itself</A>. The following rationale is related only to the
issue of where in this preexisting order the changes caused by
explicit MathML attribute settings should be inserted.

<P>Rationale: MathML rendering attributes are analogous to HTML
rendering attributes such as ALIGN, which the CSS1 section on <A
HREF="http://www.w3.org/TR/REC-CSS1#cascading-order">cascading
order</A> specifies should be processed with the same priority.
Furthermore, this choice of priority permits readers, by declaring
certain CSS styles as "<A
HREF="http://www.w3.org/TR/REC-CSS1#important">important</A>",
to decide which of their style preferences should override explicit
attribute settings in MathML. Since MathML expressions, whether
composed of "presentation" or "content" elements, are primarily
intended to convey meaning, with their "graphic design" (if any)
intended mainly to aid in that purpose but not to be essential in it,
it is likely that readers will often want their own style preferences
to have priority; the main exception will be when a rendering
attribute is intended to alter the meaning conveyed by an expression,
which is <A HREF="chap3_3.html#warn-meaningful-space">generally
discouraged</A> in the presentation attributes of MathML.

<BR><A NAME="default-values"></A><H4>Default values of attributes</H4>

<P>Default values for MathML attributes are in general given along
with the detailed descriptions of specific elements in the text.
Default values shown in plain text, in the tables of attributes
for an element, are literal (unless they
are obviously explanatory phrases), but when italicized are
descriptions of how default values can be computed.

<P>Default values described as <i>inherited</i> are taken from the
rendering environment, as described under <A
HREF="chap3_3.html#sec3.3.4"><b>&lt;mstyle&gt;</b></A>, or in some cases
(described individually) from the values of other attributes of
surrounding elements, or from certain parts of those values.  The
value used will always be one which could have been specified
explicitly, had it been known; it will never depend on the content or
attributes of the same element, only on its environment. (What it
means when used may, however, depend on those.)

<P>Default values described as <i>automatic</i> should be computed by
a MathML renderer in a way which will produce a high-quality
rendering; how to do this is not usually specified by MathML. The value
computed will always be one which could have been specified
explicitly, had it been known, but it will usually depend on the
element content and/or the rendering environment.

<P>Other italicized descriptions of default values which appear
in the tables of attributes are explained for each
attribute individually.

<P>The single or double quotes which are required around attribute
values in an XML start tag are not shown in the tables of attribute
value syntax for each element, but are shown around example
attribute values in the text.

<P>Note that, in general, there is no value which can be given
explicitly for a MathML attribute which will simulate the effect of
not specifying the attribute at all, for attributes which are
<i>inherited</i> or <i>automatic</i>. Giving the words "inherited" or
"automatic" explicitly will not work, and is not generally allowed.
Furthermore, even for presentation attributes for which a specific
default value is documented here, the <A
HREF="chap3_3.html#sec3.3.4"><b>&lt;mstyle&gt;</b></A> element
(Section 3.3.4) can be used to change this for the elements it
contains. Therefore, the MathML DTD declares most presentation
attribute default values as #IMPLIED, which prevents XML
preprocessors from adding them with any specific default value.


<BR><A NAME="attributes-in-dtd"></A><H4>Attribute values in the MathML DTD</H4>

<P>In an XML DTD, allowed attribute values can be declared as general
strings, or they can be constrained in various ways, either by
enumerating the possible values, or by declaring them to be certain
special data types. The choice of an XML attribute type affects the
extent to which validity checks can be performed using a DTD.

<P>The MathML DTD specifies formal XML attribute types for all MathML
attributes, including enumerations of legitimate values in some
cases. In general, however, the MathML DTD is relatively permissive,
frequently declaring attribute values as strings; this is done
to provide for interoperability with SGML parsers while allowing
multiple attributes on one MathML element to accept the same values
(such as "true" and "false"), and also to allow extension to the lists
of predefined values. 

<P>At the same time, even though an attribute value may be declared as
a string in the DTD, only certain values are legitimate in MathML, as
described above and in the rest of this specification. For example,
many attributes expect numerical values.  In the sections which
follow, the allowed attribute values are described for each
element. To determine when these constraints are actually enforced in
the MathML DTD, consult <A HREF="appendixA.html">Appendix A</A>.
However, lack of enforcement of a requirement in the DTD does
<em>not</em> imply that the requirement is not part of the MathML
language itself, or that it will not be enforced by a particular
MathML renderer.  (See <A HREF="chapter7.html#sec7.2.2">Section
7.2.2</A> for a description of how MathML renderers should respond to
MathML errors.)

<P>Furthermore, the MathML DTD is provided for convenience; although
it is intended to be fully compatible with the text of the
specification, the text should be taken as definitive if there is a
contradiction. (Any contradictions which may exist between various
chapters of the text should be resolved by favoring Chapter 6 first,
then Chapters 3 and 4, then Section 2.3, and then other parts of the text.)


<h3><A NAME="sec2.3.4">2.3.4 Attributes Shared by all MathML Elements</A></h3>

<P>In order to facilitate compatibility with Cascading Style Sheets,
Level 1 (<A HREF="http://www.w3.org/TR/REC-CSS1">CSS1</A>),
all MathML elements accept <B>class</B>, <B>style</B>, and <B>id</B>
attributes in addition to the attributes described specifically for
each element. MathML renderers not supporting CSS may ignore these
attributes. (MathML specifies these attribute value syntaxes as
general strings, even if style sheet mechanisms have more restrictive
syntaxes for them. That is, any value for them is valid in MathML.)

<P>Renderers supporting CSS (or analogous style sheet mechanisms) may
use these attributes to help determine which MathML elements should
be subject to which style sheet-induced changes to various rendering
properties. The properties that can be affected, and how these
changes affect them, are discussed in the subsection
<A HREF="#css-compatible-attributes">CSS-compatible attributes</A>
in Section 2.3.3 above.

<P>Every MathML element also accepts the attribute <b>other</b>
(Section <A HREF="chapter7.html#sec7.2.3">7.2.3</A>) for passing
non-standard attributes without violating the MathML DTD. MathML
renderers are only required to process this attribute if they respond
to any attributes which are not standard in MathML.

<P>See also <A HREF="chap3_2.html#sec3.2.1">Section 3.2.1</A>
for a list of MathML attributes which can be used on most presentation 
token elements.


<h3><A NAME="sec2.3.5">2.3.5 Collapsing Whitespace in Input</A></h3>

<P>MathML ignores whitespace occurring outside token elements.
Non-whitespace characters are not allowed there.  Whitespace
occurring within the content of token elements is "trimmed" from the
ends (i.e. all whitespace at the beginning and end of the content is
removed), and "collapsed" internally (i.e. each sequence of 1 or more
whitespace characters is replaced with one blank character).

<P>In MathML, as in XML, "whitespace" means blanks, tabs, newlines, or carriage
returns, i.e. characters with hexadecimal Unicode codes U+0020, U+0009,
U+000a, or U+000d, respectively.

<P>For example, <code>&lt;mo&gt; ( &lt;/mo&gt;</code> is equivalent
to <code>&lt;mo&gt;(&lt;/mo&gt;</code>,
and

<P><code>
&lt;mtext&gt;
<BR>&nbsp;&nbsp;Theorem
<BR>&nbsp;&nbsp;1:
<BR>&lt;/mtext&gt;
</code>
<P>
is equivalent to <code>&lt;mtext&gt;Theorem 1:&lt;/mtext&gt;</code>.

<P>Authors wishing to encode whitespace characters at the start or end
of the content of a token, or in sequences other than a single blank,
without having them ignored, must use &amp;nbsp; or other "whitespace"
non-marking entities as described in <A
HREF="chapter6.html#sec6.2.1">section 6.2.1</A>.  For example, compare

<PRE>
&lt;mtext>
 Theorem
  1:
&lt;/mtext>
</PRE>

with

<PRE>
&lt;mtext>
&amp;nbsp;Theorem&amp;NewLine; &amp;nbsp;1:
&lt;/mtext> 
</PRE>

<P>When the first example is rendered, there is no whitespace before
"Theorem", one blank between "Theorem" and "1:", and no whitespace after "1:".
In the second example, a single blank is rendered before "Theorem", a
new line is placed after "Theorem", two blanks are rendered before "1:",
and there is no whitespace after the "1:".  

<P>Note that the "xml:space" attribute does not apply in this situation
since XML processors pass whitespace in tokens to a MathML
processor; it is the MathML processing rules which specify that
whitespace is trimmed and collapsed.

<P>For whitespace occurring outside the content of the token elements
<B>mi</B>, <B>mn</B>, <B>mo</B>, <B>ms</B>, <B>mtext</B>, <B>ci</B>,
<B>cn</B> and <B>annotation</B>, an
<B>mspace</B> element should be used, as opposed to an <B>mtext</B>
element containing only "whitespace" entities.

<!-- footer navigation -->
<P><HR>
Next: <A HREF="chap3_1.html">Presentation Markup -- Introduction</A><BR>
Up: <A HREF="toc.html">Table of Contents</A>
<!-- end footer navigation -->


</BODY>
</HTML>




