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