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.
Files changed (336) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +9 -0
  3. data/.rubocop.yml +4 -0
  4. data/.rubocop_todo.yml +83 -18
  5. data/Gemfile +0 -2
  6. data/README.adoc +176 -47
  7. data/Rakefile +16 -1
  8. data/lib/mml/base/common_attributes.rb +44 -0
  9. data/lib/mml/base/content/annotation.rb +28 -0
  10. data/lib/mml/base/content/annotation_xml.rb +31 -0
  11. data/lib/mml/base/content/apply.rb +27 -0
  12. data/lib/mml/base/content/arith.rb +243 -0
  13. data/lib/mml/base/content/bind.rb +27 -0
  14. data/lib/mml/base/content/bvar.rb +20 -0
  15. data/lib/mml/base/content/calculus.rb +103 -0
  16. data/lib/mml/base/content/cbytes.rb +24 -0
  17. data/lib/mml/base/content/cerror.rb +24 -0
  18. data/lib/mml/base/content/ci.rb +77 -0
  19. data/lib/mml/base/content/cn.rb +33 -0
  20. data/lib/mml/base/content/condition.rb +20 -0
  21. data/lib/mml/base/content/constants.rb +173 -0
  22. data/lib/mml/base/content/cs.rb +22 -0
  23. data/lib/mml/base/content/csymbol.rb +79 -0
  24. data/lib/mml/base/content/declare.rb +34 -0
  25. data/lib/mml/base/content/degree.rb +20 -0
  26. data/lib/mml/base/content/elementary_functions.rb +309 -0
  27. data/lib/mml/base/content/fn.rb +25 -0
  28. data/lib/mml/base/content/functions.rb +85 -0
  29. data/lib/mml/base/content/interval.rb +24 -0
  30. data/lib/mml/base/content/inverse.rb +25 -0
  31. data/lib/mml/base/content/lambda.rb +20 -0
  32. data/lib/mml/base/content/linear_algebra.rb +122 -0
  33. data/lib/mml/base/content/logic.rb +93 -0
  34. data/lib/mml/base/content/otherwise.rb +20 -0
  35. data/lib/mml/base/content/piece.rb +20 -0
  36. data/lib/mml/base/content/piecewise.rb +20 -0
  37. data/lib/mml/base/content/relations.rb +113 -0
  38. data/lib/mml/base/content/reln.rb +19 -0
  39. data/lib/mml/base/content/semantics.rb +27 -0
  40. data/lib/mml/base/content/sep.rb +19 -0
  41. data/lib/mml/base/content/sets.rb +163 -0
  42. data/lib/mml/base/content/share.rb +22 -0
  43. data/lib/mml/base/content/statistics.rb +95 -0
  44. data/lib/mml/base/content/vector_calculus.rb +63 -0
  45. data/lib/mml/base/content_loader.rb +195 -0
  46. data/lib/mml/base/maction.rb +1 -0
  47. data/lib/mml/base/math.rb +47 -0
  48. data/lib/mml/base/menclose.rb +1 -1
  49. data/lib/mml/base/mfenced.rb +2 -2
  50. data/lib/mml/base/mglyph.rb +2 -2
  51. data/lib/mml/base/mi.rb +9 -6
  52. data/lib/mml/base/mlabeledtr.rb +2 -6
  53. data/lib/mml/base/mn.rb +3 -2
  54. data/lib/mml/base/mo.rb +3 -3
  55. data/lib/mml/base/mrow.rb +0 -2
  56. data/lib/mml/base/ms.rb +4 -6
  57. data/lib/mml/base/mscarries.rb +1 -1
  58. data/lib/mml/base/mspace.rb +0 -2
  59. data/lib/mml/base/mstyle.rb +4 -8
  60. data/lib/mml/base/mtable.rb +8 -0
  61. data/lib/mml/base/mtd.rb +6 -0
  62. data/lib/mml/base/mtext.rb +0 -2
  63. data/lib/mml/base/semantics.rb +4 -2
  64. data/lib/mml/base/universal_presentation_attributes.rb +46 -0
  65. data/lib/mml/base/v3_common.rb +16 -0
  66. data/lib/mml/base/v3_presentation_attributes.rb +15 -0
  67. data/lib/mml/base/v4_attributes.rb +4 -18
  68. data/lib/mml/base.rb +11 -0
  69. data/lib/mml/common_elements.rb +336 -0
  70. data/lib/mml/context_configuration.rb +29 -0
  71. data/lib/mml/v2/annotation.rb +9 -0
  72. data/lib/mml/v2/annotation_xml.rb +9 -0
  73. data/lib/mml/v2/apply.rb +9 -0
  74. data/lib/mml/v2/arith.rb +93 -0
  75. data/lib/mml/v2/bind.rb +9 -0
  76. data/lib/mml/v2/bvar.rb +9 -0
  77. data/lib/mml/v2/calculus.rb +33 -0
  78. data/lib/mml/v2/ci.rb +9 -0
  79. data/lib/mml/v2/cn.rb +9 -0
  80. data/lib/mml/v2/common_elements.rb +34 -0
  81. data/lib/mml/v2/condition.rb +9 -0
  82. data/lib/mml/v2/configuration.rb +13 -0
  83. data/lib/mml/v2/constants.rb +65 -0
  84. data/lib/mml/v2/csymbol.rb +9 -0
  85. data/lib/mml/v2/degree.rb +9 -0
  86. data/lib/mml/v2/elementary_functions.rb +121 -0
  87. data/lib/mml/v2/fn.rb +9 -0
  88. data/lib/mml/v2/functions.rb +29 -0
  89. data/lib/mml/v2/interval.rb +9 -0
  90. data/lib/mml/v2/inverse.rb +9 -0
  91. data/lib/mml/v2/lambda.rb +9 -0
  92. data/lib/mml/v2/linear_algebra.rb +41 -0
  93. data/lib/mml/v2/logic.rb +33 -0
  94. data/lib/mml/v2/maction.rb +9 -0
  95. data/lib/mml/v2/maligngroup.rb +9 -0
  96. data/lib/mml/v2/malignmark.rb +9 -0
  97. data/lib/mml/v2/math.rb +11 -0
  98. data/lib/mml/v2/menclose.rb +9 -0
  99. data/lib/mml/v2/merror.rb +9 -0
  100. data/lib/mml/v2/mfenced.rb +9 -0
  101. data/lib/mml/v2/mfrac.rb +9 -0
  102. data/lib/mml/v2/mfraction.rb +9 -0
  103. data/lib/mml/v2/mglyph.rb +9 -0
  104. data/lib/mml/v2/mi.rb +9 -0
  105. data/lib/mml/v2/mlabeledtr.rb +9 -0
  106. data/lib/mml/v2/mlongdiv.rb +9 -0
  107. data/lib/mml/v2/mmultiscripts.rb +9 -0
  108. data/lib/mml/v2/mn.rb +9 -0
  109. data/lib/mml/v2/mo.rb +10 -0
  110. data/lib/mml/v2/mover.rb +9 -0
  111. data/lib/mml/v2/mpadded.rb +9 -0
  112. data/lib/mml/v2/mphantom.rb +9 -0
  113. data/lib/mml/v2/mprescripts.rb +9 -0
  114. data/lib/mml/v2/mroot.rb +9 -0
  115. data/lib/mml/v2/mrow.rb +9 -0
  116. data/lib/mml/v2/ms.rb +9 -0
  117. data/lib/mml/v2/mscarries.rb +9 -0
  118. data/lib/mml/v2/mscarry.rb +9 -0
  119. data/lib/mml/v2/msgroup.rb +9 -0
  120. data/lib/mml/v2/msline.rb +9 -0
  121. data/lib/mml/v2/mspace.rb +9 -0
  122. data/lib/mml/v2/msqrt.rb +9 -0
  123. data/lib/mml/v2/msrow.rb +9 -0
  124. data/lib/mml/v2/mstack.rb +9 -0
  125. data/lib/mml/v2/mstyle.rb +10 -0
  126. data/lib/mml/v2/msub.rb +9 -0
  127. data/lib/mml/v2/msubsup.rb +9 -0
  128. data/lib/mml/v2/msup.rb +9 -0
  129. data/lib/mml/v2/mtable.rb +9 -0
  130. data/lib/mml/v2/mtd.rb +9 -0
  131. data/lib/mml/v2/mtext.rb +9 -0
  132. data/lib/mml/v2/mtr.rb +9 -0
  133. data/lib/mml/v2/munder.rb +9 -0
  134. data/lib/mml/v2/munderover.rb +9 -0
  135. data/lib/mml/v2/namespace.rb +7 -0
  136. data/lib/mml/v2/none.rb +9 -0
  137. data/lib/mml/v2/otherwise.rb +9 -0
  138. data/lib/mml/v2/piece.rb +9 -0
  139. data/lib/mml/v2/piecewise.rb +9 -0
  140. data/lib/mml/v2/relations.rb +41 -0
  141. data/lib/mml/v2/reln.rb +13 -0
  142. data/lib/mml/v2/semantics.rb +9 -0
  143. data/lib/mml/v2/sep.rb +9 -0
  144. data/lib/mml/v2/sets.rb +57 -0
  145. data/lib/mml/v2/statistics.rb +33 -0
  146. data/lib/mml/v2/vector_calculus.rb +21 -0
  147. data/lib/mml/v2.rb +311 -0
  148. data/lib/mml/v3/annotation.rb +10 -0
  149. data/lib/mml/v3/annotation_xml.rb +10 -0
  150. data/lib/mml/v3/apply.rb +10 -0
  151. data/lib/mml/v3/arith.rb +115 -0
  152. data/lib/mml/v3/bind.rb +10 -0
  153. data/lib/mml/v3/calculus.rb +40 -0
  154. data/lib/mml/v3/cbytes.rb +10 -0
  155. data/lib/mml/v3/cerror.rb +10 -0
  156. data/lib/mml/v3/ci.rb +10 -0
  157. data/lib/mml/v3/cn.rb +10 -0
  158. data/lib/mml/v3/common_elements.rb +34 -0
  159. data/lib/mml/v3/constants.rb +80 -0
  160. data/lib/mml/v3/constructs.rb +55 -0
  161. data/lib/mml/v3/cs.rb +10 -0
  162. data/lib/mml/v3/csymbol.rb +10 -0
  163. data/lib/mml/v3/deprecated_content.rb +29 -0
  164. data/lib/mml/v3/elementary_functions.rb +145 -0
  165. data/lib/mml/v3/functions.rb +35 -0
  166. data/lib/mml/v3/linear_algebra.rb +50 -0
  167. data/lib/mml/v3/logic.rb +40 -0
  168. data/lib/mml/v3/maction.rb +1 -1
  169. data/lib/mml/v3/math.rb +7 -1
  170. data/lib/mml/v3/mi.rb +1 -0
  171. data/lib/mml/v3/mn.rb +1 -0
  172. data/lib/mml/v3/mo.rb +1 -0
  173. data/lib/mml/v3/mrow.rb +1 -0
  174. data/lib/mml/v3/ms.rb +1 -0
  175. data/lib/mml/v3/mstyle.rb +1 -0
  176. data/lib/mml/v3/mtext.rb +1 -0
  177. data/lib/mml/v3/relations.rb +50 -0
  178. data/lib/mml/v3/sets.rb +70 -0
  179. data/lib/mml/v3/statistics.rb +40 -0
  180. data/lib/mml/v3/vector_calculus.rb +25 -0
  181. data/lib/mml/v3.rb +25 -0
  182. data/lib/mml/v4/a.rb +4 -3
  183. data/lib/mml/v4/annotation.rb +10 -0
  184. data/lib/mml/v4/annotation_xml.rb +14 -0
  185. data/lib/mml/v4/apply.rb +9 -0
  186. data/lib/mml/v4/arith.rb +93 -0
  187. data/lib/mml/v4/calculus.rb +25 -0
  188. data/lib/mml/v4/cbytes.rb +9 -0
  189. data/lib/mml/v4/cerror.rb +9 -0
  190. data/lib/mml/v4/ci.rb +9 -0
  191. data/lib/mml/v4/cn.rb +9 -0
  192. data/lib/mml/v4/common_elements.rb +33 -0
  193. data/lib/mml/v4/constants.rb +65 -0
  194. data/lib/mml/v4/constructs.rb +49 -0
  195. data/lib/mml/v4/cs.rb +9 -0
  196. data/lib/mml/v4/csymbol.rb +9 -0
  197. data/lib/mml/v4/deprecated_content.rb +25 -0
  198. data/lib/mml/v4/elementary_functions.rb +118 -0
  199. data/lib/mml/v4/factorof.rb +9 -0
  200. data/lib/mml/v4/functions.rb +30 -0
  201. data/lib/mml/v4/limit.rb +9 -0
  202. data/lib/mml/v4/linear_algebra.rb +41 -0
  203. data/lib/mml/v4/logic.rb +33 -0
  204. data/lib/mml/v4/maction.rb +1 -2
  205. data/lib/mml/v4/maligngroup.rb +0 -1
  206. data/lib/mml/v4/malignmark.rb +0 -1
  207. data/lib/mml/v4/math.rb +1 -1
  208. data/lib/mml/v4/menclose.rb +0 -1
  209. data/lib/mml/v4/merror.rb +0 -1
  210. data/lib/mml/v4/mfenced.rb +0 -1
  211. data/lib/mml/v4/mfrac.rb +0 -1
  212. data/lib/mml/v4/mfraction.rb +0 -1
  213. data/lib/mml/v4/mglyph.rb +0 -1
  214. data/lib/mml/v4/mi.rb +1 -1
  215. data/lib/mml/v4/mlabeledtr.rb +0 -1
  216. data/lib/mml/v4/mlongdiv.rb +0 -1
  217. data/lib/mml/v4/mmultiscripts.rb +0 -1
  218. data/lib/mml/v4/mn.rb +1 -1
  219. data/lib/mml/v4/mo.rb +1 -1
  220. data/lib/mml/v4/mover.rb +0 -1
  221. data/lib/mml/v4/mpadded.rb +0 -1
  222. data/lib/mml/v4/mphantom.rb +0 -1
  223. data/lib/mml/v4/mprescripts.rb +0 -1
  224. data/lib/mml/v4/mroot.rb +0 -1
  225. data/lib/mml/v4/mrow.rb +1 -1
  226. data/lib/mml/v4/ms.rb +1 -1
  227. data/lib/mml/v4/mscarries.rb +0 -1
  228. data/lib/mml/v4/mscarry.rb +0 -1
  229. data/lib/mml/v4/msgroup.rb +0 -1
  230. data/lib/mml/v4/msline.rb +0 -1
  231. data/lib/mml/v4/mspace.rb +0 -1
  232. data/lib/mml/v4/msqrt.rb +0 -1
  233. data/lib/mml/v4/msrow.rb +0 -1
  234. data/lib/mml/v4/mstack.rb +0 -1
  235. data/lib/mml/v4/mstyle.rb +1 -1
  236. data/lib/mml/v4/msub.rb +0 -1
  237. data/lib/mml/v4/msubsup.rb +0 -1
  238. data/lib/mml/v4/msup.rb +0 -1
  239. data/lib/mml/v4/mtable.rb +0 -1
  240. data/lib/mml/v4/mtd.rb +0 -1
  241. data/lib/mml/v4/mtext.rb +1 -1
  242. data/lib/mml/v4/mtr.rb +0 -1
  243. data/lib/mml/v4/munder.rb +0 -1
  244. data/lib/mml/v4/munderover.rb +0 -1
  245. data/lib/mml/v4/none.rb +0 -1
  246. data/lib/mml/v4/relations.rb +37 -0
  247. data/lib/mml/v4/semantics.rb +0 -1
  248. data/lib/mml/v4/sets.rb +57 -0
  249. data/lib/mml/v4/statistics.rb +33 -0
  250. data/lib/mml/v4/tendsto.rb +9 -0
  251. data/lib/mml/v4/vector_calculus.rb +21 -0
  252. data/lib/mml/v4.rb +421 -44
  253. data/lib/mml/version.rb +1 -1
  254. data/lib/mml/versioned_parser.rb +1 -1
  255. data/lib/mml.rb +3 -1
  256. data/reference-docs/mathml-source/pubtext/mathmlspec.dtd +150 -0
  257. data/reference-docs/mathml-source/pubtext/xmlspec.dtd +2649 -0
  258. data/reference-docs/mathml-source/readme.txt +40 -0
  259. data/reference-docs/mathml-source/run +296 -0
  260. data/reference-docs/mathml-source/style/html/html2xhtml.xsl +216 -0
  261. data/reference-docs/mathml-source/style/html/images.xsl +98 -0
  262. data/reference-docs/mathml-source/style/html/mml6.xsl +1156 -0
  263. data/reference-docs/mathml-source/style/html/mmldiff.xsl +566 -0
  264. data/reference-docs/mathml-source/style/html/mmlspec.xsl +2531 -0
  265. data/reference-docs/mathml-source/style/html/slices-common.xsl +312 -0
  266. data/reference-docs/mathml-source/style/html/slices.xsl +48 -0
  267. data/reference-docs/mathml-source/style/html/xmlspec.xsl +2542 -0
  268. data/reference-docs/mathml-source/style/pdf/mathmlspec.xsl +2510 -0
  269. data/reference-docs/mathml-source/xml/changes.xml +773 -0
  270. data/reference-docs/mathml-source/xml/character-set.xml +1011 -0
  271. data/reference-docs/mathml-source/xml/content-element-def.xml +6143 -0
  272. data/reference-docs/mathml-source/xml/content-markup.xml +8178 -0
  273. data/reference-docs/mathml-source/xml/contributors.xml +425 -0
  274. data/reference-docs/mathml-source/xml/dom-bindings.xml +20 -0
  275. data/reference-docs/mathml-source/xml/dom-intro.xml +114 -0
  276. data/reference-docs/mathml-source/xml/fundamentals.xml +1646 -0
  277. data/reference-docs/mathml-source/xml/glossary.xml +519 -0
  278. data/reference-docs/mathml-source/xml/interface.xml +1096 -0
  279. data/reference-docs/mathml-source/xml/introduction.xml +724 -0
  280. data/reference-docs/mathml-source/xml/mathml-css-sample.xml +304 -0
  281. data/reference-docs/mathml-source/xml/mathml-dom.xml +3813 -0
  282. data/reference-docs/mathml-source/xml/mathml-spec.xml +356 -0
  283. data/reference-docs/mathml-source/xml/mixing.xml +982 -0
  284. data/reference-docs/mathml-source/xml/operator-dict.xml +551 -0
  285. data/reference-docs/mathml-source/xml/parsing.xml +2565 -0
  286. data/reference-docs/mathml-source/xml/presentation-markup.xml +6834 -0
  287. data/reference-docs/mathml-source/xml/references.xml +323 -0
  288. data/reference-docs/mathml-source/xml/validation-grammar.xml +877 -0
  289. data/schemas/README.adoc +17 -0
  290. data/schemas/mathml2/common/common-attribs.xsd +41 -0
  291. data/schemas/mathml2/common/math.xsd +126 -0
  292. data/schemas/mathml2/common/xlink-href.xsd +20 -0
  293. data/schemas/mathml2/content/CVS/Entries +16 -0
  294. data/schemas/mathml2/content/CVS/Repository +1 -0
  295. data/schemas/mathml2/content/CVS/Root +1 -0
  296. data/schemas/mathml2/content/arith.xsd +90 -0
  297. data/schemas/mathml2/content/calculus.xsd +146 -0
  298. data/schemas/mathml2/content/common-attrib.xsd +30 -0
  299. data/schemas/mathml2/content/constants.xsd +83 -0
  300. data/schemas/mathml2/content/constructs.xsd +260 -0
  301. data/schemas/mathml2/content/elementary-functions.xsd +117 -0
  302. data/schemas/mathml2/content/functions.xsd +73 -0
  303. data/schemas/mathml2/content/linear-algebra.xsd +173 -0
  304. data/schemas/mathml2/content/logic.xsd +53 -0
  305. data/schemas/mathml2/content/relations.xsd +55 -0
  306. data/schemas/mathml2/content/semantics.xsd +85 -0
  307. data/schemas/mathml2/content/sets.xsd +236 -0
  308. data/schemas/mathml2/content/statistics.xsd +136 -0
  309. data/schemas/mathml2/content/tokens.xsd +120 -0
  310. data/schemas/mathml2/content/tokens.xsd.~1.3.~ +119 -0
  311. data/schemas/mathml2/content/vector-calculus.xsd +88 -0
  312. data/schemas/mathml2/mathml2.xsd +59 -0
  313. data/schemas/mathml2/presentation/action.xsd +44 -0
  314. data/schemas/mathml2/presentation/characters.xsd +37 -0
  315. data/schemas/mathml2/presentation/common-attribs.xsd +113 -0
  316. data/schemas/mathml2/presentation/common-types.xsd +103 -0
  317. data/schemas/mathml2/presentation/error.xsd +40 -0
  318. data/schemas/mathml2/presentation/layout.xsd +195 -0
  319. data/schemas/mathml2/presentation/scripts.xsd +186 -0
  320. data/schemas/mathml2/presentation/space.xsd +52 -0
  321. data/schemas/mathml2/presentation/style.xsd +69 -0
  322. data/schemas/mathml2/presentation/table.xsd +216 -0
  323. data/schemas/mathml2/presentation/tokens.xsd +124 -0
  324. data/schemas/mathml3/mathml3-common.xsd +99 -0
  325. data/schemas/mathml3/mathml3-content.xsd +684 -0
  326. data/schemas/mathml3/mathml3-presentation.xsd +2151 -0
  327. data/schemas/mathml3/mathml3-strict-content.xsd +186 -0
  328. data/schemas/mathml3/mathml3.xsd +9 -0
  329. data/schemas/mathml4/mathml4-content.rnc +382 -0
  330. data/schemas/mathml4/mathml4-core.rnc +361 -0
  331. data/schemas/mathml4/mathml4-presentation.rnc +358 -0
  332. data/schemas/mathml4/mathml4-strict-content.rnc +86 -0
  333. data/schemas/mathml4/mathml4.rnc +21 -0
  334. data/schemas/mathml4/mathml4.rnc.1 +21 -0
  335. data/schemas/mathml4/mathml4.rng +37 -0
  336. metadata +249 -2
