1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Math Macros Initializations}
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\unprotect
53
54\newdimension \mathstrutht
55\newdimension \mathstrutdp
56\newinteger \mathnestinglevel
57
58\newcount \c_math_strc_hangafter
59\newdimen \d_math_strc_hangindent
60
61\newcount \c_strc_math_n_of_lines
62
63\newdimension \d_strc_math_max_right
64\newdimension \d_strc_math_first_right
65\newdimension \d_strc_math_last_right
66
67\newdimension \d_strc_math_max_left
68\newdimension \d_strc_math_first_left
69\newdimension \d_strc_math_last_left
70
71\newdimension \d_strc_math_first_height
72\newdimension \d_strc_math_last_depth
73
74\newdimension \d_strc_math_display_width
75\newdimension \d_strc_math_indent
76\newconditional\c_strc_math_indent
77
78\registerctxluafile{mathini}{autosuffix}
79\registerctxluafile{mathdim}{autosuffix}
80
81\registerctxluafile{mathext}{autosuffix}
82\registerctxluafile{mathvfu}{autosuffix}
83\registerctxluafile{mathttv}{autosuffix}
84\registerctxluafile{mathmap}{autosuffix}
85\registerctxluafile{mathact}{autosuffix}
86\registerctxluafile{mathren}{autosuffix}
87\registerctxluafile{mathnoa}{autosuffix}
88\registerctxluafile{mathtag}{autosuffix}
89\registerctxluafile{mathfbk}{autosuffix}
90
91\registerctxluafile{mathspa}{autosuffix}
92\registerctxluafile{mathfnt}{autosuffix}
93\registerctxluafile{mathpre}{autosuffix}
94
95
96
97\aliased\let\Umathemwidth\Umathquad
98
99\protected\def\mathaxisunit {\scaledmathaxis \mathstyle\norelax}
100\protected\def\mathexheightunit{\scaledmathexheight\mathstyle\norelax}
101\protected\def\mathquadunit {\scaledmathemwidth \mathstyle\norelax}
102
103\newuserunit \mathaxisunit ma
104\newuserunit \mathexheightunit mx
105\newuserunit \mathquadunit mq
106
107
108
109
110
111\delimiterfactor \plusthousand
112\delimitershortfall \zeropoint
113
114
115
116
117
118
119
120
121\mathfontcontrol\numexpr
122 \zerocount
123 \overrulemathcontrolcode
124 \underrulemathcontrolcode
125 \radicalrulemathcontrolcode
126 \fractionrulemathcontrolcode
127 \accentskewhalfmathcontrolcode
128 \accentskewapplymathcontrolcode
129 \applyordinarykernpairmathcontrolcode
130 \applyverticalitalickernmathcontrolcode
131 \applyordinaryitalickernmathcontrolcode
132
133
134 \applyboxeditalickernmathcontrolcode
135 \staircasekernmathcontrolcode
136 \applytextitalickernmathcontrolcode
137 \checktextitalickernmathcontrolcode
138
139 \applyscriptitalickernmathcontrolcode
140
141 \analyzescriptnucleuscharmathcontrolcode
142 \analyzescriptnucleuslistmathcontrolcode
143 \analyzescriptnucleusboxmathcontrolcode
144 \accenttopskewwithoffsetmathcontrolcode
145
146
147 \extendaccentsmathcontrolcode
148 \extenddelimitersmathcontrolcode
149\relax
150
151
152
153
154
155
156\immutable\mugluespecdef\defaultthickermuskip 7mu plus 5mu
157\immutable\mugluespecdef\defaultthickmuskip 5mu plus 3mu minus 1mu
158\immutable\mugluespecdef\defaultmedmuskip 4mu plus 2mu minus 2mu
159\immutable\mugluespecdef\defaultthinmuskip 3mu
160\immutable\mugluespecdef\defaulttinymuskip 2mu minus 1mu
161\immutable\mugluespecdef\defaultpettymuskip 1mu minus 0.5mu
162
163\immutable\mugluespecdef\halfthickmuskip 2.5mu plus 1.5mu minus 0.5mu
164\immutable\mugluespecdef\halfmedmuskip 2mu plus 1mu minus 1mu
165\immutable\mugluespecdef\halfthinmuskip 1.5mu
166\immutable\mugluespecdef\halftinymuskip 1mu minus 0.5mu
167\immutable\mugluespecdef\halfpettymuskip 0.5mu minus 0.25mu
168
169\immutable\mugluespecdef\hairmuskip .15mu
170
171\immutable\integerdef \defaultrelpenalty 500
172\immutable\integerdef \defaultbinoppenalty 700
173\immutable\integerdef \defaultprerelpenalty 100
174\immutable\integerdef \defaultprebinoppenalty 100
175
176\newmuskip\thickermuskip \thickermuskip \defaultthickermuskip
177\newmuskip\fencemuskip \fencemuskip \defaultpettymuskip
178
179
180
181
182\setnewconstant\mathunsetcode \mathclassvalue unset
183
184\setnewconstant\mathordinarycode \mathclassvalue ordinary \aliased\let\mathordcode \mathordinarycode
185\setnewconstant\mathoperatorcode \mathclassvalue operator \aliased\let\mathopcode \mathoperatorcode
186\setnewconstant\mathbinarycode \mathclassvalue binary \aliased\let\mathbincode \mathbinarycode
187\setnewconstant\mathrelationcode \mathclassvalue relation \aliased\let\mathrelcode \mathrelationcode
188\setnewconstant\mathopencode \mathclassvalue open
189\setnewconstant\mathclosecode \mathclassvalue close
190\setnewconstant\mathpunctuationcode \mathclassvalue punctuation \aliased\let\mathpunctcode\mathpunctuationcode
191\setnewconstant\mathinnercode \mathclassvalue inner
192\setnewconstant\mathovercode \mathclassvalue over
193\setnewconstant\mathundercode \mathclassvalue under
194\setnewconstant\mathfractioncode \mathclassvalue fraction
195\setnewconstant\mathradicalcode \mathclassvalue radical
196\setnewconstant\mathmiddlecode \mathclassvalue middle
197\setnewconstant\mathaccentcode \mathclassvalue accent
198\setnewconstant\mathfencedcode \mathclassvalue fenced
199\setnewconstant\mathghostcode \mathclassvalue ghost
200\setnewconstant\mathvariablecode \mathclassvalue variable
201\setnewconstant\mathactivecode \mathclassvalue active
202\setnewconstant\mathvcentercode \mathclassvalue vcenter
203\setnewconstant\mathimaginarycode \mathclassvalue imaginary
204\setnewconstant\mathdifferentialcode \mathclassvalue differential
205\setnewconstant\mathexponentialcode \mathclassvalue exponential
206\setnewconstant\mathintegralcode \mathclassvalue integral
207\setnewconstant\mathellipsiscode \mathclassvalue ellipsis
208\setnewconstant\mathfunctioncode \mathclassvalue function
209\setnewconstant\mathdigitcode \mathclassvalue digit
210\setnewconstant\mathexplicitcode \mathclassvalue explicit
211\setnewconstant\mathdivisioncode \mathclassvalue division
212\setnewconstant\mathfactorialcode \mathclassvalue factorial
213\setnewconstant\mathwrappedcode \mathclassvalue wrapped
214\setnewconstant\mathconstructcode \mathclassvalue construct
215\setnewconstant\mathdimensioncode \mathclassvalue dimension
216\setnewconstant\mathtextpunctuationcode \mathclassvalue textpunctuation
217\setnewconstant\mathunspacedcode \mathclassvalue unspaced
218\setnewconstant\mathexperimentalcode \mathclassvalue experimental
219\setnewconstant\mathunarycode \mathclassvalue unary
220\setnewconstant\mathnumbergroupcode \mathclassvalue numbergroup
221
222\setnewconstant\mathbegincode \mathclassvalue begin
223\setnewconstant\mathendcode \mathclassvalue end
224\setnewconstant\mathallcode \mathclassvalue all
225\setnewconstant\mathfakecode \mathclassvalue fake
226
227\setnewconstant\mathchemicalbondcode \mathclassvalue chemicalbond
228\setnewconstant\mathimplicationcode \mathclassvalue implication
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250\setnewconstant\mathmaybeordinarycode \mathclassvalue maybeordinary
251\setnewconstant\mathmayberelationcode \mathclassvalue mayberelation
252\setnewconstant\mathmaybebinarycode \mathclassvalue maybebinary
253
254
255
256
257
258
259
260
261
262
263
264
265
266\copymathspacing \mathimaginarycode \mathordinarycode
267\copymathspacing \mathdifferentialcode \mathordinarycode
268\copymathspacing \mathfactorialcode \mathordinarycode
269\copymathspacing \mathexponentialcode \mathordinarycode
270\copymathspacing \mathintegralcode \mathoperatorcode
271\copymathspacing \mathdigitcode \mathordinarycode
272\copymathspacing \mathfunctioncode \mathoperatorcode
273\copymathspacing \mathwrappedcode \mathfractioncode
274\copymathspacing \mathunarycode \mathordinarycode
275
276\copymathspacing \mathmaybeordinarycode \mathordinarycode
277\copymathspacing \mathmayberelationcode \mathrelationcode
278\copymathspacing \mathmaybebinarycode \mathbinarycode
279
280
281\copymathspacing \mathnumbergroupcode \mathrelationcode
282
283\copymathspacing \mathchemicalbondcode \mathordinarycode
284\copymathspacing \mathimplicationcode \mathrelationcode
285
286\setnewconstant\mathlimopcode \plusone
287\setnewconstant\mathnolopcode \plusone
288
289\pushoverloadmode
290
291\aliased\let\mathordinary \normalmathord
292\aliased\let\mathoperator \normalmathop
293\aliased\let\mathbinary \normalmathbin
294\aliased\let\mathrelation \normalmathrel
295\aliased\let\mathopen \normalmathopen
296\aliased\let\mathclose \normalmathclose
297\aliased\let\mathpunctuation\normalmathpunct
298\aliased\let\mathinner \normalmathinner
299
300
301
302
303
304
305
306
307
308
309
310\untraced\protected\def\mathfraction {\mathatom \s!class \mathfractioncode }
311\untraced\protected\def\mathradical {\mathatom \s!class \mathradicalcode }
312\untraced\protected\def\mathmiddle {\mathatom \s!class \mathmiddlecode }
313\untraced\protected\def\mathaccent {\mathatom \s!class \mathaccentcode }
314\untraced\protected\def\mathfenced {\mathatom \s!class \mathfencedcode }
315\untraced\protected\def\mathghost {\mathatom \s!class \mathghostcode }
316\untraced\protected\def\mathvariable {\mathatom \s!class \mathvariablecode }
317\untraced\protected\def\mathactive {\mathatom \s!class \mathactivecode }
318\untraced\protected\def\mathvcenter {\mathatom \s!class \mathvcentercode }
319\untraced\protected\def\mathimaginary {\mathatom \s!class \mathimaginarycode }
320\untraced\protected\def\mathdifferential{\mathatom \s!class \mathdifferentialcode}
321\untraced\protected\def\mathexponential {\mathatom \s!class \mathexponentialcode }
322
323
324\untraced\protected\def\mathdigit {\mathatom \s!class \mathdigitcode }
325
326\untraced\protected\def\mathdivision {\mathatom \s!class \mathdivisioncode }
327\untraced\protected\def\mathfactorial {\mathatom \s!class \mathfactorialcode }
328\untraced\protected\def\mathwrapped {\mathatom \s!class \mathwrappedcode }
329\untraced\protected\def\mathconstruct {\mathatom \s!class \mathconstructcode }
330\untraced\protected\def\mathchemicalbond{\mathatom \s!class \mathchemicalbondcode}
331\untraced\protected\def\mathimplication {\mathatom \s!class \mathimplicationcode }
332\untraced\protected\def\mathdimension {\mathatom \s!class \mathdimensioncode }
333
334
335\untraced\protected\def\mathunary {\mathatom \s!class \mathunarycode }
336
337\popoverloadmode
338
339
340
341\setnewconstant\mathboxcode \zerocount
342\setnewconstant\mathchoicecode \zerocount
343\setnewconstant\mathalphacode \zerocount
344\setnewconstant\mathnothingcode \zerocount
345
346
347
348
349\pushoverloadmode
350 \untraced\permanent\protected\def\binoppenalty {\setmathpostpenalty\mathbinarycode}
351 \untraced\permanent\protected\def\prebinoppenalty{\setmathprepenalty \mathbinarycode}
352 \untraced\permanent\protected\def\relpenalty {\setmathpostpenalty\mathrelationcode}
353 \untraced\permanent\protected\def\prerelpenalty {\setmathprepenalty \mathrelationcode}
354\popoverloadmode
355
356
357
358
359
360
361
362
363
364\setmathignore\Umathspacebeforescript\zerocount
365\setmathignore\Umathspaceafterscript \zerocount
366
367
368
369
370
371
372
373
374
375
376
377
378\mathslackmode \plusone
379\mathgroupingmode \plusone
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395\mathdoublescriptmode
396 "\tohexadecimal\mathfakecode
397 \tohexadecimal\mathfakecode
398 \tohexadecimal\mathfakecode
399
400\integerdef\defaultmathclassoptions\numexpr
401 \zerocount
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422\relax
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\preshortinlinepenalty 150
453
454\appendtoks
455 \shortinlinemaththreshold\emwidth
456\to \everybodyfont
457
458
459
460\permanent\protected\untraced\def\setmathoption
461 {\afterassigned
462 {\afterassigned
463 {\scratchcounter\setmathoptions\scratchcounterone
464 \bitwiseflip\scratchcounter\scratchcountertwo
465 \setmathoptions\scratchcounterone\scratchcounter}
466 \scratchcountertwo}
467 \scratchcounterone}
468
469\permanent\protected\untraced\def\resetmathoption
470 {\afterassigned
471 {\afterassigned
472 {\scratchcounter\setmathoptions\scratchcounterone
473 \bitwiseflip\scratchcounter\scratchcountertwo
474 \setmathoptions\scratchcounterone\scratchcounter}
475 \scratchcountertwo}
476 \scratchcounterone}
477
478
479
480
481
482
483\setmathoptions\mathordinarycode\numexpr
484 \zerocount
485 \noitaliccorrectionclassoptioncode
486
487 \checkkernpairclassoptioncode
488
489 \shortinlineclassoptioncode
490\relax
491
492\setmathoptions\mathoperatorcode\numexpr
493 \zerocount
494 \nopreslackclassoptioncode
495 \nopostslackclassoptioncode
496
497 \checkkernpairclassoptioncode
498\relax
499
500\setmathoptions\mathintegralcode\numexpr
501 \zerocount
502 \nopreslackclassoptioncode
503 \nopostslackclassoptioncode
504
505 \checkkernpairclassoptioncode
506\relax
507
508
509
510
511
512
513
514
515
516
517
518
519
520\setmathoptions\mathbinarycode\numexpr
521 \zerocount
522 \nopreslackclassoptioncode
523 \nopostslackclassoptioncode
524 \lookaheadforendclassoptioncode
525 \noitaliccorrectionclassoptioncode
526
527 \checkkernpairclassoptioncode
528
529 \obeynestingclassoptioncode
530\relax
531
532\setmathoptions\mathrelationcode\numexpr
533 \zerocount
534 \nopreslackclassoptioncode
535 \nopostslackclassoptioncode
536 \noitaliccorrectionclassoptioncode
537
538 \checkkernpairclassoptioncode
539
540
541 \obeynestingclassoptioncode
542\relax
543
544\setmathoptions\mathimplicationcode\numexpr
545 \zerocount
546 \nopreslackclassoptioncode
547 \nopostslackclassoptioncode
548 \noitaliccorrectionclassoptioncode
549
550 \checkkernpairclassoptioncode
551
552
553 \obeynestingclassoptioncode
554\relax
555
556\setmathoptions\mathopencode\numexpr
557 \zerocount
558 \nopreslackclassoptioncode
559
560 \noitaliccorrectionclassoptioncode
561
562
563 \checkkernpairclassoptioncode
564 \pushnestingclassoptioncode
565\relax
566
567\setmathoptions\mathclosecode\numexpr
568 \zerocount
569
570 \nopostslackclassoptioncode
571 \noitaliccorrectionclassoptioncode
572
573
574 \checkkernpairclassoptioncode
575 \raiseprimeclassoptioncode
576 \popnestingclassoptioncode
577\relax
578
579\setmathoptions\mathpunctuationcode\numexpr
580 \zerocount
581 \nopreslackclassoptioncode
582 \nopostslackclassoptioncode
583 \noitaliccorrectionclassoptioncode
584
585
586 \checkkernpairclassoptioncode
587 \removeitaliccorrectionclassoptioncode
588 \obeynestingclassoptioncode
589\relax
590
591\setmathoptions\mathvariablecode\numexpr
592 \zerocount
593 \noitaliccorrectionclassoptioncode
594\relax
595
596\setmathoptions\mathactivecode\numexpr
597 \zerocount
598 \noitaliccorrectionclassoptioncode
599\relax
600
601
602
603
604
605
606\setmathoptions\mathmiddlecode\numexpr
607 \zerocount
608 \noitaliccorrectionclassoptioncode
609
610 \raiseprimeclassoptioncode
611 \carryoverlefttopkernclassoptioncode
612 \carryoverleftbottomkernclassoptioncode
613 \carryoverrighttopkernclassoptioncode
614 \carryoverrightbottomkernclassoptioncode
615 \preferdelimiterdimensionsclassoptioncode
616\relax
617
618\setmathoptions\mathfractioncode\numexpr
619 \zerocount
620 \nopreslackclassoptioncode
621 \nopostslackclassoptioncode
622 \raiseprimeclassoptioncode
623 \carryoverlefttopkernclassoptioncode
624 \carryoverleftbottomkernclassoptioncode
625 \carryoverrighttopkernclassoptioncode
626 \carryoverrightbottomkernclassoptioncode
627 \preferdelimiterdimensionsclassoptioncode
628 \shortinlineclassoptioncode
629\relax
630
631\setmathoptions\mathradicalcode\numexpr
632 \zerocount
633 \nopreslackclassoptioncode
634 \nopostslackclassoptioncode
635 \raiseprimeclassoptioncode
636 \carryoverlefttopkernclassoptioncode
637 \carryoverleftbottomkernclassoptioncode
638 \carryoverrighttopkernclassoptioncode
639 \carryoverrightbottomkernclassoptioncode
640 \preferdelimiterdimensionsclassoptioncode
641 \shortinlineclassoptioncode
642\relax
643
644\setmathoptions\mathaccentcode\numexpr
645 \zerocount
646 \nopreslackclassoptioncode
647 \nopostslackclassoptioncode
648 \autoinjectclassoptioncode
649 \shortinlineclassoptioncode
650 \lefttopkernclassoptioncode
651 \leftbottomkernclassoptioncode
652 \righttopkernclassoptioncode
653 \rightbottomkernclassoptioncode
654\relax
655
656
657
658\setmathoptions\mathdivisioncode\numexpr
659 \zerocount
660 \nopreslackclassoptioncode
661 \nopostslackclassoptioncode
662 \lefttopkernclassoptioncode
663
664
665 \rightbottomkernclassoptioncode
666\relax
667
668\setmathoptions\mathbegincode\numexpr
669 \zerocount
670 \nopostslackclassoptioncode
671\relax
672
673\setmathoptions\mathendcode\numexpr
674 \zerocount
675 \nopreslackclassoptioncode
676\relax
677
678
679
680
681
682\setmathoptions\mathfencedcode\numexpr
683 \zerocount
684 \unpackclassoptioncode
685 \carryoverlefttopkernclassoptioncode
686 \carryoverleftbottomkernclassoptioncode
687 \carryoverrighttopkernclassoptioncode
688 \carryoverrightbottomkernclassoptioncode
689 \preferdelimiterdimensionsclassoptioncode
690\relax
691
692
693
694\setmathoptions\mathexponentialcode\numexpr
695 \zerocount
696 \shortinlineclassoptioncode
697\relax
698
699\setmathoptions\mathimaginarycode\numexpr
700 \zerocount
701 \shortinlineclassoptioncode
702\relax
703
704\setmathoptions\mathdifferentialcode\numexpr
705 \zerocount
706 \shortinlineclassoptioncode
707\relax
708
709\setmathoptions\mathdigitcode\numexpr
710 \zerocount
711 \shortinlineclassoptioncode
712\relax
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731\permanent\protected\def\math_discretionary_plus {\discretionary class \mathbinarycode {$$}{$$}{$$}}
732\permanent\protected\def\math_discretionary_minus{\discretionary class \mathbinarycode {$$}{$$}{$$}}
733
734\newtoks\everymathdiscretionaries
735
736\appendtoks
737 \enforced\let\+\math_discretionary_plus
738 \enforced\let\-\math_discretionary_minus
739\to \everymathdiscretionaries
740
741\appendtoks
742 \ifconditional\c_math_discretionaries
743 \expand\everymathdiscretionaries
744 \fi
745\to \everymathematics
746
747\newconditional\c_math_discretionaries
748
749\installtexexperiment
750 {mathematics.discretionaries}
751 {\c_math_discretionaries\conditionaltrue}
752 {\c_math_discretionaries\conditionalfalse}
753
754
755
756\permanent\protected\def\dimension#1
757 {\mathematics
758 {\mathatom
759 \s!leftclass \mathdimensioncode
760 \s!rightclass \mathordinarycode
761 {\tf #1}}}
762
763\permanent\protected\def\nodimension#1
764 {#1}
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780\appendtoks
781 \advanceby\mathnestinglevel\plusone
782\to \everymathematics
783
784
785
786\definesystemattribute[mathalphabet] [public]
787\definesystemattribute[mathsize] [public]
788\definesystemattribute[mathpunctuation][public]
789\definesystemattribute[mathgreek] [public]
790\definesystemattribute[mathalternate] [public]
791\definesystemattribute[mathrendering] [public]
792\definesystemattribute[mathcategory] [public]
793\definesystemattribute[mathmode] [public]
794
795\definesystemattribute[mathkernpairs] [public]
796\definesystemattribute[mathbidi] [public]
797
798\definesystemattribute[mathcollapsing] [public]
799\definesystemattribute[mathunstack] [public]
800\definesystemattribute[mathvariant] [public]
801\definesystemattribute[mathnumbers] [public]
802\definesystemattribute[mathspacing] [public]
803\definesystemattribute[mathfencing] [public]
804
805\definesystemattribute[displaymath] [public]
806
807
808
809
810
811
812
813
814
815\ifdefined\ordlimits\else
816 \let\ordlimits\Umathlimits
817\fi
818
819\appendtoks
820 \c_attr_mathmode\plusone
821\to \everydisplay
822
823\appendtoks
824 \c_attr_mathmode \plusone
825 \c_attr_displaymath\plusone
826\to \everybeforedisplayformula
827
828
829
830
831
832\newconditional\indisplaymath
833
834\appendtoks
835 \indisplaymath\conditionalfalse
836\to \everymath
837
838\appendtoks
839 \indisplaymath\conditionaltrue
840\to \everydisplay
841
842\permanent\def\inlineordisplaymath{\ifconditional\indisplaymath\expandafter\secondoftwoarguments\else\expandafter\firstoftwoarguments\fi}
843
844\permanent\protected\def\forcedisplaymath
845 {\ifmmode
846 \displaystyle
847 \indisplaymath\conditionaltrue
848 \fi}
849
850\permanent\protected\def\forceinlinemath
851 {\ifmmode
852 \textstyle
853 \indisplaymath\conditionalfalse
854 \fi}
855
856\permanent\protected\def\startforceddisplaymath
857 {\Ustartmathmode \displaystyle
858 \begingroup
859 \indisplaymath\conditionaltrue}
860
861\permanent\protected\def\stopforceddisplaymath
862 {\endgroup
863 \Ustopmathmode}
864
865\permanent\protected\def\startpickupmath
866 {\ifconditional\indisplaymath
867 \startforceddisplaymath
868 \enforced\let\stoppickupmath\stopforceddisplaymath
869 \else
870 \startimath
871 \enforced\let\stoppickupmath\stopimath
872 \fi}
873
874\aliased\let\stoppickupmath\relax
875
876\permanent\protected\def\rawmathematics#1
877 {\begingroup
878 \ifmmode
879 \resetmathattributes#1
880 \else
881 \startimath\resetmathattributes#1\stopimath
882 \fi
883 \endgroup}
884
885
886
887
888
889
890
891
892
893
894
895
896
897\installcorenamespace{mathematics}
898
899\installswitchcommandhandler \??mathematics {mathematics} \??mathematics
900
901\installmacrostack\currentmathematics
902
903\permanent\protected\tolerant\def\startmathematics[#1]
904 {\push_macro_currentmathematics
905 \cdef\currentmathematics{#1}
906 \expand\everyswitchmathematics}
907
908\permanent\protected\def\stopmathematics
909 {\pop_macro_currentmathematics
910 \expand\everyswitchmathematics}
911
912\definemathematics[\v!default]
913
914
915
916\pushoverloadmode
917 \permanent\protected\def\mathematics{\doifelsenextoptionalcs\math_m_yes\math_m_nop}
918
919 \aliased\let\m \mathematics
920 \aliased\let\math\mathematics
921\popoverloadmode
922
923\def\math_m_yes
924 {\relax
925 \ifmmode
926 \expandafter\math_m_yes_math
927 \else
928 \expandafter\math_m_yes_text
929 \fi}
930
931\def\math_m_yes_math[#1]#2
932 {#2}
933
934\def\math_m_yes_text[#S#1]
935 {\begingroup
936 \ifhastok={#1}
937 \setupcurrentmathematics[#1]
938 \else
939 \cdef\currentmathematics{#1}
940 \fi
941 \usemathematicscolorparameter\c!color
942 \ifcstok{\mathematicsparameter\c!openup}\v!yes
943 \expandafter\math_m_yes_text_openedup
944 \else
945 \expandafter\math_m_yes_text_normal
946 \fi}
947
948\def\math_m_yes_text_openedup#1
949 {\setbox\scratchbox\hbox\bgroup
950 \expand\everyswitchmathematics\relax
951 \normalstartimath
952 \usemathstyleparameter\mathematicsparameter\c!mathstyle
953 \expand\everyinsidemathematics\relax
954 #1
955 \normalstopimath
956 \egroup
957 \ifdim\ht\scratchbox>\strutht
958 \math_inline_openup_start_yes
959 \orelse\ifdim\dp\scratchbox>\strutdp
960 \math_inline_openup_start_yes
961 \else
962 \math_inline_openup_start_nop
963 \fi
964 \unhbox\scratchbox
965 \math_inline_openup_stop
966 \endgroup}
967
968\def\math_m_yes_text_normal#1
969 {\expand\everyswitchmathematics\relax
970 \normalstartimath
971 \usemathstyleparameter\mathematicsparameter\c!mathstyle
972 \expand\everyinsidemathematics\relax
973 \begingroup#1\endgroup
974 \normalstopimath
975 \endgroup}
976
977\def\math_m_nop#1
978 {\relax
979 \ifmmode
980 #1
981 \else
982 \normalstartimath
983 \usemathstyleparameter\mathematicsparameter\c!mathstyle
984 \expand\everyinsidemathematics\relax
985 \begingroup#1\endgroup
986 \normalstopimath
987 \fi}
988
989
990
991
992
993
994
995
996
997
998\permanent\protected\def\dm#1
999 {\relax
1000 \ifmmode
1001
1002 \mathconstruct{\forcedisplaymath#1}
1003 \else
1004 \startimath\begingroup\forcedisplaymath#1\endgroup\stopimath
1005 \fi}
1006
1007\permanent\protected\def\im#1
1008 {\relax
1009 \ifmmode
1010
1011 \mathconstruct{\forceinlinemath#1}
1012 \else
1013 \startimath#1\stopimath
1014 \fi}
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025\startsetups math:spacing:default
1026 \thickmuskip \defaultthickmuskip
1027 \medmuskip \defaultmedmuskip
1028 \thinmuskip \defaultthinmuskip
1029 \tinymuskip \defaulttinymuskip
1030 \pettymuskip \defaultpettymuskip
1031 \relpenalty \defaultrelpenalty
1032 \binoppenalty \defaultbinoppenalty
1033 \prebinoppenalty\maxdimen
1034 \prerelpenalty \maxdimen
1035\stopsetups
1036
1037\startsetups math:spacing:split
1038 \thickmuskip \defaultthickmuskip
1039 \medmuskip \defaultmedmuskip
1040 \thinmuskip \defaultthinmuskip
1041 \tinymuskip \defaulttinymuskip
1042 \pettymuskip \defaultpettymuskip
1043 \relpenalty \defaultrelpenalty
1044 \binoppenalty \defaultbinoppenalty
1045 \prebinoppenalty\defaultprebinoppenalty
1046 \prerelpenalty \defaultprerelpenalty
1047\stopsetups
1048
1049\startsetups math:spacing:half
1050 \thickmuskip \halfthickmuskip
1051 \medmuskip \halfmedmuskip
1052 \thinmuskip \halfthinmuskip
1053 \tinymuskip \halftinymuskip
1054 \pettymuskip \halfpettymuskip
1055 \relpenalty \defaultrelpenalty
1056 \binoppenalty \defaultbinoppenalty
1057 \prebinoppenalty\maxdimen
1058 \prerelpenalty \maxdimen
1059\stopsetups
1060
1061\startsetups math:spacing:tight
1062 \ifcase\raggedstatus
1063 \thickmuskip \halfthickmuskip
1064 \medmuskip \halfmedmuskip
1065 \thinmuskip \halfthinmuskip
1066 \tinymuskip \halftinymuskip
1067 \pettymuskip \halfpettymuskip
1068 \else
1069 \thickmuskip 1\halfthickmuskip
1070 \medmuskip 1\halfmedmuskip
1071 \thinmuskip 1\halfthinmuskip
1072 \tinymuskip 1\halftinymuskip
1073 \pettymuskip 1\halfpettymuskip
1074 \fi
1075 \relpenalty \defaultrelpenalty
1076 \binoppenalty \maxdimen
1077 \prebinoppenalty\maxdimen
1078 \prerelpenalty \maxdimen
1079\stopsetups
1080
1081\startsetups math:spacing:fixed
1082 \ifcase\raggedstatus
1083 \thickmuskip \halfthickmuskip
1084 \medmuskip \halfmedmuskip
1085 \thinmuskip \halfthinmuskip
1086 \tinymuskip \halftinymuskip
1087 \pettymuskip \halfpettymuskip
1088 \else
1089 \thickmuskip 1\halfthickmuskip
1090 \medmuskip 1\halfmedmuskip
1091 \thinmuskip 1\halfthinmuskip
1092 \tinymuskip 1\halftinymuskip
1093 \pettymuskip 1\halfpettymuskip
1094 \fi
1095 \relpenalty \maxdimen
1096 \binoppenalty \maxdimen
1097 \prebinoppenalty\maxdimen
1098 \prerelpenalty \maxdimen
1099\stopsetups
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115\newmuskip\mathinterwordmuskip
1116
1117
1118
1119
1120
1121
1122
1123
1124\mathinterwordmuskip 18mu
1125
1126\permanent\protected\def\mtp#1{\mathatom class \mathtextpunctuationcode {\hbox{#1}}}
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144\startsetups math:spacing:presets
1145 \resetmathspacing
1146
1147
1148 \inherited\setmathspacing \mathordinarycode \mathoperatorcode \allmathstyles \thinmuskip
1149 \inherited\setmathspacing \mathordinarycode \mathbinarycode \allsplitstyles \medmuskip
1150 \inherited\setmathspacing \mathordinarycode \mathbinarycode \allunsplitstyles \pettymuskip
1151 \inherited\setmathspacing \mathordinarycode \mathrelationcode \allsplitstyles \thickmuskip
1152 \inherited\setmathspacing \mathordinarycode \mathrelationcode \allunsplitstyles \pettymuskip
1153
1154 \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allsplitstyles \thickmuskip
1155 \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allunsplitstyles \pettymuskip
1156 \inherited\setmathspacing \mathordinarycode \mathclosecode \allmathstyles \fencemuskip
1157
1158 \inherited\setmathspacing \mathordinarycode \mathconstructcode \allsplitstyles \thinmuskip
1159 \inherited\setmathspacing \mathordinarycode \mathconstructcode \allunsplitstyles \pettymuskip
1160 \inherited\setmathspacing \mathordinarycode \mathellipsiscode \allsplitstyles \thinmuskip
1161 \inherited\setmathspacing \mathordinarycode \mathellipsiscode \allunsplitstyles \pettymuskip
1162 \inherited\setmathspacing \mathordinarycode \mathfractioncode \allsplitstyles \thinmuskip
1163 \inherited\setmathspacing \mathordinarycode \mathfractioncode \allunsplitstyles \pettymuskip
1164
1165
1166
1167 \inherited\setmathspacing \mathoperatorcode \mathordinarycode \allmathstyles \thinmuskip
1168 \inherited\setmathspacing \mathoperatorcode \mathoperatorcode \allmathstyles \thinmuskip
1169
1170 \inherited\setmathspacing \mathoperatorcode \mathrelationcode \allsplitstyles \thickmuskip
1171 \inherited\setmathspacing \mathoperatorcode \mathrelationcode \allunsplitstyles \pettymuskip
1172
1173 \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allsplitstyles \thickmuskip
1174 \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allunsplitstyles \pettymuskip
1175 \inherited\setmathspacing \mathoperatorcode \mathclosecode \allmathstyles \fencemuskip
1176
1177 \inherited\setmathspacing \mathoperatorcode \mathconstructcode \allsplitstyles \thinmuskip
1178 \inherited\setmathspacing \mathoperatorcode \mathconstructcode \allunsplitstyles \pettymuskip
1179 \inherited\setmathspacing \mathoperatorcode \mathellipsiscode \allsplitstyles \thinmuskip
1180 \inherited\setmathspacing \mathoperatorcode \mathellipsiscode \allunsplitstyles \pettymuskip
1181 \inherited\setmathspacing \mathoperatorcode \mathfractioncode \allmathstyles \thinmuskip
1182 \inherited\setmathspacing \mathoperatorcode \mathradicalcode \allmathstyles \thinmuskip
1183
1184 \inherited\setmathspacing \mathbinarycode \mathordinarycode \allsplitstyles \medmuskip
1185 \inherited\setmathspacing \mathbinarycode \mathordinarycode \allunsplitstyles \pettymuskip
1186 \inherited\setmathspacing \mathbinarycode \mathoperatorcode \allsplitstyles \medmuskip
1187 \inherited\setmathspacing \mathbinarycode \mathoperatorcode \allunsplitstyles \pettymuskip
1188
1189
1190 \inherited\setmathspacing \mathbinarycode \mathopencode \allsplitstyles \medmuskip
1191 \inherited\setmathspacing \mathbinarycode \mathopencode \allunsplitstyles \pettymuskip
1192 \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allsplitstyles \thickmuskip
1193 \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allunsplitstyles \pettymuskip
1194 \inherited\setmathspacing \mathbinarycode \mathclosecode \allmathstyles \fencemuskip
1195 \inherited\setmathspacing \mathbinarycode \mathpunctuationcode \allsplitstyles \medmuskip
1196 \inherited\setmathspacing \mathbinarycode \mathpunctuationcode \allunsplitstyles \pettymuskip
1197 \inherited\setmathspacing \mathbinarycode \mathconstructcode \allsplitstyles \medmuskip
1198 \inherited\setmathspacing \mathbinarycode \mathconstructcode \allunsplitstyles \pettymuskip
1199 \inherited\setmathspacing \mathbinarycode \mathellipsiscode \allsplitstyles \medmuskip
1200 \inherited\setmathspacing \mathbinarycode \mathellipsiscode \allunsplitstyles \pettymuskip
1201 \inherited\setmathspacing \mathbinarycode \mathfractioncode \allsplitstyles \medmuskip
1202 \inherited\setmathspacing \mathbinarycode \mathfractioncode \allunsplitstyles \pettymuskip
1203 \inherited\setmathspacing \mathbinarycode \mathradicalcode \allsplitstyles \medmuskip
1204 \inherited\setmathspacing \mathbinarycode \mathradicalcode \allunsplitstyles \pettymuskip
1205
1206 \inherited\setmathspacing \mathrelationcode \mathordinarycode \allsplitstyles \thickmuskip
1207 \inherited\setmathspacing \mathrelationcode \mathordinarycode \allunsplitstyles \pettymuskip
1208 \inherited\setmathspacing \mathrelationcode \mathoperatorcode \allsplitstyles \thickmuskip
1209 \inherited\setmathspacing \mathrelationcode \mathoperatorcode \allunsplitstyles \pettymuskip
1210
1211
1212 \inherited\setmathspacing \mathrelationcode \mathopencode \allsplitstyles \thickmuskip
1213 \inherited\setmathspacing \mathrelationcode \mathopencode \allunsplitstyles \pettymuskip
1214 \inherited\setmathspacing \mathrelationcode \mathmiddlecode \allsplitstyles \thickmuskip
1215 \inherited\setmathspacing \mathrelationcode \mathmiddlecode \allunsplitstyles \thinmuskip
1216 \inherited\setmathspacing \mathrelationcode \mathclosecode \allmathstyles \fencemuskip
1217 \inherited\setmathspacing \mathrelationcode \mathpunctuationcode \allsplitstyles \thickmuskip
1218 \inherited\setmathspacing \mathrelationcode \mathpunctuationcode \allunsplitstyles \pettymuskip
1219 \inherited\setmathspacing \mathrelationcode \mathconstructcode \allsplitstyles \thickmuskip
1220 \inherited\setmathspacing \mathrelationcode \mathconstructcode \allunsplitstyles \pettymuskip
1221 \inherited\setmathspacing \mathrelationcode \mathellipsiscode \allsplitstyles \thickmuskip
1222 \inherited\setmathspacing \mathrelationcode \mathellipsiscode \allunsplitstyles \pettymuskip
1223 \inherited\setmathspacing \mathrelationcode \mathfractioncode \allsplitstyles \thickmuskip
1224 \inherited\setmathspacing \mathrelationcode \mathfractioncode \allunsplitstyles \pettymuskip
1225 \inherited\setmathspacing \mathrelationcode \mathradicalcode \allsplitstyles \thickmuskip
1226 \inherited\setmathspacing \mathrelationcode \mathradicalcode \allunsplitstyles \pettymuskip
1227
1228 \inherited\setmathspacing \mathopencode \mathordinarycode \allmathstyles \fencemuskip
1229 \inherited\setmathspacing \mathopencode \mathoperatorcode \allmathstyles \fencemuskip
1230 \inherited\setmathspacing \mathopencode \mathbinarycode \allmathstyles \fencemuskip
1231 \inherited\setmathspacing \mathopencode \mathrelationcode \allmathstyles \fencemuskip
1232 \inherited\setmathspacing \mathopencode \mathopencode \allmathstyles \fencemuskip
1233 \inherited\setmathspacing \mathopencode \mathmiddlecode \allmathstyles \pettymuskip
1234 \inherited\setmathspacing \mathopencode \mathclosecode \allmathstyles \pettymuskip
1235 \inherited\setmathspacing \mathopencode \mathpunctuationcode \allmathstyles \pettymuskip
1236 \inherited\setmathspacing \mathopencode \mathconstructcode \allmathstyles \pettymuskip
1237 \inherited\setmathspacing \mathopencode \mathellipsiscode \allmathstyles \pettymuskip
1238 \inherited\setmathspacing \mathopencode \mathradicalcode \allmathstyles \fencemuskip
1239 \inherited\setmathspacing \mathopencode \mathfractioncode \allsplitstyles \pettymuskip
1240 \inherited\setmathspacing \mathopencode \mathfractioncode \allunsplitstyles \pettymuskip
1241
1242 \inherited\setmathspacing \mathclosecode \mathordinarycode \allmathstyles \tinymuskip
1243 \inherited\setmathspacing \mathclosecode \mathoperatorcode \allmathstyles \thinmuskip
1244 \inherited\setmathspacing \mathclosecode \mathbinarycode \allsplitstyles \medmuskip
1245 \inherited\setmathspacing \mathclosecode \mathbinarycode \allunsplitstyles \pettymuskip
1246 \inherited\setmathspacing \mathclosecode \mathrelationcode \allsplitstyles \thickmuskip
1247 \inherited\setmathspacing \mathclosecode \mathrelationcode \allunsplitstyles \pettymuskip
1248 \inherited\setmathspacing \mathclosecode \mathopencode \alltextstyles \tinymuskip
1249 \inherited\setmathspacing \mathclosecode \mathopencode \alldisplaystyles \thinmuskip
1250 \inherited\setmathspacing \mathclosecode \mathopencode \allunsplitstyles \pettymuskip
1251
1252
1253
1254
1255
1256
1257
1258 \inherited\setmathspacing \mathclosecode \mathclosecode \allmathstyles \fencemuskip
1259
1260 \inherited\setmathspacing \mathclosecode \mathconstructcode \allsplitstyles \thinmuskip
1261 \inherited\setmathspacing \mathclosecode \mathconstructcode \allunsplitstyles \pettymuskip
1262 \inherited\setmathspacing \mathclosecode \mathfactorialcode \allmathstyles \zeromuskip
1263 \inherited\setmathspacing \mathclosecode \mathellipsiscode \allsplitstyles \thinmuskip
1264 \inherited\setmathspacing \mathclosecode \mathellipsiscode \allunsplitstyles \pettymuskip
1265 \inherited\setmathspacing \mathclosecode \mathfractioncode \allsplitstyles \thinmuskip
1266 \inherited\setmathspacing \mathclosecode \mathfractioncode \allunsplitstyles \pettymuskip
1267
1268
1269 \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allsplitstyles \medmuskip
1270 \inherited\setmathspacing \mathpunctuationcode \mathordinarycode \allunsplitstyles \tinymuskip
1271 \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allsplitstyles \medmuskip
1272 \inherited\setmathspacing \mathpunctuationcode \mathoperatorcode \allunsplitstyles \tinymuskip
1273
1274 \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allsplitstyles \medmuskip
1275 \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allunsplitstyles \tinymuskip
1276 \inherited\setmathspacing \mathpunctuationcode \mathopencode \allsplitstyles \medmuskip
1277 \inherited\setmathspacing \mathpunctuationcode \mathopencode \allunsplitstyles \tinymuskip
1278 \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allsplitstyles \thickmuskip
1279 \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allunsplitstyles \tinymuskip
1280 \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allsplitstyles \medmuskip
1281 \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allunsplitstyles \tinymuskip
1282 \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allsplitstyles \medmuskip
1283 \inherited\setmathspacing \mathpunctuationcode \mathpunctuationcode \allunsplitstyles \tinymuskip
1284 \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allsplitstyles \medmuskip
1285 \inherited\setmathspacing \mathpunctuationcode \mathconstructcode \allunsplitstyles \tinymuskip
1286 \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allsplitstyles \medmuskip
1287 \inherited\setmathspacing \mathpunctuationcode \mathellipsiscode \allunsplitstyles \tinymuskip
1288 \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allsplitstyles \medmuskip
1289 \inherited\setmathspacing \mathpunctuationcode \mathfractioncode \allunsplitstyles \tinymuskip
1290 \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allsplitstyles \medmuskip
1291 \inherited\setmathspacing \mathpunctuationcode \mathradicalcode \allunsplitstyles \tinymuskip
1292
1293 \inherited\setmathspacing \mathconstructcode \mathordinarycode \allsplitstyles \thinmuskip
1294 \inherited\setmathspacing \mathconstructcode \mathordinarycode \allunsplitstyles \pettymuskip
1295 \inherited\setmathspacing \mathconstructcode \mathoperatorcode \allmathstyles \thinmuskip
1296 \inherited\setmathspacing \mathconstructcode \mathbinarycode \allsplitstyles \medmuskip
1297 \inherited\setmathspacing \mathconstructcode \mathbinarycode \allunsplitstyles \pettymuskip
1298 \inherited\setmathspacing \mathconstructcode \mathrelationcode \allsplitstyles \thickmuskip
1299 \inherited\setmathspacing \mathconstructcode \mathrelationcode \allunsplitstyles \pettymuskip
1300 \inherited\setmathspacing \mathconstructcode \mathopencode \allsplitstyles \thinmuskip
1301 \inherited\setmathspacing \mathconstructcode \mathopencode \allunsplitstyles \pettymuskip
1302 \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allsplitstyles \thickmuskip
1303 \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allunsplitstyles \pettymuskip
1304 \inherited\setmathspacing \mathconstructcode \mathclosecode \allmathstyles \pettymuskip
1305 \inherited\setmathspacing \mathconstructcode \mathpunctuationcode \allsplitstyles \thinmuskip
1306 \inherited\setmathspacing \mathconstructcode \mathpunctuationcode \allunsplitstyles \pettymuskip
1307 \inherited\setmathspacing \mathconstructcode \mathconstructcode \allsplitstyles \thinmuskip
1308 \inherited\setmathspacing \mathconstructcode \mathconstructcode \allunsplitstyles \pettymuskip
1309 \inherited\setmathspacing \mathconstructcode \mathfractioncode \allsplitstyles \thinmuskip
1310 \inherited\setmathspacing \mathconstructcode \mathfractioncode \allunsplitstyles \pettymuskip
1311 \inherited\setmathspacing \mathconstructcode \mathradicalcode \allsplitstyles \thinmuskip
1312 \inherited\setmathspacing \mathconstructcode \mathradicalcode \allunsplitstyles \pettymuskip
1313
1314 \inherited\setmathspacing \mathellipsiscode \mathordinarycode \allsplitstyles \thinmuskip
1315 \inherited\setmathspacing \mathellipsiscode \mathordinarycode \allunsplitstyles \pettymuskip
1316 \inherited\setmathspacing \mathellipsiscode \mathoperatorcode \allmathstyles \thinmuskip
1317 \inherited\setmathspacing \mathellipsiscode \mathbinarycode \allsplitstyles \medmuskip
1318 \inherited\setmathspacing \mathellipsiscode \mathbinarycode \allunsplitstyles \pettymuskip
1319 \inherited\setmathspacing \mathellipsiscode \mathrelationcode \allsplitstyles \thickmuskip
1320 \inherited\setmathspacing \mathellipsiscode \mathrelationcode \allunsplitstyles \pettymuskip
1321 \inherited\setmathspacing \mathellipsiscode \mathopencode \allsplitstyles \thinmuskip
1322 \inherited\setmathspacing \mathellipsiscode \mathopencode \allunsplitstyles \pettymuskip
1323 \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allsplitstyles \thickmuskip
1324 \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allunsplitstyles \pettymuskip
1325 \inherited\setmathspacing \mathellipsiscode \mathclosecode \allmathstyles \pettymuskip
1326 \inherited\setmathspacing \mathellipsiscode \mathpunctuationcode \allsplitstyles \thinmuskip
1327 \inherited\setmathspacing \mathellipsiscode \mathpunctuationcode \allunsplitstyles \pettymuskip
1328 \inherited\setmathspacing \mathellipsiscode \mathconstructcode \allsplitstyles \thinmuskip
1329 \inherited\setmathspacing \mathellipsiscode \mathconstructcode \allunsplitstyles \pettymuskip
1330 \inherited\setmathspacing \mathellipsiscode \mathellipsiscode \allsplitstyles \thinmuskip
1331 \inherited\setmathspacing \mathellipsiscode \mathellipsiscode \allunsplitstyles \pettymuskip
1332 \inherited\setmathspacing \mathellipsiscode \mathfractioncode \allsplitstyles \thinmuskip
1333 \inherited\setmathspacing \mathellipsiscode \mathfractioncode \allunsplitstyles \pettymuskip
1334 \inherited\setmathspacing \mathellipsiscode \mathradicalcode \allsplitstyles \thinmuskip
1335 \inherited\setmathspacing \mathellipsiscode \mathradicalcode \allunsplitstyles \pettymuskip
1336
1337 \inherited\setmathspacing \mathfractioncode \mathordinarycode \allsplitstyles \thinmuskip
1338 \inherited\setmathspacing \mathfractioncode \mathordinarycode \allunsplitstyles \pettymuskip
1339 \inherited\setmathspacing \mathfractioncode \mathoperatorcode \allsplitstyles \medmuskip
1340 \inherited\setmathspacing \mathfractioncode \mathoperatorcode \allunsplitstyles \pettymuskip
1341 \inherited\setmathspacing \mathfractioncode \mathbinarycode \allsplitstyles \medmuskip
1342 \inherited\setmathspacing \mathfractioncode \mathbinarycode \allunsplitstyles \pettymuskip
1343 \inherited\setmathspacing \mathfractioncode \mathrelationcode \allsplitstyles \thickmuskip
1344 \inherited\setmathspacing \mathfractioncode \mathrelationcode \allunsplitstyles \pettymuskip
1345 \inherited\setmathspacing \mathfractioncode \mathopencode \allsplitstyles \thinmuskip
1346 \inherited\setmathspacing \mathfractioncode \mathopencode \allunsplitstyles \pettymuskip
1347 \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allsplitstyles \thickmuskip
1348 \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allunsplitstyles \pettymuskip
1349 \inherited\setmathspacing \mathfractioncode \mathclosecode \allmathstyles \pettymuskip
1350
1351 \inherited\setmathspacing \mathfractioncode \mathpunctuationcode \allsplitstyles \tinymuskip
1352 \inherited\setmathspacing \mathfractioncode \mathpunctuationcode \allunsplitstyles \pettymuskip
1353 \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \tinymuskip
1354 \inherited\setmathspacing \mathfractioncode \mathconstructcode \allsplitstyles \thinmuskip
1355 \inherited\setmathspacing \mathfractioncode \mathconstructcode \allunsplitstyles \pettymuskip
1356 \inherited\setmathspacing \mathfractioncode \mathellipsiscode \allsplitstyles \thinmuskip
1357 \inherited\setmathspacing \mathfractioncode \mathellipsiscode \allunsplitstyles \pettymuskip
1358 \inherited\setmathspacing \mathfractioncode \mathfractioncode \allsplitstyles \thinmuskip
1359 \inherited\setmathspacing \mathfractioncode \mathfractioncode \allunsplitstyles \pettymuskip
1360 \inherited\setmathspacing \mathfractioncode \mathradicalcode \allsplitstyles \thinmuskip
1361 \inherited\setmathspacing \mathfractioncode \mathradicalcode \allunsplitstyles \pettymuskip
1362 \inherited\setmathspacing \mathfractioncode \mathdifferentialcode \allsplitstyles \medmuskip
1363 \inherited\setmathspacing \mathfractioncode \mathdifferentialcode \allunsplitstyles \pettymuskip
1364
1365 \inherited\setmathspacing \mathradicalcode \mathordinarycode \allsplitstyles \tinymuskip
1366 \inherited\setmathspacing \mathradicalcode \mathordinarycode \allunsplitstyles \pettymuskip
1367 \inherited\setmathspacing \mathradicalcode \mathoperatorcode \allmathstyles \thinmuskip
1368 \inherited\setmathspacing \mathradicalcode \mathbinarycode \allsplitstyles \medmuskip
1369 \inherited\setmathspacing \mathradicalcode \mathbinarycode \allunsplitstyles \pettymuskip
1370 \inherited\setmathspacing \mathradicalcode \mathrelationcode \allsplitstyles \thickmuskip
1371 \inherited\setmathspacing \mathradicalcode \mathrelationcode \allunsplitstyles \pettymuskip
1372
1373 \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allsplitstyles \thickmuskip
1374 \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allunsplitstyles \pettymuskip
1375 \inherited\setmathspacing \mathradicalcode \mathclosecode \allmathstyles \pettymuskip
1376 \inherited\setmathspacing \mathradicalcode \mathpunctuationcode \allsplitstyles \pettymuskip
1377 \inherited\setmathspacing \mathradicalcode \mathpunctuationcode \allunsplitstyles \tinymuskip
1378 \inherited\setmathspacing \mathradicalcode \mathconstructcode \allsplitstyles \thinmuskip
1379 \inherited\setmathspacing \mathradicalcode \mathconstructcode \allunsplitstyles \pettymuskip
1380 \inherited\setmathspacing \mathradicalcode \mathellipsiscode \allsplitstyles \thinmuskip
1381 \inherited\setmathspacing \mathradicalcode \mathellipsiscode \allunsplitstyles \pettymuskip
1382 \inherited\setmathspacing \mathradicalcode \mathfractioncode \allsplitstyles \tinymuskip
1383 \inherited\setmathspacing \mathradicalcode \mathfractioncode \allunsplitstyles \pettymuskip
1384 \inherited\setmathspacing \mathradicalcode \mathradicalcode \allsplitstyles \thinmuskip
1385 \inherited\setmathspacing \mathradicalcode \mathradicalcode \allunsplitstyles \pettymuskip
1386
1387 \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allsplitstyles \thickmuskip
1388 \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allunsplitstyles \pettymuskip
1389 \inherited\setmathspacing \mathmiddlecode \mathoperatorcode \allmathstyles \thickmuskip
1390 \inherited\setmathspacing \mathmiddlecode \mathbinarycode \allsplitstyles \medmuskip
1391 \inherited\setmathspacing \mathmiddlecode \mathbinarycode \allunsplitstyles \pettymuskip
1392 \inherited\setmathspacing \mathmiddlecode \mathrelationcode \allsplitstyles \thickmuskip
1393 \inherited\setmathspacing \mathmiddlecode \mathrelationcode \allunsplitstyles \pettymuskip
1394 \inherited\setmathspacing \mathmiddlecode \mathopencode \allsplitstyles \thickmuskip
1395 \inherited\setmathspacing \mathmiddlecode \mathopencode \allscriptstyles \pettymuskip
1396 \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allsplitstyles \thickmuskip
1397 \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allunsplitstyles \pettymuskip
1398 \inherited\setmathspacing \mathmiddlecode \mathclosecode \allsplitstyles \thickmuskip
1399 \inherited\setmathspacing \mathmiddlecode \mathclosecode \allunsplitstyles \pettymuskip
1400 \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allsplitstyles \thickmuskip
1401 \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allunsplitstyles \pettymuskip
1402 \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allsplitstyles \thickmuskip
1403 \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allunsplitstyles \pettymuskip
1404 \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allsplitstyles \thickmuskip
1405 \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allunsplitstyles \pettymuskip
1406 \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allsplitstyles \thickmuskip
1407 \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allunsplitstyles \pettymuskip
1408 \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allsplitstyles \thickmuskip
1409 \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allmathstyles \pettymuskip
1410
1411 \inherited\setmathspacing \mathclosecode \mathdifferentialcode \allsplitstyles \thinmuskip
1412 \inherited\setmathspacing \mathclosecode \mathdifferentialcode \allunsplitstyles \pettymuskip
1413 \inherited\setmathspacing \mathordinarycode \mathdifferentialcode \allsplitstyles \thinmuskip
1414 \inherited\setmathspacing \mathordinarycode \mathdifferentialcode \allunsplitstyles \pettymuskip
1415 \inherited\setmathspacing \mathfactorialcode \mathordinarycode \allsplitstyles \thinmuskip
1416 \inherited\setmathspacing \mathfactorialcode \mathordinarycode \allunsplitstyles \pettymuskip
1417 \inherited\setmathspacing \mathfactorialcode \mathfactorialcode \allmathstyles \zeromuskip
1418
1419 \inherited\setmathspacing \mathopencode \mathconstructcode \allmathstyles \thinmuskip
1420 \inherited\setmathspacing \mathconstructcode \mathclosecode \allmathstyles \thinmuskip
1421
1422 \inherited\setmathspacing \mathdimensioncode \mathdimensioncode \allmathstyles \zeromuskip
1423 \inherited\setmathspacing \mathordinarycode \mathdimensioncode \allsplitstyles \thinmuskip
1424 \inherited\setmathspacing \mathordinarycode \mathdimensioncode \allunsplitstyles \pettymuskip
1425 \inherited\setmathspacing \mathdigitcode \mathdimensioncode \allsplitstyles \thinmuskip
1426 \inherited\setmathspacing \mathdigitcode \mathdimensioncode \allunsplitstyles \pettymuskip
1427 \inherited\setmathspacing \mathclosecode \mathdimensioncode \allsplitstyles \thinmuskip
1428 \inherited\setmathspacing \mathclosecode \mathdimensioncode \allunsplitstyles \pettymuskip
1429 \inherited\setmathspacing \mathfunctioncode \mathbinarycode \allsplitstyles \medmuskip
1430 \inherited\setmathspacing \mathfunctioncode \mathbinarycode \allunsplitstyles \pettymuskip
1431
1432
1433 \inherited\setmathspacing \mathintegralcode \mathordinarycode \allmathstyles \pettymuskip
1434 \inherited\setmathspacing \mathintegralcode \mathdigitcode \allmathstyles \pettymuskip
1435 \inherited\setmathspacing \mathintegralcode \mathoperatorcode \allmathstyles \pettymuskip
1436 \inherited\setmathspacing \mathintegralcode \mathdifferentialcode \allmathstyles \pettymuskip
1437 \inherited\setmathspacing \mathintegralcode \mathexponentialcode \allmathstyles \pettymuskip
1438 \inherited\setmathspacing \mathintegralcode \mathimaginarycode \allmathstyles \pettymuskip
1439
1440
1441
1442 \inherited\setmathspacing \mathdimensioncode \mathdigitcode \allmathstyles \thickmuskip
1443 \inherited\setmathspacing \mathdimensioncode \mathbinarycode \allsplitstyles \medmuskip
1444 \inherited\setmathspacing \mathdimensioncode \mathbinarycode \allunsplitstyles \pettymuskip
1445 \inherited\setmathspacing \mathdimensioncode \mathrelationcode \allsplitstyles \thickmuskip
1446 \inherited\setmathspacing \mathdimensioncode \mathrelationcode \allunsplitstyles \pettymuskip
1447
1448 \inherited\setmathspacing \mathfakecode \mathallcode \allmathstyles \tinymuskip
1449 \inherited\setmathspacing \mathallcode \mathfakecode \allmathstyles \tinymuskip
1450
1451 \inherited\setmathspacing \mathtextpunctuationcode \mathordinarycode \allmathstyles \mathinterwordmuskip
1452 \inherited\setmathspacing \mathtextpunctuationcode \mathoperatorcode \allmathstyles \mathinterwordmuskip
1453 \inherited\setmathspacing \mathtextpunctuationcode \mathbinarycode \allmathstyles \mathinterwordmuskip
1454 \inherited\setmathspacing \mathtextpunctuationcode \mathrelationcode \allmathstyles \mathinterwordmuskip
1455 \inherited\setmathspacing \mathtextpunctuationcode \mathopencode \allmathstyles \mathinterwordmuskip
1456 \inherited\setmathspacing \mathtextpunctuationcode \mathmiddlecode \allmathstyles \mathinterwordmuskip
1457 \inherited\setmathspacing \mathtextpunctuationcode \mathclosecode \allmathstyles \mathinterwordmuskip
1458 \inherited\setmathspacing \mathtextpunctuationcode \mathpunctuationcode \allmathstyles \mathinterwordmuskip
1459 \inherited\setmathspacing \mathtextpunctuationcode \mathconstructcode \allmathstyles \mathinterwordmuskip
1460 \inherited\setmathspacing \mathtextpunctuationcode \mathellipsiscode \allmathstyles \mathinterwordmuskip
1461 \inherited\setmathspacing \mathtextpunctuationcode \mathfractioncode \allmathstyles \mathinterwordmuskip
1462 \inherited\setmathspacing \mathtextpunctuationcode \mathradicalcode \allmathstyles \mathinterwordmuskip
1463 \inherited\setmathspacing \mathtextpunctuationcode \mathdifferentialcode \allmathstyles \mathinterwordmuskip
1464 \inherited\setmathspacing \mathtextpunctuationcode \mathpunctuationcode \allmathstyles \mathinterwordmuskip
1465
1466 \inherited\setmathspacing \mathordinarycode \mathtextpunctuationcode \allmathstyles \pettymuskip
1467 \inherited\setmathspacing \mathoperatorcode \mathtextpunctuationcode \allmathstyles \pettymuskip
1468 \inherited\setmathspacing \mathbinarycode \mathtextpunctuationcode \allmathstyles \pettymuskip
1469 \inherited\setmathspacing \mathrelationcode \mathtextpunctuationcode \allmathstyles \pettymuskip
1470 \inherited\setmathspacing \mathopencode \mathtextpunctuationcode \allmathstyles \pettymuskip
1471 \inherited\setmathspacing \mathmiddlecode \mathtextpunctuationcode \allmathstyles \pettymuskip
1472 \inherited\setmathspacing \mathclosecode \mathtextpunctuationcode \allmathstyles \pettymuskip
1473 \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \pettymuskip
1474 \inherited\setmathspacing \mathconstructcode \mathtextpunctuationcode \allmathstyles \pettymuskip
1475 \inherited\setmathspacing \mathellipsiscode \mathtextpunctuationcode \allmathstyles \pettymuskip
1476 \inherited\setmathspacing \mathfractioncode \mathtextpunctuationcode \allmathstyles \pettymuskip
1477 \inherited\setmathspacing \mathradicalcode \mathtextpunctuationcode \allmathstyles \pettymuskip
1478 \inherited\setmathspacing \mathdifferentialcode \mathtextpunctuationcode \allmathstyles \pettymuskip
1479 \inherited\setmathspacing \mathpunctuationcode \mathtextpunctuationcode \allmathstyles \pettymuskip
1480
1481
1482
1483 \inherited\setmathspacing \mathimplicationcode \mathordinarycode \alldisplaystyles \thickermuskip
1484 \inherited\setmathspacing \mathimplicationcode \mathbinarycode \alldisplaystyles \thickermuskip
1485 \inherited\setmathspacing \mathimplicationcode \mathdigitcode \alldisplaystyles \thickermuskip
1486 \inherited\setmathspacing \mathordinarycode \mathimplicationcode \alldisplaystyles \thickermuskip
1487 \inherited\setmathspacing \mathbinarycode \mathimplicationcode \alldisplaystyles \thickermuskip
1488 \inherited\setmathspacing \mathdigitcode \mathimplicationcode \alldisplaystyles \thickermuskip
1489 \inherited\setmathspacing \mathclosecode \mathimplicationcode \alldisplaystyles \thickermuskip
1490 \inherited\setmathspacing \mathradicalcode \mathimplicationcode \alldisplaystyles \thickermuskip
1491 \inherited\setmathspacing \mathfractioncode \mathimplicationcode \alldisplaystyles \thickermuskip
1492 \inherited\setmathspacing \mathfunctioncode \mathimplicationcode \alldisplaystyles \thickermuskip
1493 \inherited\setmathspacing \mathoperatorcode \mathimplicationcode \alldisplaystyles \thickermuskip
1494 \inherited\setmathspacing \mathellipsiscode \mathimplicationcode \alldisplaystyles \thickermuskip
1495 \inherited\setmathspacing \mathconstructcode \mathimplicationcode \alldisplaystyles \thickermuskip
1496 \inherited\setmathspacing \mathghostcode \mathimplicationcode \alldisplaystyles \thickermuskip
1497 \inherited\setmathspacing \mathwrappedcode \mathimplicationcode \alldisplaystyles \thickermuskip
1498\stopsetups
1499
1500\directsetup{math:spacing:default}
1501\directsetup{math:spacing:presets}
1502
1503
1504
1505
1506
1507\definemathematics[i:default][\c!setups=math:spacing:equal]
1508\definemathematics[i:half] [\c!setups=math:spacing:half]
1509\definemathematics[i:tight] [\c!setups=math:spacing:tight]
1510\definemathematics[i:fixed] [\c!setups=math:spacing:fixed]
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524\installcorenamespace{mathstylealternative}
1525
1526\permanent\protected\def\setmathfontstylealternate#1
1527 {\ifcsname\??mathstylealternative\fontclass:#1\endcsname
1528 \expandafter\setmathfontalternate\lastnamedcs
1529 \orelse\ifcsname\??mathstylealternative#1\endcsname
1530 \expandafter\setmathfontalternate\lastnamedcs
1531 \fi}
1532
1533\permanent\tolerant\protected\def\setupmathrendering[#1]#*[#S#2]
1534 {\ifparameter#2\or
1535 \getparameters[\??mathstylealternative#1:][#2]
1536 \else
1537 \getparameters[\??mathstylealternative][#1]
1538 \fi}
1539
1540\appendtoks
1541 \edef\p_stylealternative{\mathematicsparameter\c!stylealternative}
1542 \ifempty\p_stylealternative\else
1543 \presetmathfontalternate{\p_stylealternative}
1544 \fi
1545\to \everymathematics
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567\permanent\protected\def\mathaltcalligraphic{\setmathfontalternate{calligraphic}\cal}
1568\permanent\protected\def\mathaltitalic {\setmathfontalternate{italic}}
1569\permanent\protected\def\mathslashedzero {\begingroup\setmathfontalternate{zero}∅\endgroup}
1570\permanent\protected\def\mathdotless {\setmathfontalternate{dotless}}
1571\permanent\protected\def\mathdotfull {\setmathfontalternate{dotless}}
1572\permanent\protected\def\mathdotlessi {\begingroup\mathdotless i\endgroup}
1573\permanent\protected\def\mathdotlessj {\begingroup\mathdotless j\endgroup}
1574
1575\aliased\let\mathaltcal\mathaltcalligraphic
1576\aliased\let\mathaltit \mathaltitalic
1577
1578
1579\aliased\let\textdotlessi \dotlessi \permanent\protected\def\autodotlessi {\mathortext\mathdotlessi \textdotlessi}
1580\aliased\let\textdotlessj \dotlessj \permanent\protected\def\autodotlessj {\mathortext\mathdotlessj \textdotlessj}
1581
1582\appendtoks
1583
1584 \enforced\let\dotlessi\autodotlessi
1585 \enforced\let\dotlessj\autodotlessj
1586\to \everymathematics
1587
1588\aliased\let\setmathfontalternative \setmathfontalternate
1589\aliased\let\setmathfontstylealternative\setmathfontstylealternate
1590\aliased\let\mathalternate \setmathfontalternate
1591
1592\permanent\protected\def\math_upright {\setmathattribute\s!regular\s!tf\setmathfontstylealternate\s!tf}
1593\permanent\protected\def\math_italic {\setmathattribute\s!regular\s!it\setmathfontstylealternate\s!it}
1594
1595
1596\permanent\protected\def\math_script {\setmathalphabet \s!script \setmathfontstylealternate\s!script}
1597\permanent\protected\def\math_calligraphic{\setmathalphabet \s!calligraphic\setmathfontstylealternate\s!calligraphic}
1598\permanent\protected\def\math_fraktur {\setmathalphabet \s!fraktur \setmathfontstylealternate\s!fraktur}
1599\permanent\protected\def\math_blackboard {\setmathalphabet \s!blackboard \setmathfontstylealternate\s!blackboard}
1600
1601\permanent\protected\def\mathupright {\mathgroupedcommandcs\math_upright }
1602\permanent\protected\def\mathitalic {\mathgroupedcommandcs\math_italic }
1603\permanent\protected\def\mathscript {\mathgroupedcommandcs\math_script }
1604\permanent\protected\def\mathcalligraphic{\mathgroupedcommandcs\math_calligraphic}
1605\permanent\protected\def\mathfraktur {\mathgroupedcommandcs\math_fraktur }
1606\permanent\protected\def\mathblackboard {\mathgroupedcommandcs\math_blackboard }
1607
1608\permanent\protected\def\math_rm{\setmathattribute\s!rm\s!tf\setmathfontstylealternate\s!tf}
1609\permanent\protected\def\math_ss{\setmathattribute\s!ss\s!tf\setmathfontstylealternate\s!tf}
1610\permanent\protected\def\math_tt{\setmathattribute\s!tt\s!tf\setmathfontstylealternate\s!tf}
1611
1612\permanent\protected\def\math_tf{\setmathfontstyle\s!tf\setmathfontstylealternate\s!tf}
1613\permanent\protected\def\math_sl{\setmathfontstyle\s!it\setmathfontstylealternate\s!it}
1614\permanent\protected\def\math_it{\setmathfontstyle\s!it\setmathfontstylealternate\s!it}
1615
1616\permanent\protected\def\math_bf{\setmathfontstyle\s!bf\setmathfontstylealternate\s!bf}
1617\permanent\protected\def\math_bs{\setmathfontstyle\s!bi\setmathfontstylealternate\s!bi}
1618\permanent\protected\def\math_bi{\setmathfontstyle\s!bi\setmathfontstylealternate\s!bi}
1619
1620\permanent\protected\def\mathrm{\mathgroupedcommandcs\math_rm}
1621\permanent\protected\def\mathss{\mathgroupedcommandcs\math_ss}
1622\permanent\protected\def\mathtt{\mathgroupedcommandcs\math_tt}
1623
1624\permanent\protected\def\mathtf{\mathgroupedcommandcs\math_tf}
1625\permanent\protected\def\mathsl{\mathgroupedcommandcs\math_sl}
1626\permanent\protected\def\mathit{\mathgroupedcommandcs\math_it}
1627
1628\permanent\protected\def\mathbf{\mathgroupedcommandcs\math_bf}
1629\permanent\protected\def\mathbs{\mathgroupedcommandcs\math_bs}
1630\permanent\protected\def\mathbi{\mathgroupedcommandcs\math_bi}
1631
1632\aliased\let\math_default\math_italic
1633\aliased\let\mathdefault \math_italic
1634
1635\appendtoks
1636 \ifcstok{\mathematicsparameter\c!default}\v!normal
1637 \enforced\let\mathdefault \math_upright
1638 \enforced\let\math_default\math_upright
1639 \else
1640 \enforced\let\mathdefault \math_italic
1641 \enforced\let\math_default\math_italic
1642 \fi
1643\to \everysetupmathematics
1644
1645\setupmathematics
1646 [\c!default=\v!italic]
1647
1648\aliased\let\tfmath\mathtf
1649\aliased\let\slmath\mathsl
1650\aliased\let\itmath\mathit
1651
1652\aliased\let\bfmath\mathbf
1653\aliased\let\bsmath\mathbs
1654\aliased\let\bimath\mathbi
1655
1656\aliased\let\Bbb\mathblackboard
1657
1658\permanent\protected\def\frak {\ifmmode\expandafter\mathfraktur \fi}
1659\permanent\protected\def\cal {\ifmmode\expandafter\mathcalligraphic\fi}
1660\permanent\protected\def\bbd {\ifmmode\expandafter\mathblackboard \fi}
1661\permanent\protected\def\blackboard{\ifmmode\expandafter\mathblackboard \fi}
1662\permanent\protected\def\fraktur {\ifmmode\expandafter\mathfraktur \fi}
1663\permanent\protected\def\gothic {\ifmmode\expandafter\mathfraktur \fi}
1664
1665\aliased\let\mathcal \mathcalligraphic
1666\aliased\let\mathscr \mathscript
1667\aliased\let\mathfrak\mathfraktur
1668\aliased\let\mathbb \mathblackboard
1669
1670\ifdefined\normaltf \else \permanent\let\normaltf\tf \fi \permanent\protected\def\tf{\ifmmode\expandafter\mathtf\else\expandafter\normaltf\fi}
1671\ifdefined\normalbf \else \permanent\let\normalbf\bf \fi \permanent\protected\def\bf{\ifmmode\expandafter\mathbf\else\expandafter\normalbf\fi}
1672\ifdefined\normalit \else \permanent\let\normalit\it \fi \permanent\protected\def\it{\ifmmode\expandafter\mathit\else\expandafter\normalit\fi}
1673\ifdefined\normalsl \else \permanent\let\normalsl\sl \fi \permanent\protected\def\sl{\ifmmode\expandafter\mathsl\else\expandafter\normalsl\fi}
1674\ifdefined\normalbi \else \permanent\let\normalbi\bi \fi \permanent\protected\def\bi{\ifmmode\expandafter\mathbi\else\expandafter\normalbi\fi}
1675\ifdefined\normalbs \else \permanent\let\normalbs\bs \fi \permanent\protected\def\bs{\ifmmode\expandafter\mathbs\else\expandafter\normalbs\fi}
1676
1677\permanent\protected\def\rm{\ifmmode\expandafter\mathrm\else\expandafter\normalrm\fi}
1678\permanent\protected\def\ss{\ifmmode\expandafter\mathss\else\expandafter\normalss\fi}
1679\permanent\protected\def\tt{\ifmmode\expandafter\mathtt\else\expandafter\normaltt\fi}
1680
1681\ifdefined\mr \else \let\mr\relax \fi
1682\ifdefined\mb \else \let\mb\relax \fi
1683
1684
1685
1686
1687
1688
1689
1690\prependtoks
1691 \math_default
1692\to \everymathematics
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711\newinteger\c_math_renderings_attribute
1712
1713\appendtoks
1714 \c_math_renderings_attribute\clf_mathrenderset{\mathematicsparameter\c!symbolset}\relax
1715\to \everysetupmathematics
1716
1717\appendtoks
1718 \ifcase\c_math_renderings_attribute\else
1719 \c_attr_mathrendering\c_math_renderings_attribute
1720 \fi
1721\to \everymathematics
1722
1723\setupmathematics
1724 [\c!symbolset=]
1725
1726
1727
1728
1729
1730
1731\mutable\let\mathboldsymbol\relax
1732
1733\permanent\protected\def\boldsymbol
1734 {\mathortext\mathboldsymbol\bold}
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753\aliased\let\doifutfmathaccentelse \doifelseutfmathaccent
1754\aliased\let\doifutfmathaboveelse \doifelseutfmathabove
1755\aliased\let\doifutfmathbelowelse \doifelseutfmathbelow
1756\aliased\let\doifutfmathfillerelse \doifelseutfmathfiller
1757\aliased\let\doifutfmathlimopelse \doifelseutfmathlimop
1758
1759
1760
1761\permanent\protected\def\mathlimop#1{\normalmathop{#1}}
1762\permanent\protected\def\mathbox #1{\dontleavehmode\hbox\Ustartmath\mathsurround\zeropoint#1\Ustopmath}
1763\permanent\protected\def\mathnolop#1{\normalmathop{#1}\nolimits}
1764
1765
1766
1767
1768
1769
1770
1771\ifdefined\mathop \else \aliased\let\mathop \normalmathoperator \aliased\let\normalmathop \normalmathoperator \fi
1772\ifdefined\mathord \else \aliased\let\mathord \normalmathordinary \aliased\let\normalmathord \normalmathordinary \fi
1773\ifdefined\mathbin \else \aliased\let\mathbin \normalmathbinary \aliased\let\normalmathbin \normalmathbinary \fi
1774\ifdefined\mathrel \else \aliased\let\mathrel \normalmathrelation \aliased\let\normalmathrel \normalmathrelation \fi
1775\ifdefined\mathpunct \else \aliased\let\mathpunct\normalmathpunctuation \aliased\let\normalmathpunct\normalmathpunctuation \fi
1776\ifdefined\underline \else \aliased\let\underline\normalmathunderline \aliased\let\normalunderline\normalmathunderline \fi
1777\ifdefined\overline \else \aliased\let\overline \normalmathoverline \aliased\let\normaloverline \normalmathoverline \fi
1778
1779\permanent\def\mathcodechecked#1
1780 {\numexpr
1781 \ifempty{#1}
1782 \mathordinarycode
1783 \orelse\ifchknumber#1\or
1784 \lastchknumber
1785 \orelse\ifchknumber\begincsname math#1code\endcsname\or
1786 \lastchknumber
1787 \else
1788 \mathordinarycode
1789 \fi
1790 \relax}
1791
1792\permanent\def\mathcodenumber#1
1793 {\the\mathcodechecked{#1}}
1794
1795\permanent\protected\def\mathcodecommand#1
1796 {\mathatom \s!class \mathcodechecked{#1}}
1797
1798\permanent\protected\def\mathcodeallcommand#1#2
1799 {\mathatom \s!class \mathcodechecked{#1} \s!all \mathcodechecked{#2}}
1800
1801\def\math_class_by_parameter #1#2{\normalexpanded{\noexpand\mathcodechecked{#1#2}}}
1802\def\math_atom_by_parameter #1{\normalexpanded{\noexpand\math_atom_by_parameter_indeed{#1\c!mathclass}}}
1803\def\math_atom_by_parameter_indeed#1{\mathatom \s!class \mathcodechecked{#1}}
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817\installcorenamespace{mathcommand}
1818
1819\permanent\tolerant\protected\def\definemathcommand[#1]#*[#2]#*[#3]#:#*#4
1820 {\ifparameter#3\or
1821 \ifcstok{#3}\v!one
1822 \frozen\protected\defcsname\??mathcommand#1\endcsname##1{\mathcodecommand{#2}{#4{##1}}}
1823 \orelse\ifcstok{#3}\v!two
1824 \frozen\protected\defcsname\??mathcommand#1\endcsname##1##2{\mathcodecommand{#2}{#4{##1}{##2}}}
1825 \orelse\ifchknum\mathcodechecked{#3}\or
1826 \frozen\protected\defcsname\??mathcommand#1\endcsname{\mathcodeallcommand{#2}{#3}{#4}}
1827 \else
1828 \frozen\protected\defcsname\??mathcommand#1\endcsname{\mathcodecommand{#2}{#4}}
1829 \fi
1830 \orelse\ifparameter#2\or
1831 \frozen\protected\defcsname\??mathcommand#1\endcsname{\mathcodecommand{#2}{#4}}
1832 \else
1833 \frozen\protected\defcsname\??mathcommand#1\endcsname{#4}
1834 \fi
1835 \ifparameter#1\or
1836 \letcsname#1\expandafter\endcsname\csname\??mathcommand#1\endcsname
1837 \fi}
1838
1839\permanent\protected\def\mathcommand#1
1840 {\begincsname\??mathcommand#1\endcsname}
1841
1842
1843
1844
1845
1846\definemathcommand [joinrel] [\s!relation] {\mkern3mu}
1847
1848\immutable\chardef\c_math_strut"28
1849
1850
1851
1852
1853\let\math_strut_math_style\normalmathstyle
1854
1855
1856
1857\appendtoks
1858 \Umathruleheight\allmainstyles \strutheightfactor\fontspecifiedsize\textfont \zerocount
1859 \Umathruledepth \allmainstyles \strutdepthfactor \fontspecifiedsize\textfont \zerocount
1860 \Umathruleheight\allscriptstyles \strutheightfactor\fontspecifiedsize\scriptfont \zerocount
1861 \Umathruledepth \allscriptstyles \strutdepthfactor \fontspecifiedsize\scriptfont \zerocount
1862 \Umathruleheight\allscriptscriptstyles\strutheightfactor\fontspecifiedsize\scriptscriptfont\zerocount
1863 \Umathruledepth \allscriptscriptstyles\strutdepthfactor \fontspecifiedsize\scriptscriptfont\zerocount
1864\to \everybodyfont
1865
1866\protected\def\math_strut
1867 {\normalsrule
1868 \s!width \zeropoint
1869 \s!fam \fam
1870 \s!char \c_math_strut
1871 \relax}
1872
1873\permanent\protected\def\math_strut_height
1874 {\normalsrule
1875 \s!width \zeropoint
1876 \s!depth \zeropoint
1877 \s!fam \fam
1878 \s!char \c_math_strut
1879 \relax}
1880
1881\permanent\protected\def\math_strut_depth
1882 {\normalsrule
1883 \s!width \zeropoint
1884 \s!height\zeropoint
1885 \s!fam \fam
1886 \s!char \c_math_strut
1887 \relax}
1888
1889\permanent\protected\def\showmathstruts
1890 {\showmakeup[strut]}
1891
1892\pushoverloadmode
1893 \permanent\protected\def\mathstrut {\math_strut}
1894 \permanent\protected\def\mathheightstrut{\math_strut_height}
1895 \permanent\protected\def\mathdepthstrut {\math_strut_depth}
1896\popoverloadmode
1897
1898\permanent\protected\def\topstrut{\normalsrule\s!width\zeropoint\s!height\strutht \s!depth\zeropoint\relax}
1899\permanent\protected\def\botstrut{\normalsrule\s!width\zeropoint\s!height\zeropoint\s!depth\strutdp \relax}
1900
1901
1902
1903
1904\appendtoks
1905 \mathstrutht\strutht
1906 \mathstrutdp\strutdp
1907
1908\to \everymathematics
1909
1910
1911
1912\permanent\protected\def\mathopwithlimits#1#2{\mathop{#1{#2}}\limits}
1913\permanent\protected\def\stackrel #1#2{\mathrel{\mathop{#2}\limits{#1}}}
1914
1915
1916
1917
1918
1919
1920
1921
1922\permanent\protected\def\mf{\begincsname\fontalternative\endcsname}
1923
1924
1925
1926\permanent\protected\def\normalmbox
1927 {\normalhbox\bgroup
1928 \usemathematicsstyleandcolor\c!textstyle\c!textcolor
1929 \dowithnextboxcs\math_mbox_finish\normalhbox}
1930
1931\def\math_mbox_finish
1932 {\flushnextbox
1933 \egroup}
1934
1935\permanent\protected\def\mbox
1936 {\ifmmode\normalmbox\else\normalhbox\fi}
1937
1938\permanent\protected\def\enablembox
1939 {\toksapp\everymathematics{\math_enable_mbox}}
1940
1941\permanent\def\math_enable_mbox
1942 {\enforced\let\hbox\mbox}
1943
1944\permanent\protected\def\snappedmath#1
1945 {\dontleavehmode
1946 \begingroup
1947 \setbox\scratchbox\normalhbox\bgroup
1948 \startimath#1\stopimath
1949 \egroup
1950 \ht\scratchbox\strutht
1951 \dp\scratchbox\strutdp
1952 \box\scratchbox
1953 \endgroup}
1954
1955\permanent\protected\def\mtext#1
1956 {\text{\usemathematicsstyleandcolor\c!textstyle\c!textcolor#1}}
1957
1958
1959
1960\aliased\let\mathfunction\firstofoneunexpanded
1961
1962\let\math_tags_function \firstofoneunexpanded
1963\let\math_tags_functionlabeltext\mathlabeltext
1964
1965\let\math_tags_mo\firstofoneunexpanded
1966\let\math_tags_mi\firstofoneunexpanded
1967
1968\protected\def\math_tags_mn#1{\begingroup\math_upright\math_set_o_both#1\endgroup}
1969\protected\def\math_tags_ms#1{\begingroup\math_upright\math_set_p_both#1\endgroup}
1970
1971
1972
1973
1974
1975
1976\setupmathematics
1977 [\c!textstyle=,
1978 \c!textcolor=,
1979 \c!functionstyle=,
1980 \c!functioncolor=]
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031\installcorenamespace{mathfunction}
2032
2033\installcommandhandler \??mathfunction {mathfunction} \??mathfunction
2034
2035\appendtoks
2036 \frozen\protected\edefcsname\currentmathfunction\endcsname{\math_function_handle\plusone{\currentmathfunction}{}}
2037\to \everydefinemathfunction
2038
2039\aliased\let\setupmathfunctions\setupmathfunction
2040
2041\setupmathfunctions
2042 [\c!color=\mathematicsparameter\c!functioncolor,
2043 \c!style=\mathematicsparameter\c!functionstyle]
2044
2045\def\math_function_handle_normal#1#2#3
2046 {\begingroup
2047 \mathdotfull
2048 \cdef\currentmathfunction{#2}
2049 \setupcurrentmathfunction[#3]
2050 \edef\p_limits{\mathfunctionparameter\c!mathlimits}
2051 \mathatom
2052 mathfont
2053 single
2054 class \mathfunctioncode
2055 \ifx\p_limits\v!no
2056 nolimits
2057 \orelse\ifx\p_limits\v!yes
2058 limits
2059 \orelse\ifx\p_limits\v!auto
2060 nolimits
2061 limits
2062 \fi
2063
2064
2065
2066
2067
2068
2069
2070
2071 \bgroup
2072
2073
2074
2075
2076
2077
2078 \math_tags_mfunctionlab{#2}\c_apply_function
2079 \usemathfunctioncolorparameter\c!color
2080 \edef\p_functionstyle{\mathfunctionparameter\c!style}
2081 \ifempty\p_functionstyle
2082 \expandafter\math_upright
2083 \orelse\ifcsname\??alternativestyle\p_functionstyle\endcsname
2084 \expandafter\lastnamedcs
2085 \else
2086 \expandafter\p_functionstyle
2087 \fi
2088 \ifcase#1\relax
2089 \expandafter\firstofoneargument
2090 \or
2091 \expandafter\mathlabeltext
2092 \fi{#2}
2093
2094
2095
2096 \egroup
2097 \endgroup}
2098
2099\def\math_function_handle_language_indeed#1#2#3
2100 {\cdef\currentmathfunction{#2}
2101 \setupcurrentmathfunction[#3]
2102 \edef\p_command{\mathfunctionparameter\c!command}
2103 \ifempty\p_command
2104 \endgroup\math_function_handle_normal#1{#2}{#3}
2105 \else
2106 \normalexpanded{\endgroup\p_command\expandafter}
2107 \fi}
2108
2109\def\math_function_handle_language#1#2
2110 {\begingroup
2111 \let\math_function_handle\math_function_handle_language_indeed
2112 \csname\currentmainlanguage:#2\endcsname}
2113
2114\tolerant\protected\def\math_function_handle#1#2#3
2115 {\ifcsname\currentmainlanguage:#2\endcsname
2116 \expandafter\math_function_handle_language
2117 \else
2118 \expandafter\math_function_handle_normal
2119 \fi#1{#2}{#3}}
2120
2121\permanent\tolerant\protected\def\mfunctionlabeltext[#1]
2122 {\math_function_handle\plusone{#1}{}}
2123
2124
2125
2126\permanent\tolerant\protected\def\mfunction[#1]
2127 {\ifhastok={#1}
2128 \expandafter\mfunction_yes
2129 \orelse\ifparameter#1\or
2130 \expandafter\mfunction_nop
2131 \else
2132 \expandafter\mfunction_yop
2133 \fi{#1}}
2134
2135\permanent\tolerant\protected\def\mfunction_yes#1#*[#2]#;#3{\math_function_handle\zerocount{#2#3}{#1}}
2136\permanent\protected\def\mfunction_nop #1{\math_function_handle\zerocount{#1}{}}
2137\permanent\protected\def\mfunction_yop #1#2{\math_function_handle\zerocount{#2}{}}
2138
2139\appendtoks
2140 \edef\p_functionstyle{\formulaparameter\c!functionstyle}
2141 \ifempty\p_functionstyle\else
2142 \letmathematicsparameter\c!functionstyle\p_functionstyle
2143 \fi
2144 \edef\p_functioncolor{\formulaparameter\c!functioncolor}
2145 \ifempty\p_functioncolor\else
2146 \letmathematicsparameter\c!functioncolor\p_functioncolor
2147 \fi
2148\to \everybeforedisplayformula
2149
2150\let\math_tags_mfunctiontxt\gobbletwoarguments
2151\let\math_tags_mfunctionlab\gobbletwoarguments
2152
2153\permanent\protected\def\math_tags_mo_indeed#1{\begingroup \c_attr_mathcategory\plusone #1\endgroup}
2154\permanent\protected\def\math_tags_mi_indeed#1{\begingroup \c_attr_mathcategory\plustwo #1\endgroup}
2155\permanent\protected\def\math_tags_mn_indeed#1{\begingroup\math_upright\c_attr_mathcategory\plusthree\math_set_o_both#1\endgroup}
2156\permanent\protected\def\math_tags_ms_indeed#1{\begingroup\math_upright\c_attr_mathcategory\plusfour \math_set_p_both#1\endgroup}
2157
2158\newconditional\c_apply_function
2159
2160\permanent\protected\def\math_tags_apply#1#2
2161 {\begingroup
2162 \c_apply_function\conditionaltrue
2163 #1
2164 \endgroup
2165 \begingroup
2166
2167 #2
2168 \endgroup}
2169
2170\ifdefined\apply \else \aliased\let\apply\relax \fi
2171
2172\mutable\let\mo\relax
2173\mutable\let\mi\relax
2174\mutable\let\mn\relax
2175\mutable\let\ms\relax
2176
2177\appendtoks
2178 \enforced\let\math_tags_mfunctiontxt\clf_tagmfunctiontxt
2179 \enforced\let\math_tags_mfunctionlab\clf_tagmfunctionlab
2180 \enforced\let\math_tags_mo \math_tags_mo_indeed
2181 \enforced\let\math_tags_mi \math_tags_mi_indeed
2182 \enforced\let\math_tags_mn \math_tags_mn_indeed
2183 \enforced\let\math_tags_ms \math_tags_ms_indeed
2184\to \everyenableelements
2185
2186\appendtoks
2187 \enforced\let\mo \math_tags_mo
2188 \enforced\let\mi \math_tags_mi
2189 \enforced\let\mn \math_tags_mn
2190 \enforced\let\ms \math_tags_ms
2191 \enforced\let\apply\math_tags_apply
2192\to\everymathematics
2193
2194\mutable\def\currentmscaledstyle{rm}
2195
2196\permanent\protected\def\mscaledtext#1
2197 {\mathchoice
2198 {\hbox{\csname\currentmscaledstyle\endcsname\tf #1}}
2199 {\hbox{\csname\currentmscaledstyle\endcsname\tf #1}}
2200 {\hbox{\csname\currentmscaledstyle\endcsname\tfx #1}}
2201 {\hbox{\csname\currentmscaledstyle\endcsname\tfxx#1}}}
2202
2203\permanent\protected\def\setmathfunctionstyle#1
2204 {\setupmathematics[\c!functionstyle=#1]}
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339\ifdefined \prime \else
2340 \Umathchardef\prime "0 "0 "2032
2341\fi
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364\newtoks\everydonknuthmode
2365\newtoks\everynonknuthmode
2366
2367\newconditional \knuthmode
2368
2369\aliased\let\nonknuthmode\relax
2370\aliased\let\donknuthmode\relax
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450\permanent\protected\def\enableasciimode
2451 {\clf_enableasciimode}
2452
2453\permanent\protected\def\asciimode
2454 {\catcodetable\txtcatcodes
2455 \clf_enableasciimode}
2456
2457\permanent\protected\def\startasciimode
2458 {\pushcatcodetable
2459 \catcodetable\txtcatcodes
2460 \clf_enableasciimode}
2461
2462\permanent\protected\def\stopasciimode
2463 {\popcatcodetable}
2464
2465
2466
2467\permanent\def\nulloperator{\mathortext{\mathop{\emptyhbox}}{\emptyhbox}}
2468
2469
2470
2471\def\math_basics_check_compact
2472 {\ifcstok{\mathematicsparameter\c!compact}\v!yes
2473 \expandafter\enabledirectives
2474 \else
2475 \expandafter\disabledirectives
2476 \fi
2477 [math.virtual.optional]}
2478
2479\appendtoks
2480 \ifempty\currentmathematics
2481 \math_basics_check_compact
2482 \fi
2483\to \everysetupmathematics
2484
2485\setupmathematics
2486 [\c!compact=\v!no]
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519\newconditional\c_math_right_to_left
2520
2521\installcorenamespace{mathaligndirection}
2522
2523\defcsname\??mathaligndirection r2l\endcsname{\c_math_right_to_left\conditionaltrue}
2524\defcsname\??mathaligndirection\v!righttoleft\endcsname{\c_math_right_to_left\conditionaltrue}
2525
2526\appendtoks
2527 \ifcsname\??mathaligndirection\mathematicsparameter\c!align\endcsname
2528 \lastnamedcs
2529 \else
2530 \c_math_right_to_left\conditionalfalse
2531 \fi
2532\to \everyswitchmathematics
2533
2534\protected\def\math_basics_synchronize_direction
2535 {\mathdirection\ifconditional\c_math_right_to_left\directionrighttoleft\else\directionlefttoright\fi}
2536
2537
2538
2539
2540\appendtoks
2541 \math_basics_synchronize_direction
2542\to \everyswitchmathematics
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579\installcorenamespace{mathgreek}
2580
2581\newconstant\c_math_greek_attribute
2582
2583\defcsname\??mathgreek\v!none \endcsname{1}
2584\defcsname\??mathgreek\v!normal\endcsname{2}
2585\defcsname\??mathgreek\v!italic\endcsname{3}
2586
2587\appendtoks
2588 \edef\p_sygreek{\mathematicsparameter\s!sygreek}
2589 \edef\p_lcgreek{\mathematicsparameter\s!lcgreek}
2590 \edef\p_ucgreek{\mathematicsparameter\s!ucgreek}
2591 \c_math_greek_attribute"
2592 \ifcsname\??mathgreek\p_sygreek\endcsname\lastnamedcs\else1\fi
2593 \ifcsname\??mathgreek\p_lcgreek\endcsname\lastnamedcs\else1\fi
2594 \ifcsname\??mathgreek\p_ucgreek\endcsname\lastnamedcs\else1\fi
2595 \relax
2596 \ifcase\c_math_greek_attribute
2597 \c_math_greek_attribute\attributeunsetvalue
2598 \fi
2599\to \everyswitchmathematics
2600
2601
2602
2603\permanent\protected\def\mathgreekupright{\c_attr_mathgreek"222\relax}
2604\permanent\protected\def\mathgreekitalic {\c_attr_mathgreek"333\relax}
2605\permanent\protected\def\mathgreekdefault{\c_attr_mathgreek"000\relax}
2606
2607\aliased\let\mathgreeknormal\mathgreekupright
2608\aliased\let\mathgreeknone \mathgreekdefault
2609
2610\appendtoks
2611 \c_attr_mathgreek\c_math_greek_attribute
2612\to \everymathematics
2613
2614\setupmathematics
2615 [\s!sygreek=\v!normal,
2616 \s!lcgreek=\v!italic,
2617 \s!ucgreek=\v!normal]
2618
2619
2620
2621\installcorenamespace{mathcollapsing}
2622
2623\setnewconstant\c_math_collapsing_attribute\attributeunsetvalue
2624
2625\letcsname\??mathcollapsing 0\endcsname\zerocount
2626\letcsname\??mathcollapsing\s!tex \endcsname\zerocount
2627\letcsname\??mathcollapsing 1\endcsname\plusone
2628\letcsname\??mathcollapsing\v!default\endcsname\plusone
2629\letcsname\??mathcollapsing 2\endcsname\plustwo
2630\letcsname\??mathcollapsing\v!all \endcsname\plustwo
2631\letcsname\??mathcollapsing 3\endcsname\plusthree
2632\letcsname\??mathcollapsing\v!list \endcsname\plusthree
2633\letcsname\??mathcollapsing\v!none \endcsname\attributeunsetvalue
2634\letcsname\??mathcollapsing\v!reset \endcsname\attributeunsetvalue
2635
2636\def\math_collapsing_initialize
2637 {\ifnum\c_math_collapsing_attribute=\attributeunsetvalue \else
2638 \clf_initializemathcollapsing
2639 \glet\math_collapsing_initialize\relax
2640 \fi}
2641
2642\appendtoks
2643 \edef\p_collapsing{\mathematicsparameter\s!collapsing}
2644 \c_math_collapsing_attribute
2645 \ifcsname\??mathcollapsing\p_collapsing\endcsname\lastnamedcs\else\attributeunsetvalue\fi
2646 \relax
2647\to \everyswitchmathematics
2648
2649\appendtoks
2650 \math_collapsing_initialize
2651 \c_attr_mathcollapsing\c_math_collapsing_attribute
2652\to \everymathematics
2653
2654\setupmathematics
2655 [\s!collapsing=1]
2656
2657
2658
2659\installcorenamespace{mathkernpairs}
2660
2661\setnewconstant\c_math_kernpairs_attribute\attributeunsetvalue
2662
2663\def\math_kernpairs_initialize
2664 {\ifnum\c_math_kernpairs_attribute=\attributeunsetvalue \else
2665 \clf_initializemathkernpairs
2666 \glet\math_kernpairs_initialize\relax
2667 \fi}
2668
2669\appendtoks
2670 \edef\p_kernpairs{\mathematicsparameter\s!kernpairs}
2671 \c_math_kernpairs_attribute\ifx\p_kernpairs\v!yes\plusone\else\attributeunsetvalue\fi\relax
2672\to \everyswitchmathematics
2673
2674\appendtoks
2675 \math_kernpairs_initialize
2676 \c_attr_mathkernpairs\c_math_kernpairs_attribute
2677\to \everymathematics
2678
2679\setupmathematics
2680 [\s!kernpairs=\v!no]
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775\def\math_activeate_comma {\amcode\commaasciicode \activecatcode}
2776\def\math_activeate_period {\amcode\periodasciicode \activecatcode}
2777\def\math_activeate_semicolon{\amcode\semicolonasciicode\activecatcode}
2778
2779\def\math_set_o_comma {\Umathcode\commaasciicode \mathordinarycode \zerocount\commaasciicode}
2780\def\math_set_p_comma {\Umathcode\commaasciicode \mathpunctuationcode\zerocount\commaasciicode}
2781\def\math_set_o_period {\Umathcode\periodasciicode \mathordinarycode \zerocount\periodasciicode}
2782\def\math_set_p_period {\Umathcode\periodasciicode \mathpunctuationcode\zerocount\periodasciicode}
2783\def\math_set_o_semicolon{\Umathcode\semicolonasciicode\mathordinarycode \zerocount\semicolonasciicode}
2784\def\math_set_p_semicolon{\Umathcode\semicolonasciicode\mathpunctuationcode\zerocount\semicolonasciicode}
2785
2786\edef\math_set_o_both{\math_set_o_period\math_set_o_comma}
2787\edef\math_set_p_both{\math_set_p_period\math_set_p_comma}
2788
2789
2790
2791\protected\def\math_punctuation_nop_comma {\begingroup\math_set_p_comma ,\endgroup\math_activeate_comma }
2792\protected\def\math_punctuation_nop_period {\begingroup\math_set_o_period .\endgroup\math_activeate_period }
2793\protected\def\math_punctuation_nop_semicolon{\begingroup\math_set_p_semicolon;\endgroup\math_activeate_semicolon}
2794
2795\def\math_punctuation_comma_next {\begingroup\Umathcode\commaasciicode \ifx\nexttoken\blankspace\mathpunctuationcode\else\mathordinarycode\fi\zerocount\commaasciicode ,\endgroup\math_activeate_comma }
2796\def\math_punctuation_period_next {\begingroup\Umathcode\periodasciicode \ifx\nexttoken\blankspace\mathpunctuationcode\else\mathordinarycode\fi\zerocount\periodasciicode .\endgroup\math_activeate_period }
2797\def\math_punctuation_semicolon_next{\begingroup\Umathcode\semicolonasciicode\ifx\nexttoken\blankspace\mathpunctuationcode\else\mathordinarycode\fi\zerocount\semicolonasciicode;\endgroup\math_activeate_semicolon}
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809\protected\def\math_punctuation_all_comma {\futurelet\nexttoken\math_punctuation_comma_next}
2810\protected\def\math_punctuation_all_period {\futurelet\nexttoken\math_punctuation_period_next}
2811\protected\def\math_punctuation_all_semicolon{\futurelet\nexttoken\math_punctuation_semicolon_next}
2812
2813 \let\math_punctuation_yes_comma \math_punctuation_all_comma
2814 \let\math_punctuation_yes_period \math_punctuation_nop_period
2815 \let\math_punctuation_yes_semicolon\math_punctuation_all_semicolon
2816
2817\installcorenamespace {mathautopunctuation}
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862\defcsname\??mathautopunctuation\v!no\endcsname
2863 {\letcharcode\commaasciicode \math_punctuation_nop_comma
2864 \letcharcode\periodasciicode \math_punctuation_nop_period
2865 \letcharcode\semicolonasciicode\math_punctuation_nop_semicolon}
2866
2867\defcsname\??mathautopunctuation\v!yes\endcsname
2868 {\letcharcode\commaasciicode \math_punctuation_yes_comma
2869 \letcharcode\periodasciicode \math_punctuation_yes_period
2870 \letcharcode\semicolonasciicode\math_punctuation_nop_semicolon}
2871
2872\defcsname\??mathautopunctuation\v!all\endcsname
2873 {\letcharcode\commaasciicode \math_punctuation_all_comma
2874 \letcharcode\periodasciicode \math_punctuation_all_period
2875 \letcharcode\semicolonasciicode\math_punctuation_nop_semicolon}
2876
2877\defcsname\??mathautopunctuation comma\endcsname
2878 {\letcharcode\commaasciicode \math_punctuation_yes_comma
2879 \letcharcode\periodasciicode \math_punctuation_yes_period
2880 \letcharcode\semicolonasciicode\math_punctuation_nop_semicolon}
2881
2882\defcsname\??mathautopunctuation\v!yes\string,semicolon\endcsname
2883 {\letcharcode\commaasciicode \math_punctuation_yes_comma
2884 \letcharcode\periodasciicode \math_punctuation_yes_period
2885 \letcharcode\semicolonasciicode\math_punctuation_yes_semicolon}
2886
2887\defcsname\??mathautopunctuation comma\string,semicolon\endcsname
2888 {\letcharcode\commaasciicode \math_punctuation_yes_comma
2889 \letcharcode\periodasciicode \math_punctuation_yes_period
2890 \letcharcode\semicolonasciicode\math_punctuation_yes_semicolon}
2891
2892\defcsname\??mathautopunctuation\v!all\string,semicolon\endcsname
2893 {\letcharcode\commaasciicode \math_punctuation_all_comma
2894 \letcharcode\periodasciicode \math_punctuation_all_period
2895 \letcharcode\semicolonasciicode\math_punctuation_all_semicolon}
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914\appendtoks
2915 \math_activeate_comma
2916 \math_activeate_period
2917 \math_activeate_semicolon
2918 \begincsname\??mathautopunctuation\mathematicsparameter\c!autopunctuation\endcsname
2919\to \everymathematics
2920
2921\appendtoks
2922 \ifcsname\??mathautopunctuation\mathematicsparameter\c!autopunctuation\endcsname \else
2923 \letmathematicsparameter\c!autopunctuation\v!no
2924 \fi
2925\to \everysetupmathematics
2926
2927\permanent\protected\def\enablemathpunctuation {\csname\??mathautopunctuation\v!no \endcsname}
2928\permanent\protected\def\disablemathpunctuation{\csname\??mathautopunctuation\v!yes\endcsname}
2929
2930\setupmathematics
2931 [\c!autopunctuation=\v!no]
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960\installcorenamespace{autospacing}
2961
2962\permanent\protected\def\enablemathautospacing
2963 {\attribute\mathspacingattribute\plusone
2964 \clf_initializemathspacing}
2965
2966\permanent\protected\def\disablemathautospacing
2967 {\attribute\mathspacingattribute\attributeunsetvalue}
2968
2969\appendtoks
2970 \ifcstok{\mathematicsparameter\c!autospacing}\v!yes
2971 \enablemathautospacing
2972 \else
2973 \disablemathautospacing
2974 \fi
2975\to \everysetupmathematics
2976
2977\setupmathematics
2978 [\c!autospacing=\v!no]
2979
2980\permanent\protected\def\enablemathautonumbers
2981 {\attribute\mathnumbersattribute\plusone
2982 \clf_initializemathnumbers}
2983
2984\permanent\protected\def\disablemathautonumbers
2985 {\attribute\mathnumbersattribute\attributeunsetvalue}
2986
2987\appendtoks
2988 \edef\p_autonumbers{\mathematicsparameter\c!autonumbers}
2989 \ifchknum\p_autonumbers\or
2990 \enablemathautonumbers
2991 \attribute\mathnumbersattribute\p_autonumbers\relax
2992 \orelse\ifx\p_autonumbers\v!no
2993 \disablemathautonumbers
2994 \else
2995 \enablemathautonumbers
2996 \fi
2997\to \everysetupmathematics
2998
2999\setupmathematics
3000 [\c!autonumbers=\v!no]
3001
3002\installcorenamespace{autofencing}
3003
3004\permanent\protected\def\enablemathautofencing
3005 {\attribute\mathfencingattribute\plusone
3006 \clf_initializemathfencing}
3007
3008\permanent\protected\def\disablemathautofencing
3009 {\attribute\mathfencingattribute\attributeunsetvalue}
3010
3011\appendtoks
3012 \ifcstok{\mathematicsparameter\c!autofencing}\v!yes
3013 \enablemathautofencing
3014 \else
3015 \disablemathautofencing
3016 \fi
3017\to \everysetupmathematics
3018
3019\setupmathematics
3020 [\c!autofencing=\v!no]
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049\permanent\def\uncramped#1
3050 {\beginmathgroup
3051 \ifmathstyle
3052 \or \displaystyle \or
3053 \or \textstyle \or
3054 \or \scriptstyle \or
3055 \or \scriptscriptstyle \fi
3056 #1
3057 \endmathgroup}
3058
3059\permanent\def\cramped#1
3060 {\beginmathgroup
3061 \ifmathstyle
3062 \crampeddisplaystyle \or \or
3063 \crampedtextstyle \or \or
3064 \crampedscriptstyle \or \or
3065 \crampedscriptscriptstyle \fi
3066 #1
3067 \endmathgroup}
3068
3069\permanent\def\triggermathstyle#1{\givenmathstyle\numexpr#1\relax}
3070
3071\permanent\let\mathstyletrigger \firstofoneargument
3072
3073\def\triggeredmathstyle#1{\givenmathstyle\numexpr\number#1\relax}
3074
3075\permanent\def\triggeredmathstyleparameter#1
3076 {\ifcase\numexpr\normalmathstyle\relax
3077 #1\displaystyle \or
3078 #1\crampeddisplaystyle \or
3079 #1\textstyle \or
3080 #1\crampedtextstyle \or
3081 #1\scriptstyle \or
3082 #1\crampedscriptstyle \or
3083 #1\scriptscriptstyle \or
3084 #1\crampedscriptscriptstyle \else
3085
3086 \fi}
3087
3088\permanent\def\mathstylefont#1
3089 {\ifcase\numexpr#1\relax
3090 \textfont \or
3091 \textfont \or
3092 \textfont \or
3093 \textfont \or
3094 \scriptfont \or
3095 \scriptfont \or
3096 \scriptscriptfont \or
3097 \scriptscriptfont \else
3098 \textfont
3099 \fi\fam}
3100
3101\permanent\def\somemathstylefont#1
3102 {\ifcase\numexpr#1\relax
3103 \textfont \or
3104 \textfont \or
3105 \textfont \or
3106 \textfont \or
3107 \scriptfont \or
3108 \scriptfont \or
3109 \scriptscriptfont \or
3110 \scriptscriptfont \else
3111 \textfont
3112 \fi}
3113
3114\permanent\def\mathsmallstylefont#1
3115 {\ifcase\numexpr#1\relax
3116 \scriptfont \or
3117 \scriptfont \or
3118 \scriptfont \or
3119 \scriptfont \or
3120 \scriptscriptfont \or
3121 \scriptscriptfont \or
3122 \scriptscriptfont \or
3123 \scriptscriptfont \else
3124 \scriptfont
3125 \fi\fam}
3126
3127\permanent\def\mathstyleface#1
3128 {\ifcase\numexpr#1\relax
3129 \textface \or
3130 \textface \or
3131 \textface \or
3132 \textface \or
3133 \scriptface \or
3134 \scriptface \or
3135 \scriptscriptface \or
3136 \scriptscriptface \else
3137 \textface
3138 \fi}
3139
3140
3141
3142
3143\permanent\def\mathsmallstyleface#1
3144 {\ifcase\numexpr#1\relax
3145 \scriptface \or
3146 \scriptface \or
3147 \scriptface \or
3148 \scriptface \or
3149 \scriptscriptface \or
3150 \scriptscriptface \or
3151 \scriptscriptface \or
3152 \scriptscriptface \else
3153 \scriptface
3154 \fi}
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169\permanent\def\mathstylecommand#1#2#3
3170 {\ifcase\numexpr\normalmathstyle\relax
3171 \expandafter#1\or
3172 \expandafter#1\or
3173 \expandafter#1\or
3174 \expandafter#1\or
3175 \expandafter#2\or
3176 \expandafter#2\or
3177 \expandafter#3\or
3178 \expandafter#3\else
3179 \expandafter#1\fi}
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194\permanent\protected\def\verbosemathstyle#1
3195 {{\normalexpanded{\relax\darkgray\ttxx[\number#1:\ifcase\numexpr#1\relax
3196 display\or
3197 crampeddisplay\or
3198 text\or
3199 crampedtext\or
3200 script\or
3201 crampedscript\or
3202 scriptscript\or
3203 crampedscriptscript\else
3204 unknown\fi]}}}
3205
3206\permanent\protected\def\showmathstyle{\verbosemathstyle\normalmathstyle}
3207
3208
3209
3210\permanent\def\mathcharwd{\scaledfontcharwd\mathstylefont\normalmathstyle}
3211\permanent\def\mathcharht{\scaledfontcharht\mathstylefont\normalmathstyle}
3212\permanent\def\mathchardp{\scaledfontchardp\mathstylefont\normalmathstyle}
3213
3214
3215
3216\aliased \let\mathexheight \exheight
3217\permanent\def\mathemwidth {\Umathquad\normalmathstyle}
3218
3219
3220
3221\permanent\def\mathpalette#1#2
3222 {\mathchoice
3223 {#1\displaystyle {#2}}
3224 {#1\textstyle {#2}}
3225 {#1\scriptstyle {#2}}
3226 {#1\scriptscriptstyle{#2}}}
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251\permanent\protected\def\crampedllap#1{\llap{\cramped#1}}
3252\permanent\protected\def\crampedrlap#1{\rlap{\cramped#1}}
3253\permanent\protected\def\crampedclap#1{\clap{\cramped#1}}
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265\permanent\protected\def\mathstylehbox#1#
3266 {\math_style_hbox{#1}}
3267
3268\protected\def\math_style_hbox#1#2
3269 {\normalexpanded{\hbox#1\bgroup
3270 \startimath\triggeredmathstyle\normalmathstyle}\mathsurround\zeropoint#2\stopimath\egroup}
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282\permanent\protected\def\mathstylevbox#1
3283 {\normalexpanded{\vbox\bgroup
3284 \startimath\triggeredmathstyle\normalmathstyle}\mathsurround\zeropoint#1\stopimath\egroup}
3285
3286\permanent\protected\def\mathstylevcenter#1
3287 {\normalexpanded{\vcenter\bgroup
3288 \startimath\triggeredmathstyle\normalmathstyle}\mathsurround\zeropoint#1\stopimath\egroup}
3289
3290\permanent\protected\def\mathstylevcenteredhbox#1
3291 {\normalexpanded{\vcenter\bgroup\hbox\bgroup
3292 \startimath\triggeredmathstyle\normalmathstyle}\mathsurround\zeropoint#1\stopimath\egroup\egroup}
3293
3294\permanent\protected\def\mathstylevcenteredvbox#1
3295 {\normalexpanded{\vcenter\bgroup\vbox\bgroup
3296 \startimath\triggeredmathstyle\normalmathstyle}\mathsurround\zeropoint#1\stopimath\egroup\egroup}
3297
3298\permanent\protected\def\setmathsmalltextbox#1#2#
3299 {\normalizebodyfontsize\m_math_text_choice_face{\mathsmallstyleface\normalmathstyle}
3300 \setbox#1#2\bgroup
3301 \font_basics_switchtobodyfont\m_math_text_choice_face
3302 \let\next}
3303
3304\permanent\protected\def\setmathtextbox#1#2#
3305 {\normalizebodyfontsize\m_math_text_choice_face{\mathstyleface\normalmathstyle}
3306 \setbox#1#2\bgroup
3307 \font_basics_switchtobodyfont\m_math_text_choice_face
3308 \let\next}
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331\permanent\def\triggerdisplaystyle
3332 {\ifmathstyle
3333 \displaystyle \or
3334 \crampeddisplaystyle \or
3335 \displaystyle \or
3336 \crampeddisplaystyle \or
3337 \displaystyle \or
3338 \crampeddisplaystyle \or
3339 \displaystyle \or
3340 \crampeddisplaystyle \or
3341 \fi}
3342
3343\permanent\def\triggertextstyle
3344 {\ifmathstyle
3345 \textstyle \or
3346 \crampedtextstyle \or
3347 \textstyle \or
3348 \crampedtextstyle \or
3349 \textstyle \or
3350 \crampedtextstyle \or
3351 \textstyle \or
3352 \crampedtextstyle \else
3353 \fi}
3354
3355\permanent\def\triggerscriptstyle
3356 {\ifmathstyle
3357 \scriptstyle \or
3358 \crampedscriptstyle \or
3359 \scriptstyle \or
3360 \crampedscriptstyle \or
3361 \scriptstyle \or
3362 \crampedscriptstyle \or
3363 \scriptstyle \or
3364 \crampedscriptstyle \or
3365 \fi}
3366
3367\permanent\def\triggerscriptscriptstyle
3368 {\ifmathstyle
3369 \scriptscriptstyle \or
3370 \crampedscriptscriptstyle \or
3371 \scriptscriptstyle \or
3372 \crampedscriptscriptstyle \or
3373 \scriptscriptstyle \or
3374 \crampedscriptscriptstyle \or
3375 \scriptscriptstyle \or
3376 \crampedscriptscriptstyle \or
3377 \fi}
3378
3379\permanent\def\triggeruncrampedstyle
3380 {\ifmathstyle
3381 \or \displaystyle \or
3382 \or \textstyle \or
3383 \or \scriptstyle \or
3384 \or \scriptscriptstyle \fi}
3385
3386\permanent\def\triggercrampedstyle
3387 {\ifmathstyle
3388 \crampeddisplaystyle \or \or
3389 \crampedtextstyle \or \or
3390 \crampedscriptstyle \or \or
3391 \crampedscriptscriptstyle \fi}
3392
3393\permanent\def\triggersmallstyle
3394 {\ifmathstyle
3395 \scriptstyle \or
3396 \crampedscriptstyle \or
3397 \scriptstyle \or
3398 \crampedscriptstyle \or
3399 \scriptscriptstyle \or
3400 \crampedscriptscriptstyle \or
3401 \scriptscriptstyle \or
3402 \crampedscriptscriptstyle \or
3403 \fi}
3404
3405\permanent\def\triggeruncrampedsmallstyle
3406 {\ifmathstyle
3407 \scriptstyle \or
3408 \scriptstyle \or
3409 \scriptstyle \or
3410 \scriptstyle \or
3411 \scriptscriptstyle \or
3412 \scriptscriptstyle \or
3413 \scriptscriptstyle \or
3414 \scriptscriptstyle \or
3415 \fi}
3416
3417\permanent\def\triggercrampedsmallstyle
3418 {\ifmathstyle
3419 \crampedscriptstyle \or
3420 \crampedscriptstyle \or
3421 \crampedscriptstyle \or
3422 \crampedscriptstyle \or
3423 \crampedscriptscriptstyle \or
3424 \crampedscriptscriptstyle \or
3425 \crampedscriptscriptstyle \or
3426 \crampedscriptscriptstyle \or
3427 \fi}
3428
3429\permanent\def\triggerbigstyle
3430 {\ifmathstyle
3431 \displaystyle \or
3432 \crampeddisplaystyle \or
3433 \textstyle \or
3434 \crampedtextstyle \or
3435 \textstyle \or
3436 \crampedtextstyle \or
3437 \scriptstyle \or
3438 \crampedscriptstyle \or
3439 \fi}
3440
3441\permanent\def\triggeruncrampedbigstyle
3442 {\ifmathstyle
3443 \displaystyle \or
3444 \displaystyle \or
3445 \textstyle \or
3446 \textstyle \or
3447 \textstyle \or
3448 \textstyle \or
3449 \scriptstyle \or
3450 \scriptstyle \or
3451 \fi}
3452
3453\permanent\def\triggercrampedbigstyle
3454 {\ifmathstyle
3455 \crampeddisplaystyle \or
3456 \crampeddisplaystyle \or
3457 \crampedtextstyle \or
3458 \crampedtextstyle \or
3459 \crampedtextstyle \or
3460 \crampedtextstyle \or
3461 \crampedscriptstyle \or
3462 \crampedscriptstyle \or
3463 \fi}
3464
3465\newinteger\c_math_saved_style
3466
3467\permanent\protected\def\pushmathstyle
3468 {\c_math_saved_style\mathstyle}
3469
3470\permanent\protected\def\popmathstyle
3471 {\ifnum\mathstyle=\c_math_saved_style\else
3472 \triggermathstyle\c_math_saved_style
3473 \fi}
3474
3475\installcorenamespace{mathstylecommand}
3476\installcorenamespace{mathstylecache}
3477
3478\newconstant\c_math_styles_state_style
3479\newconstant\c_math_styles_state_cramped
3480\newconstant\c_math_styles_state_size
3481
3482\def\math_style_add_to_cache_choice {
3483 \ifcase\c_math_styles_state_size
3484 \ifcase\c_math_styles_state_style
3485 \ifcase\c_math_styles_state_cramped
3486 \relax \or
3487 \noexpand\triggeruncrampedstyle \or
3488 \noexpand\triggercrampedstyle \fi
3489 \or\ifcase\c_math_styles_state_cramped
3490 \noexpand\triggerdisplaystyle \or
3491 \displaystyle \or
3492 \crampeddisplaystyle \fi
3493 \or\ifcase\c_math_styles_state_cramped
3494 \noexpand\triggertextstyle \or
3495 \textstyle \or
3496 \crampedtextstyle \fi
3497 \or\ifcase\c_math_styles_state_cramped
3498 \noexpand\triggerscriptstyle \or
3499 \scriptstyle \or
3500 \crampedscriptstyle \fi
3501 \or\ifcase\c_math_styles_state_cramped
3502 \noexpand\triggerscriptscriptstyle \or
3503 \scriptscriptstyle \or
3504 \crampedscriptscriptstyle \fi
3505 \fi
3506 \or
3507 \ifcase\c_math_styles_state_style
3508 \ifcase\c_math_styles_state_cramped
3509 \noexpand\triggersmallstyle \or
3510 \noexpand\triggeruncrampedsmallstyle \or
3511 \noexpand\triggercrampedsmallstyle \fi
3512 \or\ifcase\c_math_styles_state_cramped
3513 \noexpand\triggerscriptstyle \or
3514 \scriptstyle \or
3515 \crampedscriptstyle \fi
3516 \or\ifcase\c_math_styles_state_cramped
3517 \noexpand\triggerscriptstyle \or
3518 \scriptstyle \or
3519 \crampedscriptstyle \fi
3520 \or\ifcase\c_math_styles_state_cramped
3521 \noexpand\triggerscriptscriptstyle \or
3522 \scriptscriptstyle \or
3523 \crampedscriptscriptstyle \fi
3524 \or\ifcase\c_math_styles_state_cramped
3525 \noexpand\triggerscriptscriptstyle \or
3526 \scriptscriptstyle \or
3527 \crampedscriptscriptstyle \fi
3528 \fi
3529 \or
3530 \ifcase\c_math_styles_state_style
3531 \ifcase\c_math_styles_state_cramped
3532 \noexpand\triggerbigstyle \or
3533 \noexpand\triggeruncrampedbigstyle \or
3534 \noexpand\triggercrampedbigstyle \fi
3535 \or\ifcase\c_math_styles_state_cramped
3536 \noexpand\triggerdisplaystyle \or
3537 \displaystyle \or
3538 \crampeddisplaystyle \fi
3539 \or\ifcase\c_math_styles_state_cramped
3540 \noexpand\triggertextstyle \or
3541 \textstyle \or
3542 \crampedtextstyle \fi
3543 \or\ifcase\c_math_styles_state_cramped
3544 \noexpand\triggertextstyle \or
3545 \textstyle \or
3546 \crampedtextstyle \fi
3547 \or\ifcase\c_math_styles_state_cramped
3548 \noexpand\triggerscriptstyle \or
3549 \scriptstyle \or
3550 \crampedscriptstyle \fi
3551 \fi
3552 \fi
3553}
3554
3555\permanent\def\installmathstyle#1#2
3556 {\ifcsname\??mathstylecommand#1\endcsname \else
3557 \defcsname\??mathstylecommand#1\endcsname{#2}
3558 \fi}
3559
3560\def\math_style_collect#1
3561 {\csname\??mathstylecommand#1\endcsname}
3562
3563\defcsname\??mathstylecommand\s!display \endcsname{\c_math_styles_state_style \plusone}
3564\defcsname\??mathstylecommand\s!text \endcsname{\c_math_styles_state_style \plustwo}
3565\defcsname\??mathstylecommand\s!script \endcsname{\c_math_styles_state_style \plusthree}
3566\defcsname\??mathstylecommand\s!scriptscript\endcsname{\c_math_styles_state_style \plusfour}
3567
3568\defcsname\??mathstylecommand\s!uncramped \endcsname{\c_math_styles_state_cramped\plusone}
3569\defcsname\??mathstylecommand\s!cramped \endcsname{\c_math_styles_state_cramped\plustwo}
3570\defcsname\??mathstylecommand\v!normal \endcsname{\c_math_styles_state_cramped\plusone}
3571\defcsname\??mathstylecommand\v!packed \endcsname{\c_math_styles_state_cramped\plustwo}
3572
3573\defcsname\??mathstylecommand\v!small \endcsname{\c_math_styles_state_size \plusone}
3574\defcsname\??mathstylecommand\v!big \endcsname{\c_math_styles_state_size \plustwo}
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586\installcorenamespace {mathstyle}
3587
3588\letcsname\??mathstyle \endcsname\empty
3589\letcsname\??mathstylecache\endcsname\empty
3590
3591\defcsname\??mathstyle\v!normal\endcsname{\givenmathstyle\normalmathstyle}
3592
3593\def\math_style_set_indeed
3594 {\ifcsname\??mathstyle\m_math_style_asked\endcsname
3595 \lastnamedcs
3596 \orelse\ifcsname\??mathstylecache\m_math_style_asked\endcsname
3597 \lastnamedcs
3598 \else
3599 \math_style_set_mathstyle_mathstylecache\m_math_style_asked
3600 \fi}
3601
3602\permanent\def\expandedmathstyleparameter#1#2
3603 {\normalexpanded{\noexpand\math_style_set_expanded{#1#2}}}
3604
3605\def\math_style_set_expanded#1
3606 {\ifcsname\??mathstyle#1\endcsname
3607 \lastnamedcs
3608 \orelse\ifcsname\??mathstylecache#1\endcsname
3609 \lastnamedcs
3610 \else
3611 \math_style_set_mathstyle_mathstylecache{#1}
3612 \fi}
3613
3614\permanent\protected\def\usemathstyleparameter#1#2
3615 {\edef\m_math_style_asked{#1#2}
3616 \ifempty\m_math_style_asked \else
3617 \math_style_set_indeed
3618 \fi}
3619
3620\permanent\tolerant\protected\def\setmathstyle[#1]#;#=
3621 {\edef\m_math_style_asked{#1\c!mathstyle}
3622 \ifempty\m_math_style_asked \else
3623 \math_style_set_indeed
3624 \fi}
3625
3626\permanent\protected\def\setupmathstyle[#1]
3627 {\edef\m_math_style_asked{#1}
3628 \ifempty\m_math_style_asked \else
3629 \math_style_set_indeed
3630 \fi}
3631
3632\def\math_style_set_mathstyle_mathstylecache#1
3633 {\beginlocalcontrol
3634 \edef\m_math_style_asked{#1}
3635 \c_math_styles_state_style \zerocount
3636 \c_math_styles_state_cramped\zerocount
3637 \c_math_styles_state_size \zerocount
3638 \rawprocesscommacommand[\m_math_style_asked]\math_style_collect
3639 \gletcsname\??mathstylecache\m_math_style_asked\normalexpanded{\endcsname\math_style_add_to_cache_choice}
3640 \endlocalcontrol
3641 \csname\??mathstylecache#1\endcsname}
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654\permanent\protected\def\startmathstyle[#1]
3655 {\edef\m_math_style_asked{#1}
3656 \ifempty\m_math_style_asked
3657 \enforced\aliased\let\stopmathstyle\relax
3658 \else
3659 \beginmathgroup
3660 \math_style_set_indeed
3661 \enforced\aliased\let\stopmathstyle\endmathgroup
3662 \fi}
3663
3664\aliased\let\stopmathstyle\relax
3665
3666\permanent\protected\def\startusemathstyleparameter#1#2
3667 {\edef\m_math_style_asked{#1#2}
3668 \ifempty\m_math_style_asked
3669 \enforced\let\stopusemathstyleparameter\relax
3670 \else
3671 \beginmathgroup
3672 \math_style_set_indeed
3673 \enforced\let\stopusemathstyleparameter\endmathgroup
3674 \fi}
3675
3676\aliased\let\stopusemathstyleparameter\relax
3677
3678
3679
3680
3681
3682\let\m_math_text_choice_face\relax
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760\installcorenamespace{mathtext}
3761
3762\installcommandhandler \??mathtext {mathtext} \??mathtext
3763
3764\setupmathtext
3765 [\s!leftclass=\mathtextparameter\s!class,
3766 \s!rightclass=\mathtextparameter\s!class,
3767 \s!class=\mathordinarycode]
3768
3769\appendtoks
3770 \frozen\protected\edefcsname\currentmathtext\endcsname{\math_text_handle{\currentmathtext}}
3771\to \everydefinemathtext
3772
3773\newtoks\everymathtext
3774
3775\tolerant\protected\def\math_text_handle_indeed#1#*[#S#2]#:#3#
3776 {\begingroup
3777 \cdef\currentmathtext{#1}
3778 \setupcurrentmathtext[#2]
3779 \normalizebodyfontsize\m_math_text_choice_face{\mathstyleface\normalmathstyle}
3780 \ifcstok{\mathtextparameter\c!alternative}\v!split
3781 \mathatom
3782 unroll
3783 class \mathcodechecked{\mathtextparameter\s!class}
3784 leftclass \mathcodechecked{\mathtextparameter\s!leftclass}
3785 rightclass \mathcodechecked{\mathtextparameter\s!rightclass}
3786 \bgroup
3787 \hbox#3\bgroup
3788 \aftergroup\egroup
3789 \aftergroup\endgroup
3790 \else
3791 \hbox#3\bgroup
3792 \atendofgroup\hss
3793 \aftergroup\endgroup
3794 \ifcstok{\mathtextparameter\c!alternative}\v!word
3795 \nospacing
3796 \fi
3797 \hss
3798 \fi
3799 \font_basics_switchtobodyfont\m_math_text_choice_face
3800 \usemathtextstyleandcolor\c!style\c!color
3801 \expand\everymathtext\relax
3802 \let\next}
3803
3804\protected\def\math_text_handle#1
3805 {\mathortext{\math_text_handle_indeed{#1}}\hbox}
3806
3807\definemathtext[mathtext]
3808\definemathtext[mathtexttf][mathtext][\c!style=\tf]
3809\definemathtext[mathtextit][mathtext][\c!style=\it]
3810\definemathtext[mathtextsl][mathtext][\c!style=\sl]
3811\definemathtext[mathtextbf][mathtext][\c!style=\bf]
3812\definemathtext[mathtextbi][mathtext][\c!style=\bi]
3813\definemathtext[mathtextbs][mathtext][\c!style=\bs]
3814
3815\definemathtext[mathword] [mathtext][\c!alternative=\v!word]
3816\definemathtext[mathwordtf][mathword][\c!style=\tf]
3817\definemathtext[mathwordit][mathword][\c!style=\it]
3818\definemathtext[mathwordsl][mathword][\c!style=\sl]
3819\definemathtext[mathwordbf][mathword][\c!style=\bf]
3820\definemathtext[mathwordbi][mathword][\c!style=\bi]
3821\definemathtext[mathwordbs][mathword][\c!style=\bs]
3822
3823\definemathtext[mathsplit] [mathtext] [\c!alternative=\v!split]
3824\definemathtext[mathsplittf][mathsplit][\c!style=\tf]
3825\definemathtext[mathsplitit][mathsplit][\c!style=\it]
3826\definemathtext[mathsplitsl][mathsplit][\c!style=\sl]
3827\definemathtext[mathsplitbf][mathsplit][\c!style=\bf]
3828\definemathtext[mathsplitbi][mathsplit][\c!style=\bi]
3829\definemathtext[mathsplitbs][mathsplit][\c!style=\bs]
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844\newconditional\c_mathtextauto
3845
3846\permanent\protected\def\automathtext{\c_mathtextauto\conditionaltrue}
3847
3848\let\currentmathalphabet \s!rm
3849\let\currentmathfontstyle\s!tf
3850
3851\permanent\protected\def\mathtextauto#1#2
3852 {\ifconditional\c_mathtextauto
3853 \mathortext
3854 {\mathpunct
3855 {\begincsname\currentmathalphabet\endcsname
3856 \begincsname mathtext\currentmathfontstyle\endcsname
3857 {#1}}}
3858 {#1}
3859 \else
3860 #2
3861 \fi}
3862
3863
3864
3865
3866
3867
3868
3869
3870\pushoverloadmode
3871 \permanent\protected\def\.{\mathtextauto{.}{.}}
3872 \permanent\protected\def\,{\mathtextauto{,}{\thinspace }}
3873 \permanent\protected\def\:{\mathtextauto{:}{\medspace }}
3874 \permanent\protected\def\;{\mathtextauto{;}{\thickspace}}
3875 \permanent\protected\def\!{\mathtextauto{!}{\negthinspace}}
3876 \permanent\protected\def\?{\mathtextauto{?}{?}}
3877\popoverloadmode
3878
3879\appendtoks \obeydiscretionaries \to \everymathtext
3880\appendtoks \ignorediscretionaries \to \everymathematics
3881
3882
3883
3884\appendtoks
3885 \enforced\let\_\normalunderscore
3886\to \everymathematics
3887
3888
3889
3890\appendtoks
3891 \enforced\let\text\mathtext
3892\to \everymathematics
3893
3894\newinteger\interdisplaylinepenalty \interdisplaylinepenalty\plushundred
3895
3896
3897
3898\permanent\protected\def\mathortext
3899 {\ifmmode
3900 \expandafter\firstoftwoarguments
3901 \else
3902 \expandafter\secondoftwoarguments
3903 \fi}
3904
3905
3906
3907
3908
3909\ifdefined\text\else \aliased\let\text\hbox \fi
3910
3911
3912
3913\newtoks\everymathoptext
3914
3915\appendtoks
3916 \let\textbar
3917\to \everymathoptext
3918
3919\permanent\protected\def\mathoptext
3920 {\normalizebodyfontsize\m_math_text_choice_face{\mathstyleface\normalmathstyle}
3921
3922 \dowithnextbox
3923 {\mathop{\box\nextbox}}
3924 \hbox\bgroup
3925 \expandtoks\everymathoptext
3926 \font_basics_switchtobodyfont
3927 \m_math_text_choice_face
3928 \let\next}
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939\newtoks\everyinsidemathematics
3940
3941\appendtoks
3942 \edef\p_setups{\mathematicsparameter\c!setups}
3943 \ifempty\p_setups\else
3944 \directsetup\p_setups
3945 \fi
3946
3947\to \everyinsidemathematics
3948
3949
3950
3951\permanent\protected\def\smallmathsymbol#1
3952 {\mathematics{\mathbin{\normalexpanded{\raise.15\exheight\hbox{\normalstartimath
3953 \triggeredmathstyle{\the\numexpr\normalmathstyle2\relax}#1
3954 \normalstopimath}}}}}
3955
3956
3957
3958\permanent\def\mathextensiblecode#1#2{\clf_extensiblecode\numexpr#1\relax\numexpr#2\relax}
3959\permanent\def\mathhorizontalcode#1#2{\clf_horizontalcode\numexpr#1\relax\numexpr#2\relax}
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005\def\m_math_inline_openup_ht{\dimexpr\ifinsidecolumns\strutdp\else\lineheight\fi\plusfour\relax}
4006\def\m_math_inline_openup_dp{\dimexpr\ifinsidecolumns\strutdp\else\lineheight\fi\plusfour\relax}
4007
4008
4009
4010
4011\installtextracker
4012 {math.openedup}
4013 {\let\math_inline_openup_start_yes\math_inline_openup_traced_start}
4014 {\let\math_inline_openup_start_yes\math_inline_openup_normal_start}
4015
4016\protected\def\math_inline_openup_normal_start
4017 {\scratchheight\dimexpr\ht\scratchbox\m_math_inline_openup_ht\relax
4018 \scratchdepth \dimexpr\dp\scratchbox\m_math_inline_openup_dp\relax
4019 \vrule\s!width\zeropoint\s!height\scratchheight\s!depth\scratchdepth\relax
4020 \begingroup
4021 \let\math_inline_openup_stop\math_inline_openup_normal_stop}
4022
4023\protected\def\math_inline_openup_normal_stop
4024 {\endgroup
4025 \vrule\s!width\zeropoint\s!height\scratchheight\s!depth\scratchdepth\relax}
4026
4027\protected\def\math_inline_openup_traced_start
4028 {\scratchtopoffset \ht\scratchbox
4029 \scratchbottomoffset\dp\scratchbox
4030 \scratchheight \dimexpr\scratchtopoffset \m_math_inline_openup_ht\relax
4031 \scratchdepth \dimexpr\scratchbottomoffset\m_math_inline_openup_dp\relax
4032 \vrule\s!width\zeropoint\s!height\scratchheight\s!depth\scratchdepth\relax
4033 \begingroup
4034 \dousecolorparameter{darkred}
4035 \vrule\s!width\emwidth\s!height\scratchheight\s!depth\scratchtopoffset\relax
4036 \endgroup
4037 \kern\emwidth
4038 \begingroup
4039 \let\math_inline_openup_stop\math_inline_openup_traced_stop}
4040
4041\protected\def\math_inline_openup_traced_stop
4042 {\endgroup
4043 \kern\emwidth
4044 \begingroup
4045 \dousecolorparameter{darkblue}
4046 \vrule\s!width\emwidth\s!height\scratchbottomoffset\s!depth\scratchdepth\relax
4047 \endgroup
4048 \vrule\s!width\zeropoint\s!height\scratchheight\s!depth\scratchdepth\relax}
4049
4050\let\math_inline_openup_start_yes\math_inline_openup_normal_start
4051\let\math_inline_openup_stop \relax
4052
4053\def\math_inline_openup_start_nop
4054 {\let\math_inline_openup_stop\relax}
4055
4056\permanent\protected\def\openedupimath
4057 {\dontleavehmode
4058 \begingroup
4059 \ifmmode
4060 \expandafter\openedupimath_math
4061 \else
4062 \expandafter\openedupimath_text
4063 \fi}
4064
4065\protected\def\openedupimath_math#1
4066 {\setbox\scratchbox\mathstylehbox{#1}
4067 \ifdim\ht\scratchbox>\strutht
4068 \math_inline_openup_start_yes
4069 \orelse\ifdim\dp\scratchbox>\strutdp
4070 \math_inline_openup_start_yes
4071 \else
4072 \math_inline_openup_start_nop
4073 \fi
4074 #1
4075 \math_inline_openup_stop
4076 \endgroup}
4077
4078\protected\def\openedupimath_text#1
4079 {\setbox\scratchbox\hbox{\startimath#1\stopimath}
4080 \ifdim\ht\scratchbox>\strutht
4081 \math_inline_openup_start_yes
4082 \orelse\ifdim\dp\scratchbox>\strutdp
4083 \math_inline_openup_start_yes
4084 \else
4085 \math_inline_openup_start_nop
4086 \fi
4087 \startimath
4088 #1
4089 \stopimath
4090 \math_inline_openup_stop
4091 \endgroup}
4092
4093
4094
4095
4096
4097\permanent\protected\def\mathplus {}
4098\permanent\protected\def\mathminus {\ifmmode –\orelse\iffontchar\font−−\else –\fi}
4099\permanent\protected\def\mathplusminus{±}
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128\installcorenamespace{mathrules}
4129
4130\permanent\protected\def\enablemathrules{\gletcsname\??mathrules\fontclass\endcsname\plusone}
4131
4132\appendtoks
4133 \mathrulesmode\ifcsname\??mathrules\fontclass\endcsname
4134 \lastnamedcs
4135 \else
4136 \zerocount
4137 \fi
4138 \mathrulesfam\zerocount
4139\to \everymathematics
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193\permanent\protected\def\math_scripts_stack
4194 {\c_attr_mathunstack\attributeunsetvalue}
4195
4196\permanent\protected\def\math_scripts_unstack
4197 {\clf_enablescriptunstacking
4198 \c_attr_mathunstack\plustwo}
4199
4200\ifdefined\stackscripts \else \aliased\let\stackscripts \relax \fi
4201\ifdefined\unstackscripts \else \aliased\let\unstackscripts\relax \fi
4202
4203\appendtoks
4204 \enforced\let\stackscripts \math_scripts_stack
4205 \enforced\let\unstackscripts\math_scripts_unstack
4206\to \everymathematics
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248\permanent\protected\def\mathopenupparameter#1#2
4249 {\ifmathparameter#1\displaystyle \or\frozen#1\displaystyle #2#1\displaystyle \fi
4250 \ifmathparameter#1\crampeddisplaystyle \or\frozen#1\crampeddisplaystyle #2#1\crampeddisplaystyle \fi
4251 \ifmathparameter#1\textstyle \or\frozen#1\textstyle #2#1\textstyle \fi
4252 \ifmathparameter#1\crampedtextstyle \or\frozen#1\crampedtextstyle #2#1\crampedtextstyle \fi
4253 \ifmathparameter#1\scriptstyle \or\frozen#1\scriptstyle #2#1\scriptstyle \fi
4254 \ifmathparameter#1\crampedscriptstyle \or\frozen#1\crampedscriptstyle #2#1\crampedscriptstyle \fi
4255 \ifmathparameter#1\scriptscriptstyle \or\frozen#1\scriptscriptstyle #2#1\scriptscriptstyle \fi
4256 \ifmathparameter#1\crampedscriptscriptstyle\or\frozen#1\crampedscriptscriptstyle#2#1\crampedscriptscriptstyle\fi}
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274\permanent\protected\def\tomathord {\Umathclass\zerocount}
4275\permanent\protected\def\tomathop {\Umathclass\plusone }
4276\permanent\protected\def\tomathbin {\Umathclass\plustwo }
4277\permanent\protected\def\tomathrel {\Umathclass\plusthree}
4278\permanent\protected\def\tomathopen {\Umathclass\plusfour }
4279\permanent\protected\def\tomathclose{\Umathclass\plusfive }
4280\permanent\protected\def\tomathpunct{\Umathclass\plussix }
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314\normalsupmarkmode\plusone
4315
4316\permanent\protected\tolerant\def\supscr[#1]#:#2
4317 {\ifchkdimension#1\or\Umathopenupheight\lastchkdimension\fi
4318 \superscript{#2}}
4319
4320\permanent\protected\tolerant\def\subscr[#1]#:#2
4321 {\ifchkdimension#1\or\Umathopenupdepth\lastchkdimension\fi
4322 \subscript{#2}}
4323
4324\permanent\protected\tolerant\def\supsubscr[#1]#:#2#3
4325 {\ifchkdimension#1\or\Umathopenupheight\lastchkdimension\Umathopenupdepth\lastchkdimension\relax\fi
4326 \superscript{#2}\subscript{#3}}
4327
4328\permanent\protected\tolerant\def\subsupscr[#1]#:#*#2#3
4329 {\ifchkdimension#1\or\Umathopenupheight\lastchkdimension\Umathopenupdepth\lastchkdimension\relax\fi
4330 \subscript{#2}\superscript{#3}}
4331
4332\permanent\protected\tolerant\def\supprescr[#1]#:#2
4333 {\ifchkdimension#1\or\Umathopenupheight\lastchkdimension\fi
4334 \superprescript{#2}}
4335
4336\permanent\protected\tolerant\def\subprescr[#1]#:#2
4337 {\ifchkdimension#1\or\Umathopenupdepth\lastchkdimension\fi
4338 \subprescript{#2}}
4339
4340\permanent\protected\tolerant\def\supsubprescr[#1]#:#2#3
4341 {\ifchkdimension#1\or\Umathopenupheight\lastchkdimension\Umathopenupdepth\lastchkdimension\fi
4342 \superprescript{#2}\subprescript{#3}}
4343
4344\permanent\protected\tolerant\def\subsupprescr[#1]#:#*#2#3
4345 {\ifchkdimension#1\or\Umathopenupheight\lastchkdimension\Umathopenupdepth\lastchkdimension\fi
4346 \subprescript{#2}\superprescript{#3}}
4347
4348
4349
4350\def\math_relax_limits{\enforced\let\limits\relax}
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375\installcorenamespace{mathspacing}
4376
4377\permanent\tolerant\protected\def\definemathspacing[#1]#*[#2]#*[#3]
4378 {\ifcstok{#2}\v!horizontal
4379 \edefcsname\??mathspacing#1\endcsname
4380 {\Umathxscale\allmathstyles\ifchknum#3\or#3\else\plusthousand\fi\relax}
4381 \orelse\ifcstok{#2}\v!vertical
4382 \edefcsname\??mathspacing#1\endcsname
4383 {\Umathyscale\allmathstyles\ifchknum#3\or#3\else\plusthousand\fi\relax}
4384 \else
4385 \edefcsname\??mathspacing#1\endcsname
4386 {\Umathxscale\allmathstyles\ifchknum#2\or\number#2\else\plusthousand\fi\relax
4387 \Umathyscale\allmathstyles\ifchknum#3\or\number#3\orelse\ifchknum#2\or\number#2\else\plusthousand\fi\relax}
4388 \fi}
4389
4390\definemathspacing[\v!normal] [1000] [1000]
4391\definemathspacing[\v!tight] [\c!vertical] [900]
4392\definemathspacing[\v!loose] [\c!vertical] [1100]
4393\definemathspacing[\v!narrow][\c!horizontal] [900]
4394\definemathspacing[\v!wide] [\c!horizontal] [1100]
4395\definemathspacing[\v!less] [900] [900]
4396\definemathspacing[\v!more] [1100] [1100]
4397
4398\permanent\protected\def\setupmathspacing[#1]
4399 {\begincsname\??mathspacing#1\endcsname}
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419\mathdisplaymode\plusone
4420
4421
4422
4423\immutable\integerdef\c_math_glyph_options_default\numexpr
4424 \noexpansionglyphoptioncode
4425 \noprotrusionglyphoptioncode
4426\relax
4427
4428\immutable\integerdef\c_math_glyph_options_hz\numexpr
4429 \noprotrusionglyphoptioncode
4430\relax
4431
4432\appendtoks
4433 \ifcstok{\mathematicsparameter\c!hz}\v!yes
4434 \glyphoptions\c_math_glyph_options_hz
4435 \else
4436 \glyphoptions\c_math_glyph_options_default
4437 \fi
4438\to \everymathematics
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452\def\math_italics_initialize
4453 {\clf_initializemathitalics
4454 \glettonothing\math_italics_initialize}
4455
4456\appendtoks
4457 \ifcstok{\mathematicsparameter\s!italics}\v!yes
4458 \math_italics_initialize
4459 \fi
4460\to \everymathematics
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472\aliased\let\mathtraversecommand\relax
4473
4474\permanent\protected\def\traversemath#1#2#3#4
4475 {\pushmacro\mathtraversecommand
4476 \enforced\def\mathtraversecommand##1{#4}
4477 \clf_traversemath{#1}{#2}{#3}\mathtraversecommand
4478 \popmacro\mathtraversecommand}
4479
4480\permanent\protected\def\traverseblock#1#2
4481 {\pushmacro\mathtraversecommand
4482 \enforced\def\mathtraversecommand##1{#2}
4483 \clf_traverseblock{#1}\mathtraversecommand
4484 \popmacro\mathtraversecommand}
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511\appendtoks
4512 \scriptspace.05\Umathquad\textstyle
4513\to \everymathematics
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525\permanent\tolerant\def\mathdigits#1
4526 {\ifmmode
4527 \mathatom class \mathdigitcode all \mathdigitcode {#1}
4528 \else
4529 #1
4530 \fi}
4531
4532\permanent\tolerant\protected\def\base[#1]#*#:#2
4533 {\ifmmode
4534 \mathdigits{\tf#2}\ifparameter#1\or\subscript{\mathdigits{\tf#1}}\fi
4535 \else
4536 #2\ifparameter#1\or\low{#1}\fi
4537 \fi}
4538
4539
4540
4541\permanent\tolerant\protected\def\definemathgroupset[#1]#*[#2]
4542 {\clf_registergroupset{#1}{#2}}
4543
4544\permanent\tolerant\protected\def\setmathgroupset[#1]
4545 {\mathdictgroup\clf_groupsetgroup{#1}\relax}
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559\definesystemattribute[mathaxis][public]
4560
4561\def\math_axis_inject_indeed#1
4562 {\srule
4563 \s!height
4564 \dimexpr (\scratchdimentwo\scratchdimenone)*
4565 \ifnum\c_math_m_scaled=\plusthousand
4566 \glyphscale\plusthousand
4567 \else
4568 \c_math_m_scaled*\glyphscale\plusthousand\plusthousand
4569 \fi
4570 \relax
4571 \s!depth
4572 \dimexpr (\scratchdimentwo\scratchdimenone)*
4573 \ifnum\c_math_m_scaled=\plusthousand
4574 \glyphscale\plusthousand
4575 \else
4576 \c_math_m_scaled*\glyphscale\plusthousand\plusthousand
4577 \fi
4578 \relax
4579 \s!attr \mathaxisattribute#1
4580 \relax}
4581
4582\def\math_axis_inject#1#2
4583 {\mathatom \s!class \mathghostcode \s!unpack {
4584 \showmakeup[strut]
4585 \ifcase#1
4586
4587 \or
4588 \scratchdimenone.5\Umathfractionrule\mathstyle
4589 \scratchdimentwo\Umathaxis\mathstyle
4590 \math_axis_inject_indeed#2
4591 \or
4592 \scratchdimenone.25\Umathfractionrule\mathstyle
4593 \scratchdimentwo\Umathsupshiftup\mathstyle
4594 \math_axis_inject_indeed#2
4595 \scratchdimentwo\Umathsubshiftdown\mathstyle
4596 \math_axis_inject_indeed#2
4597 \scratchdimentwo\Umathsubsupshiftdown\mathstyle
4598 \math_axis_inject_indeed#2
4599
4600 \divideby\scratchdimenone\plustwo
4601 \scratchdimentwo\Umathprimeshiftup\mathstyle
4602 \math_axis_inject_indeed#2
4603 \fi}}
4604
4605\permanent\protected\def\mathaxisbelow {\math_axis_inject\plusone\plusone}
4606\permanent\protected\def\mathaxisontop {\math_axis_inject\plusone\plustwo}
4607\permanent\protected\def\mathscriptbelow{\math_axis_inject\plustwo\plusone}
4608\permanent\protected\def\mathscriptontop{\math_axis_inject\plustwo\plustwo}
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623\mathinlinepenaltyfactor = 1500
4624\mathdisplaypenaltyfactor = 1000
4625
4626\setmathpostpenalty\mathpunctuationcode\plustenthousand
4627
4628\installcorenamespace{mathnesting}
4629
4630\installcommandhandler \??mathnesting {mathnesting} \??mathnesting
4631
4632\appendtoks
4633 \frozen\protected\instance\edefcsname\currentmathnesting\endcsname{\math_nesting[\currentmathnesting]}
4634\to \everydefinemathnesting
4635
4636\newconstant\c_math_boundary_old
4637\newconstant\c_math_boundary_new
4638
4639\protected\tolerant\def\math_nesting[#1]#*[#S#2]
4640 {\groupedcommand
4641 {\cdef\currentmathnesting{#1}
4642 \setupcurrentmathnesting[#2]
4643 \mathnestingparameter\c!left
4644 \c_math_boundary_old\c_math_boundary_new
4645 \c_math_boundary_new
4646 \ifconditional\indisplaymath
4647 \ifchknum\mathnestingparameter\c!displayfactor\or\lastnamedcs\else\mathdisplaypenaltyfactor\fi
4648 \else
4649 \ifchknum\mathnestingparameter\c!inlinefactor \or\lastnamedcs\else\mathinlinepenaltyfactor \fi
4650 \fi
4651 \relax
4652 \mathboundary\plustwo \c_math_boundary_new}
4653 {\mathboundary\plusthree\c_math_boundary_old
4654 \mathnestingparameter\c!right}}
4655
4656\permanent\tolerant\protected\def\mathnesting[#1]
4657 {\groupedcommand
4658 {\c_math_boundary_old\c_math_boundary_new
4659 \c_math_boundary_new\ifchknum#1\or#1\orelse\ifconditional\indisplaymath\mathdisplaypenaltyfactor\else\mathinlinepenaltyfactor\fi\relax
4660 \mathboundary\plustwo \c_math_boundary_new}
4661 {\mathboundary\plusthree\c_math_boundary_old}}
4662
4663
4664
4665
4666\definemathnesting[mathtogether][\c!inlinefactor=1500]
4667\definemathnesting[mathloose] [\c!inlinefactor=0500]
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689\setupmathematics
4690 [\c!snap=\v!no]
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705\installcorenamespace {mathannotation}
4706
4707\installcommandhandler \??mathannotation {mathannotation} \??mathannotation
4708
4709\setupmathannotation
4710 [\c!top=,
4711 \c!bottom=,
4712 \c!strut=\v!yes,
4713 \c!mathclass=\mathconstructcode]
4714
4715\appendtoks
4716 \frozen\protected\tolerant\edefcsname\currentmathannotation\endcsname{\math_annotation{\currentmathannotation}}
4717\to \everydefinemathannotation
4718
4719\tolerant\protected\def\math_annotation#1[#S#2]#:#3
4720 {\beginmathgroup
4721 \edef\currentmathannotation{#1}
4722 \setupcurrentmathannotation[#2]
4723 \edef\p_strut{\mathannotationparameter\c!strut}
4724 \mathatom
4725 limits
4726 \s!class\mathcodechecked{\mathannotationparameter\c!mathclass}
4727 {#3}
4728 \ifempty{\mathannotationparameter\c!top}\else
4729
4730 \superscript{
4731 \ifx\p_strut\v!yes\botstrut\fi
4732 \mtext{\mathannotationparameter\c!top}
4733 }
4734 \fi
4735 \ifempty{\mathannotationparameter\c!bottom}\else
4736
4737 \subscript{
4738 \ifx\p_strut\v!yes\topstrut\fi
4739 \mtext{\mathannotationparameter\c!bottom}
4740 }
4741 \fi
4742 \endmathgroup}
4743
4744\definemathannotation[mathannotation]
4745
4746
4747\protect \endinput
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765 |