home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
XML Bible (2nd Edition)
/
XML_Bible_Second_Edition_Hungry_Minds_2001.iso
/
mac
/
specs
/
XML-MathML-20010221
/
xml
/
interface.xml
< prev
next >
Wrap
Text File
|
2001-02-19
|
46KB
|
1,026 lines
<div1 id="interf" role="chapter7"><head>The MathML Interface</head>
<!-- $Id: interface.xml,v 1.46 2001/02/19 10:18:59 davidc Exp $ -->
<p>To be effective, MathML must work well with a wide variety of
renderers, processors, translators and editors. This chapter addresses
some of the interface issues involved in generating and rendering
MathML. Since MathML exists primarily to encode mathematics in Web
documents, perhaps the most important interface issues are related to
embedding MathML in <bibref ref="HTML4" /> and
<bibref ref="XHTML"/>.</p>
<p>There are three kinds of interface issues that arise in embedding
MathML in other XML documents. First, MathML must be semantically
integrated. MathML markup must be recognized as valid embedded XML
content, and not as an error. This is primarily a question of
managing namespaces in XML <bibref ref="Namespaces"/>.</p>
<p>Second, in the case of HTML/XHTML, MathML rendering must be
integrated into browser software. Some browsers already implement
MathML rendering natively, and one can expect more browsers will do so
in the future. At the same time, other browsers have developed
infrastructure to facilitate the rendering of MathML and other
embedded XML content by third-party software. Using these browser
specific mechanisms generally requires some additional interface
markup of some sort to activate them.</p>
<p>Third, other tools for generating and processing MathML must be
able to intercommunicate. A number of MathML tools have been or are
being developed, including editors, translators, computer algebra
systems, and other scientific software. However, since MathML
expressions tend to be lengthy, and prone to error when entered by
hand, special emphasis must be given to insuring that MathML can be
easily generated by user-friendly conversion and authoring tools, and
that these tools work together in a dependable, platform and vendor
independent way.</p>
<p>The W3C Math Working Group is committed to providing support to software
vendors developing any kind of MathML tool. The Working Group monitors
the public mailing list
<loc href="mailto:www-math@w3.org">www-math@w3.org</loc>,
and will attempt to answer questions about the MathML specification. The
Working Group works with MathML developer
and user groups. For current information about MathML tools, applications
and user support activities, consult the
<loc href="http://www.w3.org/Math/">home page of the W3C Math Working
Group</loc>.</p>
<div2 id="interf_embed"><head>Embedding MathML in other Documents</head>
<p>While MathML can be used in isolation as a language for exchanging
mathematical expressions between MathML-aware applications, the
primary anticipated use of MathML is to encode mathematical expression
within larger documents. MathML is ideal for embedding math
expressions in other applications of XML.</p>
<p>In particular, the focus here is on the mechanics of embedding
MathML in <bibref ref="XHTML"/>. XHTML is a W3C Recommendation
formulating a family of current and future XML-based document types
and modules that reproduce, subset, and extend HTML. While <bibref
ref="HTML4"/> is the dominant language of the Web at the time of
this writing, one may anticipate a shift from HTML to XHTML.
Indeed, XHTML can already be made to render properly in most HTML user
agents.</p>
<p>Since MathML and XHTML share a common XML framework, namespaces
provide a standard mechanism for embedding MathML in XHTML. While
some popular user agents also support inclusion of MathML directly in
HTML as "XML data islands," this is a transitional strategy.
Consult user agent documentation for specific information on
its support for embedding XML in HTML.</p>
<div3 id="interf_namespace"><head>MathML and Namespaces</head>
<p>Embedding MathML in XML-based documents in general, and XHTML in
particular, is a matter of managing namespaces. See the W3C
Recommendation "Namespaces in XML" <bibref
ref="Namespaces"/> for full details.</p>
<p>An XML namespace is a collection of names identified by a URI. The
URI for the MathML namespace is:</p>
<eg>
http://www.w3.org/1998/Math/MathML
</eg>
<p>Using namespaces, embedding a MathML expression in a larger XML
document is merely a matter of identifying the MathML markup as
residing in the MathML namespace. This can be accomplished by either
explicitly identifying each MathML element name by attaching a
namespace prefix, or by declaring a default namespace on an enclosing
element.</p>
<p>To declare a namespace, one uses an <kw role="attrib">xmlns</kw>
attribute, or an attribute
with an <kw role="attrib">xmlns</kw> prefix. When the <kw
role="attrib">xmlns</kw> attribute is used alone, it sets
the default namespace for the element on which it
appears, and for any children elements.</p>
<p>Example:</p>
<eg><![CDATA[
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>...</mrow>
</math>
]]></eg>
<p>When the <kw role="attrib">xmlns</kw> attribute is used as a
prefix, it declares a
prefix which can then be used to explicitly associate other elements
and attributes with a particular namespace.</p>
<p>Example:</p>
<eg><![CDATA[
<body xmlns:m="http://www.w3.org/1998/Math/MathML">
...
<m:math><m:mrow>...</m:mrow></m:math>
...
</body>
]]></eg>
<p>These two methods of namespace declaration can be used together.
For example, by using both an explicit document-wide namespace prefix,
and default namespace declarations on individual mathematical
elements, it is possible to localize namespace related markup to the
top-level <kw role="element">math</kw> element. This is also
important for implementation with some user agents, since attaching
rendering behaviors to an element currently requires an explicit
namespace prefix in these browsers. At the same time, a number of
MathML authoring tools are not yet namespace-aware, and thus the
ability to use markup without prefixes is also desirable in the short
term.</p>
<p>Example:</p>
<eg><![CDATA[
<body xmlns:m="http://www.w3.org/1998/Math/MathML">
...
<m:math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>...<mrow>
</m:math>
...
</body>
]]></eg>
<div4 id="interf_validation"><head>Document Validation Issues</head>
<p>The use of namespace prefixes creates an issue for DTD validation
of documents embedding MathML. DTD validation requires knowing the
literal (possibly prefixed) element names used in the document.
However, the Namespaces in XML Recommendation <bibref
ref="Namespaces"/> allows the prefix to be changed at arbitrary points
in the document, since namespace prefixes may be declared on any
element.</p>
<p>The `historical' method of bridging this gap was to write a DTD
with a fixed prefix, or in the case of XHTML and MathML, with no
prefix, and mandate that the specified form must be used throughout
the document. However, this is somewhat restricting for a modular DTD
that is intended for use in conjunction with another DTD, which is
exactly the situation with MathML in XHTML. In essence, the MathML
DTD would have to allocate a prefix for itself and hope no
other module uses the same prefix to avoid name clashes, thus losing
one of the main benefits of XML namespaces.</p>
<p>One strategy for addressing this problem is to make every element
name in the DTD be accessed by an entity reference. This means that by
declaring a couple of entities to specify the prefix before the DTD is
loaded, the prefix can be chosen by a document author, and compound
DTDs that include several modules can, without changing the module
DTDs, specify unique prefixes for each module to avoid clashes. The
MathML DTD has been designed in this fashion. See <specref
ref="parsing_dtd" /> and <bibref ref="Modularization"/> for
details.</p>
<p>An extra issue arises in the case where explicit prefixes are used
on the top-level <kw role="element">math</kw> element, but a default
namespace is used for other MathML elements. In this case, one wants
the MathML module to be included into XHTML with the prefix set to
empty. However, the `driver' DTD file that sets up the inclusion of
the MathML module would then need to define a new element called
m:math. This would allow the top-level <kw role="element">math</kw>
element to use an explicit prefix, for attaching rendering behaviors
in current browsers, while the contents would not need an explicit
prefix, for ease of interoperability between authoring tools, etc.</p>
</div4>
<div4 id="interf_compatibility"><head>Compatibility Suggestions</head>
<p>While the use of namespaces to embed MathML in other XML
applications is completely described by the relevant W3C
Recommendations, a certain degree of pragmatism is still called for at
present. Support for XML, namespaces and rendering behaviors in
popular user agents is not always fully in alignment with W3C
Recommendations. In some cases, the software predates the relevant
standards, and in other cases, the relevant standards are not yet
complete.</p>
<p>During the transitional period, in which some software may not be
fully namespace-aware, a few conventional practices will ease
compatibility problems:
<olist>
<item><p>When using namespace prefixes with MathML markup, use m: as a
conventional prefix for the MathML namespace. Using an explicit
prefix is probably safer for compatibility in current user agents.
</p></item>
<item><p>When using namespace prefixes, pick one and use it
consistently within a document.
</p></item>
<item><p>Explicitly declare the MathML namespace on all
<kw role="element">math</kw> elements.
</p></item> </olist></p>
<p>Examples.</p>
<eg><![CDATA[
<body>
...
<m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
<m:mrow>...<m:mrow>
</m:math>
...
</body>
]]></eg>
<p>Or</p>
<eg><![CDATA[
<body>
...
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>...<mrow>
</math>
...
</body>
]]></eg>
<p>Note that these suggestions alone may not be sufficient for
creating functional Web pages containing MathML markup. It will
generally be the case that some additional document-wide markup will
be required. Additional work may also be required to make all MathML
instances in a document compatible with document-wide declarations.
This is particularly true when documents are created by cutting and
pasting MathML expressions, since current tools will probably not
be able to query global namespace information.</p>
<p>Consult the <loc href="http://www.w3.org/Math/">W3C Math Working
Group</loc> home page for compatibility and implementation suggestions
for current browsers and other MathML-aware tools.</p>
</div4>
</div3>
<div3 id="interf_toplevel"><head>The Top-Level
<kw role="element">math</kw> Element</head>
<p>MathML specifies a single top-level or root <kw
role="element">math</kw> element, which encapsulates each instance of
MathML markup within a document. All other MathML content must be
contained in a <kw role="element">math</kw> element; equivalently,
every valid, complete MathML expression must be contained in <kw
role="starttag">math</kw> tags. The <kw role="element">math</kw>
element must always be the outermost element in a MathML expression;
it is an error for one <kw role="element">math</kw> element to contain
another.</p>
<p>Applications that return sub-expressions of other MathML
expressions, for example, as the result of a cut-and-paste operation,
should always wrap them in <kw role="starttag">math</kw>
tags. Ideally, the presence of enclosing <kw role="starttag">math</kw>
tags should be a very good heuristic test for MathML
material. Similarly, applications which insert MathML expressions in
other MathML expressions must take care to remove the <kw
role="starttag">math</kw> tags from the inner expressions.</p>
<p>The <kw role="element">math</kw> element can contain an arbitrary number
of children schemata. The children schemata render by default as if they
were contained in an <kw role="element">mrow</kw> element.</p>
<p>The attributes of the <kw role="element">math</kw> element are:
<glist>
<gitem><label>class, id, style</label>
<def><p>Provided for use with stylesheets.</p></def>
</gitem>
<gitem><label>xref</label>
<def><p>Provided along with <kw role="attrib">id</kw> for use
with XSL processing (See <specref ref="mixing_tools" />)</p></def>
</gitem>
<gitem><label>macros</label>
<def><p>This attribute provides a way of pointing to
external macro definition files. Macros are not part of the MathML
specification, and much of the functionality provided by macros in MathML can be
accommodated by XSL transformations <bibref ref="XSLT"/>. However, the <kw
role="attrib">macros</kw> attribute is provided to make possible future
development of more streamlined, MathML-specific macro mechanisms. The
value of this attribute is a sequence of URLs or URIs, separated by
whitespace</p></def>
</gitem>
<gitem>
<label>mode</label>
<def><p>The <kw role="attrib">mode</kw> attribute specifies whether
the enclosed MathML expression should be rendered in a display style
or an in-line style. Allowed values are
<kw role="attval">display</kw> and
<kw role="attval">inline</kw> (default).
This attribute is <intref ref="interf_deprec">deprecated</intref> in
favor of the new <kw role="attrib">display</kw> attribute, or the
<loc href="http://www.w3.org/TR/CSS2/visuren.html#propdef-display">CSS2
`display' property</loc> with the analogous <kw>block</kw> and
<kw>inline</kw> values.</p></def>
</gitem>
<gitem>
<label>display</label>
<def><p>The <kw role="attrib">display</kw> attribute replaces the
deprecated <kw role="attrib">mode</kw> element. It specifies whether
the enclosed MathML expression should be rendered in a display style
or an in-line style. Allowed values are
<kw role="attval">block</kw> and
<kw role="attval">inline</kw> (default).
</p></def>
</gitem>
</glist>
</p>
<p>The attributes of the <kw role="element">math</kw> element affect
the entire enclosed expression. They are, in a sense, <quote>inward
looking</quote>. However, to render MathML properly in a browser, and
to integrate it properly into an XHTML document, a second collection
of <quote>outward looking</quote> attributes are also useful.</p>
<p>While general mechanisms for attaching rendering behaviors to
elements in XML documents are under development, wide variations in
strategy and level of implementation remain between various existing
user agents. Consequently, the remainder of this section describes
attributes and functionality that are desirable for integrating
third-party rendering modules with user agents:
<glist>
<gitem><label>overflow</label> <def><p>In cases where size negotiation
is not possible or fails (for example in the case of an extremely long
equation), this attribute is provided to suggest an alternative
processing method to the renderer. Allowed values are <glist>
<gitem><label>scroll</label> <def><p>The window provides a viewport
into the larger complete display of the mathematical
expression. Horizontal or vertical scrollbars are added to the window
as necessary to allow the viewport to be moved to a different
position.</p></def> </gitem>
<gitem><label>elide</label>
<def><p>The display is abbreviated by removing enough of it so that
the remainder fits into the window. For example, a large polynomial
might have the first and last terms displayed with <quote>+ ... +</quote> between
them. Advanced renderers may provide a facility to zoom in on elided
areas.</p></def>
</gitem>
<gitem><label>truncate</label>
<def><p>The display is abbreviated by simply truncating it at the right and
bottom borders. It is recommended that some indication of truncation is
made to the viewer.</p></def>
</gitem>
<gitem><label>scale</label>
<def><p>The fonts used to display the mathematical expression are
chosen so that the full expression fits in the window. Note that this
only happens if the expression is too large. In the case of a window
larger than necessary, the expression is shown at its normal size
within the larger window.</p></def>
</gitem>
</glist>
</p>
</def>
</gitem>
<gitem><label>altimg</label>
<def><p>This attribute provides a graceful fall-back for browsers that do
not support embedded elements. The value of the
attribute is an URL.</p></def>
</gitem>
<gitem><label>alttext</label>
<def><p>This attribute provides a graceful fall-back for browsers that do
not support embedded elements or images.
The value of the attribute is a text string.</p></def>
</gitem>
</glist>
</p>
</div3>
<div3><head>Invoking MathML Processors</head>
<p>In browsers where MathML is not natively supported, it is anticipated
that MathML rendering will be carried out via embedded objects such as
plug-ins, applets, or helper applications. The direction which has
begun emerging for invoking third-party rendering and processing
software is elucidated in the W3C Working Draft "Behavioral
Extensions to CSS" <bibref ref="Behaviors" />.</p>
<p>Behavioral extensions use the linking mechanism of CSS to attach
executable components to elements. Typically, the executable
components involve script code which manipulate the DOM to instantiate
other MathML processing components. Using experimental
implementations of behavior extensions in current user agents, it is
possible to attach processing components to <kw
role="element">math</kw> elements which then carry out the rendering
of MathML markup in an XHTML page.</p>
<p>Work on on Behavior Extensions to CSS is ongoing at W3C, and
existing implementations must be regarded as non-standard at this time.
However, it offers a very promising direction for powerful and
flexible invocation of third-party MathML processors.</p>
<p>MIME types <bibref ref="RFC2045" />, <bibref ref="RFC2046" /> offer
an alternative strategy that can also be used in current user agents
to invoke a MathML renderer. This is primarily useful when
referencing separate files containing MathML markup from an <kw
role="element">EMBED</kw> or <kw role="element">OBJECT</kw> element.
<bibref ref="RFC3023" /> assigns MathML the MIME type
<code>application/mathml+xml</code>. The W3C Math Working Group
recommends the standard file extension <code>.mml</code> used for
browser registry.</p>
<p>In MathML 1.0, <code>text/mathml</code> was given as the suggested
MIME type. This has been superceded by RFC3023.</p>
<p>Although rendering MathML expressions typically occurs in place in
a Web browser, other MathML processing functions take place more
naturally in other applications. Particularly common tasks include
opening a MathML expression in an equation editor or computer algebra
system.</p>
<p>At present, there is no standard way of selecting between various
applications which might be used to render or process embedded MathML.
As work progresses on coordination between browsers and embedded
elements and the Document Object Model <bibref ref="DOM" />, providing
this kind of functionality should be a priority. Both authors and
readers should be able to indicate a preference about what MathML
application to use in a given context. For example, one might imagine
that some mouse gesture over a MathML expression causes a browser to
present the reader with a pop-up menu, showing the various kinds of
MathML processing available on the system, and the MathML processors
recommended by the author.</p>
<p>Since MathML is most often generated by authoring tools, it is
particularly important that opening a MathML expression in an editor should
be easy to do and to implement. In many cases, it will be desirable for an
authoring tool to record some information about its internal state along
with a MathML expression, so that an author can pick up editing where he or
she left off. The MathML specification does not explicitly contain
provisions for recording information about the authoring tool. In some
circumstances, it may be possible to include authoring tool information
that applies to an entire document in the form of meta-data; interested
readers are encouraged to consult the <loc
href="http://www.w3.org/Metadata/">W3C Metadata Activity</loc> for current
information about metadata and resource definition. For encoding authoring
tool state information that applies to a particular MathML instance,
readers are referred to the possible use of the <kw
role="element">semantics</kw> element for this purpose <specref
ref="contm_semantics"/>.</p>
<p>In the short term, regardless of the methodology, implementors of
embedded MathML processing applications are encouraged to try to allow for
the following kinds of functionality:
<ulist>
<item><p>An author wishing to reach an audience as wide as possible
might want MathML to be rendered by any available processor.</p>
</item>
<item><p>An author targeting a specific audience might want to indicate that
a particular MathML processor be used.</p>
</item>
<item><p>A reader might wish to specify which of several available
processors installed locally should be used.</p>
</item>
</ulist>
</p>
</div3>
<div3 id="interf_link"><head>Mixing and Linking MathML and HTML</head>
<p>In order to fully integrate MathML into XHTML, it should be possible
not only to embed MathML in XHTML, but also to embed XHTML in MathML.
However, the problem of supporting XHTML in MathML presents many
difficulties. Therefore, at present, the MathML specification does not
permit any XHTML elements within a MathML expression, although this
may be subject to change in a future revision of MathML.</p>
<p>In most cases, XHTML elements (headings, paragraphs, lists, etc.)
either do not apply in mathematical contexts, or MathML already
provides equivalent or better functionality specifically tailored to
mathematical content (tables, mathematics style changes,
etc.). However, there are two notable exceptions, the XHTML anchor and
image elements. For this functionality, MathML relies on the general
XML linking and graphics mechanisms being developed by other W3C
Activities. </p>
<div4><head>Linking</head>
<p>MathML has no element that corresponds to the XHTML anchor element
<mi>a</mi>. In XHTML, anchors are used both to make links, and to
provide locations to which a link can be made. MathML, as an XML
application, defines links by the use of the mechanism described in
the W3C Candidate Recommendation "XML Linking Language" <bibref
ref="XLink"/>. The reader is cautioned that at the time of this writing,
XLink is not yet a Recommendation, and is therefore subject to future
revision. Since the MathML linking mechanism is defined in terms of
the XML linking specification, the same proviso holds for it as
well.</p>
<p>A MathML element is designated as a link by the presence of the
attribute <kw role="attrib">xlink:href</kw>. To use the attribute <kw
role="attrib">xlink:href</kw>, it is also necessary to declare the
appropriate namespace. Thus, a typical MathML link might look like:
<eg><![CDATA[
<mrow xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="sample.xml">
...
</mrow>
]]></eg>
</p>
<p>MathML designates that almost all elements can be used as XML linking
elements. The only elements that cannot serve as linking elements are those
such as the <kw role="element">sep</kw> element, which exist primarily to
disambiguate other MathML constructs and in general do not correspond to
any part of a typical visual rendering. The full list of exceptional
elements that cannot be used as linking elements is given in the table
below.
<table width="75%">
<thead>
<tr><td colspan="3">MathML elements that cannot be linking elements.</td></tr>
</thead>
<tbody>
<tr>
<td><kw role="element">mprescripts</kw></td>
<td><kw role="element">none</kw></td>
<td><kw role="element">sep</kw></td>
</tr>
<tr>
<td><kw role="element">malignmark</kw></td>
<td><kw role="element">maligngroup</kw></td>
<td></td>
</tr>
</tbody>
</table>
</p>
<p>Note that the XML Linking <bibref
ref="XLink"/> and XML Pointer Language <bibref
ref="XPointer"/> specifications also define how to link
<emph>into</emph> a MathML expressions. Be aware, however, that such
links may or may not be properly interpreted in current software.</p>
</div4>
<div4><head>Images</head>
<p>The <kw role="element">IMG</kw> element has no MathML
equivalent. The decision to omit a general mechanism for image
inclusion from MathML was based on several factors. However, the main
reason for not providing an image facility is that MathML takes great
pains to make the notational structure and mathematical content it
encodes easily available to processors, whereas information contained
in images is only available to a human reader looking at a visual
representation. Thus, for example, in the MathML paradigm, it would be
preferable to introduce new glyphs via the <kw
role="element">mglyph</kw> element which at a minimum identifies them
as glyphs, rather than simply including them as images.</p>
<p>Finally, apart from the introduction of new glyphs, many of the
situations where one might be inclined to use an image amount to some
sort of labeled diagram. For example, knot diagrams, Venn diagrams,
Dynkin diagrams, Feynman diagrams and complicated commutative diagrams
all fall into this category. As such, their content would be better
encoded via some combination of structured graphics and MathML markup.
Because of the generality of the <quote>labeled diagram</quote> construction, the
definition of a markup language to encode such constructions extends
beyond the scope of the current W3C Math activity.
(See <loc
href="http://www.w3.org/Graphics/">http://www.w3.org/Graphics</loc> for
further W3C activity in this area.)
</p>
</div4>
</div3>
<div3 id="interf_style"><head>Using CSS with MathML</head>
<p>When MathML is rendered in an environment
that supports CSS, controlling mathematics style properties with a CSS
stylesheet is obviously desirable.
MathML 2.0 has significantly redesigned the way presentation element
style properties are organized to facilitate better interaction
between MathML renderers and CSS style mechanisms. It introduces four
new <emph>mathematics style</emph> attributes with logical values. Roughly
speaking, these attributes can be viewed as the proper selectors for
CSS rules that affect MathML.</p>
<p>Controlling mathematics styling is not as simple as it might first appear
because mathematics styling and text styling are quite different in
character. In text, meaning is primarily carried by the relative
positioning of characters next to one another to form words. Thus,
although the font used to render text may impart nuances to the
meaning, transforming the typographic properties of the individual
characters leaves the meaning of text basically intact. By contrast,
in mathematical expressions, individual characters in specific
typefaces tend to function as atomic symbols. Thus, in the same
equation, a bold italic 'x' and a normal italic 'x' are almost always
intended to be two distinct symbols that mean different things. In
traditional usage, there are eight basic typographical categories
of symbols. These categories are described by mathematics style
attributes, primarily the <kw role="attrib">mathvariant</kw>
attribute.</p>
<p>Text and mathematics layout also obviously differ in that
mathematics uses 2-dimensional layout. As a result, many of the style
parameters that affect mathematics layout have no textual analogs.
Even in cases where there are analogous properties, the sensible
values for these properties may not correspond. For example,
traditional mathematical typography usually uses italic fonts for
single character identifiers, and upright fonts for multicharacter
identifier. In text, italicization does not usually depend on the
number of letters in a word. Thus although a font-slant property
makes sense for both mathematics and text, the natural default values
are quite different.</p>
<p>Because of the difference between text and mathematics styling, only some
aspects of MathML layout are good candidates for CSS control. MathML
2.0 captures the most important properties with the new mathematics style
attributes, and users should try to use them whenever possible over
more direct, but less robust, approaches. A sample CSS stylesheet
illustrating the use of the mathematical
style attributes is available in <specref ref="stylesheet"/></p>
<p>Generally speaking, the model for CSS interaction with the math
style attributes runs as follows. A CSS style sheet might provide a style
rule such as:</p>
<eg><![CDATA[
math *.[mathsize="small"] {
font-size: 80%
}
]]></eg>
<p>This rule sets the CSS font-size properties for all children of the
<kw role="element">math</kw> element that have the <kw
role="attrib">mathsize</kw> attribute set to small. A MathML renderer
would then query the style engine for the CSS environment, and use the
values returned as input to its own layout algorithms. MathML does
not specify the mechanism by which style information is inherited from
the environment. However, some suggested rendering rules for the
interaction between properties of the ambient style environment and
MathML-specific rendering rules are discussed in <specref
ref="presm_commatt"/>, and more generally throughout <specref
ref="presm"/>.</p>
<p>It should be stressed, however, that some caution is required in
writing CSS stylesheets for MathML. Because changing typographic
properties of mathematics symbols can change the meaning of an equation,
stylesheet should be written in a way such that changes to document-wide
typographic styles do not affect embedded MathML expressions. By
using the MathML 2.0 mathematics style attributes as selectors for CSS rules,
this danger is minimized.</p>
<p>Another pitfall to be avoided is using CSS to provide
typographic style information necessary to the proper understanding of
an expression. Expressions dependent on CSS for meaning will not be
portable to non-CSS environments such as computer algebra systems. By
using the logical values of the new MathML 2.0 mathematics style attributes
as selectors for CSS rules, it can be assured that style information
necessary to the sense of an expression is encoded directly in the
MathML.</p>
<p>MathML 2.0 does not specify how a user agent should process style
information, because there are many non-CSS MathML environments, and
because different users agents and renderers have widely varying
degrees of access to CSS information. In general, however, developers
are urged to provide as much CSS support for MathML as possible.</p>
</div3>
</div2>
<div2 id="interf_genproc"><head>Conformance</head>
<p>Information is increasingly generated, processed and rendered by
software tools. The exponential growth of the Web is fueling the
development of advanced systems for automatically searching,
categorizing, and interconnecting information. Thus, although MathML
can be written by hand and read by humans, the future of MathML is
largely tied to the ability to process it with software tools.</p>
<p>There are many different kinds of MathML editors, translators,
processors and renderers. What it means to support MathML varies
widely between applications. For example, the issues that arise with
a MathML-compliant validating parser are very different from those for
a MathML-compliant equation editor.</p>
<p>In this section, guidelines are given for describing different types
of MathML support, and for quantifying the extent of MathML support in
a given application. Developers, users and reviewers are encouraged
to use these guidelines in characterizing products. The intention
behind these guidelines is to facilitate reuse and interoperability
between MathML applications by accurately characterizing their
capabilities in quantifiable terms.</p>
<p>The W3C Math Working Group maintains <loc
href="http://www.w3.org/Math/iandi/compliance">MathML 2.0 Compliance
Guidelines</loc>. Consult this document for future updates on conformance
activities and resources.
</p>
<div3><head>MathML Compliance</head>
<p>A valid MathML expression is an XML construct determined by the MathML
DTD together with the additional requirements given in this specification.</p>
<p>Define a <quote>MathML processor</quote> to mean any application that
can accept, produce, or <quote>roundtrip</quote> a valid MathML
expression. An example of an application that might round-trip a MathML
expression might be an editor that writes a new file even though no
modifications are made.</p>
<p>Three forms of MathML compliance are specified:
<olist>
<item><p>A MathML-input-compliant processor must accept all valid MathML
expressions, and faithfully translate all MathML expressions into
application-specific form allowing native application operations to be
performed.</p>
</item>
<item><p>A MathML-output-compliant processor must generate valid MathML,
faithfully representing all application-specific data.</p>
</item>
<item><p>A MathML-roundtrip-compliant processor must preserve MathML
equivalence. Two MathML expressions are <quote>equivalent</quote> if and
only if both expressions have the same interpretation (as stated by the
MathML DTD and specification) under any circumstances, by any MathML
processor. Equivalence on an element-by-element basis is discussed
elsewhere in this document.</p>
</item>
</olist>
</p>
<p>Beyond the above definitions, the MathML specification makes no demands
of individual processors. In order to guide developers, the MathML
specification includes advisory material; for example, there are many suggested
rendering rules throughout <specref ref="presm"/>. However, in general,
developers are given wide latitude in interpreting what kind of MathML
implementation is meaningful for their own particular application.</p>
<p>To clarify the difference between compliance and interpretation of
what is meaningful, consider some examples:
<olist>
<item><p>In order to be MathML-input-compliant, a validating parser needs
only to accept expressions, and return <quote>true</quote> for
expressions that are valid MathML. In particular, it need not render or
interpret the MathML expressions at all.</p>
</item>
<item><p>A MathML computer-algebra interface based on content markup might
choose to ignore all presentation markup. Provided the interface accepts
all valid MathML expressions including those containing presentation markup,
it would be technically correct to characterize the application as
MathML-input-compliant.</p>
</item>
<item><p>An equation editor might have an internal data representation
that makes it easy to export some equations as MathML but not
others. If the editor exports the simple equations as valid MathML,
and merely displays an error message to the effect that conversion
failed for the others, it is still technically
MathML-output-compliant.</p> </item> </olist> </p>
<div4 id="interf_testsuite"><head>MathML Test Suite and Validator</head>
<p>As the previous examples show, to be useful, the concept of MathML
compliance frequently involves a judgment about what parts of the
language are meaningfully implemented, as opposed to parts that are
merely processed in a technically correct way with respect to the
definitions of compliance. This requires some mechanism for giving a
quantitative statement about which parts of MathML are meaningfully
implemented by a given application. To this end, the W3C Math Working
Group has provided a <loc href="http://www.w3.org/Math/testsuite/">test
suite</loc>.</p>
<p>The test suite consists of a large number of MathML expressions
categorized by markup category and dominant MathML element being
tested. The existence of this test suite makes it possible, for example,
to characterize quantitatively the hypothetical computer algebra interface
mentioned above by saying that it is a MathML-input compliant processor
which meaningfully implements MathML content markup, including all of
the expressions in the content markup section of the test suite.</p>
<p>Developers who choose not to implement parts of the MathML
specification in a meaningful way are encouraged to itemize the parts
they leave out by referring to specific categories in the test suite.</p>
<p>For MathML-output-compliant processors, there is also a <loc
href="http://www.w3.org/Math/validator/">MathML validator</loc>
accessible over the Web. Developers of MathML-output-compliant
processors are encouraged to verify their output using this
validator.</p>
<p>Customers of MathML applications who wish to verify claims as to which
parts of the MathML specification are implemented by an application are
encouraged to use the test suites as a part of their decision
processes.</p>
</div4>
<div4 id="interf_deprec"><head>Deprecated MathML 1.x Features</head>
<p>MathML 2.0 contains a number of MathML 1.x features which are now
deprecated. The following points define what it means for a
feature to be deprecated, and clarify the relation between
deprecated features and MathML 2.0 compliance.</p>
<olist>
<item><p>In order to be MathML-output-compliant, authoring tools may not
generate MathML markup containing deprecated features.</p></item>
<item><p>In order to be MathML-input-compliant, rendering/reading
tools must support deprecated features if they are to be
MathML 1.x compliant. They do not have to support deprecated
features to be considered MathML 2.0 compliant. However, all tools
are encouraged to support the old forms as much as
possible.</p></item>
<item><p>In order to be MathML-roundtrip-compliant, a processor need
only preserve MathML equivalence on expressions containing no
deprecated features.</p></item>
</olist>
</div4>
</div3>
<div3 id="interf_error"><head>Handling of Errors</head>
<p>If a MathML-input-compliant application receives input containing one or
more elements with an illegal number or type of attributes or child
schemata, it should nonetheless attempt to render all the input in an
intelligible way, i.e. to render normally those parts of the input that
were valid, and to render error messages (rendered as if enclosed in
an <intref ref="presm_merror"><kw role="element">merror</kw></intref>
element) in place of invalid expressions.</p>
<p>MathML-output-compliant applications such as editors and translators may
choose to generate <kw role="element">merror</kw> expressions to signal
errors in their input. This is usually preferable to generating valid, but
possibly erroneous, MathML.</p>
</div3>
<div3 id="interf_unspecified"><head>Attributes for unspecified data</head>
<p>The MathML attributes described in the MathML specification are
necessary for presentation and content markup. Ideally, the MathML
attributes should be an open-ended list so that users can add specific
attributes for specific renderers. However, this cannot be done within
the confines of a single XML DTD. Although it can be done using
extensions of the standard DTD, some authors will wish to use
non-standard attributes to take advantage of renderer-specific
capabilities while remaining strictly in compliance with the standard
DTD.</p>
<p>To allow this, the MathML 1.0 specification allowed the attribute
<kw role="attrib">other</kw> on all elements, for use as a hook to
pass on renderer-specific information. In particular, it was intended
as a hook for passing information to audio renderers, computer algebra
systems, and for pattern matching in future macro/extension
mechanisms. The motivation for this approach to the problem was
historical, looking to PostScript, for example, where comments are
widely used to pass information that is not part of PostScript.</p>
<p>In the meantime, however, the development of a general XML namespace
mechanism has made the use of the <kw role="attrib">other</kw>
attribute obsolete. In MathML 2.0, the <kw role="attrib">other</kw>
attribute is <intref ref="interf_deprec">deprecated</intref>
in favor of the use of namespace
prefixes to identify non-MathML attributes.</p>
<p>For example, in MathML 1.0, it was recommended that if additional information
was used in a renderer-specific implementation for the <kw
role="element">maction</kw> element (<specref ref="presm_maction"/>),
that information should be passed in using the <kw
role="attrib">other</kw> attribute:</p>
<eg><![CDATA[
<maction actiontype="highlight" other="color='#ff0000'"> expression </maction>
]]></eg>
<p>In MathML 2.0, a <kw role="attrib">color</kw> attribute from another
namespace would be used:</p>
<eg><![CDATA[
<body xmlns:my="http://www.example.com/MathML/extensions">
...
<maction actiontype="highlight" my:color="#ff0000"> expression </maction>
...
</body>
]]></eg>
<p>Note that the intent of allowing non-standard attributes is
<emph>not</emph> to encourage software developers to use this as a
loophole for circumventing the core conventions for MathML markup.
Authors and applications should use non-standard attributes
judiciously.</p>
</div3>
</div2>
<div2 id="interf_future"><head>Future Extensions</head>
<p>If MathML is to remain useful in the future, it is to be expected
that MathML will need to be extended and revised in various ways. Some
of these extensions can be easily foreseen; for example, as work on
behavioral extensions to CSS proceeds, MathML will likely need to be
extended as well.</p>
<p>Similarly, there are several kinds of functionality that are fairly
obvious candidates for future MathML extensions. These include macros,
style sheets, and perhaps a general facility for <quote>labeled
diagrams</quote>. However, there will no doubt be other desirable
extensions to MathML that will only emerge as MathML is widely used. For
these extensions, the W3C Math Working Group relies on the extensible
architecture of XML, and the common sense of the larger Web community.</p>
<div3><head>Macros and Style Sheets</head>
<p>The development of style-sheet mechanisms for XML is part of the ongoing
XML activity of the World Wide Web Consortium. Both XSL and CSS are working
to incorporate greater support for mathematics.</p>
<p>In particular, XSL Transformations <bibref ref="XSLT"/> are likely
to have a large impact on the future development of MathML. Macros
have traditionally contributed greatly the usability and effectiveness
of mathematics encodings. Further work developing applications of
XSLT tailored specifically to MathML is clearly called for.</p>
<p>Some of the possible uses of macro capabilities for MathML include:
<glist>
<gitem><label>Abbreviation</label>
<def><p>One common use of macros is for
abbreviation. Authors needing to repeat some complicated but constant
notation can define a macro. This greatly facilitates hand authoring.
Macros that allow for substitution of parameters facilitate such usage
even further.</p></def>
</gitem>
<gitem><label>Extension of Content Markup</label>
<def><p>By defining macros for semantic objects, for example a binomial
coefficient, or a Bessel function, one can in effect extend the content
markup for MathML. Such a macro could include an explicit semantic
binding, or such a binding could be easily added by an external
application. Narrowly defined disciplines should be able to easily
introduce standardized content markup by using standard macro packages. For
example, the OpenMath project could release macro packages for attaching
OpenMath content markup.</p></def>
</gitem>
<gitem><label>Rendering and Style Control</label>
<def><p>Another basic way in which macros are often used is to provide a
way of controlling style and rendering behavior by replacing high-level
macro definitions. This is especially important for controlling the
rendering behavior of MathML content tags in a context sensitive way. Such
a macro capability is also necessary to provide a way of attaching
renderings to user-defined XML extensions to the MathML core.</p></def>
</gitem>
<gitem><label>Accessibility</label>
<def><p>Reader-controlled style sheets are important in providing
accessibility to MathML. For example, a reader listening to a voice
renderer might, by default, hear a bit of MathML presentation markup read as
<quote>D sub x sup 2 of f</quote>. Knowing the context to be multi-variable
calculus, the reader may wish to use a style sheet or macro package that
instructs the renderer to render this <kw role="starttag">msubsup</kw>
element as <quote>second derivative with respect to x of f</quote>.</p></def>
</gitem>
</glist>
</p>
</div3>
<div3><head>XML Extensions to MathML</head>
<p>The set of elements and attributes specified in the MathML
specification are necessary for rendering common mathematical expressions.
It is recognized that not all mathematical notation is covered by this
set of elements, that new notations are continually invented, and that
sub-communities within mathematics often have specialized notations;
and furthermore that the explicit extension of a standard is a
necessarily slow and conservative process. This implies that the
MathML standard could never explicitly cover all the presentational
forms used by every sub-community of authors and readers of
mathematics, much less encode all mathematical content.</p>
<p>In order to facilitate the use of MathML by the widest possible
audience, and to enable its smooth evolution to encompass more
notational forms and more mathematical content (perhaps eventually
covered by explicit extensions to the standard), the set of tags and
attributes is open-ended, in the sense described in this section.</p>
<p>MathML is described by an XML DTD, which necessarily limits the elements
and attributes to those occurring in the DTD. Renderers desiring to accept
non-standard elements or attributes, and authors desiring to include these
in documents, should accept or produce documents that conform to an
appropriately extended XML DTD that has the standard MathML DTD
as a subset.</p>
<p>MathML-compliant renderers are allowed, but not required, to accept
non-standard elements and attributes, and to render them in any way. If a
renderer does not accept some or all non-standard tags, it is encouraged
either to handle them as errors as described above for elements with the
wrong number of arguments, or to render their arguments as if they were
arguments to an <kw role="element">mrow</kw>, in either case rendering all
standard parts of the input in the normal way.</p>
</div3>
</div2>
</div1>