@@ -0,0 +1,982 @@
1
+ <div1 id="mixing" role="chapter5"><head>Combining Presentation and Content Markup</head>
2
+ <!-- $Id: mixing.xml,v 1.45 2003/06/09 13:42:03 jsdevitt Exp $ -->
3
+
4
+ <!--
5
+ Principal authors
6
+ Stephen Watt: overal design; organization and original text of documentation.
7
+ Robert Miner: additional text.
8
+ -->
9
+
10
+ <p>Presentation markup and content markup can be combined in two
11
+ ways. The first manner is to intersperse content and presentation elements
12
+ in what is essentially a single tree. This is called <emph>mixed</emph>
13
+ markup. The second manner is to provide <emph>both</emph> an explicit
14
+ presentation and an explicit content in a pair of trees. This is called
15
+ <emph>parallel</emph> markup. This chapter describes both mixed and
16
+ parallel markup, and how they may used in conjunction with style sheets and
17
+ other tools.</p>
18
+
19
+ <div2 id="mixing_why"><head>Why Two Different Kinds of Markup?</head>
20
+
21
+ <p>Chapters 3 and 4 describe two kinds of markup for encoding mathematical
22
+ material in documents.</p>
23
+
24
+ <p><emph>Presentation markup</emph> captures <emph>notational
25
+ structure</emph>. It encodes the notational structure of an expression in a
26
+ sufficiently abstract way to facilitate rendering to various media. Thus,
27
+ the same presentation markup can be rendered with relative ease on screen
28
+ in either wide and narrow windows, in ASCII or graphics, in print, or it
29
+ can be enunciated in a sensible way when spoken. It does this by providing
30
+ information such as structured grouping of expression parts, classification
31
+ of symbols, etc.</p>
32
+
33
+ <p>Presentation markup does <emph>not</emph> directly concern itself with
34
+ the mathematical structure or meaning of an expression. In many situations,
35
+ notational structure and mathematical structure are closely related, so a
36
+ sophisticated processing application may be able to heuristically infer
37
+ mathematical meaning from notational structure, provided sufficient context
38
+ is known. However, in practice, the inference of mathematical meaning from
39
+ mathematical notation must often be left to the reader.</p>
40
+
41
+ <p> Employing presentation tags alone may limit the ability to re-use a
42
+ MathML object in another context, especially evaluation by external
43
+ applications.</p>
44
+
45
+ <p><emph>Content markup</emph> captures <emph>mathematical
46
+ structure</emph>. It encodes mathematical structure in a sufficiently
47
+ regular way in order to facilitate the assignment of mathematical meaning
48
+ to an expression by application programs. Though the details of mapping
49
+ from mathematical expression structure to mathematical meaning can be
50
+ extremely complex, in practice, there is wide agreement about the
51
+ conventional meaning of many basic mathematical constructions.
52
+ Consequently, much of the meaning of a content expression is easily
53
+ accessible to a processing application, independently of where or how it is
54
+ displayed to the reader. In many cases, content markup could be cut from a
55
+ Web browser and pasted into a mathematical software tool
56
+ with confidence that sensible
57
+ values will be computed.</p>
58
+
59
+ <p>Since content markup is <emph>not</emph> directly concerned with how an
60
+ expression is displayed, a renderer must infer how an expression should be
61
+ presented to a reader. While a sufficiently sophisticated renderer and
62
+ style sheet mechanism could in principle allow a user to read mathematical
63
+ documents using personalized notational preferences, in practice, rendering
64
+ content expressions with notational nuances may still require
65
+ intervention of some sort.</p>
66
+
67
+ <p> Employing content tags alone may limit the ability of the author to
68
+ precisely control how an expression is rendered.</p>
69
+
70
+ <p>Both content and presentation tags are
71
+ necessary in order to provide the full expressive capability one would
72
+ expect in a mathematical markup language. Often the same mathematical
73
+ notation is used to represent several completely different concepts. For
74
+ example, the notation <var>x</var><sup><var>i</var></sup> may be intended (in
75
+ polynomial algebra) as the <var>i</var>-th power of the variable <var>x</var>,
76
+ or as the <var>i</var>-th component of a vector <var>x</var> (in tensor calculus).
77
+ In other cases, the same mathematical concept may be displayed in one of various
78
+ notations. For instance, the factorial of a number might be expressed with
79
+ an exclamation mark, a Gamma function, or a Pochhammer symbol.</p>
80
+
81
+ <p>Thus the same notation may represent several mathematical ideas, and,
82
+ conversely, the same mathematical idea often has several notations. In
83
+ order to provide authors with the ability to precisely control notation
84
+ while at the same time encoding meanings in a machine-readable way,
85
+ both content and presentation markup are needed.</p>
86
+
87
+ <p>In general, if it is important to control exactly how an expression is
88
+ rendered, presentation markup will generally be more satisfactory. If it is
89
+ important that the meaning of an expression can be interpreted dependably
90
+ and automatically, then content markup will generally be more
91
+ satisfactory.</p>
92
+ </div2>
93
+
94
+ <div2 id="mixing_markup"><head>Mixed Markup</head>
95
+
96
+ <p>MathML offers authors elements for both content and presentation
97
+ markup. Whether to use one or the other, or a combination of both, depends
98
+ on what aspects of rendering and interpretation an author wishes to
99
+ control, and what kinds of re-use he or she wishes to facilitate.</p>
100
+
101
+ <div3 id="mixing_reasons"><head>Reasons to Mix Markup</head>
102
+
103
+ <p>In many common situations, an author or authoring tool may choose to
104
+ generate either presentation or content markup exclusively. For example, a
105
+ program for translating legacy documents would most likely generate pure
106
+ presentation markup. Similarly, an educational software package might very
107
+ well generate only content markup for evaluation in a computer algebra
108
+ system. However, in many other situations, there are advantages to mixing
109
+ both presentation and content markup within a single expression.</p>
110
+
111
+ <p>If an author is primarily presentation-oriented, interspersing some
112
+ content markup will often produce more accessible, more re-usable
113
+ results. For example, an author writing about linear algebra might write:
114
+ <eg role="mathml"><![CDATA[
115
+ <mrow>
116
+ <apply>
117
+ <power/>
118
+ <ci>x</ci>
119
+ <cn>2</cn>
120
+ </apply>
121
+ <mo>+</mo>
122
+ <msup>
123
+ <mi>v</mi>
124
+ <mn>2</mn>
125
+ </msup>
126
+ </mrow>
127
+ ]]></eg>
128
+ where <var>v</var> is a vector and the superscript denotes a vector
129
+ component, and <var>x</var> is a real variable. On account of the linear
130
+ algebra context, a visually impaired reader may have directed his or her
131
+ voice synthesis software to render superscripts as vector components. By
132
+ explicitly encoding the power, the content markup yields a much better
133
+ voice rendering than would likely happen by default.</p>
134
+
135
+ <p>If an author is primarily content-oriented, there are two reasons to
136
+ intersperse presentation markup. First, using presentation markup provides
137
+ a way of modifying or refining how a content expression is rendered. For
138
+ example, one might write:
139
+ <eg role="mathml"><![CDATA[
140
+ <apply>
141
+ <in/>
142
+ <ci><mi mathvariant="bold">v</mi></ci>
143
+ <ci>S</ci>
144
+ </apply>
145
+ ]]></eg>
146
+ In this case, the use of embedded presentation markup allows the
147
+ author to specify that <var>v</var> should be rendered in
148
+ boldface.
149
+ In the same way, it is sometimes the case that a completely different
150
+ notation is desired for a content expression. For example, here
151
+ we express a fact about factorials, <var>n</var> = <var>n</var>!/(<var>n</var>-1)!,
152
+ using the ascending factorial notation:
153
+ <eg role="mathml"><![CDATA[
154
+ <apply>
155
+ <equivalent/>
156
+ <ci>n</ci>
157
+ <apply>
158
+ <divide/>
159
+ <semantics>
160
+ <apply>
161
+ <factorial/>
162
+ <ci>n</ci>
163
+ </apply>
164
+ <annotation-xml encoding="MathML-Presentation">
165
+ <msup>
166
+ <mn>1</mn>
167
+ <mover accent="true">
168
+ <mi>n</mi>
169
+ <mo>&OverBar;</mo>
170
+ </mover>
171
+ </msup>
172
+ </annotation-xml>
173
+ </semantics>
174
+ <semantics>
175
+ <apply>
176
+ <factorial/>
177
+ <apply><minus/><ci>n</ci><cn>1</cn></apply>
178
+ </apply>
179
+ <annotation-xml encoding="MathML-Presentation">
180
+ <msup>
181
+ <mn>1</mn>
182
+ <mover accent="true">
183
+ <mrow><mi>n</mi><mo>-</mo><mn>1</mn></mrow>
184
+ <mo>&OverBar;</mo>
185
+ </mover>
186
+ </msup>
187
+ </annotation-xml>
188
+ </semantics>
189
+ </apply>
190
+ </apply>
191
+ ]]></eg>
192
+ This content expression would render using the given notation as:
193
+ <graphic diff="chg" role="inline" source="image/factid.gif"
194
+ alt="n \equiv \frac{1^{\bar{n}}}{1^{\frac{}{n-1}}}"/>
195
+ </p>
196
+
197
+ <p>A second reason to use presentation within content markup is that
198
+ there is a continually growing list of areas of discourse that do not have
199
+ pre-defined content elements for encoding their objects and operators. As a
200
+ consequence, any system of content markup inevitably requires an extension
201
+ mechanism that combines notation with semantics in some way. MathML
202
+ content markup specifies several ways of attaching an external semantic
203
+ definitions to content objects. It is necessary, however, to use MathML
204
+ presentation markup to specify how such user-defined semantic extensions
205
+ should be rendered.</p>
206
+
207
+ <p>For example, the <quote>rank</quote> operator from linear algebra is not
208
+ included as a pre-defined MathML content element. Thus, to express
209
+ the statement rank(<var>u</var><sup>T</sup><var>v</var>)=1
210
+ we use a <el>semantics</el> element to bind a semantic
211
+ definition to the symbol <var>rank</var>.
212
+ <eg role="mathml"><![CDATA[
213
+ <apply>
214
+ <eq/>
215
+ <apply>
216
+ <semantics>
217
+ <mi>rank</mi>
218
+ <annotation-xml encoding="OpenMath">
219
+ <OMS name="rank" cd="linalg]]><phrase diff="chg">4</phrase><![CDATA[" xmlns="http://www.openmath.org/OpenMath"/>
220
+ </annotation-xml>
221
+ </semantics>
222
+ <apply>
223
+ <times/>
224
+ <apply> <transpose/> <ci>u</ci> </apply>
225
+ <ci>v</ci>
226
+ </apply>
227
+ </apply>
228
+ <cn>1</cn>
229
+ </apply>
230
+ ]]></eg>
231
+ Here, the semantics of rank have been
232
+ given using a symbol from an OpenMath <bibref diff="add"
233
+ ref="OpenMath2000"/> content dictionary (CD).</p>
234
+
235
+ </div3>
236
+
237
+ <div3><head>Combinations that are prohibited</head>
238
+
239
+ <p>The main consideration when presentation markup and content markup are
240
+ mixed together in a single expression is that the result should still make
241
+ sense. When both kinds of markup are contained in a presentation
242
+ expression, this means it should be possible to render the resulting mixed
243
+ expressions simply and sensibly. Conversely, when mixed markup appears in a
244
+ content expression, it should be possible to simply and sensibly assign a
245
+ semantic interpretation to the expression as <phrase diff="add">a</phrase> whole. These requirements
246
+ place a few natural constraints on how presentation and content markup can
247
+ be mixed in a single expression, in order to avoid ambiguous or otherwise
248
+ problematic expressions.</p>
249
+
250
+ <p>Two examples illustrate the kinds of problems that must
251
+ be avoided in mixed markup. Consider:
252
+ <eg role="mathml-error"><![CDATA[
253
+ <mrow>
254
+ <bvar> x </bvar> <mo> + </mo> <bvar> y </bvar>
255
+ </mrow>
256
+ ]]></eg>
257
+ In this example, the content element <el>bvar</el> has been
258
+ indiscriminately embedded in a presentation expression.
259
+ Since <el>bvar</el> requires an enclosing context for its
260
+ meaning, this expression is unclear.</p>
261
+
262
+ <p>Similarly, consider:
263
+ <eg role="mathml-error"><![CDATA[
264
+ <apply>
265
+ <ci> x </ci> <mo> + </mo> <ci> y </ci>
266
+ </apply>
267
+ ]]></eg>
268
+ Here, the <el>mo</el> element is problematic. Should a
269
+ renderer infer that the usual arithmetic operator is intended, and act as
270
+ if the prefix content element <el>plus</el> had been used?
271
+ Or should this be literally interpreted as the operator <var>x</var>
272
+ applied to two arguments,
273
+ <el role="starttag">mo</el>+<el role="endtag">mo</el> and
274
+ <el role="starttag">mi</el>y<el role="endtag">mi</el> ?
275
+ Even if we were to decide that
276
+ <el role="starttag">mo</el>+<el role="endtag">mo</el> was the operator, then what
277
+ should its meaning be?
278
+ These questions do not have particularly compelling answers, so this kind
279
+ of mixing of content and presentation markup is also prohibited.</p>
280
+
281
+ </div3>
282
+
283
+ <div3 id="mixing_pmincm"><head>Presentation Markup Contained in Content Markup</head>
284
+
285
+ <p>The use of presentation markup within content markup is limited to
286
+ situations that do not effect the ability of content markup to
287
+ unambiguously encode mathematical meaning. Specifically,
288
+ presentation markup may only appear in content markup in three ways:
289
+ <olist>
290
+ <item><p>within <el>ci</el> and
291
+ <el>cn</el> token elements</p>
292
+ </item>
293
+ <item><p>within the <el>csymbol</el> element</p>
294
+ </item>
295
+ <item><p>within the <el>semantics</el> element</p>
296
+ </item>
297
+ </olist>
298
+ Any other presentation markup occurring within a content markup is a
299
+ MathML error. More detailed discussion of these three cases follows:
300
+ <glist>
301
+ <gitem>
302
+ <label>Presentation markup within token elements.</label>
303
+ <def><p>The token elements <el>ci</el> and <el>cn</el> are permitted to contain any sequence of
304
+ MathML characters (defined in <specref ref="chars"/>),
305
+ presentation elements, and <el>sep</el> empty elements.
306
+ Contiguous blocks of MathML characters in <el>ci</el> and
307
+ <el>cn</el> elements are rendered as if they were wrapped in
308
+ <el>mi</el> and <el>mn</el>
309
+ elements respectively. If a token element contains both MathML characters
310
+ and presentation elements, contiguous blocks of MathML characters (if any)
311
+ are treated as
312
+ if wrapped in <el>mi</el> or <el>mn</el>
313
+ elements as appropriate, and the resulting collection of presentation
314
+ elements are rendered as if wrapped in an <el>mrow</el>
315
+ element.</p></def>
316
+ </gitem>
317
+
318
+ <gitem>
319
+ <label>Presentation markup within the <el>csymbol</el>
320
+ element.</label>
321
+ <def><p>The <el>csymbol</el> element may contain either
322
+ MathML characters interspersed with presentation markup, or content elements
323
+ of the container type. It is a MathML error for a <el>csymbol</el> element to contain both presentation and
324
+ content elements. When the <el>csymbol</el> element contains
325
+ both raw data and presentation markup, the same rendering rules that apply
326
+ to content elements of the token type should be used.</p></def>
327
+ </gitem>
328
+
329
+ <gitem>
330
+ <label>Presentation markup within the <el>semantics</el> element.</label>
331
+ <def><p>One of the main purposes of the
332
+ <el>semantics</el> element is to provide a mechanism for
333
+ incorporating arbitrary MathML expressions into content markup in a
334
+ semantically meaningful way. In particular, any valid presentation
335
+ expression can be embedded in a content expression by placing it as the
336
+ first child of a <el>semantics</el> element. The
337
+ meaning of this wrapped expression should be indicated by one or more
338
+ annotation elements also contained in the <el>semantics</el>
339
+ element. Suggested rendering for a <el>semantics</el>
340
+ element is discussed in <specref ref="contm_synsem"/>.</p></def>
341
+ </gitem>
342
+ </glist>
343
+ </p>
344
+ </div3>
345
+
346
+ <div3 id="mixing_cminpm"><head>Content Markup Contained in
347
+ Presentation Markup</head>
348
+
349
+ <p>The guiding principle for embedding content markup within presentation
350
+ expressions is that the resulting expression should still have an
351
+ unambiguous rendering. In general, this means that embedded content
352
+ expressions must be semantically meaningful, since rendering of content
353
+ markup depends on its meaning.</p>
354
+
355
+ <p>Certain content elements
356
+ derive part of their semantic meaning from the surrounding context, such as
357
+ whether a <el>bvar</el> element is qualifying an integral,
358
+ logical quantifier or lambda expression. Another example
359
+ would be whether a <el>degree</el> element occurs in
360
+ a <el>root</el> or <el>partialdiff</el> element.
361
+ Thus, in a presentation context, elements such as these do not have a clearly
362
+ defined meaning, and hence there is no obvious choice for a rendering.
363
+ Consequently, they are not allowed.</p>
364
+
365
+ <p>Using the terminology of <specref ref="contm_cats"/>,
366
+ we see that operator, relation, container, constant and symbol
367
+ elements make sense on their own, while elements of the
368
+ qualifier and condition type do not.
369
+ (Note that <el>interval</el> may be used either as
370
+ a general container, or as a qualifier.)</p>
371
+
372
+ <p>Outside these categories, certain elements deserve specific comment:
373
+ the elements <el>declare</el>, <el>sep</el>,
374
+ <el>annotation</el> and <el>annotation-xml</el>
375
+ can only appear in very specific contexts and consequently are not permitted
376
+ as direct sub-expressions of any presentation element.
377
+ Finally, the element <el>semantics</el>
378
+ carries with it sufficient information to be permitted in presentation.</p>
379
+
380
+ <p>The complete list of content elements that <emph>cannot</emph> appear as a child
381
+ in a presentation element is:
382
+ <el>annotation</el>,
383
+ <el>annotation-xml</el>,
384
+ <el>sep</el>,
385
+ <el>declare</el>,
386
+ <el>bvar</el>,
387
+ <el>condition</el>,
388
+ <el>degree</el>,
389
+ <el>logbase</el>,
390
+ <el>lowlimit</el>,
391
+ <el>uplimit</el>.
392
+ </p>
393
+
394
+ <p>Note that within presentation markup, content expressions may only
395
+ appear in locations where it is valid for any MathML expression to
396
+ appear. In particular, content expressions may not appear within
397
+ presentation token elements. In this regard mixing presentation and content
398
+ are asymmetrical.</p>
399
+
400
+ <p>Note that embedding content markup in presentation will often require
401
+ applications to render operators outside of an <el>apply</el>
402
+ context. E.g., it may be necessary to render
403
+ <el>abs</el>,
404
+ <el>plus</el>,
405
+ <el>root</el> or
406
+ <el>sin</el>
407
+ outside of an application. Content/presentation mixing does not
408
+ introduce any new requirements, however, since unapplied operators
409
+ are already permitted in content expressions, for example:
410
+ <eg role="mathml"><![CDATA[
411
+ <apply>
412
+ <compose/>
413
+ <sin/>
414
+ <apply>
415
+ <inverse/>
416
+ <root/>
417
+ </apply>
418
+ </apply>
419
+ ]]></eg></p>
420
+
421
+ </div3>
422
+ </div2>
423
+
424
+ <div2 id="mixing_parallel"><head>Parallel Markup</head>
425
+
426
+ <p>Some applications are able to make use of <emph>both</emph> presentation
427
+ and content information. For these applications it is desirable to provide
428
+ both forms of markup for the same mathematical expression. This is called
429
+ <emph>parallel markup</emph>.</p>
430
+
431
+ <p>Parallel markup is achieved with the <el>semantics</el> element. Parallel markup for an expression
432
+ can be used on its own, or can be incorporated as part of a larger content
433
+ or presentation tree.
434
+ </p>
435
+
436
+ <div3><head>Top-level Parallel Markup</head>
437
+ <p>
438
+ In many cases what is desired is to provide
439
+ presentation markup and content markup for a mathematical
440
+ expression as a whole.
441
+ To achieve this, a single <el>semantics</el> element is used
442
+ pairing two markup trees, with the first branch being the MathML presentation
443
+ markup, and the second branch being the MathML content markup.</p>
444
+
445
+ <p>The following example encodes the boolean arithmetic expression
446
+ (<var>a</var>+<var>b</var>)(<var>c</var>+<var>d</var>) in this way.
447
+ <eg role="mathml"><![CDATA[
448
+ <semantics>
449
+ <mrow>
450
+ <mrow><mo>(</mo><mi>a</mi> <mo>+</mo> <mi>b</mi><mo>)</mo></mrow>
451
+ <mo>&InvisibleTimes;</mo>
452
+ <mrow><mo>(</mo><mi>c</mi> <mo>+</mo> <mi>d</mi><mo>)</mo></mrow>
453
+ </mrow>
454
+ <annotation-xml encoding="MathML-Content">
455
+ <apply><and/>
456
+ <apply><xor/><ci>a</ci> <ci>b</ci></apply>
457
+ <apply><xor/><ci>c</ci> <ci>d</ci></apply>
458
+ </apply>
459
+ </annotation-xml>
460
+ </semantics>
461
+ ]]></eg>
462
+ This example is non-trivial in the sense that the content markup
463
+ could not be easily derived from the presentation markup alone.
464
+ </p>
465
+ </div3>
466
+
467
+ <div3><head>Fine-grained Parallel Markup</head>
468
+
469
+ <p>Top-level pairing of independent presentation and content markup is
470
+ sufficient for many, but not all, situations. Applications that allow
471
+ treatment of <emph>sub-expressions</emph> of mathematical objects
472
+ require the ability to associate presentation, content or information
473
+ with the <emph>parts</emph> of an object with mathematical
474
+ markup. Top-level pairing with a <el>semantics</el> element is
475
+ insufficient in this type of situation; identification of a
476
+ sub-expression in one branch of <phrase diff="add">a</phrase>
477
+ <el>semantics</el> element gives no indication of the corresponding
478
+ parts in other branches.</p>
479
+
480
+ <p>The ability to identify corresponding sub-expressions is required in
481
+ applications such as mathematical expression editors. In this situation,
482
+ selecting a sub-expression on a visual display can identify a particular
483
+ portion of a presentation markup tree. The application then needs to
484
+ determine the corresponding annotations of the sub-expressions; in
485
+ particular, the application requires the sub-expressions of the
486
+ <el>annotation-xml</el> tree in MathML content notation.</p>
487
+
488
+ <p>It is, in principle, possible to provide annotations for
489
+ each presentation node by incorporating
490
+ <el>semantics</el> elements recursively.
491
+ <eg role="mathml"><![CDATA[
492
+ <semantics>
493
+ <mrow>
494
+ <semantics>
495
+ <mrow><mo>(</mo><mi>a</mi> <mo>+</mo> <mi>b</mi><mo>)</mo></mrow>
496
+ <annotation-xml encoding="MathML-Content">
497
+ <apply><plus/><ci>a</ci> <ci>b</ci></apply>
498
+ </annotation-xml>
499
+ </semantics>
500
+ <mo>&InvisibleTimes;</mo>
501
+ <semantics>
502
+ <mrow><mo>(</mo><mi>c</mi> <mo>+</mo> <mi>d</mi><mo>)</mo></mrow>
503
+ <annotation-xml encoding="MathML-Content">
504
+ <apply><plus/><ci>c</ci> <ci>d</ci></apply>
505
+ </annotation-xml>
506
+ </semantics>
507
+ </mrow>
508
+
509
+ <annotation-xml encoding="MathML-Content">
510
+ <apply><times/>
511
+ <apply><plus/><ci>a</ci> <ci>b</ci></apply>
512
+ <apply><plus/><ci>c</ci> <ci>d</ci></apply>
513
+ </apply>
514
+ </annotation-xml>
515
+ </semantics>
516
+ ]]></eg>
517
+ To be complete this example would be much more verbose, wrapping each of
518
+ the individual leaves <el>mi</el>, <el>mo</el> and <el>mn</el> in a further seven
519
+ <el>semantics</el> elements.</p>
520
+
521
+ <p>This approach is very general and works for all kinds of annotations
522
+ (including non-MathML annotations and multiple annotations). It leads,
523
+ however, to O(<phrase diff="chg"><var>n</var> log <var>n</var></phrase>) increase in size of the document.
524
+ This is therefore not a suitable approach for fine-grained parallel markup
525
+ of large objects.</p>
526
+ </div3>
527
+
528
+ <div3><head>Parallel Markup via Cross-References:
529
+ <att>id</att> and <att>xref</att></head>
530
+
531
+ <p>To better accommodate applications that must deal with sub-expressions
532
+ of large objects, MathML uses cross-references between the branches of a
533
+ <el>semantics</el> element to identify corresponding
534
+ sub-structures.</p>
535
+
536
+ <p>Cross-referencing is achieved using <att>id</att> and <att>xref</att> attributes within the branches of a containing <el>semantics</el> element. These attributes may optionally be
537
+ placed on MathML elements of any type.</p>
538
+
539
+ <p>The following example shows this cross-referencing for the
540
+ boolean arithmetic expression
541
+ (<var>a</var>+<var>b</var>)(<var>c</var>+<var>d</var>).
542
+
543
+ <eg role="mathml"><![CDATA[
544
+ <semantics>
545
+ <mrow id="E">
546
+ <mrow id="E.1">
547
+ <mo id="E.1.1">(</mo>
548
+ <mi id="E.1.2">a</mi>
549
+ <mo id="E.1.3">+</mo>
550
+ <mi id="E.1.4">b</mi>
551
+ <mo id="E.1.5">)</mo>
552
+ </mrow>
553
+ <mo id="E.2">&InvisibleTimes;</mo>
554
+ <mrow id="E.3">
555
+ <mo id="E.3.1">(</mo>
556
+ <mi id="E.3.2">c</mi>
557
+ <mo id="E.3.3">+</mo>
558
+ <mi id="E.3.4">d</mi>
559
+ <mo id="E.3.5">)</mo>
560
+ </mrow>
561
+ </mrow>
562
+
563
+ <annotation-xml encoding="MathML-Content">
564
+ <apply xref="E">
565
+ <and xref="E.2"/>
566
+ <apply xref="E.1">
567
+ <xor xref="E.1.3"/><ci xref="E.1.2">a</ci><ci xref="E.1.4">b</ci>
568
+ </apply>
569
+ <apply xref="E.3">
570
+ <xor xref="E.3.3"/><ci xref="E.3.2">c</ci><ci xref="E.3.4">d</ci>
571
+ </apply>
572
+ </apply>
573
+ </annotation-xml>
574
+ </semantics>
575
+ ]]></eg></p>
576
+
577
+ <p>An <att>id</att> attribute and a corresponding <att>xref</att> appearing within the same <el>semantics</el> element create a correspondence between
578
+ sub-expressions.</p>
579
+
580
+ <p>In creating these correspondences by cross-reference, <emph>all</emph>
581
+ of the <att>id</att> attributes referenced by any <att>xref</att> must be in the <emph>same</emph> branch of an
582
+ enclosing <el>semantics</el> element. This constraint
583
+ guarantees that these correspondences do not create unintentional cycles.
584
+ (Note that this restriction does <emph>not</emph> exclude the use of <att>id</att> attributes within the other branches of the enclosing
585
+ <el>semantics</el> element. It does, however, exclude
586
+ references to these other <att>id</att> attributes
587
+ originating in the same <el>semantics</el> element.)</p>
588
+
589
+ <p>There is no restriction on which branch of the <el>semantics</el> element may contain the destination <att>id</att> attributes. It is up to the application to determine
590
+ which branch to use.</p>
591
+
592
+ <p>In general, there will not be a one-to-one correspondence between nodes
593
+ in parallel branches. For example, a presentation tree may contain
594
+ elements, such as parentheses, that have no correspondents in the content
595
+ tree. It is therefore often useful to put the <att>id</att>
596
+ attributes on the branch with the finest-grained node structure. Then all
597
+ of the other branches will have <att>xref</att> attributes
598
+ to some subset of the <att>id</att> attributes.</p>
599
+
600
+ <p>In absence of other criteria, the first branch of the <el>semantics</el> element is a sensible choice to contain the
601
+ <att>id</att> attributes. Applications that add or remove
602
+ annotations will then not have to re-assign attributes to the <el>semantics</el> trees.</p>
603
+
604
+ <p>In general, the use of <att>id</att> and <att>xref</att> attributes allows a full correspondence between
605
+ sub-expressions to be given in text that is at most a constant factor
606
+ larger than the original. The direction of the references should not be
607
+ taken to imply that sub-expression selection is intended to be permitted
608
+ only on one child of the <el>semantics</el> element. It is
609
+ equally feasible to select a subtree in any branch and to recover the
610
+ corresponding subtrees of the other branches.</p>
611
+ </div3>
612
+
613
+ <div3><head>Annotation Cross-References using XLink:
614
+ <att>id</att> and <att>href</att></head>
615
+
616
+ <p>It is possible to give cross-references between a MathML expression and
617
+ a non-MathML XML annotation using the XLink protocol <bibref ref="XLink"/>.
618
+ As an example, the boolean expression of the previous section can
619
+ be annotated with OpenMath, and cross-linked as follows:
620
+ <eg role="mathml-extension"><![CDATA[
621
+ <semantics>
622
+ <mrow id="E">
623
+ <mrow id="E.1">
624
+ <mo id="E.1.1">(</mo>
625
+ <mi id="E.1.2">a</mi>
626
+ <mo id="E.1.3">+</mo>
627
+ <mi id="E.1.4">b</mi>
628
+ <mo id="E.1.5">)</mo>
629
+ </mrow>
630
+ <mo id="E.2">&InvisibleTimes;</mo>
631
+ <mrow id="E.3">
632
+ <mo id="E.3.1">(</mo>
633
+ <mi id="E.3.2">c</mi>
634
+ <mo id="E.3.3">+</mo>
635
+ <mi id="E.3.4">d</mi>
636
+ <mo id="E.3.5">)</mo>
637
+ </mrow>
638
+ </mrow>
639
+
640
+ <annotation-xml encoding="MathML-Content">
641
+ <apply xref="E">
642
+ <and xref="E.2"/>
643
+ <apply xref="E.1">
644
+ <xor xref="E.1.3"/><ci xref="E.1.2">a</ci><ci xref="E.1.4">b</ci>
645
+ </apply>
646
+ <apply xref="E.3">
647
+ <xor xref="E.3.3"/><ci xref="E.3.2">c</ci><ci xref="E.3.4">d</ci>
648
+ </apply>
649
+ </apply>
650
+ </annotation-xml>
651
+
652
+ <annotation-xml encoding="OpenMath"
653
+ xmlns:om="http://www.openmath.org/OpenMath"
654
+ xmlns:xlink="http://www.w3.org/1999/xlink">
655
+
656
+ <om:OMA xlink:href="#xpointer(id('E'))" xlink:type="simple">
657
+ <om:OMS name="and" cd="logic1"
658
+ xlink:href="#xpointer(id('E.2'))" xlink:type="simple"/>
659
+
660
+ <om:OMA xlink:href="#xpointer(id('E.1'))" xlink:type="simple">
661
+ <om:OMS name="xor" cd="logic1"
662
+ xlink:href="#xpointer(id('E.1.3'))" xlink:type="simple"/>
663
+ <om:OMV name="a"
664
+ xlink:href="#xpointer(id('E.1.2'))" xlink:type="simple"/>
665
+ <om:OMV name="b"
666
+ xlink:href="#xpointer(id('E.1.4'))" xlink:type="simple"/>
667
+ </om:OMA>
668
+
669
+ <om:OMA xlink:href="#xpointer(id('E.3'))" xlink:type="simple">
670
+ <om:OMS name="xor" cd="logic1"
671
+ xlink:href="#xpointer(id('E.3.3'))" xlink:type="simple"/>
672
+ <om:OMV name="c"
673
+ xlink:href="#xpointer(id('E.3.2'))" xlink:type="simple"/>
674
+ <om:OMV name="d"
675
+ xlink:href="#xpointer(id('E.3.4'))" xlink:type="simple"/>
676
+ </om:OMA>
677
+ </om:OMA>
678
+ </annotation-xml>
679
+ </semantics>
680
+ ]]></eg>
681
+ Here
682
+ <el namespace="openmath">OMA</el>, <el namespace="openmath">OMS</el> and
683
+ <el namespace="openmath">OMV</el> are elements defined in the OpenMath
684
+ standard for representing
685
+ application, symbol and variable, respectively.
686
+ The references from the OpenMath annotation are given by the
687
+ <att>xlink:href</att> attributes which in this case
688
+ use XPointer <bibref ref="XPointer"/> to refer to<phrase diff="del">an</phrase>
689
+ <att>id</att>s within the current document.</p>
690
+
691
+ <p>Note that the application might or might not have a mechanism for
692
+ extending DTDs. It will be the case, therefore that some applications
693
+ will give well-formed, but not "valid", XML within
694
+ <el>annotation-xml</el> elements.
695
+ Consequently, some MathML applications using
696
+ <el>annotation-xml</el> will not be validated.
697
+ More flexibility is offered by the use of XML Schemas.</p>
698
+
699
+ </div3>
700
+ </div2>
701
+
702
+ <div2 id="mixing_tools"><head>Tools, Style Sheets and Macros for Combined Markup</head>
703
+
704
+ <p>The interaction of presentation and content markup can be greatly
705
+ enhanced through the use of various tools. While the set of tools and
706
+ standards for working with XML applications is rapidly evolving at the
707
+ present, we can already outline some specific techniques.</p>
708
+
709
+ <p>In general, the interaction of content and presentation is handled via
710
+ transformation rules on MathML trees. These transformation rules are
711
+ sometimes called <quote>macros</quote>. In principle, these rules can be
712
+ expressed using any one of a number of mechanisms, including DSSSL, Java
713
+ programs operating on a DOM, etc. We anticipate, however, that the
714
+ principal mechanism for these transformations in most applications shall be
715
+ XSLT.</p>
716
+
717
+ <p>In this section we discuss transformation rules for two specific purposes:
718
+ for notational style sheets, and to simplify parallel markup.</p>
719
+
720
+ <div3 id="mixing_notsheet"><head>Notational Style Sheets</head>
721
+
722
+ <p>Authors who make use of content markup may be required to deploy their
723
+ documents in locales with notational conventions different than the default
724
+ content rendering. It is therefore expected that transformation tools will
725
+ be used to determine notations for content elements in different
726
+ settings. Certain elements, e.g. <el>lambda</el>,
727
+ <el>mean</el> and <el>transpose</el>, have
728
+ widely varying common notations and will often require notational
729
+ selection. Some examples of notational variations are given below.
730
+
731
+ <ulist>
732
+ <item><p><graphic role="inline" source="image/f5001.gif" alt="\mathbf{V}"/>
733
+ versus <graphic role="inline" source="image/f5002.gif" alt="\vec{V}"/>
734
+ </p></item>
735
+ <item><p>tan <var>x</var> versus tg <var>x</var>
736
+ </p></item>
737
+ <item><p><graphic role="inline" source="image/f5003.gif" alt="{n \choose m}"/>
738
+ versus <graphic role="inline" source="image/f5004.gif" alt="{}_nC^m"/>
739
+ versus <graphic role="inline" source="image/f5005.gif" alt="C^n_m"/>
740
+ versus <graphic role="inline" source="image/f5006.gif" alt="C^m_n"/>
741
+ </p></item>
742
+ <item><p><graphic role="inline" source="image/f5007.gif"
743
+ alt="a_0 + \frac{ ~1 ~ |}{| ~a_1 ~} + \ldots + \frac{~1 ~ |}{| ~ a_k~}"/>
744
+ versus <graphic role="inline" source="image/f5008.gif" alt="[a_0, a_1, \ldots, a_k]"/>
745
+ </p></item>
746
+ </ulist>
747
+ Other elements, for example <el>plus</el> and <el>sin</el>, are less likely to require these features.</p>
748
+
749
+ <p>Selection of notational style is sometimes necessary
750
+ for correct understanding of documents by locale. For instance,
751
+ the binomial coefficient
752
+ <graphic role="inline" source="image/f5005.gif" alt="C^n_m"/>
753
+ in French notation is equivalent to
754
+ <graphic role="inline" source="image/f5006.gif" alt="C^m_n"/>
755
+ in Russian notation.</p>
756
+
757
+ <p>A natural way for a MathML application to bind a particular notation to
758
+ the set of content tags is with an XSLT style sheet <bibref
759
+ ref="XSLT"/>. The examples of this section shall assume this is the
760
+ mechanism to express style choices. (Other choices are equally possible,
761
+ for example an application program may provide menus offering a number of
762
+ rendering choices for all content tags.)
763
+ </p>
764
+
765
+ <p>When writing XSLT style sheets for mathematical notation, some
766
+ transformation rules can be purely local, while others will require
767
+ multi-node context to determine the correct output notation. The following
768
+ example gives a local transformation rule that could be included in a
769
+ notational style sheet displaying open intervals as
770
+ ]<var>a</var>,<var>b</var>[ rather than as (<var>a</var>,<var>b</var>).
771
+ <eg><![CDATA[
772
+ <xsl:template match="m:interval">
773
+ <m:mrow>
774
+ <xsl:choose>
775
+ <xsl:when test="@closure='closed'">
776
+ <m:mfenced open="[" close="]" separators=",">
777
+ <xsl:apply-templates/>
778
+ </m:mfenced>
779
+ </xsl:when>
780
+ <xsl:when test="@closure='open'">
781
+ <m:mfenced open="]" close="[" separators=",">
782
+ <xsl:apply-templates/>
783
+ </m:mfenced>
784
+ </xsl:when>
785
+ <xsl:when test="@closure='open-closed'">
786
+ <m:mfenced open="]" close="]" separators=",">
787
+ <xsl:apply-templates/>
788
+ </m:mfenced>
789
+ </xsl:when>
790
+ <xsl:when test="@closure='closed-open'">
791
+ <m:mfenced open="[" close="[" separators=",">
792
+ <xsl:apply-templates/>
793
+ </m:mfenced>
794
+ </xsl:when>
795
+ <xsl:otherwise>
796
+ <m:mfenced open="[" close="]" separators=",">
797
+ <xsl:apply-templates/>
798
+ </m:mfenced>
799
+ </xsl:otherwise>
800
+ </xsl:choose>
801
+ </m:mrow>
802
+ </xsl:template>
803
+ ]]></eg>
804
+ Here <code>m</code> is established as the MathML namespace.</p>
805
+
806
+ <p>An example of a rule requiring context information would be:
807
+ <eg><![CDATA[
808
+ <xsl:template match="m:apply[m:factorial]">
809
+ <m:mrow>
810
+ <xsl:choose>
811
+ <xsl:when test="not(*[2]=m:ci) and not(*[2]=m:cn)">
812
+ <m:mrow>
813
+ <m:mo>(</m:mo>
814
+ <xsl:apply-templates select="*[2]" />
815
+ <m:mo>)</m:mo>
816
+ </m:mrow>
817
+ </xsl:when>
818
+ <xsl:otherwise>
819
+ <xsl:apply-templates select="*[2]" />
820
+ </xsl:otherwise>
821
+ </xsl:choose>
822
+ <m:mo>!</m:mo>
823
+ </m:mrow>
824
+ </xsl:template>
825
+ ]]></eg>
826
+ Other examples of context-dependent transformations would be, e.g.
827
+ for the <el>apply</el> of a <el>plus</el>
828
+ to render <var>a</var>-<var>b</var>+<var>c</var>, rather than
829
+ <var>a</var>+ -<var>b</var>+<var>c</var>, or for the
830
+ <el>apply</el> of a <el>power</el>
831
+ to render sin<sup>2</sup><var>x</var>, rather than
832
+ sin <var>x</var><sup>2</sup>.</p>
833
+
834
+ <p>Notational variation will occur both for built-in content elements
835
+ as well as extensions. Notational style for extensions can be handled
836
+ as described above, with rules matching the names of any extension
837
+ tags, and with the content handling (in a content-faithful style sheet)
838
+ proceeding as described in <specref ref="mixing_sheet"/>.</p>
839
+ </div3>
840
+
841
+ <div3><head>Content-Faithful Transformations</head>
842
+
843
+ <p>There may be a temptation to view notational style sheets as a
844
+ transformation from content markup to equivalent presentation markup.
845
+ This viewpoint is explicitly discouraged, since information will be
846
+ lost and content-oriented applications will not function properly.</p>
847
+
848
+ <p>We define a <quote>content-faithful</quote> transformation to be a
849
+ transformation that retains the original content in parallel markup
850
+ (<specref ref="mixing_parallel"/>).</p>
851
+
852
+ <p>Tools that support MathML should be <quote>content-faithful</quote>,
853
+ and not gratuitously convert content elements to presentation elements in
854
+ their processing. Notational style sheets should be content-faithful
855
+ whenever they may be used in interactive applications.</p>
856
+
857
+ <p>It is possible to write content-faithful style sheets in a number
858
+ of ways. Top-level parallel markup can be achieved by incorporating the
859
+ following rules in an XSLT style sheet:
860
+ <eg><![CDATA[
861
+ <xsl:template match="m:math">
862
+ <m:semantics>
863
+ <xsl:apply-templates/>
864
+
865
+ <m:annotation-xml m:encoding="MathML-Content">
866
+ <xsl:copy-of select="."/>
867
+ </m:annotation-xml>
868
+ </m:semantics>
869
+ </xsl:template>
870
+ ]]></eg>
871
+ The notation would be generated by additional rules for producing presentation
872
+ from content, such as those in <specref ref="mixing_notsheet"/>.
873
+ Fine-grained parallel markup can be achieved with additional rules
874
+ treating <att>id</att> attributes. A detailed example
875
+ is given in <bibref ref="RodWatt2000"/>. </p>
876
+
877
+ </div3>
878
+
879
+ <div3 id="mixing_sheet"><head>Style Sheets for Extensions</head>
880
+
881
+ <p>The presentation tags of MathML form a closed vocabulary of notational
882
+ structures, but are quite rich and can be used to express a rendering of
883
+ most mathematical notations. Complex notations can be composed from
884
+ the basic elements provided for presentation markup.
885
+ In this sense, the presentation ability of MathML is open-ended.
886
+ It is often useful, however, to give a
887
+ name to new notational schemas if they are going to be used often.
888
+ For example, we can shorten and clarify the ascending factorial example of
889
+ <specref ref="mixing_reasons"/>, with a rule which replaces
890
+ <eg role="mathml-extension"><![CDATA[
891
+ <mx:a-factorial>X</mx:a-factorial>
892
+ ]]></eg>
893
+ with
894
+ <eg role="mathml"><![CDATA[
895
+ <semantics>
896
+ <apply> <factorial/>]]> &lt;<phrase diff="chg">ci</phrase>>X&lt;/<phrase diff="chg">ci</phrase>> <![CDATA[</apply>
897
+ <annotation-xml encoding="MathML-Presentation">
898
+ <msup>
899
+ <mn>1</mn>
900
+ <mover accent="true">
901
+ <mi>X</mi>
902
+ <mo>&OverBar;</mo>
903
+ </mover>
904
+ </msup>
905
+ </annotation-xml>
906
+ </semantics>
907
+ ]]></eg>
908
+ Then the example would be more clearly written as:
909
+ <eg role="mathml-extension"><![CDATA[
910
+ <apply>
911
+ <equivalent/>
912
+ <ci>n</ci>
913
+ <apply>
914
+ <divide/>
915
+ <mx:a-factorial><ci>n</ci></mx:a-factorial>
916
+ <mx:a-factorial>
917
+ <apply><minus/><ci>n</ci><cn>1</cn></apply>
918
+ </mx:a-factorial>
919
+ </apply>
920
+ </apply>
921
+ ]]></eg></p>
922
+
923
+ <p>Likewise, the content tags form a fixed vocabulary of concepts covering
924
+ the types of mathematics seen in most common applications. It is not
925
+ reasonable to
926
+ expect users to compose existing MathML content tags to construct new
927
+ content concepts. (This approach is fraught with technical difficulties
928
+ even for professional mathematicians.) Instead, it is anticipated that
929
+ applications whose mathematical content concepts extend beyond what is
930
+ offered by MathML will use annotations and attributes within
931
+ <el>semantics</el> and <el>csymbol</el> elements,
932
+ and that these annotations will use
933
+ content description languages outside of MathML.</p>
934
+
935
+ <p>Often the naming of a notation and the identification of a new semantic
936
+ concept are related. This allows a single transformation rule to capture
937
+ both a presentation and a content markup for an expression. This is one of
938
+ the areas of MathML that benefits most strongly from the use of macro
939
+ processing.
940
+ <eg role="mathml-extension"><![CDATA[
941
+ <mx:rank/>
942
+ ]]></eg>
943
+ and
944
+ <eg role="mathml-extension"><![CDATA[
945
+ <mx:tr>X</mx:tr>
946
+ ]]></eg>
947
+ and respectively transform them to
948
+ <eg role="mathml"><![CDATA[
949
+ <semantics>
950
+ <ci><mo>rank</mo></ci>
951
+ <annotation-xml encoding="OpenMath">
952
+ <OMS name="rank" cd="linalg]]><phrase diff="chg">4</phrase><![CDATA[" xmlns="http://www.openmath.org/OpenMath"/>
953
+ </annotation-xml>
954
+ </semantics>
955
+ ]]></eg>
956
+ and
957
+ <eg role="mathml"><![CDATA[
958
+ <apply>
959
+ <transpose/>
960
+ <ci>X</ci>
961
+ </apply>
962
+ ]]></eg>
963
+ The lengthy sample encoding of
964
+ rank(<var>u</var><sup>T</sup><var>v</var>)=1,
965
+ from <specref ref="mixing_reasons"/> could then be condensed to
966
+ <eg role="mathml-extension"><![CDATA[
967
+ <apply>
968
+ <eq/>
969
+ <apply>
970
+ <mx:rank/>
971
+ <apply> <times/> <mx:tr>u</mx:tr> <ci>v</ci> </apply>
972
+ </apply>
973
+ <cn>1</cn>
974
+ </apply>
975
+ ]]></eg>
976
+ From this example we see how the combination of presentation and content
977
+ markup could become much simpler and effective to generate as standard
978
+ style sheet libraries become available.
979
+ </p>
980
+ </div3>
981
+ </div2>
982
+ </div1>