forked from w3c/mathml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfundamentals.html
1010 lines (841 loc) · 40.4 KB
/
fundamentals.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
<section>
<h2 id="fund">MathML Fundamentals</h2>
<!-- <div class="issue" data-number="264"></div>-->
<!-- <div class="issue" data-number="250"></div>-->
<section>
<h3 id="fund_syntax">MathML Syntax and Grammar</h3>
<section>
<h4 id="fund_xmlgeneral">General Considerations</h4>
<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 [[RELAXNG-SCHEMA]] in <a href="#parsing"></a>.
Derived schema in other formats, DTD (Document Type Definition)
and XML Schema [[XMLSchemas]] are also provided.
</p>
<p>MathML's character set consists of any
Unicode characters [[Unicode]] allowed by the syntax being used. (See for example [[XML]] or [[HTML]].)
The use of Unicode characters for mathematics is
discussed in <a href="#chars"></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>
</section>
<section>
<h4 id="interf_namespace">MathML and Namespaces</h4>
<p>An XML namespace [[Namespaces]] 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 class="attribute">xmlns</code>
attribute, or an attribute with an <code class="attribute">xmlns</code> prefix.</p>
<div class="example ">
<pre>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>...</mrow>
</math>
</pre>
</div>
<p>When the <code class="attribute">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 HTML using XML syntax, one might use:
</p>
<div class="example ">
<pre>
<body xmlns:m="http://www.w3.org/1998/Math/MathML">
...
<m:math><m:mrow>...</m:mrow></m:math>
...
</body>
</pre>
</div>
<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 class="attribute">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 class="attribute">xmlns</code>=<code class="attributevalue">http://www.w3.org/1998/Math/MathML</code>
may be used on the <code class="element">math</code> element; it will be ignored by the HTML parser.
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>
<div class="example mathml-fragment">
<pre>
<math xmlns="http://www.w3.org/1998/Math/MathML">
...
</math>
</pre>
</div>
</section>
<section>
<h4 id="fund_xmlsyntax">Children versus Arguments</h4>
<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 class="element">mrow</code> containing those children which acts as
the argument to the element in question; see <a href="#presm_inferredmrow"></a>.
</p>
<p>In the detailed discussions of element syntax given with each
element throughout the MathML specification, 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="#presm_reqarg"></a>.</p>
</section>
<section>
<h4 id="fund_renderingmodel">MathML and Rendering</h4>
<p>Web Platform implementations of [[MathML-Core]] should follow the
detailed layout rules specified in that document.</p>
<p>This document only recommends (i.e., does not require) specific
ways of rendering Presentation MathML; this is in order to allow
for medium-dependent rendering and for implementations not using
the CSS based Web Platform.</p>
</section>
<section>
<h4 id="fund_attval">MathML Attribute Values</h4>
<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>
<section>
<h5 id="fund_syntax_notation">Syntax notation used in the MathML specification</h5>
<p>To describe the MathML-specific syntax of
attribute values, the following conventions and notations are
used for most attributes in the present document.</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_unsigned-integer"><dfn><em>unsigned-integer</em></dfn></td>
<td>As defined in [[MathML-Core]], an <a data-cite="CSS-VALUES-3#integer-value"><code>integer</code></a>, whose first character is neither
U+002D HYPHEN-MINUS character (-) nor
U+002B PLUS SIGN (+).</td>
</tr>
<tr>
<td id="type_positive-integer"><dfn><em>positive-integer</em></dfn></td>
<td>An [=unsigned-integer=] not consisting solely of "0"s (U+0030), representing a positive integer</td>
</tr>
<tr>
<td id="type_integer"><dfn><em>integer</em></dfn></td>
<td>an optional "-" (U+002D), followed by an [=unsigned-integer=],
and representing an integer
</td>
</tr>
<tr>
<td id="type_unsigned-number"><dfn><em>unsigned-number</em></dfn></td>
<td>
value as defined in
[[CSS-VALUES-3]] <a data-cite="CSS-VALUES-3#number"><code>number</code></a>, whose first character is neither
U+002D HYPHEN-MINUS character (-) nor
U+002B PLUS SIGN (+),
representing a non-negative terminating decimal number
(a type of rational number)</td>
</tr>
<tr>
<td id="type_number"><dfn><em>number</em></dfn></td>
<td>
an optional prefix of "-" (U+002D), followed by an <a href="#type_unsigned-number">unsigned number</a>,
representing a terminating decimal number (a type of rational number)</td>
</tr>
<tr>
<td id="type_character"><dfn><em>character</em></dfn></td>
<td>a single non-whitespace character</td>
</tr>
<tr>
<td id="type_string"><dfn><em>string</em></dfn></td>
<td>an arbitrary, nonempty and finite, string of <em>character</em>s</td>
</tr>
<tr>
<td id="type_length"><dfn><em>length</em></dfn></td>
<td>a length, as explained below, <a href="#fund_units"></a></td>
</tr>
<tr>
<td id="type_namedspace"><b><em>namedspace</em></b></td>
<td>a named [=length=], [=namedspace=], as explained in <a href="#fund_units"></a></td>
</tr>
<tr>
<td id="type_color"><dfn><em>color</em></dfn></td>
<td>a color, using the syntax specified by [[CSS-Color-3]]</td>
</tr>
<tr>
<td id="type_id"><dfn><em>id</em></dfn></td>
<td>an identifier, unique within the document;
must satisfy the NAME syntax of the XML recommendation [[XML]]</td>
</tr>
<tr>
<td id="type_idref"><dfn><em>idref</em></dfn></td>
<td>an identifier referring to another element within the document;
must satisfy the NAME syntax of the XML recommendation [[XML]]</td>
</tr>
<tr>
<td id="type_uri"><dfn><em>URI</em></dfn></td>
<td>a Uniform Resource Identifier [[RFC3986]]. 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 [[IRI]].</td>
</tr>
<tr>
<td><em>italicized word</em></td>
<td>values as explained in the text for each attribute; see <a href="#fund_defaults"></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><math class="doc" alttext="(f)"><mo>(</mo><mi>f</mi><mo>)</mo></math></td>
<td>same <math class="doc" alttext="f"><mi>f</mi></math></td>
</tr>
<tr>
<td><math class="doc" alttext="f?"><mi>f</mi><mo>?</mo></math></td>
<td>an optional instance of <math class="doc" alttext="f"><mi>f</mi></math></td>
</tr>
<tr>
<td><math class="doc" alttext="f*"><mi>f</mi><mo>*</mo></math></td>
<td>zero or more instances of <math class="doc" alttext="f"><mi>f</mi></math>, with
separating whitespace characters</td>
</tr>
<tr>
<td><math class="doc" alttext="f+"><mi>f</mi><mo>+</mo></math></td>
<td>one or more instances of <math class="doc" alttext="f"><mi>f</mi></math>, with
separating whitespace characters</td>
</tr>
<tr>
<td><math class="doc" alttext="f_1 f_2 ... f_n"><msub><mi>f</mi><mn>1</mn></msub><msub><mi>f</mi><mn>2</mn></msub> <mo>⋯</mo><msub><mi>f</mi><mi>n</mi></msub></math></td>
<td>one instance of each form <math class="doc" alttext="f_i"><msub><mi>f</mi><mi>i</mi></msub></math>, in sequence,
with no separating whitespace</td>
</tr>
<tr>
<td><math class="doc" alttext="f_1, f_2, ..., f_n"><msub><mi>f</mi><mn>1</mn></msub><mo>,</mo><msub><mi>f</mi><mn>2</mn></msub><mo>,</mo> <mo>…</mo><mo>,</mo><msub><mi>f</mi><mi>n</mi></msub></math></td>
<td>one instance of each form <math class="doc" alttext="f_i"><msub><mi>f</mi><mi>i</mi></msub></math>, in sequence, with
separating whitespace characters (but no commas)</td>
</tr>
<tr>
<td style="white-space:nowrap"><math class="doc" alttext="f_1, f_2, ..., f_n"><msub><mi>f</mi><mn>1</mn></msub><mo>|</mo><msub><mi>f</mi><mn>2</mn></msub><mo>|</mo> <mo>⋯</mo><mo>|</mo><msub><mi>f</mi><mi>n</mi></msub></math></td>
<td>any one of the specified forms <math class="doc" alttext="f_i"><msub><mi>f</mi><mi>i</mi></msub></math></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="#parsing"></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 class="attribute">number</code> or
<code class="attribute">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>
</section>
<section>
<h5 id="fund_units">Length Valued Attributes</h5>
<p>Most presentation elements have attributes that accept values
representing lengths to be used for size, spacing or similar properties.
[[MathML-Core]] accepts lengths only in the
<a id="type_unit" data-cite="CSS-VALUES-3#typedef-length-percentage"><code><length-percentage></code></a>
syntax defined in [[CSS-VALUES-3]].
MathML Full extends length syntax by accepting also a <dfn>namedspace</dfn>
being one of:</p>
<table class="data">
<thead>
<tr><th>Positive space</th><th>Negative space</th><th>Value</th></tr>
</thead>
<tbody>
<tr>
<td style="white-space:nowrap"><code class="attributevalue">veryverythinmathspace</code></td>
<td style="white-space:nowrap"><code class="attributevalue">negativeveryverythinmathspace</code></td>
<td>±1/18 em</td>
</tr>
<tr>
<td style="white-space:nowrap"><code class="attributevalue">verythinmathspace</code></td>
<td style="white-space:nowrap"><code class="attributevalue">negativeverythinmathspace</code></td>
<td>±2/18 em</td>
</tr>
<tr>
<td style="white-space:nowrap"><code class="attributevalue">thinmathspace</code></td>
<td style="white-space:nowrap"><code class="attributevalue">negativethinmathspace</code></td>
<td>±3/18 em</td>
</tr>
<tr>
<td style="white-space:nowrap"><code class="attributevalue">mediummathspace</code></td>
<td style="white-space:nowrap"><code class="attributevalue">negativemediummathspace</code></td>
<td>±4/18 em</td>
</tr>
<tr>
<td style="white-space:nowrap"><code class="attributevalue">thickmathspace</code></td>
<td style="white-space:nowrap"><code class="attributevalue">negativethickmathspace</code></td>
<td>±5/18 em</td>
</tr>
<tr>
<td style="white-space:nowrap"><code class="attributevalue">verythickmathspace</code></td>
<td style="white-space:nowrap"><code class="attributevalue">negativeverythickmathspace</code></td>
<td>±6/18 em</td>
</tr>
<tr>
<td style="white-space:nowrap"><code class="attributevalue">veryverythickmathspace</code></td>
<td style="white-space:nowrap"><code class="attributevalue">negativeveryverythickmathspace</code></td>
<td>±7/18 em</td>
</tr>
</tbody>
</table>
<p>In MathML 3, the attributes on <a href="#presm_mpadded">mpadded</a>
allowed three <dfn>pseudo-units</dfn>, <code>height</code>,
<code>depth</code>, and <code>width</code> (taking the place of one of the usual CSS units)
denoting the original dimensions of the content.
It also allowed a deprecated usage with lengths specified as
a number without a unit which was interpreted as a multiple of the
reference value. These forms are considered invalid in MathML 4.
</p>
<section>
<h6 id="units_addl_notes">Additional notes about units</h6>
<p>Two additional aspects of relative units must be clarified, however.
First, some elements such as <a href="#presm_scrlim"></a> or <code class="element">mfrac</code>
implicitly switch to smaller font sizes for some of their arguments.
Similarly, <code class="element">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 class="attribute">mathsize</code>
and <code class="attribute">scriptlevel</code>, must be processed before
evaluating other length valued attributes.
</p>
</section>
</section>
<section>
<h5 id="fund_defaults">Default values of attributes</h5>
<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="#presm_mstyle"></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 <q>inherited</q> or
<q>automatic</q> explicitly will not work, and is not generally
allowed. Furthermore, the <code class="element">mstyle</code> element (<a href="#presm_mstyle"></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 class="attribute">mathsize</code> (the math font
size: see <a href="#presm_commatt"></a>), or the
behavior in setting limits on operators such as integrals or sums
(e.g., <code class="attribute">movablelimits</code> or <code class="attribute">displaystyle</code>), or
upon breaking formulas over lines (e.g.
<code class="attribute">linebreakstyle</code>); for such attributes see several
elements in <a href="#presm_tokel"></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="#oper-dict"></a>.
This is also discussed in <a href="#presm_opdict"></a> and examples are given in
<a href="#presm_mo_dict_attrs"></a>.</p>
</section>
</section>
<section>
<h4 id="fund_globatt">Attributes Shared by all MathML Elements</h4>
<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 class="attribute">xml:lang</code>,
and attributes from namespaces other than MathML,
which are ignored by default.</p>
<table class="attributes data">
<thead>
<tr>
<th>Name</th>
<th>values</th>
<th>default</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2" class="attname"><a class="coreyes" href="https://w3c.github.io/mathml-core/spec.html#dfn-id">id</a></td>
<td><em>[=id=]</em></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 class="attribute">xref</code> and <a href="#mixing_parallel"></a>.
</td>
</tr>
<tr>
<td rowspan="2" class="attname"><span class="coreno">xref</span></td>
<td><em>[=idref=]</em></td>
<td><em>none</em></td>
</tr>
<tr>
<td colspan="2" class="attdesc">
References another element within the document.
See <code class="attribute">id</code> and <a href="#mixing_parallel"></a>.
</td>
</tr>
<tr>
<td rowspan="2" class="attname"><a class="coreyes" href="https://w3c.github.io/mathml-core/spec.html#dfn-class">class</a></td>
<td><em>[=string=]</em></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
[[CSS21]].
See <a href="#world-int-style"></a> for discussion of the interaction of MathML and CSS.
</td>
</tr>
<tr>
<td rowspan="2" class="attname"><a class="coreyes" href="https://w3c.github.io/mathml-core/spec.html#dfn-style">style</a></td>
<td><em>[=string=]</em></td>
<td><em>none</em></td>
</tr>
<tr>
<td colspan="2" class="attdesc">
Associates style information with the element for use with
[[CSS21]].
See <a href="#world-int-style"></a> for discussion of the interaction
of MathML and CSS.
</td>
</tr>
<tr>
<td rowspan="2" class="attname"><span class="coreno">href</span></td>
<td><a class="intref" href="#type_uri"><em>URI</em></a></td>
<td><em>none</em></td>
</tr>
<tr>
<td colspan="2" class="attdesc">
Can be used to establish the element as a hyperlink to the specified <em>URI</em>.
</td>
</tr>
</tbody>
</table>
<p id="presm_presatt_intent">All MathML presentation elements accept <code
class="attribute">intent</code> and <code
class="attribute">arg</code> attributes to support specifying
<q>intent</q>. These are more fully described in
[[[#mixing_intent]]].</p>
<table class="attributes data">
<thead>
<tr>
<th>Name</th>
<th>values</th>
<th>default</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2" class="attname"><a class="coreyes" href="#parsing_rnc_core">intent</a></td>
<td><a class="intref" href="#mixing_intent_grammar"><em>intent expression</em></a></td>
<td><em>none</em></td>
</tr>
<tr>
<td colspan="2" class="attdesc">The <code
class="attribute">intent</code> attribute is more fully described
in <a href="#mixing_intent"></a>. It may be used on presentation
elements to give information about the intended meaning of the
expression, mainly for guiding audio or braille accessible
renderings.</td>
</tr>
<tr>
<td rowspan="2" class="attname"><a class="coreyes" href="#parsing_rnc_core">arg</a></td>
<td><a class="intref" href="#mixing_intent_grammar"><em>name</em></a></td>
<td><em>none</em></td>
</tr>
<tr>
<td colspan="2" class="attdesc">The <code
class="attribute">arg</code> attribute is more fully described
in <a href="#mixing_intent"></a>. It may be used to name an element to be referenced from an
<code class="attribute">intent</code> expression on an ancestor element.</td>
</tr>
</tbody>
</table>
<p>See also <a href="#presm_commatt"></a> for a list of MathML attributes
which can be used on most presentation token elements.
</p>
</section>
<section>
<h4 id="fund_collapse">Collapsing Whitespace in Input</h4>
<p>In MathML, as in XML, <q>whitespace</q> means simple spaces,
tabs, newlines, or carriage returns, i.e., characters with hexadecimal
Unicode codes U+0020, U+0009, U+000A, or
U+000D, respectively; see also the discussion of whitespace in Section 2.3 of
[[XML]].</p>
<p>MathML ignores whitespace occurring outside token elements.
Non-whitespace characters are not allowed there. Whitespace occurring
within the content of token elements, except for <a class="intref" href="#contm_cs"><code class="starttag"><cs></code></a>, is normalized as follows. All whitespace at the beginning and end of the content is
removed, and whitespace internal to content of the element is
collapsed canonically, i.e., each sequence of 1 or more
whitespace characters is replaced with one space character (U+0020, sometimes
called a blank character).</p>
<p>For example, <code><mo> ( </mo></code> is equivalent to
<code><mo>(</mo></code>, and</p>
<div class="example mathml mmlcore">
<pre>
<mtext>
Theorem
1:
</mtext>
</pre>
</div>
<p>is equivalent to
<code><mtext>Theorem 1:</mtext></code>
or
<code><mtext>Theorem&#x20;1:</mtext></code>.</p>
<p>Authors wishing to encode white space 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 non-breaking space U+00A0 (or <code class="entity">nbsp</code>)
or other non-marking characters that are not trimmed.
For example, compare the above use of an <code class="element">mtext</code> element
with</p>
<div class="example mathml mmlcore">
<pre>
<mtext>
&#x00A0;<!--nbsp-->Theorem &#x00A0;<!--nbsp-->1:
</mtext> </pre>
</div>
<p>When the first example is rendered, there is nothing before
<q>Theorem</q>, one Unicode space character between <q>Theorem</q> and
<q>1:</q>, and nothing after <q>1:</q>. In the
second example, a single space character is to be rendered before
<q>Theorem</q>; two spaces, one a Unicode space character and
one a Unicode no-break space character, are to be rendered before
<q>1:</q>; and there is nothing after the
<q>1:</q>.</p>
<p>Note that the value of the <code class="attribute">xml:space</code> attribute is not relevant
in this situation since XML processors pass whitespace in tokens to a
MathML processor; it is the requirements of MathML processing which specify that
whitespace is trimmed and collapsed.</p>
<p>For whitespace occurring outside the content of the token elements
<code class="element">mi</code>, <code class="element">mn</code>, <code class="element">mo</code>, <code class="element">ms</code>, <code class="element">mtext</code>,
<code class="element">ci</code>, <code class="element">cn</code>, <code class="element">cs</code>, <code class="element">csymbol</code> and <code class="element">annotation</code>,
an <code class="element">mspace</code> element should be used, as opposed to an <code class="element">mtext</code> element containing
only whitespace entities.</p>
</section>
</section>
<section>
<h3 id="interf_toplevel">The Top-Level
<code class="defn starttag"><math></code> Element</h3>
<p>MathML specifies a single top-level or root <code class="element">math</code> element,
which encapsulates each instance of
MathML markup within a document. All other MathML content must be
contained in a <code class="element">math</code> element; in other words,
every valid MathML expression is wrapped in outer
<code class="starttag"><math></code> tags. The <code class="element">math</code>
element must always be the outermost element in a MathML expression;
it is an error for one <code class="element">math</code> element to contain
another. These considerations also apply when sub-expressions are
passed between applications, such as for cut-and-paste operations;
see <a href="#world-int-transfers"></a>.</p>
<p>The <code class="element">math</code> element can contain an arbitrary number
of child elements. They render by default as if they
were contained in an <code class="element">mrow</code> element.</p>
<section>
<h4 id="interf_toplevel_atts">Attributes</h4>
<p>The <code class="element">math</code> element accepts any of the attributes that can be set on
<a href="#presm_mstyle"></a>, including the common attributes
specified in <a href="#fund_globatt"></a>.
In particular, it accepts the <code class="attribute">dir</code> attribute for
setting the overall directionality; the <code class="element">math</code> element is usually
the most useful place to specify the directionality
(see <a href="#presm_bidi"></a> for further discussion).
Note that the <code class="attribute">dir</code> attribute defaults to <code class="attributevalue">ltr</code>
on the <code class="element">math</code> element (but <em>inherits</em> on all other elements
which accept the <code class="attribute">dir</code> attribute); this provides for backward
compatibility with MathML 2.0 which had no notion of directionality.
Also, it accepts the <code class="attribute">mathbackground</code> attribute in the same sense
as <code class="element">mstyle</code> and other presentation elements to set the background
color of the bounding box, rather than specifying a default for the attribute
(see <a href="#presm_presatt"></a>).</p>
<p>In addition to those attributes, the <code class="element">math</code> element accepts:</p>
<table class="attributes data">
<thead>
<tr>
<th>Name</th>
<th>values</th>
<th>default</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2" class="attname"><a class="coreyes" href="https://w3c.github.io/mathml-core/spec.html#dfn-display">display</a></td>
<td>"block" | "inline"</td>
<td>inline</td>
</tr>
<tr>
<td colspan="2" class="attdesc">
specifies whether the enclosed MathML expression should be rendered
as a separate vertical block (in display style)
or inline, aligned with adjacent text.
When <code class="attribute">display</code>=<code class="attributevalue">block</code>, <code class="attribute">displaystyle</code> is initialized
to <code class="attributevalue">true</code>,
whereas when <code class="attribute">display</code>=<code class="attributevalue">inline</code>, <code class="attribute">displaystyle</code>
is initialized to <code class="attributevalue">false</code>;
in both cases <code class="attribute">scriptlevel</code> is initialized to 0
(see <a href="#presm_scriptlevel"></a>).
Moreover, when the math element is embedded in a larger document,
a block math element should be treated as a block element as appropriate
for the document type (typically as a new vertical block),
whereas an inline math element should be treated as inline
(typically exactly as if it were a sequence of words in normal text).
In particular, this applies to spacing and linebreaking: for instance,
there should not be spaces or line breaks inserted between inline math
and any immediately following punctuation.
When the display attribute is missing, a rendering agent is free to initialize
as appropriate to the context.
</td>
</tr>
<tr>
<td rowspan="2" class="attname"><span class="coreno">maxwidth</span></td>
<td><a class="intref" href="#type_length"><em>length</em></a></td>
<td><em>available width</em></td>
</tr>
<tr>
<td colspan="2" class="attdesc">
specifies the maximum width to be used for linebreaking.
The default is the maximum width available in the surrounding environment.
If that value cannot be determined, the renderer should assume an infinite rendering
width.
</td>
</tr>
<tr>
<td rowspan="2" class="attname"><span class="coreno">overflow</span></td>
<td>"linebreak" | "scroll" | "elide" | "truncate" | "scale"</td>
<td>linebreak</td>
</tr>
<tr>
<td colspan="2" class="attdesc">
specifies the preferred handing in cases where an expression is too long to
fit in the allowed width. See the discussion below.
</td>
</tr>
<tr>
<td rowspan="2" class="attname"><span class="coreno">altimg</span></td>
<td><a class="intref" href="#type_uri"><em>URI</em></a></td>
<td><em>none</em></td>
</tr>
<tr>
<td colspan="2" class="attdesc">
provides a URI referring to an image to display as a fall-back
for user agents that do not support embedded MathML.
</td>
</tr>
<tr>
<td rowspan="2" class="attname"><span class="coreno">altimg-width</span></td>
<td><a class="intref" href="#type_length"><em>length</em></a></td>
<td><em>width of </em><code class="attribute">altimg</code></td>
</tr>
<tr>
<td colspan="2" class="attdesc">
specifies the width to display <code class="attribute">altimg</code>, scaling the image if necessary;
see <code class="attribute">altimg-height</code>.
</td>
</tr>
<tr>
<td rowspan="2" class="attname"><span class="coreno">altimg-height</span></td>
<td><a class="intref" href="#type_length"><em>length</em></a></td>
<td><em>height of </em><code class="attribute">altimg</code></td>
</tr>
<tr>
<td colspan="2" class="attdesc">
specifies the height to display <code class="attribute">altimg</code>, scaling the image if necessary;
if only one of the attributes <code class="attribute">altimg-width</code> and <code class="attribute">altimg-height</code>
are given, the scaling should preserve the image's aspect ratio;
if neither attribute is given, the image should be shown at its natural size.
</td>
</tr>
<tr>
<td rowspan="2" class="attname"><span class="coreno">altimg-valign</span></td>
<td><a class="intref" href="#type_length"><em>length</em></a>
| "top" | "middle" | "bottom" </td>
<td>0ex</td>
</tr>
<tr>
<td colspan="2" class="attdesc">
specifies the vertical alignment of the image with respect to adjacent inline material.
A positive value of <code class="attribute">altimg-valign</code> shifts the bottom of the image above the
current baseline, while a negative value lowers it.
The keyword "top" aligns the top of the image with the top of adjacent inline material;
"center" aligns the middle of the image to the middle of adjacent material;
"bottom" aligns the bottom of the image to the bottom of adjacent material
(not necessarily the baseline). This attribute only has effect
when <code class="attribute">display</code>=<code class="attributevalue">inline</code>.
By default, the bottom of the image aligns to the baseline.
</td>
</tr>
<tr>
<td rowspan="2" class="attname"><a class="coreyes" href="#parsing_rnc_core">alttext</a></td>
<td><em>[=string=]</em></td>
<td><em>none</em></td>
</tr>
<tr>
<td colspan="2" class="attdesc">
provides a textual alternative as a fall-back for user agents
that do not support embedded MathML or images.
</td>
</tr>
<tr>
<td rowspan="2" class="attname"><span class="coreno">cdgroup</span></td>
<td><a class="intref" href="#type_uri"><em>URI</em></a></td>
<td><em>none</em></td>
</tr>
<tr>
<td colspan="2" class="attdesc">
specifies a CD group file that acts as a catalogue of CD bases for locating
OpenMath content dictionaries of <code class="element">csymbol</code>, <code class="element">annotation</code>, and
<code class="element">annotation-xml</code> elements in this <code class="element">math</code> element; see <a href="#contm_csymbol_sec"></a>. When no <code class="attribute">cdgroup</code> attribute is explicitly specified, the
document format embedding this <code class="element">math</code> element may provide a method for determining
CD bases. Otherwise the system must determine a CD base; in the absence of specific
information <code>http://www.openmath.org/cd</code> is assumed as the CD base for all
<code class="element">csymbol</code>, <code class="element">annotation</code>, and <code class="element">annotation-xml</code> elements. This is the
CD base for the collection of standard CDs maintained by the OpenMath Society.
</td>
</tr>
</tbody>
</table>
<p>In cases where size negotiation is not possible or fails
(for example in the case of an expression that is too long to fit in the allowed width),
the <code class="attribute">overflow</code> attribute is provided to suggest a processing method to the renderer.
Allowed values are:</p>
<table id="fund_table-overflow" class="data">
<thead>
<tr>
<th> Value </th>
<th> Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>"linebreak"</td>
<td>The expression will be broken across several lines.
See <a href="#presm_linebreaking"></a> for further discussion.
<span class="coreno"></span>
</td>
</tr>
<tr>
<td>"scroll"</td>
<td>The window provides a viewport
into the larger complete display of the mathematical
expression. Horizontal or vertical scroll bars are added to the window
as necessary to allow the viewport to be moved to a different
position.
<span class="coreno"></span>
</td>
</tr>
<tr>
<td>"elide"</td>
<td>The display is abbreviated by removing enough of it so that
the remainder fits into the window. For example, a large polynomial
might have the first and last terms displayed with <q>+ ... +</q>
between
them. Advanced renderers may provide a facility to zoom in on elided
areas.
<span class="coreno"></span>
</td>
</tr>
<tr>
<td>"truncate"</td>
<td>The display is abbreviated by simply truncating it at the right and
bottom borders. It is recommended that some indication of truncation is
made to the viewer.
<span class="coreno"></span>
</td>
</tr>
<tr>
<td>"scale"</td>
<td>The fonts used to display the mathematical expression are
chosen so that the full expression fits in the window. Note that this
only happens if the expression is too large. In the case of a window
larger than necessary, the expression is shown at its normal size
within the larger window.
<span class="coreno"></span>
</td>
</tr>