mml 2.3.0 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitmodules +9 -0
- data/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +83 -18
- data/Gemfile +0 -2
- data/README.adoc +176 -47
- data/Rakefile +16 -1
- data/lib/mml/base/common_attributes.rb +44 -0
- data/lib/mml/base/content/annotation.rb +28 -0
- data/lib/mml/base/content/annotation_xml.rb +31 -0
- data/lib/mml/base/content/apply.rb +27 -0
- data/lib/mml/base/content/arith.rb +243 -0
- data/lib/mml/base/content/bind.rb +27 -0
- data/lib/mml/base/content/bvar.rb +20 -0
- data/lib/mml/base/content/calculus.rb +103 -0
- data/lib/mml/base/content/cbytes.rb +24 -0
- data/lib/mml/base/content/cerror.rb +24 -0
- data/lib/mml/base/content/ci.rb +77 -0
- data/lib/mml/base/content/cn.rb +33 -0
- data/lib/mml/base/content/condition.rb +20 -0
- data/lib/mml/base/content/constants.rb +173 -0
- data/lib/mml/base/content/cs.rb +22 -0
- data/lib/mml/base/content/csymbol.rb +79 -0
- data/lib/mml/base/content/declare.rb +34 -0
- data/lib/mml/base/content/degree.rb +20 -0
- data/lib/mml/base/content/elementary_functions.rb +309 -0
- data/lib/mml/base/content/fn.rb +25 -0
- data/lib/mml/base/content/functions.rb +85 -0
- data/lib/mml/base/content/interval.rb +24 -0
- data/lib/mml/base/content/inverse.rb +25 -0
- data/lib/mml/base/content/lambda.rb +20 -0
- data/lib/mml/base/content/linear_algebra.rb +122 -0
- data/lib/mml/base/content/logic.rb +93 -0
- data/lib/mml/base/content/otherwise.rb +20 -0
- data/lib/mml/base/content/piece.rb +20 -0
- data/lib/mml/base/content/piecewise.rb +20 -0
- data/lib/mml/base/content/relations.rb +113 -0
- data/lib/mml/base/content/reln.rb +19 -0
- data/lib/mml/base/content/semantics.rb +27 -0
- data/lib/mml/base/content/sep.rb +19 -0
- data/lib/mml/base/content/sets.rb +163 -0
- data/lib/mml/base/content/share.rb +22 -0
- data/lib/mml/base/content/statistics.rb +95 -0
- data/lib/mml/base/content/vector_calculus.rb +63 -0
- data/lib/mml/base/content_loader.rb +195 -0
- data/lib/mml/base/maction.rb +1 -0
- data/lib/mml/base/math.rb +47 -0
- data/lib/mml/base/menclose.rb +1 -1
- data/lib/mml/base/mfenced.rb +2 -2
- data/lib/mml/base/mglyph.rb +2 -2
- data/lib/mml/base/mi.rb +9 -6
- data/lib/mml/base/mlabeledtr.rb +2 -6
- data/lib/mml/base/mn.rb +3 -2
- data/lib/mml/base/mo.rb +3 -3
- data/lib/mml/base/mrow.rb +0 -2
- data/lib/mml/base/ms.rb +4 -6
- data/lib/mml/base/mscarries.rb +1 -1
- data/lib/mml/base/mspace.rb +0 -2
- data/lib/mml/base/mstyle.rb +4 -8
- data/lib/mml/base/mtable.rb +8 -0
- data/lib/mml/base/mtd.rb +6 -0
- data/lib/mml/base/mtext.rb +0 -2
- data/lib/mml/base/semantics.rb +4 -2
- data/lib/mml/base/universal_presentation_attributes.rb +46 -0
- data/lib/mml/base/v3_common.rb +16 -0
- data/lib/mml/base/v3_presentation_attributes.rb +15 -0
- data/lib/mml/base/v4_attributes.rb +4 -18
- data/lib/mml/base.rb +11 -0
- data/lib/mml/common_elements.rb +336 -0
- data/lib/mml/context_configuration.rb +29 -0
- data/lib/mml/v2/annotation.rb +9 -0
- data/lib/mml/v2/annotation_xml.rb +9 -0
- data/lib/mml/v2/apply.rb +9 -0
- data/lib/mml/v2/arith.rb +93 -0
- data/lib/mml/v2/bind.rb +9 -0
- data/lib/mml/v2/bvar.rb +9 -0
- data/lib/mml/v2/calculus.rb +33 -0
- data/lib/mml/v2/ci.rb +9 -0
- data/lib/mml/v2/cn.rb +9 -0
- data/lib/mml/v2/common_elements.rb +34 -0
- data/lib/mml/v2/condition.rb +9 -0
- data/lib/mml/v2/configuration.rb +13 -0
- data/lib/mml/v2/constants.rb +65 -0
- data/lib/mml/v2/csymbol.rb +9 -0
- data/lib/mml/v2/degree.rb +9 -0
- data/lib/mml/v2/elementary_functions.rb +121 -0
- data/lib/mml/v2/fn.rb +9 -0
- data/lib/mml/v2/functions.rb +29 -0
- data/lib/mml/v2/interval.rb +9 -0
- data/lib/mml/v2/inverse.rb +9 -0
- data/lib/mml/v2/lambda.rb +9 -0
- data/lib/mml/v2/linear_algebra.rb +41 -0
- data/lib/mml/v2/logic.rb +33 -0
- data/lib/mml/v2/maction.rb +9 -0
- data/lib/mml/v2/maligngroup.rb +9 -0
- data/lib/mml/v2/malignmark.rb +9 -0
- data/lib/mml/v2/math.rb +11 -0
- data/lib/mml/v2/menclose.rb +9 -0
- data/lib/mml/v2/merror.rb +9 -0
- data/lib/mml/v2/mfenced.rb +9 -0
- data/lib/mml/v2/mfrac.rb +9 -0
- data/lib/mml/v2/mfraction.rb +9 -0
- data/lib/mml/v2/mglyph.rb +9 -0
- data/lib/mml/v2/mi.rb +9 -0
- data/lib/mml/v2/mlabeledtr.rb +9 -0
- data/lib/mml/v2/mlongdiv.rb +9 -0
- data/lib/mml/v2/mmultiscripts.rb +9 -0
- data/lib/mml/v2/mn.rb +9 -0
- data/lib/mml/v2/mo.rb +10 -0
- data/lib/mml/v2/mover.rb +9 -0
- data/lib/mml/v2/mpadded.rb +9 -0
- data/lib/mml/v2/mphantom.rb +9 -0
- data/lib/mml/v2/mprescripts.rb +9 -0
- data/lib/mml/v2/mroot.rb +9 -0
- data/lib/mml/v2/mrow.rb +9 -0
- data/lib/mml/v2/ms.rb +9 -0
- data/lib/mml/v2/mscarries.rb +9 -0
- data/lib/mml/v2/mscarry.rb +9 -0
- data/lib/mml/v2/msgroup.rb +9 -0
- data/lib/mml/v2/msline.rb +9 -0
- data/lib/mml/v2/mspace.rb +9 -0
- data/lib/mml/v2/msqrt.rb +9 -0
- data/lib/mml/v2/msrow.rb +9 -0
- data/lib/mml/v2/mstack.rb +9 -0
- data/lib/mml/v2/mstyle.rb +10 -0
- data/lib/mml/v2/msub.rb +9 -0
- data/lib/mml/v2/msubsup.rb +9 -0
- data/lib/mml/v2/msup.rb +9 -0
- data/lib/mml/v2/mtable.rb +9 -0
- data/lib/mml/v2/mtd.rb +9 -0
- data/lib/mml/v2/mtext.rb +9 -0
- data/lib/mml/v2/mtr.rb +9 -0
- data/lib/mml/v2/munder.rb +9 -0
- data/lib/mml/v2/munderover.rb +9 -0
- data/lib/mml/v2/namespace.rb +7 -0
- data/lib/mml/v2/none.rb +9 -0
- data/lib/mml/v2/otherwise.rb +9 -0
- data/lib/mml/v2/piece.rb +9 -0
- data/lib/mml/v2/piecewise.rb +9 -0
- data/lib/mml/v2/relations.rb +41 -0
- data/lib/mml/v2/reln.rb +13 -0
- data/lib/mml/v2/semantics.rb +9 -0
- data/lib/mml/v2/sep.rb +9 -0
- data/lib/mml/v2/sets.rb +57 -0
- data/lib/mml/v2/statistics.rb +33 -0
- data/lib/mml/v2/vector_calculus.rb +21 -0
- data/lib/mml/v2.rb +311 -0
- data/lib/mml/v3/annotation.rb +10 -0
- data/lib/mml/v3/annotation_xml.rb +10 -0
- data/lib/mml/v3/apply.rb +10 -0
- data/lib/mml/v3/arith.rb +115 -0
- data/lib/mml/v3/bind.rb +10 -0
- data/lib/mml/v3/calculus.rb +40 -0
- data/lib/mml/v3/cbytes.rb +10 -0
- data/lib/mml/v3/cerror.rb +10 -0
- data/lib/mml/v3/ci.rb +10 -0
- data/lib/mml/v3/cn.rb +10 -0
- data/lib/mml/v3/common_elements.rb +34 -0
- data/lib/mml/v3/constants.rb +80 -0
- data/lib/mml/v3/constructs.rb +55 -0
- data/lib/mml/v3/cs.rb +10 -0
- data/lib/mml/v3/csymbol.rb +10 -0
- data/lib/mml/v3/deprecated_content.rb +29 -0
- data/lib/mml/v3/elementary_functions.rb +145 -0
- data/lib/mml/v3/functions.rb +35 -0
- data/lib/mml/v3/linear_algebra.rb +50 -0
- data/lib/mml/v3/logic.rb +40 -0
- data/lib/mml/v3/maction.rb +1 -1
- data/lib/mml/v3/math.rb +7 -1
- data/lib/mml/v3/mi.rb +1 -0
- data/lib/mml/v3/mn.rb +1 -0
- data/lib/mml/v3/mo.rb +1 -0
- data/lib/mml/v3/mrow.rb +1 -0
- data/lib/mml/v3/ms.rb +1 -0
- data/lib/mml/v3/mstyle.rb +1 -0
- data/lib/mml/v3/mtext.rb +1 -0
- data/lib/mml/v3/relations.rb +50 -0
- data/lib/mml/v3/sets.rb +70 -0
- data/lib/mml/v3/statistics.rb +40 -0
- data/lib/mml/v3/vector_calculus.rb +25 -0
- data/lib/mml/v3.rb +25 -0
- data/lib/mml/v4/a.rb +4 -3
- data/lib/mml/v4/annotation.rb +10 -0
- data/lib/mml/v4/annotation_xml.rb +14 -0
- data/lib/mml/v4/apply.rb +9 -0
- data/lib/mml/v4/arith.rb +93 -0
- data/lib/mml/v4/calculus.rb +25 -0
- data/lib/mml/v4/cbytes.rb +9 -0
- data/lib/mml/v4/cerror.rb +9 -0
- data/lib/mml/v4/ci.rb +9 -0
- data/lib/mml/v4/cn.rb +9 -0
- data/lib/mml/v4/common_elements.rb +33 -0
- data/lib/mml/v4/constants.rb +65 -0
- data/lib/mml/v4/constructs.rb +49 -0
- data/lib/mml/v4/cs.rb +9 -0
- data/lib/mml/v4/csymbol.rb +9 -0
- data/lib/mml/v4/deprecated_content.rb +25 -0
- data/lib/mml/v4/elementary_functions.rb +118 -0
- data/lib/mml/v4/factorof.rb +9 -0
- data/lib/mml/v4/functions.rb +30 -0
- data/lib/mml/v4/limit.rb +9 -0
- data/lib/mml/v4/linear_algebra.rb +41 -0
- data/lib/mml/v4/logic.rb +33 -0
- data/lib/mml/v4/maction.rb +1 -2
- data/lib/mml/v4/maligngroup.rb +0 -1
- data/lib/mml/v4/malignmark.rb +0 -1
- data/lib/mml/v4/math.rb +1 -1
- data/lib/mml/v4/menclose.rb +0 -1
- data/lib/mml/v4/merror.rb +0 -1
- data/lib/mml/v4/mfenced.rb +0 -1
- data/lib/mml/v4/mfrac.rb +0 -1
- data/lib/mml/v4/mfraction.rb +0 -1
- data/lib/mml/v4/mglyph.rb +0 -1
- data/lib/mml/v4/mi.rb +1 -1
- data/lib/mml/v4/mlabeledtr.rb +0 -1
- data/lib/mml/v4/mlongdiv.rb +0 -1
- data/lib/mml/v4/mmultiscripts.rb +0 -1
- data/lib/mml/v4/mn.rb +1 -1
- data/lib/mml/v4/mo.rb +1 -1
- data/lib/mml/v4/mover.rb +0 -1
- data/lib/mml/v4/mpadded.rb +0 -1
- data/lib/mml/v4/mphantom.rb +0 -1
- data/lib/mml/v4/mprescripts.rb +0 -1
- data/lib/mml/v4/mroot.rb +0 -1
- data/lib/mml/v4/mrow.rb +1 -1
- data/lib/mml/v4/ms.rb +1 -1
- data/lib/mml/v4/mscarries.rb +0 -1
- data/lib/mml/v4/mscarry.rb +0 -1
- data/lib/mml/v4/msgroup.rb +0 -1
- data/lib/mml/v4/msline.rb +0 -1
- data/lib/mml/v4/mspace.rb +0 -1
- data/lib/mml/v4/msqrt.rb +0 -1
- data/lib/mml/v4/msrow.rb +0 -1
- data/lib/mml/v4/mstack.rb +0 -1
- data/lib/mml/v4/mstyle.rb +1 -1
- data/lib/mml/v4/msub.rb +0 -1
- data/lib/mml/v4/msubsup.rb +0 -1
- data/lib/mml/v4/msup.rb +0 -1
- data/lib/mml/v4/mtable.rb +0 -1
- data/lib/mml/v4/mtd.rb +0 -1
- data/lib/mml/v4/mtext.rb +1 -1
- data/lib/mml/v4/mtr.rb +0 -1
- data/lib/mml/v4/munder.rb +0 -1
- data/lib/mml/v4/munderover.rb +0 -1
- data/lib/mml/v4/none.rb +0 -1
- data/lib/mml/v4/relations.rb +37 -0
- data/lib/mml/v4/semantics.rb +0 -1
- data/lib/mml/v4/sets.rb +57 -0
- data/lib/mml/v4/statistics.rb +33 -0
- data/lib/mml/v4/tendsto.rb +9 -0
- data/lib/mml/v4/vector_calculus.rb +21 -0
- data/lib/mml/v4.rb +421 -44
- data/lib/mml/version.rb +1 -1
- data/lib/mml/versioned_parser.rb +1 -1
- data/lib/mml.rb +3 -1
- data/reference-docs/mathml-source/pubtext/mathmlspec.dtd +150 -0
- data/reference-docs/mathml-source/pubtext/xmlspec.dtd +2649 -0
- data/reference-docs/mathml-source/readme.txt +40 -0
- data/reference-docs/mathml-source/run +296 -0
- data/reference-docs/mathml-source/style/html/html2xhtml.xsl +216 -0
- data/reference-docs/mathml-source/style/html/images.xsl +98 -0
- data/reference-docs/mathml-source/style/html/mml6.xsl +1156 -0
- data/reference-docs/mathml-source/style/html/mmldiff.xsl +566 -0
- data/reference-docs/mathml-source/style/html/mmlspec.xsl +2531 -0
- data/reference-docs/mathml-source/style/html/slices-common.xsl +312 -0
- data/reference-docs/mathml-source/style/html/slices.xsl +48 -0
- data/reference-docs/mathml-source/style/html/xmlspec.xsl +2542 -0
- data/reference-docs/mathml-source/style/pdf/mathmlspec.xsl +2510 -0
- data/reference-docs/mathml-source/xml/changes.xml +773 -0
- data/reference-docs/mathml-source/xml/character-set.xml +1011 -0
- data/reference-docs/mathml-source/xml/content-element-def.xml +6143 -0
- data/reference-docs/mathml-source/xml/content-markup.xml +8178 -0
- data/reference-docs/mathml-source/xml/contributors.xml +425 -0
- data/reference-docs/mathml-source/xml/dom-bindings.xml +20 -0
- data/reference-docs/mathml-source/xml/dom-intro.xml +114 -0
- data/reference-docs/mathml-source/xml/fundamentals.xml +1646 -0
- data/reference-docs/mathml-source/xml/glossary.xml +519 -0
- data/reference-docs/mathml-source/xml/interface.xml +1096 -0
- data/reference-docs/mathml-source/xml/introduction.xml +724 -0
- data/reference-docs/mathml-source/xml/mathml-css-sample.xml +304 -0
- data/reference-docs/mathml-source/xml/mathml-dom.xml +3813 -0
- data/reference-docs/mathml-source/xml/mathml-spec.xml +356 -0
- data/reference-docs/mathml-source/xml/mixing.xml +982 -0
- data/reference-docs/mathml-source/xml/operator-dict.xml +551 -0
- data/reference-docs/mathml-source/xml/parsing.xml +2565 -0
- data/reference-docs/mathml-source/xml/presentation-markup.xml +6834 -0
- data/reference-docs/mathml-source/xml/references.xml +323 -0
- data/reference-docs/mathml-source/xml/validation-grammar.xml +877 -0
- data/schemas/README.adoc +17 -0
- data/schemas/mathml2/common/common-attribs.xsd +41 -0
- data/schemas/mathml2/common/math.xsd +126 -0
- data/schemas/mathml2/common/xlink-href.xsd +20 -0
- data/schemas/mathml2/content/CVS/Entries +16 -0
- data/schemas/mathml2/content/CVS/Repository +1 -0
- data/schemas/mathml2/content/CVS/Root +1 -0
- data/schemas/mathml2/content/arith.xsd +90 -0
- data/schemas/mathml2/content/calculus.xsd +146 -0
- data/schemas/mathml2/content/common-attrib.xsd +30 -0
- data/schemas/mathml2/content/constants.xsd +83 -0
- data/schemas/mathml2/content/constructs.xsd +260 -0
- data/schemas/mathml2/content/elementary-functions.xsd +117 -0
- data/schemas/mathml2/content/functions.xsd +73 -0
- data/schemas/mathml2/content/linear-algebra.xsd +173 -0
- data/schemas/mathml2/content/logic.xsd +53 -0
- data/schemas/mathml2/content/relations.xsd +55 -0
- data/schemas/mathml2/content/semantics.xsd +85 -0
- data/schemas/mathml2/content/sets.xsd +236 -0
- data/schemas/mathml2/content/statistics.xsd +136 -0
- data/schemas/mathml2/content/tokens.xsd +120 -0
- data/schemas/mathml2/content/tokens.xsd.~1.3.~ +119 -0
- data/schemas/mathml2/content/vector-calculus.xsd +88 -0
- data/schemas/mathml2/mathml2.xsd +59 -0
- data/schemas/mathml2/presentation/action.xsd +44 -0
- data/schemas/mathml2/presentation/characters.xsd +37 -0
- data/schemas/mathml2/presentation/common-attribs.xsd +113 -0
- data/schemas/mathml2/presentation/common-types.xsd +103 -0
- data/schemas/mathml2/presentation/error.xsd +40 -0
- data/schemas/mathml2/presentation/layout.xsd +195 -0
- data/schemas/mathml2/presentation/scripts.xsd +186 -0
- data/schemas/mathml2/presentation/space.xsd +52 -0
- data/schemas/mathml2/presentation/style.xsd +69 -0
- data/schemas/mathml2/presentation/table.xsd +216 -0
- data/schemas/mathml2/presentation/tokens.xsd +124 -0
- data/schemas/mathml3/mathml3-common.xsd +99 -0
- data/schemas/mathml3/mathml3-content.xsd +684 -0
- data/schemas/mathml3/mathml3-presentation.xsd +2151 -0
- data/schemas/mathml3/mathml3-strict-content.xsd +186 -0
- data/schemas/mathml3/mathml3.xsd +9 -0
- data/schemas/mathml4/mathml4-content.rnc +382 -0
- data/schemas/mathml4/mathml4-core.rnc +361 -0
- data/schemas/mathml4/mathml4-presentation.rnc +358 -0
- data/schemas/mathml4/mathml4-strict-content.rnc +86 -0
- data/schemas/mathml4/mathml4.rnc +21 -0
- data/schemas/mathml4/mathml4.rnc.1 +21 -0
- data/schemas/mathml4/mathml4.rng +37 -0
- metadata +249 -2
|
@@ -0,0 +1,1646 @@
|
|
|
1
|
+
<div1 id="fund" role="chapter2"><head>MathML Fundamentals</head>
|
|
2
|
+
<!-- $Id: fundamentals.xml,v 1.60 2003/09/08 13:04:48 davidc Exp $ -->
|
|
3
|
+
|
|
4
|
+
<div2 id="fund_overview"><head>MathML Overview</head>
|
|
5
|
+
|
|
6
|
+
<p>This chapter introduces the basic ideas of MathML. The first section
|
|
7
|
+
describes the overall design of MathML. The second section presents a
|
|
8
|
+
number of motivating examples, to give the reader something concrete to
|
|
9
|
+
refer to while reading subsequent chapters of the MathML specification.
|
|
10
|
+
The final section describes basic features of the MathML syntax and
|
|
11
|
+
grammar, which apply to all MathML markup. In particular, <specref
|
|
12
|
+
ref="fund_syntax"/> should be read <emph>before</emph> <specref
|
|
13
|
+
ref="presm"/>, <specref ref="contm"/> and <specref ref="mixing"/>.</p>
|
|
14
|
+
|
|
15
|
+
<p>A fundamental challenge in defining a markup language for mathematics on
|
|
16
|
+
the Web is reconciling the need to encode both the presentation of a
|
|
17
|
+
mathematical notation and the content of the mathematical idea or object
|
|
18
|
+
which it represents.</p>
|
|
19
|
+
|
|
20
|
+
<p>The relationship between a mathematical notation and a mathematical idea
|
|
21
|
+
is subtle and deep. On a formal level, the results of mathematical logic
|
|
22
|
+
raise unsettling questions about the correspondence between systems of
|
|
23
|
+
symbolic logic and the phenomena they model. At a more intuitive level,
|
|
24
|
+
anyone who uses mathematical notation knows the difference that a good
|
|
25
|
+
choice of notation can make; the symbolic structure of the notation
|
|
26
|
+
suggests the logical structure. For example, the Leibniz notation for
|
|
27
|
+
derivatives <quote>suggests</quote> the chain rule of calculus through the
|
|
28
|
+
symbolic cancellation of fractions: <graphic role="inline"
|
|
29
|
+
source="image/f2001.gif" alt="\frac{d f}{d x}\frac{d x}{d t}=\frac{d f}{d
|
|
30
|
+
t}"/>.</p>
|
|
31
|
+
|
|
32
|
+
<p>Mathematicians and teachers intuitively understand this very well; part
|
|
33
|
+
of their expertise lies in choosing notation that emphasizes key aspects of
|
|
34
|
+
a problem while hiding or diminishing extraneous aspects. It is
|
|
35
|
+
commonplace in mathematics and science to write one thing when strictly
|
|
36
|
+
technically something else is meant, because long experience shows this
|
|
37
|
+
actually communicates the idea better at some higher level than rigorous
|
|
38
|
+
detail.</p>
|
|
39
|
+
|
|
40
|
+
<p>In many other settings, though, mathematical notation is used to encode
|
|
41
|
+
the full, precise meaning of a mathematical object. Mathematical notation
|
|
42
|
+
is capable of prodigious rigor, and when used carefully, it can be
|
|
43
|
+
virtually free of ambiguity. Moreover, it is precisely this lack of
|
|
44
|
+
ambiguity which makes it possible to describe mathematical objects so that
|
|
45
|
+
they can be used by software applications such as computer algebra systems
|
|
46
|
+
and voice renderers. In situations where such inter-application
|
|
47
|
+
communication is of paramount importance, the nuances of visual
|
|
48
|
+
presentation generally play a minimal role.</p>
|
|
49
|
+
|
|
50
|
+
<p>MathML allows authors to encode both the notation which represents a
|
|
51
|
+
mathematical object and the mathematical structure of the object
|
|
52
|
+
itself. Moreover, authors can mix both kinds of encoding in order to
|
|
53
|
+
specify both the presentation and content of a mathematical idea. The
|
|
54
|
+
remainder of this section gives a basic overview of how MathML can be used
|
|
55
|
+
in each of these ways.</p>
|
|
56
|
+
|
|
57
|
+
<div3><head>Taxonomy of MathML Elements</head>
|
|
58
|
+
|
|
59
|
+
<p>All MathML elements fall into one of three categories: presentation
|
|
60
|
+
elements, content elements and interface elements. Each of these categories
|
|
61
|
+
is described in detail in <specref ref="presm"/>, <specref ref="contm"/>
|
|
62
|
+
and <specref ref="interf"/>, respectively.</p>
|
|
63
|
+
|
|
64
|
+
<p>Presentation elements describe mathematical notation's visually oriented
|
|
65
|
+
two-dimensional structure. Typical examples are the
|
|
66
|
+
<intref ref="presm_mrow"><el>mrow</el></intref>
|
|
67
|
+
element, which is usually employed to indicate a
|
|
68
|
+
horizontal row of pieces of expressions, and the
|
|
69
|
+
<intref ref="presm_msup"><el>msup</el></intref> element, which is used to mark up a base
|
|
70
|
+
expression and a superscript to it. As a general rule, each presentation
|
|
71
|
+
element corresponds to a single kind of notational <quote>schema</quote>
|
|
72
|
+
such as a row, a superscript, a subscript, an underscript and so on.
|
|
73
|
+
Any formula is made by putting together parts which ultimately can
|
|
74
|
+
be analyzed down to the simplest items such as digits, letters, or
|
|
75
|
+
other symbol characters.</p>
|
|
76
|
+
|
|
77
|
+
<p>Although the previous paragraph was concerned with the display
|
|
78
|
+
aspect of mathematical notation, and hence with presentation markup,
|
|
79
|
+
the same observation about decomposition applies equally well to
|
|
80
|
+
abstract mathematical objects, and hence to content markup. For
|
|
81
|
+
example, in the context of content markup a superscript would
|
|
82
|
+
typically be denoted by an exponentiation operation that would require
|
|
83
|
+
two operands: a <quote>base</quote> and an
|
|
84
|
+
<quote>exponent</quote>. This is no coincidence, since as a general
|
|
85
|
+
rule, mathematical notation's layout closely follows the logical
|
|
86
|
+
structure of the underlying mathematical objects.</p>
|
|
87
|
+
|
|
88
|
+
<p>The recursive nature of mathematical objects and notation is strongly
|
|
89
|
+
reflected in MathML markup. In use, most presentation or content elements
|
|
90
|
+
contain some number of other MathML elements corresponding to the
|
|
91
|
+
constituent pieces out of which the original object is recursively
|
|
92
|
+
built. The original schema is commonly called the <emph>parent</emph>
|
|
93
|
+
schema, and the constituent pieces are called <emph>child</emph>
|
|
94
|
+
schemata. More generally, MathML expressions can be regarded as trees,
|
|
95
|
+
where each node corresponds to a MathML element, the branches under a
|
|
96
|
+
<quote>parent</quote> node correspond to its <quote>children</quote>, and
|
|
97
|
+
the leaves in the tree correspond to atomic notation or content units such
|
|
98
|
+
as numbers, characters, etc.</p>
|
|
99
|
+
|
|
100
|
+
<p>Most leaf nodes in a MathML expression tree are either <emph>canonically
|
|
101
|
+
empty elements</emph> with no bodies, or <emph>token elements</emph>.
|
|
102
|
+
Canonically empty elements represent symbols directly in MathML, for
|
|
103
|
+
example, the content element
|
|
104
|
+
<intref ref="contm_plus"><el role="emptytag">plus</el></intref> does
|
|
105
|
+
this. MathML token elements are the only MathML elements permitted to
|
|
106
|
+
contain MathML character data. MathML character data consists of
|
|
107
|
+
Unicode characters with the infrequent addition of special
|
|
108
|
+
character constructions done with the
|
|
109
|
+
<intref ref="presm_mglyph"><el>mglyph</el></intref>
|
|
110
|
+
element. A third kind of leaf node
|
|
111
|
+
permitted in MathML is the
|
|
112
|
+
<intref ref="contm_annotation"><el>annotation</el></intref> element,
|
|
113
|
+
which is used to hold data which is not in MathML format.</p>
|
|
114
|
+
|
|
115
|
+
<p>The most important presentation token elements are
|
|
116
|
+
<intref ref="presm_mi"><el>mi</el></intref>,
|
|
117
|
+
<intref ref="presm_mn"><el>mn</el></intref> and
|
|
118
|
+
<intref ref="presm_mo"><el>mo</el></intref> for representing identifiers, numbers and operators
|
|
119
|
+
respectively. Typically a renderer will employ slightly different
|
|
120
|
+
typesetting styles for each of these kinds of character data: numbers are
|
|
121
|
+
usually in upright font, identifiers in italics, and operators have extra
|
|
122
|
+
space around them. In content markup, there are only three tokens,
|
|
123
|
+
<intref ref="contm_ci"><el>ci</el></intref>,
|
|
124
|
+
<intref ref="contm_cn"><el>cn</el></intref> and
|
|
125
|
+
<intref ref="contm_csymbol"><el>csymbol</el></intref>, for identifiers, numbers and new symbols
|
|
126
|
+
introduced in the document itself, respectively. In content markup,
|
|
127
|
+
separate elements are provided for commonly used functions and
|
|
128
|
+
operators. The
|
|
129
|
+
<intref ref="contm_apply"><el>apply</el></intref> element is provided for
|
|
130
|
+
user-defined extensions to the base set.</p>
|
|
131
|
+
|
|
132
|
+
<p>In terms of markup, most MathML elements are denoted by a
|
|
133
|
+
<emph>start</emph> tag and an <emph>end</emph> tag, which enclose the
|
|
134
|
+
markup for their contents. In the case of tokens, the content is
|
|
135
|
+
character data, and in most other cases, the content is the markup for
|
|
136
|
+
child elements. Elements in a third category, called canonically empty
|
|
137
|
+
elements, do not require any contents, and are denoted by a single tag of
|
|
138
|
+
the form <el namespace="" role="emptytag">name</el>. An example of this kind of
|
|
139
|
+
markup is <el role="emptytag">plus</el> in content markup.</p>
|
|
140
|
+
|
|
141
|
+
<p>Let us take the very simple example of (<var>a</var> +
|
|
142
|
+
<var>b</var>)<sup>2</sup>, and we can now see how the
|
|
143
|
+
principles discussed above play out in practice. One form of
|
|
144
|
+
presentation markup for this example is:
|
|
145
|
+
<eg role='mathml'><![CDATA[
|
|
146
|
+
<mrow>
|
|
147
|
+
<msup>
|
|
148
|
+
<mfenced>
|
|
149
|
+
<mrow>
|
|
150
|
+
<mi>a</mi>
|
|
151
|
+
<mo>+</mo>
|
|
152
|
+
<mi>b</mi>
|
|
153
|
+
</mrow>
|
|
154
|
+
</mfenced>
|
|
155
|
+
<mn>2</mn>
|
|
156
|
+
</msup>
|
|
157
|
+
</mrow>
|
|
158
|
+
]]></eg></p>
|
|
159
|
+
|
|
160
|
+
<p>This example demonstrates a number of presentation elements. The first
|
|
161
|
+
element, one that is used a great deal is
|
|
162
|
+
<intref ref="presm_mrow"><el>mrow</el></intref>.
|
|
163
|
+
This element is used to denote a row of horizontally aligned material. The
|
|
164
|
+
material contained between the <el role="starttag">mrow</el> and <el role="endtag">mrow</el> tags is considered to be an argument to the <el>mrow</el> element. Thus the whole expression here is
|
|
165
|
+
contained in an <el>mrow</el> element. As previously noted,
|
|
166
|
+
almost all mathematical expressions decompose into subexpressions. These
|
|
167
|
+
subexpressions can, in turn, also be contained in an <el>mrow</el> element. For example, a + b is also contained in an
|
|
168
|
+
<el>mrow</el>.</p>
|
|
169
|
+
|
|
170
|
+
<p>The
|
|
171
|
+
<intref ref="presm_mfenced"><el>mfenced</el></intref> element is used to provide fences
|
|
172
|
+
(braces, brackets, and parentheses) around formula material. It defaults
|
|
173
|
+
to using parentheses.</p>
|
|
174
|
+
|
|
175
|
+
<p>Note the use of the
|
|
176
|
+
<intref ref="presm_mi"><el>mi</el></intref> element for displaying
|
|
177
|
+
the variables a and b and the
|
|
178
|
+
<intref ref="presm_mo"><el>mo</el></intref> element for
|
|
179
|
+
marking the + operator.</p>
|
|
180
|
+
|
|
181
|
+
<p>The
|
|
182
|
+
<intref ref="presm_msup"><el>msup</el></intref> element is for expressions involving
|
|
183
|
+
superscripts and takes two arguments, in order, the base expression (here,
|
|
184
|
+
(<var>a</var>+<var>b</var>)) and the exponent expression (here, 2).</p>
|
|
185
|
+
|
|
186
|
+
<p>The content markup for the same example is:
|
|
187
|
+
<eg role='mathml'><![CDATA[
|
|
188
|
+
<mrow>
|
|
189
|
+
<apply>
|
|
190
|
+
<power/>
|
|
191
|
+
<apply>
|
|
192
|
+
<plus/>
|
|
193
|
+
<ci>a</ci>
|
|
194
|
+
<ci>b</ci>
|
|
195
|
+
</apply>
|
|
196
|
+
<cn>2</cn>
|
|
197
|
+
</apply>
|
|
198
|
+
</mrow>
|
|
199
|
+
]]></eg></p>
|
|
200
|
+
|
|
201
|
+
<p>Here, the
|
|
202
|
+
<intref ref="contm_apply"><el>apply</el></intref> content element means apply an
|
|
203
|
+
operation to an expression. In this example, the <el>power</el> element (for exponentiation), which requires no
|
|
204
|
+
body, and the similar
|
|
205
|
+
<intref ref="contm_plus"><el>plus</el></intref> element (for addition)
|
|
206
|
+
are both <emph>applied</emph>. Observe that both operators take two
|
|
207
|
+
arguments, the order being particularly significant in the case of the
|
|
208
|
+
power operator. But the order of the children is crucial in the use
|
|
209
|
+
of the <el>apply</el> since the first child, the operator,
|
|
210
|
+
takes as argument list the remaining ones. </p>
|
|
211
|
+
|
|
212
|
+
<p>Note the use of the
|
|
213
|
+
<intref ref="contm_ci"><el>ci</el></intref> element to mark up the
|
|
214
|
+
variables a and b, and the
|
|
215
|
+
<intref ref="contm_cn"><el>cn</el></intref> element to mark up
|
|
216
|
+
the number 2.</p>
|
|
217
|
+
|
|
218
|
+
</div3>
|
|
219
|
+
|
|
220
|
+
<div3>
|
|
221
|
+
<head>Presentation Markup</head>
|
|
222
|
+
|
|
223
|
+
<p>MathML presentation markup consists of about 30 elements which accept
|
|
224
|
+
over 50 attributes. Most of the elements correspond to <emph>layout
|
|
225
|
+
schemata</emph>, which contain other presentation elements. Each layout
|
|
226
|
+
schema corresponds to a two-dimensional notational device, such as a
|
|
227
|
+
superscript or subscript, fraction or table. In addition, there are the
|
|
228
|
+
presentation token elements
|
|
229
|
+
<intref ref="presm_mi"><el>mi</el></intref>,
|
|
230
|
+
<intref ref="presm_mo"><el>mo</el></intref> and
|
|
231
|
+
<intref ref="presm_mn"><el>mn</el></intref> introduced above, as
|
|
232
|
+
well as several other less commonly used token elements. The remaining few
|
|
233
|
+
presentation elements are empty elements, and are used mostly in connection
|
|
234
|
+
with alignment.</p>
|
|
235
|
+
|
|
236
|
+
<p>The layout schemata fall into several classes. One group of
|
|
237
|
+
elements is concerned with scripts, and contains elements such as
|
|
238
|
+
<intref ref="presm_msub"><el>msub</el></intref>,
|
|
239
|
+
<intref ref="presm_munder"><el>munder</el></intref>,
|
|
240
|
+
and <intref ref="presm_mmultiscripts"><el>mmultiscripts</el></intref>. Another group focuses on
|
|
241
|
+
more general layout and includes <intref ref="presm_mrow"><el>mrow</el></intref>, <intref ref="presm_mstyle"><el>mstyle</el></intref>, and <intref ref="presm_mfrac"><el>mfrac</el></intref>. A third group deals with tables.
|
|
242
|
+
The <intref ref="presm_maction"><el>maction</el></intref> element is in a category by
|
|
243
|
+
itself, and allows coding of various kinds of actions on notation,
|
|
244
|
+
such as occur in an expression which toggles between two pieces of
|
|
245
|
+
notation.</p>
|
|
246
|
+
|
|
247
|
+
<p>An important feature of many layout schemata is that the order of child
|
|
248
|
+
schemata is significant. For example, the first child of an
|
|
249
|
+
<intref ref="presm_mfrac"><el>mfrac</el></intref> element is the numerator and the second child is
|
|
250
|
+
the denominator. Since the order of child schemata is not enforced at the
|
|
251
|
+
XML level by the MathML DTD, the information added by ordering is only
|
|
252
|
+
available to a MathML processor, as opposed to a generic XML processor.
|
|
253
|
+
When we want to emphasize that a MathML element such as
|
|
254
|
+
<intref ref="presm_mfrac"><el>mfrac</el></intref> requires children in a specific order, we will
|
|
255
|
+
refer to them as <emph>arguments</emph>, and think of the
|
|
256
|
+
<el>mfrac</el> element as a notational
|
|
257
|
+
<quote>constructor</quote>.</p>
|
|
258
|
+
</div3>
|
|
259
|
+
|
|
260
|
+
<div3><head>Content Markup</head>
|
|
261
|
+
|
|
262
|
+
<p>Content markup consists of about 120 elements accepting roughly a dozen
|
|
263
|
+
attributes. The majority of these elements are empty elements corresponding
|
|
264
|
+
to a wide variety of operators, relations and named functions. Examples of
|
|
265
|
+
this sort include
|
|
266
|
+
<intref ref="contm_partialdiff"><el>partialdiff</el></intref>,
|
|
267
|
+
<intref ref="contm_leq"><el>leq</el></intref> and
|
|
268
|
+
<intref ref="contm_trig"><el>tan</el></intref>. Others such as
|
|
269
|
+
<intref ref="contm_matrix"><el>matrix</el></intref> and
|
|
270
|
+
<intref ref="contm_set"><el>set</el></intref> are used to
|
|
271
|
+
encode various mathematical data types, and a third, important category of
|
|
272
|
+
content elements such as
|
|
273
|
+
<intref ref="contm_apply"><el>apply</el></intref> are used to apply
|
|
274
|
+
operations to expressions and also to make new mathematical objects from
|
|
275
|
+
others.</p>
|
|
276
|
+
|
|
277
|
+
<p>The
|
|
278
|
+
<el>apply</el> element is perhaps the single most
|
|
279
|
+
important content element. It is used to apply a function or operation to a
|
|
280
|
+
collection of arguments. The positions of the child schemata are again
|
|
281
|
+
significant, with the first child denoting the function to be applied, and
|
|
282
|
+
the remaining children denoting the arguments of the function in
|
|
283
|
+
order. Note that the <el>apply</el> construct always uses
|
|
284
|
+
prefix notation, like the programming language LISP. In particular, even
|
|
285
|
+
binary operations such as subtraction are marked up by applying a prefix
|
|
286
|
+
subtraction operator to two arguments. For example, <var>a</var> -
|
|
287
|
+
<var>b</var> would be marked up as
|
|
288
|
+
<eg role='mathml'><![CDATA[
|
|
289
|
+
<mrow>
|
|
290
|
+
<apply>
|
|
291
|
+
<minus/>
|
|
292
|
+
<ci>a</ci>
|
|
293
|
+
<ci>b</ci>
|
|
294
|
+
</apply>
|
|
295
|
+
</mrow>
|
|
296
|
+
]]></eg>
|
|
297
|
+
</p>
|
|
298
|
+
|
|
299
|
+
<p>A number of functions and operations require one or more quantifiers to
|
|
300
|
+
be well-defined. For example, in addition to an integrand, a definite
|
|
301
|
+
integral must specify the limits of integration and the bound variable. For
|
|
302
|
+
this reason, there are several <emph>qualifier</emph> schemata such as
|
|
303
|
+
<intref ref="contm_bvar"><el>bvar</el></intref> and
|
|
304
|
+
<intref ref="contm_lowlimit"><el>lowlimit</el></intref>. They are
|
|
305
|
+
used with operators such as
|
|
306
|
+
<intref ref="contm_diff"><el>diff</el></intref> and
|
|
307
|
+
<intref ref="contm_int"><el>int</el></intref>.</p>
|
|
308
|
+
|
|
309
|
+
<p>The
|
|
310
|
+
<intref ref="contm_declare"><el>declare</el></intref> construct is especially important
|
|
311
|
+
for content markup that might be evaluated by a computer algebra system.
|
|
312
|
+
The <el>declare</el> element provides a basic assignment
|
|
313
|
+
mechanism, where a variable can be declared to be of a certain type, with a
|
|
314
|
+
certain value.</p>
|
|
315
|
+
|
|
316
|
+
<p>
|
|
317
|
+
In both the presentation and content markup examples, mathematical
|
|
318
|
+
expressions are recursively decomposed into nested, simpler MathML
|
|
319
|
+
elements specifying each stage of the decomposition. The examples in
|
|
320
|
+
the following sections illustrate this with more complex expressions.
|
|
321
|
+
</p>
|
|
322
|
+
|
|
323
|
+
</div3>
|
|
324
|
+
|
|
325
|
+
<div3><head>Mixing Presentation and Content</head>
|
|
326
|
+
|
|
327
|
+
<p>Different kinds of markup will be found most appropriate for different
|
|
328
|
+
kinds of tasks. Documents written before the World Wide Web became
|
|
329
|
+
important were most often intended only for visual communication of
|
|
330
|
+
information, so that legacy data is probably best translated into pure
|
|
331
|
+
presentation markup, since semantic information about what the author meant
|
|
332
|
+
can only be guessed at heuristically. By contrast, some mathematical
|
|
333
|
+
applications and pedagogically-oriented authoring tools will likely choose
|
|
334
|
+
to be entirely content-based. The majority of applications fall somewhere
|
|
335
|
+
in between these extremes. For these applications, the most appropriate
|
|
336
|
+
markup is a mixture of both presentation and content markup.</p>
|
|
337
|
+
|
|
338
|
+
<p>The rules for mixing presentation and content markup derive from the
|
|
339
|
+
general principle that mixed content should only be allowed in places where
|
|
340
|
+
it makes sense. For content markup embedded in presentation markup this
|
|
341
|
+
basically means that any content fragments should be semantically
|
|
342
|
+
meaningful, and should not require additional arguments or quantifiers to
|
|
343
|
+
be fully specified. For presentation markup embedded in content markup,
|
|
344
|
+
this usually means that presentation markup must be contained in a content
|
|
345
|
+
token element, so that it will be treated as an indivisible notational unit
|
|
346
|
+
used as a variable or function name.</p>
|
|
347
|
+
|
|
348
|
+
<p>Another option is to use a
|
|
349
|
+
<intref ref="contm_semantics"><el>semantics</el></intref> element.
|
|
350
|
+
The <el>semantics</el> element is used to bind MathML
|
|
351
|
+
expressions to various kinds of annotations. One common use for the <el>semantics</el> element is to bind a piece of content markup
|
|
352
|
+
to some presentation markup as a semantic annotation. In this way, an
|
|
353
|
+
author can specify a non-standard notation to be used when displaying a
|
|
354
|
+
particular content expression. Another use of the <el>semantics</el> element is to bind some other kind of
|
|
355
|
+
semantic specification, such as an OpenMath expression, to a MathML
|
|
356
|
+
expression. In this way, the <el>semantics</el> element can
|
|
357
|
+
be used to extend the scope of MathML content markup.</p>
|
|
358
|
+
</div3>
|
|
359
|
+
</div2>
|
|
360
|
+
|
|
361
|
+
<div2 id="fund_document"><head>MathML in a Document</head>
|
|
362
|
+
|
|
363
|
+
<p>The discussion above has actually been of fragmentary formulas
|
|
364
|
+
outside the context of any document. To be more specific let us look
|
|
365
|
+
at what corresponds to a programming language's "Hello
|
|
366
|
+
World!" example. We shall provide more complete code for an <xspecref
|
|
367
|
+
href="http://www.w3.org/TR/xhtml1/#well-formed">XHTML 1.0
|
|
368
|
+
document</xspecref> containing the square of a sum of two variables
|
|
369
|
+
mentioned above. It would be
|
|
370
|
+
|
|
371
|
+
<eg role="mathml-fragment"><![CDATA[
|
|
372
|
+
|
|
373
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
374
|
+
|
|
375
|
+
<head>
|
|
376
|
+
<title>MathML's Hello Square</title>
|
|
377
|
+
</head>
|
|
378
|
+
|
|
379
|
+
<body>
|
|
380
|
+
|
|
381
|
+
<p> This is a perfect square:</p>
|
|
382
|
+
|
|
383
|
+
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
|
384
|
+
<mrow>
|
|
385
|
+
<msup>
|
|
386
|
+
<mfenced>
|
|
387
|
+
<mrow>
|
|
388
|
+
<mi>a</mi>
|
|
389
|
+
<mo>+</mo>
|
|
390
|
+
<mi>b</mi>
|
|
391
|
+
</mrow>
|
|
392
|
+
</mfenced>
|
|
393
|
+
<mn>2</mn>
|
|
394
|
+
</msup>
|
|
395
|
+
</mrow>
|
|
396
|
+
</math>
|
|
397
|
+
|
|
398
|
+
</body>
|
|
399
|
+
</html>
|
|
400
|
+
]]></eg>
|
|
401
|
+
</p>
|
|
402
|
+
|
|
403
|
+
<p>Here we have the normal structure of an XHTML document. It begins
|
|
404
|
+
with the start tag <el namespace="xhtml" role="starttag">html</el> embellished with an
|
|
405
|
+
XML namespace declaration and language assertions. A <el namespace="xhtml">head</el> element contains a title as is customary.
|
|
406
|
+
<phrase diff="chg">Within the <el namespace="xhtml">body</el> is
|
|
407
|
+
a simple paragraph followed by a <el>math</el> element
|
|
408
|
+
which has the MathML namespace declared.</phrase> Inside the <el>math</el> element is MathML markup.
|
|
409
|
+
<phrase diff="del">
|
|
410
|
+
as we are beginning to be used to it.
|
|
411
|
+
The reasons why one might have to do a more complex
|
|
412
|
+
namespace declaration for MathML are explained in <specref
|
|
413
|
+
ref="interf"/>; they have to do with present-day limitations in some XML
|
|
414
|
+
handling, that may be expected to go away.
|
|
415
|
+
</phrase>
|
|
416
|
+
</p>
|
|
417
|
+
|
|
418
|
+
<p>For the next level of technical detail concerning such matters
|
|
419
|
+
as <code>!DOCTYPE</code> statements and the like, see the
|
|
420
|
+
discussion in <specref ref="interf"/>.
|
|
421
|
+
</p>
|
|
422
|
+
|
|
423
|
+
</div2>
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
<div2 id="fund_examples">
|
|
427
|
+
<head>Some MathML Examples</head>
|
|
428
|
+
|
|
429
|
+
<p>
|
|
430
|
+
We continue below to display examples in the form of fragments of
|
|
431
|
+
MathML markup such as would appear inside <el>math</el>
|
|
432
|
+
elements in real documents. For the sake of clearer exposition of
|
|
433
|
+
principles, the examples in Chapters 3, 4, 5 and 6 follow this form of
|
|
434
|
+
giving examples as MathML fragments.
|
|
435
|
+
</p>
|
|
436
|
+
|
|
437
|
+
<div3 id="fund_pres"><head>Presentation Examples</head>
|
|
438
|
+
|
|
439
|
+
<p>Notation: <var>x</var><sup>2</sup> + 4<var>x</var> + 4 = 0.</p>
|
|
440
|
+
|
|
441
|
+
<p>Markup:
|
|
442
|
+
<eg role='mathml'><![CDATA[
|
|
443
|
+
<mrow>
|
|
444
|
+
<mrow>
|
|
445
|
+
<msup>
|
|
446
|
+
<mi>x</mi>
|
|
447
|
+
<mn>2</mn>
|
|
448
|
+
</msup>
|
|
449
|
+
<mo>+</mo>
|
|
450
|
+
<mrow>
|
|
451
|
+
<mn>4</mn>
|
|
452
|
+
<mo>⁢</mo>
|
|
453
|
+
<mi>x</mi>
|
|
454
|
+
</mrow>
|
|
455
|
+
<mo>+</mo>
|
|
456
|
+
<mn>4</mn>
|
|
457
|
+
</mrow>
|
|
458
|
+
<mo>=</mo>
|
|
459
|
+
<mn>0</mn>
|
|
460
|
+
</mrow>
|
|
461
|
+
]]></eg>
|
|
462
|
+
Note the use of nested <intref ref="presm_mrow"><el>mrow</el></intref> elements to denote terms, for
|
|
463
|
+
example, the left-hand side of the equation functioning as an operand
|
|
464
|
+
of <quote>=</quote>. Marking terms greatly facilitates spacing for
|
|
465
|
+
visual rendering, voice rendering, and line breaking. The <kw role="entity">InvisibleTimes</kw> MathML character entity is used here
|
|
466
|
+
to indicate to a renderer that there are special spacing rules between
|
|
467
|
+
the 4 and the x, and that the 4 and the x should not be broken onto
|
|
468
|
+
separate lines.
|
|
469
|
+
<phrase diff="del">
|
|
470
|
+
In fact, this use of an entity which was introduced
|
|
471
|
+
in MathML 1.0 is no longer the way that is preferred. Ultimately all
|
|
472
|
+
ordinary character data is given by Unicode values. However, although
|
|
473
|
+
a character for <kw role="entity">InvisibleTimes</kw> is expected in
|
|
474
|
+
Unicode 3.2, and there is a suggested code point under
|
|
475
|
+
consideration in a Unicode amendment, there is no Unicode 3.0
|
|
476
|
+
character to be used at present. We could use the expected numerical
|
|
477
|
+
character reference &#2062; but for clarity we will continue to
|
|
478
|
+
use entity references in these examples. The situation is explicitly
|
|
479
|
+
discussed in <specref ref="presm_tokel"/> and in <specref
|
|
480
|
+
ref="chars"/>.
|
|
481
|
+
</phrase>
|
|
482
|
+
</p>
|
|
483
|
+
|
|
484
|
+
<p>Notation:
|
|
485
|
+
<graphic role="inline" source="image/f1002.gif"
|
|
486
|
+
alt="x = \frac{-b\pm\sqrt{b^2 - 4ac}}{2a}"/>.</p>
|
|
487
|
+
|
|
488
|
+
<p>Markup:
|
|
489
|
+
<eg role='mathml'><![CDATA[
|
|
490
|
+
<mrow>
|
|
491
|
+
<mi>x</mi>
|
|
492
|
+
<mo>=</mo>
|
|
493
|
+
<mfrac>
|
|
494
|
+
<mrow>
|
|
495
|
+
<mrow>
|
|
496
|
+
<mo>-</mo>
|
|
497
|
+
<mi>b</mi>
|
|
498
|
+
</mrow>
|
|
499
|
+
<mo>±</mo>
|
|
500
|
+
<msqrt>
|
|
501
|
+
<mrow>
|
|
502
|
+
<msup>
|
|
503
|
+
<mi>b</mi>
|
|
504
|
+
<mn>2</mn>
|
|
505
|
+
</msup>
|
|
506
|
+
<mo>-</mo>
|
|
507
|
+
<mrow>
|
|
508
|
+
<mn>4</mn>
|
|
509
|
+
<mo>⁢</mo>
|
|
510
|
+
<mi>a</mi>
|
|
511
|
+
<mo>⁢</mo>
|
|
512
|
+
<mi>c</mi>
|
|
513
|
+
</mrow>
|
|
514
|
+
</mrow>
|
|
515
|
+
</msqrt>
|
|
516
|
+
</mrow>
|
|
517
|
+
<mrow>
|
|
518
|
+
<mn>2</mn>
|
|
519
|
+
<mo>⁢</mo>
|
|
520
|
+
<mi>a</mi>
|
|
521
|
+
</mrow>
|
|
522
|
+
</mfrac>
|
|
523
|
+
</mrow>
|
|
524
|
+
]]></eg>
|
|
525
|
+
|
|
526
|
+
The
|
|
527
|
+
<intref ref="presm_mfrac"><el>mfrac</el></intref> and
|
|
528
|
+
<intref ref="presm_mroot"><el>msqrt</el></intref>
|
|
529
|
+
elements are used for generating fractions
|
|
530
|
+
and square roots, respectively.</p>
|
|
531
|
+
|
|
532
|
+
<p>Notice that the <quote>plus or minus</quote> sign is given by
|
|
533
|
+
<phrase diff="chg">the</phrase> entity name <kw role="entity">PlusMinus</kw>,
|
|
534
|
+
<phrase diff="chg">this is equivalent to using the character reference</phrase> &#00B1;.
|
|
535
|
+
MathML provides a very comprehensive list of character names for
|
|
536
|
+
mathematical symbols. In addition to the mathematical symbols needed for
|
|
537
|
+
screen and print rendering, MathML provides symbols to facilitate audio
|
|
538
|
+
rendering. For audio rendering, it is important to be able to
|
|
539
|
+
automatically determine whether
|
|
540
|
+
<eg role='mathml'><![CDATA[
|
|
541
|
+
<mrow>
|
|
542
|
+
<mi>z</mi>
|
|
543
|
+
<mfenced>
|
|
544
|
+
<mrow>
|
|
545
|
+
<mi>x</mi>
|
|
546
|
+
<mo>+</mo>
|
|
547
|
+
<mi>y</mi>
|
|
548
|
+
</mrow>
|
|
549
|
+
</mfenced>
|
|
550
|
+
</mrow>
|
|
551
|
+
]]></eg>
|
|
552
|
+
|
|
553
|
+
should be read as '<var>z</var> times the quantity <var>x</var> plus
|
|
554
|
+
<var>y</var>' or '<var>z</var> of <var>x</var> plus <var>y</var>'. The
|
|
555
|
+
characters <kw role="entity">InvisibleTimes</kw> (U+2062) and <kw
|
|
556
|
+
role="entity">ApplyFunction</kw> (U+2061) provide a way for authors to
|
|
557
|
+
directly encode the distinction for audio renderers. For instance, in
|
|
558
|
+
the first case <kw role="entity">InvisibleTimes</kw> (U+2062) should
|
|
559
|
+
be inserted after the line containing the <var>z</var>. MathML also
|
|
560
|
+
introduces entities like <kw role="entity">dd</kw> (U+2146)
|
|
561
|
+
representing a <quote>differential d</quote>, which renders with slightly
|
|
562
|
+
different spacing in print and can be rendered as <quote>d</quote> or
|
|
563
|
+
<quote>with respect to</quote> in speech. Unless content tags, or some
|
|
564
|
+
other mechanism, are used to eliminate the ambiguity, authors should
|
|
565
|
+
always use these characters here referred to as entities, in order to
|
|
566
|
+
make their documents more accessible.</p>
|
|
567
|
+
|
|
568
|
+
<p>Notation:
|
|
569
|
+
<graphic role="inline" source="image/f2008.gif"
|
|
570
|
+
alt="A=\left[\begin{array}{cc} x & y \\ z & w \end{array}\right]"/>.</p>
|
|
571
|
+
|
|
572
|
+
<p>Markup:
|
|
573
|
+
<eg role='mathml'><![CDATA[
|
|
574
|
+
<mrow>
|
|
575
|
+
<mi>A</mi>
|
|
576
|
+
<mo>=</mo>
|
|
577
|
+
<mfenced open="[" close="]">
|
|
578
|
+
<mtable>
|
|
579
|
+
<mtr>
|
|
580
|
+
<mtd><mi>x</mi></mtd>
|
|
581
|
+
<mtd><mi>y</mi></mtd>
|
|
582
|
+
</mtr>
|
|
583
|
+
<mtr>
|
|
584
|
+
<mtd><mi>z</mi></mtd>
|
|
585
|
+
<mtd><mi>w</mi></mtd>
|
|
586
|
+
</mtr>
|
|
587
|
+
</mtable>
|
|
588
|
+
</mfenced>
|
|
589
|
+
</mrow>
|
|
590
|
+
]]></eg> The <el>mtable</el> element denotes that a
|
|
591
|
+
MathML table is being created. The <el>mtr</el>
|
|
592
|
+
specifies a row of the table and the <el>mtd</el>
|
|
593
|
+
element holds the data for an element of a row. Most elements have a
|
|
594
|
+
number of attributes that control the details of their screen and
|
|
595
|
+
print rendering. For example, there are several attributes for the <el>mfenced</el> element that controls what delimiters
|
|
596
|
+
should be used at the beginning and the end of the grouped expression
|
|
597
|
+
above. The attributes for operator elements given using <el role="starttag">mo</el> are set to default values determined by a
|
|
598
|
+
dictionary. For the suggested MathML operator dictionary, see <specref
|
|
599
|
+
ref="oper-dict"/>.</p>
|
|
600
|
+
|
|
601
|
+
</div3>
|
|
602
|
+
|
|
603
|
+
<div3 id="fund_cont"><head>Content Examples</head>
|
|
604
|
+
|
|
605
|
+
<!-- ION -->
|
|
606
|
+
|
|
607
|
+
<p>Notation: <var>x</var><sup>2</sup> + 4<var>x</var> + 4 = 0.</p>
|
|
608
|
+
|
|
609
|
+
<p>Markup:
|
|
610
|
+
<eg role='mathml'><![CDATA[
|
|
611
|
+
<mrow>
|
|
612
|
+
<apply>
|
|
613
|
+
<eq/>
|
|
614
|
+
<apply>
|
|
615
|
+
<plus/>
|
|
616
|
+
<apply>
|
|
617
|
+
<power/>
|
|
618
|
+
<ci>x</ci>
|
|
619
|
+
<cn>2</cn>
|
|
620
|
+
</apply>
|
|
621
|
+
<apply>
|
|
622
|
+
<times/>
|
|
623
|
+
<cn>4</cn>
|
|
624
|
+
<ci>x</ci>
|
|
625
|
+
</apply>
|
|
626
|
+
<cn>4</cn>
|
|
627
|
+
</apply>
|
|
628
|
+
<cn>0</cn>
|
|
629
|
+
</apply>
|
|
630
|
+
</mrow>
|
|
631
|
+
]]></eg>
|
|
632
|
+
Note that the <el>apply</el> element is used for
|
|
633
|
+
relations, operators and functions.</p>
|
|
634
|
+
|
|
635
|
+
<p>Notation:
|
|
636
|
+
<graphic diff="chg" role="inline" source="image/f2007.gif"
|
|
637
|
+
alt="x = \frac{\mathop{\pm}(-b,\sqrt{b^2 - 4ac})}{2a}"/>.</p>
|
|
638
|
+
|
|
639
|
+
<p>Markup:
|
|
640
|
+
<eg role='mathml'><![CDATA[
|
|
641
|
+
<apply>
|
|
642
|
+
<eq/>
|
|
643
|
+
<ci>x</ci>
|
|
644
|
+
<apply>
|
|
645
|
+
<divide/>
|
|
646
|
+
<apply>
|
|
647
|
+
]]><phrase diff="chg"><csymbol>&PlusMinus;</csymbol></phrase><![CDATA[
|
|
648
|
+
<apply>
|
|
649
|
+
<minus/>
|
|
650
|
+
<ci>b</ci>
|
|
651
|
+
</apply>
|
|
652
|
+
<apply>
|
|
653
|
+
<root/>
|
|
654
|
+
]]><phrase diff="chg"><degree><cn>2</cn></degree></phrase><![CDATA[
|
|
655
|
+
<apply>
|
|
656
|
+
<minus/>
|
|
657
|
+
<apply>
|
|
658
|
+
<power/>
|
|
659
|
+
<ci>b</ci>
|
|
660
|
+
<cn>2</cn>
|
|
661
|
+
</apply>
|
|
662
|
+
<apply>
|
|
663
|
+
<times/>
|
|
664
|
+
<cn>4</cn>
|
|
665
|
+
<ci>a</ci>
|
|
666
|
+
<ci>c</ci>
|
|
667
|
+
</apply>
|
|
668
|
+
</apply>
|
|
669
|
+
</apply>
|
|
670
|
+
</apply>
|
|
671
|
+
<apply>
|
|
672
|
+
<times/>
|
|
673
|
+
<cn>2</cn>
|
|
674
|
+
<ci>a</ci>
|
|
675
|
+
</apply>
|
|
676
|
+
</apply>
|
|
677
|
+
</apply>
|
|
678
|
+
]]></eg>
|
|
679
|
+
MathML content markup does not directly contain an element for the
|
|
680
|
+
<quote>plus or minus</quote> operation. Therefore, we use the
|
|
681
|
+
<el>csymbol</el> element to <phrase diff="chg">specify this operator.
|
|
682
|
+
Note that the default presentation is given here in prefix form,
|
|
683
|
+
although a renderer may recognize this operator and render it as
|
|
684
|
+
infix.
|
|
685
|
+
Alternatively the Mixed Markup style shown below may be used to
|
|
686
|
+
specify a presentation form for this expression as well as the Content
|
|
687
|
+
Markup.</phrase></p>
|
|
688
|
+
|
|
689
|
+
<p>Notation:
|
|
690
|
+
<graphic role="inline" source="image/f2011.gif"
|
|
691
|
+
alt="A=\left(\begin{array}{cc} x & y \\ z & w \end{array}\right)"/>.</p>
|
|
692
|
+
|
|
693
|
+
<p>Markup:
|
|
694
|
+
<eg role='mathml'><![CDATA[
|
|
695
|
+
<mrow>
|
|
696
|
+
<apply>
|
|
697
|
+
<eq/>
|
|
698
|
+
<ci>A</ci>
|
|
699
|
+
<matrix>
|
|
700
|
+
<matrixrow>
|
|
701
|
+
<ci>x</ci>
|
|
702
|
+
<ci>y</ci>
|
|
703
|
+
</matrixrow>
|
|
704
|
+
<matrixrow>
|
|
705
|
+
<ci>z</ci>
|
|
706
|
+
<ci>w</ci>
|
|
707
|
+
</matrixrow>
|
|
708
|
+
</matrix>
|
|
709
|
+
</apply>
|
|
710
|
+
</mrow>
|
|
711
|
+
]]></eg>
|
|
712
|
+
|
|
713
|
+
Here we have used the <el>matrix</el> element, and the
|
|
714
|
+
<el>matrixrow</el> element to wrap the entries in a row of
|
|
715
|
+
the matrix. Note that, by default, the rendering of the content
|
|
716
|
+
element <el>matrix</el> includes enclosing parentheses,
|
|
717
|
+
so we need not directly encode them. This is quite different from the
|
|
718
|
+
presentation element <el>mtable</el> which may or may
|
|
719
|
+
not refer to a matrix, and hence requires explicit encoding of
|
|
720
|
+
parentheses if they are desired.</p>
|
|
721
|
+
</div3>
|
|
722
|
+
|
|
723
|
+
<div3 id="fund_mix"><head>Mixed Markup Examples</head>
|
|
724
|
+
|
|
725
|
+
<p>Notation:
|
|
726
|
+
<graphic role="inline" source="image/f2012.gif"
|
|
727
|
+
alt="\displaystyle \int_1^t \frac{\diffd x}{x}"/>.</p>
|
|
728
|
+
|
|
729
|
+
<p>Markup:
|
|
730
|
+
<eg role='mathml'><![CDATA[
|
|
731
|
+
<mrow>
|
|
732
|
+
<semantics>
|
|
733
|
+
<mrow>
|
|
734
|
+
<msubsup>
|
|
735
|
+
<mo>∫</mo>
|
|
736
|
+
<mn>1</mn>
|
|
737
|
+
<mi>t</mi>
|
|
738
|
+
</msubsup>
|
|
739
|
+
<mfrac>
|
|
740
|
+
<mrow>
|
|
741
|
+
<mo>ⅆ</mo>
|
|
742
|
+
<mi>x</mi>
|
|
743
|
+
</mrow>
|
|
744
|
+
<mi>x</mi>
|
|
745
|
+
</mfrac>
|
|
746
|
+
</mrow>
|
|
747
|
+
<annotation-xml encoding="MathML-Content">
|
|
748
|
+
<apply>
|
|
749
|
+
<int/>
|
|
750
|
+
<bvar><ci>x</ci></bvar>
|
|
751
|
+
<lowlimit><cn>1</cn></lowlimit>
|
|
752
|
+
<uplimit><ci>t</ci></uplimit>
|
|
753
|
+
<apply>
|
|
754
|
+
<divide/>
|
|
755
|
+
<cn>1</cn>
|
|
756
|
+
<ci>x</ci>
|
|
757
|
+
</apply>
|
|
758
|
+
</apply>
|
|
759
|
+
</annotation-xml>
|
|
760
|
+
</semantics>
|
|
761
|
+
</mrow>
|
|
762
|
+
]]></eg> In this example, we use the <el>semantics</el>
|
|
763
|
+
element to provide a MathML content expression to serve as a
|
|
764
|
+
<quote>semantic annotation</quote> for a presentation expression. In
|
|
765
|
+
the display markup, we have used the <el>msubsup</el>
|
|
766
|
+
element to attach a subscript and a superscript to an expression, in
|
|
767
|
+
this case the integral sign. We also used entities <kw
|
|
768
|
+
role="entity">int</kw> and <kw role="entity">dd</kw> to specify the
|
|
769
|
+
integral and differential symbols.
|
|
770
|
+
</p>
|
|
771
|
+
|
|
772
|
+
<p>
|
|
773
|
+
The <el>semantics</el> element has as its first child
|
|
774
|
+
the expression being annotated, and the subsequent children are the
|
|
775
|
+
annotations. There is no restriction on the kind of annotation that
|
|
776
|
+
can be attached using the <el>semantics</el> element.
|
|
777
|
+
For example, one might give a &TeX; encoding, or computer algebra
|
|
778
|
+
input in an annotation. The type of annotation is specified by the <att>encoding</att> attribute and the <el>annotation</el> and <el>annotation-xml</el> elements.</p>
|
|
779
|
+
|
|
780
|
+
<p>Another common use of the <el>semantics</el>
|
|
781
|
+
element arises when one wants to use a content coding, and
|
|
782
|
+
provide a suggestion for its presentation. In such a case,
|
|
783
|
+
applied to the formula above we would have the markup:
|
|
784
|
+
<eg role='mathml'><![CDATA[
|
|
785
|
+
<semantics>
|
|
786
|
+
<apply>
|
|
787
|
+
<int/>
|
|
788
|
+
<bvar><ci>x</ci></bvar>
|
|
789
|
+
<lowlimit><cn>1</cn></lowlimit>
|
|
790
|
+
<uplimit><ci>t</ci></uplimit>
|
|
791
|
+
<apply>
|
|
792
|
+
<divide/>
|
|
793
|
+
<cn>1</cn>
|
|
794
|
+
<ci>x</ci>
|
|
795
|
+
</apply>
|
|
796
|
+
</apply>
|
|
797
|
+
<annotation-xml encoding="MathML-Presentation">
|
|
798
|
+
<mrow>
|
|
799
|
+
<msubsup>
|
|
800
|
+
<mo>∫</mo>
|
|
801
|
+
<mn>1</mn>
|
|
802
|
+
<mi>t</mi>
|
|
803
|
+
</msubsup>
|
|
804
|
+
<mfrac>
|
|
805
|
+
<mrow>
|
|
806
|
+
<mo>ⅆ</mo>
|
|
807
|
+
<mi>x</mi>
|
|
808
|
+
</mrow>
|
|
809
|
+
<mi>x</mi>
|
|
810
|
+
</mfrac>
|
|
811
|
+
</mrow>
|
|
812
|
+
</annotation-xml>
|
|
813
|
+
</semantics>
|
|
814
|
+
]]></eg>
|
|
815
|
+
</p>
|
|
816
|
+
|
|
817
|
+
<p>This kind of annotation is useful when something other than the default
|
|
818
|
+
rendering of the content encoding is desired. For example, by default, some
|
|
819
|
+
renderers might layout the integrand something like <quote>(1/<var>x</var>)
|
|
820
|
+
d<var>x</var></quote>. Specifying that the integrand should by preference
|
|
821
|
+
render as <quote>d<var>x</var>/<var>x</var></quote> instead can be accomplished
|
|
822
|
+
with the use of a MathML Presentation annotation as shown. Be aware,
|
|
823
|
+
however, that renderers are not required to take into account information
|
|
824
|
+
contained in annotations, and what use is made of them, if any, will depend
|
|
825
|
+
on the renderer.</p>
|
|
826
|
+
</div3>
|
|
827
|
+
</div2>
|
|
828
|
+
|
|
829
|
+
<div2 id="fund_syntax">
|
|
830
|
+
<head>MathML Syntax and Grammar</head>
|
|
831
|
+
<div3>
|
|
832
|
+
<head>MathML Syntax and Grammar</head>
|
|
833
|
+
|
|
834
|
+
<p>MathML is an application of <bibref ref="XML"/>, or Extensible
|
|
835
|
+
Markup Language, and as such its syntax is governed by the rules of
|
|
836
|
+
XML syntax, and its grammar is in part specified by a DTD, or Document
|
|
837
|
+
Type Definition. In other words, the details of using tags,
|
|
838
|
+
attributes, entity references and so on are defined in the XML
|
|
839
|
+
language specification, and the details about MathML element and
|
|
840
|
+
attribute names, which elements can be nested inside each other, and
|
|
841
|
+
so on are specified in the MathML DTD. This is in <specref
|
|
842
|
+
ref="parsing"/>.</p>
|
|
843
|
+
|
|
844
|
+
<p>The W3C in seeking to increase the flexibility of the use of XML
|
|
845
|
+
for the Web, and to encourage modularization of applications built
|
|
846
|
+
with XML, has found that the basic form of a DTD is not sufficiently
|
|
847
|
+
flexible. Therefore, a W3C Working Group was created to develop a
|
|
848
|
+
specification for XML Schemas <bibref ref="XMLSchemas"/>, which are
|
|
849
|
+
specification documents that will eventually supersede DTDs. MathML
|
|
850
|
+
2.0 is consciously designed so that mathematics may take advantage of the
|
|
851
|
+
latest in the evolving Web technology. Thus, there is to be a schema
|
|
852
|
+
for MathML. For further information on a MathML schema see <specref
|
|
853
|
+
ref="parsing"/> and the <loc href="http://www.w3.org/Math/">MathML
|
|
854
|
+
Home Page</loc>.</p>
|
|
855
|
+
|
|
856
|
+
<p>However, MathML also specifies some syntax and grammar rules in addition
|
|
857
|
+
to the general rules it inherits as an XML application. These rules allow
|
|
858
|
+
MathML to encode a great deal more information than would ordinarily be
|
|
859
|
+
possible with pure XML, without introducing many more elements, and using a
|
|
860
|
+
substantially more complex DTD or schema. A grammar for content markup
|
|
861
|
+
expressions is given in <specref ref="cmvg"/>. Of course, one drawback to
|
|
862
|
+
using MathML specific rules is that they are invisible to generic XML
|
|
863
|
+
processors and validators.</p>
|
|
864
|
+
|
|
865
|
+
<p>There are basically two kinds of additional MathML grammar and syntax
|
|
866
|
+
rules. One kind involves placing additional criteria on attribute values.
|
|
867
|
+
For example, it is not possible in pure XML to require that an attribute
|
|
868
|
+
value be a positive integer. The second kind of rule specifies more
|
|
869
|
+
detailed restrictions on the child elements (for example on ordering) than
|
|
870
|
+
are given in the DTD or even a schema. For example, it is not possible in
|
|
871
|
+
XML to specify that the first child be interpreted one way, and the second
|
|
872
|
+
in another.</p>
|
|
873
|
+
|
|
874
|
+
<p>The following sections discuss features both of XML syntax and grammar
|
|
875
|
+
in general, and of MathML in particular. Throughout the remainder of the
|
|
876
|
+
MathML specification, we will usually take care to distinguish between
|
|
877
|
+
usage required by XML syntax and the MathML DTD (and schema) and usage
|
|
878
|
+
required by MathML specific rules. However, we will frequently allude to
|
|
879
|
+
<quote>MathML errors</quote> without identifying which part of the
|
|
880
|
+
specification is being violated.</p>
|
|
881
|
+
</div3>
|
|
882
|
+
|
|
883
|
+
<div3 id="fund_xmlsyntax">
|
|
884
|
+
<head>An XML Syntax Primer</head>
|
|
885
|
+
|
|
886
|
+
<p>Since MathML is an application of XML, the MathML specification uses the
|
|
887
|
+
terminology of XML to describe it. Briefly, XML data is composed of Unicode
|
|
888
|
+
characters (which include ordinary ASCII characters), <quote>entity
|
|
889
|
+
references</quote> (informally called <quote>entities</quote>) such as <kw
|
|
890
|
+
role="entity">lt</kw> which usually represent <quote>extended
|
|
891
|
+
characters</quote>, and <quote>elements</quote> such as <code><![CDATA[<mi
|
|
892
|
+
fontstyle="normal"> x </mi>]]></code>.</p>
|
|
893
|
+
|
|
894
|
+
<p>An element quite often encloses other XML data called its
|
|
895
|
+
<quote>content</quote>, or <quote>body</quote>, between a <quote>start
|
|
896
|
+
tag</quote> (sometimes called a <quote>begin tag</quote>) and an <quote>end
|
|
897
|
+
tag</quote>, much as in HTML. There are also <quote>empty elements</quote>
|
|
898
|
+
such as <el role="emptytag">plus</el>, whose start tag ends with
|
|
899
|
+
<code>/></code> to indicate that the element has no content or end
|
|
900
|
+
tag. The start tag can contain named parameters called
|
|
901
|
+
<quote>attributes</quote>, such as <code>fontstyle="normal"</code> in the
|
|
902
|
+
example above. For further details on XML, consult the XML specification
|
|
903
|
+
<bibref ref="XML"/>.</p>
|
|
904
|
+
|
|
905
|
+
<p>As XML is case-sensitive, MathML element and attribute names are
|
|
906
|
+
case-sensitive. For reasons of legibility, the MathML specification
|
|
907
|
+
defines them almost all in lowercase.</p>
|
|
908
|
+
|
|
909
|
+
<p>In formal discussions of XML markup, a distinction is maintained
|
|
910
|
+
between an element, such as an <el>mrow</el> element,
|
|
911
|
+
and the tags <el role="starttag">mrow</el> and <el role="endtag">mrow</el> marking it. What is between the <el role="starttag">mrow</el> start tag and the <el role="endtag">mrow</el> end tag is the content, or body, of the <el>mrow</el> element. An <quote>empty element</quote>
|
|
912
|
+
such as <el>none</el> is defined to have no body, and
|
|
913
|
+
so has a single tag of the form <el role="emptytag">none</el>.
|
|
914
|
+
Usually, the distinction between elements and tags will not be so
|
|
915
|
+
finely drawn in this specification. For instance, we will sometimes
|
|
916
|
+
refer to the <el role="starttag">mrow</el> and <el role="emptytag">none</el> elements, really meaning the elements whose
|
|
917
|
+
tags these are, in order that references to elements are visually
|
|
918
|
+
distinguishable from references to attributes. However, the words
|
|
919
|
+
<quote>element</quote> and <quote>tag</quote> themselves will be used
|
|
920
|
+
strictly in accordance with XML terminology.</p>
|
|
921
|
+
|
|
922
|
+
</div3>
|
|
923
|
+
|
|
924
|
+
<div3><head>Children versus Arguments</head>
|
|
925
|
+
|
|
926
|
+
<p>Many MathML elements require a specific number of child elements or
|
|
927
|
+
attach additional meanings to children in certain positions. As noted
|
|
928
|
+
above, these kinds of requirements are MathML specific, and cannot be
|
|
929
|
+
given entirely using XML syntax and grammar. When the children of a
|
|
930
|
+
given MathML element are subject to these kinds of additional
|
|
931
|
+
conditions, we will often refer to them as <emph>arguments</emph>
|
|
932
|
+
instead of merely as children, in order to emphasize their MathML
|
|
933
|
+
specific usage. Note that, especially in <specref ref="presm"/>, the
|
|
934
|
+
term <quote>argument</quote> is usually used in this technical sense,
|
|
935
|
+
unless otherwise noted, and therefore refers to a child element.</p>
|
|
936
|
+
|
|
937
|
+
<p>In the detailed discussions of element syntax given with each
|
|
938
|
+
element throughout the MathML specification, the number of required
|
|
939
|
+
arguments and their order is implicitly indicated by giving names for
|
|
940
|
+
the arguments at various positions. This information is also given for
|
|
941
|
+
presentation elements in the table of argument requirements in
|
|
942
|
+
<specref ref="presm_reqarg"/>, and for content elements in <specref
|
|
943
|
+
ref="cmvg"/>.</p>
|
|
944
|
+
|
|
945
|
+
<p>A few elements have other requirements on the number or
|
|
946
|
+
type of arguments. These additional requirements are described
|
|
947
|
+
together with the individual elements.</p>
|
|
948
|
+
</div3>
|
|
949
|
+
|
|
950
|
+
<div3 id="fund_attval">
|
|
951
|
+
<head>MathML Attribute Values</head>
|
|
952
|
+
|
|
953
|
+
<p>According to the XML language specification, attributes
|
|
954
|
+
given to elements must have one of the forms
|
|
955
|
+
<eg><![CDATA[
|
|
956
|
+
attribute-name = "value"
|
|
957
|
+
]]></eg>
|
|
958
|
+
or
|
|
959
|
+
<eg><![CDATA[
|
|
960
|
+
attribute-name = 'value'
|
|
961
|
+
]]></eg>
|
|
962
|
+
where whitespace around the '=' is optional.</p>
|
|
963
|
+
|
|
964
|
+
<p>Attribute names are generally shown in a <att>monospaced</att> font within descriptive text in this
|
|
965
|
+
specification, just as the <att>monospaced</att> font is used
|
|
966
|
+
for examples.</p>
|
|
967
|
+
|
|
968
|
+
<p>An attribute's value, which in general in MathML can be a string of
|
|
969
|
+
arbitrary characters, must be surrounded by a pair of either double quotes
|
|
970
|
+
(<code>"</code>) or single quotes (<code>'</code>). The kind of quotes
|
|
971
|
+
not used to surround the value may be included within it.</p>
|
|
972
|
+
|
|
973
|
+
<p>MathML uses a more complicated syntax for attribute values than the
|
|
974
|
+
generic XML syntax required by the MathML DTD. These additional rules are
|
|
975
|
+
intended for use by MathML applications, and it is a MathML error to
|
|
976
|
+
violate them, though they cannot be enforced by XML processing. The MathML
|
|
977
|
+
syntax of each attribute value is specified in the table of attributes
|
|
978
|
+
provided with the description of each element, using a notation described
|
|
979
|
+
below. When MathML applications process attribute values, whitespace
|
|
980
|
+
is ignored except to separate letter and digit sequences into
|
|
981
|
+
individual words or numbers. Attribute values may contain any MathML
|
|
982
|
+
characters listed in <specref ref="chars_mathmlchars"/> permitted by the syntax
|
|
983
|
+
restrictions for an attribute. Character data can be
|
|
984
|
+
included directly in attribute values, or by using entity references
|
|
985
|
+
as described in <specref ref="chars_unicodechars"/>.
|
|
986
|
+
</p>
|
|
987
|
+
|
|
988
|
+
<p>In particular, the characters <code>"</code>, <code>'</code>,
|
|
989
|
+
<code>&</code> and <code><</code> can be included in MathML
|
|
990
|
+
attribute values (when permitted by the attribute value syntax) using the
|
|
991
|
+
entity references <kw role="entity">quot</kw>, <kw role="entity">apos</kw>,
|
|
992
|
+
<kw role="entity">amp</kw> and <kw role="entity">lt</kw>, respectively.
|
|
993
|
+
</p>
|
|
994
|
+
|
|
995
|
+
<p>The MathML DTD provided in <specref ref="parsing"/> declares most
|
|
996
|
+
attribute value types as <kw>CDATA</kw> strings. This permits increased
|
|
997
|
+
interoperability with existing SGML and XML software and allows extension
|
|
998
|
+
to the lists of predefined values. Similar sorts of considerations apply
|
|
999
|
+
with XML schemas.</p>
|
|
1000
|
+
|
|
1001
|
+
<div4><head>Syntax notations used in the MathML specification</head>
|
|
1002
|
+
|
|
1003
|
+
<p>To describe the MathML-specific syntax of permissible
|
|
1004
|
+
attribute values, the following conventions and notations are
|
|
1005
|
+
used for most attributes in the present document.
|
|
1006
|
+
<table id="fund_table-attval">
|
|
1007
|
+
<thead>
|
|
1008
|
+
<tr>
|
|
1009
|
+
<td>Notation</td>
|
|
1010
|
+
<td>What it matches</td>
|
|
1011
|
+
</tr>
|
|
1012
|
+
</thead>
|
|
1013
|
+
<tbody>
|
|
1014
|
+
<tr>
|
|
1015
|
+
<td>number</td>
|
|
1016
|
+
<td>decimal integer or rational number (a string of digits
|
|
1017
|
+
with one decimal point),
|
|
1018
|
+
optionally starting with '-'</td>
|
|
1019
|
+
</tr>
|
|
1020
|
+
<tr>
|
|
1021
|
+
<td>unsigned-number</td>
|
|
1022
|
+
<td>decimal integer or real number, no sign</td>
|
|
1023
|
+
</tr>
|
|
1024
|
+
<tr>
|
|
1025
|
+
<td>integer</td>
|
|
1026
|
+
<td>decimal integer, optionally starting with '-'</td>
|
|
1027
|
+
</tr>
|
|
1028
|
+
<tr>
|
|
1029
|
+
<td>positive-integer</td>
|
|
1030
|
+
<td>decimal integer, unsigned, not 0</td>
|
|
1031
|
+
</tr>
|
|
1032
|
+
<tr>
|
|
1033
|
+
<td>string</td>
|
|
1034
|
+
<td>arbitrary string (always the entire attribute value)</td>
|
|
1035
|
+
</tr>
|
|
1036
|
+
<tr>
|
|
1037
|
+
<td>character</td>
|
|
1038
|
+
<td>single non-whitespace character, or MathML entity reference;
|
|
1039
|
+
whitespace separation is optional</td>
|
|
1040
|
+
</tr>
|
|
1041
|
+
<tr>
|
|
1042
|
+
<td>#rrggbb</td> <td>RGB color value; the three pairs of
|
|
1043
|
+
hexadecimal digits in the example #5599dd define proportions
|
|
1044
|
+
of red, green and blue on a scale of x00 through xFF, which
|
|
1045
|
+
gives a strong sky blue.</td>
|
|
1046
|
+
</tr>
|
|
1047
|
+
<tr>
|
|
1048
|
+
<td>h-unit</td>
|
|
1049
|
+
<td>unit of horizontal length (allowable units are listed below)</td>
|
|
1050
|
+
</tr>
|
|
1051
|
+
<tr>
|
|
1052
|
+
<td>v-unit</td>
|
|
1053
|
+
<td>unit of vertical length (allowable units are listed below)</td>
|
|
1054
|
+
</tr>
|
|
1055
|
+
<tr>
|
|
1056
|
+
<td>css-fontfamily</td>
|
|
1057
|
+
<td>explained in the CSS subsection below</td>
|
|
1058
|
+
</tr>
|
|
1059
|
+
<tr>
|
|
1060
|
+
<td>css-color-name</td>
|
|
1061
|
+
<td>explained in the CSS subsection below</td>
|
|
1062
|
+
</tr>
|
|
1063
|
+
<tr>
|
|
1064
|
+
<td>other italicized words</td>
|
|
1065
|
+
<td>explained in the text for each attribute</td>
|
|
1066
|
+
</tr>
|
|
1067
|
+
<tr>
|
|
1068
|
+
<td>form +</td>
|
|
1069
|
+
<td>one or more instances of 'form'</td>
|
|
1070
|
+
</tr>
|
|
1071
|
+
<tr>
|
|
1072
|
+
<td>form *</td>
|
|
1073
|
+
<td>zero or more instances of 'form'</td>
|
|
1074
|
+
</tr>
|
|
1075
|
+
<tr>
|
|
1076
|
+
<td>f1 f2 ... fn</td>
|
|
1077
|
+
<td>one instance of each form, in sequence, perhaps separated by whitespace</td>
|
|
1078
|
+
</tr>
|
|
1079
|
+
<tr>
|
|
1080
|
+
<td>f1 | f2 | ... | fn</td>
|
|
1081
|
+
<td>any one of the specified forms</td>
|
|
1082
|
+
</tr>
|
|
1083
|
+
<tr>
|
|
1084
|
+
<td>[ form ]</td>
|
|
1085
|
+
<td>an optional instance of 'form'</td>
|
|
1086
|
+
</tr>
|
|
1087
|
+
<tr>
|
|
1088
|
+
<td>( form )</td>
|
|
1089
|
+
<td>same as form</td>
|
|
1090
|
+
</tr>
|
|
1091
|
+
<tr>
|
|
1092
|
+
<td>word in plain text</td>
|
|
1093
|
+
<td>that word, literally present in the attribute value (unless it is
|
|
1094
|
+
obviously part of an explanatory phrase)</td>
|
|
1095
|
+
</tr>
|
|
1096
|
+
<tr>
|
|
1097
|
+
<td>quoted symbol</td>
|
|
1098
|
+
<td>that symbol, literally present in attribute value (e.g. "+" or '+')</td>
|
|
1099
|
+
</tr>
|
|
1100
|
+
</tbody>
|
|
1101
|
+
</table>
|
|
1102
|
+
</p>
|
|
1103
|
+
|
|
1104
|
+
<p>The order of precedence of the syntax notation operators is,
|
|
1105
|
+
from highest to lowest precedence:
|
|
1106
|
+
<slist>
|
|
1107
|
+
<sitem>form + or form *</sitem>
|
|
1108
|
+
<sitem>f1 f2 ... fn (sequence of forms)</sitem>
|
|
1109
|
+
<sitem>f1 | f2 | ... | fn (alternative forms)</sitem>
|
|
1110
|
+
</slist>
|
|
1111
|
+
</p>
|
|
1112
|
+
|
|
1113
|
+
<p>A <emph>string</emph> can contain arbitrary characters which are
|
|
1114
|
+
specifiable within XML <kw>CDATA</kw> attribute values. See <specref
|
|
1115
|
+
ref="chars"/> for a discussion and complete listing of MathML
|
|
1116
|
+
characters. No syntax rule in MathML includes a <emph>string</emph>
|
|
1117
|
+
as only part of an attribute value, only as the entire value.</p>
|
|
1118
|
+
|
|
1119
|
+
<p>Adjacent keywords and numbers must be separated by whitespace in the
|
|
1120
|
+
actual attribute values, except for unit identifiers (denoted by <att>h-unit</att> or <att>v-unit</att> syntax symbols)
|
|
1121
|
+
following numbers. Whitespace is not otherwise required, but is permitted
|
|
1122
|
+
between any of the tokens listed above, except (for compatibility with
|
|
1123
|
+
CSS) immediately before unit identifiers, between the '-' signs and digits
|
|
1124
|
+
of negative numbers, or between <code>#</code> or <attval>rrggbb</attval> and <attval>rgb</attval>.</p>
|
|
1125
|
+
|
|
1126
|
+
<p>Numerical attribute values for dimensions that should depend upon the
|
|
1127
|
+
current font can be given in font-related units, or in named absolute units
|
|
1128
|
+
(described in a separate subsection below). Horizontal dimensions are
|
|
1129
|
+
conventionally given in <code>em</code>'s, and vertical dimensions in
|
|
1130
|
+
<code>ex</code>'s, by immediately following a number by one of the unit
|
|
1131
|
+
identifiers <attval>em</attval> or <attval>ex</attval>. For
|
|
1132
|
+
example, the horizontal spacing around an operator such as <quote>+</quote>
|
|
1133
|
+
is conventionally given in <attval>em</attval>s, though other units
|
|
1134
|
+
can be used. Using font-related units is usually preferable to using
|
|
1135
|
+
absolute units, since it allows renderings to grow or shrink in proportion
|
|
1136
|
+
to the current font size.</p>
|
|
1137
|
+
|
|
1138
|
+
<p>For most numerical attributes, only those in a subset of the expressible
|
|
1139
|
+
values are sensible; values outside this subset are not errors, unless
|
|
1140
|
+
otherwise specified, but rather are rounded up or down (at the discretion
|
|
1141
|
+
of the renderer) to the closest value within the allowed subset. The set
|
|
1142
|
+
of allowed values may depend on the renderer, and is not specified by
|
|
1143
|
+
MathML.</p>
|
|
1144
|
+
|
|
1145
|
+
<p>If a numerical value within an attribute value syntax description is
|
|
1146
|
+
declared to allow a minus sign ('-'), e.g. <att>number</att> or
|
|
1147
|
+
<att>integer</att>, it is not a syntax error when one is
|
|
1148
|
+
provided in cases where a negative value is not sensible. Instead, the
|
|
1149
|
+
value should be handled by the processing application as described in the
|
|
1150
|
+
preceding paragraph. An explicit plus sign ('+') is not allowed as part of
|
|
1151
|
+
a numerical value except when it is specifically listed in the syntax (as a
|
|
1152
|
+
quoted '+' or "+"), and its presence can change the meaning of the
|
|
1153
|
+
attribute value (as documented with each attribute which permits it).</p>
|
|
1154
|
+
|
|
1155
|
+
<p>The symbols <att>h-unit</att>, <att>v-unit</att>, <att>css-fontfamily</att>,
|
|
1156
|
+
and <att>css-color-name</att> are explained in the
|
|
1157
|
+
following subsections.</p>
|
|
1158
|
+
</div4>
|
|
1159
|
+
|
|
1160
|
+
<div4 id="fund_units">
|
|
1161
|
+
<head>Attributes with units</head>
|
|
1162
|
+
|
|
1163
|
+
<p>Some attributes accept horizontal or vertical lengths as numbers
|
|
1164
|
+
followed by a <quote>unit identifier</quote> (often just called a
|
|
1165
|
+
<quote>unit</quote>). The syntax symbols <att>h-unit</att> and
|
|
1166
|
+
<att>v-unit</att> refer to a unit for horizontal or vertical
|
|
1167
|
+
length, respectively. The possible units and the lengths they refer to are
|
|
1168
|
+
shown in the table below; they are the same for horizontal and vertical
|
|
1169
|
+
lengths, but the syntax symbols are distinguished in attribute syntaxes as
|
|
1170
|
+
a reminder of the direction each is used in.</p>
|
|
1171
|
+
|
|
1172
|
+
<p>The unit identifiers and meanings are taken from CSS. However, the
|
|
1173
|
+
syntax of numbers followed by unit identifiers in MathML is not identical
|
|
1174
|
+
to the syntax of length values with units in CSS style sheets, since
|
|
1175
|
+
numbers in CSS cannot end with decimal points, and are allowed to start
|
|
1176
|
+
with '+' signs.</p>
|
|
1177
|
+
|
|
1178
|
+
<p>The possible horizontal or vertical units in MathML are:
|
|
1179
|
+
</p>
|
|
1180
|
+
<table>
|
|
1181
|
+
<thead>
|
|
1182
|
+
<tr>
|
|
1183
|
+
<td>Unit identifier</td>
|
|
1184
|
+
<td>Unit description</td>
|
|
1185
|
+
</tr>
|
|
1186
|
+
</thead>
|
|
1187
|
+
<tbody>
|
|
1188
|
+
<tr>
|
|
1189
|
+
<td>em</td>
|
|
1190
|
+
<td>em (font-relative unit traditionally used for horizontal lengths)</td>
|
|
1191
|
+
</tr>
|
|
1192
|
+
<tr>
|
|
1193
|
+
<td>ex</td>
|
|
1194
|
+
<td>ex (font-relative unit traditionally used for vertical lengths)</td>
|
|
1195
|
+
</tr>
|
|
1196
|
+
<tr>
|
|
1197
|
+
<td>px</td>
|
|
1198
|
+
<td>pixels, or pixel size of the current display</td>
|
|
1199
|
+
</tr>
|
|
1200
|
+
<tr>
|
|
1201
|
+
<td>in</td>
|
|
1202
|
+
<td>inches (1 inch = 2.54 centimeters)</td>
|
|
1203
|
+
</tr>
|
|
1204
|
+
<tr>
|
|
1205
|
+
<td>cm</td>
|
|
1206
|
+
<td>centimeters</td>
|
|
1207
|
+
</tr>
|
|
1208
|
+
<tr>
|
|
1209
|
+
<td>mm</td>
|
|
1210
|
+
<td>millimeters</td>
|
|
1211
|
+
</tr>
|
|
1212
|
+
<tr>
|
|
1213
|
+
<td>pt</td>
|
|
1214
|
+
<td>points (1 point = 1/72 inch)</td>
|
|
1215
|
+
</tr>
|
|
1216
|
+
<tr>
|
|
1217
|
+
<td>pc</td>
|
|
1218
|
+
<td>picas (1 pica = 12 points)</td>
|
|
1219
|
+
</tr>
|
|
1220
|
+
<tr>
|
|
1221
|
+
<td>%</td>
|
|
1222
|
+
<td>percentage of default value</td>
|
|
1223
|
+
</tr>
|
|
1224
|
+
</tbody>
|
|
1225
|
+
</table>
|
|
1226
|
+
|
|
1227
|
+
<p>The typesetting units <attval>em</attval> and <attval>ex</attval> are defined in <specref ref="glossary"/>, and
|
|
1228
|
+
discussed further under <quote>Additional notes</quote> below.</p>
|
|
1229
|
+
|
|
1230
|
+
<p><code>%</code> is a <quote>relative unit</quote>; when an attribute
|
|
1231
|
+
value is given as <attval>n%</attval> (for any numerical value <attval>n</attval>), the value being specified is the default value for
|
|
1232
|
+
the property being controlled multiplied by <attval>n</attval>
|
|
1233
|
+
divided by 100. The default value (or the way in which it is obtained, when
|
|
1234
|
+
it is not constant) is listed in the table of attributes for each element,
|
|
1235
|
+
and its meaning is described in the subsequent documentation about that
|
|
1236
|
+
attribute. (The <el>mpadded</el> element has its own syntax
|
|
1237
|
+
for <code>%</code> and does not allow it as a unit identifier.)</p>
|
|
1238
|
+
|
|
1239
|
+
<p>For consistency with CSS, length units in MathML are rarely
|
|
1240
|
+
optional. When they are, the unit symbol is enclosed in square brackets in
|
|
1241
|
+
the attribute syntax, following the number to which it applies,
|
|
1242
|
+
e.g. <code>number [ h-unit ]</code>. The meaning of specifying no unit is
|
|
1243
|
+
given in the documentation for each attribute; in general it is that the
|
|
1244
|
+
number given is a multiplier for the default value of the attribute. (In
|
|
1245
|
+
such cases, specifying the number <attval>nnn</attval> without a unit
|
|
1246
|
+
is equivalent to specifying the number <attval>nnn</attval> times 100
|
|
1247
|
+
followed by <code>%</code>. For example, <code><mo maxsize="2"> (
|
|
1248
|
+
</mo></code> is equivalent to <code><mo maxsize="200%"> (
|
|
1249
|
+
</mo></code>.)</p>
|
|
1250
|
+
|
|
1251
|
+
<p>As a special exception (also consistent with CSS), a numerical value
|
|
1252
|
+
equal to 0 need not be followed by a unit identifier even if the syntax
|
|
1253
|
+
specified here requires one. In such cases, the unit identifier (or lack of
|
|
1254
|
+
one) would not matter, since 0 times any unit is 0.</p>
|
|
1255
|
+
|
|
1256
|
+
<p>For most attributes, the typical unit which would be used to describe
|
|
1257
|
+
them in typesetting is chosen as the one used in that attribute's default
|
|
1258
|
+
value in this specification; when a specific default value is not given,
|
|
1259
|
+
the typical unit is usually mentioned in the syntax table or in the
|
|
1260
|
+
documentation for that attribute. The most common units are <code>em</code>
|
|
1261
|
+
or <code>ex</code>. However, any unit can be used, unless otherwise
|
|
1262
|
+
specified for a specific attribute.</p>
|
|
1263
|
+
|
|
1264
|
+
<div5><head>Additional notes about units</head>
|
|
1265
|
+
|
|
1266
|
+
<p>Note that some attributes, e.g. <att>framespacing</att>
|
|
1267
|
+
on a <el role="starttag">mtable</el>,
|
|
1268
|
+
can contain more than one numerical value, each followed by its own
|
|
1269
|
+
unit.</p>
|
|
1270
|
+
|
|
1271
|
+
<p>It is conventional to use the font-relative unit <code>ex</code> mainly
|
|
1272
|
+
for vertical lengths, and <code>em</code> mainly for horizontal lengths,
|
|
1273
|
+
but this is not required. These units are relative to the font and font size
|
|
1274
|
+
which would be used for rendering the element in whose attribute value they
|
|
1275
|
+
are specified, which means they should be interpreted <emph>after</emph>
|
|
1276
|
+
attributes such as <att>fontfamily</att> and <att>fontsize</att> are processed, if those occur on the same
|
|
1277
|
+
element, since changing the current font or font size can change the length
|
|
1278
|
+
of one of these units.</p>
|
|
1279
|
+
|
|
1280
|
+
<p>The definition of the length of each unit, but not the MathML syntax for
|
|
1281
|
+
length values, is as specified in CSS, except that if a font provides
|
|
1282
|
+
specific values for <code>em</code> and <code>ex</code> which differ from
|
|
1283
|
+
the values defined by CSS (the font size and <quote>x</quote>-height
|
|
1284
|
+
respectively), those values should be used.</p>
|
|
1285
|
+
</div5>
|
|
1286
|
+
</div4>
|
|
1287
|
+
|
|
1288
|
+
<div4 id="fund_cssatt"><head>CSS-compatible attributes</head>
|
|
1289
|
+
|
|
1290
|
+
<p>Several MathML attributes, listed below, correspond closely to text
|
|
1291
|
+
rendering properties defined originally in <bibref ref="CSS1"/>.
|
|
1292
|
+
In MathML 1.01, the names and values of these attributes were aligned
|
|
1293
|
+
with the CSS Recommendation where possible. This was done so that
|
|
1294
|
+
renderers in CSS environments could query the environment for the
|
|
1295
|
+
corresponding property when determining the default values for the
|
|
1296
|
+
attributes. </p>
|
|
1297
|
+
|
|
1298
|
+
<p>Allowing style properties to be set both via MathML attributes and
|
|
1299
|
+
CSS style sheets has drawbacks. At a minimum, its confusing, and at
|
|
1300
|
+
worst, it leads to the meaning of equations being inadvertently
|
|
1301
|
+
changed by document-wide CSS changes. For these reasons, these
|
|
1302
|
+
attributes have been <intref ref="interf_deprec">deprecated</intref>.
|
|
1303
|
+
In their place, MathML 2.0 introduces four new mathematical style
|
|
1304
|
+
attributes. These attributes use logical values to better capture the
|
|
1305
|
+
abstract categories of letter-like symbols used in math, and afford a
|
|
1306
|
+
much cleaner separation between MathML and CSS. See <specref
|
|
1307
|
+
ref="presm_commatt"/> for more details.</p>
|
|
1308
|
+
|
|
1309
|
+
<p>For reference, a table showing the correspondence of the deprecated
|
|
1310
|
+
MathML 1.01 style attribute with the CSS counterparts is given below:</p>
|
|
1311
|
+
|
|
1312
|
+
<table>
|
|
1313
|
+
<thead>
|
|
1314
|
+
<tr>
|
|
1315
|
+
<td>MathML attribute</td>
|
|
1316
|
+
<td>CSS property</td>
|
|
1317
|
+
<td>syntax symbol</td>
|
|
1318
|
+
<td>MathML elements</td>
|
|
1319
|
+
<td>refer to</td>
|
|
1320
|
+
</tr>
|
|
1321
|
+
</thead>
|
|
1322
|
+
<tbody>
|
|
1323
|
+
<tr>
|
|
1324
|
+
<td>fontsize</td>
|
|
1325
|
+
<td>font-size</td>
|
|
1326
|
+
<td>-</td>
|
|
1327
|
+
<td>presentation tokens; <el>mstyle</el></td>
|
|
1328
|
+
<td><specref ref="presm_commatt"/></td>
|
|
1329
|
+
</tr>
|
|
1330
|
+
<tr>
|
|
1331
|
+
<td>fontweight</td>
|
|
1332
|
+
<td>font-weight</td>
|
|
1333
|
+
<td>-</td>
|
|
1334
|
+
<td>presentation tokens; <el>mstyle</el></td>
|
|
1335
|
+
<td><specref ref="presm_commatt"/></td>
|
|
1336
|
+
</tr>
|
|
1337
|
+
<tr>
|
|
1338
|
+
<td>fontstyle</td>
|
|
1339
|
+
<td>font-style</td>
|
|
1340
|
+
<td>-</td>
|
|
1341
|
+
<td>presentation tokens; <el>mstyle</el></td>
|
|
1342
|
+
<td><specref ref="presm_commatt"/></td>
|
|
1343
|
+
</tr>
|
|
1344
|
+
<tr>
|
|
1345
|
+
<td>fontfamily</td>
|
|
1346
|
+
<td>font-family</td>
|
|
1347
|
+
<td>css-fontfamily</td>
|
|
1348
|
+
<td>presentation tokens; <el>mstyle</el></td>
|
|
1349
|
+
<td><specref ref="presm_commatt"/></td>
|
|
1350
|
+
</tr>
|
|
1351
|
+
<tr>
|
|
1352
|
+
<td>color</td>
|
|
1353
|
+
<td>color</td>
|
|
1354
|
+
<td>css-color-name</td>
|
|
1355
|
+
<td>presentation tokens; <el>mstyle</el></td>
|
|
1356
|
+
<td><specref ref="presm_mstyle"/></td>
|
|
1357
|
+
</tr>
|
|
1358
|
+
<tr>
|
|
1359
|
+
<td>background</td>
|
|
1360
|
+
<td>background</td>
|
|
1361
|
+
<td>css-color-name</td>
|
|
1362
|
+
<td><el>mstyle</el></td>
|
|
1363
|
+
<td><specref ref="presm_mstyle"/></td>
|
|
1364
|
+
</tr>
|
|
1365
|
+
</tbody>
|
|
1366
|
+
</table>
|
|
1367
|
+
|
|
1368
|
+
<p>See also <specref ref="fund_globatt"/> below for a discussion of the <att>class</att>, <att>style</att> and <att>id</att> attributes for use with style sheets.</p>
|
|
1369
|
+
|
|
1370
|
+
<div5>
|
|
1371
|
+
<head>Order of processing attributes versus style sheets</head>
|
|
1372
|
+
|
|
1373
|
+
<p>CSS or analogous style sheets can specify changes to rendering
|
|
1374
|
+
properties of selected MathML elements. Since rendering properties
|
|
1375
|
+
can also be changed by attributes on an element, or be changed automatically
|
|
1376
|
+
by the renderer, it is necessary to specify the order in which changes
|
|
1377
|
+
from various sources occur. An example of automatic adjustment is what
|
|
1378
|
+
happens for <att>fontsize</att>, as explained in the
|
|
1379
|
+
discussion on <att>scriptlevel</att> in <specref
|
|
1380
|
+
ref="presm_mstyle"/>. In the case of <quote>absolute</quote> changes,
|
|
1381
|
+
i.e., setting a new property value independent of the old value (as
|
|
1382
|
+
opposed to <quote>relative</quote> changes, such as increments or
|
|
1383
|
+
multiplications by a factor), the absolute change performed last will
|
|
1384
|
+
be the only absolute change which is effective, so the sources of
|
|
1385
|
+
changes which should have the highest priority must be processed
|
|
1386
|
+
last.</p>
|
|
1387
|
+
|
|
1388
|
+
<p>In the case of CSS, the order of processing of changes
|
|
1389
|
+
from various sources which affect one MathML element's
|
|
1390
|
+
rendering properties should be as follows:</p>
|
|
1391
|
+
<eg role='text'>
|
|
1392
|
+
(first changes; lowest priority)
|
|
1393
|
+
</eg>
|
|
1394
|
+
<ulist>
|
|
1395
|
+
|
|
1396
|
+
<item>
|
|
1397
|
+
<p>Automatic changes to properties or attributes based on the type of the
|
|
1398
|
+
parent element, and this element's position in the parent, as for the
|
|
1399
|
+
changes to <att>fontsize</att> in relation to <att>scriptlevel</att> mentioned above; such changes will usually
|
|
1400
|
+
be implemented by the parent element itself before it passes a set of
|
|
1401
|
+
rendering properties to this element</p></item>
|
|
1402
|
+
|
|
1403
|
+
<item>
|
|
1404
|
+
<p>From a style sheet from the reader: styles which are <emph>not</emph>
|
|
1405
|
+
declared <quote>important</quote></p></item>
|
|
1406
|
+
|
|
1407
|
+
<item>
|
|
1408
|
+
<p>Explicit attribute settings on this MathML element</p></item>
|
|
1409
|
+
|
|
1410
|
+
<item>
|
|
1411
|
+
<p>From a style sheet from the author: styles which are <emph>not</emph>
|
|
1412
|
+
declared <quote>important</quote></p></item>
|
|
1413
|
+
|
|
1414
|
+
<item>
|
|
1415
|
+
<p>From a style sheet from the author: styles which <emph>are</emph>
|
|
1416
|
+
declared <quote>important</quote></p></item>
|
|
1417
|
+
|
|
1418
|
+
<item>
|
|
1419
|
+
<p>From a style sheet from the reader: styles which <emph>are</emph>
|
|
1420
|
+
declared <quote>important</quote></p></item>
|
|
1421
|
+
|
|
1422
|
+
</ulist>
|
|
1423
|
+
<eg role='text'>
|
|
1424
|
+
(last changes; highest priority)
|
|
1425
|
+
</eg>
|
|
1426
|
+
|
|
1427
|
+
<p>Note that the order of the changes derived from CSS style sheets is
|
|
1428
|
+
specified by CSS itself (this is the order specified by CSS2).
|
|
1429
|
+
The following rationale is related only to the
|
|
1430
|
+
issue of where in this pre-existing order the changes caused by explicit
|
|
1431
|
+
MathML attribute settings should be inserted.</p>
|
|
1432
|
+
|
|
1433
|
+
<p>Rationale: MathML rendering attributes are analogous to HTML rendering
|
|
1434
|
+
attributes such as <att>align</att>, which the CSS section on
|
|
1435
|
+
cascading order specifies should be processed with the same priority.
|
|
1436
|
+
Furthermore, this choice of priority permits readers, by declaring certain
|
|
1437
|
+
CSS styles as <quote>important</quote>, to decide which of their style
|
|
1438
|
+
preferences should override explicit attribute settings in MathML. Since
|
|
1439
|
+
MathML expressions, whether composed of <quote>presentation</quote> or
|
|
1440
|
+
<quote>content</quote> elements, are primarily intended to convey meaning,
|
|
1441
|
+
with their <quote>graphic design</quote> (if any) intended mainly to aid in
|
|
1442
|
+
that purpose but not to be essential in it, it is likely that readers will
|
|
1443
|
+
often want their own style preferences to have priority; the main exception
|
|
1444
|
+
will be when a rendering attribute is intended to alter the meaning
|
|
1445
|
+
conveyed by an expression, which is generally discouraged in the
|
|
1446
|
+
presentation attributes of MathML.</p>
|
|
1447
|
+
|
|
1448
|
+
</div5>
|
|
1449
|
+
</div4>
|
|
1450
|
+
|
|
1451
|
+
<div4>
|
|
1452
|
+
<head>Default values of attributes</head>
|
|
1453
|
+
|
|
1454
|
+
<p>Default values for MathML attributes are in general given along with the
|
|
1455
|
+
detailed descriptions of specific elements in the text. Default values
|
|
1456
|
+
shown in plain text in the tables of attributes for an element are literal
|
|
1457
|
+
(unless they are obviously explanatory phrases), but when italicized are
|
|
1458
|
+
descriptions of how default values can be computed.</p>
|
|
1459
|
+
|
|
1460
|
+
<p>Default values described as <emph>inherited</emph> are taken from the
|
|
1461
|
+
rendering environment, as described under <el>mstyle</el>,
|
|
1462
|
+
or in some cases (described individually) from the values of other
|
|
1463
|
+
attributes of surrounding elements, or from certain parts of those
|
|
1464
|
+
values. The value used will always be one which could have been specified
|
|
1465
|
+
explicitly, had it been known; it will never depend on the content or
|
|
1466
|
+
attributes of the same element, only on its environment. (What it means
|
|
1467
|
+
when used may, however, depend on those attributes or the content.)</p>
|
|
1468
|
+
|
|
1469
|
+
<p>Default values described as <emph>automatic</emph> should be computed by
|
|
1470
|
+
a MathML renderer in a way which will produce a high-quality rendering; how
|
|
1471
|
+
to do this is not usually specified by the MathML specification. The value
|
|
1472
|
+
computed will always be one which could have been specified explicitly, had
|
|
1473
|
+
it been known, but it will usually depend on the element content and
|
|
1474
|
+
possibly on the rendering environment.</p>
|
|
1475
|
+
|
|
1476
|
+
<p>Other italicized descriptions of default values which appear in the
|
|
1477
|
+
tables of attributes are explained for each attribute individually.</p>
|
|
1478
|
+
|
|
1479
|
+
<p>The single or double quotes which are required around attribute values
|
|
1480
|
+
in an XML start tag are not shown in the tables of attribute value syntax
|
|
1481
|
+
for each element, but are shown around example attribute values in the
|
|
1482
|
+
text.</p>
|
|
1483
|
+
|
|
1484
|
+
<p>Note that, in general, there is no value which can be given explicitly
|
|
1485
|
+
for a MathML attribute which will simulate the effect of not specifying the
|
|
1486
|
+
attribute at all for attributes which are <emph>inherited</emph> or
|
|
1487
|
+
<emph>automatic</emph>. Giving the words <quote>inherited</quote> or
|
|
1488
|
+
<quote>automatic</quote> explicitly will not work, and is not generally
|
|
1489
|
+
allowed. Furthermore, even for presentation attributes for which a
|
|
1490
|
+
specific default value is documented here, the <el>mstyle</el> element (<specref ref="presm_mstyle"/>) can be
|
|
1491
|
+
used to change this for the elements it contains. Therefore, the MathML DTD
|
|
1492
|
+
declares most presentation attribute default values as <kw>#IMPLIED</kw>,
|
|
1493
|
+
which prevents XML preprocessors from adding them with any specific default
|
|
1494
|
+
value. This point of view is carried through to the MathML schema.</p>
|
|
1495
|
+
</div4>
|
|
1496
|
+
|
|
1497
|
+
<div4>
|
|
1498
|
+
<head>Attribute values in the MathML DTD</head>
|
|
1499
|
+
|
|
1500
|
+
<p>In an XML DTD, allowed attribute values can be declared as general
|
|
1501
|
+
strings, or they can be constrained in various ways, either by enumerating
|
|
1502
|
+
the possible values, or by declaring them to be certain special data
|
|
1503
|
+
types. The choice of an XML attribute type affects the extent to which
|
|
1504
|
+
validity checks can be performed using a DTD.</p>
|
|
1505
|
+
|
|
1506
|
+
<p>The MathML DTD specifies formal XML attribute types for all MathML
|
|
1507
|
+
attributes, including enumerations of legitimate values in some cases. In
|
|
1508
|
+
general, however, the MathML DTD is relatively permissive, frequently
|
|
1509
|
+
declaring attribute values as strings; this is done to provide for
|
|
1510
|
+
interoperability with SGML parsers while allowing multiple attributes on
|
|
1511
|
+
one MathML element to accept the same values (such as <attval>true</attval> and <attval>false</attval>), and also to
|
|
1512
|
+
allow extension to the lists of predefined values.</p>
|
|
1513
|
+
|
|
1514
|
+
<p>At the same time, even though an attribute value may be declared as a
|
|
1515
|
+
string in the DTD, only certain values are legitimate in MathML, as
|
|
1516
|
+
described above and in the rest of this specification. For example, many
|
|
1517
|
+
attributes expect numerical values. In the sections which follow, the
|
|
1518
|
+
allowed attribute values are described for each element. To determine when
|
|
1519
|
+
these constraints are actually enforced in the MathML DTD, consult <specref
|
|
1520
|
+
ref="parsing"/>. However, lack of enforcement of a requirement in the DTD
|
|
1521
|
+
does <emph>not</emph> imply that the requirement is not part of the MathML
|
|
1522
|
+
language itself, or that it will not be enforced by a particular MathML
|
|
1523
|
+
renderer. (See <specref ref="interf_error"/> for a description of how
|
|
1524
|
+
MathML renderers should respond to MathML errors.)</p>
|
|
1525
|
+
|
|
1526
|
+
<p>Furthermore, the MathML DTD is provided for convenience; although it is
|
|
1527
|
+
intended to be fully compatible with the text of the specification, the
|
|
1528
|
+
text should be taken as definitive if there is a contradiction. (Any
|
|
1529
|
+
contradictions which may exist between various chapters of the text should
|
|
1530
|
+
be resolved by favoring <specref ref="chars"/> first, then <specref
|
|
1531
|
+
ref="presm"/>, <specref ref="contm"/>, then <specref ref="fund_syntax"/>,
|
|
1532
|
+
and then other parts of the text.) For the MathML schema the situation
|
|
1533
|
+
will be the same: the published Recommendation text takes precedence.
|
|
1534
|
+
Though this is what is intended to happen, there is a practical difficulty.
|
|
1535
|
+
If the system processing the MathML uses a validating parser, whether it be
|
|
1536
|
+
based on a DTD or on a schema, the process will probably simply stop when
|
|
1537
|
+
it hits something held to be incorrect syntax, whether or not further
|
|
1538
|
+
MathML processing in full harmony with the specification would have
|
|
1539
|
+
processed the piece correctly.</p>
|
|
1540
|
+
|
|
1541
|
+
</div4>
|
|
1542
|
+
</div3>
|
|
1543
|
+
|
|
1544
|
+
<div3 id="fund_globatt">
|
|
1545
|
+
<head>Attributes Shared by all MathML Elements</head>
|
|
1546
|
+
|
|
1547
|
+
<p>In order to facilitate use with style sheet mechanisms such as
|
|
1548
|
+
<bibref ref="XSLT"/> and <bibref ref="CSS2"/>
|
|
1549
|
+
all MathML elements accept <att>class</att>, <att>style</att>, and <att>id</att> attributes in addition to the attributes described
|
|
1550
|
+
specifically for each element. MathML renderers not supporting CSS may
|
|
1551
|
+
ignore these attributes. MathML specifies these attribute values as general
|
|
1552
|
+
strings, even if style sheet mechanisms have more restrictive syntaxes for
|
|
1553
|
+
them. That is, any value for them is valid in MathML.</p>
|
|
1554
|
+
|
|
1555
|
+
<p>In order to facilitate compatibility with linking mechanisms, all
|
|
1556
|
+
MathML elements accept the <att>xlink:href</att>
|
|
1557
|
+
attribute.</p>
|
|
1558
|
+
|
|
1559
|
+
<p>All MathML elements also accept the <att>xref</att>
|
|
1560
|
+
attribute for use in parallel markup (<specref
|
|
1561
|
+
ref="mixing_parallel"/>). The <att>id</att> is also used
|
|
1562
|
+
in this context.</p>
|
|
1563
|
+
|
|
1564
|
+
<p>Every MathML element, because of a legacy from MathML 1.0, also
|
|
1565
|
+
accepts the <intref ref="interf_deprec">deprecated</intref> attribute
|
|
1566
|
+
<att>other</att> (<specref ref="interf_unspecified"/>)
|
|
1567
|
+
which was conceived for passing non-standard attributes without
|
|
1568
|
+
violating the MathML DTD. MathML renderers are only required to
|
|
1569
|
+
process this attribute if they respond to any attributes which are not
|
|
1570
|
+
standard in MathML. However, the use of <att>other</att>
|
|
1571
|
+
is strongly <phrase diff="chg">discouraged</phrase> when there are already other ways within MathML
|
|
1572
|
+
of passing specific information.</p>
|
|
1573
|
+
|
|
1574
|
+
<p>See also <specref ref="presm_commatt"/> for a list of MathML attributes
|
|
1575
|
+
which can be used on most presentation token elements.</p>
|
|
1576
|
+
</div3>
|
|
1577
|
+
|
|
1578
|
+
<div3 id="fund_collapse">
|
|
1579
|
+
<head>Collapsing Whitespace in Input</head>
|
|
1580
|
+
|
|
1581
|
+
<p>MathML ignores whitespace occurring outside token elements.
|
|
1582
|
+
Non-whitespace characters are not allowed there. Whitespace occurring
|
|
1583
|
+
within the content of token elements is <quote>trimmed</quote> from the
|
|
1584
|
+
ends, i.e., all whitespace at the beginning and end of the content is
|
|
1585
|
+
removed. Whitespace internal to content of MathML elements is
|
|
1586
|
+
<quote>collapsed</quote> canonically, i.e., each sequence of 1 or more
|
|
1587
|
+
whitespace characters is replaced with one space character (sometimes
|
|
1588
|
+
called a blank character).</p>
|
|
1589
|
+
|
|
1590
|
+
<p>In MathML, as in XML, <quote>whitespace</quote> means simple spaces,
|
|
1591
|
+
tabs, newlines, or carriage returns, i.e., characters with hexadecimal
|
|
1592
|
+
Unicode codes <kw>U+0020</kw>, <kw>U+0009</kw>, <kw>U+000A</kw>, or
|
|
1593
|
+
<kw>U+000D</kw>, respectively.</p>
|
|
1594
|
+
|
|
1595
|
+
<p>For example, <code><![CDATA[<mo> ( </mo>]]></code> is equivalent to
|
|
1596
|
+
<code><![CDATA[<mo>(</mo>]]></code>, and
|
|
1597
|
+
<eg role='mathml'><![CDATA[
|
|
1598
|
+
<mtext>
|
|
1599
|
+
Theorem
|
|
1600
|
+
1:
|
|
1601
|
+
</mtext>
|
|
1602
|
+
]]></eg>
|
|
1603
|
+
is equivalent to
|
|
1604
|
+
<code><![CDATA[<mtext>Theorem 1:</mtext>]]></code>.</p>
|
|
1605
|
+
|
|
1606
|
+
<p>Authors wishing to encode whitespace characters at the start or end of
|
|
1607
|
+
the content of a token, or in sequences other than a single space, without
|
|
1608
|
+
having them ignored, must use <kw role="entity">nbsp</kw> or other
|
|
1609
|
+
<quote>whitespace</quote> non-marking entities as described in <specref
|
|
1610
|
+
ref="chars_nonmark"/>. For example, compare
|
|
1611
|
+
<eg role='mathml'><![CDATA[
|
|
1612
|
+
<mtext>
|
|
1613
|
+
Theorem
|
|
1614
|
+
1:
|
|
1615
|
+
</mtext>
|
|
1616
|
+
]]></eg>
|
|
1617
|
+
with
|
|
1618
|
+
<eg role='mathml'><![CDATA[
|
|
1619
|
+
<mtext>
|
|
1620
|
+
Theorem 1:
|
|
1621
|
+
</mtext> ]]></eg>
|
|
1622
|
+
</p>
|
|
1623
|
+
|
|
1624
|
+
<p>When the first example is rendered, there is no whitespace before
|
|
1625
|
+
<quote>Theorem</quote>, one space between <quote>Theorem</quote> and
|
|
1626
|
+
<quote>1:</quote>, and no whitespace after <quote>1:</quote>. In the
|
|
1627
|
+
second example, a single space is rendered before
|
|
1628
|
+
<quote>Theorem</quote>, two spaces are rendered before
|
|
1629
|
+
<quote>1:</quote>, and there is no whitespace after the
|
|
1630
|
+
<quote>1:</quote>.</p>
|
|
1631
|
+
|
|
1632
|
+
<p>Note that the <att>xml:space</att> attribute does not apply
|
|
1633
|
+
in this situation since XML processors pass whitespace in tokens to a
|
|
1634
|
+
MathML processor; it is the MathML processing rules which specify that
|
|
1635
|
+
whitespace is trimmed and collapsed.</p>
|
|
1636
|
+
|
|
1637
|
+
<p>For whitespace occurring outside the content of the token elements <el>mi</el>, <el>mn</el>, <el>mo</el>, <el>ms</el>, <el>mtext</el>, <el>ci</el>, <el>cn</el> and <el>annotation</el>, an <el>mspace</el> element should be used, as opposed to an <el>mtext</el> element containing only <quote>whitespace</quote>
|
|
1638
|
+
entities.</p>
|
|
1639
|
+
|
|
1640
|
+
</div3>
|
|
1641
|
+
|
|
1642
|
+
</div2>
|
|
1643
|
+
</div1>
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
|