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