This repository has been archived by the owner on Jan 3, 2020. It is now read-only.
forked from w3c/mathml.old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chapter2.html
1688 lines (1607 loc) · 96.3 KB
/
chapter2.html
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
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>MathML Fundamentals</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style type="text/css">
/** Table of Contents taken from html 5.2 spec
stop flicker in toc **/
.toc a {
/* More spacing; use padding to make it part of the click target. */
padding-top: 0.1rem;
/* Larger, more consistently-sized click target */
display: block;
/* Reverse color scheme */
color: black;
border-color: #3980B5;
border-bottom-width: 3px !important;
margin-bottom: 0px !important;
}
.egmeta {
color:#5555AA;font-style:italic;font-family:serif;font-weight:bold;
}
div.graphic{margin-left:2em}
table.syntax {
font-size: 75%;
background-color: #DDDDDD;
border: thin solid;
}
table.syntax td {
border: solid thin;
}
table.syntax th {
text-align: left;
}
table.attributes td { padding-left:0.5em; padding-right:0.5em; border: solid thin; }
table.attributes td.attname { white-space:nowrap; vertical-align:top;}
table.attributes td.attdesc { background-color:#F0F0FF; padding-left:2em; padding-right:2em}
th.uname {font-size: 50%; text-align:left;}
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 }
div.mathml-example {border:solid thin black;
padding: 0.5em;
margin: 0.5em 0 0.5em 0;
}
div.strict-mathml-example {border:solid thin black;
padding: 0.5em;
margin: 0.5em 0 0.5em 0;
}
div.strict-mathml-example h5 {
margin-top: -0.3em;
margin-bottom: -0.5em;}
var.meta {background-color:green}
var.transmeta {background-color:red}
pre.mathml {padding: 0.5em;
background-color: #FFFFDD;}
pre.mathml-fragment {padding: 0.5em;
background-color: #FFFFDD;}
pre.strict-mathml {padding: 0.5em;
background-color: #FFFFDD;}
span.uname {color:#999900;font-size:75%;font-family:sans-serif;}
.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 }
a.termref {
text-decoration: none;
color: black;
}
.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="https://www.w3.org/StyleSheets/TR/2016/W3C-ED.css"><script src="//www.w3.org/scripts/TR/2016/fixup.js"> </script></head>
<body>
<h1><a id="fund"></a>2 MathML Fundamentals</h1>
<!-- TOP NAVIGATION BAR -->
<nav id="toc">
<ol class="toc">
<li><a href="Overview.html"><span class="secno"></span> Mathematical Markup Language (MathML) Version 4.0</a></li>
<li><a href="chapter1.html"><span class="secno">1 </span> Introduction</a></li>
<li><a href="chapter3.html"><span class="secno">3 </span> Presentation Markup</a></li>
<li><a href="chapter2.html"><span class="secno">2 </span> MathML Fundamentals</a>
<ol class="toc">
<li><a href="chapter2.html#fund.syntax"><span class="secno">2.1 </span> MathML Syntax and Grammar</a>
<ol class="toc">
<li><a href="chapter2.html#fund.xmlgeneral"><span class="secno">2.1.1 </span> General Considerations</a>
</li>
<li><a href="chapter2.html#interf.namespace"><span class="secno">2.1.2 </span> MathML and Namespaces</a>
</li>
<li><a href="chapter2.html#fund.xmlsyntax"><span class="secno">2.1.3 </span> Children versus Arguments</a>
</li>
<li><a href="chapter2.html#fund.renderingmodel"><span class="secno">2.1.4 </span> MathML and Rendering</a>
</li>
<li><a href="chapter2.html#fund.attval"><span class="secno">2.1.5 </span> MathML Attribute Values</a>
<ol class="toc">
<li><a href="chapter2.html#id.2.1.5.1"><span class="secno">2.1.5.1 </span> Syntax notation used in the MathML specification</a>
</li>
<li><a href="chapter2.html#fund.units"><span class="secno">2.1.5.2 </span> Length Valued Attributes</a>
<ol class="toc">
<li><a href="chapter2.html#units.addl.notes"><span class="secno">2.1.5.2.1 </span> Additional notes about units</a>
</li>
</ol>
</li>
<li><a href="chapter2.html#fund.color"><span class="secno">2.1.5.3 </span> Color Valued Attributes</a>
</li>
<li><a href="chapter2.html#fund.defaults"><span class="secno">2.1.5.4 </span> Default values of attributes</a>
</li>
</ol>
</li>
<li><a href="chapter2.html#fund.globatt"><span class="secno">2.1.6 </span> Attributes Shared by all MathML Elements</a>
</li>
<li><a href="chapter2.html#fund.collapse"><span class="secno">2.1.7 </span> Collapsing Whitespace in Input</a>
</li>
</ol>
</li>
<li><a href="chapter2.html#interf.toplevel"><span class="secno">2.2 </span> The Top-Level
<code><math></code> Element</a>
<ol class="toc">
<li><a href="chapter2.html#interf.toplevel.atts"><span class="secno">2.2.1 </span> Attributes</a>
</li>
<li><a href="chapter2.html#id.2.2.2"><span class="secno">2.2.2 </span> Deprecated Attributes</a>
</li>
</ol>
</li>
<li><a href="chapter2.html#interf.genproc"><span class="secno">2.3 </span> Conformance</a>
<ol class="toc">
<li><a href="chapter2.html#fund.mathmlconf"><span class="secno">2.3.1 </span> MathML Conformance</a>
<ol class="toc">
<li><a href="chapter2.html#interf.testsuite"><span class="secno">2.3.1.1 </span> MathML Test Suite and Validator</a>
</li>
<li><a href="chapter2.html#interf.deprec"><span class="secno">2.3.1.2 </span> Deprecated MathML 1.x and MathML 2.x Features</a>
</li>
<li><a href="chapter2.html#interf.extension"><span class="secno">2.3.1.3 </span> MathML
Extension Mechanisms and Conformance</a>
</li>
</ol>
</li>
<li><a href="chapter2.html#interf.error"><span class="secno">2.3.2 </span> Handling of Errors</a>
</li>
<li><a href="chapter2.html#interf.unspecified"><span class="secno">2.3.3 </span> Attributes for unspecified data</a>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</nav>
<div class="div1">
<div class="div2">
<h2><a id="fund.syntax"></a>2.1 MathML Syntax and Grammar</h2>
<div class="div3">
<h3><a id="fund.xmlgeneral"></a>2.1.1 General Considerations</h3>
<p>The basic ‘syntax’ of MathML is
defined using XML syntax,
but other syntaxes that can encode labeled trees are possible. Notably the HTML parser
may
also be used with MathML.
Upon this, we layer a ‘grammar’, being the rules for allowed elements,
the order in which they can appear,
and how they may be contained within each other,
as well as additional syntactic rules for the values of attributes.
These rules are defined by this specification,
and formalized by a RelaxNG schema <a href="appendixg.html#RELAX-NG">[RELAX-NG]</a>.
The RelaxNG Schema is normative, but a DTD (Document Type Definition)
and an XML Schema <a href="appendixh.html#XMLSchemas">[XMLSchemas]</a> are provided
for continuity (they were normative for MathML2).
See <a href="appendixa.html">Appendix A Parsing MathML</a>.
</p>
<p>MathML's character set
consists
of legal characters
as specified by Unicode <a href="appendixg.html#Unicode">[Unicode]</a>, further restricted
by the characters not allowed in XML.
The use of Unicode characters for mathematics is
discussed in <a href="chapter7.html">Chapter 7 Characters, Entities and Fonts</a>.</p>
<p>The following sections discuss the general aspects
of the MathML grammar as well as describe the syntaxes used
for attribute values.
</p>
</div>
<div class="div3">
<h3><a id="interf.namespace"></a>2.1.2 MathML and Namespaces</h3>
<p>An XML namespace <a href="appendixg.html#Namespaces">[Namespaces]</a> is a collection of names identified by a URI.
The URI for the MathML namespace is:</p>
<pre>
http://www.w3.org/1998/Math/MathML
</pre>
<p>To declare a namespace when using the XML serialisation of MathML,
one uses an <code>xmlns</code>
attribute, or an attribute with an <code>xmlns</code> prefix.
When the <code>xmlns</code> attribute is used alone, it sets
the default namespace for the element on which it
appears, and for any child elements. For example:</p>
<pre>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>...</mrow>
</math>
</pre>
<p>When the <code>xmlns</code> attribute is used as a
prefix, it declares a prefix which can then be used to explicitly associate other
elements
and attributes with a particular namespace.
When embedding MathML within XHTML, one might use:
</p>
<pre>
<body xmlns:m="http://www.w3.org/1998/Math/MathML">
...
<m:math><m:mrow>...</m:mrow></m:math>
...
</body>
</pre>
<p>HTML does not support namespace extensibility in the same way, the HTML parser
has in-built knowledge of the HTML, SVG and MathML namespaces. <code>xmlns</code> attributes are
just treated as normal attributes. Thus when using the HTML serialisation of MathML,
prefixed element names must not be used. <code>xmlns</code>="http://www.w3.org/1998/Math/MathML"
may be used on the <code>math element</code>, it will be ignored by the HTML parser,
which always places <code>math</code> elements and its descendents in the MathML namespace
(other than special rules described in <a href="appendixa.html">Appendix A Parsing MathML</a>for invalid input, and for <code>annotation-xml</code>.
If a MathML expression is likely to be in contexts where it may be parsed by an XML
parser or an HTML parser, it SHOULD
use the following form to ensure maximum compatibility:
</p>
<pre class="mathml-fragment">
<math xmlns="http://www.w3.org/1998/Math/MathML">
...
</math>
</pre>
</div>
<div class="div3">
<h3><a id="fund.xmlsyntax"></a>2.1.3 Children versus Arguments</h3>
<p>Most MathML elements act as ‘containers’; such an element's
children are not distinguished from each other except as individual members of the
list of children. Commonly there is no limit imposed on the number of children
an element may have. This is the case for most presentation
elements and some content elements such as <code>set</code>.
But many
MathML elements require a specific number of children, or
attach a particular meaning to children in certain positions.
Such elements are best considered to represent constructors of mathematical
objects, and hence thought of as functions of their children. Therefore
children of such a MathML element
will often be referred to as its <em>arguments</em> instead of merely as children.
Examples of this can be found, say, in <a href="chapter3.html#presm.reqarg">Section 3.1.3 Required Arguments</a>.
</p>
<p>There are presentation elements that conceptually accept only
a single argument, but which for convenience have been written to accept any number
of children;
then we infer an <code>mrow</code> containing those children which acts as
the argument to the element in question; see <a href="chapter3.html#presm.inferredmrow">Section 3.1.3.1 Inferred <code><mrow></code>s</a>.
</p>
<p>In the detailed discussions of element syntax given with each
element throughout the MathML specification, the correspondence
of children with arguments, the number of arguments required and
their order, as well as other constraints on the content, are specified.
This information is also tabulated
for the presentation elements in <a href="chapter3.html#presm.reqarg">Section 3.1.3 Required Arguments</a>.</p>
</div>
<div class="div3">
<h3><a id="fund.renderingmodel"></a>2.1.4 MathML and Rendering</h3>
<p>MathML presentation elements only recommend (i.e., do not require)
specific ways of rendering; this is in order to allow for medium-dependent
rendering and for individual preferences of style.</p>
<p>Nevertheless, some parts of this specification describe these
recommended visual rendering rules in detail; in those
descriptions it is often assumed that the model of rendering
used supports the concepts of a well-defined 'current rendering
environment' which, in particular, specifies a 'current font',
a 'current display' (for pixel size) and a 'current baseline'.
The 'current font' provides certain metric properties and an
encoding of glyphs.</p>
</div>
<div class="div3">
<h3><a id="fund.attval"></a>2.1.5 MathML Attribute Values</h3>
<p>MathML elements take attributes with values that further specialize
the meaning or effect of the element. Attribute names are shown in a
<code>monospaced</code> font throughout this document. The meanings of attributes and their
allowed values are described within the specification of each element.
The syntax notation explained in this section is used in specifying allowed values.
</p>
<p>Except when explicitly forbidden by the specification for an attribute,
MathML attribute values may contain any legal characters specified by
the XML recommendation. See <a href="chapter7.html">Chapter 7 Characters, Entities and Fonts</a> for further
clarification.
</p>
<div class="div4">
<h4><a id="id.2.1.5.1"></a>2.1.5.1 Syntax notation used in the MathML specification</h4>
<p>To describe the MathML-specific syntax of
attribute values, the following conventions and notations are
used for most attributes in the present document.
We use below the notation
beginning with U+ that is recommended by Unicode
for referring to Unicode characters [see <a href="appendixg.html#Unicode">[Unicode]</a>, page
xxviii].
</p>
<table id="fund.table-attval" class="data">
<thead>
<tr>
<th>Notation</th>
<th>What it matches</th>
</tr>
</thead>
<tbody>
<tr>
<td id="type.digit"><em>decimal-digit</em></td>
<td>a decimal digit from the range U+0030 to U+0039</td>
</tr>
<tr>
<td id="type.hexdigit"><em>hexadecimal-digit</em></td>
<td>a hexadecimal (base 16) digit from the ranges U+0030 to U+0039, U+0041 to
U+0046 and U+0061 to U+0066</td>
</tr>
<tr>
<td id="type.unsigned-integer"><em>unsigned-integer</em></td>
<td>a string of <a href="#type.digit"><em>decimal-digit</em></a>s,
representing a non-negative integer</td>
</tr>
<tr>
<td id="type.positive-integer"><em>positive-integer</em></td>
<td>a string of <a href="#type.digit"><em>decimal-digit</em></a>s,
but not consisting solely of "0"s (U+0030), representing a positive integer</td>
</tr>
<tr>
<td id="type.integer"><em>integer</em></td>
<td>an optional "-" (U+002D), followed by a string of
<a href="#type.digit"><em>decimal digit</em></a>s,
and representing an integer
</td>
</tr>
<tr>
<td id="type.unsigned-number"><em>unsigned-number</em></td>
<td>
a string of <a href="#type.digit"><em>decimal digit</em></a>s
with up to one decimal point (U+002E),
representing a non-negative terminating decimal number
(a type of rational number)</td>
</tr>
<tr>
<td id="type.number"><em>number</em></td>
<td>
an optional prefix of "-" (U+002D), followed by an unsigned number,
representing a terminating decimal number (a type of rational number)</td>
</tr>
<tr>
<td id="type.character"><em>character</em></td>
<td>a single non-whitespace character</td>
</tr>
<tr>
<td id="type.string"><em>string</em></td>
<td>an arbitrary, nonempty and finite, string of <em>character</em>s</td>
</tr>
<tr>
<td><em>length</em></td>
<td>a length, as explained below, <a href="#fund.units">Section 2.1.5.2 Length Valued Attributes</a></td>
</tr>
<tr>
<td><em>unit</em></td>
<td>a unit, typically used as part of a length, as explained below, <a href="#fund.units">Section 2.1.5.2 Length Valued Attributes</a></td>
</tr>
<tr>
<td><em>namedlength</em></td>
<td>a named length, as explained below, <a href="#fund.units">Section 2.1.5.2 Length Valued Attributes</a></td>
</tr>
<tr>
<td><em>color</em></td>
<td>a color, as explained below, <a href="#fund.color">Section 2.1.5.3 Color Valued Attributes</a></td>
</tr>
<tr>
<td id="type.id"><em>id</em></td>
<td>an identifier, unique within the document;
must satisfy the NAME syntax of the XML recommendation <a href="appendixg.html#XML">[XML]</a></td>
</tr>
<tr>
<td id="type.idref"><em>idref</em></td>
<td>an identifier referring to another element within the document;
must satisfy the NAME syntax of the XML recommendation <a href="appendixg.html#XML">[XML]</a></td>
</tr>
<tr>
<td id="type.uri"><em>URI</em></td>
<td>a Uniform Resource Identifier <a href="appendixg.html#RFC3986">[RFC3986]</a>. Note that the attribute value
is typed in the schema as anyURI which allows any sequence of XML characters.
Systems needing to use this string as a URI must encode the bytes of the UTF-8 encoding
of any characters not allowed in URI using %HH encoding where HH are the byte value
in hexadecimal.
This ensures that such an attribute value may be interpreted as an IRI,
or more generally a LEIRI, see <a href="appendixg.html#IRI">[IRI]</a>.</td>
</tr>
<tr>
<td><em>italicized word</em></td>
<td>values as explained in the text for each attribute; see <a href="#fund.defaults">Section 2.1.5.4 Default values of attributes</a></td>
</tr>
<tr>
<td>"literal"</td>
<td>quoted symbol, literally present in the attribute value (e.g. "+" or '+')</td>
</tr>
</tbody>
</table>
<p>The ‘types’ described above, except for <em>string</em>,
may be combined into composite patterns using the following operators. The whole
attribute value must be delimited by single (') or double (") quotation marks in the
marked up
document. Note that double quotation marks are often used in this specification to
mark up
literal expressions; an example is the "-" in line 5 of the table above.
</p>
<p>
In the table
below a form <em>f</em> means an instance of a type described in the table above.
The combining operators are shown in order of precedence from highest
to lowest:</p>
<table id="fund.table.notn" class="data">
<thead>
<tr>
<th>Notation</th>
<th>What it matches</th>
</tr>
</thead>
<tbody>
<tr>
<td>( <em>f</em> )</td>
<td>same as <em>f</em></td>
</tr>
<tr>
<td><em>f</em><code>?</code></td>
<td>an optional instance of <em>f</em></td>
</tr>
<tr>
<td><em>f</em> <code>*</code></td>
<td>zero or more instances of <em>f</em>, with
separating whitespace characters</td>
</tr>
<tr>
<td><em>f</em> +</td>
<td>one or more instances of <em>f</em>, with
separating whitespace characters</td>
</tr>
<tr>
<td><em>f<sub>1</sub> f<sub>2</sub> ... f<sub>n</sub></em></td>
<td>one instance of each form <em>f<sub>i</sub></em>, in sequence,
with no separating whitespace</td>
</tr>
<tr>
<td><em>f<sub>1</sub>, f<sub>2</sub>, ..., f<sub>n</sub></em></td>
<td>one instance of each form <em>f<sub>i</sub></em>, in sequence, with
separating whitespace characters (but no commas)</td>
</tr>
<tr>
<td><em>f<sub>1</sub></em> | <em>f<sub>2</sub></em> | ... | <em>f<sub>n</sub></em></td>
<td>any one of the specified forms <em>f<sub>i</sub></em></td>
</tr>
</tbody>
</table>
<p>The notation we have chosen here is in the style of the syntactical notation of the
RelaxNG
used for MathML's basic schema, <a href="appendixa.html">Appendix A Parsing MathML</a>.
</p>
<p>Since some applications are inconsistent about normalization
of whitespace, for maximum interoperability it is advisable to use only
a single whitespace character for separating parts of a value.
Moreover, leading and trailing whitespace in attribute values should be avoided.</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>
</div>
<div class="div4">
<h4><a id="fund.units"></a>2.1.5.2 Length Valued Attributes</h4>
<p>Most presentation elements have attributes that accept values
representing lengths to be used for size, spacing or similar properties.
The syntax of a length is specified as</p>
<table id="type.length" class="data">
<thead>
<tr>
<th>Type</th>
<th>Syntax</th>
</tr>
</thead>
<tbody>
<tr>
<td><em>length</em></td>
<td>
<a href="#type.number"><em>number</em></a>
| <a href="#type.number"><em>number</em></a>
<a href="#type.unit"><em>unit</em></a>
| <a href="#type.namedspace"><em>namedspace</em></a>
</td>
</tr>
</tbody>
</table>
<p>There should be no space between the number and the unit of a length.</p>
<p>The possible <em>unit</em>s and <em>namedspace</em>s, along with their interpretations, are
shown below. Note that although the units and their meanings are taken from
CSS, the syntax of lengths is not identical. A few MathML elements
have length attributes that accept additional keywords; these are termed pseudo-units
and specified
in the description of those particular elements; see, for instance, <a href="chapter3.html#presm.mpadded">Section 3.3.6 Adjust Space Around Content
<code><mpadded></code></a>.</p>
<p>
A trailing "%" represents a percent of
a reference value; unless otherwise stated,
the reference value is
the default value.
The default value, or how it is obtained,
is listed in the table of attributes for each element
along with the reference value when
it differs from the default.
(See also <a href="#fund.defaults">Section 2.1.5.4 Default values of attributes</a>.)
A number without a unit is intepreted as a multiple of the
reference value.
This form is primarily for backward compatibility and should be avoided,
prefering explicit units for clarity.
</p>
<p>In some cases, the range of acceptable values for a particular attribute may be restricted;
implementations are free to round up or down to the closest allowable value.</p>
<p id="type.unit">The possible <em>unit</em>s in MathML are:</p>
<table class="data">
<thead>
<tr>
<th>Unit</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>em</code></td>
<td>an em (font-relative unit traditionally used for horizontal lengths)</td>
</tr>
<tr>
<td><code>ex</code></td>
<td>an ex (font-relative unit traditionally used for vertical lengths)</td>
</tr>
<tr>
<td><code>px</code></td>
<td>pixels, or size of a pixel in the current display</td>
</tr>
<tr>
<td><code>in</code></td>
<td>inches (1 inch = 2.54 centimeters)</td>
</tr>
<tr>
<td><code>cm</code></td>
<td>centimeters</td>
</tr>
<tr>
<td><code>mm</code></td>
<td>millimeters</td>
</tr>
<tr>
<td><code>pt</code></td>
<td>points (1 point = 1/72 inch)</td>
</tr>
<tr>
<td><code>pc</code></td>
<td>picas (1 pica = 12 points)</td>
</tr>
<tr>
<td><code>%</code></td>
<td>percentage of the reference value</td>
</tr>
</tbody>
</table>
<p>Some additional aspects of units are discussed further
below, in <a href="#units.addl.notes">Section 2.1.5.2.1 Additional notes about units</a>.</p>
<p id="type.namedspace">The following constants, <em>namedspace</em>s,
may also be used where a length is needed; they are typically used for
spacing or padding between tokens.
Recommended default values for these constants are shown;
the actual spacing used is implementation specific.
</p>
<table class="data">
<thead>
<tr>
<th><em>namedspace</em></th>
<th>Recommended default</th>
</tr>
</thead>
<tbody>
<tr>
<td>"veryverythinmathspace"</td>
<td>1/18<code>em</code></td>
</tr>
<tr>
<td>"verythinmathspace"</td>
<td>2/18<code>em</code></td>
</tr>
<tr>
<td>"thinmathspace"</td>
<td>3/18<code>em</code></td>
</tr>
<tr>
<td>"mediummathspace"</td>
<td>4/18<code>em</code></td>
</tr>
<tr>
<td>"thickmathspace"</td>
<td>5/18<code>em</code></td>
</tr>
<tr>
<td>"verythickmathspace"</td>
<td>6/18<code>em</code></td>
</tr>
<tr>
<td>"veryverythickmathspace"</td>
<td>7/18<code>em</code></td>
</tr>
<tr>
<td>"negativeveryverythinmathspace"</td>
<td>-1/18<code>em</code></td>
</tr>
<tr>
<td>"negativeverythinmathspace"</td>
<td>-2/18<code>em</code></td>
</tr>
<tr>
<td>"negativethinmathspace"</td>
<td>-3/18<code>em</code></td>
</tr>
<tr>
<td>"negativemediummathspace"</td>
<td>-4/18<code>em</code></td>
</tr>
<tr>
<td>"negativethickmathspace"</td>
<td>-5/18<code>em</code></td>
</tr>
<tr>
<td>"negativeverythickmathspace"</td>
<td>-6/18<code>em</code></td>
</tr>
<tr>
<td>"negativeveryverythickmathspace"</td>
<td>-7/18<code>em</code></td>
</tr>
</tbody>
</table>
<div class="div5">
<h5><a id="units.addl.notes"></a>2.1.5.2.1 Additional notes about units</h5>
<p>Lengths are only used in MathML for presentation, and presentation
will ultimately involve rendering in or on some medium. For visual media,
the display context is assumed to have certain properties available to
the rendering agent. A <code>px</code> corresponds to a pixel on the display, to
the extent that is meaningful. The resolution of the display device
will affect the correspondence of pixels to the units
<code>in</code>, <code>cm</code>, <code>mm</code>, <code>pt</code> and <code>pc</code>.
</p>
<p>Moreover, the display context will also provide a default for the font size;
the parameters of this font determine the initial values used to interpret
the units <code>em</code> and <code>ex</code>, and thus indirectly the sizes
of namedspaces. Since these units track the display context, and in particular,
the user's preferences for display, the relative units <code>em</code> and <code>ex</code>
are generally to be preferred over absolute units such as <code>px</code> or <code>cm</code>.
</p>
<p>Two additional aspects of relative units must be clarified, however.
First, some elements such as <a href="chapter3.html#presm.scrlim">Section 3.4 Script and Limit Schemata</a> or <code>mfrac</code>,
implicitly switch to smaller font sizes for some of their arguments.
Similarly, <code>mstyle</code> can be used to explicitly change
the current font size. In such cases, the effective values of
an <code>em</code> or <code>ex</code> inside those contexts will be
different than outside. The second point is that the effective value
of an <code>em</code> or <code>ex</code> used for an attribute value
can be affected by changes to the current font size.
Thus, attributes that affect the current font size,
such as <code>mathsize</code>
and <code>scriptlevel</code>, must be processed before
evaluating other length valued attributes.
</p>
<p>If, and how, lengths might affect non-visual media is implementation specific.</p>
</div>
</div>
<div class="div4">
<h4><a id="fund.color"></a>2.1.5.3 Color Valued Attributes</h4>
<p>The color, or background color, of presentation elements
may be specified as a <em>color</em> using the following syntax:</p>
<table id="type.color" class="data">
<thead>
<tr>
<th>Type</th>
<th>Syntax</th>
</tr>
</thead>
<tbody>
<tr>
<td><em>color</em></td>
<td>
#<a href="#type.hexdigit"><em>R</em></a><a href="#type.hexdigit"><em>G</em></a><a href="#type.hexdigit"><em>B</em></a>
| #<a href="#type.hexdigit"><em>R</em></a><a href="#type.hexdigit"><em>R</em></a><a href="#type.hexdigit"><em>G</em></a><a href="#type.hexdigit"><em>G</em></a><a href="#type.hexdigit"><em>B</em></a><a href="#type.hexdigit"><em>B</em></a>
| <a href="#type.html-color"><em>html-color-name</em></a>
</td>
</tr>
</tbody>
</table>
<p>A color is specified either by "#" followed
by hexadecimal values for the red, green, and blue components,
with no intervening whitespace, or by an <em>html-color-name</em>.
The color components can be either 1-digit or 2-digit, but
must all have the same number of digits; the component
ranges from 0 (component not present) to <code>FF</code> (component fully present).
Note that, for example, by the digit-doubling rule specified under Colors in
<a href="appendixh.html#CSS21">[CSS21]</a>
<code>#123</code> is a short form for <code>#112233</code>.
</p>
<p id="type.html-color">Color values can also be specified as an <em>html-color-name</em>,
one of the color-name keywords defined in <a href="appendixg.html#HTML4">[HTML4]</a>
("aqua",
"black",
"blue",
"fuchsia",
"gray",
"green",
"lime",
"maroon",
"navy",
"olive",
"purple",
"red",
"silver",
"teal",
"white", and
"yellow").
Note that the color name keywords are not case-sensitive, unlike most
keywords in MathML attribute values, for compatibility with CSS and HTML.</p>
<p>When a <em>color</em> is applied to an element,
it is the color in which the content of tokens is rendered.
Additionally, when inherited from a surrounding element or from the environment in
which the complete MathML expression is embedded, it controls the color of
all other drawing due to MathML elements, including the lines
or radical signs that can be drawn in rendering <code>mfrac</code>, <code>mtable</code>, or
<code>msqrt</code>.</p>
<p>When used to specify a background color, the keyword "transparent"
is also allowed.
The recommended MathML visual rendering rules do not define the
precise extent of the region whose background is affected by using the
<code>background</code> attribute on an element,
except that, when the element's content does not have
negative dimensions and its drawing region is not overlapped by other
drawing due to surrounding negative spacing, this region should lie
behind all the drawing done to render the content of the
element, but should not lie behind any of the
drawing done to render surrounding expressions. The effect of overlap
of drawing regions caused by negative spacing on the extent of the
region affected by the <code>background</code> attribute is not
defined by these rules.</p>
</div>
<div class="div4">
<h4><a id="fund.defaults"></a>2.1.5.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,
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 in <a href="chapter3.html#presm.mstyle">Section 3.3.4 Style Change <code><mstyle></code></a>,
or in some cases (which are described individually) taken 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 context in which the element is rendered.</p>
<p>Other italicized descriptions of default values which appear in the
tables of attributes are explained individually for each attribute.</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 around attribute values in examples in the
text, so that the pieces of code shown are correct.</p>
<p>Note that, in general, there is no mechanism in MathML to simulate the
effect of not specifying 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, the <code>mstyle</code> element (<a href="chapter3.html#presm.mstyle">Section 3.3.4 Style Change <code><mstyle></code></a>)
can even be used to change the default values of presentation attributes
for its children.</p>
<p>Note also that these defaults describe the
behavior of MathML applications when an attribute is not supplied;
they do not indicate a value that will be filled in by an XML parser,
as is sometimes mandated by DTD-based specifications.</p>
<p>In general, there are a number of
properties of MathML rendering that may be thought of as overall
properties of a document, or at least of sections of a large
document. Examples might be <code>mathsize</code> (the math font
size: see <a href="chapter3.html#presm.commatt">Section 3.2.2 Mathematics style attributes common to token elements</a>), or the
behavior in setting limits on operators such as integrals or sums
(e.g., <code>movablelimits</code> or <code>displaystyle</code>), or
upon breaking formulas over lines (e.g.
<code>linebreakstyle</code>); for such attributes see several
elements in <a href="chapter3.html#presm.tokel">Section 3.2 Token Elements</a>.
These may be thought to be inherited from some such
containing scope. Just above we have mentioned the setting of default
values of MathML attributes as <em>inherited</em> or
<em>automatic</em>; there is a third source of global default values
for behavior in rendering MathML, a MathML operator dictionary. A
default example is provided in <a href="appendixc.html">Appendix C Operator Dictionary</a>.
This is also discussed in <a href="chapter3.html#presm.opdict">Section 3.2.5.7.1 The operator dictionary</a> and examples are given in
<a href="chapter3.html#presm.mo.dict.attrs">Section 3.2.5.2.1 Dictionary-based attributes</a>.</p>
</div>
</div>
<div class="div3">
<h3><a id="fund.globatt"></a>2.1.6 Attributes Shared by all MathML Elements</h3>
<p>In addition to the attributes described specifically for each element,
the attributes in the following table are allowed on every MathML element.
Also allowed are attributes from the xml namespace, such as <code>xml:lang</code>,
and attributes from namespaces other than MathML,
which are ignored by default.</p>
<table class="attributes">
<thead>
<tr>
<th>Name</th>
<th>values</th>
<th>default</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2" class="attname">id</td>
<td><a href="#type.id"><em>id</em></a></td>
<td><em>none</em></td>
</tr>
<tr>
<td colspan="2" class="attdesc">
Establishes a unique identifier associated with the element
to support linking, cross-references and parallel markup.
See <code>xref</code> and <a href="chapter5.html#mixing.parallel">Section 5.4 Parallel Markup</a>.
</td>
</tr>
<tr>
<td rowspan="2" class="attname">xref</td>
<td><a href="#type.idref"><em>idref</em></a></td>
<td><em>none</em></td>
</tr>
<tr>
<td colspan="2" class="attdesc">
References another element within the document.
See <code>id</code> and <a href="chapter5.html#mixing.parallel">Section 5.4 Parallel Markup</a>.
</td>
</tr>
<tr>
<td rowspan="2" class="attname">class</td>
<td><a href="#type.string"><em>string</em></a></td>
<td><em>none</em></td>
</tr>
<tr>
<td colspan="2" class="attdesc">
Associates the element with a set of style classes for use with
<a href="appendixh.html#XSLT">[XSLT]</a> and <a href="appendixh.html#CSS21">[CSS21]</a>.
Typically this would be a space separated sequence of words,
but this is not specified by MathML.
See <a href="chapter6.html#world-int-style">Section 6.5 Using CSS with MathML</a> for discussion of the interaction of MathML and CSS.
</td>
</tr>
<tr>