| 1 |
% language=us engine=luatex runpath=texruns:manuals/luatex |
| 2 |
|
| 3 |
\environment luatex-style |
| 4 |
|
| 5 |
\startcomponent luatex-math |
| 6 |
|
| 7 |
\startchapter[reference=math,title={Math}] |
| 8 |
|
| 9 |
\startsection[title={Traditional alongside \OPENTYPE}] |
| 10 |
|
| 11 |
\topicindex {math} |
| 12 |
|
| 13 |
The handling of mathematics in \LUATEX\ differs quite a bit from how \TEX82 (and |
| 14 |
therefore \PDFTEX) handles math. First, \LUATEX\ adds primitives and extends some |
| 15 |
others so that \UNICODE\ input can be used easily. Second, all of \TEX82's |
| 16 |
internal special values (for example for operator spacing) have been made |
| 17 |
accessible and changeable via control sequences. Third, there are extensions that |
| 18 |
make it easier to use \OPENTYPE\ math fonts. And finally, there are some |
| 19 |
extensions that have been proposed or considered in the past that are now added |
| 20 |
to the engine. |
| 21 |
|
| 22 |
\stopsection |
| 23 |
|
| 24 |
\startsection[title={Unicode math characters}] |
| 25 |
|
| 26 |
\topicindex {math+\UNICODE} |
| 27 |
\topicindex {\UNICODE+math} |
| 28 |
|
| 29 |
Character handling is now extended up to the full \UNICODE\ range (the \type {\U} |
| 30 |
prefix), which is compatible with \XETEX. |
| 31 |
|
| 32 |
The math primitives from \TEX\ are kept as they are, except for the ones that |
| 33 |
convert from input to math commands: \type {mathcode}, and \type {delcode}. These |
| 34 |
two now allow for a 21-bit character argument on the left hand side of the equals |
| 35 |
sign. |
| 36 |
|
| 37 |
Some of the new \LUATEX\ primitives read more than one separate value. This is |
| 38 |
shown in the tables below by a plus sign. |
| 39 |
|
| 40 |
The input for such primitives would look like this: |
| 41 |
|
| 42 |
\starttyping |
| 43 |
\def\overbrace{\Umathaccent 0 1 "23DE } |
| 44 |
\stoptyping |
| 45 |
|
| 46 |
The altered \TEX82 primitives are: |
| 47 |
|
| 48 |
\starttabulate[|l|l|r|c|l|r|] |
| 49 |
\DB primitive \BC min \BC max \BC \kern 2em \BC min \BC max \NC \NR |
| 50 |
\TB |
| 51 |
\NC \prm {mathcode} \NC 0 \NC 10FFFF \NC = \NC 0 \NC 8000 \NC \NR |
| 52 |
\NC \prm {delcode} \NC 0 \NC 10FFFF \NC = \NC 0 \NC FFFFFF \NC \NR |
| 53 |
\LL |
| 54 |
\stoptabulate |
| 55 |
|
| 56 |
The unaltered ones are: |
| 57 |
|
| 58 |
\starttabulate[|l|l|r|] |
| 59 |
\DB primitive \BC min \BC max \NC \NR |
| 60 |
\TB |
| 61 |
\NC \prm {mathchardef} \NC 0 \NC 8000 \NC \NR |
| 62 |
\NC \prm {mathchar} \NC 0 \NC 7FFF \NC \NR |
| 63 |
\NC \prm {mathaccent} \NC 0 \NC 7FFF \NC \NR |
| 64 |
\NC \prm {delimiter} \NC 0 \NC 7FFFFFF \NC \NR |
| 65 |
\NC \prm {radical} \NC 0 \NC 7FFFFFF \NC \NR |
| 66 |
\LL |
| 67 |
\stoptabulate |
| 68 |
|
| 69 |
For practical reasons \prm {mathchardef} will silently accept values larger |
| 70 |
that \type {0x8000} and interpret it as \lpr {Umathcharnumdef}. This is needed |
| 71 |
to satisfy older macro packages. |
| 72 |
|
| 73 |
The following new primitives are compatible with \XETEX: |
| 74 |
|
| 75 |
% somewhat fuzzy: |
| 76 |
|
| 77 |
\starttabulate[|l|l|r|c|l|r|] |
| 78 |
\DB primitive \BC min \BC max \BC \kern 2em \BC min \BC max \NC \NR |
| 79 |
\TB |
| 80 |
\NC \lpr {Umathchardef} \NC 0+0+0 \NC 7+FF+10FFFF \NC \NC \NC \NC \NR |
| 81 |
\NC \lpr {Umathcharnumdef}\rlap{\high{5}} \NC -80000000 \NC 7FFFFFFF \NC \NC \NC \NC \NR |
| 82 |
\NC \lpr {Umathcode} \NC 0 \NC 10FFFF \NC = \NC 0+0+0 \NC 7+FF+10FFFF \NC \NR |
| 83 |
\NC \lpr {Udelcode} \NC 0 \NC 10FFFF \NC = \NC 0+0 \NC FF+10FFFF \NC \NR |
| 84 |
\NC \lpr {Umathchar} \NC 0+0+0 \NC 7+FF+10FFFF \NC \NC \NC \NC \NR |
| 85 |
\NC \lpr {Umathaccent} \NC 0+0+0 \NC 7+FF+10FFFF \NC \NC \NC \NC \NR |
| 86 |
\NC \lpr {Udelimiter} \NC 0+0+0 \NC 7+FF+10FFFF \NC \NC \NC \NC \NR |
| 87 |
\NC \lpr {Uradical} \NC 0+0 \NC FF+10FFFF \NC \NC \NC \NC \NR |
| 88 |
\NC \lpr {Umathcharnum} \NC -80000000 \NC 7FFFFFFF \NC \NC \NC \NC \NR |
| 89 |
\NC \lpr {Umathcodenum} \NC 0 \NC 10FFFF \NC = \NC -80000000 \NC 7FFFFFFF \NC \NR |
| 90 |
\NC \lpr {Udelcodenum} \NC 0 \NC 10FFFF \NC = \NC -80000000 \NC 7FFFFFFF \NC \NR |
| 91 |
\LL |
| 92 |
\stoptabulate |
| 93 |
|
| 94 |
Specifications typically look like: |
| 95 |
|
| 96 |
\starttyping |
| 97 |
\Umathchardef\xx="1"0"456 |
| 98 |
\Umathcode 123="1"0"789 |
| 99 |
\stoptyping |
| 100 |
|
| 101 |
The new primitives that deal with delimiter|-|style objects do not set up a |
| 102 |
\quote {large family}. Selecting a suitable size for display purposes is expected |
| 103 |
to be dealt with by the font via the \lpr {Umathoperatorsize} parameter. |
| 104 |
|
| 105 |
For some of these primitives, all information is packed into a single signed |
| 106 |
integer. For the first two (\lpr {Umathcharnum} and \lpr {Umathcodenum}), the |
| 107 |
lowest 21 bits are the character code, the 3 bits above that represent the math |
| 108 |
class, and the family data is kept in the topmost bits. This means that the values |
| 109 |
for math families 128--255 are actually negative. For \lpr {Udelcodenum} there |
| 110 |
is no math class. The math family information is stored in the bits directly on |
| 111 |
top of the character code. Using these three commands is not as natural as using |
| 112 |
the two- and three|-|value commands, so unless you know exactly what you are |
| 113 |
doing and absolutely require the speedup resulting from the faster input |
| 114 |
scanning, it is better to use the verbose commands instead. |
| 115 |
|
| 116 |
The \lpr {Umathaccent} command accepts optional keywords to control various |
| 117 |
details regarding math accents. See \in {section} [mathacc] below for details. |
| 118 |
|
| 119 |
There are more new primitives and all of these will be explained in following |
| 120 |
sections: |
| 121 |
|
| 122 |
\starttabulate[|l|l|] |
| 123 |
\DB primitive \BC value range (in hex) \NC \NR |
| 124 |
\TB |
| 125 |
\NC \lpr {Uroot} \NC 0 + 0--FF + 10FFFF \NC \NR |
| 126 |
\NC \lpr {Uoverdelimiter} \NC 0 + 0--FF + 10FFFF \NC \NR |
| 127 |
\NC \lpr {Uunderdelimiter} \NC 0 + 0--FF + 10FFFF \NC \NR |
| 128 |
\NC \lpr {Udelimiterover} \NC 0 + 0--FF + 10FFFF \NC \NR |
| 129 |
\NC \lpr {Udelimiterunder} \NC 0 + 0--FF + 10FFFF \NC \NR |
| 130 |
\LL |
| 131 |
\stoptabulate |
| 132 |
|
| 133 |
Instead of the pseudo class variable (7) you can use a family number as signal |
| 134 |
for using the current family. This permits classifying characters with a class |
| 135 |
and still let the family adapt. The trigger family is set with \lpr |
| 136 |
{variablefam}. So: |
| 137 |
|
| 138 |
\starttyping |
| 139 |
\variablefam"24 |
| 140 |
\Umathchardef\foo "3 "24 123 |
| 141 |
\foo \fam9 |
| 142 |
\stoptyping |
| 143 |
|
| 144 |
Results in a curly left brace taken from family 9 with class \quote {relation} |
| 145 |
and spacing around it will be accordingly. |
| 146 |
|
| 147 |
\stopsection |
| 148 |
|
| 149 |
\startsection[title={Math styles}] |
| 150 |
|
| 151 |
\subsection{\lpr {mathstyle}} |
| 152 |
|
| 153 |
\topicindex {math+styles} |
| 154 |
|
| 155 |
It is possible to discover the math style that will be used for a formula in an |
| 156 |
expandable fashion (while the math list is still being read). To make this |
| 157 |
possible, \LUATEX\ adds the new primitive: \lpr {mathstyle}. This is a \quote |
| 158 |
{convert command} like e.g. \prm {romannumeral}: its value can only be read, |
| 159 |
not set. |
| 160 |
|
| 161 |
The returned value is between 0 and 7 (in math mode), or $-1$ (all other modes). |
| 162 |
For easy testing, the eight math style commands have been altered so that they can |
| 163 |
be used as numeric values, so you can write code like this: |
| 164 |
|
| 165 |
\starttyping |
| 166 |
\ifnum\mathstyle=\textstyle |
| 167 |
\message{normal text style} |
| 168 |
\else \ifnum\mathstyle=\crampedtextstyle |
| 169 |
\message{cramped text style} |
| 170 |
\fi \fi |
| 171 |
\stoptyping |
| 172 |
|
| 173 |
Sometimes you won't get what you expect so a bit of explanation might help to |
| 174 |
understand what happens. When math is parsed and expanded it gets turned into a |
| 175 |
linked list. In a second pass the formula will be build. This has to do with the |
| 176 |
fact that in order to determine the automatically chosen sizes (in for instance |
| 177 |
fractions) following content can influence preceding sizes. A side effect of this |
| 178 |
is for instance that one cannot change the definition of a font family (and |
| 179 |
thereby reusing numbers) because the number that got used is stored and used in |
| 180 |
the second pass (so changing \type {\fam 12} mid|-|formula spoils over to |
| 181 |
preceding use of that family). |
| 182 |
|
| 183 |
The style switching primitives like \prm {textstyle} are turned into nodes so the |
| 184 |
styles set there are frozen. The \prm {mathchoice} primitive results in four |
| 185 |
lists being constructed of which one is used in the second pass. The fact that |
| 186 |
some automatic styles are not yet known also means that the \lpr {mathstyle} |
| 187 |
primitive expands to the current style which can of course be different from the |
| 188 |
one really used. It's a snapshot of the first pass state. As a consequence in the |
| 189 |
following example you get a style number (first pass) typeset that can actually |
| 190 |
differ from the used style (second pass). In the case of a math choice used |
| 191 |
ungrouped, the chosen style is used after the choice too, unless you group. |
| 192 |
|
| 193 |
\startbuffer[1] |
| 194 |
[a:\mathstyle]\quad |
| 195 |
\bgroup |
| 196 |
\mathchoice |
| 197 |
{\bf \scriptstyle (x:d :\mathstyle)} |
| 198 |
{\bf \scriptscriptstyle (x:t :\mathstyle)} |
| 199 |
{\bf \scriptscriptstyle (x:s :\mathstyle)} |
| 200 |
{\bf \scriptscriptstyle (x:ss:\mathstyle)} |
| 201 |
\egroup |
| 202 |
\quad[b:\mathstyle]\quad |
| 203 |
\mathchoice |
| 204 |
{\bf \scriptstyle (y:d :\mathstyle)} |
| 205 |
{\bf \scriptscriptstyle (y:t :\mathstyle)} |
| 206 |
{\bf \scriptscriptstyle (y:s :\mathstyle)} |
| 207 |
{\bf \scriptscriptstyle (y:ss:\mathstyle)} |
| 208 |
\quad[c:\mathstyle]\quad |
| 209 |
\bgroup |
| 210 |
\mathchoice |
| 211 |
{\bf \scriptstyle (z:d :\mathstyle)} |
| 212 |
{\bf \scriptscriptstyle (z:t :\mathstyle)} |
| 213 |
{\bf \scriptscriptstyle (z:s :\mathstyle)} |
| 214 |
{\bf \scriptscriptstyle (z:ss:\mathstyle)} |
| 215 |
\egroup |
| 216 |
\quad[d:\mathstyle] |
| 217 |
\stopbuffer |
| 218 |
|
| 219 |
\startbuffer[2] |
| 220 |
[a:\mathstyle]\quad |
| 221 |
\begingroup |
| 222 |
\mathchoice |
| 223 |
{\bf \scriptstyle (x:d :\mathstyle)} |
| 224 |
{\bf \scriptscriptstyle (x:t :\mathstyle)} |
| 225 |
{\bf \scriptscriptstyle (x:s :\mathstyle)} |
| 226 |
{\bf \scriptscriptstyle (x:ss:\mathstyle)} |
| 227 |
\endgroup |
| 228 |
\quad[b:\mathstyle]\quad |
| 229 |
\mathchoice |
| 230 |
{\bf \scriptstyle (y:d :\mathstyle)} |
| 231 |
{\bf \scriptscriptstyle (y:t :\mathstyle)} |
| 232 |
{\bf \scriptscriptstyle (y:s :\mathstyle)} |
| 233 |
{\bf \scriptscriptstyle (y:ss:\mathstyle)} |
| 234 |
\quad[c:\mathstyle]\quad |
| 235 |
\begingroup |
| 236 |
\mathchoice |
| 237 |
{\bf \scriptstyle (z:d :\mathstyle)} |
| 238 |
{\bf \scriptscriptstyle (z:t :\mathstyle)} |
| 239 |
{\bf \scriptscriptstyle (z:s :\mathstyle)} |
| 240 |
{\bf \scriptscriptstyle (z:ss:\mathstyle)} |
| 241 |
\endgroup |
| 242 |
\quad[d:\mathstyle] |
| 243 |
\stopbuffer |
| 244 |
|
| 245 |
\typebuffer[1] |
| 246 |
|
| 247 |
% \typebuffer[2] |
| 248 |
|
| 249 |
This gives: |
| 250 |
|
| 251 |
\blank $\displaystyle \getbuffer[1]$ \blank |
| 252 |
\blank $\textstyle \getbuffer[1]$ \blank |
| 253 |
|
| 254 |
Using \prm {begingroup} \unknown\ \prm {endgroup} instead gives: |
| 255 |
|
| 256 |
\blank $\displaystyle \getbuffer[2]$ \blank |
| 257 |
\blank $\textstyle \getbuffer[2]$ \blank |
| 258 |
|
| 259 |
This might look wrong but it's just a side effect of \lpr {mathstyle} expanding |
| 260 |
to the current (first pass) style and the number being injected in the list that |
| 261 |
gets converted in the second pass. It all makes sense and it illustrates the |
| 262 |
importance of grouping. In fact, the math choice style being effective afterwards |
| 263 |
has advantages. It would be hard to get it otherwise. |
| 264 |
|
| 265 |
\subsection{\lpr {Ustack}} |
| 266 |
|
| 267 |
\topicindex {math+stacks} |
| 268 |
|
| 269 |
There are a few math commands in \TEX\ where the style that will be used is not |
| 270 |
known straight from the start. These commands (\prm {over}, \prm {atop}, |
| 271 |
\prm {overwithdelims}, \prm {atopwithdelims}) would therefore normally return |
| 272 |
wrong values for \lpr {mathstyle}. To fix this, \LUATEX\ introduces a special |
| 273 |
prefix command: \lpr {Ustack}: |
| 274 |
|
| 275 |
\starttyping |
| 276 |
$\Ustack {a \over b}$ |
| 277 |
\stoptyping |
| 278 |
|
| 279 |
The \lpr {Ustack} command will scan the next brace and start a new math group |
| 280 |
with the correct (numerator) math style. |
| 281 |
|
| 282 |
\subsection{Cramped math styles} |
| 283 |
|
| 284 |
\topicindex {math+styles} |
| 285 |
\topicindex {math+spacing} |
| 286 |
\topicindex {math+cramped} |
| 287 |
|
| 288 |
\LUATEX\ has four new primitives to set the cramped math styles directly: |
| 289 |
|
| 290 |
\starttyping |
| 291 |
\crampeddisplaystyle |
| 292 |
\crampedtextstyle |
| 293 |
\crampedscriptstyle |
| 294 |
\crampedscriptscriptstyle |
| 295 |
\stoptyping |
| 296 |
|
| 297 |
These additional commands are not all that valuable on their own, but they come |
| 298 |
in handy as arguments to the math parameter settings that will be added shortly. |
| 299 |
|
| 300 |
In Eijkhouts \quotation {\TEX\ by Topic} the rules for handling styles in scripts |
| 301 |
are described as follows: |
| 302 |
|
| 303 |
\startitemize |
| 304 |
\startitem |
| 305 |
In any style superscripts and subscripts are taken from the next smaller style. |
| 306 |
Exception: in display style they are in script style. |
| 307 |
\stopitem |
| 308 |
\startitem |
| 309 |
Subscripts are always in the cramped variant of the style; superscripts are only |
| 310 |
cramped if the original style was cramped. |
| 311 |
\stopitem |
| 312 |
\startitem |
| 313 |
In an \type {..\over..} formula in any style the numerator and denominator are |
| 314 |
taken from the next smaller style. |
| 315 |
\stopitem |
| 316 |
\startitem |
| 317 |
The denominator is always in cramped style; the numerator is only in cramped |
| 318 |
style if the original style was cramped. |
| 319 |
\stopitem |
| 320 |
\startitem |
| 321 |
Formulas under a \type {\sqrt} or \prm {overline} are in cramped style. |
| 322 |
\stopitem |
| 323 |
\stopitemize |
| 324 |
|
| 325 |
In \LUATEX\ one can set the styles in more detail which means that you sometimes |
| 326 |
have to set both normal and cramped styles to get the effect you want. (Even) if |
| 327 |
we force styles in the script using \prm {scriptstyle} and \lpr |
| 328 |
{crampedscriptstyle} we get this: |
| 329 |
|
| 330 |
\startbuffer[demo] |
| 331 |
\starttabulate |
| 332 |
\DB style \BC example \NC \NR |
| 333 |
\TB |
| 334 |
\NC default \NC $b_{x=xx}^{x=xx}$ \NC \NR |
| 335 |
\NC script \NC $b_{\scriptstyle x=xx}^{\scriptstyle x=xx}$ \NC \NR |
| 336 |
\NC crampedscript \NC $b_{\crampedscriptstyle x=xx}^{\crampedscriptstyle x=xx}$ \NC \NR |
| 337 |
\LL |
| 338 |
\stoptabulate |
| 339 |
\stopbuffer |
| 340 |
|
| 341 |
\getbuffer[demo] |
| 342 |
|
| 343 |
Now we set the following parameters |
| 344 |
|
| 345 |
\startbuffer[setup] |
| 346 |
\Umathordrelspacing\scriptstyle=30mu |
| 347 |
\Umathordordspacing\scriptstyle=30mu |
| 348 |
\stopbuffer |
| 349 |
|
| 350 |
\typebuffer[setup] |
| 351 |
|
| 352 |
This gives a different result: |
| 353 |
|
| 354 |
\start\getbuffer[setup,demo]\stop |
| 355 |
|
| 356 |
But, as this is not what is expected (visually) we should say: |
| 357 |
|
| 358 |
\startbuffer[setup] |
| 359 |
\Umathordrelspacing\scriptstyle=30mu |
| 360 |
\Umathordordspacing\scriptstyle=30mu |
| 361 |
\Umathordrelspacing\crampedscriptstyle=30mu |
| 362 |
\Umathordordspacing\crampedscriptstyle=30mu |
| 363 |
\stopbuffer |
| 364 |
|
| 365 |
\typebuffer[setup] |
| 366 |
|
| 367 |
Now we get: |
| 368 |
|
| 369 |
\start\getbuffer[setup,demo]\stop |
| 370 |
|
| 371 |
\stopsection |
| 372 |
|
| 373 |
\startsection[title={Math parameter settings}] |
| 374 |
|
| 375 |
\subsection {Many new \lpr {Umath*} primitives} |
| 376 |
|
| 377 |
\topicindex {math+parameters} |
| 378 |
|
| 379 |
In \LUATEX, the font dimension parameters that \TEX\ used in math typesetting are |
| 380 |
now accessible via primitive commands. In fact, refactoring of the math engine |
| 381 |
has resulted in many more parameters than were not accessible before. |
| 382 |
|
| 383 |
\starttabulate |
| 384 |
\DB primitive name \BC description \NC \NR |
| 385 |
\TB |
| 386 |
\NC \lpr {Umathquad} \NC the width of 18 mu's \NC \NR |
| 387 |
\NC \lpr {Umathaxis} \NC height of the vertical center axis of |
| 388 |
the math formula above the baseline \NC \NR |
| 389 |
\NC \lpr {Umathoperatorsize} \NC minimum size of large operators in display mode \NC \NR |
| 390 |
\NC \lpr {Umathoverbarkern} \NC vertical clearance above the rule \NC \NR |
| 391 |
\NC \lpr {Umathoverbarrule} \NC the width of the rule \NC \NR |
| 392 |
\NC \lpr {Umathoverbarvgap} \NC vertical clearance below the rule \NC \NR |
| 393 |
\NC \lpr {Umathunderbarkern} \NC vertical clearance below the rule \NC \NR |
| 394 |
\NC \lpr {Umathunderbarrule} \NC the width of the rule \NC \NR |
| 395 |
\NC \lpr {Umathunderbarvgap} \NC vertical clearance above the rule \NC \NR |
| 396 |
\NC \lpr {Umathradicalkern} \NC vertical clearance above the rule \NC \NR |
| 397 |
\NC \lpr {Umathradicalrule} \NC the width of the rule \NC \NR |
| 398 |
\NC \lpr {Umathradicalvgap} \NC vertical clearance below the rule \NC \NR |
| 399 |
\NC \lpr {Umathradicaldegreebefore}\NC the forward kern that takes place before placement of |
| 400 |
the radical degree \NC \NR |
| 401 |
\NC \lpr {Umathradicaldegreeafter} \NC the backward kern that takes place after placement of |
| 402 |
the radical degree \NC \NR |
| 403 |
\NC \lpr {Umathradicaldegreeraise} \NC this is the percentage of the total height and depth of |
| 404 |
the radical sign that the degree is raised by; it is |
| 405 |
expressed in \type {percents}, so 60\% is expressed as the |
| 406 |
integer $60$ \NC \NR |
| 407 |
\NC \lpr {Umathstackvgap} \NC vertical clearance between the two |
| 408 |
elements in a \prm {atop} stack \NC \NR |
| 409 |
\NC \lpr {Umathstacknumup} \NC numerator shift upward in \prm {atop} stack \NC \NR |
| 410 |
\NC \lpr {Umathstackdenomdown} \NC denominator shift downward in \prm {atop} stack \NC \NR |
| 411 |
\NC \lpr {Umathfractionrule} \NC the width of the rule in a \prm {over} \NC \NR |
| 412 |
\NC \lpr {Umathfractionnumvgap} \NC vertical clearance between the numerator and the rule \NC \NR |
| 413 |
\NC \lpr {Umathfractionnumup} \NC numerator shift upward in \prm {over} \NC \NR |
| 414 |
\NC \lpr {Umathfractiondenomvgap} \NC vertical clearance between the denominator and the rule \NC \NR |
| 415 |
\NC \lpr {Umathfractiondenomdown} \NC denominator shift downward in \prm {over} \NC \NR |
| 416 |
\NC \lpr {Umathfractiondelsize} \NC minimum delimiter size for \type {\...withdelims} \NC \NR |
| 417 |
\NC \lpr {Umathlimitabovevgap} \NC vertical clearance for limits above operators \NC \NR |
| 418 |
\NC \lpr {Umathlimitabovebgap} \NC vertical baseline clearance for limits above operators \NC \NR |
| 419 |
\NC \lpr {Umathlimitabovekern} \NC space reserved at the top of the limit \NC \NR |
| 420 |
\NC \lpr {Umathlimitbelowvgap} \NC vertical clearance for limits below operators \NC \NR |
| 421 |
\NC \lpr {Umathlimitbelowbgap} \NC vertical baseline clearance for limits below operators \NC \NR |
| 422 |
\NC \lpr {Umathlimitbelowkern} \NC space reserved at the bottom of the limit \NC \NR |
| 423 |
\NC \lpr {Umathoverdelimitervgap} \NC vertical clearance for limits above delimiters \NC \NR |
| 424 |
\NC \lpr {Umathoverdelimiterbgap} \NC vertical baseline clearance for limits above delimiters \NC \NR |
| 425 |
\NC \lpr {Umathunderdelimitervgap} \NC vertical clearance for limits below delimiters \NC \NR |
| 426 |
\NC \lpr {Umathunderdelimiterbgap} \NC vertical baseline clearance for limits below delimiters \NC \NR |
| 427 |
\NC \lpr {Umathsubshiftdrop} \NC subscript drop for boxes and subformulas \NC \NR |
| 428 |
\NC \lpr {Umathsubshiftdown} \NC subscript drop for characters \NC \NR |
| 429 |
\NC \lpr {Umathsupshiftdrop} \NC superscript drop (raise, actually) for boxes and subformulas \NC \NR |
| 430 |
\NC \lpr {Umathsupshiftup} \NC superscript raise for characters \NC \NR |
| 431 |
\NC \lpr {Umathsubsupshiftdown} \NC subscript drop in the presence of a superscript \NC \NR |
| 432 |
\NC \lpr {Umathsubtopmax} \NC the top of standalone subscripts cannot be higher than this |
| 433 |
above the baseline \NC \NR |
| 434 |
\NC \lpr {Umathsupbottommin} \NC the bottom of standalone superscripts cannot be less than |
| 435 |
this above the baseline \NC \NR |
| 436 |
\NC \lpr {Umathsupsubbottommax} \NC the bottom of the superscript of a combined super- and subscript |
| 437 |
be at least as high as this above the baseline \NC \NR |
| 438 |
\NC \lpr {Umathsubsupvgap} \NC vertical clearance between super- and subscript \NC \NR |
| 439 |
\NC \lpr {Umathspaceafterscript} \NC additional space added after a super- or subscript \NC \NR |
| 440 |
\NC \lpr {Umathconnectoroverlapmin}\NC minimum overlap between parts in an extensible recipe \NC \NR |
| 441 |
\LL |
| 442 |
\stoptabulate |
| 443 |
|
| 444 |
Each of the parameters in this section can be set by a command like this: |
| 445 |
|
| 446 |
\starttyping |
| 447 |
\Umathquad\displaystyle=1em |
| 448 |
\stoptyping |
| 449 |
|
| 450 |
they obey grouping, and you can use \type {\the\Umathquad\displaystyle} if |
| 451 |
needed. |
| 452 |
|
| 453 |
\subsection{Font|-|based math parameters} |
| 454 |
|
| 455 |
\topicindex {math+parameters} |
| 456 |
|
| 457 |
While it is nice to have these math parameters available for tweaking, it would |
| 458 |
be tedious to have to set each of them by hand. For this reason, \LUATEX\ |
| 459 |
initializes a bunch of these parameters whenever you assign a font identifier to |
| 460 |
a math family based on either the traditional math font dimensions in the font |
| 461 |
(for assignments to math family~2 and~3 using \TFM|-|based fonts like \type |
| 462 |
{cmsy} and \type {cmex}), or based on the named values in a potential \type |
| 463 |
{MathConstants} table when the font is loaded via Lua. If there is a \type |
| 464 |
{MathConstants} table, this takes precedence over font dimensions, and in that |
| 465 |
case no attention is paid to which family is being assigned to: the \type |
| 466 |
{MathConstants} tables in the last assigned family sets all parameters. |
| 467 |
|
| 468 |
In the table below, the one|-|letter style abbreviations and symbolic tfm font |
| 469 |
dimension names match those used in the \TeX book. Assignments to \prm |
| 470 |
{textfont} set the values for the cramped and uncramped display and text styles, |
| 471 |
\prm {scriptfont} sets the script styles, and \prm {scriptscriptfont} sets the |
| 472 |
scriptscript styles, so we have eight parameters for three font sizes. In the |
| 473 |
\TFM\ case, assignments only happen in family~2 and family~3 (and of course only |
| 474 |
for the parameters for which there are font dimensions). |
| 475 |
|
| 476 |
Besides the parameters below, \LUATEX\ also looks at the \quote {space} font |
| 477 |
dimension parameter. For math fonts, this should be set to zero. |
| 478 |
|
| 479 |
\def\MathLine#1#2#3#4#5% |
| 480 |
{\TB |
| 481 |
\NC \llap{\high{\tx #2\enspace}}\ttbf \string #1 \NC \tt #5 \NC \NR |
| 482 |
\NC \tx #3 \NC \tt #4 \NC \NR} |
| 483 |
|
| 484 |
\starttabulate[|l|l|] |
| 485 |
\DB variable / style \BC tfm / opentype \NC \NR |
| 486 |
\MathLine{\Umathaxis} {} {} {AxisHeight} {axis_height} |
| 487 |
\MathLine{\Umathoperatorsize} {6} {D, D'} {DisplayOperatorMinHeight} {\emdash} |
| 488 |
\MathLine{\Umathfractiondelsize} {9} {D, D'} {FractionDelimiterDisplayStyleSize} {delim1} |
| 489 |
\MathLine{\Umathfractiondelsize} {9} {T, T', S, S', SS, SS'}{FractionDelimiterSize} {delim2} |
| 490 |
\MathLine{\Umathfractiondenomdown} {} {D, D'} {FractionDenominatorDisplayStyleShiftDown}{denom1} |
| 491 |
\MathLine{\Umathfractiondenomdown} {} {T, T', S, S', SS, SS'}{FractionDenominatorShiftDown} {denom2} |
| 492 |
\MathLine{\Umathfractiondenomvgap} {} {D, D'} {FractionDenominatorDisplayStyleGapMin} {3*default_rule_thickness} |
| 493 |
\MathLine{\Umathfractiondenomvgap} {} {T, T', S, S', SS, SS'}{FractionDenominatorGapMin} {default_rule_thickness} |
| 494 |
\MathLine{\Umathfractionnumup} {} {D, D'} {FractionNumeratorDisplayStyleShiftUp} {num1} |
| 495 |
\MathLine{\Umathfractionnumup} {} {T, T', S, S', SS, SS'}{FractionNumeratorShiftUp} {num2} |
| 496 |
\MathLine{\Umathfractionnumvgap} {} {D, D'} {FractionNumeratorDisplayStyleGapMin} {3*default_rule_thickness} |
| 497 |
\MathLine{\Umathfractionnumvgap} {} {T, T', S, S', SS, SS'}{FractionNumeratorGapMin} {default_rule_thickness} |
| 498 |
\MathLine{\Umathfractionrule} {} {} {FractionRuleThickness} {default_rule_thickness} |
| 499 |
\MathLine{\Umathskewedfractionhgap} {} {} {SkewedFractionHorizontalGap} {math_quad/2} |
| 500 |
\MathLine{\Umathskewedfractionvgap} {} {} {SkewedFractionVerticalGap} {math_x_height} |
| 501 |
\MathLine{\Umathlimitabovebgap} {} {} {UpperLimitBaselineRiseMin} {big_op_spacing3} |
| 502 |
\MathLine{\Umathlimitabovekern} {1} {} {0} {big_op_spacing5} |
| 503 |
\MathLine{\Umathlimitabovevgap} {} {} {UpperLimitGapMin} {big_op_spacing1} |
| 504 |
\MathLine{\Umathlimitbelowbgap} {} {} {LowerLimitBaselineDropMin} {big_op_spacing4} |
| 505 |
\MathLine{\Umathlimitbelowkern} {1} {} {0} {big_op_spacing5} |
| 506 |
\MathLine{\Umathlimitbelowvgap} {} {} {LowerLimitGapMin} {big_op_spacing2} |
| 507 |
\MathLine{\Umathoverdelimitervgap} {} {} {StretchStackGapBelowMin} {big_op_spacing1} |
| 508 |
\MathLine{\Umathoverdelimiterbgap} {} {} {StretchStackTopShiftUp} {big_op_spacing3} |
| 509 |
\MathLine{\Umathunderdelimitervgap} {} {} {StretchStackGapAboveMin} {big_op_spacing2} |
| 510 |
\MathLine{\Umathunderdelimiterbgap} {} {} {StretchStackBottomShiftDown} {big_op_spacing4} |
| 511 |
\MathLine{\Umathoverbarkern} {} {} {OverbarExtraAscender} {default_rule_thickness} |
| 512 |
\MathLine{\Umathoverbarrule} {} {} {OverbarRuleThickness} {default_rule_thickness} |
| 513 |
\MathLine{\Umathoverbarvgap} {} {} {OverbarVerticalGap} {3*default_rule_thickness} |
| 514 |
\MathLine{\Umathquad} {1} {} {<font_size(f)>} {math_quad} |
| 515 |
\MathLine{\Umathradicalkern} {} {} {RadicalExtraAscender} {default_rule_thickness} |
| 516 |
\MathLine{\Umathradicalrule} {2} {} {RadicalRuleThickness} {<not set>} |
| 517 |
\MathLine{\Umathradicalvgap} {3} {D, D'} {RadicalDisplayStyleVerticalGap} {default_rule_thickness+abs(math_x_height)/4} |
| 518 |
\MathLine{\Umathradicalvgap} {3} {T, T', S, S', SS, SS'}{RadicalVerticalGap} {default_rule_thickness+abs(default_rule_thickness)/4} |
| 519 |
\MathLine{\Umathradicaldegreebefore}{2} {} {RadicalKernBeforeDegree} {<not set>} |
| 520 |
\MathLine{\Umathradicaldegreeafter} {2} {} {RadicalKernAfterDegree} {<not set>} |
| 521 |
\MathLine{\Umathradicaldegreeraise} {2,7}{} {RadicalDegreeBottomRaisePercent} {<not set>} |
| 522 |
\MathLine{\Umathspaceafterscript} {4} {} {SpaceAfterScript} {script_space} |
| 523 |
\MathLine{\Umathstackdenomdown} {} {D, D'} {StackBottomDisplayStyleShiftDown} {denom1} |
| 524 |
\MathLine{\Umathstackdenomdown} {} {T, T', S, S', SS, SS'}{StackBottomShiftDown} {denom2} |
| 525 |
\MathLine{\Umathstacknumup} {} {D, D'} {StackTopDisplayStyleShiftUp} {num1} |
| 526 |
\MathLine{\Umathstacknumup} {} {T, T', S, S', SS, SS'}{StackTopShiftUp} {num3} |
| 527 |
\MathLine{\Umathstackvgap} {} {D, D'} {StackDisplayStyleGapMin} {7*default_rule_thickness} |
| 528 |
\MathLine{\Umathstackvgap} {} {T, T', S, S', SS, SS'}{StackGapMin} {3*default_rule_thickness} |
| 529 |
\MathLine{\Umathsubshiftdown} {} {} {SubscriptShiftDown} {sub1} |
| 530 |
\MathLine{\Umathsubshiftdrop} {} {} {SubscriptBaselineDropMin} {sub_drop} |
| 531 |
\MathLine{\Umathsubsupshiftdown} {8} {} {SubscriptShiftDownWithSuperscript} {\emdash} |
| 532 |
\MathLine{\Umathsubtopmax} {} {} {SubscriptTopMax} {abs(math_x_height*4)/5} |
| 533 |
\MathLine{\Umathsubsupvgap} {} {} {SubSuperscriptGapMin} {4*default_rule_thickness} |
| 534 |
\MathLine{\Umathsupbottommin} {} {} {SuperscriptBottomMin} {abs(math_x_height/4)} |
| 535 |
\MathLine{\Umathsupshiftdrop} {} {} {SuperscriptBaselineDropMax} {sup_drop} |
| 536 |
\MathLine{\Umathsupshiftup} {} {D} {SuperscriptShiftUp} {sup1} |
| 537 |
\MathLine{\Umathsupshiftup} {} {T, S, SS,} {SuperscriptShiftUp} {sup2} |
| 538 |
\MathLine{\Umathsupshiftup} {} {D', T', S', SS'} {SuperscriptShiftUpCramped} {sup3} |
| 539 |
\MathLine{\Umathsupsubbottommax} {} {} {SuperscriptBottomMaxWithSubscript} {abs(math_x_height*4)/5} |
| 540 |
\MathLine{\Umathunderbarkern} {} {} {UnderbarExtraDescender} {default_rule_thickness} |
| 541 |
\MathLine{\Umathunderbarrule} {} {} {UnderbarRuleThickness} {default_rule_thickness} |
| 542 |
\MathLine{\Umathunderbarvgap} {} {} {UnderbarVerticalGap} {3*default_rule_thickness} |
| 543 |
\MathLine{\Umathconnectoroverlapmin}{5} {} {MinConnectorOverlap} {0} |
| 544 |
\LL |
| 545 |
\stoptabulate |
| 546 |
|
| 547 |
Note 1: \OPENTYPE\ fonts set \lpr {Umathlimitabovekern} and \lpr |
| 548 |
{Umathlimitbelowkern} to zero and set \lpr {Umathquad} to the font size of the |
| 549 |
used font, because these are not supported in the \type {MATH} table, |
| 550 |
|
| 551 |
Note 2: Traditional \TFM\ fonts do not set \lpr {Umathradicalrule} because |
| 552 |
\TEX82\ uses the height of the radical instead. When this parameter is indeed not |
| 553 |
set when \LUATEX\ has to typeset a radical, a backward compatibility mode will |
| 554 |
kick in that assumes that an oldstyle \TEX\ font is used. Also, they do not set |
| 555 |
\lpr {Umathradicaldegreebefore}, \lpr {Umathradicaldegreeafter}, and \lpr |
| 556 |
{Umathradicaldegreeraise}. These are then automatically initialized to |
| 557 |
$5/18$quad, $-10/18$quad, and 60. |
| 558 |
|
| 559 |
Note 3: If \TFM\ fonts are used, then the \lpr {Umathradicalvgap} is not set |
| 560 |
until the first time \LUATEX\ has to typeset a formula because this needs |
| 561 |
parameters from both family~2 and family~3. This provides a partial backward |
| 562 |
compatibility with \TEX82, but that compatibility is only partial: once the \lpr |
| 563 |
{Umathradicalvgap} is set, it will not be recalculated any more. |
| 564 |
|
| 565 |
Note 4: When \TFM\ fonts are used a similar situation arises with respect to \lpr |
| 566 |
{Umathspaceafterscript}: it is not set until the first time \LUATEX\ has to |
| 567 |
typeset a formula. This provides some backward compatibility with \TEX82. But |
| 568 |
once the \lpr {Umathspaceafterscript} is set, \prm {scriptspace} will never be |
| 569 |
looked at again. |
| 570 |
|
| 571 |
Note 5: Traditional \TFM\ fonts set \lpr {Umathconnectoroverlapmin} to zero |
| 572 |
because \TEX82\ always stacks extensibles without any overlap. |
| 573 |
|
| 574 |
Note 6: The \lpr {Umathoperatorsize} is only used in \prm {displaystyle}, and is |
| 575 |
only set in \OPENTYPE\ fonts. In \TFM\ font mode, it is artificially set to one |
| 576 |
scaled point more than the initial attempt's size, so that always the \quote |
| 577 |
{first next} will be tried, just like in \TEX82. |
| 578 |
|
| 579 |
Note 7: The \lpr {Umathradicaldegreeraise} is a special case because it is the |
| 580 |
only parameter that is expressed in a percentage instead of a number of scaled |
| 581 |
points. |
| 582 |
|
| 583 |
Note 8: \type {SubscriptShiftDownWithSuperscript} does not actually exist in the |
| 584 |
\quote {standard} \OPENTYPE\ math font Cambria, but it is useful enough to be |
| 585 |
added. |
| 586 |
|
| 587 |
Note 9: \type {FractionDelimiterDisplayStyleSize} and \type |
| 588 |
{FractionDelimiterSize} do not actually exist in the \quote {standard} \OPENTYPE\ |
| 589 |
math font Cambria, but were useful enough to be added. |
| 590 |
|
| 591 |
\stopsection |
| 592 |
|
| 593 |
\startsection[title={Math spacing}] |
| 594 |
|
| 595 |
\subsection{Inline surrounding space} |
| 596 |
|
| 597 |
\topicindex {math+spacing} |
| 598 |
|
| 599 |
Inline math is surrounded by (optional) \prm {mathsurround} spacing but that is a fixed |
| 600 |
dimension. There is now an additional parameter \lpr {mathsurroundskip}. When set to a |
| 601 |
non|-|zero value (or zero with some stretch or shrink) this parameter will replace |
| 602 |
\prm {mathsurround}. By using an additional parameter instead of changing the nature |
| 603 |
of \prm {mathsurround}, we can remain compatible. In the meantime a bit more |
| 604 |
control has been added via \lpr {mathsurroundmode}. This directive can take 6 values |
| 605 |
with zero being the default behaviour. |
| 606 |
|
| 607 |
\start |
| 608 |
|
| 609 |
\def\OneLiner#1#2% |
| 610 |
{\NC \type{#1} |
| 611 |
\NC \dontleavehmode\inframed[align=normal,offset=0pt,frame=off]{\mathsurroundmode#1\relax\hsize 100pt x$x$x} |
| 612 |
\NC \dontleavehmode\inframed[align=normal,offset=0pt,frame=off]{\mathsurroundmode#1\relax\hsize 100pt x $x$ x} |
| 613 |
\NC #2 |
| 614 |
\NC \NR} |
| 615 |
|
| 616 |
\startbuffer |
| 617 |
\mathsurround 10pt |
| 618 |
\mathsurroundskip20pt |
| 619 |
\stopbuffer |
| 620 |
|
| 621 |
\typebuffer \getbuffer |
| 622 |
|
| 623 |
\starttabulate[|c|c|c|pl|] |
| 624 |
\DB mode \BC x\$x\$x \BC x \$x\$ x \BC effect \NC \NR |
| 625 |
\TB |
| 626 |
\OneLiner{0}{obey \prm {mathsurround} when \lpr {mathsurroundskip} is 0pt} |
| 627 |
\OneLiner{1}{only add skip to the left} |
| 628 |
\OneLiner{2}{only add skip to the right} |
| 629 |
\OneLiner{3}{add skip to the left and right} |
| 630 |
\OneLiner{4}{ignore the skip setting, obey \prm {mathsurround}} |
| 631 |
\OneLiner{5}{disable all spacing around math} |
| 632 |
\OneLiner{6}{only apply \lpr {mathsurroundskip} when also spacing} |
| 633 |
\OneLiner{7}{only apply \lpr {mathsurroundskip} when no spacing} |
| 634 |
\LL |
| 635 |
\stoptabulate |
| 636 |
|
| 637 |
\stop |
| 638 |
|
| 639 |
Method six omits the surround glue when there is (x)spacing glue present while |
| 640 |
method seven does the opposite, the glue is only applied when there is (x)space |
| 641 |
glue present too. Anything more fancy, like checking the begining or end of a |
| 642 |
paragraph (or edges of a box) would not be robust anyway. If you want that you |
| 643 |
can write a callback that runs over a list and analyzes a paragraph. Actually, in |
| 644 |
that case you could also inject glue (or set the properties of a math node) |
| 645 |
explicitly. So, these modes are in practice mostly useful for special purposes |
| 646 |
and experiments (they originate in a tracker item). Keep in mind that this glue |
| 647 |
is part of the math node and not always treated as normal glue: it travels with |
| 648 |
the begin and end math nodes. Also, method 6 and 7 will zero the skip related |
| 649 |
fields in a node when applicable in the first occasion that checks them |
| 650 |
(linebreaking or packaging). |
| 651 |
|
| 652 |
\subsection{Pairwise spacing} |
| 653 |
|
| 654 |
\topicindex {math+spacing} |
| 655 |
|
| 656 |
Besides the parameters mentioned in the previous sections, there are also 64 new |
| 657 |
primitives to control the math spacing table (as explained in Chapter~18 of the |
| 658 |
\TEX book). The primitive names are a simple matter of combining two math atom |
| 659 |
types, but for completeness' sake, here is the whole list: |
| 660 |
|
| 661 |
\starttwocolumns |
| 662 |
\startlines |
| 663 |
\lpr {Umathordordspacing} |
| 664 |
\lpr {Umathordopspacing} |
| 665 |
\lpr {Umathordbinspacing} |
| 666 |
\lpr {Umathordrelspacing} |
| 667 |
\lpr {Umathordopenspacing} |
| 668 |
\lpr {Umathordclosespacing} |
| 669 |
\lpr {Umathordpunctspacing} |
| 670 |
\lpr {Umathordinnerspacing} |
| 671 |
\lpr {Umathopordspacing} |
| 672 |
\lpr {Umathopopspacing} |
| 673 |
\lpr {Umathopbinspacing} |
| 674 |
\lpr {Umathoprelspacing} |
| 675 |
\lpr {Umathopopenspacing} |
| 676 |
\lpr {Umathopclosespacing} |
| 677 |
\lpr {Umathoppunctspacing} |
| 678 |
\lpr {Umathopinnerspacing} |
| 679 |
\lpr {Umathbinordspacing} |
| 680 |
\lpr {Umathbinopspacing} |
| 681 |
\lpr {Umathbinbinspacing} |
| 682 |
\lpr {Umathbinrelspacing} |
| 683 |
\lpr {Umathbinopenspacing} |
| 684 |
\lpr {Umathbinclosespacing} |
| 685 |
\lpr {Umathbinpunctspacing} |
| 686 |
\lpr {Umathbininnerspacing} |
| 687 |
\lpr {Umathrelordspacing} |
| 688 |
\lpr {Umathrelopspacing} |
| 689 |
\lpr {Umathrelbinspacing} |
| 690 |
\lpr {Umathrelrelspacing} |
| 691 |
\lpr {Umathrelopenspacing} |
| 692 |
\lpr {Umathrelclosespacing} |
| 693 |
\lpr {Umathrelpunctspacing} |
| 694 |
\lpr {Umathrelinnerspacing} |
| 695 |
\lpr {Umathopenordspacing} |
| 696 |
\lpr {Umathopenopspacing} |
| 697 |
\lpr {Umathopenbinspacing} |
| 698 |
\lpr {Umathopenrelspacing} |
| 699 |
\lpr {Umathopenopenspacing} |
| 700 |
\lpr {Umathopenclosespacing} |
| 701 |
\lpr {Umathopenpunctspacing} |
| 702 |
\lpr {Umathopeninnerspacing} |
| 703 |
\lpr {Umathcloseordspacing} |
| 704 |
\lpr {Umathcloseopspacing} |
| 705 |
\lpr {Umathclosebinspacing} |
| 706 |
\lpr {Umathcloserelspacing} |
| 707 |
\lpr {Umathcloseopenspacing} |
| 708 |
\lpr {Umathcloseclosespacing} |
| 709 |
\lpr {Umathclosepunctspacing} |
| 710 |
\lpr {Umathcloseinnerspacing} |
| 711 |
\lpr {Umathpunctordspacing} |
| 712 |
\lpr {Umathpunctopspacing} |
| 713 |
\lpr {Umathpunctbinspacing} |
| 714 |
\lpr {Umathpunctrelspacing} |
| 715 |
\lpr {Umathpunctopenspacing} |
| 716 |
\lpr {Umathpunctclosespacing} |
| 717 |
\lpr {Umathpunctpunctspacing} |
| 718 |
\lpr {Umathpunctinnerspacing} |
| 719 |
\lpr {Umathinnerordspacing} |
| 720 |
\lpr {Umathinneropspacing} |
| 721 |
\lpr {Umathinnerbinspacing} |
| 722 |
\lpr {Umathinnerrelspacing} |
| 723 |
\lpr {Umathinneropenspacing} |
| 724 |
\lpr {Umathinnerclosespacing} |
| 725 |
\lpr {Umathinnerpunctspacing} |
| 726 |
\lpr {Umathinnerinnerspacing} |
| 727 |
\stoplines |
| 728 |
\stoptwocolumns |
| 729 |
|
| 730 |
These parameters are of type \prm {muskip}, so setting a parameter can be done |
| 731 |
like this: |
| 732 |
|
| 733 |
\starttyping |
| 734 |
\Umathopordspacing\displaystyle=4mu plus 2mu |
| 735 |
\stoptyping |
| 736 |
|
| 737 |
They are all initialized by \type {initex} to the values mentioned in the table |
| 738 |
in Chapter~18 of the \TEX book. |
| 739 |
|
| 740 |
Note 1: for ease of use as well as for backward compatibility, \prm {thinmuskip}, |
| 741 |
\prm {medmuskip} and \prm {thickmuskip} are treated specially. In their case a |
| 742 |
pointer to the corresponding internal parameter is saved, not the actual \prm |
| 743 |
{muskip} value. This means that any later changes to one of these three |
| 744 |
parameters will be taken into account. |
| 745 |
|
| 746 |
Note 2: Careful readers will realise that there are also primitives for the items |
| 747 |
marked \type {*} in the \TEX book. These will not actually be used as those |
| 748 |
combinations of atoms cannot actually happen, but it seemed better not to break |
| 749 |
orthogonality. They are initialized to zero. |
| 750 |
|
| 751 |
\subsection{Skips around display math} |
| 752 |
|
| 753 |
\topicindex {math+spacing} |
| 754 |
|
| 755 |
The injection of \prm {abovedisplayskip} and \prm {belowdisplayskip} is not |
| 756 |
symmetrical. An above one is always inserted, also when zero, but the below is |
| 757 |
only inserted when larger than zero. Especially the latter makes it sometimes hard |
| 758 |
to fully control spacing. Therefore \LUATEX\ comes with a new directive: \lpr |
| 759 |
{mathdisplayskipmode}. The following values apply: |
| 760 |
|
| 761 |
\starttabulate[|c|l|] |
| 762 |
\DB value \BC meaning \NC \NR |
| 763 |
\TB |
| 764 |
\NC 0 \NC normal \TEX\ behaviour \NC \NR |
| 765 |
\NC 1 \NC always (same as 0) \NC \NR |
| 766 |
\NC 2 \NC only when not zero \NC \NR |
| 767 |
\NC 3 \NC never, not even when not zero \NC \NR |
| 768 |
\LL |
| 769 |
\stoptabulate |
| 770 |
|
| 771 |
By default the short skip detection is not adapted to r2l typesetting and that |
| 772 |
hasn't been the case since the start of the project. Changing it could break |
| 773 |
hacks that users came up with but when you set \lpr {matheqdirmode} to a positive |
| 774 |
value direction will be taken into account. |
| 775 |
|
| 776 |
% \subsection {Nolimit correction} |
| 777 |
% |
| 778 |
% \topicindex {math+limits} |
| 779 |
% |
| 780 |
% There are two extra math parameters \lpr {Umathnolimitsupfactor} and \lpr |
| 781 |
% {Umathnolimitsubfactor} that were added to provide some control over how limits |
| 782 |
% are spaced (for example the position of super and subscripts after integral |
| 783 |
% operators). They relate to an extra parameter \lpr {mathnolimitsmode}. The half |
| 784 |
% corrections are what happens when scripts are placed above and below. The |
| 785 |
% problem with italic corrections is that officially that correction italic is used |
| 786 |
% for above|/|below placement while advanced kerns are used for placement at the |
| 787 |
% right end. The question is: how often is this implemented, and if so, do the |
| 788 |
% kerns assume correction too. Anyway, with this parameter one can control it. |
| 789 |
|
| 790 |
% \starttabulate[|l|ck1|ck1|ck1|ck1|ck1|ck1|] |
| 791 |
% \NC % probably not ok, we need a raw int here |
| 792 |
% \NC \mathnolimitsmode0 $\displaystyle\mathop{\normalint}\nolimits^0_1$ |
| 793 |
% \NC \mathnolimitsmode1 $\displaystyle\mathop{\normalint}\nolimits^0_1$ |
| 794 |
% \NC \mathnolimitsmode2 $\displaystyle\mathop{\normalint}\nolimits^0_1$ |
| 795 |
% \NC \mathnolimitsmode3 $\displaystyle\mathop{\normalint}\nolimits^0_1$ |
| 796 |
% \NC \mathnolimitsmode4 $\displaystyle\mathop{\normalint}\nolimits^0_1$ |
| 797 |
% \NC \mathnolimitsmode8000 $\displaystyle\mathop{\normalint}\nolimits^0_1$ |
| 798 |
% \NC \NR |
| 799 |
% \TB |
| 800 |
% \BC mode |
| 801 |
% \NC \tttf 0 |
| 802 |
% \NC \tttf 1 |
| 803 |
% \NC \tttf 2 |
| 804 |
% \NC \tttf 3 |
| 805 |
% \NC \tttf 4 |
| 806 |
% \NC \tttf 8000 |
| 807 |
% \NC \NR |
| 808 |
% \BC superscript |
| 809 |
% \NC 0 |
| 810 |
% \NC font |
| 811 |
% \NC 0 |
| 812 |
% \NC 0 |
| 813 |
% \NC +ic/2 |
| 814 |
% \NC 0 |
| 815 |
% \NC \NR |
| 816 |
% \BC subscript |
| 817 |
% \NC -ic |
| 818 |
% \NC font |
| 819 |
% \NC 0 |
| 820 |
% \NC -ic/2 |
| 821 |
% \NC -ic/2 |
| 822 |
% \NC 8000ic/1000 |
| 823 |
% \NC \NR |
| 824 |
% \stoptabulate |
| 825 |
% |
| 826 |
% When the mode is set to one, the math parameters are used. This way a macro |
| 827 |
% package writer can decide what looks best. Given the current state of fonts in |
| 828 |
% \CONTEXT\ we currently use mode 1 with factor 0 for the superscript and 750 for |
| 829 |
% the subscripts. Positive values are used for both parameters but the subscript |
| 830 |
% shifts to the left. A \lpr {mathnolimitsmode} larger that 15 is considered to |
| 831 |
% be a factor for the subscript correction. This feature can be handy when |
| 832 |
% experimenting. |
| 833 |
|
| 834 |
% \subsection {Math italic mess} |
| 835 |
% |
| 836 |
% \topicindex {math+italics} |
| 837 |
% |
| 838 |
% The \lpr {mathitalicsmode} parameter was introduced to deal with the difference |
| 839 |
% in applying italic correction in traditional and \OPENTYPE\ math fonts. There are |
| 840 |
% \OPENTYPE\ fonts out there that have italic correction and assume them to be |
| 841 |
% applied like traditional \TEX\ fonts. This parameter takes several values: |
| 842 |
% |
| 843 |
% When set to zero, you get what was decided when the two code paths (traditional |
| 844 |
% and \OPENTYPE) were introduced. |
| 845 |
% |
| 846 |
% Values larger than zero will add the italic correction between simple noads (it |
| 847 |
% checks some classes so you might pay attention to for instance punctuation |
| 848 |
% classes assigned). |
| 849 |
% |
| 850 |
% When set to zero or one, italics are independent, so we separate width from |
| 851 |
% italic, while values larger than one combine both in the width but later |
| 852 |
% selectively has to get rid of it (depending on code path). |
| 853 |
% |
| 854 |
% A value larger than two will backtrack italics for large operators, because there |
| 855 |
% italic correction is used for anchoring scripts (limits and no limits). In fact, |
| 856 |
% \OPENTYPE\ uses italics either between characters or for this purpose but as |
| 857 |
% mentioned fonts are sort of messy here. |
| 858 |
% |
| 859 |
% We tested our version of plain \TEX\ and recommend to use the value of three to |
| 860 |
% get the best average results. More about this italic correction dilemma in |
| 861 |
% rendering math can be found in articles (in for instance \TUGBOAT) and various |
| 862 |
% documents in the \CONTEXT\ distribution, especially those that discuss the |
| 863 |
% upgraded math engine in \LUAMETATEX. |
| 864 |
% |
| 865 |
% % The \lpr {mathitalicsmode} parameter can be set to~1 to force italic correction |
| 866 |
% % before noads that represent some more complex structure (read: everything that is |
| 867 |
% % not an ord, bin, rel, open, close, punct or inner). A value of~2 will enforce the |
| 868 |
% % old school font code path for all italics. We show a Cambria example. |
| 869 |
% % |
| 870 |
% % \starttexdefinition Whatever #1 |
| 871 |
% % \NC \type{\mathitalicsmode = #1} |
| 872 |
% % \NC \mathitalicsmode#1\ruledhbox{$\left|T^1\right|$} |
| 873 |
% % \NC \mathitalicsmode#1\ruledhbox{$\left|T\right|$} |
| 874 |
% % \NC \mathitalicsmode#1\ruledhbox{$T+1$} |
| 875 |
% % \NC \mathitalicsmode#1\ruledhbox{$T{1\over2}$} |
| 876 |
% % \NC \mathitalicsmode#1\ruledhbox{$T\sqrt{1}$} |
| 877 |
% % \NC \NR |
| 878 |
% % \stoptexdefinition |
| 879 |
% % |
| 880 |
% % \start |
| 881 |
% % \switchtobodyfont[cambria] |
| 882 |
% % \starttabulate[|c|c|c|c|c|c|] |
| 883 |
% % \Whatever{0}% |
| 884 |
% % \Whatever{1}% |
| 885 |
% % \stoptabulate |
| 886 |
% % \stop |
| 887 |
% % |
| 888 |
% % This kind of parameters relate to the fact that italic correction in \OPENTYPE\ |
| 889 |
% % math is bound to fuzzy rules. So, control is the solution. |
| 890 |
|
| 891 |
% \subsection {Script and kerning} |
| 892 |
% |
| 893 |
% \topicindex {math+kerning} |
| 894 |
% \topicindex {math+scripts} |
| 895 |
% |
| 896 |
% If you want to typeset text in math macro packages often provide something \type |
| 897 |
% {\text} which obeys the script sizes. As the definition can be anything there is |
| 898 |
% a good chance that the kerning doesn't come out well when used in a script. Given |
| 899 |
% that the first glyph ends up in a \prm {hbox} we have some control over this. |
| 900 |
% And, as a bonus we also added control over the normal sublist kerning. The \lpr |
| 901 |
% {mathscriptboxmode} parameter defaults to~1. |
| 902 |
% |
| 903 |
% \starttabulate[|c|l|] |
| 904 |
% \DB value \BC meaning \NC \NR |
| 905 |
% \TB |
| 906 |
% \NC \type {0} \NC forget about kerning \NC \NR |
| 907 |
% \NC \type {1} \NC kern math sub lists with a valid glyph \NC \NR |
| 908 |
% \NC \type {2} \NC also kern math sub boxes that have a valid glyph \NC \NR |
| 909 |
% \NC \type {2} \NC only kern math sub boxes with a boundary node present\NC \NR |
| 910 |
% \LL |
| 911 |
% \stoptabulate |
| 912 |
% |
| 913 |
% Here we show some examples. Of course this doesn't solve all our problems, if |
| 914 |
% only because some fonts have characters with bounding boxes that compensate for |
| 915 |
% italics, while other fonts can lack kerns. |
| 916 |
% |
| 917 |
% \startbuffer[1] |
| 918 |
% $T_{\tf fluff}$ |
| 919 |
% \stopbuffer |
| 920 |
% |
| 921 |
% \startbuffer[2] |
| 922 |
% $T_{\text{fluff}}$ |
| 923 |
% \stopbuffer |
| 924 |
% |
| 925 |
% \startbuffer[3] |
| 926 |
% $T_{\text{\boundary1 fluff}}$ |
| 927 |
% \stopbuffer |
| 928 |
% |
| 929 |
% \unexpanded\def\Show#1#2#3% |
| 930 |
% {\doifelsenothing{#3} |
| 931 |
% {\small\tx\typeinlinebuffer[#1]} |
| 932 |
% {\doifelse{#3}{-} |
| 933 |
% {\small\bf\tt mode #2} |
| 934 |
% {\switchtobodyfont[#3]\showfontkerns\showglyphs\mathscriptboxmode#2\relax\inlinebuffer[#1]}}} |
| 935 |
% |
| 936 |
% \starttabulate[|lBT|c|c|c|c|c|] |
| 937 |
% \NC \NC \Show{1}{0}{} \NC\Show{1}{1}{} \NC \Show{2}{1}{} \NC \Show{2}{2}{} \NC \Show{3}{3}{} \NC \NR |
| 938 |
% \NC \NC \Show{1}{0}{-} \NC\Show{1}{1}{-} \NC \Show{2}{1}{-} \NC \Show{2}{2}{-} \NC \Show{3}{3}{-} \NC \NR |
| 939 |
% \NC modern \NC \Show{1}{0}{modern} \NC\Show{1}{1}{modern} \NC \Show{2}{1}{modern} \NC \Show{2}{2}{modern} \NC \Show{3}{3}{modern} \NC \NR |
| 940 |
% \NC lucidaot \NC \Show{1}{0}{lucidaot} \NC\Show{1}{1}{lucidaot} \NC \Show{2}{1}{lucidaot} \NC \Show{2}{2}{lucidaot} \NC \Show{3}{3}{lucidaot} \NC \NR |
| 941 |
% \NC pagella \NC \Show{1}{0}{pagella} \NC\Show{1}{1}{pagella} \NC \Show{2}{1}{pagella} \NC \Show{2}{2}{pagella} \NC \Show{3}{3}{pagella} \NC \NR |
| 942 |
% \NC cambria \NC \Show{1}{0}{cambria} \NC\Show{1}{1}{cambria} \NC \Show{2}{1}{cambria} \NC \Show{2}{2}{cambria} \NC \Show{3}{3}{cambria} \NC \NR |
| 943 |
% \NC dejavu \NC \Show{1}{0}{dejavu} \NC\Show{1}{1}{dejavu} \NC \Show{2}{1}{dejavu} \NC \Show{2}{2}{dejavu} \NC \Show{3}{3}{dejavu} \NC \NR |
| 944 |
% \stoptabulate |
| 945 |
% |
| 946 |
% % Kerning between a character subscript is controlled by \lpr {mathscriptcharmode} |
| 947 |
% % which also defaults to~1. |
| 948 |
% |
| 949 |
% Here is another example. Internally we tag kerns as italic kerns or font kerns |
| 950 |
% where font kerns result from the staircase kern tables. In 2018 fonts like Latin |
| 951 |
% Modern and Pagella rely on cheats with the boundingbox, Cambria uses staircase |
| 952 |
% kerns and Lucida a mixture. Depending on how fonts evolve we might add some more |
| 953 |
% control over what one can turn on and off. |
| 954 |
% |
| 955 |
% \def\MathSample#1#2#3% |
| 956 |
% {\NC |
| 957 |
% #1 \NC |
| 958 |
% #2 \NC |
| 959 |
% \showglyphdata \switchtobodyfont[#2,17.3pt]$#3T_{f}$ \NC |
| 960 |
% \showglyphdata \switchtobodyfont[#2,17.3pt]$#3\gamma_{e}$ \NC |
| 961 |
% \showglyphdata \switchtobodyfont[#2,17.3pt]$#3\gamma_{ee}$ \NC |
| 962 |
% \showglyphdata \switchtobodyfont[#2,17.3pt]$#3T_{\tf fluff}$ \NC |
| 963 |
% \NR} |
| 964 |
% |
| 965 |
% \starttabulate[|Tl|Tl|l|l|l|l|] |
| 966 |
% \FL |
| 967 |
% \MathSample{normal}{modern} {\mr} |
| 968 |
% \MathSample{} {pagella} {\mr} |
| 969 |
% \MathSample{} {cambria} {\mr} |
| 970 |
% \MathSample{} {lucidaot}{\mr} |
| 971 |
% \ML |
| 972 |
% \MathSample{bold} {modern} {\mb} |
| 973 |
% \MathSample{} {pagella} {\mb} |
| 974 |
% \MathSample{} {cambria} {\mb} |
| 975 |
% \MathSample{} {lucidaot}{\mb} |
| 976 |
% \LL |
| 977 |
% \stoptabulate |
| 978 |
|
| 979 |
\subsection{Fixed scripts} |
| 980 |
|
| 981 |
We have three parameters that are used for this fixed anchoring: |
| 982 |
|
| 983 |
\starttabulate[|c|l|] |
| 984 |
\DB parameter \BC register \NC \NR |
| 985 |
\NC $d$ \NC \lpr {Umathsubshiftdown} \NC \NR |
| 986 |
\NC $u$ \NC \lpr {Umathsupshiftup} \NC \NR |
| 987 |
\NC $s$ \NC \lpr {Umathsubsupshiftdown} \NC \NR |
| 988 |
\LL |
| 989 |
\stoptabulate |
| 990 |
|
| 991 |
When we set \lpr {mathscriptsmode} to a value other than zero these are used |
| 992 |
for calculating fixed positions. This is something that is needed for instance |
| 993 |
for chemistry. You can manipulate the mentioned variables to achieve different |
| 994 |
effects. |
| 995 |
|
| 996 |
\def\SampleMath#1% |
| 997 |
{$\mathscriptsmode#1\mathupright CH_2 + CH^+_2 + CH^2_2$} |
| 998 |
|
| 999 |
\starttabulate[|c|c|c|p|] |
| 1000 |
\DB mode \BC down \BC up \BC example \NC \NR |
| 1001 |
\TB |
| 1002 |
\NC 0 \NC dynamic \NC dynamic \NC \SampleMath{0} \NC \NR |
| 1003 |
\NC 1 \NC $d$ \NC $u$ \NC \SampleMath{1} \NC \NR |
| 1004 |
\NC 2 \NC $s$ \NC $u$ \NC \SampleMath{2} \NC \NR |
| 1005 |
\NC 3 \NC $s$ \NC $u + s - d$ \NC \SampleMath{3} \NC \NR |
| 1006 |
\NC 4 \NC $d + (s-d)/2$ \NC $u + (s-d)/2$ \NC \SampleMath{4} \NC \NR |
| 1007 |
\NC 5 \NC $d$ \NC $u + s - d$ \NC \SampleMath{5} \NC \NR |
| 1008 |
\LL |
| 1009 |
\stoptabulate |
| 1010 |
|
| 1011 |
The value of this parameter obeys grouping but applies to the whole current |
| 1012 |
formula. |
| 1013 |
|
| 1014 |
% if needed we can put the value in stylenodes but maybe more should go there |
| 1015 |
|
| 1016 |
\subsection{Penalties: \lpr {mathpenaltiesmode}} |
| 1017 |
|
| 1018 |
\topicindex {math+penalties} |
| 1019 |
|
| 1020 |
Only in inline math penalties will be added in a math list. You can force |
| 1021 |
penalties (also in display math) by setting: |
| 1022 |
|
| 1023 |
\starttyping |
| 1024 |
\mathpenaltiesmode = 1 |
| 1025 |
\stoptyping |
| 1026 |
|
| 1027 |
This primnitive is not really needed in \LUATEX\ because you can use the callback |
| 1028 |
\cbk {mlist_to_hlist} to force penalties by just calling the regular routine |
| 1029 |
with forced penalties. However, as part of opening up and control this primitive |
| 1030 |
makes sense. As a bonus we also provide two extra penalties: |
| 1031 |
|
| 1032 |
\starttyping |
| 1033 |
\prebinoppenalty = -100 % example value |
| 1034 |
\prerelpenalty = 900 % example value |
| 1035 |
\stoptyping |
| 1036 |
|
| 1037 |
They default to inifinite which signals that they don't need to be inserted. When |
| 1038 |
set they are injected before a binop or rel noad. This is an experimental feature. |
| 1039 |
|
| 1040 |
\subsection{Equation spacing: \lpr {matheqnogapstep}} |
| 1041 |
|
| 1042 |
By default \TEX\ will add one quad between the equation and the number. This is |
| 1043 |
hard coded. A new primitive can control this: |
| 1044 |
|
| 1045 |
\startsyntax |
| 1046 |
\matheqnogapstep = 1000 |
| 1047 |
\stopsyntax |
| 1048 |
|
| 1049 |
Because a math quad from the math text font is used instead of a dimension, we |
| 1050 |
use a step to control the size. A value of zero will suppress the gap. The step |
| 1051 |
is divided by 1000 which is the usual way to mimmick floating point factors in |
| 1052 |
\TEX. |
| 1053 |
|
| 1054 |
\stopsection |
| 1055 |
|
| 1056 |
\startsection[title={Math constructs}] |
| 1057 |
|
| 1058 |
% \subsection {Unscaled fences} |
| 1059 |
% |
| 1060 |
% \topicindex {math+fences} |
| 1061 |
% |
| 1062 |
% The \lpr {mathdelimitersmode} primitive is experimental and deals with the |
| 1063 |
% following (potential) problems. Three bits can be set. The first bit prevents an |
| 1064 |
% unwanted shift when the fence symbol is not scaled (a cambria side effect). The |
| 1065 |
% second bit forces italic correction between a preceding character ordinal and the |
| 1066 |
% fenced subformula, while the third bit turns that subformula into an ordinary so |
| 1067 |
% that the same spacing applies as with unfenced variants. Here we show Cambria |
| 1068 |
% (with \lpr {mathitalicsmode} enabled). |
| 1069 |
% |
| 1070 |
% \starttexdefinition Whatever #1 |
| 1071 |
% \NC \type{\mathdelimitersmode = #1} |
| 1072 |
% \NC \mathitalicsmode1\mathdelimitersmode#1\ruledhbox{\showglyphs\showfontkerns\showfontitalics$f(x)$} |
| 1073 |
% \NC \mathitalicsmode1\mathdelimitersmode#1\ruledhbox{\showglyphs\showfontkerns\showfontitalics$f\left(x\right)$} |
| 1074 |
% \NC \NR |
| 1075 |
% \stoptexdefinition |
| 1076 |
% |
| 1077 |
% \start |
| 1078 |
% \switchtobodyfont[cambria] |
| 1079 |
% \starttabulate[|l|l|l|] |
| 1080 |
% \Whatever{0}\Whatever{1}\Whatever{2}\Whatever{3}% |
| 1081 |
% \Whatever{4}\Whatever{5}\Whatever{6}\Whatever{7}% |
| 1082 |
% \stoptabulate |
| 1083 |
% \stop |
| 1084 |
% |
| 1085 |
% So, when set to 7 fenced subformulas with unscaled delimiters come out the same |
| 1086 |
% as unfenced ones. This can be handy for cases where one is forced to use \prm |
| 1087 |
% {left} and \prm {right} always because of unpredictable content. As said, it's an |
| 1088 |
% experimental feature (which somehow fits in the exceptional way fences are dealt |
| 1089 |
% with in the engine). The full list of flags is given in the next table: |
| 1090 |
% |
| 1091 |
% \starttabulate[|c|l|] |
| 1092 |
% \DB value \BC meaning \NC \NR |
| 1093 |
% \TB |
| 1094 |
% \NC \type{"01} \NC don't apply the usual shift \NC \NR |
| 1095 |
% \NC \type{"02} \NC apply italic correction when possible \NC \NR |
| 1096 |
% \NC \type{"04} \NC force an ordinary subformula \NC \NR |
| 1097 |
% \NC \type{"08} \NC no shift when a base character \NC \NR |
| 1098 |
% \NC \type{"10} \NC only shift when an extensible \NC \NR |
| 1099 |
% \LL |
| 1100 |
% \stoptabulate |
| 1101 |
% |
| 1102 |
% The effect can depend on the font (and for Cambria one can use for instance \type {"16}). |
| 1103 |
|
| 1104 |
\subsection[mathacc]{Accent handling} |
| 1105 |
|
| 1106 |
\topicindex {math+accents} |
| 1107 |
|
| 1108 |
\LUATEX\ supports both top accents and bottom accents in math mode, and math |
| 1109 |
accents stretch automatically (if this is supported by the font the accent comes |
| 1110 |
from, of course). Bottom and combined accents as well as fixed-width math accents |
| 1111 |
are controlled by optional keywords following \lpr {Umathaccent}. |
| 1112 |
|
| 1113 |
The keyword \type {bottom} after \lpr {Umathaccent} signals that a bottom accent |
| 1114 |
is needed, and the keyword \type {both} signals that both a top and a bottom |
| 1115 |
accent are needed (in this case two accents need to be specified, of course). |
| 1116 |
|
| 1117 |
Then the set of three integers defining the accent is read. This set of integers |
| 1118 |
can be prefixed by the \type {fixed} keyword to indicate that a non-stretching |
| 1119 |
variant is requested (in case of both accents, this step is repeated). |
| 1120 |
|
| 1121 |
A simple example: |
| 1122 |
|
| 1123 |
\starttyping |
| 1124 |
\Umathaccent both fixed 0 0 "20D7 fixed 0 0 "20D7 {example} |
| 1125 |
\stoptyping |
| 1126 |
|
| 1127 |
If a math top accent has to be placed and the accentee is a character and has a |
| 1128 |
non-zero \type {top_accent} value, then this value will be used to place the |
| 1129 |
accent instead of the \prm {skewchar} kern used by \TEX82. |
| 1130 |
|
| 1131 |
The \type {top_accent} value represents a vertical line somewhere in the |
| 1132 |
accentee. The accent will be shifted horizontally such that its own \type |
| 1133 |
{top_accent} line coincides with the one from the accentee. If the \type |
| 1134 |
{top_accent} value of the accent is zero, then half the width of the accent |
| 1135 |
followed by its italic correction is used instead. |
| 1136 |
|
| 1137 |
The vertical placement of a top accent depends on the \type {x_height} of the |
| 1138 |
font of the accentee (as explained in the \TEX book), but if a value turns out |
| 1139 |
to be zero and the font had a \type {MathConstants} table, then \type |
| 1140 |
{AccentBaseHeight} is used instead. |
| 1141 |
|
| 1142 |
The vertical placement of a bottom accent is straight below the accentee, no |
| 1143 |
correction takes place. |
| 1144 |
|
| 1145 |
Possible locations are \type {top}, \type {bottom}, \type {both} and \type |
| 1146 |
{center}. When no location is given \type {top} is assumed. An additional |
| 1147 |
parameter \nod {fraction} can be specified followed by a number; a value of for |
| 1148 |
instance 1200 means that the criterium is 1.2 times the width of the nucleus. The |
| 1149 |
fraction only applies to the stepwise selected shapes and is mostly meant for the |
| 1150 |
\type {overlay} location. It also works for the other locations but then it |
| 1151 |
concerns the width. |
| 1152 |
|
| 1153 |
\subsection{Radical extensions} |
| 1154 |
|
| 1155 |
\topicindex {math+radicals} |
| 1156 |
|
| 1157 |
The new primitive \lpr {Uroot} allows the construction of a radical noad |
| 1158 |
including a degree field. Its syntax is an extension of \lpr {Uradical}: |
| 1159 |
|
| 1160 |
\starttyping |
| 1161 |
\Uradical <fam integer> <char integer> <radicand> |
| 1162 |
\Uroot <fam integer> <char integer> <degree> <radicand> |
| 1163 |
\stoptyping |
| 1164 |
|
| 1165 |
The placement of the degree is controlled by the math parameters \lpr |
| 1166 |
{Umathradicaldegreebefore}, \lpr {Umathradicaldegreeafter}, and \lpr |
| 1167 |
{Umathradicaldegreeraise}. The degree will be typeset in \prm |
| 1168 |
{scriptscriptstyle}. |
| 1169 |
|
| 1170 |
\subsection{Super- and subscripts} |
| 1171 |
|
| 1172 |
The character fields in a \LUA|-|loaded \OPENTYPE\ math font can have a \quote |
| 1173 |
{mathkern} table. The format of this table is the same as the \quote {mathkern} |
| 1174 |
table that is returned by the \type {fontloader} library, except that all height |
| 1175 |
and kern values have to be specified in actual scaled points. |
| 1176 |
|
| 1177 |
When a super- or subscript has to be placed next to a math item, \LUATEX\ checks |
| 1178 |
whether the super- or subscript and the nucleus are both simple character items. |
| 1179 |
If they are, and if the fonts of both character items are \OPENTYPE\ fonts (as |
| 1180 |
opposed to legacy \TEX\ fonts), then \LUATEX\ will use the \OPENTYPE\ math |
| 1181 |
algorithm for deciding on the horizontal placement of the super- or subscript. |
| 1182 |
|
| 1183 |
This works as follows: |
| 1184 |
|
| 1185 |
\startitemize |
| 1186 |
\startitem |
| 1187 |
The vertical position of the script is calculated. |
| 1188 |
\stopitem |
| 1189 |
\startitem |
| 1190 |
The default horizontal position is flat next to the base character. |
| 1191 |
\stopitem |
| 1192 |
\startitem |
| 1193 |
For superscripts, the italic correction of the base character is added. |
| 1194 |
\stopitem |
| 1195 |
\startitem |
| 1196 |
For a superscript, two vertical values are calculated: the bottom of the |
| 1197 |
script (after shifting up), and the top of the base. For a subscript, the two |
| 1198 |
values are the top of the (shifted down) script, and the bottom of the base. |
| 1199 |
\stopitem |
| 1200 |
\startitem |
| 1201 |
For each of these two locations: |
| 1202 |
\startitemize |
| 1203 |
\startitem |
| 1204 |
find the math kern value at this height for the base (for a subscript |
| 1205 |
placement, this is the bottom_right corner, for a superscript |
| 1206 |
placement the top_right corner) |
| 1207 |
\stopitem |
| 1208 |
\startitem |
| 1209 |
find the math kern value at this height for the script (for a |
| 1210 |
subscript placement, this is the top_left corner, for a superscript |
| 1211 |
placement the bottom_left corner) |
| 1212 |
\stopitem |
| 1213 |
\startitem |
| 1214 |
add the found values together to get a preliminary result. |
| 1215 |
\stopitem |
| 1216 |
\stopitemize |
| 1217 |
\stopitem |
| 1218 |
\startitem |
| 1219 |
The horizontal kern to be applied is the smallest of the two results from |
| 1220 |
previous step. |
| 1221 |
\stopitem |
| 1222 |
\stopitemize |
| 1223 |
|
| 1224 |
The math kern value at a specific height is the kern value that is specified by the |
| 1225 |
next higher height and kern pair, or the highest one in the character (if there is no |
| 1226 |
value high enough in the character), or simply zero (if the character has no math kern |
| 1227 |
pairs at all). |
| 1228 |
|
| 1229 |
\subsection{Scripts on extensibles} |
| 1230 |
|
| 1231 |
\topicindex {math+scripts} |
| 1232 |
\topicindex {math+delimiters} |
| 1233 |
\topicindex {math+extensibles} |
| 1234 |
|
| 1235 |
The primitives \lpr {Uunderdelimiter} and \lpr {Uoverdelimiter} allow the |
| 1236 |
placement of a subscript or superscript on an automatically extensible item and |
| 1237 |
\lpr {Udelimiterunder} and \lpr {Udelimiterover} allow the placement of an |
| 1238 |
automatically extensible item as a subscript or superscript on a nucleus. The |
| 1239 |
input: |
| 1240 |
|
| 1241 |
% these produce radical noads .. in fact the code base has the numbers wrong for |
| 1242 |
% quite a while, so no one seems to use this |
| 1243 |
|
| 1244 |
\startbuffer |
| 1245 |
$\Uoverdelimiter 0 "2194 {\hbox{\strut overdelimiter}}$ |
| 1246 |
$\Uunderdelimiter 0 "2194 {\hbox{\strut underdelimiter}}$ |
| 1247 |
$\Udelimiterover 0 "2194 {\hbox{\strut delimiterover}}$ |
| 1248 |
$\Udelimiterunder 0 "2194 {\hbox{\strut delimiterunder}}$ |
| 1249 |
\stopbuffer |
| 1250 |
|
| 1251 |
\typebuffer will render this: |
| 1252 |
|
| 1253 |
\blank \startnarrower \getbuffer \stopnarrower \blank |
| 1254 |
|
| 1255 |
The vertical placements are controlled by \lpr {Umathunderdelimiterbgap}, \lpr |
| 1256 |
{Umathunderdelimitervgap}, \lpr {Umathoverdelimiterbgap}, and \lpr |
| 1257 |
{Umathoverdelimitervgap} in a similar way as limit placements on large operators. |
| 1258 |
The superscript in \lpr {Uoverdelimiter} is typeset in a suitable scripted style, |
| 1259 |
the subscript in \lpr {Uunderdelimiter} is cramped as well. |
| 1260 |
|
| 1261 |
These primitives accepts an option \type {width} specification. When used the |
| 1262 |
also optional keywords \type {left}, \type {middle} and \type {right} will |
| 1263 |
determine what happens when a requested size can't be met (which can happen when |
| 1264 |
we step to successive larger variants). |
| 1265 |
|
| 1266 |
An extra primitive \lpr {Uhextensible} is available that can be used like this: |
| 1267 |
|
| 1268 |
\startbuffer |
| 1269 |
$\Uhextensible width 10cm 0 "2194$ |
| 1270 |
\stopbuffer |
| 1271 |
|
| 1272 |
\typebuffer This will render this: |
| 1273 |
|
| 1274 |
\blank \startnarrower \getbuffer \stopnarrower \blank |
| 1275 |
|
| 1276 |
Here you can also pass options, like: |
| 1277 |
|
| 1278 |
\startbuffer |
| 1279 |
$\Uhextensible width 1pt middle 0 "2194$ |
| 1280 |
\stopbuffer |
| 1281 |
|
| 1282 |
\typebuffer This gives: |
| 1283 |
|
| 1284 |
\blank \startnarrower \getbuffer \stopnarrower \blank |
| 1285 |
|
| 1286 |
\LUATEX\ internally uses a structure that supports \OPENTYPE\ \quote |
| 1287 |
{MathVariants} as well as \TFM\ \quote {extensible recipes}. In most cases where |
| 1288 |
font metrics are involved we have a different code path for traditional fonts end |
| 1289 |
\OPENTYPE\ fonts. |
| 1290 |
|
| 1291 |
Sometimes you might want to act upon the size of a delimiter, something that is |
| 1292 |
not really possible because of the fact that they are calculated {\em after} most |
| 1293 |
has been typeset already. In the following example the all|-|zero specification |
| 1294 |
is the trigger to make a fake box with the last delimiter dimensions and shift. |
| 1295 |
It's an ugly hack but its relative simple and not intrusive implementation has no |
| 1296 |
side effects. Any other heuristic solution would not satisfy possible demands |
| 1297 |
anyway. Here is a rather low level example: |
| 1298 |
|
| 1299 |
\startbuffer |
| 1300 |
\startformula |
| 1301 |
\Uleft \Udelimiter 5 0 "222B |
| 1302 |
\frac{\frac{a}{b}}{\frac{c}{d}} |
| 1303 |
\Uright \Udelimiter 5 0 "222B |
| 1304 |
\kern-2\fontcharwd\textfont0 "222B |
| 1305 |
\mathlimop{\Uvextensible \Udelimiter 0 0 0}_1^2 x |
| 1306 |
\stopformula |
| 1307 |
\stopbuffer |
| 1308 |
|
| 1309 |
\typebuffer |
| 1310 |
|
| 1311 |
The last line, by passing zero values, results in a fake operator that has the |
| 1312 |
dimensions of the previous delimiter. We can then backtrack over the (presumed) |
| 1313 |
width and the two numbers become limit operators. As said, it's not pretty but it |
| 1314 |
works. |
| 1315 |
|
| 1316 |
\subsection{Fractions} |
| 1317 |
|
| 1318 |
\topicindex {math+fractions} |
| 1319 |
|
| 1320 |
The \prm {abovewithdelims} command accepts keywords \type {exact} and \type |
| 1321 |
{norule}. When issued the extra space relative to the rule thickness is not |
| 1322 |
added. One can of course use the \type {\Umathfraction..gap} commands to |
| 1323 |
influence the spacing. Also the rule is still positioned around the math axis. |
| 1324 |
|
| 1325 |
\starttyping |
| 1326 |
$$ { {a} \abovewithdelims() exact 4pt {b} }$$ |
| 1327 |
\stoptyping |
| 1328 |
|
| 1329 |
The math parameter table contains some parameters that specify a horizontal and |
| 1330 |
vertical gap for skewed fractions. Of course some guessing is needed in order to |
| 1331 |
implement something that uses them. And so we now provide a primitive similar to the |
| 1332 |
other fraction related ones but with a few options so that one can influence the |
| 1333 |
rendering. Of course a user can also mess around a bit with the parameters |
| 1334 |
\lpr {Umathskewedfractionhgap} and \lpr {Umathskewedfractionvgap}. |
| 1335 |
|
| 1336 |
The syntax used here is: |
| 1337 |
|
| 1338 |
\starttyping |
| 1339 |
{ {1} \Uskewed / <options> {2} } |
| 1340 |
{ {1} \Uskewedwithdelims / () <options> {2} } |
| 1341 |
\stoptyping |
| 1342 |
|
| 1343 |
where the options can be \type {noaxis} and \type {exact}. By default we add half |
| 1344 |
the axis to the shifts and by default we zero the width of the middle character. |
| 1345 |
For Latin Modern the result looks as follows: |
| 1346 |
|
| 1347 |
\def\ShowA#1#2#3{$x + { {#1} \Uskewed / #3 {#2} } + x$} |
| 1348 |
\def\ShowB#1#2#3{$x + { {#1} \Uskewedwithdelims / () #3 {#2} } + x$} |
| 1349 |
|
| 1350 |
\start |
| 1351 |
\switchtobodyfont[modern] |
| 1352 |
\starttabulate[||||||] |
| 1353 |
\NC \NC |
| 1354 |
\ShowA{a}{b}{} \NC |
| 1355 |
\ShowA{1}{2}{} \NC |
| 1356 |
\ShowB{a}{b}{} \NC |
| 1357 |
\ShowB{1}{2}{} \NC |
| 1358 |
\NR |
| 1359 |
\NC \type{exact} \NC |
| 1360 |
\ShowA{a}{b}{exact} \NC |
| 1361 |
\ShowA{1}{2}{exact} \NC |
| 1362 |
\ShowB{a}{b}{exact} \NC |
| 1363 |
\ShowB{1}{2}{exact} \NC |
| 1364 |
\NR |
| 1365 |
\NC \type{noaxis} \NC |
| 1366 |
\ShowA{a}{b}{noaxis} \NC |
| 1367 |
\ShowA{1}{2}{noaxis} \NC |
| 1368 |
\ShowB{a}{b}{noaxis} \NC |
| 1369 |
\ShowB{1}{2}{noaxis} \NC |
| 1370 |
\NR |
| 1371 |
\NC \type{exact noaxis} \NC |
| 1372 |
\ShowA{a}{b}{exact noaxis} \NC |
| 1373 |
\ShowA{1}{2}{exact noaxis} \NC |
| 1374 |
\ShowB{a}{b}{exact noaxis} \NC |
| 1375 |
\ShowB{1}{2}{exact noaxis} \NC |
| 1376 |
\NR |
| 1377 |
\stoptabulate |
| 1378 |
\stop |
| 1379 |
|
| 1380 |
\subsection {Delimiters: \type{\Uleft}, \prm {Umiddle} and \prm {Uright}} |
| 1381 |
|
| 1382 |
\topicindex {math+delimiters} |
| 1383 |
|
| 1384 |
Normally you will force delimiters to certain sizes by putting an empty box or |
| 1385 |
rule next to it. The resulting delimiter will either be a character from the |
| 1386 |
stepwise size range or an extensible. The latter can be quite differently |
| 1387 |
positioned than the characters as it depends on the fit as well as the fact if |
| 1388 |
the used characters in the font have depth or height. Commands like (plain \TEX |
| 1389 |
s) \type {\big} need use this feature. In \LUATEX\ we provide a bit more control |
| 1390 |
by three variants that support optional parameters \type {height}, \type {depth} |
| 1391 |
and \type {axis}. The following example uses this: |
| 1392 |
|
| 1393 |
\startbuffer |
| 1394 |
\Uleft height 30pt depth 10pt \Udelimiter "0 "0 "000028 |
| 1395 |
\quad x\quad |
| 1396 |
\Umiddle height 40pt depth 15pt \Udelimiter "0 "0 "002016 |
| 1397 |
\quad x\quad |
| 1398 |
\Uright height 30pt depth 10pt \Udelimiter "0 "0 "000029 |
| 1399 |
\quad \quad \quad |
| 1400 |
\Uleft height 30pt depth 10pt axis \Udelimiter "0 "0 "000028 |
| 1401 |
\quad x\quad |
| 1402 |
\Umiddle height 40pt depth 15pt axis \Udelimiter "0 "0 "002016 |
| 1403 |
\quad x\quad |
| 1404 |
\Uright height 30pt depth 10pt axis \Udelimiter "0 "0 "000029 |
| 1405 |
\stopbuffer |
| 1406 |
|
| 1407 |
\typebuffer |
| 1408 |
|
| 1409 |
\startlinecorrection |
| 1410 |
\ruledhbox{\mathematics{\getbuffer}} |
| 1411 |
\stoplinecorrection |
| 1412 |
|
| 1413 |
The keyword \type {exact} can be used as directive that the real dimensions |
| 1414 |
should be applied when the criteria can't be met which can happen when we're |
| 1415 |
still stepping through the successively larger variants. When no dimensions are |
| 1416 |
given the \type {noaxis} command can be used to prevent shifting over the axis. |
| 1417 |
|
| 1418 |
You can influence the final class with the keyword \type {class} which will |
| 1419 |
influence the spacing. The numbers are the same as for character classes. |
| 1420 |
|
| 1421 |
\stopsection |
| 1422 |
|
| 1423 |
\startsection[title={Extracting values}] |
| 1424 |
|
| 1425 |
\subsection{Codes} |
| 1426 |
|
| 1427 |
\topicindex {math+codes} |
| 1428 |
|
| 1429 |
You can extract the components of a math character. Say that we have defined: |
| 1430 |
|
| 1431 |
\starttyping |
| 1432 |
\Umathcode 1 2 3 4 |
| 1433 |
\stoptyping |
| 1434 |
|
| 1435 |
then |
| 1436 |
|
| 1437 |
\starttyping |
| 1438 |
[\Umathcharclass1] [\Umathcharfam1] [\Umathcharslot1] |
| 1439 |
\stoptyping |
| 1440 |
|
| 1441 |
will return: |
| 1442 |
|
| 1443 |
\starttyping |
| 1444 |
[2] [3] [4] |
| 1445 |
\stoptyping |
| 1446 |
|
| 1447 |
These commands are provides as convenience. Before they come available you could |
| 1448 |
do the following: |
| 1449 |
|
| 1450 |
\starttyping |
| 1451 |
\def\Umathcharclass{\directlua{tex.print(tex.getmathcode(token.scan_int())[1])}} |
| 1452 |
\def\Umathcharfam {\directlua{tex.print(tex.getmathcode(token.scan_int())[2])}} |
| 1453 |
\def\Umathcharslot {\directlua{tex.print(tex.getmathcode(token.scan_int())[3])}} |
| 1454 |
\stoptyping |
| 1455 |
|
| 1456 |
\subsection {Last lines} |
| 1457 |
|
| 1458 |
\topicindex {math+last line} |
| 1459 |
|
| 1460 |
There is a new primitive to control the overshoot in the calculation of the |
| 1461 |
previous line in mid|-|paragraph display math. The default value is 2 times |
| 1462 |
the em width of the current font: |
| 1463 |
|
| 1464 |
\starttyping |
| 1465 |
\predisplaygapfactor=2000 |
| 1466 |
\stoptyping |
| 1467 |
|
| 1468 |
If you want to have the length of the last line independent of math i.e.\ you don't |
| 1469 |
want to revert to a hack where you insert a fake display math formula in order to |
| 1470 |
get the length of the last line, the following will often work too: |
| 1471 |
|
| 1472 |
\starttyping |
| 1473 |
\def\lastlinelength{\dimexpr |
| 1474 |
\directlua {tex.sprint ( |
| 1475 |
(nodes.dimensions(node.tail(tex.lists.page_head).list)) |
| 1476 |
)}sp |
| 1477 |
\relax} |
| 1478 |
\stoptyping |
| 1479 |
|
| 1480 |
\stopsection |
| 1481 |
|
| 1482 |
\startsection[title={Math mode}] |
| 1483 |
|
| 1484 |
\subsection {Verbose versions of single|-|character math commands} |
| 1485 |
|
| 1486 |
\topicindex {math+styles} |
| 1487 |
|
| 1488 |
\LUATEX\ defines six new primitives that have the same function as |
| 1489 |
\type {^}, \type {_}, \type {$}, and \type {$$}: |
| 1490 |
|
| 1491 |
\starttabulate[|l|l|] |
| 1492 |
\DB primitive \BC explanation \NC \NR |
| 1493 |
\TB |
| 1494 |
\NC \lpr {Usuperscript} \NC duplicates the functionality of \type {^} \NC \NR |
| 1495 |
\NC \lpr {Usubscript} \NC duplicates the functionality of \type {_} \NC \NR |
| 1496 |
\NC \lpr {Ustartmath} \NC duplicates the functionality of \type {$}, % $ |
| 1497 |
when used in non-math mode. \NC \NR |
| 1498 |
\NC \lpr {Ustopmath} \NC duplicates the functionality of \type {$}, % $ |
| 1499 |
when used in inline math mode. \NC \NR |
| 1500 |
\NC \lpr {Ustartdisplaymath} \NC duplicates the functionality of \type {$$}, % $$ |
| 1501 |
when used in non-math mode. \NC \NR |
| 1502 |
\NC \lpr {Ustopdisplaymath} \NC duplicates the functionality of \type {$$}, % $$ |
| 1503 |
when used in display math mode. \NC \NR |
| 1504 |
\LL |
| 1505 |
\stoptabulate |
| 1506 |
|
| 1507 |
The \lpr {Ustopmath} and \lpr {Ustopdisplaymath} primitives check if the current |
| 1508 |
math mode is the correct one (inline vs.\ displayed), but you can freely intermix |
| 1509 |
the four mathon|/|mathoff commands with explicit dollar sign(s). |
| 1510 |
|
| 1511 |
\subsection{Script commands \lpr {Unosuperscript} and \lpr {Unosubscript}} |
| 1512 |
|
| 1513 |
\topicindex {math+styles} |
| 1514 |
\topicindex {math+scripts} |
| 1515 |
|
| 1516 |
These two commands result in super- and subscripts but with the current style (at the |
| 1517 |
time of rendering). So, |
| 1518 |
|
| 1519 |
\startbuffer[script] |
| 1520 |
$ |
| 1521 |
x\Usuperscript {1}\Usubscript {2} = |
| 1522 |
x\Unosuperscript{1}\Unosubscript{2} = |
| 1523 |
x\Usuperscript {1}\Unosubscript{2} = |
| 1524 |
x\Unosuperscript{1}\Usubscript {2} |
| 1525 |
$ |
| 1526 |
\stopbuffer |
| 1527 |
|
| 1528 |
\typebuffer[script] |
| 1529 |
|
| 1530 |
results in \inlinebuffer[script]. |
| 1531 |
|
| 1532 |
\subsection{Allowed math commands in non|-|math modes} |
| 1533 |
|
| 1534 |
\topicindex {math+text} |
| 1535 |
\topicindex {text+math} |
| 1536 |
|
| 1537 |
The commands \prm {mathchar}, and \lpr {Umathchar} and control sequences that are |
| 1538 |
the result of \prm {mathchardef} or \lpr {Umathchardef} are also acceptable in |
| 1539 |
the horizontal and vertical modes. In those cases, the \prm {textfont} from the |
| 1540 |
requested math family is used. |
| 1541 |
|
| 1542 |
% \startsection[title={Math todo}] |
| 1543 |
% |
| 1544 |
% The following items are still todo. |
| 1545 |
% |
| 1546 |
% \startitemize |
| 1547 |
% \startitem |
| 1548 |
% Pre-scripts. |
| 1549 |
% \stopitem |
| 1550 |
% \startitem |
| 1551 |
% Multi-story stacks. |
| 1552 |
% \stopitem |
| 1553 |
% \startitem |
| 1554 |
% Flattened accents for high characters (maybe). |
| 1555 |
% \stopitem |
| 1556 |
% \startitem |
| 1557 |
% Better control over the spacing around displays and handling of equation numbers. |
| 1558 |
% \stopitem |
| 1559 |
% \startitem |
| 1560 |
% Support for multi|-|line displays using \MATHML\ style alignment points. |
| 1561 |
% \stopitem |
| 1562 |
% \stopitemize |
| 1563 |
% |
| 1564 |
% \stopsection |
| 1565 |
|
| 1566 |
\stopsection |
| 1567 |
|
| 1568 |
\startsection[title={Goodies}] |
| 1569 |
|
| 1570 |
\subsection {Obsolete} |
| 1571 |
|
| 1572 |
Per TL 2026 the following primitives are \quote {ignored}. They were not used in |
| 1573 |
two decades unless by \CONTEXT\ for exploring variants but we can do that |
| 1574 |
differently now. Obsolete commands that trigger a warning: \typ {\mathoption}, |
| 1575 |
\typ {\mathitalicssmode}, \typ {\mathnolimitsmode}, \typ {\mathscriptboxmode}, |
| 1576 |
\typ {\mathscriptcharmode}, %\typ {\mathflattenmode}, |
| 1577 |
\typ {\mathdefaultsmode}, |
| 1578 |
\typ {\mathrulethicknessmode}, \typ {\mathdelimitersmode}. Also no longer used |
| 1579 |
are the parameters \typ {\Umathnolimitsupfactor} and \typ |
| 1580 |
{\Umathnolimitsubfactor}. |
| 1581 |
|
| 1582 |
\subsection {Flattening: \lpr {mathflattenmode}} |
| 1583 |
|
| 1584 |
\topicindex {math+flattening} |
| 1585 |
|
| 1586 |
The \TEX\ math engine collapses \type {ord} noads without sub- and superscripts |
| 1587 |
and a character as nucleus. and which has the side effect that in \OPENTYPE\ mode |
| 1588 |
italic corrections are applied (given that they are enabled). |
| 1589 |
|
| 1590 |
\startbuffer[sample] |
| 1591 |
\switchtobodyfont[modern] |
| 1592 |
$V \mathbin{\mathbin{v}} V$\par |
| 1593 |
$V \mathord{\mathord{v}} V$\par |
| 1594 |
\stopbuffer |
| 1595 |
|
| 1596 |
\typebuffer[sample] |
| 1597 |
|
| 1598 |
This renders as: |
| 1599 |
|
| 1600 |
\blank \start \mathflattenmode\plusone \getbuffer[sample] \stop \blank |
| 1601 |
|
| 1602 |
When we set \lpr {mathflattenmode} to 31 we get: |
| 1603 |
|
| 1604 |
\blank \start \mathflattenmode\numexpr1+2+4+8+16\relax \getbuffer[sample] \stop \blank |
| 1605 |
|
| 1606 |
When you see no difference, then the font probably has the proper character |
| 1607 |
dimensions and no italic correction is needed. For Latin Modern (at least till |
| 1608 |
2018) there was a visual difference. In that respect this parameter is not always |
| 1609 |
needed unless of course you want efficient math lists anyway. |
| 1610 |
|
| 1611 |
You can influence flattening by adding the appropriate number to the value of the |
| 1612 |
mode parameter. The default value is~1. |
| 1613 |
|
| 1614 |
\starttabulate[|Tc|c|] |
| 1615 |
\DB mode \BC class \NC \NR |
| 1616 |
\TB |
| 1617 |
\NC 1 \NC ord \NC \NR |
| 1618 |
\NC 2 \NC bin \NC \NR |
| 1619 |
\NC 4 \NC rel \NC \NR |
| 1620 |
\NC 8 \NC punct \NC \NR |
| 1621 |
\NC 16 \NC inner \NC \NR |
| 1622 |
\LL |
| 1623 |
\stoptabulate |
| 1624 |
|
| 1625 |
\subsection {Less Tracing} |
| 1626 |
|
| 1627 |
\topicindex {math+tracing} |
| 1628 |
|
| 1629 |
Because there are quite some math related parameters and values, it is possible |
| 1630 |
to limit tracing. Only when \type {tracingassigns} and|/|or \type |
| 1631 |
{tracingrestores} are set to~2 or more they will be traced. |
| 1632 |
|
| 1633 |
% \subsection {Math options with \lpr {mathdefaultsmode}} |
| 1634 |
% |
| 1635 |
% This option has been introduced because \LATEX\ developers wanted some of the |
| 1636 |
% defaults to be different from the ones that were set in stone when we froze |
| 1637 |
% \LUATEX. The default values are: |
| 1638 |
% |
| 1639 |
% \starttabulate[|l|c|c|] |
| 1640 |
% \DB \BC scanning \BC rendering \NC \NR |
| 1641 |
% \TB |
| 1642 |
% \NC radical/root \NC cramped \NC cramped \NC \NR |
| 1643 |
% \NC under delimiter \NC cramped \NC supstyle \NC \NR |
| 1644 |
% \NC over delimiter \NC cramped \NC substyle \NC \NR |
| 1645 |
% \NC delimiter under \NC cramped \NC current \NC \NR |
| 1646 |
% \NC delimiter over \NC cramped \NC current \NC \NR |
| 1647 |
% \LL |
| 1648 |
% \stoptabulate |
| 1649 |
% |
| 1650 |
% When \type {\mathdefaultsmode} is larger than zero, we have: |
| 1651 |
% |
| 1652 |
% \starttabulate[|l|c|c|] |
| 1653 |
% \DB \BC scanning \BC rendering \NC \NR |
| 1654 |
% \TB |
| 1655 |
% \NC radical/root \NC cramped \NC cramped \NC \NR |
| 1656 |
% \NC under delimiter \NC substyle \NC substyle \NC \NR |
| 1657 |
% \NC over delimiter \NC supstyle \NC supstyle \NC \NR |
| 1658 |
% \NC delimiter under \NC current \NC current \NC \NR |
| 1659 |
% \NC delimiter over \NC cramped \NC cramped \NC \NR |
| 1660 |
% \LL |
| 1661 |
% \stoptabulate |
| 1662 |
% |
| 1663 |
% It is outside the scope of this manual to discuss the rationale behind these |
| 1664 |
% defaults. The zero values date back from the early times. If needed you can |
| 1665 |
% explicitly set the style in the content argument. |
| 1666 |
|
| 1667 |
% \subsection {Math options with \lpr {mathoption}} |
| 1668 |
% |
| 1669 |
% This command is now obsolete and triggers an error message. It was only meant |
| 1670 |
% for experiments. |
| 1671 |
|
| 1672 |
% % even more obsolete: |
| 1673 |
|
| 1674 |
% The logic in the math engine is rather complex and there are often no universal |
| 1675 |
% solutions (read: what works out well for one font, fails for another). Therefore |
| 1676 |
% some variations in the implementation are driven by parameters (modes). In |
| 1677 |
% addition there is a new primitive \lpr {mathoption} which will be used for |
| 1678 |
% testing. Don't rely on any option to be there in a production version as they are |
| 1679 |
% meant for development. |
| 1680 |
% |
| 1681 |
% This option was introduced for testing purposes when the math engine got split |
| 1682 |
% code paths and it forces the engine to treat new fonts as old ones with respect |
| 1683 |
% to italic correction etc. There are no guarantees given with respect to the final |
| 1684 |
% result and unexpected side effects are not seen as bugs as they relate to font |
| 1685 |
% properties. There is currently only one option: |
| 1686 |
% |
| 1687 |
% \startbuffer |
| 1688 |
% \mathoption old 1 |
| 1689 |
% \stopbuffer |
| 1690 |
% |
| 1691 |
% The \type {oldmath} boolean flag in the \LUA\ font table is the official way to |
| 1692 |
% force old treatment as it's bound to fonts. Like with all options we may |
| 1693 |
% temporarily introduce with this command this feature is not meant for production. |
| 1694 |
|
| 1695 |
% % obsolete: |
| 1696 |
% |
| 1697 |
% \subsubsection {\type {\mathoption noitaliccompensation}} |
| 1698 |
% |
| 1699 |
% This option compensates placement for characters with a built|-|in italic |
| 1700 |
% correction. |
| 1701 |
% |
| 1702 |
% \startbuffer |
| 1703 |
% {\showboxes\int}\quad |
| 1704 |
% {\showboxes\int_{|}^{|}}\quad |
| 1705 |
% {\showboxes\int\limits_{|}^{|}} |
| 1706 |
% \stopbuffer |
| 1707 |
% |
| 1708 |
% \typebuffer |
| 1709 |
% |
| 1710 |
% Gives (with computer modern that has such italics): |
| 1711 |
% |
| 1712 |
% \startlinecorrection[blank] |
| 1713 |
% \switchtobodyfont[modern] |
| 1714 |
% \startcombination[nx=2,ny=2,distance=5em] |
| 1715 |
% {\mathoption noitaliccompensation 0\relax \mathematics{\getbuffer}} |
| 1716 |
% {\nohyphens\type{0:inline}} |
| 1717 |
% {\mathoption noitaliccompensation 0\relax \mathematics{\displaymath\getbuffer}} |
| 1718 |
% {\nohyphens\type{0:display}} |
| 1719 |
% {\mathoption noitaliccompensation 1\relax \mathematics{\getbuffer}} |
| 1720 |
% {\nohyphens\type{1:inline}} |
| 1721 |
% {\mathoption noitaliccompensation 1\relax \mathematics{\displaymath\getbuffer}} |
| 1722 |
% {\nohyphens\type{1:display}} |
| 1723 |
% \stopcombination |
| 1724 |
% \stoplinecorrection |
| 1725 |
|
| 1726 |
% % obsolete: |
| 1727 |
% |
| 1728 |
% \subsubsection {\type {\mathoption nocharitalic}} |
| 1729 |
% |
| 1730 |
% When two characters follow each other italic correction can interfere. The |
| 1731 |
% following example shows what this option does: |
| 1732 |
% |
| 1733 |
% \startbuffer |
| 1734 |
% \catcode"1D443=11 |
| 1735 |
% \catcode"1D444=11 |
| 1736 |
% \catcode"1D445=11 |
| 1737 |
% P( PP PQR |
| 1738 |
% \stopbuffer |
| 1739 |
% |
| 1740 |
% \typebuffer |
| 1741 |
% |
| 1742 |
% Gives (with computer modern that has such italics): |
| 1743 |
% |
| 1744 |
% \startlinecorrection[blank] |
| 1745 |
% \switchtobodyfont[modern] |
| 1746 |
% \startcombination[nx=2,ny=2,distance=5em] |
| 1747 |
% {\mathoption nocharitalic 0\relax \mathematics{\getbuffer}} |
| 1748 |
% {\nohyphens\type{0:inline}} |
| 1749 |
% {\mathoption nocharitalic 0\relax \mathematics{\displaymath\getbuffer}} |
| 1750 |
% {\nohyphens\type{0:display}} |
| 1751 |
% {\mathoption nocharitalic 1\relax \mathematics{\getbuffer}} |
| 1752 |
% {\nohyphens\type{1:inline}} |
| 1753 |
% {\mathoption nocharitalic 1\relax \mathematics{\displaymath\getbuffer}} |
| 1754 |
% {\nohyphens\type{1:display}} |
| 1755 |
% \stopcombination |
| 1756 |
% \stoplinecorrection |
| 1757 |
|
| 1758 |
% % obsolete: |
| 1759 |
% |
| 1760 |
% \subsubsection {\type {\mathoption useoldfractionscaling}} |
| 1761 |
% |
| 1762 |
% This option has been introduced as solution for tracker item 604 for fuzzy cases |
| 1763 |
% around either or not present fraction related settings for new fonts. |
| 1764 |
|
| 1765 |
\stopsection |
| 1766 |
|
| 1767 |
\stopchapter |
| 1768 |
|
| 1769 |
\stopcomponent |