home *** CD-ROM | disk | FTP | other *** search
/ XML Bible (2nd Edition) / XML_Bible_Second_Edition_Hungry_Minds_2001.iso / mac / specs / XML-MathML-20010221 / xml / fundamentals.xml < prev    next >
Text File  |  2001-02-19  |  69KB  |  1,687 lines

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