1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
|
% language=uk
\environment luatex-style
\environment luatex-logos
\startcomponent luatex-math
\startchapter[reference=math,title={Math}]
The handling of mathematics in \LUATEX\ differs quite a bit from how \TEX82 (and
therefore \PDFTEX) handles math. First, \LUATEX\ adds primitives and extends some
others so that \UNICODE\ input can be used easily. Second, all of \TEX82's
internal special values (for example for operator spacing) have been made
accessible and changeable via control sequences. Third, there are extensions that
make it easier to use \OPENTYPE\ math fonts. And finally, there are some
extensions that have been proposed or considered in the past that are now added
to the engine.
\section{The current math style}
It is possible to discover the math style that will be used for a formula in an
expandable fashion (while the math list is still being read). To make this
possible, \LUATEX\ adds the new primitive: \type {\mathstyle}. This is a \quote
{convert command} like e.g. \type {\romannumeral}: its value can only be read,
not set.
\subsection{\type {\mathstyle}}
The returned value is between 0 and 7 (in math mode), or $-1$ (all other modes).
For easy testing, the eight math style commands have been altered so that the can
be used as numeric values, so you can write code like this:
\starttyping
\ifnum\mathstyle=\textstyle
\message{normal text style}
\else \ifnum\mathstyle=\crampedtextstyle
\message{cramped text style}
\fi \fi
\stoptyping
\subsection{\type {\Ustack}}
There are a few math commands in \TEX\ where the style that will be used is not
known straight from the start. These commands (\type {\over}, \type {\atop},
\type {\overwithdelims}, \type {\atopwithdelims}) would therefore normally return
wrong values for \type {\mathstyle}. To fix this, \LUATEX\ introduces a special
prefix command: \type {\Ustack}:
\starttyping
$\Ustack {a \over b}$
\stoptyping
The \type {\Ustack} command will scan the next brace and start a new math group
with the correct (numerator) math style.
\section{Unicode math characters}
Character handling is now extended up to the full \UNICODE\ range (the \type {\U}
prefix), which is compatible with \XETEX.
The math primitives from \TEX\ are kept as they are, except for the ones that
convert from input to math commands: \type {mathcode}, and \type {delcode}. These
two now allow for a 21-bit character argument on the left hand side of the equals
sign.
Some of the new \LUATEX\ primitives read more than one separate value. This is
shown in the tables below by a plus sign in the second column.
The input for such primitives would look like this:
\starttyping
\def\overbrace{\Umathaccent 0 1 "23DE }
\stoptyping
The altered \TEX82 primitives are:
\starttabulate[|l|l|r|c|l|r|]
\NC \bf primitive \NC \bf min \NC \bf max \NC \kern 2em \NC \bf min \NC \bf max \NC \NR
\NC \type {\mathcode} \NC 0 \NC 10FFFF \NC = \NC 0 \NC 8000 \NC \NR
\NC \type {\delcode} \NC 0 \NC 10FFFF \NC = \NC 0 \NC FFFFFF \NC \NR
\stoptabulate
The unaltered ones are:
\starttabulate[|l|l|r|]
\NC \bf primitive \NC \bf min \NC \bf max \NC \NR
\NC \type {\mathchardef} \NC 0 \NC 8000 \NC \NR
\NC \type {\mathchar} \NC 0 \NC 7FFF \NC \NR
\NC \type {\mathaccent} \NC 0 \NC 7FFF \NC \NR
\NC \type {\delimiter} \NC 0 \NC 7FFFFFF \NC \NR
\NC \type {\radical} \NC 0 \NC 7FFFFFF \NC \NR
\stoptabulate
For practical reasons \type {\mathchardef} will silently accept values larger
that \type {0x8000} and interpret it as \type {\Umathcharnumdef}. This is needed
to satisfy older macro packages.
The following new primitives are compatible with \XETEX:
% somewhat fuzzy:
\starttabulate[|l|l|r|c|l|r|]
\NC \bf primitive \NC \bf min \NC \bf max \NC \kern 2em \NC \bf min \NC \bf max \NC \NR
\NC \type {\Umathchardef} \NC 0+0+0 \NC 7+FF+10FFFF\rlap{\high{1}} \NC \NC \NC \NC \NR
\NC \type {\Umathcharnumdef}\rlap{\high{5}} \NC -80000000 \NC 7FFFFFFF\rlap{\high{3}} \NC \NC \NC \NC \NR
\NC \type {\Umathcode} \NC 0 \NC 10FFFF \NC = \NC 0+0+0 \NC 7+FF+10FFFF\rlap{\high{1}} \NC \NR
\NC \type {\Udelcode} \NC 0 \NC 10FFFF \NC = \NC 0+0 \NC FF+10FFFF\rlap{\high{2}} \NC \NR
\NC \type {\Umathchar} \NC 0+0+0 \NC 7+FF+10FFFF \NC \NC \NC \NC \NR
\NC \type {\Umathaccent} \NC 0+0+0 \NC 7+FF+10FFFF\rlap{\high{2,4}} \NC \NC \NC \NC \NR
\NC \type {\Udelimiter} \NC 0+0+0 \NC 7+FF+10FFFF\rlap{\high{2}} \NC \NC \NC \NC \NR
\NC \type {\Uradical} \NC 0+0 \NC FF+10FFFF\rlap{\high{2}} \NC \NC \NC \NC \NR
\NC \type {\Umathcharnum} \NC -80000000 \NC 7FFFFFFF\rlap{\high{3}} \NC \NC \NC \NC \NR
\NC \type {\Umathcodenum} \NC 0 \NC 10FFFF \NC = \NC -80000000 \NC 7FFFFFFF\rlap{\high{3}} \NC \NR
\NC \type {\Udelcodenum} \NC 0 \NC 10FFFF \NC = \NC -80000000 \NC 7FFFFFFF\rlap{\high{3}} \NC \NR
\stoptabulate
Specifications typically look like:
\starttyping
\Umathchardef\xx="1"0"456
\Umathcode 123="1"0"789
\stoptyping
Note 1: The new primitives that deal with delimiter|-|style objects do not set up a
\quote {large family}. Selecting a suitable size for display purposes is expected
to be dealt with by the font via the \type {\Umathoperatorsize} parameter (more
information can be found in a following section).
Note 2: For these three primitives, all information is packed into a single
signed integer. For the first two (\type {\Umathcharnum} and \type
{\Umathcodenum}), the lowest 21 bits are the character code, the 3 bits above
that represent the math class, and the family data is kept in the topmost bits
(This means that the values for math families 128--255 are actually negative).
For \type {\Udelcodenum} there is no math class. The math family information is
stored in the bits directly on top of the character code. Using these three
commands is not as natural as using the two- and three|-|value commands, so
unless you know exactly what you are doing and absolutely require the speedup
resulting from the faster input scanning, it is better to use the verbose
commands instead.
Note 3: The \type {\Umathaccent} command accepts optional keywords to control
various details regarding math accents. See \in {section} [mathacc] below for
details.
New primitives that exist in \LUATEX\ only (all of these will be explained
in following sections):
\starttabulate[|l|l|l|l|]
\NC \bf primitive \NC \bf value range (in hex) \NC \NR
\NC \type {\Uroot} \NC 0+0--FF+10FFFF$^2$ \NC \NR
\NC \type {\Uoverdelimiter} \NC 0+0--FF+10FFFF$^2$ \NC \NR
\NC \type {\Uunderdelimiter} \NC 0+0--FF+10FFFF$^2$ \NC \NR
\NC \type {\Udelimiterover} \NC 0+0--FF+10FFFF$^2$ \NC \NR
\NC \type {\Udelimiterunder} \NC 0+0--FF+10FFFF$^2$ \NC \NR
\stoptabulate
\section{Cramped math styles}
\LUATEX\ has four new primitives to set the cramped math styles directly:
\starttyping
\crampeddisplaystyle
\crampedtextstyle
\crampedscriptstyle
\crampedscriptscriptstyle
\stoptyping
These additional commands are not all that valuable on their own, but they come
in handy as arguments to the math parameter settings that will be added shortly.
In Eijkhouts \quotation {\TEX\ by Topic} the rules for handling styles in scripts
are described as follows:
\startitemize
\startitem
In any style superscripts and subscripts are taken from the next smaller style.
Exception: in display style they are taken in script style.
\stopitem
\startitem
Subscripts are always in the cramped variant of the style; superscripts are only
cramped if the original style was cramped.
\stopitem
\startitem
In an \type {..\over..} formula in any style the numerator and denominator are
taken from the next smaller style.
\stopitem
\startitem
The denominator is always in cramped style; the numerator is only in cramped
style if the original style was cramped.
\stopitem
\startitem
Formulas under a \type {\sqrt} or \type {\overline} are in cramped style.
\stopitem
\stopitemize
In \LUATEX\ one can set the styles in more detail which means that you sometimes
have to set both normal and cramped styles to get the effect you want. If we
force styles in the script using \type {\scriptstyle} and \type {\crampedscriptstyle}
we get this:
\startbuffer[demo]
\starttabulate
\NC default \NC $b_{x=xx}^{x=xx}$ \NC \NR
\NC script \NC $b_{\scriptstyle x=xx}^{\scriptstyle x=xx}$ \NC \NR
\NC crampedscript \NC $b_{\crampedscriptstyle x=xx}^{\crampedscriptstyle x=xx}$ \NC \NR
\stoptabulate
\stopbuffer
\getbuffer[demo]
Now we set the following parameters
\startbuffer[setup]
\Umathordrelspacing\scriptstyle=30mu
\Umathordordspacing\scriptstyle=30mu
\stopbuffer
\typebuffer[setup]
This gives:
\start\getbuffer[setup,demo]\stop
But, as this is not what is expected (visually) we should say:
\startbuffer[setup]
\Umathordrelspacing\scriptstyle=30mu
\Umathordordspacing\scriptstyle=30mu
\Umathordrelspacing\crampedscriptstyle=30mu
\Umathordordspacing\crampedscriptstyle=30mu
\stopbuffer
\typebuffer[setup]
Now we get:
\start\getbuffer[setup,demo]\stop
\section{Math parameter settings}
In \LUATEX, the font dimension parameters that \TEX\ used in math typesetting are
now accessible via primitive commands. In fact, refactoring of the math engine
has resulted in many more parameters than were accessible before.
\starttabulate
\NC \bf primitive name \NC \bf description \NC \NR
\NC \type {\Umathquad} \NC the width of 18 mu's \NC \NR
\NC \type {\Umathaxis} \NC height of the vertical center axis of
the math formula above the baseline \NC \NR
\NC \type {\Umathoperatorsize} \NC minimum size of large operators in display mode \NC \NR
\NC \type {\Umathoverbarkern} \NC vertical clearance above the rule \NC \NR
\NC \type {\Umathoverbarrule} \NC the width of the rule \NC \NR
\NC \type {\Umathoverbarvgap} \NC vertical clearance below the rule \NC \NR
\NC \type {\Umathunderbarkern} \NC vertical clearance below the rule \NC \NR
\NC \type {\Umathunderbarrule} \NC the width of the rule \NC \NR
\NC \type {\Umathunderbarvgap} \NC vertical clearance above the rule \NC \NR
\NC \type {\Umathradicalkern} \NC vertical clearance above the rule \NC \NR
\NC \type {\Umathradicalrule} \NC the width of the rule \NC \NR
\NC \type {\Umathradicalvgap} \NC vertical clearance below the rule \NC \NR
\NC \type {\Umathradicaldegreebefore}\NC the forward kern that takes place before placement of
the radical degree \NC \NR
\NC \type {\Umathradicaldegreeafter} \NC the backward kern that takes place after placement of
the radical degree \NC \NR
\NC \type {\Umathradicaldegreeraise} \NC this is the percentage of the total height and depth of
the radical sign that the degree is raised by; it is
expressed in \type {percents}, so 60\% is expressed as the
integer $60$ \NC \NR
\NC \type {\Umathstackvgap} \NC vertical clearance between the two
elements in a \type {\atop} stack \NC \NR
\NC \type {\Umathstacknumup} \NC numerator shift upward in \type {\atop} stack \NC \NR
\NC \type {\Umathstackdenomdown} \NC denominator shift downward in \type {\atop} stack \NC \NR
\NC \type {\Umathfractionrule} \NC the width of the rule in a \type {\over} \NC \NR
\NC \type {\Umathfractionnumvgap} \NC vertical clearance between the numerator and the rule \NC \NR
\NC \type {\Umathfractionnumup} \NC numerator shift upward in \type {\over} \NC \NR
\NC \type {\Umathfractiondenomvgap} \NC vertical clearance between the denominator and the rule \NC \NR
\NC \type {\Umathfractiondenomdown} \NC denominator shift downward in \type {\over} \NC \NR
\NC \type {\Umathfractiondelsize} \NC minimum delimiter size for \type {\...withdelims} \NC \NR
\NC \type {\Umathlimitabovevgap} \NC vertical clearance for limits above operators \NC \NR
\NC \type {\Umathlimitabovebgap} \NC vertical baseline clearance for limits above operators \NC \NR
\NC \type {\Umathlimitabovekern} \NC space reserved at the top of the limit \NC \NR
\NC \type {\Umathlimitbelowvgap} \NC vertical clearance for limits below operators \NC \NR
\NC \type {\Umathlimitbelowbgap} \NC vertical baseline clearance for limits below operators \NC \NR
\NC \type {\Umathlimitbelowkern} \NC space reserved at the bottom of the limit \NC \NR
\NC \type {\Umathoverdelimitervgap} \NC vertical clearance for limits above delimiters \NC \NR
\NC \type {\Umathoverdelimiterbgap} \NC vertical baseline clearance for limits above delimiters \NC \NR
\NC \type {\Umathunderdelimitervgap} \NC vertical clearance for limits below delimiters \NC \NR
\NC \type {\Umathunderdelimiterbgap} \NC vertical baseline clearance for limits below delimiters \NC \NR
\NC \type {\Umathsubshiftdrop} \NC subscript drop for boxes and subformulas \NC \NR
\NC \type {\Umathsubshiftdown} \NC subscript drop for characters \NC \NR
\NC \type {\Umathsupshiftdrop} \NC superscript drop (raise, actually) for boxes and subformulas \NC \NR
\NC \type {\Umathsupshiftup} \NC superscript raise for characters \NC \NR
\NC \type {\Umathsubsupshiftdown} \NC subscript drop in the presence of a superscript \NC \NR
\NC \type {\Umathsubtopmax} \NC the top of standalone subscripts cannot be higher than this
above the baseline \NC \NR
\NC \type {\Umathsupbottommin} \NC the bottom of standalone superscripts cannot be less than
this above the baseline \NC \NR
\NC \type {\Umathsupsubbottommax} \NC the bottom of the superscript of a combined super- and subscript
be at least as high as this above the baseline \NC \NR
\NC \type {\Umathsubsupvgap} \NC vertical clearance between super- and subscript \NC \NR
\NC \type {\Umathspaceafterscript} \NC additional space added after a super- or subscript \NC \NR
\NC \type {\Umathconnectoroverlapmin}\NC minimum overlap between parts in an extensible recipe \NC \NR
\stoptabulate
Each of the parameters in this section can be set by a command like this:
\starttyping
\Umathquad\displaystyle=1em
\stoptyping
they obey grouping, and you can use \type {\the\Umathquad\displaystyle} if
needed.
\section{Skips around display math}
The injection of \type {\abovedisplayskip} and \type {\belowdisplayskip} is not
symmetrical. An above one is always inserted, also when zero, but the below is
only inserted when larger than zero. Especially the later mkes it sometimes hard
to fully control spacing. Therefore \LUATEX\ comes with a new directive: \type
{\mathdisplayskipmode}. The following values apply:
\starttabulate
\NC 0 \NC normal \TEX\ behaviour: always above, only below when larger than zero \NC \NR
\NC 1 \NC always \NC \NR
\NC 2 \NC only when not zero \NC \NR
\NC 3 \NC never, not even when not zero \NC \NR
\stoptabulate
\section{Font-based Math Parameters}
While it is nice to have these math parameters available for tweaking, it would
be tedious to have to set each of them by hand. For this reason, \LUATEX\
initializes a bunch of these parameters whenever you assign a font identifier to
a math family based on either the traditional math font dimensions in the font
(for assignments to math family~2 and~3 using \TFM|-|based fonts like \type
{cmsy} and \type {cmex}), or based on the named values in a potential \type
{MathConstants} table when the font is loaded via Lua. If there is a \type
{MathConstants} table, this takes precedence over font dimensions, and in that
case no attention is paid to which family is being assigned to: the \type
{MathConstants} tables in the last assigned family sets all parameters.
In the table below, the one|-|letter style abbreviations and symbolic tfm font
dimension names match those using in the \TeX book. Assignments to \type
{\textfont} set the values for the cramped and uncramped display and text styles,
\type {\scriptfont} sets the script styles, and \type {\scriptscriptfont} sets
the scriptscript styles, so we have eight parameters for three font sizes. In the
\TFM\ case, assignments only happen in family~2 and family~3 (and of course only
for the parameters for which there are font dimensions).
Besides the parameters below, \LUATEX\ also looks at the \quote {space} font
dimension parameter. For math fonts, this should be set to zero.
\start
\switchtobodyfont[8pt]
\starttabulate[|l|l|l|p|]
\NC \bf variable \NC \bf style \NC \bf default value opentype \NC \bf default value tfm \NC \NR
\NC \type {\Umathaxis} \NC -- \NC AxisHeight \NC axis_height \NC \NR
\NC \type {\Umathoperatorsize} \NC D, D' \NC DisplayOperatorMinHeight \NC $^6$ \NC \NR
\NC \type {\Umathfractiondelsize} \NC D, D' \NC FractionDelimiterDisplayStyleSize$^9$ \NC delim1 \NC \NR
\NC \NC T, T', S, S', SS, SS' \NC FractionDelimiterSize$^9$ \NC delim2 \NC \NR
\NC \type {\Umathfractiondenomdown} \NC D, D' \NC FractionDenominatorDisplayStyleShiftDown \NC denom1 \NC \NR
\NC \NC T, T', S, S', SS, SS' \NC FractionDenominatorShiftDown \NC denom2 \NC \NR
\NC \type {\Umathfractiondenomvgap} \NC D, D' \NC FractionDenominatorDisplayStyleGapMin \NC 3*default_rule_thickness \NC \NR
\NC \NC T, T', S, S', SS, SS' \NC FractionDenominatorGapMin \NC default_rule_thickness \NC \NR
\NC \type {\Umathfractionnumup} \NC D, D' \NC FractionNumeratorDisplayStyleShiftUp \NC num1 \NC \NR
\NC \NC T, T', S, S', SS, SS' \NC FractionNumeratorShiftUp \NC num2 \NC \NR
\NC \type {\Umathfractionnumvgap} \NC D, D' \NC FractionNumeratorDisplayStyleGapMin \NC 3*default_rule_thickness \NC \NR
\NC \NC T, T', S, S', SS, SS' \NC FractionNumeratorGapMin \NC default_rule_thickness \NC \NR
\NC \type {\Umathfractionrule} \NC -- \NC FractionRuleThickness \NC default_rule_thickness \NC \NR
\NC \type {\Umathskewedfractionhgap} \NC -- \NC SkewedFractionHorizontalGap \NC math_quad/2 \NC \NR
\NC \type {\Umathskewedfractionvgap} \NC -- \NC SkewedFractionVerticalGap \NC math_x_height \NC \NR
\NC \type {\Umathlimitabovebgap} \NC -- \NC UpperLimitBaselineRiseMin \NC big_op_spacing3 \NC \NR
\NC \type {\Umathlimitabovekern} \NC -- \NC 0$^1$ \NC big_op_spacing5 \NC \NR
\NC \type {\Umathlimitabovevgap} \NC -- \NC UpperLimitGapMin \NC big_op_spacing1 \NC \NR
\NC \type {\Umathlimitbelowbgap} \NC -- \NC LowerLimitBaselineDropMin \NC big_op_spacing4 \NC \NR
\NC \type {\Umathlimitbelowkern} \NC -- \NC 0$^1$ \NC big_op_spacing5 \NC \NR
\NC \type {\Umathlimitbelowvgap} \NC -- \NC LowerLimitGapMin \NC big_op_spacing2 \NC \NR
\NC \type {\Umathoverdelimitervgap} \NC -- \NC StretchStackGapBelowMin \NC big_op_spacing1 \NC \NR
\NC \type {\Umathoverdelimiterbgap} \NC -- \NC StretchStackTopShiftUp \NC big_op_spacing3 \NC \NR
\NC \type {\Umathunderdelimitervgap} \NC-- \NC StretchStackGapAboveMin \NC big_op_spacing2 \NC \NR
\NC \type {\Umathunderdelimiterbgap} \NC-- \NC StretchStackBottomShiftDown \NC big_op_spacing4 \NC \NR
\NC \type {\Umathoverbarkern} \NC -- \NC OverbarExtraAscender \NC default_rule_thickness \NC \NR
\NC \type {\Umathoverbarrule} \NC -- \NC OverbarRuleThickness \NC default_rule_thickness \NC \NR
\NC \type {\Umathoverbarvgap} \NC -- \NC OverbarVerticalGap \NC 3*default_rule_thickness \NC \NR
\NC \type {\Umathquad} \NC -- \NC <font_size(f)>$^1$ \NC math_quad \NC \NR
\NC \type {\Umathradicalkern} \NC -- \NC RadicalExtraAscender \NC default_rule_thickness \NC \NR
\NC \type {\Umathradicalrule} \NC -- \NC RadicalRuleThickness \NC <not set>$^2$ \NC \NR
\NC \type {\Umathradicalvgap} \NC D, D' \NC RadicalDisplayStyleVerticalGap \NC (default_rule_thickness+\crlf
(abs(math_x_height)/4))$^3$ \NC \NR
\NC \NC T, T', S, S', SS, SS' \NC RadicalVerticalGap \NC (default_rule_thickness+\crlf
(abs(default_rule_thickness)/4))$^3$ \NC \NR
\NC \type {\Umathradicaldegreebefore} \NC -- \NC RadicalKernBeforeDegree \NC <not set>$^2$ \NC \NR
\NC \type {\Umathradicaldegreeafter} \NC -- \NC RadicalKernAfterDegree \NC <not set>$^2$ \NC \NR
\NC \type {\Umathradicaldegreeraise} \NC -- \NC RadicalDegreeBottomRaisePercent \NC <not set>$^{2,7}$ \NC \NR
\NC \type {\Umathspaceafterscript} \NC -- \NC SpaceAfterScript \NC script_space$^4$ \NC \NR
\NC \type {\Umathstackdenomdown} \NC D, D' \NC StackBottomDisplayStyleShiftDown \NC denom1 \NC \NR
\NC \NC T, T', S, S', SS, SS' \NC StackBottomShiftDown \NC denom2 \NC \NR
\NC \type {\Umathstacknumup} \NC D, D' \NC StackTopDisplayStyleShiftUp \NC num1 \NC \NR
\NC \NC T, T', S, S', SS, SS' \NC StackTopShiftUp \NC num3 \NC \NR
\NC \type {\Umathstackvgap} \NC D, D' \NC StackDisplayStyleGapMin \NC 7*default_rule_thickness \NC \NR
\NC \NC T, T', S, S', SS, SS' \NC StackGapMin \NC 3*default_rule_thickness \NC \NR
\NC \type {\Umathsubshiftdown} \NC -- \NC SubscriptShiftDown \NC sub1 \NC \NR
\NC \type {\Umathsubshiftdrop} \NC -- \NC SubscriptBaselineDropMin \NC sub_drop \NC \NR
\NC \type {\Umathsubsupshiftdown} \NC -- \NC SubscriptShiftDownWithSuperscript$^8$ \NC \NC \NR
\NC \NC \NC \quad\ or SubscriptShiftDown \NC sub2 \NC \NR
\NC \type {\Umathsubtopmax} \NC -- \NC SubscriptTopMax \NC (abs(math_x_height * 4) / 5) \NC \NR
\NC \type {\Umathsubsupvgap} \NC -- \NC SubSuperscriptGapMin \NC 4*default_rule_thickness \NC \NR
\NC \type {\Umathsupbottommin} \NC -- \NC SuperscriptBottomMin \NC (abs(math_x_height) / 4) \NC \NR
\NC \type {\Umathsupshiftdrop} \NC -- \NC SuperscriptBaselineDropMax \NC sup_drop \NC \NR
\NC \type {\Umathsupshiftup} \NC D \NC SuperscriptShiftUp \NC sup1 \NC \NR
\NC \NC T, S, SS, \NC SuperscriptShiftUp \NC sup2 \NC \NR
\NC \NC D', T', S', SS' \NC SuperscriptShiftUpCramped \NC sup3 \NC \NR
\NC \type {\Umathsupsubbottommax} \NC -- \NC SuperscriptBottomMaxWithSubscript \NC (abs(math_x_height * 4) / 5) \NC \NR
\NC \type {\Umathunderbarkern} \NC -- \NC UnderbarExtraDescender \NC default_rule_thickness \NC \NR
\NC \type {\Umathunderbarrule} \NC -- \NC UnderbarRuleThickness \NC default_rule_thickness \NC \NR
\NC \type {\Umathunderbarvgap} \NC -- \NC UnderbarVerticalGap \NC 3*default_rule_thickness \NC \NR
\NC \type {\Umathconnectoroverlapmin} \NC -- \NC MinConnectorOverlap \NC 0$^5$ \NC \NR
\stoptabulate
\stop
Note 1: \OPENTYPE\ fonts set \type {\Umathlimitabovekern} and \type
{\Umathlimitbelowkern} to zero and set \type {\Umathquad} to the font size of the
used font, because these are not supported in the \type {MATH} table,
Note 2: Traditional \TFM\ fonts do not set \type {\Umathradicalrule} because
\TEX82\ uses the height of the radical instead. When this parameter is indeed not
set when \LUATEX\ has to typeset a radical, a backward compatibility mode will
kick in that assumes that an oldstyle \TEX\ font is used. Also, they do not set
\type {\Umathradicaldegreebefore}, \type {\Umathradicaldegreeafter}, and \type
{\Umathradicaldegreeraise}. These are then automatically initialized to
$5/18$quad, $-10/18$quad, and 60.
Note 3: If \TFM\ fonts are used, then the \type {\Umathradicalvgap} is not set
until the first time \LUATEX\ has to typeset a formula because this needs
parameters from both family~2 and family~3. This provides a partial backward
compatibility with \TEX82, but that compatibility is only partial: once the \type
{\Umathradicalvgap} is set, it will not be recalculated any more.
Note 4: When \TFM\ fonts are used a similar situation arises with respect to
\type {\Umathspaceafterscript}: it is not set until the first time \LUATEX\ has
to typeset a formula. This provides some backward compatibility with \TEX82. But
once the \type {\Umathspaceafterscript} is set, \type {\scriptspace} will never
be looked at again.
Note 5: Traditional \TFM\ fonts set \type {\Umathconnectoroverlapmin} to zero
because \TEX82\ always stacks extensibles without any overlap.
Note 6: The \type {\Umathoperatorsize} is only used in \type {\displaystyle}, and
is only set in \OPENTYPE\ fonts. In \TFM\ font mode, it is artificially set to
one scaled point more than the initial attempt's size, so that always the \quote
{first next} will be tried, just like in \TEX82.
Note 7: The \type {\Umathradicaldegreeraise} is a special case because it is the
only parameter that is expressed in a percentage instead of as a number of scaled
points.
Note 8: \type {SubscriptShiftDownWithSuperscript} does not actually exist in the
\quote {standard} \OPENTYPE\ math font Cambria, but it is useful enough to be
added.
Note 9: \type {FractionDelimiterDisplayStyleSize} and \type
{FractionDelimiterSize} do not actually exist in the \quote {standard} \OPENTYPE\
math font Cambria, but were useful enough to be added.
\section{Math spacing setting}
Besides the parameters mentioned in the previous sections, there are also 64 new
primitives to control the math spacing table (as explained in Chapter~18 of the
\TEX book). The primitive names are a simple matter of combining two math atom
types, but for completeness' sake, here is the whole list:
\starttwocolumns
\starttyping
\Umathordordspacing
\Umathordopspacing
\Umathordbinspacing
\Umathordrelspacing
\Umathordopenspacing
\Umathordclosespacing
\Umathordpunctspacing
\Umathordinnerspacing
\Umathopordspacing
\Umathopopspacing
\Umathopbinspacing
\Umathoprelspacing
\Umathopopenspacing
\Umathopclosespacing
\Umathoppunctspacing
\Umathopinnerspacing
\Umathbinordspacing
\Umathbinopspacing
\Umathbinbinspacing
\Umathbinrelspacing
\Umathbinopenspacing
\Umathbinclosespacing
\Umathbinpunctspacing
\Umathbininnerspacing
\Umathrelordspacing
\Umathrelopspacing
\Umathrelbinspacing
\Umathrelrelspacing
\Umathrelopenspacing
\Umathrelclosespacing
\Umathrelpunctspacing
\Umathrelinnerspacing
\Umathopenordspacing
\Umathopenopspacing
\Umathopenbinspacing
\Umathopenrelspacing
\Umathopenopenspacing
\Umathopenclosespacing
\Umathopenpunctspacing
\Umathopeninnerspacing
\Umathcloseordspacing
\Umathcloseopspacing
\Umathclosebinspacing
\Umathcloserelspacing
\Umathcloseopenspacing
\Umathcloseclosespacing
\Umathclosepunctspacing
\Umathcloseinnerspacing
\Umathpunctordspacing
\Umathpunctopspacing
\Umathpunctbinspacing
\Umathpunctrelspacing
\Umathpunctopenspacing
\Umathpunctclosespacing
\Umathpunctpunctspacing
\Umathpunctinnerspacing
\Umathinnerordspacing
\Umathinneropspacing
\Umathinnerbinspacing
\Umathinnerrelspacing
\Umathinneropenspacing
\Umathinnerclosespacing
\Umathinnerpunctspacing
\Umathinnerinnerspacing
\stoptyping
\stoptwocolumns
These parameters are of type \type {\muskip}, so setting a parameter can be done
like this:
\starttyping
\Umathopordspacing\displaystyle=4mu plus 2mu
\stoptyping
They are all initialized by \type {initex} to the values mentioned in the table
in Chapter~18 of the \TEX book.
Note 1: for ease of use as well as for backward compatibility, \type
{\thinmuskip}, \type {\medmuskip} and \type {\thickmuskip} are treated
especially. In their case a pointer to the corresponding internal parameter is
saved, not the actual \type {\muskip} value. This means that any later changes to
one of these three parameters will be taken into account.
Note 2: Careful readers will realise that there are also primitives for the items
marked \type {*} in the \TEX book. These will not actually be used as those
combinations of atoms cannot actually happen, but it seemed better not to break
orthogonality. They are initialized to zero.
\section[mathacc]{Math accent handling}
\LUATEX\ supports both top accents and bottom accents in math mode, and math
accents stretch automatically (if this is supported by the font the accent comes
from, of course). Bottom and combined accents as well as fixed-width math accents
are controlled by optional keywords following \type {\Umathaccent}.
The keyword \type {bottom} after \type {\Umathaccent} signals that a bottom accent
is needed, and the keyword \type {both} signals that both a top and a bottom
accent are needed (in this case two accents need to be specified, of course).
Then the set of three integers defining the accent is read. This set of integers
can be prefixed by the \type {fixed} keyword to indicate that a non-stretching
variant is requested (in case of both accents, this step is repeated).
A simple example:
\starttyping
\Umathaccent both fixed 0 0 "20D7 fixed 0 0 "20D7 {example}
\stoptyping
If a math top accent has to be placed and the accentee is a character and has a
non-zero \type {top_accent} value, then this value will be used to place the
accent instead of the \type {\skewchar} kern used by \TEX82.
The \type {top_accent} value represents a vertical line somewhere in the
accentee. The accent will be shifted horizontally such that its own \type
{top_accent} line coincides with the one from the accentee. If the \type
{top_accent} value of the accent is zero, then half the width of the accent
followed by its italic correction is used instead.
The vertical placement of a top accent depends on the \type {x_height} of the
font of the accentee (as explained in the \TEX book), but if value that turns out
to be zero and the font had a \type {MathConstants} table, then \type
{AccentBaseHeight} is used instead.
The vertical placement of a bottom accent is straight below the accentee, no
correction takes place.
Possible locations are \type {top}, \type {bottom}, \type {both} and \type
{center}. When no location is given \type {top} is assumed. An additional
parameter \type {fraction} can be specified followed by a number; a value of for
instance 1200 means that the criterium is 1.2 times the width of the nuclues. The
fraction only applies to the stepwise selected shapes and is mostly meant for the
\type {overlay} location. It also works for the other locations but then it
concerns the width.
\section{Math root extension}
The new primitive \type {\Uroot} allows the construction of a radical noad
including a degree field. Its syntax is an extension of \type {\Uradical}:
\starttyping
\Uradical <fam integer> <char integer> <radicand>
\Uroot <fam integer> <char integer> <degree> <radicand>
\stoptyping
The placement of the degree is controlled by the math parameters \type
{\Umathradicaldegreebefore}, \type {\Umathradicaldegreeafter}, and \type
{\Umathradicaldegreeraise}. The degree will be typeset in \type
{\scriptscriptstyle}.
\section{Math kerning in super- and subscripts}
The character fields in a \LUA|-|loaded \OPENTYPE\ math font can have a \quote
{mathkern} table. The format of this table is the same as the \quote {mathkern}
table that is returned by the \type {fontloader} library, except that all height
and kern values have to be specified in actual scaled points.
When a super- or subscript has to be placed next to a math item, \LUATEX\ checks
whether the super- or subscript and the nucleus are both simple character items.
If they are, and if the fonts of both character items are \OPENTYPE\ fonts (as
opposed to legacy \TEX\ fonts), then \LUATEX\ will use the \OPENTYPE\ math
algorithm for deciding on the horizontal placement of the super- or subscript.
This works as follows:
\startitemize
\startitem
The vertical position of the script is calculated.
\stopitem
\startitem
The default horizontal position is flat next to the base character.
\stopitem
\startitem
For superscripts, the italic correction of the base character is added.
\stopitem
\startitem
For a superscript, two vertical values are calculated: the bottom of the
script (after shifting up), and the top of the base. For a subscript, the two
values are the top of the (shifted down) script, and the bottom of the base.
\stopitem
\startitem
For each of these two locations:
\startitemize
\startitem
find the math kern value at this height for the base (for a subscript
placement, this is the bottom_right corner, for a superscript
placement the top_right corner)
\stopitem
\startitem
find the math kern value at this height for the script (for a
subscript placement, this is the top_left corner, for a superscript
placement the bottom_left corner)
\stopitem
\startitem
add the found values together to get a preliminary result.
\stopitem
\stopitemize
\stopitem
\startitem
The horizontal kern to be applied is the smallest of the two results from
previous step.
\stopitem
\stopitemize
The math kern value at a specific height is the kern value that is specified by the
next higher height and kern pair, or the highest one in the character (if there is no
value high enough in the character), or simply zero (if the character has no math kern
pairs at all).
\section{Scripts on horizontally extensible items like arrows}
The primitives \type {\Uunderdelimiter} and \type {\Uoverdelimiter} allow the
placement of a subscript or superscript on an automatically extensible item and
\type {\Udelimiterunder} and \type {\Udelimiterover} allow the placement of an
automatically extensible item as a subscript or superscript on a nucleus. The
input:
% these produce radical noads .. in fact the code base has the numbers wrong for
% quite a while, so no one seems to use this
\startbuffer
$\Uoverdelimiter 0 "2194 {\hbox{\strut overdelimiter}}$
$\Uunderdelimiter 0 "2194 {\hbox{\strut underdelimiter}}$
$\Udelimiterover 0 "2194 {\hbox{\strut delimiterover}}$
$\Udelimiterunder 0 "2194 {\hbox{\strut delimiterunder}}$
\stopbuffer
\typebuffer will render this:
\blank \startnarrower \getbuffer \stopnarrower \blank
The vertical placements are controlled by \type {\Umathunderdelimiterbgap}, \type
{\Umathunderdelimitervgap}, \type {\Umathoverdelimiterbgap}, and \type
{\Umathoverdelimitervgap} in a similar way as limit placements on large operators.
The superscript in \type {\Uoverdelimiter} is typeset in a suitable scripted style,
the subscript in \type {\Uunderdelimiter} is cramped as well.
These primitives accepts an option \type {width} specification. When used the
also optional keywords \type {left}, \type {middle} and \type {right} will
determine what happens when a requested size can't be met (which can happen when
we step to successive larger variants).
An extra primitive \type {\Uhextensible} is available that can be used like this:
\startbuffer
$\Uhextensible width 10cm 0 "2194$
\stopbuffer
\typebuffer This will render this:
\blank \startnarrower \getbuffer \stopnarrower \blank
Here you can also pass options, like:
\startbuffer
$\Uhextensible width 1pt middle 0 "2194$
\stopbuffer
\typebuffer This gives:
\blank \startnarrower \getbuffer \stopnarrower \blank
\LUATEX\ internally uses a structure that supports \OPENTYPE\ \quote
{MathVariants} as well as \TFM\ \quote {extensible recipes}. In most cases where
font metrics are involved we have a different code path for traditional fonts end
\OPENTYPE\ fonts.
\section {Extracting values}
You can extract the components of a math character. Say that we have defined:
\starttyping
\Umathcode 1 2 3 4
\stoptyping
then
\starttyping
[\Umathcharclass1] [\Umathcharfam1] [\Umathcharslot1]
\stoptyping
will return:
\starttyping
[2] [3] [4]
\stoptyping
These commands are provides as convenience. Before they came available you could
do the following:
\starttyping
\def\Umathcharclass{\directlua{tex.print(tex.getmathcode(token.scan_int())[1])}}
\def\Umathcharfam {\directlua{tex.print(tex.getmathcode(token.scan_int())[2])}}
\def\Umathcharslot {\directlua{tex.print(tex.getmathcode(token.scan_int())[3])}}
\stoptyping
\section{fractions}
The \type {\abovewithdelims} command accepts a keyword \type {exact}. When issued
the extra space relative to the rule thickness is not added. One can of course
use the \type {\Umathfraction..gap} commands to influence the spacing. Also the
rule is still positioned around the math axis.
\starttyping
$$ { {a} \abovewithdelims() exact 4pt {b} }$$
\stoptyping
The math parameter table contains some parameters that specify a horizontal and
vertical gap for skewed fractions. Of course some guessing is needed in order to
implement something that uses them. And so we now provide a primitive similar to the
other fraction related ones but with a few options so that one can influence the
rendering. Of course a user can also mess around a bit with the parameters
\type {\Umathskewedfractionhgap} and \type {\Umathskewedfractionvgap}.
The syntax used here is:
\starttyping
{ {1} \Uskewed / <options> {2} }
{ {1} \Uskewedwithdelims / () <options> {2} }
\stoptyping
where the options can be \type {noaxis} and \type {exact}. By default we add half
the axis to the shifts and by default we zero the width of the middle character.
For Latin Modern The result looks as follows:
\def\ShowA#1#2#3{$x + { {#1} \Uskewed / #3 {#2} } + x$}
\def\ShowB#1#2#3{$x + { {#1} \Uskewedwithdelims / () #3 {#2} } + x$}
\start
\switchtobodyfont[modern]
\starttabulate[||||||]
\NC \NC
\ShowA{a}{b}{} \NC
\ShowA{1}{2}{} \NC
\ShowB{a}{b}{} \NC
\ShowB{1}{2}{} \NC
\NR
\NC \type{exact} \NC
\ShowA{a}{b}{exact} \NC
\ShowA{1}{2}{exact} \NC
\ShowB{a}{b}{exact} \NC
\ShowB{1}{2}{exact} \NC
\NR
\NC \type{noaxis} \NC
\ShowA{a}{b}{noaxis} \NC
\ShowA{1}{2}{noaxis} \NC
\ShowB{a}{b}{noaxis} \NC
\ShowB{1}{2}{noaxis} \NC
\NR
\NC \type{exact noaxis} \NC
\ShowA{a}{b}{exact noaxis} \NC
\ShowA{1}{2}{exact noaxis} \NC
\ShowB{a}{b}{exact noaxis} \NC
\ShowB{1}{2}{exact noaxis} \NC
\NR
\stoptabulate
\stop
\section {Other Math changes}
\subsection {Verbose versions of single-character math commands}
\LUATEX\ defines six new primitives that have the same function as
\type {^}, \type {_}, \type {$}, and \type {$$}: %$
\starttabulate[|l|l|l|l|]
\NC \bf primitive \NC \bf explanation \NC \NR
\NC \type {\Usuperscript} \NC Duplicates the functionality of \type {^} \NC \NR
\NC \type {\Usubscript} \NC Duplicates the functionality of \type {_} \NC \NR
\NC \type {\Ustartmath} \NC Duplicates the functionality of \type {$}, % $
when used in non-math mode. \NC \NR
\NC \type {\Ustopmath} \NC Duplicates the functionality of \type {$}, % $
when used in inline math mode. \NC \NR
\NC \type {\Ustartdisplaymath} \NC Duplicates the functionality of \type {$$}, % $$
when used in non-math mode. \NC \NR
\NC \type {\Ustopdisplaymath} \NC Duplicates the functionality of \type {$$}, % $$
when used in display math mode. \NC \NR
\stoptabulate
The \type {\Ustopmath} and \type {\Ustopdisplaymath} primitives check if the current
math mode is the correct one (inline vs.\ displayed), but you can freely intermix
the four mathon|/|mathoff commands with explicit dollar sign(s).
\subsection{Allowed math commands in non-math modes}
The commands \type {\mathchar}, and \type {\Umathchar} and control sequences that
are the result of \type {\mathchardef} or \type {\Umathchardef} are also
acceptable in the horizontal and vertical modes. In those cases, the \type
{\textfont} from the requested math family is used.
\section{Math surrounding skips}
Inline math is surrounded by (optional) \type {\mathsurround} spacing but that is fixed
dimension. There is now an additional parameter \type {\mathsurroundskip}. When set to a
non|-|zero value (or zero with some stretch or shrink) this parameter will replace
\type {\mathsurround}. By using an additional parameter instead of changing the nature
of \type {\mathsurround}, we can remain compatible.
% \section{Math todo}
%
% The following items are still todo.
%
% \startitemize
% \startitem
% Pre-scripts.
% \stopitem
% \startitem
% Multi-story stacks.
% \stopitem
% \startitem
% Flattened accents for high characters (maybe).
% \stopitem
% \startitem
% Better control over the spacing around displays and handling of equation numbers.
% \stopitem
% \startitem
% Support for multi|-|line displays using \MATHML\ style alignment points.
% \stopitem
% \stopitemize
\subsection {Delimiters: \type{\Uleft}, \type {\Umiddle} and \type {\Uright}}
Normally you will force delimiters to certain sizes by putting an empty box or
rule next to it. The resulting delimiter will either be a character from the
stepwise size range or an extensible. The latter can be quite differently
positioned that the characters as it depends on the fit as well as the fact if
the used characters in the font have depth or height. Commands like (plain \TEX
s) \type {\big} need use this feature. In \LUATEX\ we provide a bit more control
by three variants that supporting optional parameters \type {height}, \type
{depth} and \type {axis}. The following example uses this:
\startbuffer
\Uleft height 30pt depth 10pt \Udelimiter "0 "0 "000028
\quad x\quad
\Umiddle height 40pt depth 15pt \Udelimiter "0 "0 "002016
\quad x\quad
\Uright height 30pt depth 10pt \Udelimiter "0 "0 "000029
\quad \quad \quad
\Uleft height 30pt depth 10pt axis \Udelimiter "0 "0 "000028
\quad x\quad
\Umiddle height 40pt depth 15pt axis \Udelimiter "0 "0 "002016
\quad x\quad
\Uright height 30pt depth 10pt axis \Udelimiter "0 "0 "000029
\stopbuffer
\typebuffer
\startlinecorrection
\ruledhbox{\mathematics{\getbuffer}}
\stoplinecorrection
The keyword \type {exact} can be used as directive that the real dimensions
should be applied when the criteria can't be met which can happen when we're
still stepping through the successively larger variants. When no dimensions are
given the \type {noaxis} command can be used to prevent shifting over the axis.
You can influence the final class with the keyword \type {class} which will
influence the spacing.
\subsection{Fixed scripts}
We have three parameters that are used for this fixed anchoring:
\starttabulate[|l|l|]
\NC $d$ \NC \type {\Umathsubshiftdown} \NC \NR
\NC $u$ \NC \type {\Umathsupshiftup} \NC \NR
\NC $s$ \NC \type {\Umathsubsupshiftdown} \NC \NR
\stoptabulate
When we set \type {\mathscriptsmode} to a value other than zero these are used
for calculating fixed positions. This is something that is needed for instance
for chemistry. You can manipulate the mentioned variables to achive different
effects.
\def\SampleMath#1%
{$\mathscriptsmode#1\mathupright CH_2 + CH^+_2 + CH^2_2$}
\starttabulate[|c|c|c|l|]
\NC \bf mode \NC \bf down \NC \bf up \NC \NC \NR
\NC 0 \NC dynamic \NC dynamic \NC \SampleMath{0} \NC \NR
\NC 1 \NC $d$ \NC $u$ \NC \SampleMath{1} \NC \NR
\NC 2 \NC $s$ \NC $u$ \NC \SampleMath{2} \NC \NR
\NC 3 \NC $s$ \NC $u + s - d$ \NC \SampleMath{3} \NC \NR
\NC 4 \NC $d + (s-d)/2$ \NC $u + (s-d)/2$ \NC \SampleMath{4} \NC \NR
\NC 5 \NC $d$ \NC $u + s - d$ \NC \SampleMath{5} \NC \NR
\stoptabulate
The value of this parameter obeys grouping but applies to the whole current
formula.
% if needed we can put the value in stylenodes but maybe more should go there
\subsection {Tracing}
Because there are quite some math related parameters and values, it is possible
to limit tracing. Only when \type {tracingassigns} and|/|or \type
{tracingrestores} are set to~2 or more they will be traced.
\subsection {Math options}
The logic in the math engine is rather complex and there are often no universal
solutions (read: what works out well for one font, fails for another). Therefore
some variations in the implementation will be driven by options for which a new
primitive \type {\mathoption} has been introduced (so that we don't end up with
many new commands). The approach of options also permits us to see what effect a
specific solution has.
\subsubsection {\type {\mathoption noitaliccompensation}}
This option compensates placement for characters with a built|-|in italic
correction.
\startbuffer
{\showboxes\int}\quad
{\showboxes\int_{|}^{|}}\quad
{\showboxes\int\limits_{|}^{|}}
\stopbuffer
\typebuffer
Gives (with computer modern that has such italics):
\startlinecorrection[blank]
\switchtobodyfont[modern]
\startcombination[nx=2,ny=2,distance=5em]
{\mathoption noitaliccompensation 0\relax \mathematics{\getbuffer}}
{\nohyphens\type{0:inline}}
{\mathoption noitaliccompensation 0\relax \mathematics{\displaymath\getbuffer}}
{\nohyphens\type{0:display}}
{\mathoption noitaliccompensation 1\relax \mathematics{\getbuffer}}
{\nohyphens\type{1:inline}}
{\mathoption noitaliccompensation 1\relax \mathematics{\displaymath\getbuffer}}
{\nohyphens\type{1:display}}
\stopcombination
\stoplinecorrection
\subsubsection {\type {\mathoption nocharitalic}}
When two characters follow each other italic correction can interfere. The
following example shows what this option does:
\startbuffer
\catcode"1D443=11
\catcode"1D444=11
\catcode"1D445=11
P( PP PQR
\stopbuffer
\typebuffer
Gives (with computer modern that has such italics):
\startlinecorrection[blank]
\switchtobodyfont[modern]
\startcombination[nx=2,ny=2,distance=5em]
{\mathoption nocharitalic 0\relax \mathematics{\getbuffer}}
{\nohyphens\type{0:inline}}
{\mathoption nocharitalic 0\relax \mathematics{\displaymath\getbuffer}}
{\nohyphens\type{0:display}}
{\mathoption nocharitalic 1\relax \mathematics{\getbuffer}}
{\nohyphens\type{1:inline}}
{\mathoption nocharitalic 1\relax \mathematics{\displaymath\getbuffer}}
{\nohyphens\type{1:display}}
\stopcombination
\stoplinecorrection
\subsubsection {\type {\mathoption useoldfractionscaling}}
This option has been introduced as solution for tracker item 604 for fuzzy cases
around either or not present fraction related settings for new fonts.
\stopchapter
\stopcomponent
|