math-tricks.tex /size: 25 Kb    last modification: 2021-10-28 13:50
1% language=us runpath=texruns:manuals/math
2
3\environment math-layout
4
5\startcomponent math-tricks
6
7\startchapter[title=Tricks]
8
9\startsection[title=Introduction]
10
11Math support in \CONTEXT\ is wrapped around basic \TEX\ primitives and
12unfortunately not all we want is easy to configure. This is not surprising
13because the original ideas behind \TEX\ are that one makes a style per book and a
14one macro package \quote {we-can-do-it-all} approach is not what Don Knuth had in
15mind at that time.
16
17So, for instance support for configurable spacing per math element, coloring of
18specific (sub) elements, simple switching of whatever combination of alignments
19and number placement, these all take quite a bit of code and hackery.
20
21Even configuring something seemingly trivial as fractions or top, bottom, left,
22middle and right fences take some effort. This is because the engine uses
23information from fonts to combine shapes and paste the content and ornaments to
24together.
25
26For that reason already in \MKII\ but more extensively in \MKIV\ we did a lot of
27these things in wrapper macros. When the math renderer was finalized for
28\OPENTYPE\ math some extra control was added that can make these things easier.
29However, because we go a bit beyond what is possible using this new functionality
30these new mechanisms are not yet used in \MKIV, but they might be eventually.
31Here we just show some of the (newer) low level trickery. For details about what
32was already possible in pure \TEX, we refer to the ultimate references: the \TeX
33book (by Donald Knuth) and \TeX\ by Topic (by Victor Eijkhout).
34
35\stopsection
36
37\startsection[title=Kerning]
38
39Kerning in \OPENTYPE\ math is not the same as in traditional \TEX: instead of a
40single value, we have staircase kerns, that is, depending on the location (left
41or right) and the vertical position, at discrete distances between depth and
42height. In addition there is italic correction but that is only applied in
43certain cases, one of which is the script location.
44
45Unfortunately not all fonts follow the same route. Some fonts have a true width
46and a moderate italic correction is added to it (of at all), while other fonts
47lie about the width and depend on an excessive italic correction to compensate
48for that.
49
50\definemeasure[quarter][\dimexpr(\textwidth-3em)/4\relax]
51
52\def\TestKern#1%
53  {\scale
54     [width=\measure{quarter}]
55     {\hbox to 50pt{\hss\showboxes\switchtobodyfont[#1]$V_i^i = W_i^i$\hss}}}
56
57\startlinecorrection
58\startcombination[nx=4,ny=2,distance=1em]
59    {\TestKern  {modern}} {\infofont  modern}
60    {\TestKern {cambria}} {\infofont cambria}
61    {\TestKern{lucidaot}} {\infofont  lucida}
62    {\TestKern  {dejavu}} {\infofont  dejavu}
63    {\TestKern {pagella}} {\infofont pagella}
64    {\TestKern  {termes}} {\infofont  termes}
65    {\TestKern   {bonum}} {\infofont   bonum}
66    {\TestKern  {schola}} {\infofont  schola}
67\stopcombination
68\stoplinecorrection
69
70I will not discuss the details because when a font gets updated, it might look
71better or worse. These fonts were loaded with the following directive set:
72
73\starttyping
74\enabledirectives[fontgoodies.mathkerning]
75\stoptyping
76
77An example of a fontgoodie that fixed the kerning is \type {pagella-math.lfg}. Here
78is the relevant bit:
79
80\starttyping
81local kern_200 = { bottomright = { { kern = -200 } } }
82local kern_100 = { bottomright = { { kern = -100 } } }
83
84return {
85  .....
86  mathematics = {
87    .....
88    kerns = {
89      [0x1D449] = kern_200, -- 𝑉
90      [0x1D44A] = kern_100, -- 𝑊
91    },
92    .....
93  }
94}
95\stoptyping
96
97This fixes the real bad kerning of Pagella Math which at least in 2017 was not
98(yet) fixed. When the fonts are frozen we can start makling permanent runtime
99fixes like this.
100
101\stopsection
102
103\startsection[title=Primes]
104
105Primes are a pain in the butt. The reason for this is that they are independent
106characters on the one hand but can be seen as a superscript on the other. Let's
107first look at the symbols at the three sizes that are used in math.
108
109\startbuffer[prime]
110$
111    {\textstyle        \char"2032}
112    {\scriptstyle      \char"2032}
113    {\scriptscriptstyle\char"2032}
114\quad
115    {\textstyle        \char"FE931}
116    {\scriptstyle      \char"FE931}
117    {\scriptscriptstyle\char"FE931}
118\quad
119    {\textstyle        \char"FE932}
120    {\scriptstyle      \char"FE932}
121    {\scriptscriptstyle\char"FE932}
122$
123\stopbuffer
124
125\typebuffer[prime]
126
127We blow up the characters a bit and get this:
128
129\startlinecorrection
130\scale[scale=5000]{\showglyphs\inlinebuffer[prime]}
131\stoplinecorrection
132
133\def\TestPrime#1%
134  {\scale
135     [width=\measure{quarter}]
136     {\ruledhbox to 65pt{%
137       \hss
138       \showglyphs
139       \switchtobodyfont[#1]%
140       \inlinebuffer[prime]%
141       \hss}}}
142
143The first set is the normal prime character scaled to the text, script and
144scriptscriptsize. The second set shows the characters (at three sizes) as they
145are in the font. The largest character is raised while the other two are closer
146to the baseline. In some fonts the smaller sizes arenot smaller at all. The last
147set is a variant of the the first set but we made them into virtual characters
148with a displacement and different dimensions. Those are the ones we use as
149primes.
150
151\startlinecorrection
152\startcombination[nx=4,ny=2,distance=1em]
153    {\TestPrime  {modern}} {\infofont  modern}
154    {\TestPrime {cambria}} {\infofont cambria}
155    {\TestPrime{lucidaot}} {\infofont  lucida}
156    {\TestPrime  {dejavu}} {\infofont  dejavu}
157    {\TestPrime {pagella}} {\infofont pagella}
158    {\TestPrime  {termes}} {\infofont  termes}
159    {\TestPrime   {bonum}} {\infofont   bonum}
160    {\TestPrime  {schola}} {\infofont  schola}
161\stopcombination
162\stoplinecorrection
163
164Next we show how primes show up in real math. The examples
165explain themselves.
166
167\startbuffer
168{\textstyle         f = g} \quad
169{\scriptstyle       f = g} \quad
170{\scriptscriptstyle f = g}
171\stopbuffer
172
173\typebuffer
174
175\startlinecorrection
176\scale[scale=2000]{\showglyphs$\inlinebuffer$}
177\stoplinecorrection
178
179\startbuffer
180{\textstyle         f_i' = g_i'} \quad
181{\scriptstyle       f_i' = g_i'} \quad
182{\scriptscriptstyle f_i' = g_i'}
183\stopbuffer
184
185\typebuffer
186
187\startlinecorrection
188\scale[scale=2000]{\showglyphs$\inlinebuffer$}
189\stoplinecorrection
190
191\startbuffer
192{\textstyle         f^{\char"2032}(0) = g^{\char"2032}(0)} \quad
193{\scriptstyle       f^{\char"2032}(0) = g^{\char"2032}(0)} \quad
194{\scriptscriptstyle f^{\char"2032}(0) = g^{\char"2032}(0)}
195\stopbuffer
196
197\typebuffer
198
199\startlinecorrection
200\scale[scale=2000]{\showglyphs$\inlinebuffer$}
201\stoplinecorrection
202
203\startbuffer
204{\textstyle         f'(0) = g'(0)} \quad
205{\scriptstyle       f'(0) = g'(0)} \quad
206{\scriptscriptstyle f'(0) = g'(0)}
207\stopbuffer
208
209\typebuffer
210
211\startlinecorrection
212\scale[scale=2000]{\showglyphs$\inlinebuffer$}
213\stoplinecorrection
214
215\startbuffer
216{\textstyle         f^{\char"2032}(0) = g^{\char"2032}(0)} \quad
217{\scriptstyle       f^{\char"2032}(0) = g^{\char"2032}(0)} \quad
218{\scriptscriptstyle f^{\char"2032}(0) = g^{\char"2032}(0)}
219\stopbuffer
220
221\typebuffer
222
223\startlinecorrection
224\scale[scale=2000]{\showglyphs$\inlinebuffer$}
225\stoplinecorrection
226
227\startbuffer
228{\textstyle         f^{\char"2032}(0) = g^{\char"2032}(0)} \quad
229{\scriptstyle       f^{\char"2032}(0) = g^{\char"2032}(0)} \quad
230{\scriptscriptstyle f^{\char"2032}(0) = g^{\char"2032}(0)}
231\stopbuffer
232
233\typebuffer
234
235\startlinecorrection
236\scale[scale=2000]{\showglyphs$\inlinebuffer$}
237\stoplinecorrection
238
239The prime analyzer can deal with sizes, subscripts but also converts a sequence
240of upright quotes into one unicode symbol. So,
241
242\startbuffer
243f'_i \neq f''_i \neq f'''_i \neq f''''_i
244\stopbuffer
245
246\typebuffer
247
248becomes:
249
250\startlinecorrection
251\scale[scale=4000]{\showglyphs$\inlinebuffer$}
252\stoplinecorrection
253
254\stopsection
255
256\startsection[title=Radicals]
257
258Sometimes users complain about the look of a radical symbol. This is however a matter
259of design. Some fonts let the shape start more below the baseline than others. Soem go
260more straight up than relatives in another font. When largers sizes are needed, some
261fonts offer smaller than others. Just look at the different desings:
262
263\def\TestRadical#1%
264  {\NC
265     \type{#1}\blackrule[width=0pt,height=2.5ex,depth=2ex]\NC
266     \switchtobodyfont[#1]\scale[scale=2000]{\showglyphs$\surd   $}\NC
267     \switchtobodyfont[#1]\scale[scale=2000]{\showglyphs$\sqrt{} $}\NC
268     \switchtobodyfont[#1]\scale[scale=2000]{\showglyphs$\sqrt{.}$}\NC
269     \switchtobodyfont[#1]\scale[scale=2000]{\showglyphs$\sqrt{x}$}\NC
270     \switchtobodyfont[#1]\scale[scale=2000]{\showglyphs$\surd \sqrt{} \sqrt{.} \sqrt{x}$}\NC
271   \NR}
272
273\starttabulate[|l|c|c|c|c|c|]
274    \NC \NC \type{\surd} \NC \type{\sqrt{}} \NC \type{\sqrt{.}} \NC \type{\sqrt{x}} \NC \NR
275    \TestRadical{modern}
276    \TestRadical{cambria}
277    \TestRadical{lucidaot}
278    \TestRadical{dejavu}
279    \TestRadical{pagella}
280    \TestRadical{termes}
281    \TestRadical{bonum}
282    \TestRadical{schola}
283\stoptabulate
284
285The automatic scaling doesn't always work out as expected but on the average is
286okay. Keep in mind that often the content is not that extreme.
287
288\def\TestRadical#1%
289  {\NC
290     \type{#1}\NC
291     \switchtobodyfont[#1]\showglyphs$\sqrt{\blackrule[width=1em,height=1.0ex,color=darkgray]}$\NC
292     \switchtobodyfont[#1]\showglyphs$\sqrt{\blackrule[width=1em,height=1.5ex,color=darkgray]}$\NC
293     \switchtobodyfont[#1]\showglyphs$\sqrt{\blackrule[width=1em,height=2.0ex,color=darkgray]}$\NC
294     \switchtobodyfont[#1]\showglyphs$\sqrt{\blackrule[width=1em,height=2.5ex,color=darkgray]}$\NC
295     \switchtobodyfont[#1]\showglyphs$\sqrt{\blackrule[width=1em,height=3.0ex,color=darkgray]}$\NC
296     \switchtobodyfont[#1]\showglyphs$\sqrt{\blackrule[width=1em,height=3.5ex,color=darkgray]}$\NC
297     \switchtobodyfont[#1]\showglyphs$\sqrt{\blackrule[width=1em,height=4.0ex,color=darkgray]}$\NC
298     \switchtobodyfont[#1]\showglyphs$\sqrt{\blackrule[width=1em,height=4.5ex,color=darkgray]}$\NC
299   \NR}
300
301\starttabulate[|l|c|c|c|c|c|c|c|c|]
302    \NC \NC 1.0ex \NC 1.5ex \NC 2.0ex \NC 2.5ex \NC 3.0ex \NC 3.5ex \NC 4.0ex \NC 4.5ex \NC \NR
303    \TestRadical{modern}
304    \TestRadical{cambria}
305    \TestRadical{lucidaot}
306    \TestRadical{dejavu}
307    \TestRadical{pagella}
308    \TestRadical{termes}
309    \TestRadical{bonum}
310    \TestRadical{schola}
311\stoptabulate
312
313In Lucida (the version at the time of writing this) we have to correct the threshold
314a bit in the goodie file:
315
316\starttyping
317local function FixRadicalDisplayStyleVerticalGap(value,target,original)
318  local o = original.mathparameters.RadicalVerticalGap -- 50
319  return 2 * o * target.parameters.factor
320end
321
322return {
323  .....
324  mathematics = {
325    .....
326    parameters = {
327      RadicalDisplayStyleVerticalGap =
328        FixRadicalDisplayStyleVerticalGap,
329    },
330    .....
331  },
332}
333\stoptyping
334
335\stopsection
336
337\startsection[title=Integrals]
338
339{\em This section needs to be adapted to extensible integrals.}
340
341A curious exception in the math system is the integral sign. Its companions are
342the summation and product signs, but integral has as extra property that it has a
343slant. In \LUATEX\ there is rather advanced control over how the (optional)
344scripts are positioned (which relates to italic correction) but in \CONTEXT\ we
345only make limited use of that. The main reason is that we also need to support
346additional features like color. Therefore integrals are handled by the extensible
347mechanism.
348
349The size of an integral is more of less fixed but you can enlarge to your
350liking. One reason for this is that you might want a consistent size across
351formulas. Let's use the following setup:
352
353\startbuffer[setup]
354% \setupmathextensible
355\setupmathdelimiter
356  [integral]
357  [rightoffset=-1mu,
358   exact=yes,
359   factor=2]
360\stopbuffer
361
362\typebuffer[setup]
363
364We use the following exmaple:
365
366\startbuffer[demo]
367\ruledhbox{$\integral                  f\frac{1}{2}           $}\quad
368\ruledhbox{$\integral[rightoffset=3mu] f\frac{1}{2}           $}\quad
369\ruledhbox{$\integral[exact=no]        f\frac{1}{2}           $}\quad
370\ruledhbox{$\integral                  f\frac{\frac{1}{2}}{x} $}\quad
371\ruledhbox{$\integral[exact=no]        f\frac{\frac{1}{2}}{x} $}\quad
372\ruledhbox{$\integral[factor=1]        f\frac{1}{2}           $}\quad
373\ruledhbox{$\integral[factor=3]        f\frac{\frac{1}{2}}{x} $}\quad
374\ruledhbox{$\integral[factor=3]        f\frac{1}{2}           $}\quad
375\ruledhbox{$\int                       f\frac{1}{2}           $}% bonus
376\stopbuffer
377
378\typebuffer[demo]
379
380This renders as:
381
382\pushoverloadmode
383
384\dontleavehmode\hbox{\getbuffer[setup,demo]}
385
386\popoverloadmode
387
388\stopsection
389
390\startsection[title=Fancy fences]
391
392Here I only show an example of fences drawn by \METAPOST. For the implementation
393you can consult the library file \type {meta-imp-mat.mkiv} in the \CONTEXT\
394distribution.
395
396\startbuffer[setup]
397\useMPlibrary[mat]
398
399\setupmathstackers
400  [both] % vfenced]
401  [color=darkred,
402   alternative=mp]
403
404\setupmathstackers
405  [top]
406  [color=darkred,
407   alternative=mp]
408
409\setupmathstackers
410  [bottom]
411  [color=darkred,
412   alternative=mp]
413\stopbuffer
414
415\typebuffer[setup]
416
417We keep the demo simple:
418
419\startbuffer[demo]
420$ \overbracket     {a+b+c+d} \quad
421  \underbracket    {a+b+c+d} \quad
422  \doublebracket   {a+b+c+d} \quad
423  \overparent      {a+b+c+d} \quad
424  \underparent     {a+b+c+d} \quad
425  \doubleparent    {a+b+c+d} $ \blank
426$ \overbrace       {a+b+c+d} \quad
427  \underbrace      {a+b+c+d} \quad
428  \doublebrace     {a+b+c+d} \quad
429  \overbar         {a+b+c+d} \quad
430  \underbar        {a+b+c+d} \quad
431  \doublebar       {a+b+c+d} $ \blank
432$ \overleftarrow   {a+b+c+d} \quad
433  \overrightarrow  {a+b+c+d} \quad
434  \underleftarrow  {a+b+c+d} \quad
435  \underrightarrow {a+b+c+d} $ \blank
436\stopbuffer
437
438\typebuffer[demo]
439
440Or visualized:
441
442\start
443\getbuffer[setup,demo]
444\stop
445
446\stopsection
447
448\startsection[title=Combined characters]
449
450We have some magic built with respect to sequences of characters. They are derived
451from information in the character database that ships with \CONTEXT\ and are
452implemented as a sort of ligatures. Some are defined in \UNICODE, others are
453defined explicitly.
454
455\usemodule[math-ligatures]
456
457\start
458    \switchtobodyfont[small]
459    \showmathligatures
460\stop
461
462\stopsection
463
464\startsection[title=Middle class fences]
465
466The next examples are somewhat obscure. They are a side effect of some extensions
467to the engine that were introduced to control spacing around the \type {\middle}
468class fences. Actually there is no real middle class and spacing was somewhat
469hard codes when \type {\middle} was added to \ETEX. In \LUATEX\ we have
470introduced keywords to some primitives that control spacing and other properties.
471This permits better control over spacing than messing around with (for instance)
472injected \type {\mathrel} commands that can have their own side effects.
473
474\startbuffer
475\def\Middle{\middle|}
476\def\Riddle{\Umiddle class 5 |}
477\def\Left  {\left  (}
478\def\Right {\right )}
479\def\Rel   {\mathrel{}}
480\def\Per   {\mathrel{.}}
481\stopbuffer
482
483\startbuffer[1a]
484$          a                b          $
485\stopbuffer
486\startbuffer[1b]
487$     \Rel a\Rel            b\Rel      $
488\stopbuffer
489
490\startbuffer[2a]
491$          a                b          $
492\stopbuffer
493\startbuffer[2b]
494$     \Per a\Per            b\Per      $
495\stopbuffer
496
497\startbuffer[3a]
498$\Left     a    \Middle     b    \Right$
499\stopbuffer
500\startbuffer[3b]
501$\Left\Rel a    \Middle\Rel b\Rel\Right$
502\stopbuffer
503
504\startbuffer[4a]
505$\Left     a    \Middle     b    \Right$
506\stopbuffer
507\startbuffer[4b]
508$\Left\Rel a    \Middle\Per b\Per\Right$
509\stopbuffer
510
511\startbuffer[5a]
512$\Left     a    \Middle     b    \Right$
513\stopbuffer
514\startbuffer[5b]
515$\Left\Rel a\Rel\Middle\Rel b\Rel\Right$
516\stopbuffer
517
518\startbuffer[6a]
519$\Left     a    \Middle     b    \Right$
520\stopbuffer
521\startbuffer[6b]
522$\Left\Per a\Per\Middle\Per b\Per\Right$
523\stopbuffer
524
525\startbuffer[7a]
526$\Left     a    \Riddle     b    \Right$
527\stopbuffer
528\startbuffer[7b]
529$\Left\Rel a    \Riddle\Rel b\Rel\Right$
530\stopbuffer
531
532\startbuffer[8a]
533$\Left     a    \Riddle     b    \Right$
534\stopbuffer
535\startbuffer[8b]
536$\Left\Rel a    \Riddle\Per b\Per\Right$
537\stopbuffer
538
539\startbuffer[9a]
540$\Left     a    \Riddle     b    \Right$
541\stopbuffer
542\startbuffer[9b]
543$\Left\Rel a\Rel\Riddle\Rel b\Rel\Right$
544\stopbuffer
545
546\startbuffer[10a]
547$\Left     a    \Riddle     b    \Right$
548\stopbuffer
549\startbuffer[10b]
550$\Left\Per a\Per\Riddle\Per b\Per\Right$
551\stopbuffer
552
553We use the following definitions:
554
555\typebuffer
556
557Applied to samples these give the following outcome and spacing:
558
559\start
560    \getbuffer
561
562    \starttabulate
563        \NC \ruledhbox{\typeinlinebuffer[1a]}  \NC \showglyphs \inlinebuffer[1a]  \NC \NR
564        \NC \ruledhbox{\typeinlinebuffer[1b]}  \NC \showglyphs \inlinebuffer[1b]  \NC \NR
565        \NC \ruledhbox{\typeinlinebuffer[2a]}  \NC \showglyphs \inlinebuffer[2a]  \NC \NR
566        \NC \ruledhbox{\typeinlinebuffer[2b]}  \NC \showglyphs \inlinebuffer[2b]  \NC \NR
567        \NC \ruledhbox{\typeinlinebuffer[3a]}  \NC \showglyphs \inlinebuffer[3a]  \NC \NR
568        \NC \ruledhbox{\typeinlinebuffer[3b]}  \NC \showglyphs \inlinebuffer[3b]  \NC \NR
569        \NC \ruledhbox{\typeinlinebuffer[4a]}  \NC \showglyphs \inlinebuffer[4a]  \NC \NR
570        \NC \ruledhbox{\typeinlinebuffer[4b]}  \NC \showglyphs \inlinebuffer[4b]  \NC \NR
571        \NC \ruledhbox{\typeinlinebuffer[5a]}  \NC \showglyphs \inlinebuffer[5a]  \NC \NR
572        \NC \ruledhbox{\typeinlinebuffer[5b]}  \NC \showglyphs \inlinebuffer[5b]  \NC \NR
573        \NC \ruledhbox{\typeinlinebuffer[6a]}  \NC \showglyphs \inlinebuffer[6a]  \NC \NR
574        \NC \ruledhbox{\typeinlinebuffer[6b]}  \NC \showglyphs \inlinebuffer[6b]  \NC \NR
575        \NC \ruledhbox{\typeinlinebuffer[7a]}  \NC \showglyphs \inlinebuffer[7a]  \NC \NR
576        \NC \ruledhbox{\typeinlinebuffer[7b]}  \NC \showglyphs \inlinebuffer[7b]  \NC \NR
577        \NC \ruledhbox{\typeinlinebuffer[8a]}  \NC \showglyphs \inlinebuffer[8a]  \NC \NR
578        \NC \ruledhbox{\typeinlinebuffer[8b]}  \NC \showglyphs \inlinebuffer[8b]  \NC \NR
579        \NC \ruledhbox{\typeinlinebuffer[9a]}  \NC \showglyphs \inlinebuffer[9a]  \NC \NR
580        \NC \ruledhbox{\typeinlinebuffer[9b]}  \NC \showglyphs \inlinebuffer[9b]  \NC \NR
581        \NC \ruledhbox{\typeinlinebuffer[10a]} \NC \showglyphs \inlinebuffer[10a] \NC \NR
582        \NC \ruledhbox{\typeinlinebuffer[10b]} \NC \showglyphs \inlinebuffer[10b] \NC \NR
583    \stoptabulate
584\stop
585
586\stopsection
587
588\startsection[title=Auto|-|punctuation]
589
590\def\TestA#1#2#3%
591  {\ifnum#1=0 \type{#2}\else\setupmathematics[autopunctuation={#2}]$#3$\fi}
592
593\def\TestB#1#2%
594  {\NC \TestA{#1}{no}           {#2}
595   \NC \TestA{#1}{yes}          {#2}
596   \NC \TestA{#1}{yes,semicolon}{#2}
597   \NC \TestA{#1}{all}          {#2}
598   \NC \TestA{#1}{all,semicolon}{#2}
599   \NC \NR}
600
601The \type {\setupmathematics} command has an option \type {autopunctuation} that
602influences the way spacing after punctuatuon is handled, especially in cases like
603the following (coordinates and such):
604
605\starttabulate[|c|c|c|c|c|]
606   \TestB{0}{}
607   \TestB{1}{(1,2)=(1, 2)}
608   \TestB{1}{(1.2)=(1. 2)}
609   \TestB{1}{(1;2)=(1; 2)}
610\stoptabulate
611
612\stopsection
613
614\stopcomponent
615
616% \enabletrackers[math.makeup=boxes]
617
618% \startTEXpage[offset=10pt]
619%     $\displaystyle      {{1}\normalover{2}}+x$\quad $\crampeddisplaystyle     {{1}\normalover{2}}+x$\blank
620%     $\textstyle         {{1}\normalover{2}}+x$\quad $\crampedtextstyle        {{1}\normalover{2}}+x$\blank
621%     $\scriptstyle       {{1}\normalover{2}}+x$\quad $\crampedscriptstyle      {{1}\normalover{2}}+x$\blank
622%     $\scriptscriptstyle {{1}\normalover{2}}+x$\quad $\crampedscriptscriptstyle{{1}\normalover{2}}+x$\blank
623% \stopTEXpage
624
625% \startTEXpage[offset=10pt]
626%     $e=mc^2$
627% \stopTEXpage
628
629% \startTEXpage[offset=10pt]
630%     $\sqrt{\frac{1}{2}+x}$
631% \stopTEXpage
632
633% \startTEXpage[offset=10pt]
634%     $\int^0_1{\frac{1}{2}+x}$
635% \stopTEXpage
636
637% \startTEXpage[offset=10pt]
638%     $\displaystyle\the\everydisplay\int^0_1{\frac{1}{2}+x}$
639% \stopTEXpage
640
641% \startbuffer
642% ${}^2_2x^3_4 {}^2x_4$
643% \stopbuffer
644
645% % d : \Umathsubshiftdown
646% % u : \Umathsupshiftup
647% % s : \Umathsubsupshiftdown
648
649% \startTEXpage[offset=10pt]
650%     \starttabulate[|T||cT|cT|]
651%         \NC 0 \NC \mathscriptsmode 0 \inlinebuffer \NC dynamic       \NC dynamic       \NC \NR \TB
652%         \NC 1 \NC \mathscriptsmode 1 \inlinebuffer \NC d             \NC u             \NC \NR \TB
653%         \NC 2 \NC \mathscriptsmode 2 \inlinebuffer \NC s             \NC u             \NC \NR \TB
654%         \NC 3 \NC \mathscriptsmode 3 \inlinebuffer \NC s             \NC u + s − d     \NC \NR \TB
655%         \NC 4 \NC \mathscriptsmode 4 \inlinebuffer \NC d + (s − d)/2 \NC u + (s − d)/2 \NC \NR \TB
656%         \NC 5 \NC \mathscriptsmode 5 \inlinebuffer \NC d             \NC u + s − d     \NC \NR
657%     \stoptabulate
658% \stopTEXpage
659
660% \startTEXpage[offset=10pt] \tt
661%     \starttabulate[|l|ck1|ck1|ck1|ck1|ck1|ck1|]
662%         \NC
663%             \NC \mathnolimitsmode0    $\displaystyle\int\nolimits^0_1$
664%             \NC \mathnolimitsmode1    $\displaystyle\int\nolimits^0_1$
665%             \NC \mathnolimitsmode2    $\displaystyle\int\nolimits^0_1$
666%             \NC \mathnolimitsmode3    $\displaystyle\int\nolimits^0_1$
667%             \NC \mathnolimitsmode4    $\displaystyle\int\nolimits^0_1$
668%             \NC \mathnolimitsmode8000 $\displaystyle\int\nolimits^0_1$
669%         \NC \NR
670%         \TB
671%         \NC \bf mode
672%             \NC 0
673%             \NC 1
674%             \NC 2
675%             \NC 3
676%             \NC 4
677%             \NC 8000
678%         \NC \NR
679%         \NC \bf superscript
680%             \NC 0
681%             \NC font
682%             \NC 0
683%             \NC 0
684%             \NC +ic/2
685%             \NC 0
686%         \NC \NR
687%         \NC \bf subscript
688%             \NC -ic
689%             \NC font
690%             \NC 0
691%             \NC -ic/2
692%             \NC -ic/2
693%             \NC 8000ic/1000
694%         \NC \NR
695%     \stoptabulate
696% \stopTEXpage
697
698{ } \bgroup \egroup \begingroup \endgroup
699
700\startbuffer[1]
701    [a:\mathstyle]\quad
702    \bgroup
703    \mathchoice
704        {\bf \scriptstyle       (x:d :\mathstyle)}
705        {\bf \scriptscriptstyle (x:t :\mathstyle)}
706        {\bf \scriptscriptstyle (x:s :\mathstyle)}
707        {\bf \scriptscriptstyle (x:ss:\mathstyle)}
708    \egroup
709    \quad[b:\mathstyle]\quad
710    \mathchoice
711        {\bf \scriptstyle       (y:d :\mathstyle)}
712        {\bf \scriptscriptstyle (y:t :\mathstyle)}
713        {\bf \scriptscriptstyle (y:s :\mathstyle)}
714        {\bf \scriptscriptstyle (y:ss:\mathstyle)}
715    \quad[c:\mathstyle]\quad
716    \bgroup
717    \mathchoice
718        {\bf \scriptstyle       (z:d :\mathstyle)}
719        {\bf \scriptscriptstyle (z:t :\mathstyle)}
720        {\bf \scriptscriptstyle (z:s :\mathstyle)}
721        {\bf \scriptscriptstyle (z:ss:\mathstyle)}
722    \egroup
723    \quad[d:\mathstyle]
724\stopbuffer
725
726\startbuffer[2]
727    [a:\mathstyle]\quad
728    \begingroup
729    \mathchoice
730        {\bf \scriptstyle       (x:d :\mathstyle)}
731        {\bf \scriptscriptstyle (x:t :\mathstyle)}
732        {\bf \scriptscriptstyle (x:s :\mathstyle)}
733        {\bf \scriptscriptstyle (x:ss:\mathstyle)}
734    \endgroup
735    \quad[b:\mathstyle]\quad
736    \mathchoice
737        {\bf \scriptstyle       (y:d :\mathstyle)}
738        {\bf \scriptscriptstyle (y:t :\mathstyle)}
739        {\bf \scriptscriptstyle (y:s :\mathstyle)}
740        {\bf \scriptscriptstyle (y:ss:\mathstyle)}
741    \quad[c:\mathstyle]\quad
742    \begingroup
743    \mathchoice
744        {\bf \scriptstyle       (z:d :\mathstyle)}
745        {\bf \scriptscriptstyle (z:t :\mathstyle)}
746        {\bf \scriptscriptstyle (z:s :\mathstyle)}
747        {\bf \scriptscriptstyle (z:ss:\mathstyle)}
748    \endgroup
749    \quad[d:\mathstyle]
750\stopbuffer
751
752% % \bgroup .. \egroup
753
754% \startTEXpage[offset=10pt]
755%     $\displaystyle \getbuffer[1]$ \blank
756%     $\textstyle    \getbuffer[1]$
757% \stopTEXpage
758
759% % \begingroup .. \endgroup
760
761% \startTEXpage[offset=10pt]
762%     $\displaystyle \getbuffer[2]$ \blank
763%     $\textstyle    \getbuffer[2]$
764% \stopTEXpage
765
766
767% \startTEXpage[offset=10pt]
768%     $\Uleft                           ( x \Umiddle\| \Uright                           )$
769%     $\Uleft height 3ex                ( x \Umiddle\| \Uright height 3ex                )$
770%     $\Uleft axis height 3ex           ( x \Umiddle\| \Uright axis height 3ex           )$
771%     $\Uleft axis height 3ex depth 1ex ( x \Umiddle\| \Uright axis height 3ex depth 1ex )$
772% \stopTEXpage
773
774% \startTEXpage[offset=10pt]
775%     $\Uvextensible                                 ( \frac{1}{x}$
776%     $\Uvextensible height 3ex                      ( \frac{1}{x}$
777%     $\Uvextensible axis height 3ex                 ( \frac{1}{x}$
778%     $\Uvextensible axis height 3ex depth 1ex       ( \frac{1}{x}$
779%     $\Uvextensible exact axis height 3ex depth 1ex ( \frac{1}{x}$
780% \stopTEXpage
781
782% \startTEXpage[offset=10pt]
783%     \ruledhbox{$\Uhextensible                  "0 "23DE$}
784%     \ruledhbox{$\Uhextensible        width 3ex "0 "23DE$}
785%     \ruledhbox{$\Uhextensible middle width 3ex "0 "23DE$}
786%     \ruledhbox{$\Uhextensible left   width 3ex "0 "23DE$}
787%     \ruledhbox{$\Uhextensible right  width 3ex "0 "23DE$}
788% \stopTEXpage
789
790% \startTEXpage[offset=10pt]
791%     \ruledhbox{$\Umathaccent         "0 "0 "23DE                          {1+x}$}
792%     \ruledhbox{$\Umathaccent fixed   "0 "0 "23DE                          {1+x}$}
793%     \ruledhbox{$\Umathaccent top     "0 "0 "23DE                          {1+x}$}
794%     \ruledhbox{$\Umathaccent bottom              "0 "0 "23DF              {1+x}$}
795%     \ruledhbox{$\Umathaccent both    "0 "0 "23DE "0 "0 "23DF              {1+x}$}
796%     \ruledhbox{$\Umathaccent overlay "0 "0 "23DE                          {1+x}$}
797%     \ruledhbox{$\Umathaccent top     "0 "0 "23DE             fraction 800 {1+x}$}
798% \stopTEXpage
799
800% \startTEXpage[offset=10pt]
801%     ${ {1} \Uskewed           /                   {2} }$
802%     ${ {1} \Uskewed           /     exact         {2} }$
803%     ${ {1} \Uskewed           /     noaxis        {2} }$
804%     ${ {1} \Uskewed           /     exact noaxis  {2} }$
805%     ${ {1} \Uskewedwithdelims / ()                {2} }$
806%     ${ {1} \Uskewedwithdelims / ()  exact         {2} }$
807%     ${ {1} \Uskewedwithdelims / ()  noaxis        {2} }$
808%     ${ {1} \Uskewedwithdelims / ()  exact noaxis  {2} }$
809% \stopTEXpage
810
811% \disabletrackers[math.makeup]
812
813% \stopchapter
814%
815% \stopcomponent
816
817% A \type {\matheqnogapstep} factor that determines the gap between formula and
818% equation number.
819%
820% A \type {\mathdisplayskipmode} directive that controls display skips: 1 = always,
821% 2 = only when not zero, 3 = never.
822%
823% \mathstyle
824%
825% \suppressmathparerror
826
827