| 1 |
% language=us runpath=texruns:manuals/luametatex |
| 2 |
|
| 3 |
% run locally! |
| 4 |
\enablemode[checktodo] |
| 5 |
|
| 6 |
\environment luametatex-style |
| 7 |
|
| 8 |
% \tracepositions |
| 9 |
|
| 10 |
|
| 11 |
% The usual time stamp. This written while listening intermized to Fish (just ran |
| 12 |
% into), Lazulli (some yt videos too, looking forward to a next live act) and |
| 13 |
% because this all is boring checking out Sarah Coopers channel for new DT syncs |
| 14 |
% every few hours. (Picking up writing this manual in 2023 makes me realize how |
| 15 |
% time flies.) |
| 16 |
% |
| 17 |
% And now it's 2024, so time for a new time (musical) stamp when adding a few |
| 18 |
% more descriptions after watching Tyler Visser perform Fear Inoculum in one take |
| 19 |
% (think Pneuma): great to discover this in a time of artificial music popping up: |
| 20 |
% an amazing drum only version; there is also an older equally amazing version. |
| 21 |
|
| 22 |
% When you feel unhappy about the lack of detail in this manual, just keep in mind |
| 23 |
% that you cannot really demand anything from volunteers: just hope for more (or |
| 24 |
% pay for it). Friendly comments and corrections are of course always welcome. As |
| 25 |
% we like what we're doing here, it all might eventually evolve to perfection, stay |
| 26 |
% tuned. |
| 27 |
% |
| 28 |
% Hans Hagen | j.hagen @ xs4all . nl | ntg-context @ ntg . nl |
| 29 |
|
| 30 |
% iflastnamedcs |
| 31 |
% ignorerest |
| 32 |
|
| 33 |
% boxinserts bitset return codes |
| 34 |
% boxmigrate bitset return codes |
| 35 |
|
| 36 |
% \enableexperiments[fonts.compact] |
| 37 |
|
| 38 |
% \string\Uabove \quad:\quad\meaning\mathabove \par |
| 39 |
% \string\Uabovewithdelims \quad:\quad\meaning\mathabovewithdelims \par |
| 40 |
% \string\Uatop \quad:\quad\meaning\mathatop \par |
| 41 |
% \string\Uatopwithdelims \quad:\quad\meaning\mathatopwithdelims \par |
| 42 |
% \string\Udelcode \quad:\quad\meaning\mathdelcode \par |
| 43 |
% \string\Udelimited \quad:\quad\meaning\mathdelimited \par |
| 44 |
% \string\Udelimiter \quad:\quad\meaning\mathdelimiter \par % |
| 45 |
% \string\Udelimiterover \quad:\quad\meaning\mathdelimiterover \par |
| 46 |
% \string\Udelimiterunder \quad:\quad\meaning\mathdelimiterunder \par |
| 47 |
% \string\Uhextensible \quad:\quad\meaning\mathhextensible \par |
| 48 |
% \string\Uleft \quad:\quad\meaning\mathleft \par |
| 49 |
% \string\Umiddle \quad:\quad\meaning\mathmiddle \par % |
| 50 |
% \string\Uoperator \quad:\quad\meaning\mathoperator \par % |
| 51 |
% \string\Uover \quad:\quad\meaning\mathover \par % |
| 52 |
% \string\Uoverdelimiter \quad:\quad\meaning\mathoverdelimiter \par |
| 53 |
% \string\Uoverwithdelims \quad:\quad\meaning\mathoverwithdelims \par |
| 54 |
% \string\Uradical \quad:\quad\meaning\mathradical \par % |
| 55 |
% \string\Uright \quad:\quad\meaning\mathright \par |
| 56 |
% \string\Uroot \quad:\quad\meaning\mathroot \par |
| 57 |
% \string\Urooted \quad:\quad\meaning\mathrooted \par |
| 58 |
% \string\Uskewed \quad:\quad\meaning\mathskewed \par |
| 59 |
% \string\Uskewedwithdelims \quad:\quad\meaning\mathskewedwithdelims \par |
| 60 |
% \string\Ustartdisplaymath \quad:\quad\meaning\mathstartdisplaymath \par |
| 61 |
% \string\Ustartmath \quad:\quad\meaning\mathstartmath \par |
| 62 |
% \string\Ustartmathmode \quad:\quad\meaning\mathstartmathmode \par |
| 63 |
% \string\Ustopdisplaymath \quad:\quad\meaning\mathstopdisplaymath \par |
| 64 |
% \string\Ustopmath \quad:\quad\meaning\mathstopmath \par |
| 65 |
% \string\Ustopmathmode \quad:\quad\meaning\mathstopmathmode \par |
| 66 |
% \string\Ustretched \quad:\quad\meaning\mathstretched \par |
| 67 |
% \string\Ustretchedwithdelims \quad:\quad\meaning\mathstretchedwithdelims \par |
| 68 |
% \string\Uunderdelimiter \quad:\quad\meaning\mathunderdelimiter \par |
| 69 |
% \string\Uvextensible \quad:\quad\meaning\mathvextensible \par |
| 70 |
|
| 71 |
% Umathaccent |
| 72 |
% Umathchar |
| 73 |
% Umathchardef |
| 74 |
|
| 75 |
% Umathnolimitsubfactor |
| 76 |
% Umathnolimitsupfactor |
| 77 |
% Umathoverbarkern |
| 78 |
% Umathoverbarrule |
| 79 |
% Umathoverbarvgap |
| 80 |
% Umathoverlinevariant |
| 81 |
% Umathspaceafterscript |
| 82 |
% Umathspacebeforescript |
| 83 |
% Umathspacebetweenscript |
| 84 |
% Umathunderbarkern |
| 85 |
% Umathunderbarrule |
| 86 |
% Umathunderbarvgap |
| 87 |
% Umathunderlinevariant |
| 88 |
|
| 89 |
\startdocument[title=Primitives] |
| 90 |
|
| 91 |
\pushoverloadmode |
| 92 |
|
| 93 |
\doifmode{checktodo}{\startbodymatter} |
| 94 |
|
| 95 |
\startsection[title={Introduction}] |
| 96 |
|
| 97 |
Here I will discuss some of the new primitives in \LUATEX\ and \LUAMETATEX, the |
| 98 |
later being a successor that permits the \CONTEXT\ folks to experiment with new |
| 99 |
features. The order is arbitrary. When you compare \LUATEX\ with \PDFTEX, there |
| 100 |
are actually quite some differences. Some primitives that \PDFTEX\ introduced |
| 101 |
have been dropped in \LUATEX\ because they can be done better in \LUA. Others |
| 102 |
have been promoted to core primitives that no longer have a \type {pdf} prefix. |
| 103 |
Then there are lots of new primitives, some introduce new concepts, some are a |
| 104 |
side effect of for instance new math font technologies, and then there are those |
| 105 |
that are handy extensions to the macro language. The \LUAMETATEX\ engine drops |
| 106 |
quite some primitives, like those related to \PDFTEX\ specific f(r)ont or backend |
| 107 |
features. It also adds some new primitives, mostly concerning the macro language. |
| 108 |
|
| 109 |
We also discuss the primitives that fit into the macro programming scope that are |
| 110 |
present in traditional \TEX\ and \ETEX\ but there are for sure better of |
| 111 |
explanations out there already. Primitives that relate to typesetting, like those |
| 112 |
controlling math, fonts, boxes, attributes, directions, catcodes, \LUA\ |
| 113 |
(functions) etc are not discussed or discussed in less detail here. |
| 114 |
|
| 115 |
There are for instance primitives to create aliases to low level registers like |
| 116 |
counters and dimensions, as well as other (semi|-|numeric) quantities like |
| 117 |
characters, but normally these are wrapped into high level macros so that |
| 118 |
definitions can't clash too much. Numbers, dimensions etc can be advanced, |
| 119 |
multiplied and divided and there is a simple expression mechanism to deal with |
| 120 |
them. We don't go into these details here: it's mostly an overview of what the |
| 121 |
engine provides. If you are new to \TEX, you need to play a while with its mixed |
| 122 |
bag of typesetting and programming features in order to understand the difference |
| 123 |
between this macro language and other languages you might be familiar with. |
| 124 |
|
| 125 |
% \starttworows \hsize.5\textwidth |
| 126 |
\startcolumns |
| 127 |
\placelist |
| 128 |
[newprimitive,oldprimitive] |
| 129 |
[alternative=c,criterium=text] |
| 130 |
\stopcolumns |
| 131 |
|
| 132 |
In this document the section titles that discuss the \color [nonecolor] {original |
| 133 |
\TEX\ and \ETEX\ primitives} have a different color those explaining the \color |
| 134 |
[primcolor] {\LUATEX\ and \LUAMETATEX\ primitives}. |
| 135 |
|
| 136 |
Primitives that extend typesetting related functionality, provide control over |
| 137 |
subsystems (like math), allocate additional data types and resources, deal with |
| 138 |
fonts and languages, manipulate boxes and glyphs, etc.\ are hardly discussed |
| 139 |
here, only mentioned. Math for instance is a topic of its own. In this document |
| 140 |
we concentrate on the programming aspects. |
| 141 |
|
| 142 |
Most of the new primitives are discussed in specific manuals and often also |
| 143 |
original primitives are covered there but the best explanations of the |
| 144 |
traditional primitives can be found in The \TEX book by Donald Knuth and \TEX\ by |
| 145 |
Topic from Victor Eijkhout. I see no need to try to improve on those. |
| 146 |
|
| 147 |
% {\em Some new primitives in this list might be forgotten or already became |
| 148 |
% obsolete. Let me know if you run into one.} |
| 149 |
|
| 150 |
% How likely is it that an eight bit setup is used? Maybe we should at some point |
| 151 |
% just replace the old math primitives like \tex {above} replace by \tex |
| 152 |
% {Uabove}. |
| 153 |
|
| 154 |
\stopsection |
| 155 |
|
| 156 |
\startsection[title=Rationale] % ,placeholder=todo] |
| 157 |
|
| 158 |
Some words about the why and how it came. One of the early adopters of \CONTEXT\ |
| 159 |
was Taco Hoekwater and we spent numerous trips to \TEX\ meetings all over the |
| 160 |
globe. He was also the only one I knew who had read the \TEX\ sources. Because |
| 161 |
\CONTEXT\ has always been on the edge of what is possible and at that time we |
| 162 |
both used it for rather advanced rendering, we also ran into the limitations. I'm |
| 163 |
not talking of \TEX\ features here. Naturally old school \TEX\ is not really |
| 164 |
geared for dealing with images of all kind, colors in all kind of color spaces, |
| 165 |
highly interactive documents, input methods like \XML, etc. The nice thing is |
| 166 |
that it offers some escapes, like specials and writes and later execution of |
| 167 |
programs that opened up lots of possibilities, so in practice there were no real |
| 168 |
limitations to what one could do. But coming up with a consistent and extensible |
| 169 |
(multi lingual) user interface was non trivial, because it had an impact in |
| 170 |
memory usage and performance. A lot could be done given some programming, as |
| 171 |
\CONTEXT\ \MKII\ proves, but it was not always pretty under the hood. The move to |
| 172 |
\LUATEX\ and \MKIV\ transferred some action to \LUA, and because \LUATEX\ |
| 173 |
effectively was a \CONTEXT\ related project, we could easily keep them in sync. |
| 174 |
|
| 175 |
Our traveling together, meeting several times per year, and eventually email and |
| 176 |
intense \LUATEX\ developments (lots of Skype sessions) for a couple of years, |
| 177 |
gave us enough opportunity to discuss all kind of nice features not present in |
| 178 |
the engine. The previous century we discussed lots of them, rejected some, stayed |
| 179 |
with others, and I admit that forgot about most of the arguments already. Some |
| 180 |
that we did was already explored in \type {eetex}, some of those ended up in |
| 181 |
\LUATEX, and eventually what we have in \LUAMETATEX\ can been seen as the result |
| 182 |
of years of programming in \TEX, improving macros, getting more performance and |
| 183 |
efficiency out of existing \CONTEXT\ code and inspiration that we got out of the |
| 184 |
\CONTEXT\ community, a demanding lot, always willing to experiment with us. |
| 185 |
|
| 186 |
Once I decided to work on \LUAMETATEX\ and bind its source to the \CONTEXT\ |
| 187 |
distribution so that we can be sure that it won't get messed up and might |
| 188 |
interfere with the \CONTEXT\ expectations, some more primitives saw their way |
| 189 |
into it. It is very easy to come up with all kind of bells and whistles but it is |
| 190 |
equally easy to hurt performance of an engine and what might go unnoticed in |
| 191 |
simple tests can really affect a macro package that depends on stability. So, what |
| 192 |
I did was mostly looking at the \CONTEXT\ code and wondering how to make some of |
| 193 |
the low level macros look more natural, also because I know that there are users |
| 194 |
who look into these sources. We spend a lot of time making them look consistent |
| 195 |
and nice and the nicer the better. Getting a better performance was seldom an |
| 196 |
argument because much is already as fast as can be so there is not that much to |
| 197 |
gain, but less clutter in tracing was an argument for some new primitives. Also, |
| 198 |
the fact that we soon might need to fall back on our phones to use \TEX\ a |
| 199 |
smaller memory footprint and less byte shuffling also was a consideration. The |
| 200 |
\LUAMETATEX\ memory footprint is somewhat smaller than the \LUATEX\ footprint. |
| 201 |
By binding \LUAMETATEX\ to \CONTEXT\ we can also guarantee that the combinations |
| 202 |
works as expected. |
| 203 |
|
| 204 |
I'm aware of the fact that \CONTEXT\ is in a somewhat unique position. First of |
| 205 |
all it has always been kind of cutting edge so its users are willing to |
| 206 |
experiment. There are users who immediately update and run tests, so bugs can and |
| 207 |
will be fixed fast. Already for a long time the community has an convenient |
| 208 |
infrastructure for updating and the build farm for generating binaries (also for |
| 209 |
other engines) is running smoothly. |
| 210 |
|
| 211 |
Then there is the \CONTEXT\ user interface that is quite consistent and permits |
| 212 |
extensions with staying backward compatible. Sometimes users run into old manuals |
| 213 |
or examples and then complain that \CONTEXT\ is not compatible but that then |
| 214 |
involves obsolete technology: we no longer need font and input encodings and font |
| 215 |
definitions are different for \OPENTYPE\ fonts. We always had an abstract backend |
| 216 |
model, but nowadays \PDF\ is kind of dominant and drives a lot of expectations. |
| 217 |
So, some of the \MKII\ commands are gone and \MKIV\ has some more. Also, as |
| 218 |
\METAPOST\ evolved that department in \CONTEXT\ also evolved. Think of it like |
| 219 |
cars: soon all are electric so one cannot expect a hole to poor in some fluid but |
| 220 |
gets a (often incompatible) plug instead. And buttons became touch panels. There |
| 221 |
is no need to use much force to steer or brake. Navigation is different, as are |
| 222 |
many controls. And do we need to steer ourselves a decade from now? |
| 223 |
|
| 224 |
So, just look at \TEX\ and \CONTEXT\ in the same way. A system from the nineties |
| 225 |
in the previous century differs from one three decades later. Demands differ, |
| 226 |
input differs, resources change, editing and processing moves on, and so on. |
| 227 |
Manuals, although still being written are seldom read from cover to cover because |
| 228 |
online searching replaced them. And who buys books about programming? So |
| 229 |
\LUAMETATEX, while still being \TEX\ also moves on, as do the way we do our low |
| 230 |
level coding. This makes sense because the original \TEX\ ecosystem was not made |
| 231 |
with a huge and complex macro package in mind, that just happened. An author was |
| 232 |
supposed to make a style for each document. An often used argument for using |
| 233 |
another macro package over \CONTEXT\ was that the later evolved and other macro |
| 234 |
packages would work the same forever and not change from the perspective of the |
| 235 |
user. In retrospect those arguments were somewhat strange because the world, |
| 236 |
computers, users etc.\ do change. Standards come and go, as do software politics |
| 237 |
and preferences. In many aspects the \TEX\ community is not different from other |
| 238 |
large software projects, operating system wars, library devotees, programming |
| 239 |
language addicts, paradigm shifts. But, don't worry, if you don't like |
| 240 |
\LUAMETATEX\ and its new primitives, just forget about them. The other engines |
| 241 |
will be there forever and are a safe bet, although \LUATEX\ already stirred up |
| 242 |
the pot I guess. But keep in mind that new features in the latest greatest |
| 243 |
\CONTEXT\ version will more and more rely on \LUAMETATEX\ being used; after all |
| 244 |
that is where it's made for. And this manual might help understand its users why, |
| 245 |
where and how the low level code differs between \MKII, \MKIV\ and \LMTX. |
| 246 |
|
| 247 |
Can we expect more new primitives than the ones introduced here? Given the amount |
| 248 |
of time I spent on experimenting and considering what made sense and what not, |
| 249 |
the answer probably is \quotation {no}, or at least \quotation {not that much}. |
| 250 |
As in the past no user ever requested the kind of primitives that were added, I |
| 251 |
don't expect users to come up with requests in the future either. Of course, |
| 252 |
those more closely related to \CONTEXT\ development look at it from the other |
| 253 |
end. Because it's there where the low level action really is, demands might still |
| 254 |
evolve. |
| 255 |
|
| 256 |
Basically there are wo areas where the engine can evolve: the programming part |
| 257 |
and the rendering. In this manual we focus on the programming and writing the |
| 258 |
manual sort of influences how details get filled in. Rendering in more complex |
| 259 |
because there heuristics and usage plays a more dominant role. Good examples are |
| 260 |
the math, par and page builder. They were extended and features were added over |
| 261 |
time but improved rendering came later. Not all extensions are critical, some are |
| 262 |
there (and got added) in order to write more readable code but there is only so |
| 263 |
much one can do in that area. Occasionally a feature pops up that is a side |
| 264 |
effect of a challenge. No matter what gets added it might not affect complexity |
| 265 |
too much and definitely not impact performance significantly! |
| 266 |
|
| 267 |
\stopsection |
| 268 |
|
| 269 |
% When writing this manual I also decided to merge some of the condition related |
| 270 |
% code so that it dealt a bit more natural with the newer features. A usual side |
| 271 |
% effects if writing manuals. |
| 272 |
|
| 273 |
\startsection[title=Primitives] |
| 274 |
|
| 275 |
\startoldprimitive[title={\prm {<space>}}] |
| 276 |
|
| 277 |
This original \TEX\ primitive is equivalent to the more verbose \prm |
| 278 |
{explicitspace}. |
| 279 |
|
| 280 |
\stopoldprimitive |
| 281 |
|
| 282 |
\startoldprimitive[title={\prm {-}}] |
| 283 |
|
| 284 |
This original \TEX\ primitive is equivalent to the more verbose \prm |
| 285 |
{explicitdiscretionary}. |
| 286 |
|
| 287 |
\stopoldprimitive |
| 288 |
|
| 289 |
\startoldprimitive[title={\prm {/}}] |
| 290 |
|
| 291 |
This original \TEX\ primitive is equivalent to the more verbose \prm |
| 292 |
{explicititaliccorrection}. |
| 293 |
|
| 294 |
\stopoldprimitive |
| 295 |
|
| 296 |
% \startnewprimitive[title={\prm {Uabove}}] |
| 297 |
% \stopnewprimitive |
| 298 |
|
| 299 |
% \startnewprimitive[title={\prm {Uabovewithdelims}}] |
| 300 |
% \stopnewprimitive |
| 301 |
|
| 302 |
% \startnewprimitive[title={\prm {Uatop}}] |
| 303 |
% \stopnewprimitive |
| 304 |
|
| 305 |
% \startnewprimitive[title={\prm {Uatopwithdelims}}] |
| 306 |
% \stopnewprimitive |
| 307 |
|
| 308 |
% \startnewprimitive[title={\prm {Udelcode}}] |
| 309 |
% \stopnewprimitive |
| 310 |
|
| 311 |
% \startnewprimitive[title={\prm {Udelimited}}] |
| 312 |
% \stopnewprimitive |
| 313 |
|
| 314 |
% \startnewprimitive[title={\prm {Udelimiter}}] |
| 315 |
% \stopnewprimitive |
| 316 |
|
| 317 |
% \startnewprimitive[title={\prm {Udelimiterover}}] |
| 318 |
% \stopnewprimitive |
| 319 |
|
| 320 |
% \startnewprimitive[title={\prm {Udelimiterunder}}] |
| 321 |
% \stopnewprimitive |
| 322 |
|
| 323 |
% \startnewprimitive[title={\prm {Uhextensible}}] |
| 324 |
% \stopnewprimitive |
| 325 |
|
| 326 |
% \startnewprimitive[title={\prm {Uleft}}] |
| 327 |
% \stopnewprimitive |
| 328 |
|
| 329 |
% \startnewprimitive[title={\prm {Umathaccent}}] |
| 330 |
% \stopnewprimitive |
| 331 |
|
| 332 |
% \startnewprimitive[title={\prm {Umathaccentbasedepth}}] |
| 333 |
% \stopnewprimitive |
| 334 |
|
| 335 |
% \startnewprimitive[title={\prm {Umathaccentbaseheight}}] |
| 336 |
% \stopnewprimitive |
| 337 |
|
| 338 |
% \startnewprimitive[title={\prm {Umathaccentbottomovershoot}}] |
| 339 |
% \stopnewprimitive |
| 340 |
|
| 341 |
% \startnewprimitive[title={\prm {Umathaccentbottomshiftdown}}] |
| 342 |
% \stopnewprimitive |
| 343 |
|
| 344 |
% \startnewprimitive[title={\prm {Umathaccentextendmargin}}] |
| 345 |
% \stopnewprimitive |
| 346 |
|
| 347 |
% \startnewprimitive[title={\prm {Umathaccentsuperscriptdrop}}] |
| 348 |
% \stopnewprimitive |
| 349 |
|
| 350 |
% \startnewprimitive[title={\prm {Umathaccentsuperscriptpercent}}] |
| 351 |
% \stopnewprimitive |
| 352 |
|
| 353 |
% \startnewprimitive[title={\prm {Umathaccenttopovershoot}}] |
| 354 |
% \stopnewprimitive |
| 355 |
|
| 356 |
% \startnewprimitive[title={\prm {Umathaccenttopshiftup}}] |
| 357 |
% \stopnewprimitive |
| 358 |
|
| 359 |
% \startnewprimitive[title={\prm {Umathaccentvariant}}] |
| 360 |
% \stopnewprimitive |
| 361 |
|
| 362 |
% \startnewprimitive[title={\prm {Umathadapttoleft}}] |
| 363 |
% \stopnewprimitive |
| 364 |
|
| 365 |
% \startnewprimitive[title={\prm {Umathadapttoright}}] |
| 366 |
% \stopnewprimitive |
| 367 |
|
| 368 |
% \startnewprimitive[title={\prm {Umathaxis}}] |
| 369 |
% \stopnewprimitive |
| 370 |
|
| 371 |
% \startnewprimitive[title={\prm {Umathbottomaccentvariant}}] |
| 372 |
% \stopnewprimitive |
| 373 |
|
| 374 |
% \startnewprimitive[title={\prm {Umathchar}}] |
| 375 |
% \stopnewprimitive |
| 376 |
|
| 377 |
% \startnewprimitive[title={\prm {Umathchardef}}] |
| 378 |
% \stopnewprimitive |
| 379 |
|
| 380 |
% \startnewprimitive[title={\prm {Umathcode}}] |
| 381 |
% \stopnewprimitive |
| 382 |
|
| 383 |
% \startnewprimitive[title={\prm {Umathconnectoroverlapmin}}] |
| 384 |
% \stopnewprimitive |
| 385 |
|
| 386 |
% \startnewprimitive[title={\prm {Umathdegreevariant}}] |
| 387 |
% \stopnewprimitive |
| 388 |
|
| 389 |
% \startnewprimitive[title={\prm {Umathdelimiterextendmargin}}] |
| 390 |
% \stopnewprimitive |
| 391 |
|
| 392 |
% \startnewprimitive[title={\prm {Umathdelimiterovervariant}}] |
| 393 |
% \stopnewprimitive |
| 394 |
|
| 395 |
% \startnewprimitive[title={\prm {Umathdelimiterpercent}}] |
| 396 |
% \stopnewprimitive |
| 397 |
|
| 398 |
% \startnewprimitive[title={\prm {Umathdelimitershortfall}}] |
| 399 |
% \stopnewprimitive |
| 400 |
|
| 401 |
% \startnewprimitive[title={\prm {Umathdelimiterundervariant}}] |
| 402 |
% \stopnewprimitive |
| 403 |
|
| 404 |
% \startnewprimitive[title={\prm {Umathdenominatorvariant}}] |
| 405 |
% \stopnewprimitive |
| 406 |
|
| 407 |
% \startnewprimitive[title={\prm {Umathdictdef}}] |
| 408 |
% \stopnewprimitive |
| 409 |
|
| 410 |
% \startnewprimitive[title={\prm {Umathexheight}}] |
| 411 |
% \stopnewprimitive |
| 412 |
|
| 413 |
% \startnewprimitive[title={\prm {Umathextrasubpreshift}}] |
| 414 |
% \stopnewprimitive |
| 415 |
|
| 416 |
% \startnewprimitive[title={\prm {Umathextrasubprespace}}] |
| 417 |
% \stopnewprimitive |
| 418 |
|
| 419 |
% \startnewprimitive[title={\prm {Umathextrasubshift}}] |
| 420 |
% \stopnewprimitive |
| 421 |
|
| 422 |
% \startnewprimitive[title={\prm {Umathextrasubspace}}] |
| 423 |
% \stopnewprimitive |
| 424 |
|
| 425 |
% \startnewprimitive[title={\prm {Umathextrasuppreshift}}] |
| 426 |
% \stopnewprimitive |
| 427 |
|
| 428 |
% \startnewprimitive[title={\prm {Umathextrasupprespace}}] |
| 429 |
% \stopnewprimitive |
| 430 |
|
| 431 |
% \startnewprimitive[title={\prm {Umathextrasupshift}}] |
| 432 |
% \stopnewprimitive |
| 433 |
|
| 434 |
% \startnewprimitive[title={\prm {Umathextrasupspace}}] |
| 435 |
% \stopnewprimitive |
| 436 |
|
| 437 |
% \startnewprimitive[title={\prm {Umathflattenedaccentbasedepth}}] |
| 438 |
% \stopnewprimitive |
| 439 |
|
| 440 |
% \startnewprimitive[title={\prm {Umathflattenedaccentbaseheight}}] |
| 441 |
% \stopnewprimitive |
| 442 |
|
| 443 |
% \startnewprimitive[title={\prm {Umathflattenedaccentbottomshiftdown}}] |
| 444 |
% \stopnewprimitive |
| 445 |
|
| 446 |
% \startnewprimitive[title={\prm {Umathflattenedaccenttopshiftup}}] |
| 447 |
% \stopnewprimitive |
| 448 |
|
| 449 |
% \startnewprimitive[title={\prm {Umathfractiondelsize}}] |
| 450 |
% \stopnewprimitive |
| 451 |
|
| 452 |
% \startnewprimitive[title={\prm {Umathfractiondenomdown}}] |
| 453 |
% \stopnewprimitive |
| 454 |
|
| 455 |
% \startnewprimitive[title={\prm {Umathfractiondenomvgap}}] |
| 456 |
% \stopnewprimitive |
| 457 |
|
| 458 |
% \startnewprimitive[title={\prm {Umathfractionnumup}}] |
| 459 |
% \stopnewprimitive |
| 460 |
|
| 461 |
% \startnewprimitive[title={\prm {Umathfractionnumvgap}}] |
| 462 |
% \stopnewprimitive |
| 463 |
|
| 464 |
% \startnewprimitive[title={\prm {Umathfractionrule}}] |
| 465 |
% \stopnewprimitive |
| 466 |
|
| 467 |
% \startnewprimitive[title={\prm {Umathfractionvariant}}] |
| 468 |
% \stopnewprimitive |
| 469 |
|
| 470 |
% \startnewprimitive[title={\prm {Umathhextensiblevariant}}] |
| 471 |
% \stopnewprimitive |
| 472 |
|
| 473 |
% \startnewprimitive[title={\prm {Umathlimitabovebgap}}] |
| 474 |
% \stopnewprimitive |
| 475 |
|
| 476 |
% \startnewprimitive[title={\prm {Umathlimitabovekern}}] |
| 477 |
% \stopnewprimitive |
| 478 |
|
| 479 |
% \startnewprimitive[title={\prm {Umathlimitabovevgap}}] |
| 480 |
% \stopnewprimitive |
| 481 |
|
| 482 |
% \startnewprimitive[title={\prm {Umathlimitbelowbgap}}] |
| 483 |
% \stopnewprimitive |
| 484 |
|
| 485 |
% \startnewprimitive[title={\prm {Umathlimitbelowkern}}] |
| 486 |
% \stopnewprimitive |
| 487 |
|
| 488 |
% \startnewprimitive[title={\prm {Umathlimitbelowvgap}}] |
| 489 |
% \stopnewprimitive |
| 490 |
|
| 491 |
% \startnewprimitive[title={\prm {Umathlimits}}] |
| 492 |
% \stopnewprimitive |
| 493 |
|
| 494 |
% \startnewprimitive[title={\prm {Umathnoaxis}}] |
| 495 |
% \stopnewprimitive |
| 496 |
|
| 497 |
% \startnewprimitive[title={\prm {Umathnolimits}}] |
| 498 |
% \stopnewprimitive |
| 499 |
|
| 500 |
% \startnewprimitive[title={\prm {Umathnolimitsubfactor}}] |
| 501 |
% \stopnewprimitive |
| 502 |
|
| 503 |
% \startnewprimitive[title={\prm {Umathnolimitsupfactor}}] |
| 504 |
% \stopnewprimitive |
| 505 |
|
| 506 |
% \startnewprimitive[title={\prm {Umathnumeratorvariant}}] |
| 507 |
% \stopnewprimitive |
| 508 |
|
| 509 |
% \startnewprimitive[title={\prm {Umathopenupdepth}}] |
| 510 |
% \stopnewprimitive |
| 511 |
|
| 512 |
% \startnewprimitive[title={\prm {Umathopenupheight}}] |
| 513 |
% \stopnewprimitive |
| 514 |
|
| 515 |
% \startnewprimitive[title={\prm {Umathoperatorsize}}] |
| 516 |
% \stopnewprimitive |
| 517 |
|
| 518 |
% \startnewprimitive[title={\prm {Umathoverbarkern}}] |
| 519 |
% \stopnewprimitive |
| 520 |
|
| 521 |
% \startnewprimitive[title={\prm {Umathoverbarrule}}] |
| 522 |
% \stopnewprimitive |
| 523 |
|
| 524 |
% \startnewprimitive[title={\prm {Umathoverbarvgap}}] |
| 525 |
% \stopnewprimitive |
| 526 |
|
| 527 |
% \startnewprimitive[title={\prm {Umathoverdelimiterbgap}}] |
| 528 |
% \stopnewprimitive |
| 529 |
|
| 530 |
% \startnewprimitive[title={\prm {Umathoverdelimitervariant}}] |
| 531 |
% \stopnewprimitive |
| 532 |
|
| 533 |
% \startnewprimitive[title={\prm {Umathoverdelimitervgap}}] |
| 534 |
% \stopnewprimitive |
| 535 |
|
| 536 |
% \startnewprimitive[title={\prm {Umathoverlayaccentvariant}}] |
| 537 |
% \stopnewprimitive |
| 538 |
|
| 539 |
% \startnewprimitive[title={\prm {Umathoverlinevariant}}] |
| 540 |
% \stopnewprimitive |
| 541 |
|
| 542 |
% \startnewprimitive[title={\prm {Umathphantom}}] |
| 543 |
% \stopnewprimitive |
| 544 |
|
| 545 |
% \startnewprimitive[title={\prm {Umathprimeraise}}] |
| 546 |
% \stopnewprimitive |
| 547 |
|
| 548 |
% \startnewprimitive[title={\prm {Umathprimeraisecomposed}}] |
| 549 |
% \stopnewprimitive |
| 550 |
|
| 551 |
% \startnewprimitive[title={\prm {Umathprimeshiftdrop}}] |
| 552 |
% \stopnewprimitive |
| 553 |
|
| 554 |
% \startnewprimitive[title={\prm {Umathprimeshiftup}}] |
| 555 |
% \stopnewprimitive |
| 556 |
|
| 557 |
% \startnewprimitive[title={\prm {Umathprimespaceafter}}] |
| 558 |
% \stopnewprimitive |
| 559 |
|
| 560 |
% \startnewprimitive[title={\prm {Umathprimevariant}}] |
| 561 |
% \stopnewprimitive |
| 562 |
|
| 563 |
% \startnewprimitive[title={\prm {Umathquad}}] |
| 564 |
% \stopnewprimitive |
| 565 |
|
| 566 |
% \startnewprimitive[title={\prm {Umathradicaldegreeafter}}] |
| 567 |
% \stopnewprimitive |
| 568 |
|
| 569 |
% \startnewprimitive[title={\prm {Umathradicaldegreebefore}}] |
| 570 |
% \stopnewprimitive |
| 571 |
|
| 572 |
% \startnewprimitive[title={\prm {Umathradicaldegreeraise}}] |
| 573 |
% \stopnewprimitive |
| 574 |
|
| 575 |
% \startnewprimitive[title={\prm {Umathradicalextensibleafter}}] |
| 576 |
% \stopnewprimitive |
| 577 |
|
| 578 |
% \startnewprimitive[title={\prm {Umathradicalextensiblebefore}}] |
| 579 |
% \stopnewprimitive |
| 580 |
|
| 581 |
% \startnewprimitive[title={\prm {Umathradicalkern}}] |
| 582 |
% \stopnewprimitive |
| 583 |
|
| 584 |
% \startnewprimitive[title={\prm {Umathradicalrule}}] |
| 585 |
% \stopnewprimitive |
| 586 |
|
| 587 |
% \startnewprimitive[title={\prm {Umathradicalvariant}}] |
| 588 |
% \stopnewprimitive |
| 589 |
|
| 590 |
% \startnewprimitive[title={\prm {Umathradicalvgap}}] |
| 591 |
% \stopnewprimitive |
| 592 |
|
| 593 |
% \startnewprimitive[title={\prm {Umathruledepth}}] |
| 594 |
% \stopnewprimitive |
| 595 |
|
| 596 |
% \startnewprimitive[title={\prm {Umathruleheight}}] |
| 597 |
% \stopnewprimitive |
| 598 |
|
| 599 |
% \startnewprimitive[title={\prm {Umathskeweddelimitertolerance}}] |
| 600 |
% \stopnewprimitive |
| 601 |
|
| 602 |
% \startnewprimitive[title={\prm {Umathskewedfractionhgap}}] |
| 603 |
% \stopnewprimitive |
| 604 |
|
| 605 |
% \startnewprimitive[title={\prm {Umathskewedfractionvgap}}] |
| 606 |
% \stopnewprimitive |
| 607 |
|
| 608 |
% \startnewprimitive[title={\prm {Umathsource}}] |
| 609 |
% \stopnewprimitive |
| 610 |
|
| 611 |
% \startnewprimitive[title={\prm {Umathspaceafterscript}}] |
| 612 |
% \stopnewprimitive |
| 613 |
|
| 614 |
% \startnewprimitive[title={\prm {Umathspacebeforescript}}] |
| 615 |
% \stopnewprimitive |
| 616 |
|
| 617 |
% \startnewprimitive[title={\prm {Umathspacebetweenscript}}] |
| 618 |
% \stopnewprimitive |
| 619 |
|
| 620 |
% \startnewprimitive[title={\prm {Umathstackdenomdown}}] |
| 621 |
% \stopnewprimitive |
| 622 |
|
| 623 |
% \startnewprimitive[title={\prm {Umathstacknumup}}] |
| 624 |
% \stopnewprimitive |
| 625 |
|
| 626 |
% \startnewprimitive[title={\prm {Umathstackvariant}}] |
| 627 |
% \stopnewprimitive |
| 628 |
|
| 629 |
% \startnewprimitive[title={\prm {Umathstackvgap}}] |
| 630 |
% \stopnewprimitive |
| 631 |
|
| 632 |
% \startnewprimitive[title={\prm {Umathsubscriptsnap}}] |
| 633 |
% \stopnewprimitive |
| 634 |
|
| 635 |
% \startnewprimitive[title={\prm {Umathsubscriptvariant}}] |
| 636 |
% \stopnewprimitive |
| 637 |
|
| 638 |
% \startnewprimitive[title={\prm {Umathsubshiftdown}}] |
| 639 |
% \stopnewprimitive |
| 640 |
|
| 641 |
% \startnewprimitive[title={\prm {Umathsubshiftdrop}}] |
| 642 |
% \stopnewprimitive |
| 643 |
|
| 644 |
% \startnewprimitive[title={\prm {Umathsubsupshiftdown}}] |
| 645 |
% \stopnewprimitive |
| 646 |
|
| 647 |
% \startnewprimitive[title={\prm {Umathsubsupvgap}}] |
| 648 |
% \stopnewprimitive |
| 649 |
|
| 650 |
% \startnewprimitive[title={\prm {Umathsubtopmax}}] |
| 651 |
% \stopnewprimitive |
| 652 |
|
| 653 |
% \startnewprimitive[title={\prm {Umathsupbottommin}}] |
| 654 |
% \stopnewprimitive |
| 655 |
|
| 656 |
% \startnewprimitive[title={\prm {Umathsuperscriptsnap}}] |
| 657 |
% \stopnewprimitive |
| 658 |
|
| 659 |
% \startnewprimitive[title={\prm {Umathsuperscriptvariant}}] |
| 660 |
% \stopnewprimitive |
| 661 |
|
| 662 |
% \startnewprimitive[title={\prm {Umathsupshiftdrop}}] |
| 663 |
% \stopnewprimitive |
| 664 |
|
| 665 |
% \startnewprimitive[title={\prm {Umathsupshiftup}}] |
| 666 |
% \stopnewprimitive |
| 667 |
|
| 668 |
% \startnewprimitive[title={\prm {Umathsupsubbottommax}}] |
| 669 |
% \stopnewprimitive |
| 670 |
|
| 671 |
% \startnewprimitive[title={\prm {Umathtopaccentvariant}}] |
| 672 |
% \stopnewprimitive |
| 673 |
|
| 674 |
% \startnewprimitive[title={\prm {Umathunderbarkern}}] |
| 675 |
% \stopnewprimitive |
| 676 |
|
| 677 |
% \startnewprimitive[title={\prm {Umathunderbarrule}}] |
| 678 |
% \stopnewprimitive |
| 679 |
|
| 680 |
% \startnewprimitive[title={\prm {Umathunderbarvgap}}] |
| 681 |
% \stopnewprimitive |
| 682 |
|
| 683 |
% \startnewprimitive[title={\prm {Umathunderdelimiterbgap}}] |
| 684 |
% \stopnewprimitive |
| 685 |
|
| 686 |
% \startnewprimitive[title={\prm {Umathunderdelimitervariant}}] |
| 687 |
% \stopnewprimitive |
| 688 |
|
| 689 |
% \startnewprimitive[title={\prm {Umathunderdelimitervgap}}] |
| 690 |
% \stopnewprimitive |
| 691 |
|
| 692 |
% \startnewprimitive[title={\prm {Umathunderlinevariant}}] |
| 693 |
% \stopnewprimitive |
| 694 |
|
| 695 |
% \startnewprimitive[title={\prm {Umathuseaxis}}] |
| 696 |
% \stopnewprimitive |
| 697 |
|
| 698 |
% \startnewprimitive[title={\prm {Umathvextensiblevariant}}] |
| 699 |
% \stopnewprimitive |
| 700 |
|
| 701 |
% \startnewprimitive[title={\prm {Umathvoid}}] |
| 702 |
% \stopnewprimitive |
| 703 |
|
| 704 |
\startnewprimitive[title={\prm {Umathxscale}}] |
| 705 |
|
| 706 |
The \prm {Umathxscale} and \prm {Umathyscale} factors are applied to the |
| 707 |
horizontal and vertical parameters. They are set by style. There is no combined |
| 708 |
scaling primitive. |
| 709 |
|
| 710 |
\startbuffer |
| 711 |
$\Umathxscale\textstyle 800 a + b + x + d + e = f $\par |
| 712 |
$\Umathxscale\textstyle 1000 a + b + x + d + e = f $\par |
| 713 |
$\Umathxscale\textstyle 1200 a + b + x + d + e = f $\blank |
| 714 |
|
| 715 |
$\Umathyscale\textstyle 800 \sqrt[2]{x+1}$\quad |
| 716 |
$\Umathyscale\textstyle 1000 \sqrt[2]{x+1}$\quad |
| 717 |
$\Umathyscale\textstyle 1200 \sqrt[2]{x+1}$\blank |
| 718 |
\stopbuffer |
| 719 |
|
| 720 |
\typebuffer |
| 721 |
|
| 722 |
Normally only small deviations from 1000 make sense but here we want to show the |
| 723 |
effect and use a 20\percent\ scaling: |
| 724 |
|
| 725 |
\getbuffer |
| 726 |
|
| 727 |
\stopnewprimitive |
| 728 |
|
| 729 |
\startnewprimitive[title={\prm {Umathyscale}}] |
| 730 |
|
| 731 |
See \prm {Umathxscale}] |
| 732 |
|
| 733 |
\stopnewprimitive |
| 734 |
|
| 735 |
% \startnewprimitive[title={\prm {Umiddle}}] |
| 736 |
% \stopnewprimitive |
| 737 |
|
| 738 |
% \startnewprimitive[title={\prm {Uoperator}}] |
| 739 |
% \stopnewprimitive |
| 740 |
|
| 741 |
% \startnewprimitive[title={\prm {Uover}}] |
| 742 |
% \stopnewprimitive |
| 743 |
|
| 744 |
% \startnewprimitive[title={\prm {Uoverdelimiter}}] |
| 745 |
% \stopnewprimitive |
| 746 |
|
| 747 |
% \startnewprimitive[title={\prm {Uoverwithdelims}}] |
| 748 |
% \stopnewprimitive |
| 749 |
|
| 750 |
% \startnewprimitive[title={\prm {Uradical}}] |
| 751 |
% \stopnewprimitive |
| 752 |
|
| 753 |
% \startnewprimitive[title={\prm {Uright}}] |
| 754 |
% \stopnewprimitive |
| 755 |
|
| 756 |
% \startnewprimitive[title={\prm {Uroot}}] |
| 757 |
% \stopnewprimitive |
| 758 |
|
| 759 |
% \startnewprimitive[title={\prm {Urooted}}] |
| 760 |
% \stopnewprimitive |
| 761 |
|
| 762 |
% \startnewprimitive[title={\prm {Uskewed}}] |
| 763 |
% \stopnewprimitive |
| 764 |
|
| 765 |
% \startnewprimitive[title={\prm {Uskewedwithdelims}}] |
| 766 |
% \stopnewprimitive |
| 767 |
|
| 768 |
% \startnewprimitive[title={\prm {Ustartdisplaymath}}] |
| 769 |
% \stopnewprimitive |
| 770 |
|
| 771 |
% \startnewprimitive[title={\prm {Ustartmath}}] |
| 772 |
% \stopnewprimitive |
| 773 |
|
| 774 |
% \startnewprimitive[title={\prm {Ustartmathmode}}] |
| 775 |
% \stopnewprimitive |
| 776 |
|
| 777 |
% \startnewprimitive[title={\prm {Ustopdisplaymath}}] |
| 778 |
% \stopnewprimitive |
| 779 |
|
| 780 |
% \startnewprimitive[title={\prm {Ustopmath}}] |
| 781 |
% \stopnewprimitive |
| 782 |
|
| 783 |
% \startnewprimitive[title={\prm {Ustopmathmode}}] |
| 784 |
% \stopnewprimitive |
| 785 |
|
| 786 |
% \startnewprimitive[title={\prm {Ustretched}}] |
| 787 |
% \stopnewprimitive |
| 788 |
|
| 789 |
% \startnewprimitive[title={\prm {Ustretchedwithdelims}}] |
| 790 |
% \stopnewprimitive |
| 791 |
|
| 792 |
% \startnewprimitive[title={\prm {Uunderdelimiter}}] |
| 793 |
% \stopnewprimitive |
| 794 |
|
| 795 |
% \startnewprimitive[title={\prm {Uvextensible}}] |
| 796 |
% \stopnewprimitive |
| 797 |
|
| 798 |
\startoldprimitive[title={\prm {above}}][obsolete=yes] |
| 799 |
|
| 800 |
This is a variant of \prm {over} that doesn't put a rule in between. |
| 801 |
|
| 802 |
\stopoldprimitive |
| 803 |
|
| 804 |
\startoldprimitive[title={\prm {abovedisplayshortskip}}] |
| 805 |
|
| 806 |
The glue injected before a display formula when the line above it is not |
| 807 |
overlapping with the formula. Watch out for interference with \prm |
| 808 |
{baselineskip}. It can be controlled by \prm {displayskipmode}. |
| 809 |
|
| 810 |
\stopoldprimitive |
| 811 |
|
| 812 |
\startoldprimitive[title={\prm {abovedisplayskip}}] |
| 813 |
|
| 814 |
The glue injected before a display formula. Watch out for interference with |
| 815 |
\prm {baselineskip}. It can be controlled by \prm {displayskipmode}. |
| 816 |
|
| 817 |
\stopoldprimitive |
| 818 |
|
| 819 |
\startoldprimitive[title={\prm {abovewithdelims}}][obsolete=yes] |
| 820 |
|
| 821 |
This is a variant of \prm {atop} but with delimiters. It has a more advanced |
| 822 |
upgrade in \prm {Uabovewithdelims}. |
| 823 |
|
| 824 |
\stopoldprimitive |
| 825 |
|
| 826 |
\startoldprimitive[title={\prm {accent}}][obsolete=yes] |
| 827 |
|
| 828 |
This primitive is kind of obsolete in wide engines and takes two arguments: the |
| 829 |
indexes of an accent and a base character. |
| 830 |
|
| 831 |
\stopoldprimitive |
| 832 |
|
| 833 |
\startnewprimitive[title={\prm {additionalpageskip}}] |
| 834 |
|
| 835 |
This quantity will be added to the current page goal, stretch and shrink after |
| 836 |
which it will be set to zero. |
| 837 |
|
| 838 |
\stopnewprimitive |
| 839 |
|
| 840 |
\startnewprimitive[title={\prm {adjacentdemerits}}] |
| 841 |
|
| 842 |
This is a more granular variant of \prm {adjdemerits} and mostly meant for multipass |
| 843 |
par building, for instance: |
| 844 |
|
| 845 |
\starttyping |
| 846 |
\adjacentdemerits 8 0 2500 5000 7500 10000 12500 15000 20000 |
| 847 |
\stoptyping |
| 848 |
|
| 849 |
More details can be found in the \quote {beyond paragraphs} chapter of the \quote |
| 850 |
{beyond} progress report. One can also discriminate between loose and tight |
| 851 |
deltas. In these examples we also assume a more granular fitness classes setup. |
| 852 |
|
| 853 |
\starttyping |
| 854 |
\adjacentdemerits 8 double |
| 855 |
0 2500 5000 7500 10000 12500 15000 20000 |
| 856 |
20000 15000 125000 10000 7500 5000 2500 0 |
| 857 |
\stoptyping |
| 858 |
|
| 859 |
\stopnewprimitive |
| 860 |
|
| 861 |
\startoldprimitive[title={\prm {adjdemerits}}] |
| 862 |
|
| 863 |
When \TEX\ considers to lines to be incompatible it will add this penalty to its |
| 864 |
verdict when considering this breakpoint. |
| 865 |
|
| 866 |
\stopoldprimitive |
| 867 |
|
| 868 |
\startnewprimitive[title={\prm {adjustspacing}}] |
| 869 |
|
| 870 |
This parameter controls expansion (hz). A value~2 expands glyphs and font kerns |
| 871 |
and a value of~3 only glyphs. Expansion of kerns can have side effects when they |
| 872 |
are used for positioning by \OPENTYPE\ features. |
| 873 |
|
| 874 |
\stopnewprimitive |
| 875 |
|
| 876 |
\startnewprimitive[title={\prm {adjustspacingshrink}}] |
| 877 |
|
| 878 |
When set to a non zero value this overloads the shrink maximum in a font when |
| 879 |
expansion is applied. This is then the case for all fonts. |
| 880 |
|
| 881 |
\stopnewprimitive |
| 882 |
|
| 883 |
\startnewprimitive[title={\prm {adjustspacingstep}}] |
| 884 |
|
| 885 |
When set to a non zero value this overloads the expansion step in a font when |
| 886 |
expansion is applied. This is then the case for all fonts. |
| 887 |
|
| 888 |
\stopnewprimitive |
| 889 |
|
| 890 |
\startnewprimitive[title={\prm {adjustspacingstretch}}] |
| 891 |
|
| 892 |
When set to a non zero value this overloads the stretch maximum in a font when |
| 893 |
expansion is applied. This is then the case for all fonts. |
| 894 |
|
| 895 |
\stopnewprimitive |
| 896 |
|
| 897 |
\startoldprimitive[title={\prm {advance}}] |
| 898 |
|
| 899 |
Advances the given register by an also given value: |
| 900 |
|
| 901 |
\starttyping |
| 902 |
\advance\scratchdimen 10pt |
| 903 |
\advance\scratchdimen by 3pt |
| 904 |
\advance\scratchcounterone \zerocount |
| 905 |
\advance\scratchcounterone \scratchcountertwo |
| 906 |
\stoptyping |
| 907 |
|
| 908 |
The \type {by} keyword is optional. |
| 909 |
|
| 910 |
\stopoldprimitive |
| 911 |
|
| 912 |
\startnewprimitive[title={\prm {advanceby}}] |
| 913 |
|
| 914 |
This is slightly more efficient variant of \prm {advance} that doesn't look for |
| 915 |
\type {by} and therefore, if one is missing, doesn't need to push back the last |
| 916 |
seen token. Using \prm {advance} with \type {by} is nearly as efficient but takes |
| 917 |
more tokens. |
| 918 |
|
| 919 |
\stopnewprimitive |
| 920 |
|
| 921 |
\startnewprimitive[title={\prm {afterassigned}}] |
| 922 |
|
| 923 |
The \prm {afterassignment} primitive stores a token to be injected (and thereby |
| 924 |
expanded) after an assignment has happened. Unlike \prm {aftergroup}, multiple |
| 925 |
calls are not accumulated, and changing that would be too incompatible. This is |
| 926 |
why we have \prm {afterassigned}, which can be used to inject a bunch of |
| 927 |
tokens. But in order to be consistent this one is also not accumulative. |
| 928 |
|
| 929 |
\startbuffer |
| 930 |
\afterassigned{done}% |
| 931 |
\afterassigned{{\bf done}}% |
| 932 |
\scratchcounter=123 |
| 933 |
\stopbuffer |
| 934 |
|
| 935 |
\typebuffer |
| 936 |
|
| 937 |
results in: \inlinebuffer\ being typeset. |
| 938 |
|
| 939 |
\stopnewprimitive |
| 940 |
|
| 941 |
\startoldprimitive[title={\prm {afterassignment}}] |
| 942 |
|
| 943 |
The token following \prm {afterassignment}, a traditional \TEX\ primitive, is |
| 944 |
saved and gets injected (and then expanded) after a following assignment took |
| 945 |
place. |
| 946 |
|
| 947 |
\startbuffer |
| 948 |
\afterassignment !\def\MyMacro {}\quad |
| 949 |
\afterassignment !\let\MyMacro ?\quad |
| 950 |
\afterassignment !\scratchcounter 123\quad |
| 951 |
\afterassignment !% |
| 952 |
\afterassignment ?\advance\scratchcounter by 1 |
| 953 |
\stopbuffer |
| 954 |
|
| 955 |
\typebuffer |
| 956 |
|
| 957 |
The \prm {afterassignment}s are not accumulated, the last one wins: |
| 958 |
|
| 959 |
{\getbuffer} |
| 960 |
|
| 961 |
\stopoldprimitive |
| 962 |
|
| 963 |
\startoldprimitive[title={\prm {aftergroup}}] |
| 964 |
|
| 965 |
The traditional \TEX\ \prm {aftergroup} primitive stores the next token and |
| 966 |
expands that after the group has been closed. |
| 967 |
|
| 968 |
\startbuffer |
| 969 |
before{ ! \aftergroup a\aftergroup f\aftergroup t\aftergroup e\aftergroup r} |
| 970 |
\stopbuffer |
| 971 |
|
| 972 |
Multiple \prm {aftergroup}s are combined: |
| 973 |
|
| 974 |
\typebuffer |
| 975 |
|
| 976 |
\getbuffer |
| 977 |
|
| 978 |
\stopoldprimitive |
| 979 |
|
| 980 |
\startnewprimitive[title={\prm {aftergrouped}}] |
| 981 |
|
| 982 |
The in itself powerful \prm {aftergroup} primitives works quite well, even |
| 983 |
if you need to do more than one thing: you can either use it multiple times, or |
| 984 |
you can define a macro that does multiple things and apply that after the group. |
| 985 |
However, you can avoid that by using this primitive which takes a list of tokens. |
| 986 |
|
| 987 |
\startbuffer |
| 988 |
regular |
| 989 |
\bgroup |
| 990 |
\aftergrouped{regular}% |
| 991 |
\bf bold |
| 992 |
\egroup |
| 993 |
\stopbuffer |
| 994 |
|
| 995 |
\typebuffer |
| 996 |
|
| 997 |
Because it happens after the group, we're no longer typesetting in bold. |
| 998 |
|
| 999 |
{\getbuffer} |
| 1000 |
|
| 1001 |
You can mix \prm {aftergroup} and \prm {aftergrouped}. Which one is more |
| 1002 |
efficient depends on how many tokens are delayed. Picking up one token is faster |
| 1003 |
than scanning a list. |
| 1004 |
|
| 1005 |
\startbuffer |
| 1006 |
{ |
| 1007 |
\aftergroup A \aftergroup B \aftergroup C |
| 1008 |
test 1 : } |
| 1009 |
|
| 1010 |
{ |
| 1011 |
\aftergrouped{What comes next 1} |
| 1012 |
\aftergrouped{What comes next 2} |
| 1013 |
\aftergrouped{What comes next 3} |
| 1014 |
test 2 : } |
| 1015 |
|
| 1016 |
|
| 1017 |
{ |
| 1018 |
\aftergroup A \aftergrouped{What comes next 1} |
| 1019 |
\aftergroup B \aftergrouped{What comes next 2} |
| 1020 |
\aftergroup C \aftergrouped{What comes next 3} |
| 1021 |
test 3 : } |
| 1022 |
|
| 1023 |
{ |
| 1024 |
\aftergrouped{What comes next 1} \aftergroup A |
| 1025 |
\aftergrouped{What comes next 2} \aftergroup B |
| 1026 |
\aftergrouped{What comes next 3} \aftergroup C |
| 1027 |
test 4 : } |
| 1028 |
\stopbuffer |
| 1029 |
|
| 1030 |
\typebuffer |
| 1031 |
|
| 1032 |
This gives: |
| 1033 |
|
| 1034 |
\startpacked\getbuffer\stoppacked |
| 1035 |
|
| 1036 |
\stopnewprimitive |
| 1037 |
|
| 1038 |
\startnewprimitive[title={\prm {aliased}}] |
| 1039 |
|
| 1040 |
This primitive is part of the overload protection subsystem where control sequences |
| 1041 |
can be tagged. |
| 1042 |
|
| 1043 |
\startbuffer |
| 1044 |
\permanent\def\foo{FOO} |
| 1045 |
\let\ofo\foo |
| 1046 |
\aliased \let\oof\foo |
| 1047 |
|
| 1048 |
\meaningasis\foo |
| 1049 |
\meaningasis\ofo |
| 1050 |
\meaningasis\oof |
| 1051 |
\stopbuffer |
| 1052 |
|
| 1053 |
\typebuffer |
| 1054 |
|
| 1055 |
gives: |
| 1056 |
|
| 1057 |
\startlines \tt |
| 1058 |
\getbuffer |
| 1059 |
\stoplines |
| 1060 |
|
| 1061 |
When a something is \prm {let} the \quote {permanent}, \quote {primitive} and |
| 1062 |
\quote {immutable} flags are removed but the \prm {aliased} prefix retains |
| 1063 |
them. |
| 1064 |
|
| 1065 |
\startbuffer |
| 1066 |
\let\relaxed\relax |
| 1067 |
|
| 1068 |
\meaningasis\relax |
| 1069 |
\meaningasis\relaxed |
| 1070 |
\stopbuffer |
| 1071 |
|
| 1072 |
\typebuffer |
| 1073 |
|
| 1074 |
So in this example the \type {\relaxed} alias is not flagged as primitive: |
| 1075 |
|
| 1076 |
\startlines \tt |
| 1077 |
\getbuffer |
| 1078 |
\stoplines |
| 1079 |
|
| 1080 |
\stopnewprimitive |
| 1081 |
|
| 1082 |
\startnewprimitive[title={\prm {aligncontent}}] |
| 1083 |
|
| 1084 |
This is equivalent to a hash in an alignment preamble. Contrary to \prm |
| 1085 |
{alignmark} there is no need to duplicate inside a macro definition. |
| 1086 |
|
| 1087 |
\stopnewprimitive |
| 1088 |
|
| 1089 |
\startnewprimitive[title={\prm {alignmark}}] |
| 1090 |
|
| 1091 |
When you have the \type {#} not set up as macro parameter character cq.\ align |
| 1092 |
mark, you can use this primitive instead. The same rules apply with respect to |
| 1093 |
multiple such tokens in (nested) macros and alignments. |
| 1094 |
|
| 1095 |
\stopnewprimitive |
| 1096 |
|
| 1097 |
\startnewprimitive[title={\prm {alignmentcellsource}}] |
| 1098 |
|
| 1099 |
This sets the source id (a box property) of the current alignment cell. |
| 1100 |
|
| 1101 |
\stopnewprimitive |
| 1102 |
|
| 1103 |
\startnewprimitive[title={\prm {alignmentwrapsource}}] |
| 1104 |
|
| 1105 |
This sets the source id (a box property) of the current alignment row (in a \prm |
| 1106 |
{halign}) or column (in a \prm {valign}). |
| 1107 |
|
| 1108 |
\stopnewprimitive |
| 1109 |
|
| 1110 |
\startnewprimitive[title={\prm {aligntab}}] |
| 1111 |
|
| 1112 |
When you have the \type {&} not set up as align tab, you can use this primitive |
| 1113 |
instead. The same rules apply with respect to multiple such tokens in (nested) |
| 1114 |
macros and alignments. |
| 1115 |
|
| 1116 |
\stopnewprimitive |
| 1117 |
|
| 1118 |
\startnewprimitive[title={\prm {allcrampedstyles}}] |
| 1119 |
|
| 1120 |
A symbolic representation of \prm {crampeddisplaystyle}, \prm {crampedtextstyle}, |
| 1121 |
\prm {crampedscriptstyle} and \prm {crampedscriptscriptstyle}; integer |
| 1122 |
representation: \the\allcrampedstyles. |
| 1123 |
|
| 1124 |
\stopnewprimitive |
| 1125 |
|
| 1126 |
\startnewprimitive[title={\prm {alldisplaystyles}}] |
| 1127 |
|
| 1128 |
A symbolic representation of \prm {displaystyle} and \prm {crampeddisplaystyle}; |
| 1129 |
integer representation: \the\alldisplaystyles. |
| 1130 |
|
| 1131 |
\stopnewprimitive |
| 1132 |
|
| 1133 |
\startnewprimitive[title={\prm {allmainstyles}}] |
| 1134 |
|
| 1135 |
A symbolic representation of \prm {displaystyle}, \prm {crampeddisplaystyle}, |
| 1136 |
\prm {textstyle} and \prm {crampedtextstyle}; integer representation: |
| 1137 |
\the\allmainstyles. |
| 1138 |
|
| 1139 |
\stopnewprimitive |
| 1140 |
|
| 1141 |
\startnewprimitive[title={\prm {allmathstyles}}] |
| 1142 |
|
| 1143 |
A symbolic representation of \prm {displaystyle}, \prm {crampeddisplaystyle}, |
| 1144 |
\prm {textstyle}, \prm {crampedtextstyle}, \prm {scriptstyle}, \prm |
| 1145 |
{crampedscriptstyle}, \prm {scriptscriptstyle} and \prm |
| 1146 |
{crampedscriptscriptstyle}; integer representation: \the\allmathstyles. |
| 1147 |
|
| 1148 |
\stopnewprimitive |
| 1149 |
|
| 1150 |
\startnewprimitive[title={\prm {allscriptscriptstyles}}] |
| 1151 |
|
| 1152 |
A symbolic representation of \prm {scriptscriptstyle} and \prm |
| 1153 |
{crampedscriptscriptstyle}; integer representation: \the\allscriptscriptstyles. |
| 1154 |
|
| 1155 |
\stopnewprimitive |
| 1156 |
|
| 1157 |
\startnewprimitive[title={\prm {allscriptstyles}}] |
| 1158 |
|
| 1159 |
A symbolic representation of \prm {scriptstyle} and \prm {crampedscriptstyle}; |
| 1160 |
integer representation: \the\allscriptstyles. |
| 1161 |
|
| 1162 |
\stopnewprimitive |
| 1163 |
|
| 1164 |
\startnewprimitive[title={\prm {allsplitstyles}}] |
| 1165 |
|
| 1166 |
A symbolic representation of \prm {displaystyle} and \prm {textstyle} but not |
| 1167 |
\prm {scriptstyle} and \prm {scriptscriptstyle}: set versus reset; integer |
| 1168 |
representation: \the\allsplitstyles. |
| 1169 |
|
| 1170 |
\stopnewprimitive |
| 1171 |
|
| 1172 |
\startnewprimitive[title={\prm {alltextstyles}}] |
| 1173 |
|
| 1174 |
A symbolic representation of \prm {textstyle} and \prm {crampedtextstyle}; |
| 1175 |
integer representation: \the\alltextstyles. |
| 1176 |
|
| 1177 |
\stopnewprimitive |
| 1178 |
|
| 1179 |
\startnewprimitive[title={\prm {alluncrampedstyles}}] |
| 1180 |
|
| 1181 |
A symbolic representation of \prm {displaystyle}, \prm {textstyle}, \prm |
| 1182 |
{scriptstyle} and \prm {scriptscriptstyle}; integer representation: |
| 1183 |
\the\alluncrampedstyles. |
| 1184 |
|
| 1185 |
\stopnewprimitive |
| 1186 |
|
| 1187 |
\startnewprimitive[title={\prm {allunsplitstyles}}] |
| 1188 |
|
| 1189 |
A symbolic representation of \prm {scriptstyle} and \prm {scriptscriptstyle}; integer |
| 1190 |
representation: \the\allunsplitstyles. |
| 1191 |
|
| 1192 |
\stopnewprimitive |
| 1193 |
|
| 1194 |
\startnewprimitive[title={\prm {amcode}}] |
| 1195 |
\stopnewprimitive |
| 1196 |
|
| 1197 |
\startnewprimitive[title={\prm {associateunit}}] |
| 1198 |
|
| 1199 |
The \TEX\ engine comes with some build in units, like \type {pt} (fixed) and |
| 1200 |
\type {em} (adaptive). On top of that a macro package can add additional units, which is |
| 1201 |
what we do in \CONTEXT. In \in {figure} [fig:units] we show the current repertoire. |
| 1202 |
|
| 1203 |
\startplacefigure[title=Available units,reference=fig:units] |
| 1204 |
\showunitsmap[tight] |
| 1205 |
\showunitsmaplegend |
| 1206 |
\stopplacefigure |
| 1207 |
|
| 1208 |
When this primitive is used in a context where a number is expected it returns the origin |
| 1209 |
of the unit (in the color legend running from 1 upto 4). A new unit is defined as: |
| 1210 |
|
| 1211 |
\starttyping |
| 1212 |
\newdimen\MyDimenZA \MyDimenZA=10pt |
| 1213 |
|
| 1214 |
\protected\def\MyDimenAB{\dimexpr\hsize/2\relax} |
| 1215 |
|
| 1216 |
\associateunit za \MyDimenZA |
| 1217 |
\associateunit zb \MyMacroZB |
| 1218 |
\stoptyping |
| 1219 |
|
| 1220 |
Possible associations are: macros that expand to a dimension, internal dimension |
| 1221 |
registers, register dimensions (\prm {dimendef}, direct dimensions (\prm |
| 1222 |
{dimensiondef}) and \LUA\ functions that return a dimension. |
| 1223 |
|
| 1224 |
One can run into scanning ahead issues where \TEX\ expects a unit and a user unit |
| 1225 |
gets expanded. This is why for instance in \CONTEXT\ we define the \type{ma} unit |
| 1226 |
as: |
| 1227 |
|
| 1228 |
\starttyping |
| 1229 |
\protected\def\mathaxisunit{\scaledmathaxis\mathstyle\norelax} |
| 1230 |
|
| 1231 |
\associateunit ma \mathaxisunit % or \newuserunit \mathaxisunit ma |
| 1232 |
\stoptyping |
| 1233 |
|
| 1234 |
So that it can be used in rule specifications that themselves look ahead for |
| 1235 |
keywords and therefore are normally terminated by a \prm {relax}. Adding the |
| 1236 |
extra \prm {norelax} will make the scanner see one that doesn't get fed back into |
| 1237 |
the input. Of course a macro package has to manage extra units in order to avoid |
| 1238 |
conflicts. |
| 1239 |
|
| 1240 |
\stopnewprimitive |
| 1241 |
|
| 1242 |
\startnewprimitive[title={\prm {atendoffile}}] |
| 1243 |
|
| 1244 |
The \prm {everyeof} primitive is kind of useless because you don't know if a file |
| 1245 |
(which can be a tokenlist processed as pseudo file) itself includes a file, which |
| 1246 |
then results in nested application of this token register. One way around this is: |
| 1247 |
|
| 1248 |
\startbuffer |
| 1249 |
\atendoffile\SomeCommand |
| 1250 |
\stopbuffer |
| 1251 |
|
| 1252 |
\typebuffer |
| 1253 |
|
| 1254 |
This acts on files the same way as \prm {atendofgroup} does. Multiple calls will |
| 1255 |
be accumulated and are bound to the current file. |
| 1256 |
|
| 1257 |
\stopnewprimitive |
| 1258 |
|
| 1259 |
\startnewprimitive[title={\prm {atendoffiled}}] |
| 1260 |
|
| 1261 |
This is the multi token variant of \prm {atendoffile}. Multiple invocations are |
| 1262 |
accumulated and by default prepended to the existing list. As with grouping this |
| 1263 |
permits proper nesting. You can force an append by the optional keyword {reverse}. |
| 1264 |
|
| 1265 |
\stopnewprimitive |
| 1266 |
|
| 1267 |
\startnewprimitive[title={\prm {atendofgroup}}] |
| 1268 |
|
| 1269 |
The token provided will be injected just before the group ends. Because |
| 1270 |
these tokens are collected, you need to be aware of possible interference |
| 1271 |
between them. However, normally this is managed by the macro package. |
| 1272 |
|
| 1273 |
\startbuffer |
| 1274 |
\bgroup |
| 1275 |
\atendofgroup\unskip |
| 1276 |
\atendofgroup )% |
| 1277 |
(but it works okay |
| 1278 |
\egroup |
| 1279 |
\stopbuffer |
| 1280 |
|
| 1281 |
\typebuffer |
| 1282 |
|
| 1283 |
Of course these effects can also be achieved by combining (extra) grouping with |
| 1284 |
\prm {aftergroup} calls, so this is more a convenience primitives than a real |
| 1285 |
necessity: {\inlinebuffer}, as proven here. |
| 1286 |
|
| 1287 |
\stopnewprimitive |
| 1288 |
|
| 1289 |
\startnewprimitive[title={\prm {atendofgrouped}}] |
| 1290 |
|
| 1291 |
This is the multi token variant of \prm {atendofgroup}. Of course the next |
| 1292 |
example is somewhat naive when it comes to spacing and so, but it shows the |
| 1293 |
purpose. |
| 1294 |
|
| 1295 |
\startbuffer |
| 1296 |
\bgroup |
| 1297 |
\atendofgrouped{\bf QED}% |
| 1298 |
\atendofgrouped{ (indeed)}% |
| 1299 |
This sometimes looks nicer. |
| 1300 |
\egroup |
| 1301 |
\stopbuffer |
| 1302 |
|
| 1303 |
\typebuffer |
| 1304 |
|
| 1305 |
Multiple invocations are accumulated: {\inlinebuffer}. |
| 1306 |
|
| 1307 |
\stopnewprimitive |
| 1308 |
|
| 1309 |
\startoldprimitive[title={\prm {atop}}][obsolete=yes] |
| 1310 |
|
| 1311 |
This one stack two math elements on top of each other, like a fraction but with |
| 1312 |
no rule. It has a more advanced upgrade in \prm {Uatop}. |
| 1313 |
|
| 1314 |
\stopoldprimitive |
| 1315 |
|
| 1316 |
\startoldprimitive[title={\prm {atopwithdelims}}][obsolete=yes] |
| 1317 |
|
| 1318 |
This is a variant of \prm {atop} but with delimiters. It has a more advanced |
| 1319 |
upgrade in \prm {Uatopwithdelims}. |
| 1320 |
|
| 1321 |
\stopoldprimitive |
| 1322 |
|
| 1323 |
\startnewprimitive[title={\prm {attribute}}] |
| 1324 |
|
| 1325 |
The following sets an attribute(register) value: |
| 1326 |
|
| 1327 |
\starttyping |
| 1328 |
\attribute 999 = 123 |
| 1329 |
\stoptyping |
| 1330 |
|
| 1331 |
An attribute is unset by assigning \the \attributeunsetvalue\ to it. A user needs |
| 1332 |
to be aware of attributes being used now and in the future of a macro package and |
| 1333 |
setting them this way is very likely going to interfere. |
| 1334 |
|
| 1335 |
\stopnewprimitive |
| 1336 |
|
| 1337 |
\startnewprimitive[title={\prm {attributedef}}] |
| 1338 |
|
| 1339 |
This primitive can be used to relate a control sequence to an attribute register |
| 1340 |
and can be used to implement a mechanism for defining unique ones that won't |
| 1341 |
interfere. As with other registers: leave management to the macro package in |
| 1342 |
order to avoid unwanted side effects! |
| 1343 |
|
| 1344 |
\stopnewprimitive |
| 1345 |
|
| 1346 |
\startnewprimitive[title={\prm {automaticdiscretionary}}] |
| 1347 |
|
| 1348 |
This is an alias for the automatic hyphen trigger \type {-}. |
| 1349 |
|
| 1350 |
\stopnewprimitive |
| 1351 |
|
| 1352 |
\startnewprimitive[title={\prm {automatichyphenpenalty}}] |
| 1353 |
|
| 1354 |
The penalty injected after an automatic discretionary \type {-}, when \prm |
| 1355 |
{hyphenationmode} enables this. |
| 1356 |
|
| 1357 |
\stopnewprimitive |
| 1358 |
|
| 1359 |
\startnewprimitive[title={\prm {automigrationmode}}] |
| 1360 |
|
| 1361 |
This bitset determines what will bubble up to an outer level: |
| 1362 |
|
| 1363 |
\getbuffer[engine:syntax:automigrationcodes] |
| 1364 |
|
| 1365 |
The current value is {\tttf 0x\tohexadecimal\automigrationmode}. |
| 1366 |
|
| 1367 |
\stopnewprimitive |
| 1368 |
|
| 1369 |
\startnewprimitive[title={\prm {autoparagraphmode}}] |
| 1370 |
|
| 1371 |
A paragraph can be triggered by an empty line, a \type {\par} token or an |
| 1372 |
equivalent of it. This parameter controls how \type {\par} is interpreted in |
| 1373 |
different scenarios: |
| 1374 |
|
| 1375 |
\getbuffer[engine:syntax:autoparagraphcodes] |
| 1376 |
|
| 1377 |
The current value is {\tttf 0x\tohexadecimal\autoparagraphmode} and setting it to |
| 1378 |
a non|-|zero value can have consequences for mechanisms that expect otherwise. |
| 1379 |
The text option uses the same code as an empty line. The macro option checks a |
| 1380 |
token in a macro preamble against the frozen \prm {par} token. The last option |
| 1381 |
ignores the par token. |
| 1382 |
|
| 1383 |
\stopnewprimitive |
| 1384 |
|
| 1385 |
\startoldprimitive[title={\prm {badness}}] |
| 1386 |
|
| 1387 |
This one returns the last encountered badness value. |
| 1388 |
|
| 1389 |
\stopoldprimitive |
| 1390 |
|
| 1391 |
\startnewprimitive[title={\prm {balanceadjdemerits}}] |
| 1392 |
|
| 1393 |
These are added to the accumulated demerits depending on the fitness of |
| 1394 |
neighbouring slots in balancing act. |
| 1395 |
|
| 1396 |
\stopnewprimitive |
| 1397 |
|
| 1398 |
\startnewprimitive[title={\prm {balancebottomskip}}] |
| 1399 |
|
| 1400 |
The counterpart of \prm {balancetopskip} and ensures that the last depth honors |
| 1401 |
this criterium. |
| 1402 |
|
| 1403 |
\stopnewprimitive |
| 1404 |
|
| 1405 |
\startnewprimitive[title={\prm {balanceboundary}}] |
| 1406 |
|
| 1407 |
This boundary is triggering a callback that can itself trigger a try break call. It's up to |
| 1408 |
the macro package to come up with a usage scenario. |
| 1409 |
|
| 1410 |
\stopnewprimitive |
| 1411 |
|
| 1412 |
\startnewprimitive[title={\prm {balancebreakpasses}}] |
| 1413 |
|
| 1414 |
See (upcoming) \CONTEXT\ documentation for an explanation. |
| 1415 |
|
| 1416 |
\stopnewprimitive |
| 1417 |
|
| 1418 |
\startnewprimitive[title={\prm {balancechecks}}] |
| 1419 |
|
| 1420 |
The balance tracer callback gets this paremeter passed. |
| 1421 |
|
| 1422 |
\stopnewprimitive |
| 1423 |
|
| 1424 |
\startnewprimitive[title={\prm {balanceemergencyshrink}}] |
| 1425 |
|
| 1426 |
{\em This is a reserved parameter.} |
| 1427 |
|
| 1428 |
\stopnewprimitive |
| 1429 |
|
| 1430 |
\startnewprimitive[title={\prm {balanceemergencystretch}}] |
| 1431 |
|
| 1432 |
When set this will make the balancer more tolerant. It's comparable to \prm |
| 1433 |
{emergencystretch} in the par builder. |
| 1434 |
|
| 1435 |
\stopnewprimitive |
| 1436 |
|
| 1437 |
\startnewprimitive[title={\prm {balancefinalpenalties}}] |
| 1438 |
|
| 1439 |
This is a penalty array which values will be applied to the end of the to be |
| 1440 |
balanced list, starting at the end. Widow, club and other encountered penalties |
| 1441 |
will be overloaded. |
| 1442 |
|
| 1443 |
\starttyping |
| 1444 |
\balancefinalpenalties 4 |
| 1445 |
10000 9000 8000 7000 |
| 1446 |
\relax |
| 1447 |
\stoptyping |
| 1448 |
|
| 1449 |
The last one is not repetitive so here at most four penalties will be injected |
| 1450 |
between lines (that is: hlists with the line subtype). |
| 1451 |
|
| 1452 |
\stopnewprimitive |
| 1453 |
|
| 1454 |
\startnewprimitive[title={\prm {balancelineheight}}] |
| 1455 |
|
| 1456 |
{\em This is a reserved parameter.} |
| 1457 |
|
| 1458 |
\stopnewprimitive |
| 1459 |
|
| 1460 |
\startnewprimitive[title={\prm {balancelooseness}}] |
| 1461 |
|
| 1462 |
When set the balancer tries to produce nore or less slots. As with the par |
| 1463 |
builder the result of looseness is kind of unpredictable. One needs plenty of |
| 1464 |
glue and normally that is not present in a vertical list. |
| 1465 |
|
| 1466 |
\stopnewprimitive |
| 1467 |
|
| 1468 |
\startnewprimitive[title={\prm {balancepasses}}] |
| 1469 |
|
| 1470 |
Specifies one or more recipes for additional second balance passes. Examples |
| 1471 |
can be found in the \CONTEXT\ distribution (in due time). |
| 1472 |
|
| 1473 |
\stopnewprimitive |
| 1474 |
|
| 1475 |
\startnewprimitive[title={\prm {balancepenalty}}] |
| 1476 |
|
| 1477 |
This is the penalty applied between slots, prety much like \prm {linepenalty}. |
| 1478 |
|
| 1479 |
\stopnewprimitive |
| 1480 |
|
| 1481 |
\startnewprimitive[title={\prm {balanceshape}}] |
| 1482 |
|
| 1483 |
\startbuffer[shape] |
| 1484 |
\balanceshape 3 |
| 1485 |
topskip 11pt bottomskip 21pt vsize 91pt next |
| 1486 |
topskip 12pt bottomskip 22pt vsize 92pt next |
| 1487 |
topskip 13pt bottomskip 23pt vsize 93pt |
| 1488 |
\relax |
| 1489 |
\stopbuffer |
| 1490 |
|
| 1491 |
\stopnewprimitive |
| 1492 |
|
| 1493 |
\startnewprimitive[title={\prm {balanceshapebottomspace}}] |
| 1494 |
|
| 1495 |
This gives the (fixed) amount of space added at the bottom of the given shape |
| 1496 |
slot. |
| 1497 |
|
| 1498 |
\startbuffer |
| 1499 |
\the\balanceshapebottomspace 1 \space |
| 1500 |
\the\balanceshapebottomspace 3 |
| 1501 |
\stopbuffer |
| 1502 |
|
| 1503 |
\typebuffer |
| 1504 |
|
| 1505 |
\start \getbuffer[shape] We get: {\inlinebuffer}. \stop |
| 1506 |
|
| 1507 |
\stopnewprimitive |
| 1508 |
|
| 1509 |
\startnewprimitive[title={\prm {balanceshapetopspace}}] |
| 1510 |
|
| 1511 |
This provides (fixed) amount of space added at the top of the given shape slot. |
| 1512 |
|
| 1513 |
\startbuffer |
| 1514 |
\the\balanceshapetopspace 1 \space |
| 1515 |
\the\balanceshapetopspace 3 |
| 1516 |
\stopbuffer |
| 1517 |
|
| 1518 |
\typebuffer |
| 1519 |
|
| 1520 |
\start \getbuffer[shape] This results in: {\inlinebuffer}. \stop |
| 1521 |
|
| 1522 |
\stopnewprimitive |
| 1523 |
|
| 1524 |
\startnewprimitive[title={\prm {balanceshapevsize}}] |
| 1525 |
|
| 1526 |
This returns the the target height of the given shape slot. |
| 1527 |
|
| 1528 |
\startbuffer |
| 1529 |
\the\balanceshapevsize 1 \space |
| 1530 |
\the\balanceshapevsize 3 |
| 1531 |
\stopbuffer |
| 1532 |
|
| 1533 |
\typebuffer |
| 1534 |
|
| 1535 |
\start \getbuffer[shape] This results in: {\inlinebuffer}. \stop |
| 1536 |
|
| 1537 |
\stopnewprimitive |
| 1538 |
|
| 1539 |
\startnewprimitive[title={\prm {balancetolerance}}] |
| 1540 |
|
| 1541 |
This parameter sets the criterium for a slot being bad (pretty much like in the |
| 1542 |
linebreak for a line). Although the code is able to have a pre balance pass it |
| 1543 |
has no meaning here so we don't have a \type {\balancepretolerance}. \footnote |
| 1544 |
{We might find usage for it some day.} |
| 1545 |
|
| 1546 |
\stopnewprimitive |
| 1547 |
|
| 1548 |
\startnewprimitive[title={\prm {balancetopskip}}] |
| 1549 |
|
| 1550 |
This glue ensures the height of the first content (box or rule) in a slot. It can |
| 1551 |
be compared to \prm {topskip} and \prm {splittopskip}. |
| 1552 |
|
| 1553 |
\stopnewprimitive |
| 1554 |
|
| 1555 |
\startnewprimitive[title={\prm {balancevsize}}] |
| 1556 |
|
| 1557 |
This sets the target height of a balance slot unless \prm {balanceshape} is used. |
| 1558 |
|
| 1559 |
\stopnewprimitive |
| 1560 |
|
| 1561 |
\startoldprimitive[title={\prm {baselineskip}}] |
| 1562 |
|
| 1563 |
This is the maximum glue put between lines. The depth of the previous and height |
| 1564 |
of the next line are substracted. |
| 1565 |
|
| 1566 |
\stopoldprimitive |
| 1567 |
|
| 1568 |
\startoldprimitive[title={\prm {batchmode}}] |
| 1569 |
|
| 1570 |
This command disables (error) messages which can safe some runtime in situations |
| 1571 |
where \TEX's character|-|by|-|character log output impacts runtime. It only makes |
| 1572 |
sense in automated workflows where one doesn't look at the log anyway. |
| 1573 |
|
| 1574 |
\stopoldprimitive |
| 1575 |
|
| 1576 |
\startnewprimitive[title={\prm {begincsname}}] |
| 1577 |
|
| 1578 |
The next code creates a control sequence token from the given serialized tokens: |
| 1579 |
|
| 1580 |
\starttyping |
| 1581 |
\csname mymacro\endcsname |
| 1582 |
\stoptyping |
| 1583 |
|
| 1584 |
When \type {\mymacro} is not defined a control sequence will be created with the |
| 1585 |
meaning \prm {relax}. A side effect is that a test for its existence might fail |
| 1586 |
because it now exists. The next sequence will {\em not} create an controil |
| 1587 |
sequence: |
| 1588 |
|
| 1589 |
\starttyping |
| 1590 |
\begincsname mymacro\endcsname |
| 1591 |
\stoptyping |
| 1592 |
|
| 1593 |
This actually is kind of equivalent to: |
| 1594 |
|
| 1595 |
\starttyping |
| 1596 |
\ifcsname mymacro\endcsname |
| 1597 |
\csname mymacro\endcsname |
| 1598 |
\fi |
| 1599 |
\stoptyping |
| 1600 |
|
| 1601 |
\stopnewprimitive |
| 1602 |
|
| 1603 |
\startoldprimitive[title={\prm {begingroup}}] |
| 1604 |
|
| 1605 |
This primitive starts a group and has to be ended with \prm {endgroup}. See \prm |
| 1606 |
{beginsimplegroup} for more info. |
| 1607 |
|
| 1608 |
\stopoldprimitive |
| 1609 |
|
| 1610 |
\startnewprimitive[title={\prm {beginlocalcontrol}}] |
| 1611 |
|
| 1612 |
Once \TEX\ is initialized it will enter the main loop. In there certain commands |
| 1613 |
trigger a function that itself can trigger further scanning and functions. In |
| 1614 |
\LUAMETATEX\ we can have local main loops and we can either enter it from the |
| 1615 |
\LUA\ end (which we don't discuss here) or at the \TEX\ end using this primitive. |
| 1616 |
|
| 1617 |
\startbuffer |
| 1618 |
\scratchcounter100 |
| 1619 |
|
| 1620 |
\edef\whatever{ |
| 1621 |
a |
| 1622 |
\beginlocalcontrol |
| 1623 |
\advance\scratchcounter 10 |
| 1624 |
b |
| 1625 |
\endlocalcontrol |
| 1626 |
\beginlocalcontrol |
| 1627 |
c |
| 1628 |
\endlocalcontrol |
| 1629 |
d |
| 1630 |
\advance\scratchcounter 10 |
| 1631 |
} |
| 1632 |
|
| 1633 |
\the\scratchcounter |
| 1634 |
\whatever |
| 1635 |
\the\scratchcounter |
| 1636 |
\stopbuffer |
| 1637 |
|
| 1638 |
\typebuffer |
| 1639 |
|
| 1640 |
A bit of close reading probably gives an impression of what happens here: |
| 1641 |
|
| 1642 |
{\getbuffer} |
| 1643 |
|
| 1644 |
The local loop can actually result in material being injected in the current node |
| 1645 |
list. However, where normally assignments are not taking place in an \prm |
| 1646 |
{edef}, here they are applied just fine. Basically we have a local \TEX\ job, be |
| 1647 |
it that it shares all variables with the parent loop. |
| 1648 |
|
| 1649 |
\stopnewprimitive |
| 1650 |
|
| 1651 |
\startnewprimitive[title={\prm {beginmathgroup}}] |
| 1652 |
|
| 1653 |
In math mode grouping with \prm {begingroup} and \prm {endgroup} in some cases |
| 1654 |
works as expected, but because the math input is converted in a list that gets |
| 1655 |
processed later some settings can become persistent, like changes in style or |
| 1656 |
family. The engine therefore provides the alternatives \prm {beginmathgroup} and |
| 1657 |
\prm {endmathgroup} that restore some properties. |
| 1658 |
|
| 1659 |
\stopnewprimitive |
| 1660 |
|
| 1661 |
\startnewprimitive[title={\prm {beginmvl}}] |
| 1662 |
|
| 1663 |
This initiates intercepting the main vertical list (the page). There has to be a |
| 1664 |
matching \prm {endmvl}. For example: |
| 1665 |
|
| 1666 |
\starttyping |
| 1667 |
\beginmvl 1 the main vertical list, one \endmvl |
| 1668 |
\beginmvl 2 the main vertical list, two \endmvl |
| 1669 |
\stoptyping |
| 1670 |
|
| 1671 |
The streams can be flushed out of order: |
| 1672 |
|
| 1673 |
\starttyping |
| 1674 |
\setbox\scratchboxone\flushmvl 2 |
| 1675 |
\setbox\scratchboxtwo\flushmvl 1 |
| 1676 |
\stoptyping |
| 1677 |
|
| 1678 |
One can be more specific: |
| 1679 |
|
| 1680 |
\starttyping |
| 1681 |
\beginmvl |
| 1682 |
index 1 |
| 1683 |
options 5 % ignore prevdepth (1) and discard top (4) |
| 1684 |
\relax |
| 1685 |
.... |
| 1686 |
\endmvl |
| 1687 |
\stoptyping |
| 1688 |
|
| 1689 |
More details can be found in the \CONTEXT\ low level manuals that describe this |
| 1690 |
feature in combination with balancing. |
| 1691 |
|
| 1692 |
\stopnewprimitive |
| 1693 |
|
| 1694 |
\startnewprimitive[title={\prm {beginsimplegroup}}] |
| 1695 |
|
| 1696 |
The original \TEX\ engine distinguishes two kind of grouping that at the user end |
| 1697 |
show up as: |
| 1698 |
|
| 1699 |
\starttyping |
| 1700 |
\begingroup \endgroup |
| 1701 |
\bgroup \egroup { } |
| 1702 |
\stoptyping |
| 1703 |
|
| 1704 |
where the last two pairs are equivalent unless the scanner explicitly wants to see a |
| 1705 |
left and|/|or right brace and not an equivalent. For the sake of simplify we use |
| 1706 |
the aliases here. It is not possible to mix these pairs, so: |
| 1707 |
|
| 1708 |
\starttyping |
| 1709 |
\bgroup xxx\endgroup |
| 1710 |
\begingroup xxx\egroup |
| 1711 |
\stoptyping |
| 1712 |
|
| 1713 |
will in both cases issue an error. This can make it somewhat hard to write generic |
| 1714 |
grouping macros without somewhat dirty trickery. The way out is to use the generic |
| 1715 |
group opener \prm {beginsimplegroup}. |
| 1716 |
|
| 1717 |
Internally \LUAMETATEX\ is aware of what group it currently is dealing with and |
| 1718 |
there we distinguish: |
| 1719 |
|
| 1720 |
\starttabulate[||||] |
| 1721 |
\NC simple group \NC \type {\bgroup} \NC \type {\egroup} \NC \NR |
| 1722 |
\NC semi simple group \NC \type {\begingroup} \NC \type {\endgroup} \type {\endsimplegroup} \NC \NR |
| 1723 |
\NC also simple group \NC \type {\beginsimplegroup} \NC \type {\egroup} \type {\endgroup} \type {\endsimplegroup} \NC \NR |
| 1724 |
\NC math simple group \NC \type {\beginmathgroup} \NC \type {\endmathgroup} \NC \NR |
| 1725 |
\stoptabulate |
| 1726 |
|
| 1727 |
This means that you can say: |
| 1728 |
|
| 1729 |
\starttyping |
| 1730 |
\beginsimplegroup xxx\endsimplegroup |
| 1731 |
\beginsimplegroup xxx\endgroup |
| 1732 |
\beginsimplegroup xxx\egroup |
| 1733 |
\stoptyping |
| 1734 |
|
| 1735 |
So a group started with \prm {beginsimplegroup} can be finished in three ways |
| 1736 |
which means that the user (or calling macro) doesn't have take into account what |
| 1737 |
kind of grouping was used to start with. Normally usage of this primitive is |
| 1738 |
hidden in macros and not something the user has to be aware of. |
| 1739 |
|
| 1740 |
\stopnewprimitive |
| 1741 |
|
| 1742 |
\startoldprimitive[title={\prm {belowdisplayshortskip}}] |
| 1743 |
|
| 1744 |
The glue injected aftter a display formula when the line above it is not |
| 1745 |
overlapping with the formula (\TEX\ can't look ahead). Watch out for interference |
| 1746 |
with \prm {baselineskip}. It can be controlled by \prm {displayskipmode}. |
| 1747 |
|
| 1748 |
\stopoldprimitive |
| 1749 |
|
| 1750 |
\startoldprimitive[title={\prm {belowdisplayskip}}] |
| 1751 |
|
| 1752 |
The glue injected after a display formula. Watch out for interference with \prm |
| 1753 |
{baselineskip}. It can be controlled by \prm {displayskipmode}. |
| 1754 |
|
| 1755 |
\stopoldprimitive |
| 1756 |
|
| 1757 |
\startoldprimitive[title={\prm {binoppenalty}}][obsolete=yes] |
| 1758 |
|
| 1759 |
This internal quantity is a compatibility feature because normally we will use |
| 1760 |
the inter atom spacing variables. |
| 1761 |
|
| 1762 |
\stopoldprimitive |
| 1763 |
|
| 1764 |
\startoldprimitive[title={\prm {botmark}}][obsolete=yes] |
| 1765 |
|
| 1766 |
This is a reference to the last mark on the current page, it gives back tokens. |
| 1767 |
|
| 1768 |
\stopoldprimitive |
| 1769 |
|
| 1770 |
\startoldprimitive[title={\prm {botmarks}}] |
| 1771 |
|
| 1772 |
This is a reference to the last mark with the given id (a number) on the current |
| 1773 |
page, it gives back tokens. |
| 1774 |
|
| 1775 |
\stopoldprimitive |
| 1776 |
|
| 1777 |
\startnewprimitive[title={\prm {bottomskip}}] |
| 1778 |
|
| 1779 |
{\em This is a reserved parameter.} |
| 1780 |
|
| 1781 |
\stopnewprimitive |
| 1782 |
|
| 1783 |
\startnewprimitive[title={\prm {boundary}}] |
| 1784 |
|
| 1785 |
Boundaries are signals added to he current list. This primitive injects a user |
| 1786 |
boundary with the given (integer) value. Such a boundary can be consulted at the |
| 1787 |
\LUA\ end or with \prm {lastboundary}. |
| 1788 |
|
| 1789 |
\stopnewprimitive |
| 1790 |
|
| 1791 |
\startoldprimitive[title={\prm {box}}] |
| 1792 |
|
| 1793 |
This is the box register accessor. While other registers have one property a box |
| 1794 |
has many, like \prm {wd}, \prm {ht} and \prm {dp}. This primitive returns the box |
| 1795 |
and resets the register. |
| 1796 |
|
| 1797 |
\stopoldprimitive |
| 1798 |
|
| 1799 |
\startnewprimitive[title={\prm {boxadapt}}] |
| 1800 |
|
| 1801 |
Adapting will recalculate the dimensions with a scale factor for the glue: |
| 1802 |
|
| 1803 |
\startbuffer |
| 1804 |
\setbox 0 \hbox {test test test} |
| 1805 |
\setbox 2 \hbox {\red test test test} \boxadapt 0 200 |
| 1806 |
\setbox 4 \hbox {\blue test test test} \boxadapt 0 -200 |
| 1807 |
\ruledhbox{\box0} \vskip-\lineheight |
| 1808 |
\ruledhbox{\box0} \vskip-\lineheight |
| 1809 |
\ruledhbox{\box0} |
| 1810 |
\stopbuffer |
| 1811 |
|
| 1812 |
\typebuffer |
| 1813 |
|
| 1814 |
Like \prm {boxfreeze} and \prm {boxrepack} this primitive has been introduced for |
| 1815 |
experimental usage, although we do use some in production code. |
| 1816 |
|
| 1817 |
\getbuffer |
| 1818 |
|
| 1819 |
\stopnewprimitive |
| 1820 |
|
| 1821 |
\startnewprimitive[title={\prm {boxanchor}}] |
| 1822 |
|
| 1823 |
This feature is part of an (experimental) mechanism that relates boxes. The |
| 1824 |
engine just tags a box and it is up to the macro package to deal with it. |
| 1825 |
|
| 1826 |
\startbuffer |
| 1827 |
\setbox0\hbox anchor "01010202 {test}\tohexadecimal\boxanchor0 |
| 1828 |
\stopbuffer |
| 1829 |
|
| 1830 |
\typebuffer |
| 1831 |
|
| 1832 |
This gives: \inlinebuffer. Of course this feature is very macro specific and |
| 1833 |
should not be used across macro packages without coordination. An anchor has |
| 1834 |
two parts each not exceeding \type {0x0FFF}. |
| 1835 |
|
| 1836 |
\stopnewprimitive |
| 1837 |
|
| 1838 |
\startnewprimitive[title={\prm {boxanchors}}] |
| 1839 |
|
| 1840 |
This feature is part of an (experimental) mechanism that relates boxes. The |
| 1841 |
engine just tags a box and it is up to the macro package to deal with it. |
| 1842 |
|
| 1843 |
\startbuffer |
| 1844 |
\setbox0\hbox anchors "0101 "0202 {test}\tohexadecimal\boxanchors0 |
| 1845 |
\stopbuffer |
| 1846 |
|
| 1847 |
\typebuffer |
| 1848 |
|
| 1849 |
This gives: \inlinebuffer. Of course this feature is very macro specific and |
| 1850 |
should not be used across macro packages without coordination. An anchor has |
| 1851 |
two parts each not exceeding \type {0x0FFF}. |
| 1852 |
|
| 1853 |
\stopnewprimitive |
| 1854 |
|
| 1855 |
\startnewprimitive[title={\prm {boxattribute}}] |
| 1856 |
|
| 1857 |
Every node, and therefore also every box gets the attributes set that are |
| 1858 |
active at the moment of creation. Additional attributes can be set too: |
| 1859 |
|
| 1860 |
\startbuffer |
| 1861 |
\darkred |
| 1862 |
\setbox0\hbox attr 9999 1 {whatever} |
| 1863 |
\the\boxattribute 0 \colorattribute |
| 1864 |
\the\boxattribute 0 9998 |
| 1865 |
\the\boxattribute 0 9999 |
| 1866 |
\stopbuffer |
| 1867 |
|
| 1868 |
\typebuffer |
| 1869 |
|
| 1870 |
A macro package should make provide a way define attributes that don't clash the |
| 1871 |
ones it needs itself, like, in \CONTEXT, the ones that can set a color |
| 1872 |
|
| 1873 |
\startlines \getbuffer \stoplines |
| 1874 |
|
| 1875 |
The number \the\attributeunsetvalue\ (\tohexadecimal\attributeunsetvalue) |
| 1876 |
indicates an unset attribute. |
| 1877 |
|
| 1878 |
\stopnewprimitive |
| 1879 |
|
| 1880 |
\startnewprimitive[title={\prm {boxdirection}}] |
| 1881 |
|
| 1882 |
The direction of a box defaults to \type {l2r} but can be explicitly set: |
| 1883 |
|
| 1884 |
\startbuffer |
| 1885 |
\setbox0\hbox direction 1 {this is a test}\textdirection1 |
| 1886 |
\setbox2\hbox direction 0 {this is a test}\textdirection0 |
| 1887 |
\the\boxdirection0: \box0 |
| 1888 |
\the\boxdirection2: \box2 |
| 1889 |
\stopbuffer |
| 1890 |
|
| 1891 |
\typebuffer |
| 1892 |
|
| 1893 |
The \prm {textdirection} does not influence the box direction: |
| 1894 |
|
| 1895 |
\startlines \getbuffer \stoplines |
| 1896 |
|
| 1897 |
\stopnewprimitive |
| 1898 |
|
| 1899 |
\startnewprimitive[title={\prm {boxfinalize}}] |
| 1900 |
|
| 1901 |
This is special version of \prm {boxfreeze} which we demonstrate |
| 1902 |
with an example: |
| 1903 |
|
| 1904 |
\startbuffer[setthem] |
| 1905 |
\setbox0\ruledvbox to 3cm{\hsize 2cm test\vskip10pt plus 10pt test} |
| 1906 |
\setbox2\copy0\setbox4\copy0\setbox6\copy0\setbox8\copy0 |
| 1907 |
\stopbuffer |
| 1908 |
|
| 1909 |
\startbuffer[usethem] |
| 1910 |
\boxlimitate 0 0 % don't recurse |
| 1911 |
\boxfreeze 2 0 % don't recurse |
| 1912 |
\boxfinalize 4 500 % scale glue multiplier by .50 |
| 1913 |
\boxfinalize 6 250 % scale glue multiplier by .25 |
| 1914 |
\boxfinalize 8 100 % scale glue multiplier by .10 |
| 1915 |
|
| 1916 |
\hpack\bgroup |
| 1917 |
\copy0\quad\copy2\quad\copy4\quad\copy6\quad\copy8 |
| 1918 |
\egroup |
| 1919 |
\stopbuffer |
| 1920 |
|
| 1921 |
\typebuffer[usethem] |
| 1922 |
|
| 1923 |
where the boxes are populated with: |
| 1924 |
|
| 1925 |
\typebuffer[setthem] |
| 1926 |
|
| 1927 |
\startlinecorrection |
| 1928 |
\getbuffer[setthem,usethem] |
| 1929 |
\stoplinecorrection |
| 1930 |
|
| 1931 |
\stopnewprimitive |
| 1932 |
|
| 1933 |
\startnewprimitive[title={\prm {boxfreeze}}] |
| 1934 |
|
| 1935 |
Glue in a box has a fixed component that will always be used and stretch and |
| 1936 |
shrink that kicks in when needed. The effective value (width) of the glue is |
| 1937 |
driven by some box parameters that are set by the packaging routine. This is why |
| 1938 |
we can unbox: the original value is kept. It is the backend that calculates the |
| 1939 |
effective value. Te \prm {boxfreeze} primitive can do the same: turn the flexible |
| 1940 |
glue into a fixed one. |
| 1941 |
|
| 1942 |
\startbuffer |
| 1943 |
\setbox 0 \hbox to 6cm {\hss frost} |
| 1944 |
\setbox 2 \hbox to 6cm {\hss frost} |
| 1945 |
\boxfreeze 2 0 |
| 1946 |
\ruledhbox{\unhbox 0} |
| 1947 |
\ruledhbox{\unhbox 2} |
| 1948 |
\stopbuffer |
| 1949 |
|
| 1950 |
\typebuffer |
| 1951 |
|
| 1952 |
The second parameter to \prm {boxfreeze} determines recursion. We don't recurse |
| 1953 |
here so just freeze the outer level: |
| 1954 |
|
| 1955 |
\getbuffer |
| 1956 |
|
| 1957 |
\stopnewprimitive |
| 1958 |
|
| 1959 |
\startnewprimitive[title={\prm {boxgeometry}}] |
| 1960 |
|
| 1961 |
A box can have an orientation, offsets and|/|or anchors. These are stored |
| 1962 |
independently but for efficiency reasons we register if one or more of these |
| 1963 |
properties is set. This primitive accesses this state; it is a bitset: |
| 1964 |
|
| 1965 |
\getbuffer[engine:syntax:listgeometrycodes] |
| 1966 |
|
| 1967 |
\stopnewprimitive |
| 1968 |
|
| 1969 |
\startnewprimitive[title={\prm {boxinserts}}] |
| 1970 |
|
| 1971 |
A non zero value return indicates that there are inserts in this box. This |
| 1972 |
primitive is meant to be used with the balancer. |
| 1973 |
|
| 1974 |
\stopnewprimitive |
| 1975 |
|
| 1976 |
\startnewprimitive[title={\prm {boxlimit}}] |
| 1977 |
|
| 1978 |
This primitive will freeze the glue in a box but only when there is glue marked |
| 1979 |
with the limit option. |
| 1980 |
|
| 1981 |
\stopnewprimitive |
| 1982 |
|
| 1983 |
\startnewprimitive[title={\prm {boxlimitate}}] |
| 1984 |
|
| 1985 |
This primitive will freeze the glue in a box. It takes two arguments, a box |
| 1986 |
number and an number that when set to non|-|zero will recurse into nested lists. |
| 1987 |
|
| 1988 |
\stopnewprimitive |
| 1989 |
|
| 1990 |
\startnewprimitive[title={\prm {boxlimitmode}}] |
| 1991 |
|
| 1992 |
This variable controls if boxes with glue marked \quote {limit} will be checked |
| 1993 |
and frozen. |
| 1994 |
|
| 1995 |
\stopnewprimitive |
| 1996 |
|
| 1997 |
\startoldprimitive[title={\prm {boxmaxdepth}}] |
| 1998 |
|
| 1999 |
You can limit the depth of boxes being constructed. It's one of these parameters |
| 2000 |
that should be used with care because when that box is filled nested boxes can be |
| 2001 |
influenced. |
| 2002 |
|
| 2003 |
\stopoldprimitive |
| 2004 |
|
| 2005 |
\startnewprimitive[title={\prm {boxmigrate}}] |
| 2006 |
|
| 2007 |
When the given box has pre migration material the value will have \type {0x08} |
| 2008 |
set. When there is post material the \type {0x10} bit is set. Of course both can |
| 2009 |
be set. |
| 2010 |
|
| 2011 |
\stopnewprimitive |
| 2012 |
|
| 2013 |
\startnewprimitive[title={\prm {boxorientation}}] |
| 2014 |
|
| 2015 |
The orientation field can take quite some values and is discussed in one of the low level |
| 2016 |
\CONTEXT\ manuals. Some properties are dealt with in the \TEX\ engine because they |
| 2017 |
influence dimensions but in the end it is the backend that does the work. |
| 2018 |
|
| 2019 |
\stopnewprimitive |
| 2020 |
|
| 2021 |
\startnewprimitive[title={\prm {boxrepack}}] |
| 2022 |
|
| 2023 |
When a box of to wide or tight we can tweak it a bit with this primitive. The |
| 2024 |
primitive expects a box register and a dimension, where a positive number adds |
| 2025 |
and a negatie subtracts from the current box with. |
| 2026 |
|
| 2027 |
\startbuffer |
| 2028 |
\setbox 0 \hbox {test test test} |
| 2029 |
\setbox 2 \hbox {\red test test test} \boxrepack0 +.2em |
| 2030 |
\setbox 4 \hbox {\green test test test} \boxrepack0 -.2em |
| 2031 |
\ruledhbox{\box0} \vskip-\lineheight |
| 2032 |
\ruledhbox{\box0} \vskip-\lineheight |
| 2033 |
\ruledhbox{\box0} |
| 2034 |
\stopbuffer |
| 2035 |
|
| 2036 |
\typebuffer |
| 2037 |
|
| 2038 |
\getbuffer |
| 2039 |
|
| 2040 |
We can also use this primitive to check the natural dimensions of a box: |
| 2041 |
|
| 2042 |
\startbuffer |
| 2043 |
\setbox 0 \hbox spread 10pt {test test test} |
| 2044 |
\ruledhbox{\box0} (\the\boxrepack0,\the\wd0) |
| 2045 |
\stopbuffer |
| 2046 |
|
| 2047 |
\typebuffer |
| 2048 |
|
| 2049 |
In this context only one argument is expected. |
| 2050 |
|
| 2051 |
\getbuffer |
| 2052 |
|
| 2053 |
\stopnewprimitive |
| 2054 |
|
| 2055 |
\startnewprimitive[title={\prm {boxshift}}] |
| 2056 |
|
| 2057 |
Returns or sets how much the box is shifted: up or down in horizontally mode, left or |
| 2058 |
right in vertical mode. |
| 2059 |
|
| 2060 |
\stopnewprimitive |
| 2061 |
|
| 2062 |
\startnewprimitive[title={\prm {boxshrink}}] |
| 2063 |
|
| 2064 |
Returns the amount of shrink found (applied) in a box: |
| 2065 |
|
| 2066 |
\startbuffer |
| 2067 |
\setbox0\hbox to 4em {m m m m} |
| 2068 |
\the\boxshrink0 |
| 2069 |
\stopbuffer |
| 2070 |
|
| 2071 |
\typebuffer |
| 2072 |
|
| 2073 |
gives: \inlinebuffer |
| 2074 |
|
| 2075 |
\stopnewprimitive |
| 2076 |
|
| 2077 |
\startnewprimitive[title={\prm {boxsource}}] |
| 2078 |
|
| 2079 |
This feature is part of an (experimental) mechanism that relates boxes. The |
| 2080 |
engine just tags a box and it is up to the macro package to deal with it. |
| 2081 |
|
| 2082 |
\startbuffer |
| 2083 |
\setbox0\hbox source 123 {m m m m} |
| 2084 |
\the\boxsource0 |
| 2085 |
\stopbuffer |
| 2086 |
|
| 2087 |
\typebuffer |
| 2088 |
|
| 2089 |
This gives: \inlinebuffer. Of course this feature is very macro specific and |
| 2090 |
should not be used across macro packages without coordination. |
| 2091 |
|
| 2092 |
\stopnewprimitive |
| 2093 |
|
| 2094 |
\startnewprimitive[title={\prm {boxstretch}}] |
| 2095 |
|
| 2096 |
Returns the amount of stretch found (applied) in a box: |
| 2097 |
|
| 2098 |
\startbuffer |
| 2099 |
\setbox0\hbox to 6em {m m m m} |
| 2100 |
\the\boxstretch0 |
| 2101 |
\stopbuffer |
| 2102 |
|
| 2103 |
\typebuffer |
| 2104 |
|
| 2105 |
gives: \inlinebuffer |
| 2106 |
|
| 2107 |
\stopnewprimitive |
| 2108 |
|
| 2109 |
\startnewprimitive[title={\prm {boxsubtype}}] |
| 2110 |
|
| 2111 |
Returns the subtype of the given box. |
| 2112 |
|
| 2113 |
\startbuffer |
| 2114 |
\setbox0\hbox {test}[\the\boxsubtype0] |
| 2115 |
\setbox2\hbox container {test}[\the\boxsubtype2] |
| 2116 |
\stopbuffer |
| 2117 |
|
| 2118 |
\typebuffer |
| 2119 |
|
| 2120 |
gives: \inlinebuffer. Beware that the numbers can change so best use the symbolic |
| 2121 |
values that can be queried via \LUA. |
| 2122 |
|
| 2123 |
\stopnewprimitive |
| 2124 |
|
| 2125 |
\startnewprimitive[title={\prm {boxtarget}}] |
| 2126 |
|
| 2127 |
This feature is part of an (experimental) mechanism that relates boxes. The |
| 2128 |
engine just tags a box and it is up to the macro package to deal with it. |
| 2129 |
|
| 2130 |
\startbuffer |
| 2131 |
\setbox0\hbox source 123 {m m m m} |
| 2132 |
\the\boxsource0 |
| 2133 |
\stopbuffer |
| 2134 |
|
| 2135 |
\typebuffer |
| 2136 |
|
| 2137 |
This gives: \inlinebuffer. Of course this feature is very macro specific and |
| 2138 |
should not be used across macro packages without coordination. |
| 2139 |
|
| 2140 |
\stopnewprimitive |
| 2141 |
|
| 2142 |
\startnewprimitive[title={\prm {boxtotal}}] |
| 2143 |
|
| 2144 |
Returns the total of height and depth of the given box. |
| 2145 |
|
| 2146 |
\stopnewprimitive |
| 2147 |
|
| 2148 |
\startnewprimitive[title={\prm {boxvadjust}}] |
| 2149 |
|
| 2150 |
When used as query this returns a bitset indicating the associated adjust and |
| 2151 |
migration (marks and inserts) data: |
| 2152 |
|
| 2153 |
\starttabulate[|T|l|] |
| 2154 |
\NC 0x1 \NC pre adjusted \NC \NR |
| 2155 |
\NC 0x2 \NC post adjusted \NC \NR |
| 2156 |
\NC 0x4 \NC pre migrated \NC \NR |
| 2157 |
\NC 0x8 \NC post migrated \NC \NR |
| 2158 |
\stoptabulate\ |
| 2159 |
|
| 2160 |
When used as a setter it directly adds adjust data to the box and it accepts the |
| 2161 |
same keywords as \prm {vadjust}. |
| 2162 |
|
| 2163 |
\stopnewprimitive |
| 2164 |
|
| 2165 |
\startnewprimitive[title={\prm {boxxmove}}] |
| 2166 |
|
| 2167 |
This will set the vertical offset and adapt the dimensions accordingly. |
| 2168 |
|
| 2169 |
\stopnewprimitive |
| 2170 |
|
| 2171 |
\startnewprimitive[title={\prm {boxxoffset}}] |
| 2172 |
|
| 2173 |
Returns or sets the horizontal offset of the given box. |
| 2174 |
|
| 2175 |
\stopnewprimitive |
| 2176 |
|
| 2177 |
\startnewprimitive[title={\prm {boxymove}}] |
| 2178 |
|
| 2179 |
This will set the vertical offset and adapt the dimensions accordingly. |
| 2180 |
|
| 2181 |
\stopnewprimitive |
| 2182 |
|
| 2183 |
\startnewprimitive[title={\prm {boxyoffset}}] |
| 2184 |
|
| 2185 |
Returns or sets the vertical offset of the given box. |
| 2186 |
|
| 2187 |
\stopnewprimitive |
| 2188 |
|
| 2189 |
\startnewprimitive[title={\prm {brokenpenalties}}] |
| 2190 |
|
| 2191 |
Together with \prm {widowpenalties} and \prm {clubpenalties} this one permits |
| 2192 |
discriminating left- and right page (doublesided) penalties. For this one needs |
| 2193 |
to also specify \prm {options 4} and provide penalty pairs. Where the others |
| 2194 |
accept multiple pairs, this primitives expects a count value one. |
| 2195 |
|
| 2196 |
\stopnewprimitive |
| 2197 |
|
| 2198 |
\startoldprimitive[title={\prm {brokenpenalty}}] |
| 2199 |
|
| 2200 |
This penalty is added after a line that ends with a hyphen; it can help to |
| 2201 |
discourage a page break (or split in a box). |
| 2202 |
|
| 2203 |
\stopoldprimitive |
| 2204 |
|
| 2205 |
\startoldprimitive[title={\prm {catcode}}] |
| 2206 |
|
| 2207 |
Every character can be put in a category, but this is typically |
| 2208 |
something that the macro package manages because changes can affect |
| 2209 |
behavior. Also, once passed as an argument, the catcode of a character |
| 2210 |
is frozen. There are 16 different values: |
| 2211 |
|
| 2212 |
\starttabulate[|l|c|l|c|] |
| 2213 |
\NC \type {\escapecatcode } \NC \the\escapecatcode |
| 2214 |
\NC \type {\begingroupcatcode } \NC \the\begingroupcatcode \NC \NR |
| 2215 |
\NC \type {\endgroupcatcode } \NC \the\endgroupcatcode |
| 2216 |
\NC \type {\mathshiftcatcode } \NC \the\mathshiftcatcode \NC \NR |
| 2217 |
\NC \type {\alignmentcatcode } \NC \the\alignmentcatcode |
| 2218 |
\NC \type {\endoflinecatcode } \NC \the\endoflinecatcode \NC \NR |
| 2219 |
\NC \type {\parametercatcode } \NC \the\parametercatcode |
| 2220 |
\NC \type {\superscriptcatcode} \NC \the\superscriptcatcode \NC \NR |
| 2221 |
\NC \type {\subscriptcatcode } \NC \the\subscriptcatcode |
| 2222 |
\NC \type {\ignorecatcode } \NC \the\ignorecatcode \NC \NR |
| 2223 |
\NC \type {\spacecatcode } \NC \the\spacecatcode |
| 2224 |
\NC \type {\lettercatcode } \NC \the\lettercatcode \NC \NR |
| 2225 |
\NC \type {\othercatcode } \NC \the\othercatcode |
| 2226 |
\NC \type {\activecatcode } \NC \the\activecatcode \NC \NR |
| 2227 |
\NC \type {\commentcatcode } \NC \the\commentcatcode |
| 2228 |
\NC \type {\invalidcatcode } \NC \the\invalidcatcode \NC \NR |
| 2229 |
\stoptabulate |
| 2230 |
|
| 2231 |
The first column shows the constant that \CONTEXT\ provides and the |
| 2232 |
name indicates the purpose. Here are two examples: |
| 2233 |
|
| 2234 |
\starttyping |
| 2235 |
\catcode123=\begingroupcatcode |
| 2236 |
\catcode125=\endgroupcatcode |
| 2237 |
\stoptyping |
| 2238 |
|
| 2239 |
\stopoldprimitive |
| 2240 |
|
| 2241 |
\startnewprimitive[title={\prm {catcodetable}}] |
| 2242 |
|
| 2243 |
The catcode table with the given index will become active. |
| 2244 |
|
| 2245 |
\stopnewprimitive |
| 2246 |
|
| 2247 |
\startnewprimitive[title={\prm {cccode}}] |
| 2248 |
|
| 2249 |
This is an experimental feature that can set some processing options. The |
| 2250 |
character specific code is stored in the glyph node and consulted later. An |
| 2251 |
example of such option is \quote {ignore twin}, bit one, which we set for a few |
| 2252 |
punctuation characters. |
| 2253 |
|
| 2254 |
\stopnewprimitive |
| 2255 |
|
| 2256 |
\startnewprimitive[title={\prm {cdef}}] |
| 2257 |
|
| 2258 |
This primitive is like \prm {edef} but in some usage scenarios is slightly |
| 2259 |
more efficient because (delayed) expansion is ignored which in turn saves |
| 2260 |
building a temporary token list. |
| 2261 |
|
| 2262 |
\startbuffer |
| 2263 |
\edef\FooA{this is foo} \meaningfull\FooA\crlf |
| 2264 |
\cdef\FooB{this is foo} \meaningfull\FooB\par |
| 2265 |
\stopbuffer |
| 2266 |
|
| 2267 |
\typebuffer {\tttf \getbuffer} |
| 2268 |
|
| 2269 |
\stopnewprimitive |
| 2270 |
|
| 2271 |
\startnewprimitive[title={\prm {cdefcsname}}] |
| 2272 |
|
| 2273 |
This primitive is like \prm {edefcsame} but in some usage scenarios is slightly |
| 2274 |
more efficient because (delayed) expansion is ignored which in turn saves |
| 2275 |
building a temporary token list. |
| 2276 |
|
| 2277 |
\startbuffer |
| 2278 |
\edefcsname FooA\endcsname{this is foo} \meaningasis\FooA\crlf |
| 2279 |
\cdefcsname FooB\endcsname{this is foo} \meaningasis\FooB\par |
| 2280 |
\stopbuffer |
| 2281 |
|
| 2282 |
\typebuffer {\tttf \getbuffer} |
| 2283 |
|
| 2284 |
\stopnewprimitive |
| 2285 |
|
| 2286 |
\startnewprimitive[title={\prm {cfcode}}] |
| 2287 |
|
| 2288 |
This primitive is a companion to \prm {efcode} and sets the compression factor. |
| 2289 |
It takes three values: font, character code, and factor. |
| 2290 |
|
| 2291 |
\stopnewprimitive |
| 2292 |
|
| 2293 |
\startoldprimitive[title={\prm {char}}] |
| 2294 |
|
| 2295 |
This appends a character with the given index in the current font. |
| 2296 |
|
| 2297 |
\stopoldprimitive |
| 2298 |
|
| 2299 |
\startoldprimitive[title={\prm {chardef}}] |
| 2300 |
|
| 2301 |
The following definition relates a control sequence to a specific character: |
| 2302 |
|
| 2303 |
\starttyping |
| 2304 |
\chardef\copyrightsign"A9 |
| 2305 |
\stoptyping |
| 2306 |
|
| 2307 |
However, because in a context where a number is expected, such a \prm {chardef} |
| 2308 |
is seen as valid number, there was a time when this primitive was used to define |
| 2309 |
constants without overflowing the by then limited pool of count registers. In |
| 2310 |
\ETEX\ aware engines this was less needed, and in \LUAMETATEX\ we have \prm |
| 2311 |
{integerdef} as a more natural candidate. |
| 2312 |
|
| 2313 |
\stopoldprimitive |
| 2314 |
|
| 2315 |
\startoldprimitive[title={\prm {cleaders}}] |
| 2316 |
|
| 2317 |
See \prm {gleaders} for an explanation. |
| 2318 |
|
| 2319 |
\stopoldprimitive |
| 2320 |
|
| 2321 |
\startnewprimitive[title={\prm {clearmarks}}] |
| 2322 |
|
| 2323 |
This primitive is an addition to the multiple marks mechanism that originates in |
| 2324 |
\ETEX\ and reset the mark registers of the given category (a number). |
| 2325 |
|
| 2326 |
\stopnewprimitive |
| 2327 |
|
| 2328 |
\startoldprimitive[title={\prm {clubpenalties}}] |
| 2329 |
|
| 2330 |
This is an array of penalty put before the first lines in a paragraph. High values |
| 2331 |
discourage (or even prevent) a lone line at the end of a page. This |
| 2332 |
command expects a count value indicating the number of entries that will follow. |
| 2333 |
The first entry is ends up after the first line. |
| 2334 |
|
| 2335 |
\stopoldprimitive |
| 2336 |
|
| 2337 |
\startoldprimitive[title={\prm {clubpenalty}}] |
| 2338 |
|
| 2339 |
This is the penalty put before a club line in a paragraph. High values discourage |
| 2340 |
(or even prevent) a lone line at the end of a next page. |
| 2341 |
|
| 2342 |
\stopoldprimitive |
| 2343 |
|
| 2344 |
\startnewprimitive[title={\prm {constant}}] |
| 2345 |
|
| 2346 |
This prefix tags a macro (without arguments) as being constant. The main |
| 2347 |
consequence is that in some cases expansion gets delayed which gives a little |
| 2348 |
performance boost and less (temporary) memory usage, for instance in \type |
| 2349 |
{\csname} like scenarios. |
| 2350 |
|
| 2351 |
\stopnewprimitive |
| 2352 |
|
| 2353 |
\startnewprimitive[title={\prm {constrained}}] |
| 2354 |
|
| 2355 |
See previous section about \prm {retained}. |
| 2356 |
|
| 2357 |
\stopnewprimitive |
| 2358 |
|
| 2359 |
\startoldprimitive[title={\prm {copy}}] |
| 2360 |
|
| 2361 |
This is the box register accessor that returns a copy of the box. |
| 2362 |
|
| 2363 |
\stopoldprimitive |
| 2364 |
|
| 2365 |
\startnewprimitive[title={\prm {copymathatomrule}}] |
| 2366 |
|
| 2367 |
This copies the rule bitset from the parent class (second argument) to the target |
| 2368 |
class (first argument). The bitset controls the features that apply to atoms. |
| 2369 |
|
| 2370 |
\stopnewprimitive |
| 2371 |
|
| 2372 |
\startnewprimitive[title={\prm {copymathparent}}] |
| 2373 |
|
| 2374 |
This binds the given class (first argument) to another class (second argument) so |
| 2375 |
that one doesn't need to define all properties. |
| 2376 |
|
| 2377 |
\stopnewprimitive |
| 2378 |
|
| 2379 |
\startnewprimitive[title={\prm {copymathspacing}}] |
| 2380 |
|
| 2381 |
This copies an class spacing specification to another one, so in |
| 2382 |
|
| 2383 |
\starttyping |
| 2384 |
\copymathspacing 34 2 |
| 2385 |
\stoptyping |
| 2386 |
|
| 2387 |
class 34 (a user one) get the spacing from class 2 (binary). |
| 2388 |
|
| 2389 |
\stopnewprimitive |
| 2390 |
|
| 2391 |
\startnewprimitive[title={\prm {copysplitdiscards}}] |
| 2392 |
|
| 2393 |
This is a variant of \prm {splitdiscards} that keep the original. |
| 2394 |
|
| 2395 |
\stopnewprimitive |
| 2396 |
|
| 2397 |
\startoldprimitive[title={\prm {count}}] |
| 2398 |
|
| 2399 |
This accesses a count register by index. This is kind of \quote {not done} unless |
| 2400 |
you do it local and make sure that it doesn't influence macros that you call. |
| 2401 |
|
| 2402 |
\starttyping |
| 2403 |
\count4023=10 |
| 2404 |
\stoptyping |
| 2405 |
|
| 2406 |
In standard \TEX\ the first 10 counters are special because they get reported to |
| 2407 |
the console, and \type {\count0} is then assumed to be the page counter. |
| 2408 |
|
| 2409 |
\stopoldprimitive |
| 2410 |
|
| 2411 |
\startoldprimitive[title={\prm {countdef}}] |
| 2412 |
|
| 2413 |
This primitive relates a control sequence to a count register. Compare this to |
| 2414 |
the example in the previous section. |
| 2415 |
|
| 2416 |
\starttyping |
| 2417 |
\countdef\MyCounter4023 |
| 2418 |
\MyCounter=10 |
| 2419 |
\stoptyping |
| 2420 |
|
| 2421 |
However, this is also \quote {not done}. Instead one should use the allocator that |
| 2422 |
the macro package provides. |
| 2423 |
|
| 2424 |
\starttyping |
| 2425 |
\newcount\MyCounter |
| 2426 |
\MyCounter=10 |
| 2427 |
\stoptyping |
| 2428 |
|
| 2429 |
In \LUAMETATEX\ we also have integers that don't rely on registers. These are |
| 2430 |
assigned by the primitive \prm {integerdef}: |
| 2431 |
|
| 2432 |
\starttyping |
| 2433 |
\integerdef\MyCounterA 10 |
| 2434 |
\stoptyping |
| 2435 |
|
| 2436 |
Or better \type {\newinteger}. |
| 2437 |
|
| 2438 |
\starttyping |
| 2439 |
\newinteger\MyCounterB |
| 2440 |
\MyCounterN10 |
| 2441 |
\stoptyping |
| 2442 |
|
| 2443 |
There is a lowlevel manual on registers. |
| 2444 |
|
| 2445 |
\stopoldprimitive |
| 2446 |
|
| 2447 |
\startoldprimitive[title={\prm {cr}}] |
| 2448 |
|
| 2449 |
This ends a row in an alignment. It also ends an alignment preamble. |
| 2450 |
\stopoldprimitive |
| 2451 |
|
| 2452 |
\startnewprimitive[title={\prm {crampeddisplaystyle}}] |
| 2453 |
|
| 2454 |
A less spacy alternative of \prm {displaystyle}; integer representation: |
| 2455 |
\the\scriptstyle. |
| 2456 |
|
| 2457 |
\stopnewprimitive |
| 2458 |
|
| 2459 |
\startnewprimitive[title={\prm {crampedscriptscriptstyle}}] |
| 2460 |
|
| 2461 |
A less spacy alternative of \prm {scriptscriptstyle}; integer representation: |
| 2462 |
\the\scriptscriptstyle. |
| 2463 |
|
| 2464 |
\stopnewprimitive |
| 2465 |
|
| 2466 |
\startnewprimitive[title={\prm {crampedscriptstyle}}] |
| 2467 |
|
| 2468 |
A less spacy alternative of \prm {scriptstyle}; integer representation: |
| 2469 |
\the\scriptstyle. |
| 2470 |
|
| 2471 |
\stopnewprimitive |
| 2472 |
|
| 2473 |
\startnewprimitive[title={\prm {crampedtextstyle}}] |
| 2474 |
|
| 2475 |
A less spacy alternative of \prm {textstyle}; integer representation: |
| 2476 |
\the\textstyle. |
| 2477 |
|
| 2478 |
\stopnewprimitive |
| 2479 |
|
| 2480 |
\startoldprimitive[title={\prm {crcr}}] |
| 2481 |
|
| 2482 |
This ends a row in an alignment when it hasn't ended yet. |
| 2483 |
|
| 2484 |
\stopoldprimitive |
| 2485 |
|
| 2486 |
\startnewprimitive[title={\prm {csactive}}] |
| 2487 |
|
| 2488 |
Because \LUATEX\ (and \LUAMETATEX) are \UNICODE\ engines active characters are |
| 2489 |
implemented a bit differently. They don't occupy a eight bit range of characters |
| 2490 |
but are stored as control sequence with a special prefix \type {U+FFFF} which |
| 2491 |
never shows up in documents. The \prm {csstring} primitive injects the name of a |
| 2492 |
control sequence without leading escape character, the \prm {csactive} injects |
| 2493 |
the internal name of the following (either of not active) character. As we cannot |
| 2494 |
display the prefix: \type {\csactive~} will inject the \UTF\ sequences for \type |
| 2495 |
{U+FFFF} and \type {U+007E}, so here we get the bytes \type {EFBFBF7E}. Basically |
| 2496 |
the next token is preceded by \prm {string}, so when you don't provide a |
| 2497 |
character you are in for a surprise. |
| 2498 |
|
| 2499 |
\stopnewprimitive |
| 2500 |
|
| 2501 |
\startoldprimitive[title={\prm {csname}}] |
| 2502 |
|
| 2503 |
This original \TEX\ primitive starts the construction of a control sequence |
| 2504 |
reference. It does a lookup and when no sequence with than name is found, it will |
| 2505 |
create a hash entry and defaults its meaning to \prm {relax}. |
| 2506 |
|
| 2507 |
\starttyping |
| 2508 |
\csname letters and other characters\endcsname |
| 2509 |
\stoptyping |
| 2510 |
|
| 2511 |
\stopoldprimitive |
| 2512 |
|
| 2513 |
\startnewprimitive[title={\prm {csnamestring}}] |
| 2514 |
|
| 2515 |
This is a companion of \prm {lastnamedcs} that injects the name of the found |
| 2516 |
control sequence. When used inside a \type {csname} constructor it is more |
| 2517 |
efficient than repeating a token list, compare: |
| 2518 |
|
| 2519 |
\starttyping |
| 2520 |
\csname\ifcsname whatever\endcsname\csnamestring\endcsname % referenced |
| 2521 |
\csname\ifcsname whatever\endcsname whatever\endcsname % scanned |
| 2522 |
\stoptyping |
| 2523 |
|
| 2524 |
\stopnewprimitive |
| 2525 |
|
| 2526 |
\startnewprimitive[title={\prm {csstring}}] |
| 2527 |
|
| 2528 |
This primitive returns the name of the control sequence given without the leading |
| 2529 |
escape character (normally a backslash). Of course you could strip that character |
| 2530 |
with a simple helper but this is more natural. |
| 2531 |
|
| 2532 |
\startbuffer |
| 2533 |
\csstring\mymacro |
| 2534 |
\stopbuffer |
| 2535 |
|
| 2536 |
\typebuffer |
| 2537 |
|
| 2538 |
We get the name, not the meaning: {\tt \inlinebuffer}. |
| 2539 |
|
| 2540 |
\stopnewprimitive |
| 2541 |
|
| 2542 |
\startoldprimitive[title={\prm {currentgrouplevel}}] |
| 2543 |
|
| 2544 |
\startbuffer |
| 2545 |
[\the\currentgrouplevel] \bgroup |
| 2546 |
[\the\currentgrouplevel] \bgroup |
| 2547 |
[\the\currentgrouplevel] |
| 2548 |
\egroup [\the\currentgrouplevel] |
| 2549 |
\egroup [\the\currentgrouplevel] |
| 2550 |
\stopbuffer |
| 2551 |
|
| 2552 |
The next example gives: \inlinebuffer. |
| 2553 |
|
| 2554 |
\typebuffer |
| 2555 |
|
| 2556 |
\stopoldprimitive |
| 2557 |
|
| 2558 |
\startoldprimitive[title={\prm {currentgrouptype}}] |
| 2559 |
|
| 2560 |
\startbuffer |
| 2561 |
[\the\currentgrouptype] \bgroup |
| 2562 |
[\the\currentgrouptype] \begingroup |
| 2563 |
[\the\currentgrouptype] |
| 2564 |
\endgroup [\the\currentgrouptype] |
| 2565 |
[\the\currentgrouptype] \beginmathgroup |
| 2566 |
[\the\currentgrouptype] |
| 2567 |
\endmathgroup [\the\currentgrouptype] |
| 2568 |
[\the\currentgrouptype] \egroup |
| 2569 |
\stopbuffer |
| 2570 |
|
| 2571 |
The next example gives: \inlinebuffer. |
| 2572 |
|
| 2573 |
\typebuffer |
| 2574 |
|
| 2575 |
The possible values depend in the engine and for \LUAMETATEX\ they are: |
| 2576 |
|
| 2577 |
\startluacode |
| 2578 |
context.startfourrows() |
| 2579 |
context.starttabulate { "|r|l|" } |
| 2580 |
for i=0,#tex.groupcodes do |
| 2581 |
context.NC() context(i) |
| 2582 |
context.NC() context(tex.groupcodes[i]) |
| 2583 |
context.NC() context.NR() |
| 2584 |
end |
| 2585 |
context.stoptabulate() |
| 2586 |
context.stopfourrows() |
| 2587 |
\stopluacode |
| 2588 |
|
| 2589 |
\stopoldprimitive |
| 2590 |
|
| 2591 |
\startoldprimitive[title={\prm {currentifbranch}}] |
| 2592 |
|
| 2593 |
\startbuffer |
| 2594 |
[\the\currentifbranch] \iftrue |
| 2595 |
[\the\currentifbranch] \iffalse |
| 2596 |
[\the\currentifbranch] |
| 2597 |
\else |
| 2598 |
[\the\currentifbranch] |
| 2599 |
\fi [\the\currentifbranch] |
| 2600 |
\fi [\the\currentifbranch] |
| 2601 |
\stopbuffer |
| 2602 |
|
| 2603 |
The next example gives: \inlinebuffer. |
| 2604 |
|
| 2605 |
\typebuffer |
| 2606 |
|
| 2607 |
So when in the \quote {then} branch we get plus one and when in the \quote {else} |
| 2608 |
branch we end up with a minus one. |
| 2609 |
|
| 2610 |
\stopoldprimitive |
| 2611 |
|
| 2612 |
\startoldprimitive[title={\prm {currentiflevel}}] |
| 2613 |
|
| 2614 |
\startbuffer |
| 2615 |
[\the\currentiflevel] \iftrue |
| 2616 |
[\the\currentiflevel]\iftrue |
| 2617 |
[\the\currentiflevel] \iftrue |
| 2618 |
[\the\currentiflevel] |
| 2619 |
\fi [\the\currentiflevel] |
| 2620 |
\fi [\the\currentiflevel] |
| 2621 |
\fi [\the\currentiflevel] |
| 2622 |
\stopbuffer |
| 2623 |
|
| 2624 |
The next example gives: \inlinebuffer. |
| 2625 |
|
| 2626 |
\typebuffer |
| 2627 |
|
| 2628 |
\stopoldprimitive |
| 2629 |
|
| 2630 |
\startoldprimitive[title={\prm {currentiftype}}] |
| 2631 |
|
| 2632 |
\startbuffer |
| 2633 |
[\the\currentiftype] \iftrue |
| 2634 |
[\the\currentiftype]\iftrue |
| 2635 |
[\the\currentiftype] \iftrue |
| 2636 |
[\the\currentiftype] |
| 2637 |
\fi [\the\currentiftype] |
| 2638 |
\fi [\the\currentiftype] |
| 2639 |
\fi [\the\currentiftype] |
| 2640 |
\stopbuffer |
| 2641 |
|
| 2642 |
The next example gives: \inlinebuffer. |
| 2643 |
|
| 2644 |
\typebuffer |
| 2645 |
|
| 2646 |
The values are engine dependent: |
| 2647 |
|
| 2648 |
\startluacode |
| 2649 |
local t = tex.getiftypes() |
| 2650 |
context.startfiverows() |
| 2651 |
context.starttabulate { "|r|l|" } |
| 2652 |
for i=0,#tex.groupcodes do |
| 2653 |
context.NC() context(i) |
| 2654 |
context.NC() context(t[i]) |
| 2655 |
context.NC() context.NR() |
| 2656 |
end |
| 2657 |
context.stoptabulate() |
| 2658 |
context.stopfiverows() |
| 2659 |
\stopluacode |
| 2660 |
|
| 2661 |
\stopoldprimitive |
| 2662 |
|
| 2663 |
\startnewprimitive[title={\prm {currentloopiterator}}] |
| 2664 |
|
| 2665 |
Here we show the different expanded loop variants: |
| 2666 |
|
| 2667 |
\startbuffer |
| 2668 |
\edef\testA{\expandedloop 1 10 1{!}} |
| 2669 |
\edef\testB{\expandedrepeat 10 {!}} |
| 2670 |
\edef\testC{\expandedendless {\ifnum\currentloopiterator>10 \quitloop\else !\fi}} |
| 2671 |
\edef\testD{\expandedendless {\ifnum#I>10 \quitloop\else !\fi}} |
| 2672 |
\stopbuffer |
| 2673 |
|
| 2674 |
\typebuffer \getbuffer |
| 2675 |
|
| 2676 |
All these give the same result: |
| 2677 |
|
| 2678 |
\startlines \tt |
| 2679 |
\meaningasis\testA |
| 2680 |
\meaningasis\testB |
| 2681 |
\meaningasis\testC |
| 2682 |
\meaningasis\testD |
| 2683 |
\stoplines |
| 2684 |
|
| 2685 |
The \type {#I} is a shortcut to the current loop iterator; other shortcuts are |
| 2686 |
\type {#P} for the parent iterator value and \type {#G} for the grand parent. |
| 2687 |
|
| 2688 |
\stopnewprimitive |
| 2689 |
|
| 2690 |
\startnewprimitive[title={\prm {currentloopnesting}}] |
| 2691 |
|
| 2692 |
This integer reports how many nested loops are currently active. Of course in |
| 2693 |
practice the value only has meaning when you know at what outer level your nested |
| 2694 |
loop started. |
| 2695 |
|
| 2696 |
\startbuffer |
| 2697 |
\expandedloop 1 10 1 {% |
| 2698 |
\ifodd\currentloopiterator\else |
| 2699 |
[\expandedloop 1 \currentloopiterator 1 {% |
| 2700 |
\the\currentloopnesting |
| 2701 |
}] |
| 2702 |
\fi |
| 2703 |
} |
| 2704 |
\stopbuffer |
| 2705 |
|
| 2706 |
\typebuffer |
| 2707 |
|
| 2708 |
Here we use the two numeric state primitives \prm {currentloopiterator} and \prm |
| 2709 |
{currentloopnesting}. This results in: |
| 2710 |
|
| 2711 |
\getbuffer |
| 2712 |
|
| 2713 |
\stopnewprimitive |
| 2714 |
|
| 2715 |
\startnewprimitive[title={\prm {currentlysetmathstyle}}] |
| 2716 |
TODO |
| 2717 |
\stopnewprimitive |
| 2718 |
|
| 2719 |
\startnewprimitive[title={\prm {currentmarks}}] |
| 2720 |
|
| 2721 |
Marks only get updated when a page is split off or part of a box using \prm |
| 2722 |
{vsplit} gets wrapped up. This primitive gives access to the current value of a |
| 2723 |
mark and takes the number of a mark class. |
| 2724 |
|
| 2725 |
\stopnewprimitive |
| 2726 |
|
| 2727 |
\startoldprimitive[title={\prm {currentstacksize}}] |
| 2728 |
|
| 2729 |
This is more diagnostic feature than a useful one but we show it anyway. There is |
| 2730 |
some basic overhead when we enter a group: |
| 2731 |
|
| 2732 |
\startbuffer |
| 2733 |
\bgroup [\the\currentstacksize] |
| 2734 |
\bgroup [\the\currentstacksize] |
| 2735 |
\bgroup [\the\currentstacksize] |
| 2736 |
[\the\currentstacksize] \egroup |
| 2737 |
[\the\currentstacksize] \egroup |
| 2738 |
[\the\currentstacksize] \egroup |
| 2739 |
\stopbuffer |
| 2740 |
|
| 2741 |
\typebuffer \getbuffer |
| 2742 |
|
| 2743 |
As soon as we define something or change a value, the stack gets populated by |
| 2744 |
information needed for recovery after the group ends. |
| 2745 |
|
| 2746 |
\startbuffer |
| 2747 |
\bgroup [\the\currentstacksize] |
| 2748 |
\scratchcounter 1 |
| 2749 |
\bgroup [\the\currentstacksize] |
| 2750 |
\scratchdimen 1pt |
| 2751 |
\scratchdimen 2pt |
| 2752 |
\bgroup [\the\currentstacksize] |
| 2753 |
\scratchcounter 2 |
| 2754 |
\scratchcounter 3 |
| 2755 |
[\the\currentstacksize] \egroup |
| 2756 |
[\the\currentstacksize] \egroup |
| 2757 |
[\the\currentstacksize] \egroup |
| 2758 |
\stopbuffer |
| 2759 |
|
| 2760 |
\typebuffer \getbuffer |
| 2761 |
|
| 2762 |
The stack also keeps some state information, for instance when a box is being |
| 2763 |
built. In \LUAMETATEX\ that is is quite a bit more than in other engines but it |
| 2764 |
is compensated by more efficient save stack handling elsewhere. |
| 2765 |
|
| 2766 |
\startbuffer |
| 2767 |
\hbox \bgroup [\the\currentstacksize] |
| 2768 |
\hbox \bgroup [\the\currentstacksize] |
| 2769 |
\hbox \bgroup [\the\currentstacksize] |
| 2770 |
[\the\currentstacksize] \egroup |
| 2771 |
[\the\currentstacksize] \egroup |
| 2772 |
[\the\currentstacksize] \egroup |
| 2773 |
\stopbuffer |
| 2774 |
|
| 2775 |
\typebuffer \getbuffer |
| 2776 |
|
| 2777 |
\stopoldprimitive |
| 2778 |
|
| 2779 |
\startoldprimitive[title={\prm {day}}] |
| 2780 |
|
| 2781 |
This internal number starts out with the day that the job started. |
| 2782 |
|
| 2783 |
\stopoldprimitive |
| 2784 |
|
| 2785 |
\startnewprimitive[title={\prm {dbox}}] |
| 2786 |
|
| 2787 |
A \prm {dbox} is just a \prm {vbox} (baseline at the bottom) but it has the |
| 2788 |
property \quote {dual baseline} which means that is some cases it will behave |
| 2789 |
like a \prm {vtop} (baseline at the top) too. Like: |
| 2790 |
|
| 2791 |
\ruledhbox\bgroup \showstruts |
| 2792 |
\ruleddbox {\hsize 3cm \strut dbox \par \strut dbox \par\strut dbox } |
| 2793 |
\ruledvbox {\hsize 3cm \strut vbox \par \strut vbox \par\strut vbox } |
| 2794 |
\ruledvtop {\hsize 3cm \strut vtop \par \strut vtop \par\strut vtop } |
| 2795 |
\ruledvcenter{\hsize 3cm \strut vcenter \par \strut vcenter \par\strut vcenter}% |
| 2796 |
\egroup |
| 2797 |
|
| 2798 |
A \type {\dbox} behaves like a \type {\vtop} when it's appended to a vertical list which |
| 2799 |
means that the height of the first box or rule determines the (base)line correction that |
| 2800 |
gets applied. |
| 2801 |
|
| 2802 |
% This example is taken from lowlevel-boxes: |
| 2803 |
|
| 2804 |
\startlinecorrection |
| 2805 |
\startcombination [nx=3,ny=1,location=top] |
| 2806 |
{\vbox \bgroup \hsize .3\textwidth |
| 2807 |
\small\small \setupalign[tolerant,stretch] \dontcomplain |
| 2808 |
xxxxxxxxxxxxxxxx\par |
| 2809 |
\ruledvbox{\samplefile{ward}}\par |
| 2810 |
xxxxxxxxxxxxxxxx\par |
| 2811 |
\egroup} {\type {\vbox}} |
| 2812 |
{\vbox \bgroup \hsize .3\textwidth |
| 2813 |
\small\small \setupalign[tolerant,stretch] \dontcomplain |
| 2814 |
xxxxxxxxxxxxxxxx\par |
| 2815 |
\ruledvtop{\samplefile{ward}}\par |
| 2816 |
xxxxxxxxxxxxxxxx\par |
| 2817 |
\egroup} {\type {\vtop}} |
| 2818 |
{\vbox \bgroup \hsize .3\textwidth |
| 2819 |
\small\small \setupalign[tolerant,stretch] \dontcomplain |
| 2820 |
xxxxxxxxxxxxxxxx\par |
| 2821 |
\ruleddbox{\samplefile{ward}}\par |
| 2822 |
xxxxxxxxxxxxxxxx\par |
| 2823 |
\egroup} {\type {\dbox}} |
| 2824 |
\stopcombination |
| 2825 |
\stoplinecorrection |
| 2826 |
|
| 2827 |
\stopnewprimitive |
| 2828 |
|
| 2829 |
\startoldprimitive[title={\prm {deadcycles}}] |
| 2830 |
|
| 2831 |
This counter is incremented every time the output routine is entered. When \prm |
| 2832 |
{maxdeadcycles} is reached \TEX\ will issue an error message, so you'd better |
| 2833 |
reset its value when a page is done. |
| 2834 |
|
| 2835 |
\stopoldprimitive |
| 2836 |
|
| 2837 |
\startoldprimitive[title={\prm {def}}] |
| 2838 |
|
| 2839 |
This is the main definition command, as in: |
| 2840 |
|
| 2841 |
\starttyping |
| 2842 |
\def\foo{l me} |
| 2843 |
\stoptyping |
| 2844 |
|
| 2845 |
with companions like \prm {gdef}, \prm {edef}, \prm {xdef}, etc. and variants |
| 2846 |
like: |
| 2847 |
|
| 2848 |
\starttyping |
| 2849 |
\def\foo#1{... #1...} |
| 2850 |
\stoptyping |
| 2851 |
|
| 2852 |
where the hash is used in the preamble and for referencing. More about that can |
| 2853 |
be found in the low level manual about macros. |
| 2854 |
|
| 2855 |
In the \CONTEXT\ distribution you can find explanations about how \LUAMETATEX\ |
| 2856 |
extends the argument parser. When defining a macro you can do this: |
| 2857 |
|
| 2858 |
\starttyping |
| 2859 |
\def\foo(#1)#2{...} |
| 2860 |
\stoptyping |
| 2861 |
|
| 2862 |
Here the first argument between parentheses is mandate. But the magic |
| 2863 |
prefix \prm {tolerant} makes that limitation go away: |
| 2864 |
|
| 2865 |
\starttyping |
| 2866 |
\tolerant\def\foo(#1)#2{...} |
| 2867 |
\stoptyping |
| 2868 |
|
| 2869 |
A variant is this: |
| 2870 |
|
| 2871 |
\starttyping |
| 2872 |
\tolerant\def\foo(#1)#*(#2){...} |
| 2873 |
\stoptyping |
| 2874 |
|
| 2875 |
Here we have two optional arguments, possibly be separated by spaces. There are |
| 2876 |
more parsing options, that we just mention: |
| 2877 |
|
| 2878 |
\starttabulate[|T|i2l|] |
| 2879 |
\FL |
| 2880 |
\NC + \NC keep the braces \NC \NR |
| 2881 |
\NC - \NC discard and don't count the argument \NC \NR |
| 2882 |
\NC / \NC remove leading an trailing spaces and pars \NC \NR |
| 2883 |
\NC = \NC braces are mandate \NC \NR |
| 2884 |
\NC _ \NC braces are mandate and kept \NC \NR |
| 2885 |
\NC ^ \NC keep leading spaces \NC \NR |
| 2886 |
\ML |
| 2887 |
\NC 1-9 \NC an argument \NC \NR |
| 2888 |
\NC 0 \NC discard but count the argument \NC \NR |
| 2889 |
\ML |
| 2890 |
\NC * \NC ignore spaces \NC \NR |
| 2891 |
\NC . \NC ignore pars and spaces \NC \NR |
| 2892 |
\NC , \NC push back space when no match \NC \NR |
| 2893 |
\ML |
| 2894 |
\NC : \NC pick up scanning here \NC \NR |
| 2895 |
\NC ; \NC quit scanning \NC \NR |
| 2896 |
\LL |
| 2897 |
\stoptabulate |
| 2898 |
|
| 2899 |
\stopoldprimitive |
| 2900 |
|
| 2901 |
\startoldprimitive[title={\prm {defaulthyphenchar}}][obsolete=yes] |
| 2902 |
|
| 2903 |
When a font is loaded its hyphen character is set to this value. It can be |
| 2904 |
changed afterwards. However, in \LUAMETATEX\ font loading is under \LUA\ control |
| 2905 |
so these properties can be set otherwise. |
| 2906 |
|
| 2907 |
\stopoldprimitive |
| 2908 |
|
| 2909 |
\startoldprimitive[title={\prm {defaultskewchar}}][obsolete=yes] |
| 2910 |
|
| 2911 |
When a font is loaded its skew character is set to this value. It can be changed |
| 2912 |
afterwards. However, in \LUAMETATEX\ font loading is under \LUA\ control so these |
| 2913 |
properties can be set otherwise. Also, \OPENTYPE\ math fonts have top anchor |
| 2914 |
instead. |
| 2915 |
|
| 2916 |
\stopoldprimitive |
| 2917 |
|
| 2918 |
\startnewprimitive[title={\prm {defcsname}}] |
| 2919 |
|
| 2920 |
We now get a series of log clutter avoidance primitives. It's fine if you argue |
| 2921 |
that they are not really needed, just don't use them. |
| 2922 |
|
| 2923 |
\starttyping |
| 2924 |
\expandafter\def\csname MyMacro:1\endcsname{...} |
| 2925 |
\defcsname MyMacro:1\endcsname{...} |
| 2926 |
\stoptyping |
| 2927 |
|
| 2928 |
The fact that \TEX\ has three (expanded and global) companions can be seen as a |
| 2929 |
signal that less verbosity makes sense. It's just that macro packages use plenty |
| 2930 |
of \prm {csname}'s. |
| 2931 |
|
| 2932 |
\stopnewprimitive |
| 2933 |
|
| 2934 |
\startnewprimitive[title={\prm {deferred}}] |
| 2935 |
|
| 2936 |
This is mostly a compatibility prefix and it can be checked at the \LUA\ end when |
| 2937 |
there is a \LUA\ based assignment going on. It is the counterpart of \prm |
| 2938 |
{immediate}. In the traditional engines a \prm {write} is normally deferred |
| 2939 |
(turned into a node) and can be handled \prm {immediate}, while a \prm {special} |
| 2940 |
does the opposite. |
| 2941 |
|
| 2942 |
\stopnewprimitive |
| 2943 |
|
| 2944 |
\startoldprimitive[title={\prm {delcode}}][obsolete=yes] |
| 2945 |
|
| 2946 |
This assigns delimiter properties to an eight bit character so it has little use |
| 2947 |
in an \OPENTYPE\ math setup. WHen the assigned value is hex encoded, the first |
| 2948 |
byte denotes the small family, then we have two bytes for the small index, |
| 2949 |
followed by three similar bytes for the large variant. |
| 2950 |
|
| 2951 |
\stopoldprimitive |
| 2952 |
|
| 2953 |
\startoldprimitive[title={\prm {delimiter}}][obsolete=yes] |
| 2954 |
|
| 2955 |
This command inserts a delimiter with the given specification. In \OPENTYPE\ math |
| 2956 |
we use a different command so it is unlikely that this primitive is used in |
| 2957 |
\LUAMETATEX. It takes a number that can best be coded hexadecimal: one byte for |
| 2958 |
the class, one for the small family, two for the small index, one for the large |
| 2959 |
family and two for the large index. This demonstrates that it can't handle wide |
| 2960 |
fonts. Also, in \OPENTYPE\ math fonts the larger sizes and extensible come from |
| 2961 |
the same font as the small symbol. On top of that, in \LUAMETATEX\ we have more |
| 2962 |
classes than fit in a byte. |
| 2963 |
|
| 2964 |
\stopoldprimitive |
| 2965 |
|
| 2966 |
\startoldprimitive[title={\prm {delimiterfactor}}][obsolete=yes] |
| 2967 |
|
| 2968 |
This is one of the parameters that determines the size of a delimiter: at least |
| 2969 |
this factor times the formula height divided by 1000. In \OPENTYPE\ math |
| 2970 |
different properties and strategies are used. |
| 2971 |
|
| 2972 |
\stopoldprimitive |
| 2973 |
|
| 2974 |
\startoldprimitive[title={\prm {delimitershortfall}}][obsolete=yes] |
| 2975 |
|
| 2976 |
This is one of the parameters that determines the size of a delimiter: at least |
| 2977 |
the formula height minus this parameter. In \OPENTYPE\ math different properties |
| 2978 |
and strategies are used. |
| 2979 |
|
| 2980 |
\stopoldprimitive |
| 2981 |
|
| 2982 |
\startnewprimitive[title={\prm {detokened}}] |
| 2983 |
|
| 2984 |
The following token will be serialized into characters with category \quote |
| 2985 |
{other}. |
| 2986 |
|
| 2987 |
\startbuffer |
| 2988 |
\toks0{123} |
| 2989 |
\def\foo{let's be \relax'd} |
| 2990 |
\def\oof#1{let's see #1} |
| 2991 |
\detokened\toks0 |
| 2992 |
\detokened\foo |
| 2993 |
\detokened\oof |
| 2994 |
\detokened\setbox |
| 2995 |
\detokened X |
| 2996 |
\stopbuffer |
| 2997 |
|
| 2998 |
\typebuffer |
| 2999 |
|
| 3000 |
Gives: |
| 3001 |
|
| 3002 |
\startlines\tt |
| 3003 |
\getbuffer |
| 3004 |
\stoplines |
| 3005 |
|
| 3006 |
Macros with arguments are not shown. |
| 3007 |
|
| 3008 |
\stopnewprimitive |
| 3009 |
|
| 3010 |
\startoldprimitive[title={\prm {detokenize}}] |
| 3011 |
|
| 3012 |
This \ETEX\ primitive turns the content of the provides list will become |
| 3013 |
characters, kind of verbatim. |
| 3014 |
|
| 3015 |
\startbuffer |
| 3016 |
\expandafter\let\expandafter\temp\detokenize{1} \meaning\temp |
| 3017 |
\expandafter\let\expandafter\temp\detokenize{A} \meaning\temp |
| 3018 |
\stopbuffer |
| 3019 |
|
| 3020 |
\typebuffer |
| 3021 |
|
| 3022 |
\startlines \tttf \getbuffer \stoplines |
| 3023 |
|
| 3024 |
\stopoldprimitive |
| 3025 |
|
| 3026 |
\startnewprimitive[title={\prm {detokenized}}] |
| 3027 |
|
| 3028 |
The following (single) token will be serialized into characters with category |
| 3029 |
\quote {other}. |
| 3030 |
|
| 3031 |
\startbuffer |
| 3032 |
\toks0{123} |
| 3033 |
\def\foo{let's be \relax'd} |
| 3034 |
\def\oof#1{let's see #1} |
| 3035 |
\detokenized\toks0 |
| 3036 |
\detokenized\foo |
| 3037 |
\detokenized\oof |
| 3038 |
\detokenized\setbox |
| 3039 |
\detokenized X |
| 3040 |
\stopbuffer |
| 3041 |
|
| 3042 |
\typebuffer |
| 3043 |
|
| 3044 |
Gives: |
| 3045 |
|
| 3046 |
\startlines\tt |
| 3047 |
\getbuffer |
| 3048 |
\stoplines |
| 3049 |
|
| 3050 |
It is one of these new primitives that complement others like \prm {detokened} |
| 3051 |
and such, and they are often mostly useful in experiments of some low level |
| 3052 |
magic, which made them stay. |
| 3053 |
|
| 3054 |
\stopnewprimitive |
| 3055 |
|
| 3056 |
\startoldprimitive[title={\prm {dimen}}] |
| 3057 |
|
| 3058 |
Like \prm {count} this is a register accessor which is described in more |
| 3059 |
detail in a low level manual. |
| 3060 |
|
| 3061 |
\starttyping |
| 3062 |
\dimen0=10pt |
| 3063 |
\stoptyping |
| 3064 |
|
| 3065 |
While \TEX\ has some assumptions with respect to the first ten count registers |
| 3066 |
(as well as the one that holds the output, normally 255), all dimension registers |
| 3067 |
are treated equal. However, you need to be aware of clashes with other usage. |
| 3068 |
Therefore you can best use the predefined scratch registers or define dedicate |
| 3069 |
ones with the \type {\newdimen} macro. |
| 3070 |
|
| 3071 |
\stopoldprimitive |
| 3072 |
|
| 3073 |
\startoldprimitive[title={\prm {dimendef}}] |
| 3074 |
|
| 3075 |
This primitive is used by the \type {\newdimen} macro when it relates a control |
| 3076 |
sequence with a specific register. Only use it when you know what you're doing. |
| 3077 |
|
| 3078 |
\stopoldprimitive |
| 3079 |
|
| 3080 |
\startnewprimitive[title={\prm {dimensiondef}}] |
| 3081 |
|
| 3082 |
A variant of \prm {integerdef} is: |
| 3083 |
|
| 3084 |
\starttyping |
| 3085 |
\dimensiondef\MyDimen = 1234pt |
| 3086 |
\stoptyping |
| 3087 |
|
| 3088 |
The properties are comparable to the ones described in the section \prm |
| 3089 |
{integerdef}. |
| 3090 |
|
| 3091 |
\stopnewprimitive |
| 3092 |
|
| 3093 |
% \startnewprimitive[title={\prm {dimexperimental}}] |
| 3094 |
% \stopnewprimitive |
| 3095 |
|
| 3096 |
\startoldprimitive[title={\prm {dimexpr}}] |
| 3097 |
|
| 3098 |
This primitive is similar to of \prm {numexpr} but operates on dimensions |
| 3099 |
instead. Integer quantities are interpreted as dimensions in scaled points. |
| 3100 |
|
| 3101 |
\startbuffer |
| 3102 |
\the\dimexpr (1pt + 2pt - 5pt) * 10 / 2 \relax |
| 3103 |
\stopbuffer |
| 3104 |
|
| 3105 |
\typebuffer |
| 3106 |
|
| 3107 |
gives: \inlinebuffer. You can mix in symbolic integers and dimensions. This doesn't work: |
| 3108 |
|
| 3109 |
\startbuffer |
| 3110 |
\the\dimexpr 10 * (1pt + 2pt - 5pt) / 2 \relax |
| 3111 |
\stopbuffer |
| 3112 |
|
| 3113 |
because the engine scans for a dimension and only for an integer (or equivalent) |
| 3114 |
after a \type {*} or \type {/}. |
| 3115 |
|
| 3116 |
|
| 3117 |
\stopoldprimitive |
| 3118 |
|
| 3119 |
\startnewprimitive[title={\prm {dimexpression}}] |
| 3120 |
|
| 3121 |
This command is like \prm {numexpression} but results in a dimension instead of |
| 3122 |
an integer. Where \prm {dimexpr} doesn't like \typ {2 * 10pt} this expression |
| 3123 |
primitive is quite happy with it. |
| 3124 |
|
| 3125 |
You can get an idea what the engines sees by setting \prm {tracingexpressions} |
| 3126 |
to a value larger than zero. It shows the expression in rpn form. |
| 3127 |
|
| 3128 |
\starttyping |
| 3129 |
\dimexpression 4pt * 2 + 6pt \relax |
| 3130 |
\dimexpression 2 * 4pt + 6pt \relax |
| 3131 |
\dimexpression 4pt * 2.5 + 6pt \relax |
| 3132 |
\dimexpression 2.5 * 4pt + 6pt \relax |
| 3133 |
\numexpression 2 * 4 + 6 \relax |
| 3134 |
\numexpression (1 + 2) * (3 + 4) \relax |
| 3135 |
\stoptyping |
| 3136 |
|
| 3137 |
The \prm {relax} is mandate simply because there are keywords involved so the |
| 3138 |
parser needs to know where to stop scanning. It made no sense to be more clever |
| 3139 |
and introduce fuzziness (so there is no room for exposing in|-|depth \TEX\ |
| 3140 |
insight and expertise here). In case you wonder: the difference in performance |
| 3141 |
between the \ETEX\ expression mechanism and the more extended variant will |
| 3142 |
normally not be noticed, probably because they both use a different approach and |
| 3143 |
because the \ETEX\ variant also has been optimized. |
| 3144 |
|
| 3145 |
\stopnewprimitive |
| 3146 |
|
| 3147 |
\startnewprimitive[title={\prm {directlua}}] |
| 3148 |
|
| 3149 |
This is the low level interface to \LUA: |
| 3150 |
|
| 3151 |
\startbuffer |
| 3152 |
\directlua { tex.print ("Greetings from the lua end!") } |
| 3153 |
\stopbuffer |
| 3154 |
|
| 3155 |
Gives: \quotation {\inlinebuffer} as expected. In \LUA\ we have access to all |
| 3156 |
kind of internals of the engine. In \LUAMETATEX\ the interfaces have been |
| 3157 |
polished and extended compared to \LUATEX. Although many primitives and |
| 3158 |
mechanisms were added to the \TEX\ frontend, the main extension interface remains |
| 3159 |
\LUA. More information can be found in documents that come with \CONTEXT, in |
| 3160 |
presentations and in articles. |
| 3161 |
|
| 3162 |
\stopnewprimitive |
| 3163 |
|
| 3164 |
\startoldprimitive[title={\prm {discretionary}}] |
| 3165 |
|
| 3166 |
The three snippets given with this command determine the pre, post and replace |
| 3167 |
component of the injected discretionary node. The \type {penalty} keyword permits |
| 3168 |
setting a penalty with this node. The \type {postword} keyword indicates that |
| 3169 |
this discretionary starts a word, and \type {preword} ends it. With \type {break} |
| 3170 |
the line break algorithm will prefer a pre or post component over a replace, and |
| 3171 |
with \type {nobreak} replace will win over pre. With \type {class} you can set a |
| 3172 |
math class that will determine spacing and such for discretionaries used in math |
| 3173 |
mode. |
| 3174 |
|
| 3175 |
\stopoldprimitive |
| 3176 |
|
| 3177 |
\startnewprimitive[title={\prm {discretionaryoptions}}] |
| 3178 |
|
| 3179 |
Processing of discretionaries is controlled by this bitset: |
| 3180 |
|
| 3181 |
\getbuffer[engine:syntax:discoptioncodes] |
| 3182 |
|
| 3183 |
These can also be set on \prm {discretionary} using the \type {options} key. |
| 3184 |
|
| 3185 |
\stopnewprimitive |
| 3186 |
|
| 3187 |
\startoldprimitive[title={\prm {displayindent}}] |
| 3188 |
|
| 3189 |
The \prm {displaywidth}, \prm {displayindent} and \prm {predisplaysize} |
| 3190 |
parameters are set by the line break routine (but can be adapted by the user), so |
| 3191 |
that mid|-|par display formula can adapt itself to hanging indentation and par |
| 3192 |
shapes. I order to calculate thee values and adapt the line break state |
| 3193 |
afterwards such a display formula is assumed to occupy three lines, so basically |
| 3194 |
a rather compact formula. |
| 3195 |
|
| 3196 |
\stopoldprimitive |
| 3197 |
|
| 3198 |
\startoldprimitive[title={\prm {displaylimits}}] |
| 3199 |
|
| 3200 |
By default in math display mode limits are place on top while in inline mode they |
| 3201 |
are placed like scripts, after the operator. Placement can be forced with the |
| 3202 |
\prm {limits} and \prm {nolimits} modifiers (after the operator). Because there |
| 3203 |
can be multiple of these in a row there is \prm {displaylimits} that forces the |
| 3204 |
default placement, so effectively it acts here as a reset modifier. |
| 3205 |
|
| 3206 |
\stopoldprimitive |
| 3207 |
|
| 3208 |
\startoldprimitive[title={\prm {displaystyle}}] |
| 3209 |
|
| 3210 |
One of the main math styles; integer representation: \the\displaystyle. |
| 3211 |
|
| 3212 |
\stopoldprimitive |
| 3213 |
|
| 3214 |
\startoldprimitive[title={\prm {displaywidowpenalties}}] |
| 3215 |
|
| 3216 |
This is a math specific variant of \prm {widowpenalties}. |
| 3217 |
|
| 3218 |
\stopoldprimitive |
| 3219 |
|
| 3220 |
\startoldprimitive[title={\prm {displaywidowpenalty}}] |
| 3221 |
|
| 3222 |
This is a math specific variant of \prm {widowpenalty}. |
| 3223 |
|
| 3224 |
\stopoldprimitive |
| 3225 |
|
| 3226 |
\startoldprimitive[title={\prm {displaywidth}}] |
| 3227 |
|
| 3228 |
This parameter determines the width of the formula and normally defaults to the |
| 3229 |
\prm {hsize} unless we are in the middle of a paragraph in which case it is |
| 3230 |
compensated for hanging indentation or the par shape. |
| 3231 |
|
| 3232 |
\stopoldprimitive |
| 3233 |
|
| 3234 |
\startoldprimitive[title={\prm {divide}}] |
| 3235 |
|
| 3236 |
The \prm {divide} operation can be applied to integers, dimensions, float, |
| 3237 |
attribute and glue quantities. There are subtle rounding differences between |
| 3238 |
the divisions in expressions and \prm {divide}: |
| 3239 |
|
| 3240 |
\starttabulate |
| 3241 |
\NC \type {\scratchcounter1049 \numexpr\scratchcounter/ 10\relax} |
| 3242 |
\EQ \scratchcounter1049 \the\numexpr\scratchcounter/ 10\relax |
| 3243 |
\NC \NR |
| 3244 |
\NC \type {\scratchcounter1049 \numexpr\scratchcounter: 10\relax} |
| 3245 |
\EQ \scratchcounter1049 \the\numexpr\scratchcounter: 10\relax |
| 3246 |
\NC \NR |
| 3247 |
\NC \type {\scratchcounter1049 \divide\scratchcounter by 10} |
| 3248 |
\EQ \scratchcounter1049 \divide\scratchcounter by 10 |
| 3249 |
\the\scratchcounter |
| 3250 |
\NC \NR |
| 3251 |
\stoptabulate |
| 3252 |
|
| 3253 |
The \type {:} divider in \prm {dimexpr} is something that we introduced in |
| 3254 |
\LUATEX. |
| 3255 |
|
| 3256 |
\stopoldprimitive |
| 3257 |
|
| 3258 |
\startnewprimitive[title={\prm {divideby}}] |
| 3259 |
|
| 3260 |
This is slightly more efficient variant of \prm {divide} that doesn't look for |
| 3261 |
\type {by}. See previous section. |
| 3262 |
|
| 3263 |
\stopnewprimitive |
| 3264 |
|
| 3265 |
\startoldprimitive[title={\prm {doublehyphendemerits}}] |
| 3266 |
|
| 3267 |
This penalty will be added to the penalty assigned to a breakpoint that results |
| 3268 |
in two lines ending with a hyphen. |
| 3269 |
|
| 3270 |
\stopoldprimitive |
| 3271 |
|
| 3272 |
\startnewprimitive[title={\prm {doublepenaltymode}}] |
| 3273 |
|
| 3274 |
When set to one this parameter signals the backend to use the alternative (left |
| 3275 |
side) penalties of the pairs set on \prm {widowpenalties}, \prm {clubpenalties} |
| 3276 |
and \prm {brokenpenalties}. For more information on this you can consult manuals |
| 3277 |
(and articles) that come with \CONTEXT. |
| 3278 |
|
| 3279 |
\stopnewprimitive |
| 3280 |
|
| 3281 |
\startoldprimitive[title={\prm {dp}}] |
| 3282 |
|
| 3283 |
Returns the depth of the given box. |
| 3284 |
|
| 3285 |
\stopoldprimitive |
| 3286 |
|
| 3287 |
\startnewprimitive[title={\prm {dpack}}] |
| 3288 |
|
| 3289 |
This does what \prm {dbox} does but without callback overhead. |
| 3290 |
|
| 3291 |
\stopnewprimitive |
| 3292 |
|
| 3293 |
\startnewprimitive[title={\prm {dsplit}}] |
| 3294 |
|
| 3295 |
This is the dual baseline variant of \prm {vsplit} (see \prm {dbox} for what that |
| 3296 |
means). |
| 3297 |
|
| 3298 |
\stopnewprimitive |
| 3299 |
|
| 3300 |
\startoldprimitive[title={\prm {dump}}] |
| 3301 |
|
| 3302 |
This finishes an (ini) run and dumps a format (basically the current state of the |
| 3303 |
engine). |
| 3304 |
|
| 3305 |
\stopoldprimitive |
| 3306 |
|
| 3307 |
\startoldprimitive[title={\prm {edef}}] |
| 3308 |
|
| 3309 |
This is the expanded version of \prm {def}. |
| 3310 |
|
| 3311 |
\startbuffer |
| 3312 |
\def \foo{foo} \meaning\foo |
| 3313 |
\def \ofo{\foo\foo} \meaning\ofo |
| 3314 |
\edef\oof{\foo\foo} \meaning\oof |
| 3315 |
\stopbuffer |
| 3316 |
|
| 3317 |
\typebuffer |
| 3318 |
|
| 3319 |
Because \type {\foo} is unprotected it will expand inside the body definition: |
| 3320 |
|
| 3321 |
\startlines \tt |
| 3322 |
\getbuffer |
| 3323 |
\stoplines |
| 3324 |
|
| 3325 |
\stopoldprimitive |
| 3326 |
|
| 3327 |
\startnewprimitive[title={\prm {edefcsname}}] |
| 3328 |
|
| 3329 |
This is the companion of \prm {edef}: |
| 3330 |
|
| 3331 |
\starttyping |
| 3332 |
\expandafter\edef\csname MyMacro:1\endcsname{...} |
| 3333 |
\edefcsname MyMacro:1\endcsname{...} |
| 3334 |
\stoptyping |
| 3335 |
|
| 3336 |
\stopnewprimitive |
| 3337 |
|
| 3338 |
\startnewprimitive[title={\prm {edivide}}] |
| 3339 |
|
| 3340 |
When expressions were introduced the decision was made to round the divisions which is |
| 3341 |
incompatible with the way \prm {divide} works. The expression scanners in \LUAMETATEX\ |
| 3342 |
compensates that by providing a \type {:} for integer division. The \prm {edivide} does |
| 3343 |
the opposite: it rounds the way expressions do. |
| 3344 |
|
| 3345 |
\startbuffer |
| 3346 |
\the\dimexpr .4999pt : 2 \relax =.24994pt |
| 3347 |
\the\dimexpr .4999pt / 2 \relax =.24995pt |
| 3348 |
\scratchdimen.4999pt \divide \scratchdimen 2 \the\scratchdimen=.24994pt |
| 3349 |
\scratchdimen.4999pt \edivide\scratchdimen 2 \the\scratchdimen=.24995pt |
| 3350 |
|
| 3351 |
\the\numexpr 1001 : 2 \relax =500 |
| 3352 |
\the\numexpr 1001 / 2 \relax =501 |
| 3353 |
\scratchcounter1001 \divide \scratchcounter 2 \the\scratchcounter=500 |
| 3354 |
\scratchcounter1001 \edivide\scratchcounter 2 \the\scratchcounter=501 |
| 3355 |
\stopbuffer |
| 3356 |
|
| 3357 |
\typebuffer |
| 3358 |
|
| 3359 |
Keep in mind that with dimensions we have a fractional part so we actually |
| 3360 |
rounding applies to the fraction. For that reason we also provide \prm {rdivide}. |
| 3361 |
|
| 3362 |
\startlines |
| 3363 |
\getbuffer |
| 3364 |
\stoplines |
| 3365 |
|
| 3366 |
\stopnewprimitive |
| 3367 |
|
| 3368 |
\startnewprimitive[title={\prm {edivideby}}] |
| 3369 |
|
| 3370 |
This the \type {by}|-|less variant of \prm {edivide}. |
| 3371 |
|
| 3372 |
\stopnewprimitive |
| 3373 |
|
| 3374 |
\startnewprimitive[title={\prm {efcode}}] |
| 3375 |
|
| 3376 |
This primitive originates in \PDFTEX\ and can be used to set the expansion factor |
| 3377 |
of a glyph (characters). This primitive is obsolete because the values can be set |
| 3378 |
in the font specification that gets passed via \LUA\ to \TEX. Keep in mind that |
| 3379 |
setting font properties at the \TEX\ end is a global operation and can therefore |
| 3380 |
influence related fonts. In \LUAMETATEX\ the \prm {cf} code can be used to |
| 3381 |
specify the compression factor independent from the expansion factor. The |
| 3382 |
primitive takes three values: font, character code, and factor. |
| 3383 |
|
| 3384 |
\stopnewprimitive |
| 3385 |
|
| 3386 |
\startoldprimitive[title={\prm {else}}] |
| 3387 |
|
| 3388 |
This traditional primitive is part of the condition testing mechanism. When a |
| 3389 |
condition matches, \TEX\ will continue till it sees an \prm {else} or \prm |
| 3390 |
{or} or \prm {orelse} (to be discussed later). It will then do a fast skipping |
| 3391 |
pass till it sees an \prm {fi}. |
| 3392 |
|
| 3393 |
\stopoldprimitive |
| 3394 |
|
| 3395 |
\startoldprimitive[title={\prm {emergencyextrastretch}}] |
| 3396 |
|
| 3397 |
This is one of the extended parbuilder parameters. You can you it so temporary |
| 3398 |
increase the permitted stretch without knowing or messing with the normal value. |
| 3399 |
|
| 3400 |
\stopoldprimitive |
| 3401 |
|
| 3402 |
\startnewprimitive[title={\prm {emergencyleftskip}}] |
| 3403 |
|
| 3404 |
This is one of the extended parbuilder parameters (playground). It permits going |
| 3405 |
ragged left in case of a too bad result. |
| 3406 |
|
| 3407 |
\stopnewprimitive |
| 3408 |
|
| 3409 |
\startnewprimitive[title={\prm {emergencyrightskip}}] |
| 3410 |
|
| 3411 |
This is one of the extended parbuilder parameters (playground). It permits going |
| 3412 |
ragged right in case of a too bad result. |
| 3413 |
|
| 3414 |
\stopnewprimitive |
| 3415 |
|
| 3416 |
\startoldprimitive[title={\prm {emergencystretch}}] |
| 3417 |
|
| 3418 |
When set the par builder will run a third pass in order to fit the set criteria. |
| 3419 |
|
| 3420 |
\stopoldprimitive |
| 3421 |
|
| 3422 |
% \startnewprimitive[title={\prm {emptyparagraphmode}}] |
| 3423 |
% \stopnewprimitive |
| 3424 |
|
| 3425 |
\startoldprimitive[title={\prm {end}}] |
| 3426 |
|
| 3427 |
This ends a \TEX\ run, unless of course this primitive is redefined. |
| 3428 |
|
| 3429 |
\stopoldprimitive |
| 3430 |
|
| 3431 |
\startoldprimitive[title={\prm {endcsname}}] |
| 3432 |
|
| 3433 |
This primitive is used in combination with \prm {csname}, \prm {ifcsname} and |
| 3434 |
\prm {begincsname} where its end the scanning for the to be constructed control |
| 3435 |
sequence token. |
| 3436 |
|
| 3437 |
\stopoldprimitive |
| 3438 |
|
| 3439 |
\startoldprimitive[title={\prm {endgroup}}] |
| 3440 |
|
| 3441 |
This is the companion of the \prm {begingroup} primitive that opens a group. See |
| 3442 |
\prm {beginsimplegroup} for more info. |
| 3443 |
|
| 3444 |
\stopoldprimitive |
| 3445 |
|
| 3446 |
\startoldprimitive[title={\prm {endinput}}] |
| 3447 |
|
| 3448 |
The engine can be in different input modes: reading from file, reading from a |
| 3449 |
token list, expanding a macro, processing something that comes back from \LUA, |
| 3450 |
etc. This primitive quits reading from file: |
| 3451 |
|
| 3452 |
\startbuffer |
| 3453 |
this is seen |
| 3454 |
\endinput |
| 3455 |
here we're already quit |
| 3456 |
\stopbuffer |
| 3457 |
|
| 3458 |
\typebuffer |
| 3459 |
|
| 3460 |
There is a catch. This is what the above gives: |
| 3461 |
|
| 3462 |
\getbuffer |
| 3463 |
|
| 3464 |
but how about this: |
| 3465 |
|
| 3466 |
\startbuffer |
| 3467 |
this is seen |
| 3468 |
before \endinput after |
| 3469 |
here we're already quit |
| 3470 |
\stopbuffer |
| 3471 |
|
| 3472 |
\typebuffer |
| 3473 |
|
| 3474 |
Here we get: |
| 3475 |
|
| 3476 |
\getbuffer |
| 3477 |
|
| 3478 |
Because a token list is one line, the following works okay: |
| 3479 |
|
| 3480 |
\starttyping |
| 3481 |
\def\quitrun{\ifsomething \endinput \fi} |
| 3482 |
\stoptyping |
| 3483 |
|
| 3484 |
but in a file you'd have to do this when you quit in a conditional: |
| 3485 |
|
| 3486 |
\starttyping |
| 3487 |
\ifsomething |
| 3488 |
\expandafter \endinput |
| 3489 |
\fi |
| 3490 |
\stoptyping |
| 3491 |
|
| 3492 |
While the one|-|liner works as expected: |
| 3493 |
|
| 3494 |
\starttyping |
| 3495 |
\ifsomething \endinput \fi |
| 3496 |
\stoptyping |
| 3497 |
|
| 3498 |
\stopoldprimitive |
| 3499 |
|
| 3500 |
\startoldprimitive[title={\prm {endlinechar}}] |
| 3501 |
|
| 3502 |
This is an internal integer register. When set to positive value the character |
| 3503 |
with that code point will be appended to the line. The current value is \the |
| 3504 |
\endlinechar. Here is an example: |
| 3505 |
|
| 3506 |
\startbuffer |
| 3507 |
\endlinechar\hyphenasciicode |
| 3508 |
line 1 |
| 3509 |
line 2 |
| 3510 |
\stopbuffer |
| 3511 |
|
| 3512 |
\typebuffer |
| 3513 |
|
| 3514 |
\start \getbuffer \stop |
| 3515 |
|
| 3516 |
If the character is active, the property is honored and the command kicks in. The |
| 3517 |
maximum value is 127 (the maximum character code a single byte \UTF\ character |
| 3518 |
can carry.) |
| 3519 |
|
| 3520 |
\stopoldprimitive |
| 3521 |
|
| 3522 |
\startnewprimitive[title={\prm {endlocalcontrol}}] |
| 3523 |
|
| 3524 |
See \prm {beginlocalcontrol}. |
| 3525 |
|
| 3526 |
\stopnewprimitive |
| 3527 |
|
| 3528 |
\startnewprimitive[title={\prm {endmathgroup}}] |
| 3529 |
|
| 3530 |
This primitive is the counterpart of \prm {beginmathgroup}. |
| 3531 |
|
| 3532 |
\stopnewprimitive |
| 3533 |
|
| 3534 |
\startnewprimitive[title={\prm {endmvl}}] |
| 3535 |
|
| 3536 |
This ends \prm {beginmvl}. |
| 3537 |
|
| 3538 |
\stopnewprimitive |
| 3539 |
|
| 3540 |
\startnewprimitive[title={\prm {endsimplegroup}}] |
| 3541 |
|
| 3542 |
This one ends a simple group, see \prm {beginsimplegroup} for an explanation |
| 3543 |
about grouping primitives. |
| 3544 |
|
| 3545 |
\stopnewprimitive |
| 3546 |
|
| 3547 |
\startnewprimitive[title={\prm {enforced}}] |
| 3548 |
|
| 3549 |
The engine can be set up to prevent overloading of primitives and macros defined |
| 3550 |
as \prm {permanent} or \prm {immutable}. However, a macro package might want |
| 3551 |
to get around this in controlled situations, which is why we have a \prm |
| 3552 |
{enforced} prefix. This prefix in interpreted differently in so called \quote |
| 3553 |
{ini} mode when macro definitions can be dumped in the format. Internally they |
| 3554 |
get an \type {always} flag as indicator that in these places an overload is |
| 3555 |
possible. |
| 3556 |
|
| 3557 |
\starttyping |
| 3558 |
\permanent\def\foo{original} |
| 3559 |
|
| 3560 |
\def\oof {\def\foo{fails}} |
| 3561 |
\def\oof{\enforced\def\foo{succeeds}} |
| 3562 |
\stoptyping |
| 3563 |
|
| 3564 |
Of course this only has an effect when overload protection is enabled. |
| 3565 |
|
| 3566 |
\stopnewprimitive |
| 3567 |
|
| 3568 |
\startoldprimitive[title={\prm {eofinput}}] |
| 3569 |
|
| 3570 |
This is a variant on \prm {input} that takes a token list as first argument. That |
| 3571 |
list is expanded when the file ends. It has companion primitives \prm |
| 3572 |
{atendoffile} (single token) and \prm {atendoffiled} (multiple tokens). |
| 3573 |
|
| 3574 |
\stopoldprimitive |
| 3575 |
|
| 3576 |
\startoldprimitive[title={\prm {eqno}}] |
| 3577 |
|
| 3578 |
This primitive stores the (typeset) content (presumably a number) and when the |
| 3579 |
display formula is wrapped that number will end up right of the formula. |
| 3580 |
|
| 3581 |
\stopoldprimitive |
| 3582 |
|
| 3583 |
\startoldprimitive[title={\prm {errhelp}}] |
| 3584 |
|
| 3585 |
This is additional help information to \prm {errmessage} that triggers an error |
| 3586 |
and shows a message. |
| 3587 |
|
| 3588 |
\stopoldprimitive |
| 3589 |
|
| 3590 |
\startoldprimitive[title={\prm {errmessage}}] |
| 3591 |
|
| 3592 |
This primitive expects a token list and shows its expansion on the console |
| 3593 |
and|/|or in the log file, depending on how \TEX\ is configured. After that it |
| 3594 |
will enter the error state and either goes on or waits for input, again depending |
| 3595 |
on how \TEX\ is configured. For the record: we don't use this primitive in |
| 3596 |
\CONTEXT. |
| 3597 |
|
| 3598 |
\stopoldprimitive |
| 3599 |
|
| 3600 |
\startoldprimitive[title={\prm {errorcontextlines}}] |
| 3601 |
|
| 3602 |
This parameter determines the number on lines shown when an error is triggered. |
| 3603 |
|
| 3604 |
\stopoldprimitive |
| 3605 |
|
| 3606 |
\startoldprimitive[title={\prm {errorstopmode}}] |
| 3607 |
|
| 3608 |
This directive stops at every opportunity to interact. In \CONTEXT\ we overload |
| 3609 |
the actions in a callback and quit the run because we can assume that a |
| 3610 |
successful outcome is unlikely. |
| 3611 |
|
| 3612 |
\stopoldprimitive |
| 3613 |
|
| 3614 |
\startoldprimitive[title={\prm {escapechar}}] |
| 3615 |
|
| 3616 |
This internal integer has the code point of the character that get prepended to a |
| 3617 |
control sequence when it is serialized (for instance in tracing or messages). |
| 3618 |
|
| 3619 |
\stopoldprimitive |
| 3620 |
|
| 3621 |
\startnewprimitive[title={\prm {etexexprmode}}] |
| 3622 |
|
| 3623 |
When set to a positive value the \type {:} and \type {;} operators are not |
| 3624 |
interpreted. In \CONTEXT\ we keep this value zero! This flag was added in 2024 |
| 3625 |
for \LATEX\ where in places \type {;} is used as signal to end an expression |
| 3626 |
instead of \type {\relax}). Because one never knows what users expect this flag |
| 3627 |
disables both. |
| 3628 |
|
| 3629 |
\stopnewprimitive |
| 3630 |
|
| 3631 |
\startnewprimitive[title={\prm {etoks}}] |
| 3632 |
|
| 3633 |
This assigns an expanded token list to a token register: |
| 3634 |
|
| 3635 |
\starttyping |
| 3636 |
\def\temp{less stuff} |
| 3637 |
\etoks\scratchtoks{a bit \temp} |
| 3638 |
\stoptyping |
| 3639 |
|
| 3640 |
The orginal value of the register is lost. |
| 3641 |
|
| 3642 |
\stopnewprimitive |
| 3643 |
|
| 3644 |
\startnewprimitive[title={\prm {etoksapp}}] |
| 3645 |
|
| 3646 |
A variant of \prm {toksapp} is the following: it expands the to be appended |
| 3647 |
content. |
| 3648 |
|
| 3649 |
\starttyping |
| 3650 |
\def\temp{more stuff} |
| 3651 |
\etoksapp\scratchtoks{some \temp} |
| 3652 |
\stoptyping |
| 3653 |
|
| 3654 |
\stopnewprimitive |
| 3655 |
|
| 3656 |
\startnewprimitive[title={\prm {etokspre}}] |
| 3657 |
|
| 3658 |
A variant of \prm {tokspre} is the following: it expands the to be prepended |
| 3659 |
content. |
| 3660 |
|
| 3661 |
\starttyping |
| 3662 |
\def\temp{less stuff} |
| 3663 |
\etokspre\scratchtoks{a bit \temp} |
| 3664 |
\stoptyping |
| 3665 |
|
| 3666 |
\stopnewprimitive |
| 3667 |
|
| 3668 |
\startnewprimitive[title={\prm {eufactor}}] |
| 3669 |
|
| 3670 |
When we introduced the \type {es} (2.5cm) and \type {ts} (2.5mm) units as metric |
| 3671 |
variants of the \type {in} we also added the \type {eu} factor. One \type {eu} |
| 3672 |
equals one tenth of a \type {es} times the \prm {eufactor}. The \type {ts} is a |
| 3673 |
convenient offset in test files, the \type {es} a convenient ones for layouts and |
| 3674 |
image dimensions and the \type {eu} permits definitions that scale nicely without |
| 3675 |
the need for dimensions. They also were a prelude to what later became possible |
| 3676 |
with \prm {associateunit}. |
| 3677 |
|
| 3678 |
\stopnewprimitive |
| 3679 |
|
| 3680 |
\startnewprimitive[title={\prm {everybeforepar}}] |
| 3681 |
|
| 3682 |
This token register is expanded before a paragraph is triggered. The reason for |
| 3683 |
triggering is available in \prm {lastpartrigger}. |
| 3684 |
|
| 3685 |
\stopnewprimitive |
| 3686 |
|
| 3687 |
\startoldprimitive[title={\prm {everycr}}] |
| 3688 |
|
| 3689 |
This token list gets expanded when a row ends in an alignment. Normally it will |
| 3690 |
use \prm {noalign} as wrapper |
| 3691 |
|
| 3692 |
\startbuffer |
| 3693 |
{\everycr{\noalign{H}} \halign{#\cr test\cr test\cr}} |
| 3694 |
{\everycr{\noalign{V}} \hsize 4cm \valign{#\cr test\cr test\cr}} |
| 3695 |
\stopbuffer |
| 3696 |
|
| 3697 |
\typebuffer |
| 3698 |
|
| 3699 |
Watch how the \prm {cr} ending the preamble also get this treatment: |
| 3700 |
|
| 3701 |
\getbuffer |
| 3702 |
|
| 3703 |
\stopoldprimitive |
| 3704 |
|
| 3705 |
\startoldprimitive[title={\prm {everydisplay}}] |
| 3706 |
|
| 3707 |
This token list gets expanded every time we enter display mode. It is a companion |
| 3708 |
of \prm {everymath}. |
| 3709 |
|
| 3710 |
\stopoldprimitive |
| 3711 |
|
| 3712 |
\startoldprimitive[title={\prm {everyeof}}] |
| 3713 |
|
| 3714 |
The content of this token list is injected when a file ends but it can only be |
| 3715 |
used reliably when one is really sure that no other file is loaded in the |
| 3716 |
process. So in the end it is of no real use in a more complex macro package. |
| 3717 |
|
| 3718 |
\stopoldprimitive |
| 3719 |
|
| 3720 |
\startoldprimitive[title={\prm {everyhbox}}] |
| 3721 |
|
| 3722 |
This token list behaves similar to \prm {everyvbox} so look there for an |
| 3723 |
explanation. |
| 3724 |
|
| 3725 |
\stopoldprimitive |
| 3726 |
|
| 3727 |
\startoldprimitive[title={\prm {everyjob}}] |
| 3728 |
|
| 3729 |
This token list register is injected at the start of a job, or more precisely, |
| 3730 |
just before the main control loop starts. |
| 3731 |
|
| 3732 |
\stopoldprimitive |
| 3733 |
|
| 3734 |
\startoldprimitive[title={\prm {everymath}}] |
| 3735 |
|
| 3736 |
Often math needs to be set up independent from the running text and this token |
| 3737 |
list can be used to do that. There is also \prm {everydisplay}. |
| 3738 |
|
| 3739 |
\stopoldprimitive |
| 3740 |
|
| 3741 |
\startnewprimitive[title={\prm {everymathatom}}] |
| 3742 |
|
| 3743 |
When a math atom is seen this tokenlist is expanded before content is processed |
| 3744 |
inside the atom body. It is basically a math companion for \prm {everyhbox} and |
| 3745 |
friends and it is therefore probably just as useless. The next example shows how |
| 3746 |
it works: |
| 3747 |
|
| 3748 |
\startbuffer |
| 3749 |
\everymathatom |
| 3750 |
{\begingroup |
| 3751 |
\scratchcounter\lastatomclass |
| 3752 |
\everymathatom{}% |
| 3753 |
\mathghost{\hbox to 0pt yoffset -1ex{\smallinfofont \setstrut\strut \the\scratchcounter\hss}}% |
| 3754 |
\endgroup} |
| 3755 |
|
| 3756 |
$ a = \mathatom class 4 {b} + \mathatom class 5 {c} $ |
| 3757 |
\stopbuffer |
| 3758 |
|
| 3759 |
\typebuffer |
| 3760 |
|
| 3761 |
We get a formula with open- and close atom spacing applied to~$b$ and~$c$: |
| 3762 |
|
| 3763 |
{\getbuffer} |
| 3764 |
|
| 3765 |
This example shows bit of all: we want the number to be invisible to the math |
| 3766 |
machinery so we ghost it. So, we need to make sure we don't get recursion due to |
| 3767 |
nested injection and expansion of \prm {everymathatom} and of course we need to |
| 3768 |
store the number. The \prm {lastatomclass} state variable is only meaningful |
| 3769 |
inside an explicit atom wrapper like \prm {mathatom} and \prm {mathatom}. |
| 3770 |
|
| 3771 |
\stopnewprimitive |
| 3772 |
|
| 3773 |
\startoldprimitive[title={\prm {everypar}}] |
| 3774 |
|
| 3775 |
When a paragraph starts this tokenlist is expanded before content is processed. |
| 3776 |
|
| 3777 |
\stopoldprimitive |
| 3778 |
|
| 3779 |
\startnewprimitive[title={\prm {everytab}}] |
| 3780 |
|
| 3781 |
This token list gets expanded every time we start a table cell in \prm {halign} or |
| 3782 |
\prm {valign}. |
| 3783 |
|
| 3784 |
\stopnewprimitive |
| 3785 |
|
| 3786 |
\startoldprimitive[title={\prm {everyvbox}}] |
| 3787 |
|
| 3788 |
This token list gets expanded every time we start a vertical box. Like \prm |
| 3789 |
{everyhbox} this is not that useful unless you are certain that there are no |
| 3790 |
nested boxes that don't need this treatment. Of course you can wipe this register |
| 3791 |
in this expansion, like: |
| 3792 |
|
| 3793 |
\starttyping |
| 3794 |
\everyvbox{\kern10pt\everyvbox{}} |
| 3795 |
\stoptyping |
| 3796 |
|
| 3797 |
\stopoldprimitive |
| 3798 |
|
| 3799 |
% \startnewprimitive[title={\prm {exapostrophechar}}] |
| 3800 |
% \stopnewprimitive |
| 3801 |
|
| 3802 |
\startnewprimitive[title={\prm {exceptionpenalty}}] |
| 3803 |
|
| 3804 |
In exceptions we can indicate a penalty by \type {[digit]} in which case a |
| 3805 |
penalty is injected set by this primitive, multiplied by the digit. |
| 3806 |
|
| 3807 |
\stopnewprimitive |
| 3808 |
|
| 3809 |
\startoldprimitive[title={\prm {exhyphenchar}}] |
| 3810 |
|
| 3811 |
The character that is used as pre component of the related discretionary. |
| 3812 |
|
| 3813 |
\stopoldprimitive |
| 3814 |
|
| 3815 |
\startoldprimitive[title={\prm {exhyphenpenalty}}] |
| 3816 |
|
| 3817 |
The penalty injected after \type {-} or \type {\-} unless \prm {hyphenationmode} |
| 3818 |
is set to force the dedisated penalties. |
| 3819 |
|
| 3820 |
\stopoldprimitive |
| 3821 |
|
| 3822 |
\startnewprimitive[title={\prm {expand}}] |
| 3823 |
|
| 3824 |
Beware, this is not a prefix but a directive to ignore the protected characters of |
| 3825 |
the following macro. |
| 3826 |
|
| 3827 |
\startbuffer |
| 3828 |
\protected \def \testa{\the\scratchcounter} |
| 3829 |
\edef\testb{\testa} |
| 3830 |
\edef\testc{\expand\testa} |
| 3831 |
\stopbuffer |
| 3832 |
|
| 3833 |
\typebuffer |
| 3834 |
|
| 3835 |
The meaning of the three macros is: |
| 3836 |
|
| 3837 |
\startlines \getbuffer \tttf |
| 3838 |
\meaningfull\testa |
| 3839 |
\meaningfull\testb |
| 3840 |
\meaningfull\testc |
| 3841 |
\stoplines |
| 3842 |
|
| 3843 |
\stopnewprimitive |
| 3844 |
|
| 3845 |
\startnewprimitive[title={\prm {expandactive}}] |
| 3846 |
|
| 3847 |
This a bit of an outlier and mostly there for completeness. |
| 3848 |
|
| 3849 |
\startbuffer |
| 3850 |
\meaningasis~ |
| 3851 |
\edef\foo{~} \meaningasis\foo |
| 3852 |
\edef\foo{\expandactive~} \meaningasis\foo |
| 3853 |
\stopbuffer |
| 3854 |
|
| 3855 |
\typebuffer |
| 3856 |
|
| 3857 |
There seems to be no difference but the real meaning of the first \type {\foo} is |
| 3858 |
\quote {active character 126} while the second \type {\foo} \quote {protected |
| 3859 |
call ~} is. |
| 3860 |
|
| 3861 |
% \showluatokens\foo |
| 3862 |
|
| 3863 |
\startlines |
| 3864 |
\getbuffer |
| 3865 |
\stoplines |
| 3866 |
|
| 3867 |
Of course the definition of the active tilde is \CONTEXT\ specific and situation |
| 3868 |
dependent. |
| 3869 |
|
| 3870 |
\stopnewprimitive |
| 3871 |
|
| 3872 |
\startoldprimitive[title={\prm {expandafter}}] |
| 3873 |
|
| 3874 |
This original \TEX\ primitive stores the next token, does a one level expansion |
| 3875 |
of what follows it, which actually can be an not expandable token, and |
| 3876 |
reinjects the stored token in the input. Like: |
| 3877 |
|
| 3878 |
\starttyping |
| 3879 |
\expandafter\let\csname my weird macro name\endcsname{m w m n} |
| 3880 |
\stoptyping |
| 3881 |
|
| 3882 |
Without \prm {expandafter} the \prm {csname} primitive would have been let to |
| 3883 |
the left brace (effectively then a begin group). Actually in this particular case |
| 3884 |
the control sequence with the weird name is injected and when it didn't yet exist |
| 3885 |
it will get the meaning \prm {relax} so we sort of have two assignments in a |
| 3886 |
row then. |
| 3887 |
|
| 3888 |
\stopoldprimitive |
| 3889 |
|
| 3890 |
\startnewprimitive[title={\prm {expandafterpars}}] |
| 3891 |
|
| 3892 |
Here is another gobbler: the next token is reinjected after following spaces |
| 3893 |
and par tokens have been read. So: |
| 3894 |
|
| 3895 |
\startbuffer |
| 3896 |
[\expandafterpars 1 2] |
| 3897 |
[\expandafterpars 3 |
| 3898 |
4] |
| 3899 |
[\expandafterpars 5 |
| 3900 |
|
| 3901 |
6] |
| 3902 |
\stopbuffer |
| 3903 |
|
| 3904 |
\typebuffer |
| 3905 |
|
| 3906 |
gives us: \inlinebuffer, because empty lines are like \prm {par} and therefore |
| 3907 |
ignored. |
| 3908 |
|
| 3909 |
\stopnewprimitive |
| 3910 |
|
| 3911 |
\startnewprimitive[title={\prm {expandafterspaces}}] |
| 3912 |
|
| 3913 |
This is a gobbler: the next token is reinjected after following spaces have been |
| 3914 |
read. Here is a simple example: |
| 3915 |
|
| 3916 |
\startbuffer |
| 3917 |
[\expandafterspaces 1 2] |
| 3918 |
[\expandafterspaces 3 |
| 3919 |
4] |
| 3920 |
[\expandafterspaces 5 |
| 3921 |
|
| 3922 |
6] |
| 3923 |
\stopbuffer |
| 3924 |
|
| 3925 |
\typebuffer |
| 3926 |
|
| 3927 |
We get this typeset: \inlinebuffer, because a newline normally is configured to be |
| 3928 |
a space (and leading spaces in a line are normally being ingored anyway). |
| 3929 |
|
| 3930 |
\stopnewprimitive |
| 3931 |
|
| 3932 |
\startnewprimitive[title={\prm {expandcstoken}}] |
| 3933 |
|
| 3934 |
The rationale behind this primitive is that when we \prm {let} a single token |
| 3935 |
like a character it is hard to compare that with something similar, stored in a |
| 3936 |
macro. This primitive pushes back a single token alias created by \prm {let} |
| 3937 |
into the input. |
| 3938 |
|
| 3939 |
\startbuffer |
| 3940 |
\let\tempA + \meaning\tempA |
| 3941 |
|
| 3942 |
\let\tempB X \meaning\tempB \crlf |
| 3943 |
\let\tempC $ \meaning\tempC \par |
| 3944 |
|
| 3945 |
\edef\temp {\tempA} \doifelse{\temp}{+}{Y}{N} \meaning\temp \crlf |
| 3946 |
\edef\temp {\tempB} \doifelse{\temp}{X}{Y}{N} \meaning\temp \crlf |
| 3947 |
\edef\temp {\tempC} \doifelse{\temp}{X}{Y}{N} \meaning\temp \par |
| 3948 |
|
| 3949 |
\edef\temp{\expandcstoken\tempA} \doifelse{\temp}{+}{Y}{N} \meaning\temp \crlf |
| 3950 |
\edef\temp{\expandcstoken\tempB} \doifelse{\temp}{X}{Y}{N} \meaning\temp \crlf |
| 3951 |
\edef\temp{\expandcstoken\tempC} \doifelse{\temp}{$}{Y}{N} \meaning\temp \par |
| 3952 |
|
| 3953 |
\doifelse{\expandcstoken\tempA}{+}{Y}{N} |
| 3954 |
\doifelse{\expandcstoken\tempB}{X}{Y}{N} |
| 3955 |
\doifelse{\expandcstoken\tempC}{$}{Y}{N} \par |
| 3956 |
\stopbuffer |
| 3957 |
|
| 3958 |
\typebuffer |
| 3959 |
|
| 3960 |
The meaning of the \prm {let} macros shows that we have a shortcut to a |
| 3961 |
character with (in this case) catcode letter, other (here \quote {other |
| 3962 |
character} gets abbreviated to \quote {character}), math shift etc. |
| 3963 |
|
| 3964 |
\start \tttf \getbuffer \stop |
| 3965 |
|
| 3966 |
Here we use the \CONTEXT\ macro \type {\doifelse} which can be implemented in |
| 3967 |
different ways, but the only property relevant to the user is that the expanded |
| 3968 |
content of the two arguments is compared. |
| 3969 |
|
| 3970 |
\stopnewprimitive |
| 3971 |
|
| 3972 |
\startnewprimitive[title={\prm {expanded}}] |
| 3973 |
|
| 3974 |
This primitive complements the two expansion related primitives mentioned in the |
| 3975 |
previous two sections. This time the content will be expanded and then pushed |
| 3976 |
back into the input. Protected macros will not be expanded, so you can use this |
| 3977 |
primitive to expand the arguments in a call. |
| 3978 |
|
| 3979 |
% In \CONTEXT\ you need to use \type {\normalexpanded} because we already had a |
| 3980 |
% macro with that name. We give some examples: |
| 3981 |
|
| 3982 |
% \startbuffer |
| 3983 |
% \def\A{!} |
| 3984 |
% \def\B#1{\string#1} \B{\A} |
| 3985 |
% \def\B#1{\string#1} \normalexpanded{\noexpand\B{\A}} |
| 3986 |
% \protected\def\B#1{\string#1} \B{\A} |
| 3987 |
% \stopbuffer |
| 3988 |
|
| 3989 |
\startbuffer |
| 3990 |
\def\A{!} |
| 3991 |
\def\B#1{\string#1} \B{\A} |
| 3992 |
\def\B#1{\string#1} \expanded{\noexpand\B{\A}} |
| 3993 |
\protected\def\B#1{\string#1} \B{\A} |
| 3994 |
\stopbuffer |
| 3995 |
|
| 3996 |
\typebuffer \startlines\getbuffer\stoplines |
| 3997 |
|
| 3998 |
\stopnewprimitive |
| 3999 |
|
| 4000 |
\startnewprimitive[title={\prm {expandedafter}}] |
| 4001 |
|
| 4002 |
The following two lines are equivalent: |
| 4003 |
|
| 4004 |
\startbuffer |
| 4005 |
\def\foo{123} |
| 4006 |
\expandafter[\expandafter[\expandafter\secondofthreearguments\foo]] |
| 4007 |
\expandedafter{[[\secondofthreearguments}\foo]] |
| 4008 |
\stopbuffer |
| 4009 |
|
| 4010 |
\typebuffer |
| 4011 |
|
| 4012 |
In \CONTEXT\ \MKIV\ the number of times that one has multiple \prm {expandafter}s |
| 4013 |
is much larger than in \CONTEXT\ \LMTX\ thanks to some of the new features in |
| 4014 |
\LUAMETATEX, and this primitive is not really used yet in the core code. |
| 4015 |
|
| 4016 |
\startlines\getbuffer\stoplines |
| 4017 |
|
| 4018 |
\stopnewprimitive |
| 4019 |
|
| 4020 |
\startnewprimitive[title={\prm {expandeddetokenize}}] |
| 4021 |
|
| 4022 |
This is a companion to \prm {detokenize} that expands its argument: |
| 4023 |
|
| 4024 |
\startbuffer |
| 4025 |
\def\foo{12#H3} |
| 4026 |
\def\oof{\foo} |
| 4027 |
\detokenize {\foo} \detokenize {\oof} |
| 4028 |
\expandeddetokenize{\foo} \expandeddetokenize{\oof} |
| 4029 |
\edef\ofo{\expandeddetokenize{\foo}} \meaningless\ofo |
| 4030 |
\edef\ofo{\expandeddetokenize{\oof}} \meaningless\ofo |
| 4031 |
\stopbuffer |
| 4032 |
|
| 4033 |
\typebuffer |
| 4034 |
|
| 4035 |
This is a bit more convenient than |
| 4036 |
|
| 4037 |
% \starttyping |
| 4038 |
% \detokenize \expandafter {\normalexpanded {\foo}} |
| 4039 |
% \stoptyping |
| 4040 |
|
| 4041 |
\starttyping |
| 4042 |
\detokenize \expandafter {\expanded {\foo}} |
| 4043 |
\stoptyping |
| 4044 |
|
| 4045 |
kind of solutions. We get: |
| 4046 |
|
| 4047 |
\startlines |
| 4048 |
\getbuffer |
| 4049 |
\stoplines |
| 4050 |
|
| 4051 |
\stopnewprimitive |
| 4052 |
|
| 4053 |
\startnewprimitive[title={\prm {expandedendless}}] |
| 4054 |
|
| 4055 |
This one loops forever but because the loop counter is not set you need to find a |
| 4056 |
way to quit it. |
| 4057 |
|
| 4058 |
\stopnewprimitive |
| 4059 |
|
| 4060 |
\startnewprimitive[title={\prm {expandedloop}}] |
| 4061 |
|
| 4062 |
This variant of the previously introduced \prm {localcontrolledloop} doesn't |
| 4063 |
enter a local branch but immediately does its work. This means that it can be |
| 4064 |
used inside an expansion context like \prm {edef}. |
| 4065 |
|
| 4066 |
\startbuffer |
| 4067 |
\edef\whatever |
| 4068 |
{\expandedloop 1 10 1 |
| 4069 |
{\scratchcounter=\the\currentloopiterator\relax}} |
| 4070 |
|
| 4071 |
\meaningasis\whatever |
| 4072 |
\stopbuffer |
| 4073 |
|
| 4074 |
\typebuffer |
| 4075 |
|
| 4076 |
\start \veryraggedright \tt\tfx \getbuffer \stop \blank |
| 4077 |
|
| 4078 |
\stopnewprimitive |
| 4079 |
|
| 4080 |
\startnewprimitive[title={\prm {expandedrepeat}}] |
| 4081 |
|
| 4082 |
This one takes one instead of three arguments which is sometimes more |
| 4083 |
convenient. |
| 4084 |
|
| 4085 |
\stopnewprimitive |
| 4086 |
|
| 4087 |
\startnewprimitive[title={\prm {expandparameter}}] |
| 4088 |
|
| 4089 |
This primitive is a predecessor of \prm {parameterdef} so we stick to a simple |
| 4090 |
example. |
| 4091 |
|
| 4092 |
\startbuffer |
| 4093 |
\def\foo#1#2% |
| 4094 |
{\integerdef\MyIndexOne\parameterindex\plusone % 1 |
| 4095 |
\integerdef\MyIndexTwo\parameterindex\plustwo % 2 |
| 4096 |
\oof{P}\oof{Q}\oof{R}\norelax} |
| 4097 |
|
| 4098 |
\def\oof#1% |
| 4099 |
{<1:\expandparameter\MyIndexOne><1:\expandparameter\MyIndexOne>% |
| 4100 |
#1% |
| 4101 |
<2:\expandparameter\MyIndexTwo><2:\expandparameter\MyIndexTwo>} |
| 4102 |
|
| 4103 |
\foo{A}{B} |
| 4104 |
\stopbuffer |
| 4105 |
|
| 4106 |
\typebuffer |
| 4107 |
|
| 4108 |
In principle the whole parameter stack can be accessed but often |
| 4109 |
one never knows if a specific macro is called nested. The original |
| 4110 |
idea behind this primitive was tracing but it can also be used to |
| 4111 |
avoid passing parameters along a chain of calls. |
| 4112 |
|
| 4113 |
\getbuffer |
| 4114 |
|
| 4115 |
\stopnewprimitive |
| 4116 |
|
| 4117 |
\startnewprimitive[title={\prm {expandtoken}}] |
| 4118 |
|
| 4119 |
This primitive creates a token with a specific combination of catcode and |
| 4120 |
character code. Because it assumes some knowledge of \TEX\ we can show it |
| 4121 |
using some \prm {expandafter} magic: |
| 4122 |
|
| 4123 |
\startbuffer |
| 4124 |
\expandafter\let\expandafter\temp\expandtoken 11 `X \meaning\temp |
| 4125 |
\expandafter\let\expandafter\temp\expandtoken 12 `X \meaning\temp |
| 4126 |
\stopbuffer |
| 4127 |
|
| 4128 |
\typebuffer |
| 4129 |
|
| 4130 |
The meanings are: |
| 4131 |
|
| 4132 |
\startlines \tttf \getbuffer \stoplines |
| 4133 |
|
| 4134 |
Using other catcodes is possible but the results of injecting them into the input |
| 4135 |
directly (or here by injecting \type {\temp}) can be unexpected because of what |
| 4136 |
\TEX\ expects. You can get messages you normally won't get, for instance about |
| 4137 |
unexpected alignment interference, which is a side effect of \TEX\ using some |
| 4138 |
catcode|/|character combinations as signals and there is no reason to change |
| 4139 |
those internals. That said: |
| 4140 |
|
| 4141 |
\startbuffer |
| 4142 |
\xdef\tempA{\expandtoken 9 `X} \meaning\tempA |
| 4143 |
\xdef\tempB{\expandtoken 10 `X} \meaning\tempB |
| 4144 |
\xdef\tempC{\expandtoken 11 `X} \meaning\tempC |
| 4145 |
\xdef\tempD{\expandtoken 12 `X} \meaning\tempD |
| 4146 |
\stopbuffer |
| 4147 |
|
| 4148 |
\typebuffer |
| 4149 |
|
| 4150 |
are all valid and from the meaning you cannot really deduce what's in there: |
| 4151 |
|
| 4152 |
\startlines \tttf \getbuffer \stoplines % grouped therefore xdef |
| 4153 |
|
| 4154 |
But you can be assured that: |
| 4155 |
|
| 4156 |
\startbuffer |
| 4157 |
[AB: \ifx\tempA\tempB Y\else N\fi] |
| 4158 |
[AC: \ifx\tempA\tempC Y\else N\fi] |
| 4159 |
[AD: \ifx\tempA\tempD Y\else N\fi] |
| 4160 |
[BC: \ifx\tempB\tempC Y\else N\fi] |
| 4161 |
[BD: \ifx\tempB\tempD Y\else N\fi] |
| 4162 |
[CD: \ifx\tempC\tempD Y\else N\fi] |
| 4163 |
\stopbuffer |
| 4164 |
|
| 4165 |
\typebuffer |
| 4166 |
|
| 4167 |
makes clear that they're different: \inlinebuffer, and in case you wonder, the |
| 4168 |
characters with catcode 10 are spaces, while those with code 9 are ignored. |
| 4169 |
|
| 4170 |
\stopnewprimitive |
| 4171 |
|
| 4172 |
\startnewprimitive[title={\prm {expandtoks}}] |
| 4173 |
|
| 4174 |
This is a more efficient equivalent of \prm {the} applied to a token register, |
| 4175 |
so: |
| 4176 |
|
| 4177 |
\startbuffer |
| 4178 |
\scratchtoks{just some tokens} |
| 4179 |
\edef\TestA{[\the \scratchtoks]} |
| 4180 |
\edef\TestB{[\expandtoks\scratchtoks]} |
| 4181 |
[\the \scratchtoks] [\TestA] \meaning\TestA |
| 4182 |
[\expandtoks\scratchtoks] [\TestB] \meaning\TestB |
| 4183 |
\stopbuffer |
| 4184 |
|
| 4185 |
\typebuffer |
| 4186 |
|
| 4187 |
does the expected: |
| 4188 |
|
| 4189 |
\startlines |
| 4190 |
\getbuffer |
| 4191 |
\stoplines |
| 4192 |
|
| 4193 |
The \prm {expandtoken} primitive avoid a copy into the input when there is no |
| 4194 |
need for it. |
| 4195 |
|
| 4196 |
\stopnewprimitive |
| 4197 |
|
| 4198 |
\startnewprimitive[title={\prm {explicitdiscretionary}}] |
| 4199 |
|
| 4200 |
This is the verbose alias for one of \TEX's single character control sequences: |
| 4201 |
\type {\-}. |
| 4202 |
|
| 4203 |
\stopnewprimitive |
| 4204 |
|
| 4205 |
\startnewprimitive[title={\prm {explicithyphenpenalty}}] |
| 4206 |
|
| 4207 |
The penalty injected after an automatic discretionary \type {\-}, when \prm |
| 4208 |
{hyphenationmode} enables this. |
| 4209 |
|
| 4210 |
\stopnewprimitive |
| 4211 |
|
| 4212 |
\startnewprimitive[title={\prm {explicititaliccorrection}}] |
| 4213 |
|
| 4214 |
This is the verbose alias for one of \TEX's single character control sequences: |
| 4215 |
\type {\/}. Italic correction is a character property specific to \TEX\ and the |
| 4216 |
concept is not present in modern font technologies. There is a callback that |
| 4217 |
hooks into this command so that a macro package can provide its own solution |
| 4218 |
to this (or alternatively it can assign values to the italic correction field. |
| 4219 |
|
| 4220 |
\stopnewprimitive |
| 4221 |
|
| 4222 |
\startnewprimitive[title={\prm {explicitspace}}] |
| 4223 |
|
| 4224 |
This is the verbose alias for one of \TEX's single character control sequences: |
| 4225 |
\type {\ }. A space is inserted with properties according the space related |
| 4226 |
variables. There is look|-|back involved in order to deal with space factors. |
| 4227 |
|
| 4228 |
When \prm {nospaces} is set to~1 no spaces are inserted, when its value is~2 a |
| 4229 |
zero space is inserted. |
| 4230 |
|
| 4231 |
\stopnewprimitive |
| 4232 |
|
| 4233 |
\startoldprimitive[title={\prm {fam}}] |
| 4234 |
|
| 4235 |
In a numeric context it returns the current family number, otherwise it sets the |
| 4236 |
given family. The number of families in a traditional engine is 16, in \LUATEX\ |
| 4237 |
it is 256 and in \LUAMETATEX\ we have at most \cldcontext {tex . magicconstants . |
| 4238 |
max_n_of_math_families} families. A future version can lower that number when we |
| 4239 |
need more classes. |
| 4240 |
|
| 4241 |
\stopoldprimitive |
| 4242 |
|
| 4243 |
\startoldprimitive[title={\prm {fi}}] |
| 4244 |
|
| 4245 |
This traditional primitive is part of the condition testing mechanism and ends a |
| 4246 |
test. So, we have: |
| 4247 |
|
| 4248 |
\starttyping |
| 4249 |
\ifsomething ... \else ... \fi |
| 4250 |
\ifsomething ... \or ... \or ... \else ... \fi |
| 4251 |
\ifsomething ... \orelse \ifsometing ... \else ... \fi |
| 4252 |
\ifsomething ... \or ... \orelse \ifsometing ... \else ... \fi |
| 4253 |
\stoptyping |
| 4254 |
|
| 4255 |
The \prm {orelse} is new in \LUAMETATEX\ and a continuation like we find in |
| 4256 |
other programming languages (see later section). |
| 4257 |
|
| 4258 |
\stopoldprimitive |
| 4259 |
|
| 4260 |
\startoldprimitive[title={\prm {finalhyphendemerits}}] |
| 4261 |
|
| 4262 |
This penalty will be added to the penalty assigned to a breakpoint when that |
| 4263 |
break results in a pre|-|last line ending with a hyphen. |
| 4264 |
|
| 4265 |
\stopoldprimitive |
| 4266 |
|
| 4267 |
\startoldprimitive[title={\prm {firstmark}}][obsolete=yes] |
| 4268 |
|
| 4269 |
This is a reference to the first mark on the (split off) page, it gives back |
| 4270 |
tokens. |
| 4271 |
|
| 4272 |
\stopoldprimitive |
| 4273 |
|
| 4274 |
\startoldprimitive[title={\prm {firstmarks}}] |
| 4275 |
|
| 4276 |
This is a reference to the first mark with the given id (a number) on the (split |
| 4277 |
off) page, it gives back tokens. |
| 4278 |
|
| 4279 |
\stopoldprimitive |
| 4280 |
|
| 4281 |
\startnewprimitive[title={\prm {firstvalidlanguage}}] |
| 4282 |
|
| 4283 |
Language id's start at zero, which makes it the first valid language. You can set |
| 4284 |
this parameter to indicate the first language id that is actually a language. The |
| 4285 |
current value is \the \firstvalidlanguage, so lower values will not trigger |
| 4286 |
hyphenation. |
| 4287 |
|
| 4288 |
\stopnewprimitive |
| 4289 |
|
| 4290 |
\startnewprimitive[title={\prm {fitnessclasses}}] |
| 4291 |
|
| 4292 |
We can have more fitness classes than traditional \TEX\ that has \quote {very |
| 4293 |
loose}, \quote {loose}, \quote {decent} and \quote {tight}. In \CONTEXT\ we have |
| 4294 |
\quote {veryloose}, \quote {loose}, \quote {almostloose}, \quote {barelyloose}, |
| 4295 |
\quote {decent}, \quote {barelytight}, \quote {almosttight}, \quote {tight} and |
| 4296 |
\quote {verytight}. Although we can go up to 31 this is already more than enough. |
| 4297 |
The default is the same as in regular \TEX. |
| 4298 |
|
| 4299 |
The \prm {fitnessclasses} can be used to set the criteria and like other |
| 4300 |
specification primitives (like \prm {parshape} and \prm {widowpenalties}, it |
| 4301 |
expects a count. With \prm {adjacentdemerits} one can set the demerits that are |
| 4302 |
added depending on the distance between classes (in traditional \TEX\ that is |
| 4303 |
\typ {adjdemerits} for all distances larger than one. With the double option the |
| 4304 |
demerits come in pairs because we can go up or down in the list of fitness |
| 4305 |
classes. |
| 4306 |
|
| 4307 |
\stopnewprimitive |
| 4308 |
|
| 4309 |
\startnewprimitive[title={\prm {float}}] |
| 4310 |
|
| 4311 |
In addition to integers and dimensions, which are fixed 16.16 integer floats we |
| 4312 |
also have \quote {native} floats, based on 32 bit posit unums. |
| 4313 |
|
| 4314 |
\startbuffer |
| 4315 |
\float0 = 123.456 \the\float0 |
| 4316 |
\float2 = 123.456 \the\float0 |
| 4317 |
\advance \float0 by 123.456 \the\float0 |
| 4318 |
\advance \float0 by \float2 \the\float0 |
| 4319 |
\divideby\float0 3 \the\float0 |
| 4320 |
\stopbuffer |
| 4321 |
|
| 4322 |
\typebuffer |
| 4323 |
|
| 4324 |
They come with the same kind of support as the other numeric data types: |
| 4325 |
|
| 4326 |
\startlines \getbuffer \stoplines |
| 4327 |
|
| 4328 |
\startbuffer |
| 4329 |
\dimen00 = 123.456pt \the\dimen0 |
| 4330 |
\dimen02 = 123.456pt \the\dimen0 |
| 4331 |
\advance \dimen0 by 123.456pt \the\dimen0 |
| 4332 |
\advance \dimen0 by \dimen2 \the\dimen0 |
| 4333 |
\divideby\dimen0 3 \the\dimen0 |
| 4334 |
\stopbuffer |
| 4335 |
|
| 4336 |
We leave the subtle differences between floats and dimensions to the user to |
| 4337 |
investigate: |
| 4338 |
|
| 4339 |
\typebuffer |
| 4340 |
|
| 4341 |
The nature of posits is that they are more accurate around zero (or smaller |
| 4342 |
numbers in general). |
| 4343 |
|
| 4344 |
\startlines \getbuffer \stoplines |
| 4345 |
|
| 4346 |
This also works: |
| 4347 |
|
| 4348 |
\startbuffer |
| 4349 |
\float0=123.456e4 |
| 4350 |
\float2=123.456 \multiply\float2 by 10000 |
| 4351 |
\the\float0 |
| 4352 |
\the\float2 |
| 4353 |
\stopbuffer |
| 4354 |
|
| 4355 |
\typebuffer |
| 4356 |
|
| 4357 |
The values are (as expected) the same: |
| 4358 |
|
| 4359 |
\startlines \getbuffer \stoplines |
| 4360 |
|
| 4361 |
\stopnewprimitive |
| 4362 |
|
| 4363 |
\startnewprimitive[title={\prm {floatdef}}] |
| 4364 |
|
| 4365 |
This primitive defines a symbolic (macro) alias to a float register, just like |
| 4366 |
\prm {countdef} and friends do. |
| 4367 |
|
| 4368 |
\stopnewprimitive |
| 4369 |
|
| 4370 |
\startnewprimitive[title={\prm {floatexpr}}] |
| 4371 |
|
| 4372 |
This is the companion of \prm {numexpr}, \prm {dimexpr} etc. |
| 4373 |
|
| 4374 |
\startbuffer |
| 4375 |
\scratchcounter 200 |
| 4376 |
\the \floatexpr 123.456/456.123 \relax |
| 4377 |
\the \floatexpr 1.2*\scratchcounter \relax |
| 4378 |
\the \floatexpr \scratchcounter/3 \relax |
| 4379 |
\number\floatexpr \scratchcounter/3 \relax |
| 4380 |
\stopbuffer |
| 4381 |
|
| 4382 |
\typebuffer |
| 4383 |
|
| 4384 |
Watch the difference between \prm {the} and \prm {number}: |
| 4385 |
|
| 4386 |
\startlines \getbuffer \stoplines |
| 4387 |
|
| 4388 |
\stopnewprimitive |
| 4389 |
|
| 4390 |
\startoldprimitive[title={\prm {floatingpenalty}}] |
| 4391 |
|
| 4392 |
When an insertion is split (across pages) this one is added to to accumulated |
| 4393 |
\prm {insertpenalties}. In \LUAMETATEX\ this penalty can be stored per insertion |
| 4394 |
class. |
| 4395 |
|
| 4396 |
\stopoldprimitive |
| 4397 |
|
| 4398 |
\startnewprimitive[title={\prm {flushmarks}}] |
| 4399 |
|
| 4400 |
This primitive is an addition to the multiple marks mechanism that originates in |
| 4401 |
\ETEX\ and inserts a reset signal for the mark given category that will perform a |
| 4402 |
clear operation (like \prm {clearmarks} which operates immediately). |
| 4403 |
|
| 4404 |
\stopnewprimitive |
| 4405 |
|
| 4406 |
\startnewprimitive[title={\prm {flushmvl}}] |
| 4407 |
|
| 4408 |
This returns a vertical box with the content of the accumulated mvl list (see |
| 4409 |
\prm {beginmvl}). |
| 4410 |
|
| 4411 |
\stopnewprimitive |
| 4412 |
|
| 4413 |
\startoldprimitive[title={\prm {font}}] |
| 4414 |
|
| 4415 |
This primitive is either a symbolic reference to the current font or in the |
| 4416 |
perspective of an assignment is used to trigger a font definitions with a given |
| 4417 |
name (\type {cs}) and specification. In \LUAMETATEX\ the assignment will trigger |
| 4418 |
a callback that then handles the definition; in addition to the filename an |
| 4419 |
optional size specifier is checked (\type {at} or \type {scaled}). |
| 4420 |
|
| 4421 |
In \LUAMETATEX\ {\em all} font loading is delegated to \LUA, and there is no |
| 4422 |
loading code built in the engine. Also, instead of \prm {font} in \CONTEXT\ one |
| 4423 |
uses dedicated and more advanced font definition commands. |
| 4424 |
|
| 4425 |
\stopoldprimitive |
| 4426 |
|
| 4427 |
\startnewprimitive[title={\prm {fontcharba}}] |
| 4428 |
|
| 4429 |
Fetches the bottom anchor of a character in the given font, so: |
| 4430 |
|
| 4431 |
\startbuffer |
| 4432 |
\the\fontcharba\textfont0 "222B |
| 4433 |
\stopbuffer |
| 4434 |
|
| 4435 |
results in: \inlinebuffer. However, this anchor is only available when it is set |
| 4436 |
and it is not part of \OPENTYPE; it is something that \CONTEXT\ provides for math |
| 4437 |
fonts. |
| 4438 |
|
| 4439 |
\stopnewprimitive |
| 4440 |
|
| 4441 |
\startoldprimitive[title={\prm {fontchardp}}] |
| 4442 |
|
| 4443 |
Fetches the depth of a character in the given font, so: |
| 4444 |
|
| 4445 |
\startbuffer |
| 4446 |
\the\fontchardp\font`g |
| 4447 |
\stopbuffer |
| 4448 |
|
| 4449 |
results in: \inlinebuffer. |
| 4450 |
|
| 4451 |
\stopoldprimitive |
| 4452 |
|
| 4453 |
\startoldprimitive[title={\prm {fontcharht}}] |
| 4454 |
|
| 4455 |
Fetches the width of a character in the given font, so: |
| 4456 |
|
| 4457 |
\startbuffer |
| 4458 |
\the\fontcharht\font`g |
| 4459 |
\stopbuffer |
| 4460 |
|
| 4461 |
results in: \inlinebuffer. |
| 4462 |
|
| 4463 |
\stopoldprimitive |
| 4464 |
|
| 4465 |
\startoldprimitive[title={\prm {fontcharic}}] |
| 4466 |
|
| 4467 |
Fetches the italic correction of a character in the given font, but because it is |
| 4468 |
not an \OPENTYPE\ property it is unlikely to return something useful. Although |
| 4469 |
math fonts have such a property in \CONTEXT\ we deal with it differently. |
| 4470 |
|
| 4471 |
\stopoldprimitive |
| 4472 |
|
| 4473 |
\startnewprimitive[title={\prm {fontcharta}}] |
| 4474 |
|
| 4475 |
Fetches the top anchor of a character in the given font, so: |
| 4476 |
|
| 4477 |
\startbuffer |
| 4478 |
\the\fontcharba\textfont0 "222B |
| 4479 |
\stopbuffer |
| 4480 |
|
| 4481 |
results in: \inlinebuffer. This is a specific property of math characters because |
| 4482 |
in text mark anchoring is driven by a feature. |
| 4483 |
|
| 4484 |
\stopnewprimitive |
| 4485 |
|
| 4486 |
\startoldprimitive[title={\prm {fontcharwd}}] |
| 4487 |
|
| 4488 |
Fetches the width of a character in the given font, so: |
| 4489 |
|
| 4490 |
\startbuffer |
| 4491 |
\the\fontcharwd\font`g |
| 4492 |
\stopbuffer |
| 4493 |
|
| 4494 |
results in: \inlinebuffer. |
| 4495 |
|
| 4496 |
\stopoldprimitive |
| 4497 |
|
| 4498 |
\startoldprimitive[title={\prm {fontdimen}}][obsolete=yes] |
| 4499 |
|
| 4500 |
A traditional \TEX\ font has a couple of font specific dimensions, we only |
| 4501 |
mention the seven that come with text fonts: |
| 4502 |
|
| 4503 |
\startitemize[n,packed] |
| 4504 |
\startitem |
| 4505 |
The slant (slope) is an indication that we have an italic shape. The value |
| 4506 |
divided by 65.536 is a fraction that can be compared with for instance the |
| 4507 |
\type {slanted} operator in \METAPOST. It is used for positioning accents, so |
| 4508 |
actually not limited to oblique fonts (just like italic correction can be a |
| 4509 |
property of any character). It is not relevant in the perspective of |
| 4510 |
\OPENTYPE\ fonts where we have glyph specific top and bottom anchors. |
| 4511 |
\stopitem |
| 4512 |
\startitem |
| 4513 |
Unless is it overloaded by \prm {spaceskip} this determines the space between |
| 4514 |
words (or actually anything separated by a space). |
| 4515 |
\stopitem |
| 4516 |
\startitem |
| 4517 |
This is the stretch component of \prm {fontdimen}~2(space). |
| 4518 |
\startitem |
| 4519 |
This is the shrink component of \prm {fontdimen}~2(space). |
| 4520 |
\stopitem |
| 4521 |
\startitem |
| 4522 |
The so called ex|-|height is normally the height of the \quote {x} and is |
| 4523 |
also accessible as \type {em} unit. |
| 4524 |
\stopitem |
| 4525 |
\startitem |
| 4526 |
The so called em|-|width or in \TEX\ speak quad width is about the with of an |
| 4527 |
\quote {M} but in many fonts just matches the font size. It is also |
| 4528 |
accessible as \type {em} unit. |
| 4529 |
\stopitem |
| 4530 |
\startitem |
| 4531 |
This is a very \TEX\ specific property also known as extra space. It gets |
| 4532 |
{\em added} to the regular space after punctuation when \prm {spacefactor} is |
| 4533 |
2000 or more. It can be overloaded by \prm {xspaceskip}. |
| 4534 |
\stopitem |
| 4535 |
\stopitemize |
| 4536 |
|
| 4537 |
This primitive expects a a number and a font identifier. Setting a font dimension |
| 4538 |
is a global operation as it directly pushes the value in the font resource. |
| 4539 |
|
| 4540 |
\stopoldprimitive |
| 4541 |
|
| 4542 |
\startnewprimitive[title={\prm {fontid}}] |
| 4543 |
|
| 4544 |
Returns the (internal) number associated with the given font: |
| 4545 |
|
| 4546 |
\startbuffer |
| 4547 |
{\bf \xdef\MyFontA{\the\fontid\font}} |
| 4548 |
{\sl \xdef\MyFontB{\setfontid\the\fontid\font}} |
| 4549 |
\stopbuffer |
| 4550 |
|
| 4551 |
\typebuffer \getbuffer |
| 4552 |
|
| 4553 |
with: |
| 4554 |
|
| 4555 |
\startbuffer |
| 4556 |
test {\setfontid\MyFontA test} test {\MyFontB test} test |
| 4557 |
\stopbuffer |
| 4558 |
|
| 4559 |
\typebuffer |
| 4560 |
|
| 4561 |
gives: \inlinebuffer. |
| 4562 |
|
| 4563 |
\stopnewprimitive |
| 4564 |
|
| 4565 |
\startnewprimitive[title={\prm {fontidentifier}}] |
| 4566 |
|
| 4567 |
This one is just there for completeness: it reports the string used to identify a |
| 4568 |
font when logging. Compare: |
| 4569 |
|
| 4570 |
\starttabulate |
| 4571 |
\NC \type {\fontname \font} \NC \fontname \font \NC \NR |
| 4572 |
\NC \type {\fontidentifier\font} \NC \fontidentifier\font \NC \NR |
| 4573 |
\NC \type {\the\fontid \font} \NC \the\fontid \font \NC \NR |
| 4574 |
\stoptabulate |
| 4575 |
|
| 4576 |
\stopnewprimitive |
| 4577 |
|
| 4578 |
\startnewprimitive[title={\prm {fontmathcontrol}}] |
| 4579 |
|
| 4580 |
The \prm {mathfontcontrol} parameter controls how the engine deals with specific |
| 4581 |
font related properties and possibilities. It is set at the \TEX\ end. It makes |
| 4582 |
it possible to fine tune behavior in this mixed traditional and not perfect |
| 4583 |
\OPENTYPE\ math font arena. One can also set this bitset when initializing |
| 4584 |
(loading) the font (at the \LUA\ end) and the value set there is available in |
| 4585 |
\prm {fontmathcontrol}. The bits set in the font win over those in \prm |
| 4586 |
{mathfontcontrol}. There are a few cases where we set these options in the (so |
| 4587 |
called) goodie files. For instance we ignore font kerns in Libertinus, Antykwa |
| 4588 |
and some more. |
| 4589 |
|
| 4590 |
% \starttabulate[|l|rT|] |
| 4591 |
% \NC modern \NC \bgroup\switchtobodyfont [modern]\normalexpanded{\egroup 0x\tohexadecimal\fontmathcontrol\textfont\fam} \NC \NR |
| 4592 |
% \NC pagella \NC \bgroup\switchtobodyfont [pagella]\normalexpanded{\egroup 0x\tohexadecimal\fontmathcontrol\textfont\fam} \NC \NR |
| 4593 |
% \NC antykwa \NC \bgroup\switchtobodyfont [antykwa]\normalexpanded{\egroup 0x\tohexadecimal\fontmathcontrol\textfont\fam} \NC \NR |
| 4594 |
% \NC libertinus \NC \bgroup\switchtobodyfont[libertinus]\normalexpanded{\egroup 0x\tohexadecimal\fontmathcontrol\textfont\fam} \NC \NR |
| 4595 |
% \stoptabulate |
| 4596 |
|
| 4597 |
\starttabulate[|l|rT|] |
| 4598 |
\NC modern \NC \bgroup\switchtobodyfont [modern]\expanded{\egroup 0x\tohexadecimal\fontmathcontrol\textfont\fam} \NC \NR |
| 4599 |
\NC pagella \NC \bgroup\switchtobodyfont [pagella]\expanded{\egroup 0x\tohexadecimal\fontmathcontrol\textfont\fam} \NC \NR |
| 4600 |
\NC antykwa \NC \bgroup\switchtobodyfont [antykwa]\expanded{\egroup 0x\tohexadecimal\fontmathcontrol\textfont\fam} \NC \NR |
| 4601 |
\NC libertinus \NC \bgroup\switchtobodyfont[libertinus]\expanded{\egroup 0x\tohexadecimal\fontmathcontrol\textfont\fam} \NC \NR |
| 4602 |
\stoptabulate |
| 4603 |
|
| 4604 |
\stopnewprimitive |
| 4605 |
|
| 4606 |
\startoldprimitive[title={\prm {fontname}}] |
| 4607 |
|
| 4608 |
Depending on how the font subsystem is implemented this gives some information |
| 4609 |
about the used font: |
| 4610 |
|
| 4611 |
\startbuffer |
| 4612 |
{\tf \fontname\font} |
| 4613 |
{\bf \fontname\font} |
| 4614 |
{\sl \fontname\font} |
| 4615 |
\stopbuffer |
| 4616 |
|
| 4617 |
\typebuffer |
| 4618 |
|
| 4619 |
\startlines |
| 4620 |
\getbuffer |
| 4621 |
\stoplines |
| 4622 |
|
| 4623 |
\stopoldprimitive |
| 4624 |
|
| 4625 |
\startnewprimitive[title={\prm {fontspecdef}}] |
| 4626 |
|
| 4627 |
This primitive creates a reference to a specification that when triggered will |
| 4628 |
change multiple parameters in one go. |
| 4629 |
|
| 4630 |
\starttyping |
| 4631 |
\fontspecdef\MyFontSpec |
| 4632 |
\fontid\font |
| 4633 |
scale 1200 |
| 4634 |
xscale 1100 |
| 4635 |
yscale 800 |
| 4636 |
weight 200 |
| 4637 |
slant 500 |
| 4638 |
\relax |
| 4639 |
\stoptyping |
| 4640 |
|
| 4641 |
is equivalent to: |
| 4642 |
|
| 4643 |
\starttyping |
| 4644 |
\fontspecdef\MyFontSpec |
| 4645 |
\fontid\font |
| 4646 |
all 1200 1100 800 200 500 |
| 4647 |
\relax |
| 4648 |
\stoptyping |
| 4649 |
|
| 4650 |
while |
| 4651 |
|
| 4652 |
\starttyping |
| 4653 |
\fontspecdef\MyFontSpec |
| 4654 |
\fontid\font |
| 4655 |
all \glyphscale \glyphxscale \glyphyscale \glyphslant \glyphweight |
| 4656 |
\relax |
| 4657 |
\stoptyping |
| 4658 |
|
| 4659 |
is the same as |
| 4660 |
|
| 4661 |
\starttyping |
| 4662 |
\fontspecdef\MyFontSpec |
| 4663 |
\fontid\font |
| 4664 |
\relax |
| 4665 |
\stoptyping |
| 4666 |
|
| 4667 |
The engine adapts itself to these glyph parameters but when you access certain |
| 4668 |
quantities you have to make sure that you use the scaled ones. The same is true |
| 4669 |
at the \LUA\ end. This is somewhat fundamental in the sense that when one uses |
| 4670 |
these sort of dynamic features one also need to keep an eye on code that uses |
| 4671 |
font specific dimensions. |
| 4672 |
|
| 4673 |
\stopnewprimitive |
| 4674 |
|
| 4675 |
\startnewprimitive[title={\prm {fontspecid}}] |
| 4676 |
|
| 4677 |
Internally a font reference is a number and this primitive returns the number of |
| 4678 |
the font bound to the specification. |
| 4679 |
|
| 4680 |
\stopnewprimitive |
| 4681 |
|
| 4682 |
\startnewprimitive[title={\prm {fontspecifiedname}}] |
| 4683 |
|
| 4684 |
Depending on how the font subsystem is implemented this gives some information |
| 4685 |
about the (original) definition of the used font: |
| 4686 |
|
| 4687 |
\startbuffer |
| 4688 |
{\tf \fontspecifiedname\font} |
| 4689 |
{\bf \fontspecifiedname\font} |
| 4690 |
{\sl \fontspecifiedname\font} |
| 4691 |
\stopbuffer |
| 4692 |
|
| 4693 |
\typebuffer |
| 4694 |
|
| 4695 |
\startlines |
| 4696 |
\getbuffer |
| 4697 |
\stoplines |
| 4698 |
|
| 4699 |
\stopnewprimitive |
| 4700 |
|
| 4701 |
\startnewprimitive[title={\prm {fontspecifiedsize}}] |
| 4702 |
|
| 4703 |
Depending on how the font subsystem is implemented this gives some information |
| 4704 |
about the (original) size of the used font: |
| 4705 |
|
| 4706 |
\startbuffer |
| 4707 |
{\tf \the\fontspecifiedsize\font : \the\glyphscale} |
| 4708 |
{\bfa \the\fontspecifiedsize\font : \the\glyphscale} |
| 4709 |
{\slx \the\fontspecifiedsize\font : \the\glyphscale} |
| 4710 |
\stopbuffer |
| 4711 |
|
| 4712 |
\typebuffer |
| 4713 |
|
| 4714 |
Depending on how the font system is setup, this is not the real value that is |
| 4715 |
used in the text because we can use for instance \prm {glyphscale}. So the next |
| 4716 |
lines depend on what font mode this document is typeset. |
| 4717 |
|
| 4718 |
\startlines |
| 4719 |
\getbuffer |
| 4720 |
\stoplines |
| 4721 |
|
| 4722 |
\stopnewprimitive |
| 4723 |
|
| 4724 |
\startnewprimitive[title={\prm {fontspecscale}}] |
| 4725 |
|
| 4726 |
This returns the scale factor of a fontspec where as usual 1000 means scaling |
| 4727 |
by~1. |
| 4728 |
|
| 4729 |
\stopnewprimitive |
| 4730 |
|
| 4731 |
\startnewprimitive[title={\prm {fontspecslant}}] |
| 4732 |
|
| 4733 |
This returns the slant factor of a font specification, usually between zero and |
| 4734 |
1000 with 1000 being maximum slant. |
| 4735 |
|
| 4736 |
\stopnewprimitive |
| 4737 |
|
| 4738 |
\startnewprimitive[title={\prm {fontspecweight}}] |
| 4739 |
|
| 4740 |
This returns the weight of the font specification. Reasonable values are between |
| 4741 |
zero and 500. |
| 4742 |
|
| 4743 |
\stopnewprimitive |
| 4744 |
|
| 4745 |
\startnewprimitive[title={\prm {fontspecxscale}}] |
| 4746 |
|
| 4747 |
This returns the scale factor of a font specification where as usual 1000 means |
| 4748 |
scaling by~1. |
| 4749 |
|
| 4750 |
\stopnewprimitive |
| 4751 |
|
| 4752 |
\startnewprimitive[title={\prm {fontspecyscale}}] |
| 4753 |
|
| 4754 |
This returns the scale factor of a font specification where as usual 1000 means |
| 4755 |
scaling by~1. |
| 4756 |
|
| 4757 |
\stopnewprimitive |
| 4758 |
|
| 4759 |
\startnewprimitive[title={\prm {fonttextcontrol}}] |
| 4760 |
|
| 4761 |
This returns the text control flags that are set on the given font, here {\tttf |
| 4762 |
0x\tohexadecimal \fonttextcontrol \font}. Bits that can be set are: |
| 4763 |
|
| 4764 |
\getbuffer[engine:syntax:textcontrolcodes] |
| 4765 |
|
| 4766 |
\stopnewprimitive |
| 4767 |
|
| 4768 |
\startnewprimitive[title={\prm {forcedleftcorrection}}] |
| 4769 |
|
| 4770 |
This is a callback driven left correction signal similar to italic corrections. |
| 4771 |
|
| 4772 |
\stopnewprimitive |
| 4773 |
|
| 4774 |
\startnewprimitive[title={\prm {forcedrightcorrection}}] |
| 4775 |
|
| 4776 |
This is a callback driven right correction signal similar to italic corrections. |
| 4777 |
|
| 4778 |
\stopnewprimitive |
| 4779 |
|
| 4780 |
\startnewprimitive[title={\prm {formatname}}] |
| 4781 |
|
| 4782 |
It is in the name: {\tttf \filenameonly {\formatname}}, but we cheat here by only |
| 4783 |
showing the filename and not the full path, which in a \CONTEXT\ setup can span |
| 4784 |
more than a line in this paragraph. |
| 4785 |
|
| 4786 |
\stopnewprimitive |
| 4787 |
|
| 4788 |
\startnewprimitive[title={\prm {frozen}}] |
| 4789 |
|
| 4790 |
You can define a macro as being frozen: |
| 4791 |
|
| 4792 |
\starttyping |
| 4793 |
\frozen\def\MyMacro{...} |
| 4794 |
\stoptyping |
| 4795 |
|
| 4796 |
When you redefine this macro you get an error: |
| 4797 |
|
| 4798 |
\starttyping |
| 4799 |
! You can't redefine a frozen macro. |
| 4800 |
\stoptyping |
| 4801 |
|
| 4802 |
This is a prefix like \prm {global} and it can be combined with other prefixes. |
| 4803 |
\footnote {The \prm {outer} and \prm {long} prefixes are no|-|ops in |
| 4804 |
\LUAMETATEX\ and \LUATEX\ can be configured to ignore them.} |
| 4805 |
|
| 4806 |
\stopnewprimitive |
| 4807 |
|
| 4808 |
\startnewprimitive[title={\prm {futurecsname}}] |
| 4809 |
|
| 4810 |
In order to make the repertoire of \type {def}, \type {let} and \type {futurelet} |
| 4811 |
primitives complete we also have: |
| 4812 |
|
| 4813 |
\starttyping |
| 4814 |
\futurecsname MyMacro:1\endcsname\MyAction |
| 4815 |
\stoptyping |
| 4816 |
|
| 4817 |
\stopnewprimitive |
| 4818 |
|
| 4819 |
\startnewprimitive[title={\prm {futuredef}}] |
| 4820 |
|
| 4821 |
We elaborate on the example of using \prm {futurelet} in the previous section. |
| 4822 |
Compare that one with the next: |
| 4823 |
|
| 4824 |
\startbuffer |
| 4825 |
\def\MySpecialToken{[} |
| 4826 |
\def\DoWhatever{\ifx\NextToken\MySpecialToken YES\else NOP\fi : } |
| 4827 |
\futurelet\NextToken\DoWhatever [A]\crlf |
| 4828 |
\futurelet\NextToken\DoWhatever (A)\par |
| 4829 |
\stopbuffer |
| 4830 |
|
| 4831 |
\typebuffer |
| 4832 |
|
| 4833 |
This time we get: |
| 4834 |
|
| 4835 |
{\getbuffer} |
| 4836 |
|
| 4837 |
It is for that reason that we now also have \prm {futuredef}: |
| 4838 |
|
| 4839 |
\startbuffer |
| 4840 |
\def\MySpecialToken{[} |
| 4841 |
\def\DoWhatever{\ifx\NextToken\MySpecialToken YES\else NOP\fi : } |
| 4842 |
\futuredef\NextToken\DoWhatever [A]\crlf |
| 4843 |
\futuredef\NextToken\DoWhatever (A)\par |
| 4844 |
\stopbuffer |
| 4845 |
|
| 4846 |
\typebuffer |
| 4847 |
|
| 4848 |
So we're back to what we want: |
| 4849 |
|
| 4850 |
{\getbuffer} |
| 4851 |
|
| 4852 |
\stopnewprimitive |
| 4853 |
|
| 4854 |
\startnewprimitive[title={\prm {futureexpand}}] |
| 4855 |
|
| 4856 |
This primitive can be used as an alternative to a \prm {futurelet} approach, |
| 4857 |
which is where the name comes from. \footnote {In the engine primitives |
| 4858 |
that have similar behavior are grouped in commands that are then dealt with |
| 4859 |
together, code wise.} |
| 4860 |
|
| 4861 |
\startbuffer |
| 4862 |
\def\variantone<#1>{(#1)} |
| 4863 |
\def\varianttwo#1{[#1]} |
| 4864 |
\futureexpand<\variantone\varianttwo<one> |
| 4865 |
\futureexpand<\variantone\varianttwo{two} |
| 4866 |
\stopbuffer |
| 4867 |
|
| 4868 |
\typebuffer |
| 4869 |
|
| 4870 |
So, the next token determines which of the two variants is taken: |
| 4871 |
|
| 4872 |
{\getbuffer} |
| 4873 |
|
| 4874 |
Because we look ahead there is some magic involved: spaces are ignored but when |
| 4875 |
we have no match they are pushed back into the input. The next variant |
| 4876 |
demonstrates this: |
| 4877 |
|
| 4878 |
\startbuffer |
| 4879 |
\def\variantone<#1>{(#1)} |
| 4880 |
\def\varianttwo{} |
| 4881 |
\def\temp{\futureexpand<\variantone\varianttwo} |
| 4882 |
[\temp <one>] |
| 4883 |
[\temp {two}] |
| 4884 |
[\expandafter\temp\space <one>] |
| 4885 |
[\expandafter\temp\space {two}] |
| 4886 |
\stopbuffer |
| 4887 |
|
| 4888 |
\typebuffer |
| 4889 |
|
| 4890 |
This gives us: |
| 4891 |
|
| 4892 |
{\getbuffer} |
| 4893 |
|
| 4894 |
\stopnewprimitive |
| 4895 |
|
| 4896 |
\startnewprimitive[title={\prm {futureexpandis}}] |
| 4897 |
|
| 4898 |
We assume that the previous section is read. This variant will not push back |
| 4899 |
spaces, which permits a consistent approach i.e.\ the user can assume that macro |
| 4900 |
always gobbles the spaces. |
| 4901 |
|
| 4902 |
\startbuffer |
| 4903 |
\def\variantone<#1>{(#1)} |
| 4904 |
\def\varianttwo{} |
| 4905 |
\def\temp{\futureexpandis<\variantone\varianttwo} |
| 4906 |
[\temp <one>] |
| 4907 |
[\temp {two}] |
| 4908 |
[\expandafter\temp\space <one>] |
| 4909 |
[\expandafter\temp\space {two}] |
| 4910 |
\stopbuffer |
| 4911 |
|
| 4912 |
\typebuffer |
| 4913 |
|
| 4914 |
So, here no spaces are pushed back. This \type {is} in the name of this primitive |
| 4915 |
means \quote {ignore spaces}, but having that added to the name would have made |
| 4916 |
the primitive even more verbose (after all, we also don't have \type |
| 4917 |
{\expandeddef} but \prm {edef} and no \type {\globalexpandeddef} but \prm |
| 4918 |
{xdef}. |
| 4919 |
|
| 4920 |
{\getbuffer} |
| 4921 |
|
| 4922 |
\stopnewprimitive |
| 4923 |
|
| 4924 |
\startnewprimitive[title={\prm {futureexpandisap}}] |
| 4925 |
|
| 4926 |
This primitive is like the one in the previous section but also ignores par |
| 4927 |
tokens, so \type {isap} means \quote {ignore spaces and paragraphs}. |
| 4928 |
|
| 4929 |
\stopnewprimitive |
| 4930 |
|
| 4931 |
\startoldprimitive[title={\prm {futurelet}}] |
| 4932 |
|
| 4933 |
The original \TEX\ primitive \prm {futurelet} can be used to create an alias to a next token, |
| 4934 |
push it back into the input and then expand a given token. |
| 4935 |
|
| 4936 |
\startbuffer |
| 4937 |
\let\MySpecialTokenL[ |
| 4938 |
\let\MySpecialTokenR] % nicer for checker |
| 4939 |
\def\DoWhatever{\ifx\NextToken\MySpecialTokenL YES\else NOP\fi : } |
| 4940 |
\futurelet\NextToken\DoWhatever [A]\crlf |
| 4941 |
\futurelet\NextToken\DoWhatever (A)\par |
| 4942 |
\stopbuffer |
| 4943 |
|
| 4944 |
\typebuffer |
| 4945 |
|
| 4946 |
This is typically the kind of primitive that most users will never use because it |
| 4947 |
expects a sane follow up handler (here \type {\DoWhatever}) and therefore is |
| 4948 |
related to user interfacing. |
| 4949 |
|
| 4950 |
{\getbuffer} |
| 4951 |
|
| 4952 |
\stopoldprimitive |
| 4953 |
|
| 4954 |
\startoldprimitive[title={\prm {gdef}}] |
| 4955 |
|
| 4956 |
The is the global companion of \prm {def}. |
| 4957 |
|
| 4958 |
\stopoldprimitive |
| 4959 |
|
| 4960 |
\startnewprimitive[title={\prm {gdefcsname}}] |
| 4961 |
|
| 4962 |
As with standard \TEX\ we also define global ones: |
| 4963 |
|
| 4964 |
\starttyping |
| 4965 |
\expandafter\gdef\csname MyMacro:1\endcsname{...} |
| 4966 |
\gdefcsname MyMacro:1\endcsname{...} |
| 4967 |
\stoptyping |
| 4968 |
|
| 4969 |
\stopnewprimitive |
| 4970 |
|
| 4971 |
\startnewprimitive[title={\prm {givenmathstyle}}] |
| 4972 |
|
| 4973 |
This primitive expects a math style and returns it when valid or otherwise issues |
| 4974 |
an error. |
| 4975 |
|
| 4976 |
\stopnewprimitive |
| 4977 |
|
| 4978 |
\startnewprimitive[title={\prm {gleaders}}] |
| 4979 |
|
| 4980 |
Leaders are glue with special property: a box, rule of (in \LUAMETATEX) glyph, like: |
| 4981 |
|
| 4982 |
\startlines |
| 4983 |
x\leaders \glyph `M \hfill x |
| 4984 |
xx\leaders \glyph `M \hfill xx |
| 4985 |
|
| 4986 |
x\cleaders \glyph `M \hfill x |
| 4987 |
xx\cleaders \glyph `M \hfill xx |
| 4988 |
|
| 4989 |
x\xleaders \glyph `M \hfill x |
| 4990 |
xx\xleaders \glyph `M \hfill xx |
| 4991 |
|
| 4992 |
x\gleaders \glyph `M \hfill x |
| 4993 |
xx\gleaders \glyph `M \hfill xx |
| 4994 |
\stoplines |
| 4995 |
|
| 4996 |
Leaders fill the available space. The \prm {leaders} command starts at the left |
| 4997 |
edge and stops when there is no more space. The blobs get centered when we use |
| 4998 |
\prm {cleaders}: excess space is distributed before and after a blob while \prm |
| 4999 |
{xleaders} also puts space between the blobs. |
| 5000 |
|
| 5001 |
When a rule is given the advance (width or height and depth) is ignored, so these |
| 5002 |
are equivalent. |
| 5003 |
|
| 5004 |
\starttyping |
| 5005 |
x\leaders \hrule \hfill x |
| 5006 |
x\leaders \hrule width 1cm \hfill x |
| 5007 |
\stoptyping |
| 5008 |
|
| 5009 |
When a box is used one will normally have some alignment in that box. |
| 5010 |
|
| 5011 |
\starttyping |
| 5012 |
x\leaders \hbox {\hss.\hss} \hfill x |
| 5013 |
x\leaders \hbox {\hss.\hss} \hskip 6cm \relax x |
| 5014 |
\stoptyping |
| 5015 |
|
| 5016 |
The reference point is the left edge of the current (outer) box and the effective |
| 5017 |
glue (when it has stretch or shrink) depends on that box. The \prm {gleaders} |
| 5018 |
variant takes the page as reference. That makes it possible to \quote {align} |
| 5019 |
across boxes. |
| 5020 |
|
| 5021 |
\stopnewprimitive |
| 5022 |
|
| 5023 |
\startnewprimitive[title={\prm {glet}}] |
| 5024 |
|
| 5025 |
This is the global companion of \prm {let}. The fact that it is not an original |
| 5026 |
primitive is probably due to the expectation for it not it not being used (as) |
| 5027 |
often (as in \CONTEXT). |
| 5028 |
|
| 5029 |
\stopnewprimitive |
| 5030 |
|
| 5031 |
\startnewprimitive[title={\prm {gletcsname}}] |
| 5032 |
|
| 5033 |
Naturally \LUAMETATEX\ also provides a global variant: |
| 5034 |
|
| 5035 |
\starttyping |
| 5036 |
\expandafter\global\expandafter\let\csname MyMacro:1\endcsname\relax |
| 5037 |
\expandafter \glet\csname MyMacro:1\endcsname\relax |
| 5038 |
\gletcsname MyMacro:1\endcsname\relax |
| 5039 |
\stoptyping |
| 5040 |
|
| 5041 |
So, here we save even more. |
| 5042 |
|
| 5043 |
\stopnewprimitive |
| 5044 |
|
| 5045 |
\startnewprimitive[title={\prm {glettonothing}}] |
| 5046 |
|
| 5047 |
This is the global companion of \prm {lettonothing}. |
| 5048 |
|
| 5049 |
\stopnewprimitive |
| 5050 |
|
| 5051 |
\startoldprimitive[title={\prm {global}}] |
| 5052 |
|
| 5053 |
This is one of the original prefixes that can be used when we define a macro of |
| 5054 |
change some register. |
| 5055 |
|
| 5056 |
\starttyping |
| 5057 |
\bgroup |
| 5058 |
\def\MyMacroA{a} |
| 5059 |
\global\def\MyMacroB{a} |
| 5060 |
\gdef\MyMacroC{a} |
| 5061 |
\egroup |
| 5062 |
\stoptyping |
| 5063 |
|
| 5064 |
The macro defined in the first line is forgotten when the groups is left. The |
| 5065 |
second and third definition are both global and these definitions are retained. |
| 5066 |
|
| 5067 |
\stopoldprimitive |
| 5068 |
|
| 5069 |
\startoldprimitive[title={\prm {globaldefs}}] |
| 5070 |
|
| 5071 |
When set to a positive value, this internal integer will force all definitions to |
| 5072 |
be global, and in a complex macro package that is not something a user will do |
| 5073 |
unless it is very controlled. |
| 5074 |
|
| 5075 |
\stopoldprimitive |
| 5076 |
|
| 5077 |
\startoldprimitive[title={\prm {glueexpr}}] |
| 5078 |
|
| 5079 |
This is a more extensive variant of \prm {dimexpr} that also handles the optional |
| 5080 |
stretch and shrink components. |
| 5081 |
|
| 5082 |
\stopoldprimitive |
| 5083 |
|
| 5084 |
\startoldprimitive[title={\prm {glueshrink}}] |
| 5085 |
|
| 5086 |
This returns the shrink component of a glue quantity. The result is a dimension |
| 5087 |
so you need to apply \prm {the} when applicable. |
| 5088 |
|
| 5089 |
\stopoldprimitive |
| 5090 |
|
| 5091 |
\startoldprimitive[title={\prm {glueshrinkorder}}] |
| 5092 |
|
| 5093 |
This returns the shrink order of a glue quantity. The result is a integer so you |
| 5094 |
need to apply \prm {the} when applicable. |
| 5095 |
|
| 5096 |
\stopoldprimitive |
| 5097 |
|
| 5098 |
\startnewprimitive[title={\prm {gluespecdef}}] |
| 5099 |
|
| 5100 |
A variant of \prm {integerdef} and \prm {dimensiondef} is: |
| 5101 |
|
| 5102 |
\starttyping |
| 5103 |
\gluespecdef\MyGlue = 3pt plus 2pt minus 1pt |
| 5104 |
\stoptyping |
| 5105 |
|
| 5106 |
The properties are comparable to the ones described in the previous sections. |
| 5107 |
|
| 5108 |
\stopnewprimitive |
| 5109 |
|
| 5110 |
\startoldprimitive[title={\prm {gluestretch}}] |
| 5111 |
|
| 5112 |
This returns the stretch component of a glue quantity. The result is a dimension |
| 5113 |
so you need to apply \prm {the} when applicable. |
| 5114 |
|
| 5115 |
\stopoldprimitive |
| 5116 |
|
| 5117 |
\startoldprimitive[title={\prm {gluestretchorder}}] |
| 5118 |
|
| 5119 |
This returns the stretch order of a glue quantity. The result is a integer so you |
| 5120 |
need to apply \prm {the} when applicable. |
| 5121 |
|
| 5122 |
\stopoldprimitive |
| 5123 |
|
| 5124 |
\startoldprimitive[title={\prm {gluetomu}}] |
| 5125 |
|
| 5126 |
The sequence \typ {\the \gluetomu 20pt plus 10pt minus 5pt} gives \the \gluetomu |
| 5127 |
20pt plus 10pt minus 5pt. |
| 5128 |
|
| 5129 |
\stopoldprimitive |
| 5130 |
|
| 5131 |
\startnewprimitive[title={\prm {glyph}}] |
| 5132 |
|
| 5133 |
This is a more extensive variant of \prm {char} that permits setting some |
| 5134 |
properties if the injected character node. |
| 5135 |
|
| 5136 |
\startbuffer |
| 5137 |
\ruledhbox{\glyph |
| 5138 |
scale 2000 xscale 9000 yscale 1200 |
| 5139 |
slant 700 weight 200 |
| 5140 |
xoffset 10pt yoffset -5pt left 10pt right 20pt |
| 5141 |
123} |
| 5142 |
\quad |
| 5143 |
\ruledhbox{\glyph |
| 5144 |
scale 2000 xscale 9000 yscale 1200 |
| 5145 |
slant 700 weight 200 |
| 5146 |
125} |
| 5147 |
\stopbuffer |
| 5148 |
|
| 5149 |
\typebuffer |
| 5150 |
|
| 5151 |
In addition one can specify \type {font} (symbol), \type {id} (valid font id |
| 5152 |
number), an \type {options} (bit set) and \type {raise}. |
| 5153 |
|
| 5154 |
\startlinecorrection |
| 5155 |
\dontleavehmode\getbuffer |
| 5156 |
\stoplinecorrection |
| 5157 |
|
| 5158 |
When no parameters are set, the current ones are used. More details and examples |
| 5159 |
of usage can be found in the \CONTEXT\ distribution. |
| 5160 |
|
| 5161 |
\stopnewprimitive |
| 5162 |
|
| 5163 |
\startnewprimitive[title={\prm {glyphdatafield}}] |
| 5164 |
|
| 5165 |
The value of this parameter is assigned to data field in glyph nodes that get |
| 5166 |
injected. It has no meaning in itself but can be used at the \LUA\ end. |
| 5167 |
|
| 5168 |
\stopnewprimitive |
| 5169 |
|
| 5170 |
\startnewprimitive[title={\prm {glyphoptions}}] |
| 5171 |
|
| 5172 |
The value of this parameter is assigned to the options field in glyph nodes that |
| 5173 |
get injected. |
| 5174 |
|
| 5175 |
\starttworows |
| 5176 |
\getbuffer[engine:syntax:glyphoptions] |
| 5177 |
\stoptworows |
| 5178 |
|
| 5179 |
\stopnewprimitive |
| 5180 |
|
| 5181 |
\startnewprimitive[title={\prm {glyphscale}}] |
| 5182 |
|
| 5183 |
An integer parameter defining the current glyph scale, assigned to glyphs |
| 5184 |
(characters) inserted into the current list. |
| 5185 |
|
| 5186 |
\stopnewprimitive |
| 5187 |
|
| 5188 |
\startnewprimitive[title={\prm {glyphscriptfield}}] |
| 5189 |
|
| 5190 |
The value of this parameter is assigned to script field in glyph nodes that get |
| 5191 |
injected. It has no meaning in itself but can be used at the \LUA\ end. |
| 5192 |
|
| 5193 |
\stopnewprimitive |
| 5194 |
|
| 5195 |
\startnewprimitive[title={\prm {glyphscriptscale}}] |
| 5196 |
|
| 5197 |
This multiplier is applied to text font and glyph dimension properties when script |
| 5198 |
style is used. |
| 5199 |
|
| 5200 |
\stopnewprimitive |
| 5201 |
|
| 5202 |
\startnewprimitive[title={\prm {glyphscriptscriptscale}}] |
| 5203 |
|
| 5204 |
This multiplier is applied to text font and glyph dimension properties when |
| 5205 |
script script style is used. |
| 5206 |
|
| 5207 |
\stopnewprimitive |
| 5208 |
|
| 5209 |
\startnewprimitive[title={\prm {glyphslant}}] |
| 5210 |
|
| 5211 |
An integer parameter defining the current glyph slant, assigned to glyphs |
| 5212 |
(characters) inserted into the current list. |
| 5213 |
|
| 5214 |
\stopnewprimitive |
| 5215 |
|
| 5216 |
\startnewprimitive[title={\prm {glyphstatefield}}] |
| 5217 |
|
| 5218 |
The value of this parameter is assigned to script state in glyph nodes that get |
| 5219 |
injected. It has no meaning in itself but can be used at the \LUA\ end. |
| 5220 |
|
| 5221 |
\stopnewprimitive |
| 5222 |
|
| 5223 |
\startnewprimitive[title={\prm {glyphtextscale}}] |
| 5224 |
|
| 5225 |
This multiplier is applied to text font and glyph dimension properties when text |
| 5226 |
style is used. |
| 5227 |
|
| 5228 |
\stopnewprimitive |
| 5229 |
|
| 5230 |
\startnewprimitive[title={\prm {glyphweight}}] |
| 5231 |
|
| 5232 |
An integer parameter defining the current glyph weight, assigned to glyphs |
| 5233 |
(characters) inserted into the current list. |
| 5234 |
|
| 5235 |
\stopnewprimitive |
| 5236 |
|
| 5237 |
\startnewprimitive[title={\prm {glyphxoffset}}] |
| 5238 |
|
| 5239 |
An integer parameter defining the current glyph x offset, assigned to glyphs |
| 5240 |
(characters) inserted into the current list. Normally this will only be set when |
| 5241 |
one explicitly works with glyphs and defines a specific sequence. |
| 5242 |
|
| 5243 |
\stopnewprimitive |
| 5244 |
|
| 5245 |
\startnewprimitive[title={\prm {glyphxscale}}] |
| 5246 |
|
| 5247 |
An integer parameter defining the current glyph x scale, assigned to glyphs |
| 5248 |
(characters) inserted into the current list. |
| 5249 |
|
| 5250 |
\stopnewprimitive |
| 5251 |
|
| 5252 |
\startnewprimitive[title={\prm {glyphxscaled}}] |
| 5253 |
|
| 5254 |
This primitive returns the given dimension scaled by the \prm {glyphscale} and |
| 5255 |
\prm {glyphxscale}. |
| 5256 |
|
| 5257 |
\stopnewprimitive |
| 5258 |
|
| 5259 |
\startnewprimitive[title={\prm {glyphyoffset}}] |
| 5260 |
|
| 5261 |
An integer parameter defining the current glyph x offset, assigned to glyphs |
| 5262 |
(characters) inserted into the current list. Normally this will only be set when |
| 5263 |
one explicitly works with glyphs and defines a specific sequence. |
| 5264 |
|
| 5265 |
\stopnewprimitive |
| 5266 |
|
| 5267 |
\startnewprimitive[title={\prm {glyphyscale}}] |
| 5268 |
|
| 5269 |
An integer parameter defining the current glyph y scale, assigned to glyphs |
| 5270 |
(characters) inserted into the current list. |
| 5271 |
|
| 5272 |
\stopnewprimitive |
| 5273 |
|
| 5274 |
\startnewprimitive[title={\prm {glyphyscaled}}] |
| 5275 |
|
| 5276 |
This primitive returns the given dimension scaled by the \prm {glyphscale} and |
| 5277 |
\prm {glyphyscale}. |
| 5278 |
|
| 5279 |
\stopnewprimitive |
| 5280 |
|
| 5281 |
\startnewprimitive[title={\prm {gtoksapp}}] |
| 5282 |
|
| 5283 |
This is the global variant of \prm {toksapp}. |
| 5284 |
|
| 5285 |
\stopnewprimitive |
| 5286 |
|
| 5287 |
\startnewprimitive[title={\prm {gtokspre}}] |
| 5288 |
|
| 5289 |
This is the global variant of \prm {tokspre}. |
| 5290 |
|
| 5291 |
\stopnewprimitive |
| 5292 |
|
| 5293 |
\startoldprimitive[title={\prm {halign}}] |
| 5294 |
|
| 5295 |
This command starts horizontally aligned material. Macro packages use this |
| 5296 |
command in table mechanisms and math alignments. It starts with a preamble |
| 5297 |
followed by entries (rows and columns). There are some related primitives, for |
| 5298 |
instance \prm {alignmark} duplicates the functionality of \type {#} inside |
| 5299 |
alignment preambles, while \prm {aligntab} duplicates the functionality of \type |
| 5300 |
{&}. The \prm {aligncontent} primitive directly refers to an entry so that one |
| 5301 |
does not get repeated. |
| 5302 |
|
| 5303 |
Alignments can be traced with \prm {tracingalignments}. When set to~1 basics |
| 5304 |
usage is shown, for instance of \prm {noalign} but more interesting is~2 or more: |
| 5305 |
you then get the preambles reported. |
| 5306 |
|
| 5307 |
The \prm {halign} (tested) and \prm {valign} (yet untested) primitives accept a |
| 5308 |
few keywords in addition to \type {to} and \type {spread}: |
| 5309 |
|
| 5310 |
\starttabulate[|l|p|] |
| 5311 |
\FL |
| 5312 |
\BC keyword \BC explanation \NC \NR |
| 5313 |
\TL |
| 5314 |
\NC \type {attr} \NC set the given attribute to the given value \NC \NR |
| 5315 |
\NC \type {callback} \NC trigger the \type {alignment} callback \NC \NR |
| 5316 |
\NC \type {discard} \NC discard zero \prm {tabskip}'s \NC \NR |
| 5317 |
\NC \type {noskips} \NC don't even process zero \prm {tabskip}'s \NC \NR |
| 5318 |
\NC \type {reverse} \NC reverse the final rows \NC \NR |
| 5319 |
\LL |
| 5320 |
\stoptabulate |
| 5321 |
|
| 5322 |
In the preamble the \prm {tabsize} primitive can be used to set the width of a |
| 5323 |
column. By doing so one can avoid using a box in the preamble which, combined |
| 5324 |
with the sparse tabskip features, is a bit easier on memory when you produce |
| 5325 |
tables that span hundreds of pages and have a dozen columns. |
| 5326 |
|
| 5327 |
The \prm {everytab} complements the \prm {everycr} token register but is sort of |
| 5328 |
experimental as it might become more selective and powerful some day. |
| 5329 |
|
| 5330 |
The two primitives \prm {alignmentcellsource} and \prm {alignmentwrapsource} that |
| 5331 |
associate a source id (integer) to the current cell and row (line). Sources and |
| 5332 |
targets are experimental and are being explored in \CONTEXT\ so we'll see where |
| 5333 |
that ends up in. |
| 5334 |
|
| 5335 |
\stopoldprimitive |
| 5336 |
|
| 5337 |
\startoldprimitive[title={\prm {hangafter}}] |
| 5338 |
|
| 5339 |
This parameter tells the par builder when indentation specified with \prm |
| 5340 |
{hangindent} starts. A negative value does the opposite and starts indenting |
| 5341 |
immediately. So, a value of $-2$ will make the first two lines indent. |
| 5342 |
|
| 5343 |
\stopoldprimitive |
| 5344 |
|
| 5345 |
\startoldprimitive[title={\prm {hangindent}}] |
| 5346 |
|
| 5347 |
This parameter relates to \prm {hangafter} and sets the amount of indentation. |
| 5348 |
When larger than zero indentation happens left, otherwise it starts at the right |
| 5349 |
edge. |
| 5350 |
|
| 5351 |
\stopoldprimitive |
| 5352 |
|
| 5353 |
\startoldprimitive[title={\prm {hbadness}}] |
| 5354 |
|
| 5355 |
This sets the threshold for reporting a horizontal badness value, its current |
| 5356 |
value is \the \badness. |
| 5357 |
|
| 5358 |
\stopoldprimitive |
| 5359 |
|
| 5360 |
\startnewprimitive[title={\prm {hbadnessmode}}] |
| 5361 |
|
| 5362 |
This parameter determines what gets reported when the (in the horizontal packer) |
| 5363 |
badness exceeds some limit. The current value of this bitset is {\tt |
| 5364 |
"\tohexadecimal \hbadnessmode}. |
| 5365 |
|
| 5366 |
\startfourrows |
| 5367 |
\getbuffer[engine:syntax:badnessmodecodes] |
| 5368 |
\stopfourrows |
| 5369 |
|
| 5370 |
\stopnewprimitive |
| 5371 |
|
| 5372 |
\startoldprimitive[title={\prm {hbox}}] |
| 5373 |
|
| 5374 |
This constructs a horizontal box. There are a lot of optional parameters so more |
| 5375 |
details can be found in dedicated manuals. When the content is packed a callback |
| 5376 |
can kick in that can be used to apply for instance font features. |
| 5377 |
|
| 5378 |
\stopoldprimitive |
| 5379 |
|
| 5380 |
\startnewprimitive[title={\prm {hccode}}] |
| 5381 |
|
| 5382 |
The \TEX\ engine is good at hyphenating but traditionally that has been limited |
| 5383 |
to hyphens. Some languages however use different characters. You can set up a |
| 5384 |
different \prm {hyphenchar} as well as pre and post characters, but there's also |
| 5385 |
a dedicated code for controlling this. |
| 5386 |
|
| 5387 |
\startbuffer |
| 5388 |
\hccode"2013 "2013 |
| 5389 |
|
| 5390 |
\hsize 50mm test\char"2013test\par |
| 5391 |
\hsize 1mm test\char"2013test\par |
| 5392 |
|
| 5393 |
\hccode"2013 `! |
| 5394 |
|
| 5395 |
\hsize 50mm test\char"2013test\par |
| 5396 |
\hsize 1mm test\char"2013test\par |
| 5397 |
\stopbuffer |
| 5398 |
|
| 5399 |
\typebuffer |
| 5400 |
|
| 5401 |
This example shows that we can mark a character as hyphen|-|like but also can |
| 5402 |
remap it to something else: |
| 5403 |
|
| 5404 |
\startpacked \getbuffer \stoppacked |
| 5405 |
|
| 5406 |
\stopnewprimitive |
| 5407 |
|
| 5408 |
\startoldprimitive[title={\prm {hfil}}] |
| 5409 |
|
| 5410 |
This is a shortcut for \typ {\hskip plus 1 fil} (first order filler). |
| 5411 |
|
| 5412 |
\stopoldprimitive |
| 5413 |
|
| 5414 |
\startoldprimitive[title={\prm {hfill}}] |
| 5415 |
|
| 5416 |
This is a shortcut for \typ {\hskip plus 1 fill} (second order filler). |
| 5417 |
|
| 5418 |
\stopoldprimitive |
| 5419 |
|
| 5420 |
\startoldprimitive[title={\prm {hfilneg}}] |
| 5421 |
|
| 5422 |
This is a shortcut for \typ {\hskip plus - 1 fil} so it can compensate \prm |
| 5423 |
{hfil}. |
| 5424 |
|
| 5425 |
\stopoldprimitive |
| 5426 |
|
| 5427 |
\startoldprimitive[title={\prm {hfuzz}}] |
| 5428 |
|
| 5429 |
This dimension sets the threshold for reporting horizontal boxes that are under- |
| 5430 |
or overfull. The current value is \the \hfuzz. |
| 5431 |
|
| 5432 |
\stopoldprimitive |
| 5433 |
|
| 5434 |
\startnewprimitive[title={\prm {hjcode}}] |
| 5435 |
|
| 5436 |
The so called lowercase code determines if a character is part of a |
| 5437 |
to|-|be|-|hyphenated word. In \LUATEX\ we introduced the \quote {hyphenation |
| 5438 |
justification} code as replacement. When a language is saved and no \prm {hjcode} |
| 5439 |
is set the \prm {lccode} is used instead. This code serves a second purpose. When |
| 5440 |
the assigned value is greater than 0 but less than 32 it indicated the to be used |
| 5441 |
length when checking for left- and righthyphenmin. For instance it make sense to |
| 5442 |
set the code to~2 for characters like Å“. |
| 5443 |
|
| 5444 |
\stopnewprimitive |
| 5445 |
|
| 5446 |
\startoldprimitive[title={\prm {hkern}}] |
| 5447 |
|
| 5448 |
This primitive is like \prm {kern} but will force the engine into horizontal mode |
| 5449 |
if it isn't yet. |
| 5450 |
|
| 5451 |
\stopoldprimitive |
| 5452 |
|
| 5453 |
\startnewprimitive[title={\prm {hmcode}}] |
| 5454 |
|
| 5455 |
The \type {hm} stands for \quote {hyphenation math}. When bit~1 is set the |
| 5456 |
characters will be repeated on the next line after a break. The second bit |
| 5457 |
concerns italic correction but is of little relevance now that we moved to a |
| 5458 |
different model in \CONTEXT. Here are some examples, we also show an example of |
| 5459 |
\prm {mathdiscretionary} because that is what this code triggers: |
| 5460 |
|
| 5461 |
\startbuffer |
| 5462 |
test $ \dorecurse {50} { |
| 5463 |
a \discretionary class 2 {$\darkred +$}{$\darkgreen +$}{$\darkblue +$} |
| 5464 |
} b$ |
| 5465 |
|
| 5466 |
test $ a \mathdiscretionary class 1 {-}{-}{-} b$ |
| 5467 |
|
| 5468 |
\bgroup |
| 5469 |
\hmcode"002B=1 % + |
| 5470 |
\hmcode"002D=1 % - |
| 5471 |
\hmcode"2212=1 % - |
| 5472 |
test $ \dorecurse{50}{a + b - } c$ |
| 5473 |
\egroup |
| 5474 |
\stopbuffer |
| 5475 |
|
| 5476 |
\typebuffer |
| 5477 |
|
| 5478 |
{\setuptolerance[verytolerant,stretch]\getbuffer} |
| 5479 |
|
| 5480 |
\stopnewprimitive |
| 5481 |
|
| 5482 |
\startoldprimitive[title={\prm {holdinginserts}}] |
| 5483 |
|
| 5484 |
When set to a positive value inserts will be kept in the stream and not moved to |
| 5485 |
the insert registers. |
| 5486 |
|
| 5487 |
\stopoldprimitive |
| 5488 |
|
| 5489 |
\startnewprimitive[title={\prm {holdingmigrations}}] |
| 5490 |
|
| 5491 |
When set to a positive value marks (and adjusts) will be kept in the stream and |
| 5492 |
not moved to the outer level or related registers. |
| 5493 |
|
| 5494 |
\stopnewprimitive |
| 5495 |
|
| 5496 |
\startnewprimitive[title={\prm {hpack}}] |
| 5497 |
|
| 5498 |
This primitive is like \prm {hbox} but without the callback overhead. |
| 5499 |
|
| 5500 |
\stopnewprimitive |
| 5501 |
|
| 5502 |
\startnewprimitive[title={\prm {hpenalty}}] |
| 5503 |
|
| 5504 |
This primitive is like \prm {penalty} but will force the engine into horizontal |
| 5505 |
mode if it isn't yet. |
| 5506 |
|
| 5507 |
\stopnewprimitive |
| 5508 |
|
| 5509 |
\startoldprimitive[title={\prm {hrule}}] |
| 5510 |
|
| 5511 |
This creates a horizontal rule. Unless the width is set it will stretch to fix |
| 5512 |
the available width. In addition to the traditional \type {width}, \type {height} |
| 5513 |
and \type {depth} specifiers some more are accepted. These are discussed in other |
| 5514 |
manuals. To give an idea: |
| 5515 |
|
| 5516 |
\startbuffer |
| 5517 |
h\hrule width 10mm height 2mm depth 1mm \relax rule |
| 5518 |
h\hrule width 10mm height 2mm depth 1mm xoffset 30mm yoffset -10mm \relax rule |
| 5519 |
v\vrule width 10mm height 2mm depth 1mm \relax rule |
| 5520 |
v\vrule width 10mm height 2mm depth 1mm xoffset 30mm yoffset 10mm \relax rule |
| 5521 |
\stopbuffer |
| 5522 |
|
| 5523 |
\typebuffer |
| 5524 |
|
| 5525 |
The \prm {relax} stops scanning and because we have more keywords we get a |
| 5526 |
different error report than in traditional \TEX\ when a lookahead confuses the |
| 5527 |
engine. On separate lines we get the following. |
| 5528 |
|
| 5529 |
\startlines |
| 5530 |
\getbuffer |
| 5531 |
\stoplines |
| 5532 |
|
| 5533 |
\stopoldprimitive |
| 5534 |
|
| 5535 |
\startoldprimitive[title={\prm {hsize}}] |
| 5536 |
|
| 5537 |
This sets (or gets) the current horizontal size. |
| 5538 |
|
| 5539 |
\startbuffer |
| 5540 |
\hsize 40pt \setbox0\vbox{x} hsize: \the\wd0 |
| 5541 |
\setbox0\vbox{\hsize 40pt x} hsize: \the\wd0 |
| 5542 |
\stopbuffer |
| 5543 |
|
| 5544 |
\typebuffer |
| 5545 |
|
| 5546 |
In both cases we get the same size reported but the first one will also influence |
| 5547 |
the current paragraph when used ungrouped. |
| 5548 |
|
| 5549 |
\startlines |
| 5550 |
\getbuffer |
| 5551 |
\stoplines |
| 5552 |
|
| 5553 |
\stopoldprimitive |
| 5554 |
|
| 5555 |
\startoldprimitive[title={\prm {hskip}}] |
| 5556 |
|
| 5557 |
The given glue is injected in the horizontal list. If possible horizontal mode is |
| 5558 |
entered. |
| 5559 |
|
| 5560 |
\stopoldprimitive |
| 5561 |
|
| 5562 |
\startoldprimitive[title={\prm {hss}}] |
| 5563 |
|
| 5564 |
\startbuffer |
| 5565 |
x\hbox to 0pt{\hskip 0pt plus 1 fil minus 1 fil\relax test}x |
| 5566 |
x\hbox to 0pt{\hss test}x |
| 5567 |
x\hbox to 0pt{test\hskip 0pt plus 1 fil minus 1 fil\relax}x |
| 5568 |
x\hbox to 0pt{test\hss}x |
| 5569 |
\stopbuffer |
| 5570 |
|
| 5571 |
In traditional \TEX\ glue specifiers are shared. This makes a lot of sense when |
| 5572 |
memory has to be saved. For instance spaces in a paragraph of text are often the |
| 5573 |
same and a glue specification has at least an amount, stretch, shrink, stretch |
| 5574 |
order and shrink order field plus a leader pointer; in \LUAMETATEX\ we have even |
| 5575 |
more fields. In \LUATEX\ these shared (and therefore referenced) glue spec nodes |
| 5576 |
became just copies. |
| 5577 |
|
| 5578 |
\typebuffer |
| 5579 |
|
| 5580 |
The \prm {hss} primitives injects a glue node with one order stretch and one |
| 5581 |
order shrink. In traditional \TEX\ this is a reference to a shared specification, |
| 5582 |
and in \LUATEX\ just a copy of a predefined specifier. The only gain is now in |
| 5583 |
tokens because one could just be explicit or use a glue register with that value |
| 5584 |
because we have plenty glue registers. |
| 5585 |
|
| 5586 |
\startlines |
| 5587 |
\getbuffer |
| 5588 |
\stoplines |
| 5589 |
|
| 5590 |
We could have this: |
| 5591 |
|
| 5592 |
\starttyping |
| 5593 |
\permanent\protected\untraced\def\hss |
| 5594 |
{\hskip0pt plus 1 fil minus 1 fil\relax} |
| 5595 |
\stoptyping |
| 5596 |
|
| 5597 |
or this: |
| 5598 |
|
| 5599 |
\starttyping |
| 5600 |
\gluespecdef\hssglue 0pt plus 1 fil minus 1 fil |
| 5601 |
|
| 5602 |
\permanent\protected\untraced\def\hss |
| 5603 |
{\hskip\hssglue} |
| 5604 |
\stoptyping |
| 5605 |
|
| 5606 |
but we just keep the originals around. |
| 5607 |
|
| 5608 |
\stopoldprimitive |
| 5609 |
|
| 5610 |
\startoldprimitive[title={\prm {ht}}] |
| 5611 |
|
| 5612 |
Returns the height of the given box. |
| 5613 |
|
| 5614 |
\stopoldprimitive |
| 5615 |
|
| 5616 |
\startoldprimitive[title={\prm {hyphenation}}] |
| 5617 |
|
| 5618 |
The list passed to this primitive contains hyphenation exceptions that get bound |
| 5619 |
to the current language. In \LUAMETATEX\ this can be managed at the \LUA\ end. |
| 5620 |
Exceptions are not stored in the format file. |
| 5621 |
|
| 5622 |
\stopoldprimitive |
| 5623 |
|
| 5624 |
\startnewprimitive[title={\prm {hyphenationmin}}] |
| 5625 |
|
| 5626 |
This property (that also gets bond to the current language) sets the minimum |
| 5627 |
length of a word that gets hyphenated. |
| 5628 |
|
| 5629 |
\stopnewprimitive |
| 5630 |
|
| 5631 |
\startnewprimitive[title={\prm {hyphenationmode}}] |
| 5632 |
TODO |
| 5633 |
\stopnewprimitive |
| 5634 |
|
| 5635 |
\startoldprimitive[title={\prm {hyphenchar}}] |
| 5636 |
|
| 5637 |
This is one of the font related primitives: it returns the number of the hyphen |
| 5638 |
set in the given font. |
| 5639 |
|
| 5640 |
\stopoldprimitive |
| 5641 |
|
| 5642 |
\startoldprimitive[title={\prm {hyphenpenalty}}] |
| 5643 |
|
| 5644 |
Discretionary nodes have a related default penalty. The \prm {hyphenpenalty} is |
| 5645 |
injected after a regular discretionary, and \prm {exhyphenpenalty} after \type |
| 5646 |
{\-} or \type {-}. The later case is called an automatic discretionary. In |
| 5647 |
\LUAMETATEX\ we have two extra penalties: \prm {explicithyphenpenalty} and \prm |
| 5648 |
{automatichyphenpenalty} and these are used when the related bits are set in \prm |
| 5649 |
{hyphenationmode}. |
| 5650 |
|
| 5651 |
\stopoldprimitive |
| 5652 |
|
| 5653 |
\startoldprimitive[title={\prm {if}}] |
| 5654 |
|
| 5655 |
This traditional \TEX\ conditional checks if two character codes are the same. In |
| 5656 |
order to understand unexpanded results it is good to know that internally \TEX\ |
| 5657 |
groups primitives in a way that serves the implementation. Each primitive has a |
| 5658 |
command code and a character code, but only for real characters the name |
| 5659 |
character code makes sense. This condition only really tests for character codes |
| 5660 |
when we have a character, in all other cases, the result is true. |
| 5661 |
|
| 5662 |
\startbuffer |
| 5663 |
\def\A{A}\def\B{B} \chardef\C=`C \chardef\D=`D \def\AA{AA} |
| 5664 |
|
| 5665 |
[\if AA YES \else NOP \fi] [\if AB YES \else NOP \fi] |
| 5666 |
[\if \A\B YES \else NOP \fi] [\if \A\A YES \else NOP \fi] |
| 5667 |
[\if \C\D YES \else NOP \fi] [\if \C\C YES \else NOP \fi] |
| 5668 |
[\if \count\dimen YES \else NOP \fi] [\if \AA\A YES \else NOP \fi] |
| 5669 |
|
| 5670 |
\stopbuffer |
| 5671 |
|
| 5672 |
\typebuffer |
| 5673 |
|
| 5674 |
The last example demonstrates that the tokens get expanded, which is why |
| 5675 |
we get the extra \type {A}: |
| 5676 |
|
| 5677 |
{\getbuffer} |
| 5678 |
|
| 5679 |
\stopoldprimitive |
| 5680 |
|
| 5681 |
\startnewprimitive[title={\prm {ifabsdim}}] |
| 5682 |
|
| 5683 |
This test will negate negative dimensions before comparison, as in: |
| 5684 |
|
| 5685 |
\startbuffer |
| 5686 |
\def\TestA#1{\ifdim #1<2pt too small\orelse\ifdim #1>4pt too large\else okay\fi} |
| 5687 |
\def\TestB#1{\ifabsdim#1<2pt too small\orelse\ifabsdim#1>4pt too large\else okay\fi} |
| 5688 |
|
| 5689 |
\TestA {1pt}\quad\TestA {3pt}\quad\TestA {5pt}\crlf |
| 5690 |
\TestB {1pt}\quad\TestB {3pt}\quad\TestB {5pt}\crlf |
| 5691 |
\TestB{-1pt}\quad\TestB{-3pt}\quad\TestB{-5pt}\par |
| 5692 |
\stopbuffer |
| 5693 |
|
| 5694 |
\typebuffer |
| 5695 |
|
| 5696 |
So we get this: |
| 5697 |
|
| 5698 |
{\getbuffer} |
| 5699 |
|
| 5700 |
\stopnewprimitive |
| 5701 |
|
| 5702 |
\startnewprimitive[title={\prm {ifabsfloat}}] |
| 5703 |
|
| 5704 |
This test will negate negative floats before comparison, as in: |
| 5705 |
|
| 5706 |
\startbuffer |
| 5707 |
\def\TestA#1{\iffloat #1<2.46 small\orelse\iffloat #1>4.68 large\else medium\fi} |
| 5708 |
\def\TestB#1{\ifabsfloat#1<2.46 small\orelse\ifabsfloat#1>4.68 large\else medium\fi} |
| 5709 |
|
| 5710 |
\TestA {1.23}\quad\TestA {3.45}\quad\TestA {5.67}\crlf |
| 5711 |
\TestB {1.23}\quad\TestB {3.45}\quad\TestB {5.67}\crlf |
| 5712 |
\TestB{-1.23}\quad\TestB{-3.45}\quad\TestB{-5.67}\par |
| 5713 |
\stopbuffer |
| 5714 |
|
| 5715 |
\typebuffer |
| 5716 |
|
| 5717 |
So we get this: |
| 5718 |
|
| 5719 |
{\getbuffer} |
| 5720 |
|
| 5721 |
\stopnewprimitive |
| 5722 |
|
| 5723 |
\startnewprimitive[title={\prm {ifabsnum}}] |
| 5724 |
|
| 5725 |
This test will negate negative numbers before comparison, as in: |
| 5726 |
|
| 5727 |
\startbuffer |
| 5728 |
\def\TestA#1{\ifnum #1<100 too small\orelse\ifnum #1>200 too large\else okay\fi} |
| 5729 |
\def\TestB#1{\ifabsnum#1<100 too small\orelse\ifabsnum#1>200 too large\else okay\fi} |
| 5730 |
|
| 5731 |
\TestA {10}\quad\TestA {150}\quad\TestA {210}\crlf |
| 5732 |
\TestB {10}\quad\TestB {150}\quad\TestB {210}\crlf |
| 5733 |
\TestB{-10}\quad\TestB{-150}\quad\TestB{-210}\par |
| 5734 |
\stopbuffer |
| 5735 |
|
| 5736 |
\typebuffer |
| 5737 |
|
| 5738 |
Here we get the same result each time: |
| 5739 |
|
| 5740 |
{\getbuffer} |
| 5741 |
|
| 5742 |
\stopnewprimitive |
| 5743 |
|
| 5744 |
\startnewprimitive[title={\prm {ifarguments}}] |
| 5745 |
|
| 5746 |
This is a variant of \prm {ifcase} were the selector is the number of arguments |
| 5747 |
picked up. For example: |
| 5748 |
|
| 5749 |
\startbuffer |
| 5750 |
\def\MyMacro#1#2#3{\ifarguments\0\or1\or2\or3\else ?\fi} \MyMacro{A}{B}{C} |
| 5751 |
\def\MyMacro#1#0#3{\ifarguments\0\or1\or2\or3\else ?\fi} \MyMacro{A}{B}{C} |
| 5752 |
\def\MyMacro#1#-#2{\ifarguments\0\or1\or2\or3\else ?\fi} \MyMacro{A}{B}{C}\par |
| 5753 |
\stopbuffer |
| 5754 |
|
| 5755 |
\typebuffer |
| 5756 |
|
| 5757 |
Watch the non counted, ignored, argument in the last case. Normally this test will |
| 5758 |
be used in combination with \prm {ignorearguments}. |
| 5759 |
|
| 5760 |
{\getbuffer} |
| 5761 |
|
| 5762 |
\stopnewprimitive |
| 5763 |
|
| 5764 |
\startnewprimitive[title={\prm {ifboolean}}] |
| 5765 |
|
| 5766 |
This tests a number (register or equivalent) and any nonzero value represents |
| 5767 |
\type {true}, which is nicer than using an \type {\unless \ifcase}. |
| 5768 |
|
| 5769 |
\stopnewprimitive |
| 5770 |
|
| 5771 |
\startoldprimitive[title={\prm {ifcase}}] |
| 5772 |
|
| 5773 |
This numeric \TEX\ conditional takes a counter (literal, register, shortcut to a |
| 5774 |
character, internal quantity) and goes to the branch that matches. |
| 5775 |
|
| 5776 |
\startbuffer |
| 5777 |
\ifcase 3 zero\or one\or two\or three\or four\else five or more\fi |
| 5778 |
\stopbuffer |
| 5779 |
|
| 5780 |
\typebuffer |
| 5781 |
|
| 5782 |
Indeed: \inlinebuffer\ equals three. In later sections we will see some |
| 5783 |
\LUAMETATEX\ primitives that behave like an \prm {ifcase}. |
| 5784 |
|
| 5785 |
\stopoldprimitive |
| 5786 |
|
| 5787 |
\startoldprimitive[title={\prm {ifcat}}] |
| 5788 |
|
| 5789 |
Another traditional \TEX\ primitive: what happens with what gets read in depends |
| 5790 |
on the catcode of a character, think of characters marked to start math mode, or |
| 5791 |
alphabetic characters (letters) versus other characters (like punctuation). |
| 5792 |
|
| 5793 |
\startbuffer |
| 5794 |
\def\A{A}\def\B{,} \chardef\C=`C \chardef\D=`, \def\AA{AA} |
| 5795 |
|
| 5796 |
[\ifcat $! YES \else NOP \fi] [\ifcat () YES \else NOP \fi] |
| 5797 |
[\ifcat AA YES \else NOP \fi] [\ifcat AB YES \else NOP \fi] |
| 5798 |
[\ifcat \A\B YES \else NOP \fi] [\ifcat \A\A YES \else NOP \fi] |
| 5799 |
[\ifcat \C\D YES \else NOP \fi] [\ifcat \C\C YES \else NOP \fi] |
| 5800 |
[\ifcat \count\dimen YES \else NOP \fi] [\ifcat \AA\A YES \else NOP \fi] |
| 5801 |
\stopbuffer |
| 5802 |
|
| 5803 |
\typebuffer |
| 5804 |
|
| 5805 |
Close reading is needed here: |
| 5806 |
|
| 5807 |
{\getbuffer} |
| 5808 |
|
| 5809 |
This traditional \TEX\ condition as a well as the one in the previous section are |
| 5810 |
hardly used in \CONTEXT, if only because they expand what follows and we seldom |
| 5811 |
need to compare characters. |
| 5812 |
|
| 5813 |
\stopoldprimitive |
| 5814 |
|
| 5815 |
\startnewprimitive[title={\prm {ifchkdim}}] |
| 5816 |
|
| 5817 |
A variant on the checker in the previous section is a dimension checker: |
| 5818 |
|
| 5819 |
\startbuffer |
| 5820 |
\ifchkdim oeps \or okay\else error\fi\quad |
| 5821 |
\ifchkdim 12 \or okay\else error\fi\quad |
| 5822 |
\ifchkdim 12pt \or okay\else error\fi\quad |
| 5823 |
\ifchkdim 12pt or more\or okay\else error\fi |
| 5824 |
\stopbuffer |
| 5825 |
|
| 5826 |
\typebuffer |
| 5827 |
|
| 5828 |
We get: |
| 5829 |
|
| 5830 |
{\getbuffer} |
| 5831 |
|
| 5832 |
\stopnewprimitive |
| 5833 |
|
| 5834 |
\startnewprimitive[title={\prm {ifchkdimension}}] |
| 5835 |
|
| 5836 |
COntrary to \prm {ifchkdim} this test doesn't accept trailing crap: |
| 5837 |
|
| 5838 |
\startbuffer |
| 5839 |
\ifchkdimension oeps \or okay\else error\fi\quad |
| 5840 |
\ifchkdimension 12 \or okay\else error\fi\quad |
| 5841 |
\ifchkdimension 12pt \or okay\else error\fi\quad |
| 5842 |
\ifchkdimension 12pt or more\or okay\else error\fi |
| 5843 |
\stopbuffer |
| 5844 |
|
| 5845 |
\typebuffer |
| 5846 |
|
| 5847 |
reports: |
| 5848 |
|
| 5849 |
{\getbuffer} |
| 5850 |
|
| 5851 |
\stopnewprimitive |
| 5852 |
|
| 5853 |
\startnewprimitive[title={\prm {ifchkdimexpr}}] |
| 5854 |
|
| 5855 |
This primitive is like \prm {ifchkdim} but handles an expression. |
| 5856 |
|
| 5857 |
\stopnewprimitive |
| 5858 |
|
| 5859 |
\startnewprimitive[title={\prm {ifchknum}}] |
| 5860 |
|
| 5861 |
In \CONTEXT\ there are quite some cases where a variable can have a number or a |
| 5862 |
keyword indicating a symbolic name of a number or maybe even some special |
| 5863 |
treatment. Checking if a valid number is given is possible to some extend, but a |
| 5864 |
native checker makes much sense too. So here is one: |
| 5865 |
|
| 5866 |
\startbuffer |
| 5867 |
\ifchknum oeps \or okay\else error\fi\quad |
| 5868 |
\ifchknum 12 \or okay\else error\fi\quad |
| 5869 |
\ifchknum 12pt \or okay\else error\fi\quad |
| 5870 |
\ifchknum 12pt or more\or okay\else error\fi |
| 5871 |
\stopbuffer |
| 5872 |
|
| 5873 |
\typebuffer |
| 5874 |
|
| 5875 |
The result is as expected: |
| 5876 |
|
| 5877 |
{\getbuffer} |
| 5878 |
|
| 5879 |
\stopnewprimitive |
| 5880 |
|
| 5881 |
\startnewprimitive[title={\prm {ifchknumber}}] |
| 5882 |
|
| 5883 |
This check is more restrictive than \prm {ifchknum} discussed in the previous |
| 5884 |
section: |
| 5885 |
|
| 5886 |
\startbuffer |
| 5887 |
\ifchknumber oeps \or okay\else error\fi\quad |
| 5888 |
\ifchknumber 12 \or okay\else error\fi\quad |
| 5889 |
\ifchknumber 12pt \or okay\else error\fi\quad |
| 5890 |
\ifchknumber 12pt or more\or okay\else error\fi |
| 5891 |
\stopbuffer |
| 5892 |
|
| 5893 |
\typebuffer |
| 5894 |
|
| 5895 |
Here we get: |
| 5896 |
|
| 5897 |
{\getbuffer} |
| 5898 |
|
| 5899 |
\stopnewprimitive |
| 5900 |
|
| 5901 |
\startnewprimitive[title={\prm {ifchknumexpr}}] |
| 5902 |
|
| 5903 |
This primitive is like \prm {ifchknum} but handles an expression. |
| 5904 |
|
| 5905 |
\stopnewprimitive |
| 5906 |
|
| 5907 |
\startnewprimitive[title={\prm {ifcmpdim}}] |
| 5908 |
|
| 5909 |
This is a less strict veriant of \prm {ifchkdimension} that doesn't bark on |
| 5910 |
trailing tokens. |
| 5911 |
|
| 5912 |
\stopnewprimitive |
| 5913 |
|
| 5914 |
\startnewprimitive[title={\prm {ifcmpnum}}] |
| 5915 |
|
| 5916 |
This is a less strict veriant of \prm {ifchknumber} that doesn't bark on |
| 5917 |
trailing tokens. |
| 5918 |
|
| 5919 |
\stopnewprimitive |
| 5920 |
|
| 5921 |
\startnewprimitive[title={\prm {ifcondition}}] |
| 5922 |
|
| 5923 |
The conditionals in \TEX\ are hard coded as primitives and although it might |
| 5924 |
look like \type {\newif} creates one, it actually just defined three macros. |
| 5925 |
|
| 5926 |
\startbuffer |
| 5927 |
\newif\ifMyTest |
| 5928 |
\meaning\MyTesttrue \crlf |
| 5929 |
\meaning\MyTestfalse \crlf |
| 5930 |
\meaning\ifMyTest \crlf \MyTesttrue |
| 5931 |
\meaning\ifMyTest \par |
| 5932 |
\stopbuffer |
| 5933 |
|
| 5934 |
\typebuffer {\tttf \getbuffer} |
| 5935 |
|
| 5936 |
This means that when you say: |
| 5937 |
|
| 5938 |
\starttyping |
| 5939 |
\ifMytest ... \else ... \fi |
| 5940 |
\stoptyping |
| 5941 |
|
| 5942 |
You actually have one of: |
| 5943 |
|
| 5944 |
\starttyping |
| 5945 |
\iftrue ... \else ... \fi |
| 5946 |
\iffalse ... \else ... \fi |
| 5947 |
\stoptyping |
| 5948 |
|
| 5949 |
and because these are proper conditions nesting them like: |
| 5950 |
|
| 5951 |
\starttyping |
| 5952 |
\ifnum\scratchcounter > 0 \ifMyTest A\else B\fi \fi |
| 5953 |
\stoptyping |
| 5954 |
|
| 5955 |
will work out well too. This is not true for macros, so for instance: |
| 5956 |
|
| 5957 |
\starttyping |
| 5958 |
\scratchcounter = 1 |
| 5959 |
\unexpanded\def\ifMyTest{\iftrue} |
| 5960 |
\ifnum\scratchcounter > 0 \ifMyTest A\else B\fi \fi |
| 5961 |
\stoptyping |
| 5962 |
|
| 5963 |
will make a run fail with an error (or simply loop forever, depending on your |
| 5964 |
code). This is where \prm {ifcondition} enters the picture: |
| 5965 |
|
| 5966 |
\starttyping |
| 5967 |
\def\MyTest{\iftrue} \scratchcounter0 |
| 5968 |
\ifnum\scratchcounter > 0 |
| 5969 |
\ifcondition\MyTest A\else B\fi |
| 5970 |
\else |
| 5971 |
x |
| 5972 |
\fi |
| 5973 |
\stoptyping |
| 5974 |
|
| 5975 |
This primitive is seen as a proper condition when \TEX\ is in \quotation {fast |
| 5976 |
skipping unused branches} mode but when it is expanding a branch, it checks if |
| 5977 |
the next expanded token is a proper tests and if so, it deals with that test, |
| 5978 |
otherwise it fails. The main condition here is that the \type {\MyTest} macro |
| 5979 |
expands to a proper true or false test, so, a definition like: |
| 5980 |
|
| 5981 |
\starttyping |
| 5982 |
\def\MyTest{\ifnum\scratchcounter<10 } |
| 5983 |
\stoptyping |
| 5984 |
|
| 5985 |
is also okay. Now, is that neat or not? |
| 5986 |
|
| 5987 |
\stopnewprimitive |
| 5988 |
|
| 5989 |
\startnewprimitive[title={\prm {ifcramped}}] |
| 5990 |
|
| 5991 |
Depending on the given math style this returns true of false: |
| 5992 |
|
| 5993 |
\startbuffer |
| 5994 |
\ifcramped\mathstyle no \fi |
| 5995 |
\ifcramped\crampedtextstyle yes \fi |
| 5996 |
\ifcramped\textstyle no \fi |
| 5997 |
\ifcramped\displaystyle yes \fi |
| 5998 |
\stopbuffer |
| 5999 |
|
| 6000 |
\typebuffer |
| 6001 |
|
| 6002 |
gives: \inlinebuffer. |
| 6003 |
|
| 6004 |
\stopnewprimitive |
| 6005 |
|
| 6006 |
\startoldprimitive[title={\prm {ifcsname}}] |
| 6007 |
|
| 6008 |
This is an \ETEX\ conditional that complements the one on the previous section: |
| 6009 |
|
| 6010 |
\starttyping |
| 6011 |
\expandafter\ifx\csname MyMacro\endcsname\relax ... \else ... \fi |
| 6012 |
\ifcsname MyMacro\endcsname ... \else ... \fi |
| 6013 |
\stoptyping |
| 6014 |
|
| 6015 |
Here the first one has the side effect of defining the macro and defaulting it to |
| 6016 |
\prm {relax}, while the second one doesn't do that. Just think of checking a |
| 6017 |
few million different names: the first one will deplete the hash table and |
| 6018 |
probably string space too. |
| 6019 |
|
| 6020 |
In \LUAMETATEX\ the construction stops when there is no letter or other character |
| 6021 |
seen (\TEX\ expands on the go so expandable macros are dealt with). Instead of an |
| 6022 |
error message, the match is simply false and all tokens till the \prm |
| 6023 |
{endcsname} are gobbled. |
| 6024 |
|
| 6025 |
\stopoldprimitive |
| 6026 |
|
| 6027 |
\startnewprimitive[title={\prm {ifcstok}}] |
| 6028 |
|
| 6029 |
A variant on the primitive mentioned in the previous section is one that |
| 6030 |
operates on lists and macros: |
| 6031 |
|
| 6032 |
\startbuffer[a] |
| 6033 |
\def\a{a} \def\b{b} \def\c{a} |
| 6034 |
\stopbuffer |
| 6035 |
|
| 6036 |
\typebuffer[a] |
| 6037 |
|
| 6038 |
\startbuffer[b] |
| 6039 |
\ifcstok\a\b Y\else N\fi\space |
| 6040 |
\ifcstok\a\c Y\else N\fi\space |
| 6041 |
\ifcstok{\a}\c Y\else N\fi\space |
| 6042 |
\ifcstok{a}\c Y\else N\fi |
| 6043 |
\stopbuffer |
| 6044 |
|
| 6045 |
This: |
| 6046 |
|
| 6047 |
\typebuffer[b] |
| 6048 |
|
| 6049 |
{\getbuffer[a]will give us: \inlinebuffer[b].} |
| 6050 |
|
| 6051 |
\stopnewprimitive |
| 6052 |
|
| 6053 |
\startoldprimitive[title={\prm {ifdefined}}] |
| 6054 |
|
| 6055 |
In traditional \TEX\ checking for a macro to exist was a bit tricky and therefore |
| 6056 |
\ETEX\ introduced a convenient conditional. We can do this: |
| 6057 |
|
| 6058 |
\starttyping |
| 6059 |
\ifx\MyMacro\undefined ... \else ... \fi |
| 6060 |
\stoptyping |
| 6061 |
|
| 6062 |
but that assumes that \type {\undefined} is indeed undefined. Another test often |
| 6063 |
seen was this: |
| 6064 |
|
| 6065 |
\starttyping |
| 6066 |
\expandafter\ifx\csname MyMacro\endcsname\relax ... \else ... \fi |
| 6067 |
\stoptyping |
| 6068 |
|
| 6069 |
Instead of comparing with \type {\undefined} we need to check with \prm {relax} |
| 6070 |
because the control sequence is defined when not yet present and defaults to |
| 6071 |
\prm {relax}. This is not pretty. |
| 6072 |
|
| 6073 |
\stopoldprimitive |
| 6074 |
|
| 6075 |
\startoldprimitive[title={\prm {ifdim}}] |
| 6076 |
|
| 6077 |
Dimensions can be compared with this traditional \TEX\ primitive. |
| 6078 |
|
| 6079 |
\startbuffer |
| 6080 |
\scratchdimen=1pt \scratchcounter=65536 |
| 6081 |
|
| 6082 |
\ifdim\scratchdimen=\scratchcounter sp YES \else NOP\fi |
| 6083 |
\ifdim\scratchdimen=1 pt YES \else NOP\fi |
| 6084 |
\stopbuffer |
| 6085 |
|
| 6086 |
\typebuffer |
| 6087 |
|
| 6088 |
The units are mandate: |
| 6089 |
|
| 6090 |
{\getbuffer} |
| 6091 |
|
| 6092 |
\stopoldprimitive |
| 6093 |
|
| 6094 |
\startnewprimitive[title={\prm {ifdimexpression}}] |
| 6095 |
|
| 6096 |
The companion of the previous primitive is: |
| 6097 |
|
| 6098 |
\startbuffer |
| 6099 |
\ifdimexpression 10pt > 10bp \relax |
| 6100 |
do-something |
| 6101 |
\fi |
| 6102 |
\stopbuffer |
| 6103 |
|
| 6104 |
This matches when the result is non zero, and you can mix calculations and tests |
| 6105 |
as with normal expressions. Contrary to the number variant units can be used and |
| 6106 |
precision kicks in. |
| 6107 |
|
| 6108 |
\stopnewprimitive |
| 6109 |
|
| 6110 |
\startnewprimitive[title={\prm {ifdimval}}] |
| 6111 |
|
| 6112 |
This conditional is a variant on \prm {ifchkdim} and provides some more |
| 6113 |
detailed information about the value: |
| 6114 |
|
| 6115 |
\startbuffer |
| 6116 |
[-12pt : \ifdimval-12pt\or negative\or zero\or positive\else error\fi]\quad |
| 6117 |
[0pt : \ifdimval 0pt\or negative\or zero\or positive\else error\fi]\quad |
| 6118 |
[12pt : \ifdimval 12pt\or negative\or zero\or positive\else error\fi]\quad |
| 6119 |
[oeps : \ifdimval oeps\or negative\or zero\or positive\else error\fi] |
| 6120 |
\stopbuffer |
| 6121 |
|
| 6122 |
\typebuffer |
| 6123 |
|
| 6124 |
This gives: |
| 6125 |
|
| 6126 |
{\getbuffer} |
| 6127 |
|
| 6128 |
\stopnewprimitive |
| 6129 |
|
| 6130 |
\startnewprimitive[title={\prm {ifempty}}] |
| 6131 |
|
| 6132 |
This conditional checks if a control sequence is empty: |
| 6133 |
|
| 6134 |
\starttyping |
| 6135 |
is \ifempty\MyMacro \else not \fi empty |
| 6136 |
\stoptyping |
| 6137 |
|
| 6138 |
It is basically a shortcut of: |
| 6139 |
|
| 6140 |
\starttyping |
| 6141 |
is \ifx\MyMacro\empty \else not \fi empty |
| 6142 |
\stoptyping |
| 6143 |
|
| 6144 |
with: |
| 6145 |
|
| 6146 |
\starttyping |
| 6147 |
\def\empty{} |
| 6148 |
\stoptyping |
| 6149 |
|
| 6150 |
Of course this is not empty at all: |
| 6151 |
|
| 6152 |
\starttyping |
| 6153 |
\def\notempty#1{} |
| 6154 |
\stoptyping |
| 6155 |
|
| 6156 |
\stopnewprimitive |
| 6157 |
|
| 6158 |
\startoldprimitive[title={\prm {iffalse}}] |
| 6159 |
|
| 6160 |
Here we have a traditional \TEX\ conditional that is always false (therefore the |
| 6161 |
same is true for any macro that is \prm {let} to this primitive). |
| 6162 |
|
| 6163 |
\stopoldprimitive |
| 6164 |
|
| 6165 |
\startnewprimitive[title={\prm {ifflags}}] |
| 6166 |
|
| 6167 |
This test primitive relates to the various flags that one can set on a control |
| 6168 |
sequence in the perspective of overload protection and classification. |
| 6169 |
|
| 6170 |
\startbuffer |
| 6171 |
\protected\untraced\tolerant\def\foo[#1]{...#1...} |
| 6172 |
\permanent\constant \def\oof{okay} |
| 6173 |
\stopbuffer |
| 6174 |
|
| 6175 |
\typebuffer |
| 6176 |
|
| 6177 |
\start \getbuffer |
| 6178 |
\starttabulate[|l|c|c|l|c|c|] |
| 6179 |
\FL |
| 6180 |
\NC flag \NC \type {\foo} \NC \type {\oof} |
| 6181 |
\NC flag \NC \type {\foo} \NC \type {\oof} \NC \NR |
| 6182 |
\ML |
| 6183 |
\NC frozen \NC \ifflags\foo\frozen Y\else N\fi \NC \ifflags\oof\frozen Y\else N\fi |
| 6184 |
\NC permanent \NC \ifflags\foo\permanent Y\else N\fi \NC \ifflags\oof\permanent Y\else N\fi \NC \NR |
| 6185 |
\NC immutable \NC \ifflags\foo\immutable Y\else N\fi \NC \ifflags\oof\immutable Y\else N\fi |
| 6186 |
\NC mutable \NC \ifflags\foo\mutable Y\else N\fi \NC \ifflags\oof\mutable Y\else N\fi \NC \NR |
| 6187 |
\NC noaligned \NC \ifflags\foo\noaligned Y\else N\fi \NC \ifflags\oof\noaligned Y\else N\fi |
| 6188 |
\NC instance \NC \ifflags\foo\instance Y\else N\fi \NC \ifflags\oof\instance Y\else N\fi \NC \NR |
| 6189 |
\NC untraced \NC \ifflags\foo\untraced Y\else N\fi \NC \ifflags\oof\untraced Y\else N\fi |
| 6190 |
\NC global \NC \ifflags\foo\global Y\else N\fi \NC \ifflags\oof\global Y\else N\fi \NC \NR |
| 6191 |
\NC tolerant \NC \ifflags\foo\tolerant Y\else N\fi \NC \ifflags\oof\tolerant Y\else N\fi |
| 6192 |
\NC constant \NC \ifflags\foo\constant Y\else N\fi \NC \ifflags\oof\constant Y\else N\fi \NC \NR |
| 6193 |
\NC protected \NC \ifflags\foo\protected Y\else N\fi \NC \ifflags\oof\protected Y\else N\fi |
| 6194 |
\NC semiprotected \NC \ifflags\foo\semiprotected Y\else N\fi \NC \ifflags\oof\semiprotected Y\else N\fi \NC \NR |
| 6195 |
\LL |
| 6196 |
\stoptabulate |
| 6197 |
\stop |
| 6198 |
|
| 6199 |
Instead of checking against a prefix you can test against a bitset made from: |
| 6200 |
|
| 6201 |
\startluacode |
| 6202 |
context.starttabulate { "|r|l|r|l|r|l|r|l|" } |
| 6203 |
local n = 4 |
| 6204 |
for k, v in table.sortedhash(tex.flagcodes) do |
| 6205 |
if tonumber(k) then |
| 6206 |
n = n - 1 |
| 6207 |
context.NC() context("0x%X",k) |
| 6208 |
context.NC() context(v) |
| 6209 |
if n == 0 then |
| 6210 |
context.NC() |
| 6211 |
context.NR() |
| 6212 |
n = 4 |
| 6213 |
end |
| 6214 |
end |
| 6215 |
end |
| 6216 |
context.stoptabulate() |
| 6217 |
\stopluacode |
| 6218 |
|
| 6219 |
\stopnewprimitive |
| 6220 |
|
| 6221 |
\startnewprimitive[title={\prm {iffloat}}] |
| 6222 |
|
| 6223 |
This test does for floats what \prm {ifnum}, \prm {ifdim} do for numbers and |
| 6224 |
dimensions: comparing two of them. |
| 6225 |
|
| 6226 |
\stopnewprimitive |
| 6227 |
|
| 6228 |
\startoldprimitive[title={\prm {iffontchar}}] |
| 6229 |
|
| 6230 |
This is an \ETEX\ conditional. It takes a font identifier and a character number. |
| 6231 |
In modern fonts simply checking could not be enough because complex font features |
| 6232 |
can swap in other ones and their index can be anything. Also, a font mechanism |
| 6233 |
can provide fallback fonts and characters, so don't rely on this one too much. It |
| 6234 |
just reports true when the font passed to the frontend has a slot filled. |
| 6235 |
|
| 6236 |
\stopoldprimitive |
| 6237 |
|
| 6238 |
\startnewprimitive[title={\prm {ifhaschar}}] |
| 6239 |
|
| 6240 |
This one is a simplified variant of the above: |
| 6241 |
|
| 6242 |
\startbuffer |
| 6243 |
\ifhaschar !{this ! works} yes \else no \fi |
| 6244 |
\stopbuffer |
| 6245 |
|
| 6246 |
\typebuffer |
| 6247 |
|
| 6248 |
and indeed we get: \inlinebuffer ! Of course the spaces in this this example |
| 6249 |
code are normally not present in such a test. |
| 6250 |
|
| 6251 |
\stopnewprimitive |
| 6252 |
|
| 6253 |
\startnewprimitive[title={\prm {ifhastok}}] |
| 6254 |
|
| 6255 |
This conditional looks for occurrences in token lists where each argument has to |
| 6256 |
be a proper list. |
| 6257 |
|
| 6258 |
\startbuffer |
| 6259 |
\def\scratchtoks{x} |
| 6260 |
|
| 6261 |
\ifhastoks{yz} {xyz} Y\else N\fi\quad |
| 6262 |
\ifhastoks\scratchtoks {xyz} Y\else N\fi |
| 6263 |
\stopbuffer |
| 6264 |
|
| 6265 |
\typebuffer |
| 6266 |
|
| 6267 |
We get: |
| 6268 |
|
| 6269 |
{\getbuffer} |
| 6270 |
|
| 6271 |
\stopnewprimitive |
| 6272 |
|
| 6273 |
\startnewprimitive[title={\prm {ifhastoks}}] |
| 6274 |
|
| 6275 |
This test compares two token lists. When a macro is passed it's meaning |
| 6276 |
gets used. |
| 6277 |
|
| 6278 |
\startbuffer |
| 6279 |
\def\x {x} |
| 6280 |
\def\xyz{xyz} |
| 6281 |
|
| 6282 |
(\ifhastoks {x} {xyz}Y\else N\fi)\quad |
| 6283 |
(\ifhastoks {\x} {xyz}Y\else N\fi)\quad |
| 6284 |
(\ifhastoks \x {xyz}Y\else N\fi)\quad |
| 6285 |
(\ifhastoks {y} {xyz}Y\else N\fi)\quad |
| 6286 |
(\ifhastoks {yz} {xyz}Y\else N\fi)\quad |
| 6287 |
(\ifhastoks {yz} {\xyz}Y\else N\fi) |
| 6288 |
\stopbuffer |
| 6289 |
|
| 6290 |
\typebuffer {\getbuffer} |
| 6291 |
|
| 6292 |
\stopnewprimitive |
| 6293 |
|
| 6294 |
\startnewprimitive[title={\prm {ifhasxtoks}}] |
| 6295 |
|
| 6296 |
This primitive is like the one in the previous section but this time the |
| 6297 |
given lists are expanded. |
| 6298 |
|
| 6299 |
\startbuffer |
| 6300 |
\def\x {x} |
| 6301 |
\def\xyz{\x yz} |
| 6302 |
|
| 6303 |
(\ifhasxtoks {x} {xyz}Y\else N\fi)\quad |
| 6304 |
(\ifhasxtoks {\x} {xyz}Y\else N\fi)\quad |
| 6305 |
(\ifhastoks \x {xyz}Y\else N\fi)\quad |
| 6306 |
(\ifhasxtoks {y} {xyz}Y\else N\fi)\quad |
| 6307 |
(\ifhasxtoks {yz} {xyz}Y\else N\fi)\quad |
| 6308 |
(\ifhasxtoks {yz} {\xyz}Y\else N\fi) |
| 6309 |
\stopbuffer |
| 6310 |
|
| 6311 |
\typebuffer {\getbuffer} |
| 6312 |
|
| 6313 |
This primitive has some special properties. |
| 6314 |
|
| 6315 |
\startbuffer |
| 6316 |
\edef\+{\expandtoken 9 `+} |
| 6317 |
|
| 6318 |
\ifhasxtoks {xy} {xyz}Y\else N\fi\quad |
| 6319 |
\ifhasxtoks {x\+y} {xyz}Y\else N\fi |
| 6320 |
\stopbuffer |
| 6321 |
|
| 6322 |
\typebuffer |
| 6323 |
|
| 6324 |
Here the first argument has a token that has category code \quote {ignore} which |
| 6325 |
means that such a character will be skipped when seen. So the result is: |
| 6326 |
|
| 6327 |
{\getbuffer} |
| 6328 |
|
| 6329 |
This permits checks like these: |
| 6330 |
|
| 6331 |
\startbuffer |
| 6332 |
\edef\,{\expandtoken 9 `,} |
| 6333 |
|
| 6334 |
\ifhasxtoks{\,x\,} {,x,y,z,}Y\else N\fi\quad |
| 6335 |
\ifhasxtoks{\,y\,} {,x,y,z,}Y\else N\fi\quad |
| 6336 |
\ifhasxtoks{\,z\,} {,x,y,z,}Y\else N\fi\quad |
| 6337 |
\ifhasxtoks{\,x\,} {,xy,z,}Y\else N\fi |
| 6338 |
\stopbuffer |
| 6339 |
|
| 6340 |
\typebuffer |
| 6341 |
|
| 6342 |
I admit that it needs a bit of a twisted mind to come up with this, but it works |
| 6343 |
ok: |
| 6344 |
|
| 6345 |
{\getbuffer} |
| 6346 |
|
| 6347 |
\stopnewprimitive |
| 6348 |
|
| 6349 |
\startoldprimitive[title={\prm {ifhbox}}] |
| 6350 |
|
| 6351 |
This traditional conditional checks if a given box register or internal box |
| 6352 |
variable represents a horizontal box, |
| 6353 |
|
| 6354 |
\stopoldprimitive |
| 6355 |
|
| 6356 |
\startoldprimitive[title={\prm {ifhmode}}] |
| 6357 |
|
| 6358 |
This traditional conditional checks we are in (restricted) horizontal mode. |
| 6359 |
|
| 6360 |
\stopoldprimitive |
| 6361 |
|
| 6362 |
\startnewprimitive[title={\prm {ifinalignment}}] |
| 6363 |
|
| 6364 |
As the name indicates, this primitive tests for being in an alignment. Roughly |
| 6365 |
spoken, the engine is either in a state of align, handling text or dealing with |
| 6366 |
math. |
| 6367 |
|
| 6368 |
\stopnewprimitive |
| 6369 |
|
| 6370 |
\startnewprimitive[title={\prm {ifincsname}}] |
| 6371 |
|
| 6372 |
This conditional is sort of obsolete and can be used to check if we're inside a |
| 6373 |
\prm {csname} or \prm {ifcsname} construction. It's not used in \CONTEXT. |
| 6374 |
|
| 6375 |
\stopnewprimitive |
| 6376 |
|
| 6377 |
\startoldprimitive[title={\prm {ifinner}}] |
| 6378 |
|
| 6379 |
This traditional one can be confusing. It is true when we are in restricted |
| 6380 |
horizontal mode (a box), internal vertical mode (a box), or inline math mode. |
| 6381 |
|
| 6382 |
\startbuffer |
| 6383 |
test \ifhmode \ifinner INNER\fi HMODE\fi\crlf |
| 6384 |
\hbox{test \ifhmode \ifinner INNER \fi HMODE\fi} \par |
| 6385 |
|
| 6386 |
\ifvmode \ifinner INNER\fi VMODE \fi\crlf |
| 6387 |
\vbox{\ifvmode \ifinner INNER \fi VMODE\fi} \crlf |
| 6388 |
\vbox{\ifinner INNER \ifvmode VMODE \fi \fi} \par |
| 6389 |
\stopbuffer |
| 6390 |
|
| 6391 |
\typebuffer |
| 6392 |
|
| 6393 |
Watch the last line: because we typeset \type {INNER} we enter horizontal mode: |
| 6394 |
|
| 6395 |
{\getbuffer} |
| 6396 |
|
| 6397 |
\stopoldprimitive |
| 6398 |
|
| 6399 |
\startnewprimitive[title={\prm {ifinsert}}] |
| 6400 |
|
| 6401 |
This is the equivalent of \prm {ifvoid} for a given insert class. |
| 6402 |
|
| 6403 |
\stopnewprimitive |
| 6404 |
|
| 6405 |
\startnewprimitive[title={\prm {ifintervaldim}}] |
| 6406 |
|
| 6407 |
This conditional is true when the intervals around the values of two dimensions |
| 6408 |
overlap. The first dimension determines the interval. |
| 6409 |
|
| 6410 |
\startbuffer |
| 6411 |
[\ifintervaldim1pt 20pt 21pt \else no \fi overlap] |
| 6412 |
[\ifintervaldim1pt 18pt 20pt \else no \fi overlap] |
| 6413 |
\stopbuffer |
| 6414 |
|
| 6415 |
\typebuffer |
| 6416 |
|
| 6417 |
So here: \inlinebuffer |
| 6418 |
|
| 6419 |
\stopnewprimitive |
| 6420 |
|
| 6421 |
\startnewprimitive[title={\prm {ifintervalfloat}}] |
| 6422 |
|
| 6423 |
This one does with floats what we described under \prm {ifintervaldim}. |
| 6424 |
|
| 6425 |
\stopnewprimitive |
| 6426 |
|
| 6427 |
\startnewprimitive[title={\prm {ifintervalnum}}] |
| 6428 |
|
| 6429 |
This one does with integers what we described under \prm {ifintervaldim}. |
| 6430 |
|
| 6431 |
\stopnewprimitive |
| 6432 |
|
| 6433 |
\startnewprimitive[title={\prm {iflastnamedcs}}] |
| 6434 |
|
| 6435 |
When a \prm {csname} is constructed and succeeds the last one is remembered and |
| 6436 |
can be accessed with \prm {lastnamedcs}. It can however be an undefined one. That |
| 6437 |
state can be checked with this primitive. Of course it also works with the \prm |
| 6438 |
{ifcsname} and \prm {begincsname} variants. |
| 6439 |
|
| 6440 |
\stopnewprimitive |
| 6441 |
|
| 6442 |
\startnewprimitive[title={\prm {iflist}}] |
| 6443 |
|
| 6444 |
The \prm {ifvoid} conditional checks is a box is unset, that is, no \type {hlist} |
| 6445 |
or \type {vlist} node is assigned. The \prm {iflist} conditional also checks is a |
| 6446 |
list is assigned to this node. If there is a node assigned the box can of course |
| 6447 |
have dimensions, but it's the presence of a list (content) that matters here. |
| 6448 |
|
| 6449 |
\startbuffer |
| 6450 |
[\setbox0\hbox{!}\iflist0 \else no \fi list, \ifvoid0 \else not \fi void] |
| 6451 |
[\setbox0\hbox {}\iflist0 \else no \fi list, \ifvoid0 \else not \fi void] |
| 6452 |
[\box0 \iflist0 \else no \fi list, \ifvoid0 \else not \fi void] |
| 6453 |
\stopbuffer |
| 6454 |
|
| 6455 |
\typebuffer |
| 6456 |
|
| 6457 |
We get: \inlinebuffer |
| 6458 |
|
| 6459 |
\stopnewprimitive |
| 6460 |
|
| 6461 |
\startnewprimitive[title={\prm {ifmathparameter}}] |
| 6462 |
|
| 6463 |
This is an \prm {ifcase} where the value depends on if the given math parameter |
| 6464 |
is zero, (\type {0}), set (\type {1}), or unset (\type {2}). |
| 6465 |
|
| 6466 |
\starttyping |
| 6467 |
\ifmathparameter\Umathpunctclosespacing\displaystyle |
| 6468 |
zero \or |
| 6469 |
nonzero \or |
| 6470 |
unset \fi |
| 6471 |
\stoptyping |
| 6472 |
|
| 6473 |
\stopnewprimitive |
| 6474 |
|
| 6475 |
\startnewprimitive[title={\prm {ifmathstyle}}] |
| 6476 |
|
| 6477 |
This is a variant of \prm {ifcase} were the number is one of the seven possible |
| 6478 |
styles: display, text, cramped text, script, cramped script, script script, |
| 6479 |
cramped script script. |
| 6480 |
|
| 6481 |
\starttyping |
| 6482 |
\ifmathstyle |
| 6483 |
display |
| 6484 |
\or |
| 6485 |
text |
| 6486 |
\or |
| 6487 |
cramped text |
| 6488 |
\else |
| 6489 |
normally smaller than text |
| 6490 |
\fi |
| 6491 |
\stoptyping |
| 6492 |
|
| 6493 |
\stopnewprimitive |
| 6494 |
|
| 6495 |
\startoldprimitive[title={\prm {ifmmode}}] |
| 6496 |
|
| 6497 |
This traditional conditional checks we are in (inline or display) math mode mode. |
| 6498 |
|
| 6499 |
\stopoldprimitive |
| 6500 |
|
| 6501 |
\startoldprimitive[title={\prm {ifnum}}] |
| 6502 |
|
| 6503 |
This is a frequently used conditional: it compares two numbers where a number is |
| 6504 |
anything that can be seen as such. |
| 6505 |
|
| 6506 |
\startbuffer |
| 6507 |
\scratchcounter=65 \chardef\A=65 |
| 6508 |
|
| 6509 |
\ifnum65=`A YES \else NOP\fi |
| 6510 |
\ifnum\scratchcounter=65 YES \else NOP\fi |
| 6511 |
\ifnum\scratchcounter=\A YES \else NOP\fi |
| 6512 |
\stopbuffer |
| 6513 |
|
| 6514 |
\typebuffer |
| 6515 |
|
| 6516 |
Unless a number is an unexpandable token it ends with a space or \prm {relax}, |
| 6517 |
so when you end up in the true branch, you'd better check if \TEX\ could |
| 6518 |
determine where the number ends. |
| 6519 |
|
| 6520 |
{\getbuffer} |
| 6521 |
|
| 6522 |
% When comparing integers, definitions (for instance characters) that can be seen |
| 6523 |
% as such, or any converter that produces a number (like the \type {`} or \prm |
| 6524 |
% {number} the usual \type {=}, \type {<} or \type {>} can be used. However, in |
| 6525 |
% \LUAMETATEX\ you can negate such a comparison by \type {!}: \type {!=}, \type |
| 6526 |
% {!<} or \type {!>}. Successive \type {!} toggle the negation state. |
| 6527 |
|
| 6528 |
On top of these \ASCII\ combinations, the engine also accepts some \UNICODE\ |
| 6529 |
characters. This brings the full repertoire to: |
| 6530 |
|
| 6531 |
\starttabulate[|l|cT|cT|l|] |
| 6532 |
\FL |
| 6533 |
\BC character \BC \BC \BC operation \NC \NR |
| 6534 |
\ML |
| 6535 |
\NC \type {0x003C} \NC $\Uchar"003C$ \NC \NC less \NC \NR |
| 6536 |
\NC \type {0x003D} \NC $\Uchar"003D$ \NC \NC equal \NC \NR |
| 6537 |
\NC \type {0x003E} \NC $\Uchar"003E$ \NC \NC more \NC \NR |
| 6538 |
\NC \type {0x2208} \NC $\Uchar"2208$ \NC \NC element of \NC \NR |
| 6539 |
\NC \type {0x2209} \NC $\Uchar"2209$ \NC \NC not element of \NC \NR |
| 6540 |
\NC \type {0x2260} \NC $\Uchar"2260$ \NC != \NC not equal \NC \NR |
| 6541 |
\NC \type {0x2264} \NC $\Uchar"2264$ \NC !> \NC less equal \NC \NR |
| 6542 |
\NC \type {0x2265} \NC $\Uchar"2265$ \NC !< \NC greater equal \NC \NR |
| 6543 |
\NC \type {0x2270} \NC $\Uchar"2270$ \NC \NC not less equal \NC \NR |
| 6544 |
\NC \type {0x2271} \NC $\Uchar"2271$ \NC \NC not greater equal \NC \NR |
| 6545 |
\LL |
| 6546 |
\stoptabulate |
| 6547 |
|
| 6548 |
This also applied to \prm {ifdim} although in the case of element we discard the |
| 6549 |
fractional part (read: divide the numeric representation by 65536). |
| 6550 |
|
| 6551 |
\stopoldprimitive |
| 6552 |
|
| 6553 |
\startnewprimitive[title={\prm {ifnumexpression}}] |
| 6554 |
|
| 6555 |
Here is an example of a conditional using expressions: |
| 6556 |
|
| 6557 |
\startbuffer |
| 6558 |
\ifnumexpression (\scratchcounterone > 5) and (\scratchcountertwo > 5) \relax |
| 6559 |
do-something |
| 6560 |
\fi |
| 6561 |
\stopbuffer |
| 6562 |
|
| 6563 |
This matches when the result is non zero, and you can mix calculations and tests |
| 6564 |
as with normal expressions. |
| 6565 |
|
| 6566 |
\stopnewprimitive |
| 6567 |
|
| 6568 |
\startnewprimitive[title={\prm {ifnumval}}] |
| 6569 |
|
| 6570 |
This conditional is a variant on \prm {ifchknum}. This time we get |
| 6571 |
some more detail about the value: |
| 6572 |
|
| 6573 |
\startbuffer |
| 6574 |
[-12 : \ifnumval -12\or negative\or zero\or positive\else error\fi]\quad |
| 6575 |
[0 : \ifnumval 0\or negative\or zero\or positive\else error\fi]\quad |
| 6576 |
[12 : \ifnumval 12\or negative\or zero\or positive\else error\fi]\quad |
| 6577 |
[oeps : \ifnumval oeps\or negative\or zero\or positive\else error\fi] |
| 6578 |
\stopbuffer |
| 6579 |
|
| 6580 |
\typebuffer |
| 6581 |
|
| 6582 |
This gives: |
| 6583 |
|
| 6584 |
{\getbuffer} |
| 6585 |
|
| 6586 |
\stopnewprimitive |
| 6587 |
|
| 6588 |
\startoldprimitive[title={\prm {ifodd}}] |
| 6589 |
|
| 6590 |
One reason for this condition to be around is that in a double sided layout we |
| 6591 |
need test for being on an odd or even page. It scans for a number the same was |
| 6592 |
as other primitives, |
| 6593 |
|
| 6594 |
\startbuffer |
| 6595 |
\ifodd65 YES \else NO\fi & |
| 6596 |
\ifodd`B YES \else NO\fi . |
| 6597 |
\stopbuffer |
| 6598 |
|
| 6599 |
\typebuffer |
| 6600 |
|
| 6601 |
So: {\inlinebuffer} |
| 6602 |
|
| 6603 |
\stopoldprimitive |
| 6604 |
|
| 6605 |
\startnewprimitive[title={\prm {ifparameter}}] |
| 6606 |
|
| 6607 |
In a macro body \type {#1} is a reference to a parameter. You can check if one is |
| 6608 |
set using a dedicated parameter condition: |
| 6609 |
|
| 6610 |
\startbuffer |
| 6611 |
\tolerant\def\foo[#1]#*[#2]% |
| 6612 |
{\ifparameter#1\or one\else no one\fi\enspace |
| 6613 |
\ifparameter#2\or two\else no two\fi\emspace} |
| 6614 |
|
| 6615 |
\foo |
| 6616 |
\foo[1] |
| 6617 |
\foo[1][2] |
| 6618 |
\stopbuffer |
| 6619 |
|
| 6620 |
\typebuffer |
| 6621 |
|
| 6622 |
We get: |
| 6623 |
|
| 6624 |
\getbuffer |
| 6625 |
|
| 6626 |
\stopnewprimitive |
| 6627 |
|
| 6628 |
\startnewprimitive[title={\prm {ifparameters}}] |
| 6629 |
|
| 6630 |
This is equivalent to an \prm {ifcase} with as value the number of parameters |
| 6631 |
passed to the current macro. |
| 6632 |
|
| 6633 |
\stopnewprimitive |
| 6634 |
|
| 6635 |
\startnewprimitive[title={\prm {ifrelax}}] |
| 6636 |
|
| 6637 |
This is a convenient shortcut for \typ {\ifx\relax} and the motivation for adding |
| 6638 |
this one is (as with some others) to get less tracing. |
| 6639 |
|
| 6640 |
\stopnewprimitive |
| 6641 |
|
| 6642 |
\startnewprimitive[title={\prm {iftok}}] |
| 6643 |
|
| 6644 |
When you want to compare two arguments, the usual way to do this is the |
| 6645 |
following: |
| 6646 |
|
| 6647 |
\starttyping |
| 6648 |
\edef\tempA{#1} |
| 6649 |
\edef\tempb{#2} |
| 6650 |
\ifx\tempA\tempB |
| 6651 |
the same |
| 6652 |
\else |
| 6653 |
different |
| 6654 |
\fi |
| 6655 |
\stoptyping |
| 6656 |
|
| 6657 |
This works quite well but the fact that we need to define two macros can be |
| 6658 |
considered a bit of a nuisance. It also makes macros that use this method to be |
| 6659 |
not so called \quote {fully expandable}. The next one avoids both issues: |
| 6660 |
|
| 6661 |
\starttyping |
| 6662 |
\iftok{#1}{#2} |
| 6663 |
the same |
| 6664 |
\else |
| 6665 |
different |
| 6666 |
\fi |
| 6667 |
\stoptyping |
| 6668 |
|
| 6669 |
Instead of direct list you can also pass registers, so given: |
| 6670 |
|
| 6671 |
\startbuffer[a] |
| 6672 |
\scratchtoks{a}% |
| 6673 |
\toks0{a}% |
| 6674 |
\stopbuffer |
| 6675 |
|
| 6676 |
\typebuffer[a] |
| 6677 |
|
| 6678 |
This: |
| 6679 |
|
| 6680 |
\startbuffer[b] |
| 6681 |
\iftok 0 \scratchtoks Y\else N\fi\space |
| 6682 |
\iftok{a}\scratchtoks Y\else N\fi\space |
| 6683 |
\iftok\scratchtoks\scratchtoks Y\else N\fi |
| 6684 |
\stopbuffer |
| 6685 |
|
| 6686 |
\typebuffer[b] |
| 6687 |
|
| 6688 |
{\getbuffer[a]gives: \inlinebuffer[b].} |
| 6689 |
|
| 6690 |
\stopnewprimitive |
| 6691 |
|
| 6692 |
\startoldprimitive[title={\prm {iftrue}}] |
| 6693 |
|
| 6694 |
Here we have a traditional \TEX\ conditional that is always true (therefore the |
| 6695 |
same is true for any macro that is \prm {let} to this primitive). |
| 6696 |
|
| 6697 |
\stopoldprimitive |
| 6698 |
|
| 6699 |
\startoldprimitive[title={\prm {ifvbox}}] |
| 6700 |
|
| 6701 |
This traditional conditional checks if a given box register or internal box |
| 6702 |
variable represents a vertical box, |
| 6703 |
|
| 6704 |
\stopoldprimitive |
| 6705 |
|
| 6706 |
\startoldprimitive[title={\prm {ifvmode}}] |
| 6707 |
|
| 6708 |
This traditional conditional checks we are in (internal) vertical mode. |
| 6709 |
|
| 6710 |
\stopoldprimitive |
| 6711 |
|
| 6712 |
\startoldprimitive[title={\prm {ifvoid}}] |
| 6713 |
|
| 6714 |
This traditional conditional checks if a given box register or internal box |
| 6715 |
variable has any content. |
| 6716 |
|
| 6717 |
\stopoldprimitive |
| 6718 |
|
| 6719 |
\startoldprimitive[title={\prm {ifx}}] |
| 6720 |
|
| 6721 |
We use this traditional \TEX\ conditional a lot in \CONTEXT. Contrary to \prm {if} |
| 6722 |
the two tokens that are compared are not expanded. This makes it possible to compare |
| 6723 |
the meaning of two macros. Depending on the need, these macros can have their content |
| 6724 |
expanded or not. A different number of parameters results in false. |
| 6725 |
|
| 6726 |
Control sequences are identical when they have the same command code and |
| 6727 |
character code. Because a \prm {let} macro is just a reference, both let macros |
| 6728 |
are the same and equal to \prm {relax}: |
| 6729 |
|
| 6730 |
\starttyping |
| 6731 |
\let\one\relax \let\two\relax |
| 6732 |
\stoptyping |
| 6733 |
|
| 6734 |
The same is true for other definitions that result in the same (primitive) or |
| 6735 |
meaning encoded in the character field (think of \prm {chardef}s and so). |
| 6736 |
|
| 6737 |
\stopoldprimitive |
| 6738 |
|
| 6739 |
\startnewprimitive[title={\prm {ifzerodim}}] |
| 6740 |
|
| 6741 |
This tests for a dimen (dimension) being zero so we have: |
| 6742 |
|
| 6743 |
\starttyping |
| 6744 |
\ifdim<dimension>=0pt |
| 6745 |
\ifzerodim<dimension> |
| 6746 |
\ifcase<dimension register> |
| 6747 |
\stoptyping |
| 6748 |
|
| 6749 |
\stopnewprimitive |
| 6750 |
|
| 6751 |
\startnewprimitive[title={\prm {ifzerofloat}}] |
| 6752 |
|
| 6753 |
As the name indicated, this tests for a zero float value. |
| 6754 |
|
| 6755 |
\startbuffer |
| 6756 |
[\scratchfloat\zerofloat \ifzerofloat\scratchfloat \else not \fi zero] |
| 6757 |
[\scratchfloat\plusone \ifzerofloat\scratchfloat \else not \fi zero] |
| 6758 |
[\scratchfloat 0.01 \ifzerofloat\scratchfloat \else not \fi zero] |
| 6759 |
[\scratchfloat 0.0e0 \ifzerofloat\scratchfloat \else not \fi zero] |
| 6760 |
[\scratchfloat \zeropoint\ifzerofloat\scratchfloat \else not \fi zero] |
| 6761 |
\stopbuffer |
| 6762 |
|
| 6763 |
\typebuffer |
| 6764 |
|
| 6765 |
So: \inlinebuffer |
| 6766 |
|
| 6767 |
\stopnewprimitive |
| 6768 |
|
| 6769 |
\startnewprimitive[title={\prm {ifzeronum}}] |
| 6770 |
|
| 6771 |
This tests for a number (integer) being zero so we have these variants now: |
| 6772 |
|
| 6773 |
\starttyping |
| 6774 |
\ifnum<integer or equivalent>=0 |
| 6775 |
\ifzeronum<integer or equivalent> |
| 6776 |
\ifcase<integer or equivalent> |
| 6777 |
\stoptyping |
| 6778 |
|
| 6779 |
\stopnewprimitive |
| 6780 |
|
| 6781 |
\startnewprimitive[title={\prm {ignorearguments}}] |
| 6782 |
|
| 6783 |
This primitive will quit argument scanning and start expansion of the body of a |
| 6784 |
macro. The number of grabbed arguments can be tested as follows: |
| 6785 |
|
| 6786 |
\startbuffer |
| 6787 |
\def\MyMacro[#1][#2][#3]% |
| 6788 |
{\ifarguments zero\or one\or two\or three \else hm\fi} |
| 6789 |
|
| 6790 |
\MyMacro \ignorearguments \quad |
| 6791 |
\MyMacro [1]\ignorearguments \quad |
| 6792 |
\MyMacro [1][2]\ignorearguments \quad |
| 6793 |
\MyMacro [1][2][3]\ignorearguments \par |
| 6794 |
\stopbuffer |
| 6795 |
|
| 6796 |
\typebuffer |
| 6797 |
|
| 6798 |
{\getbuffer} |
| 6799 |
|
| 6800 |
{\em Todo: explain optional delimiters.} |
| 6801 |
|
| 6802 |
\stopnewprimitive |
| 6803 |
|
| 6804 |
\startnewprimitive[title={\prm {ignoredepthcriterion}}] |
| 6805 |
|
| 6806 |
When setting the \prm {prevdepth} (either by \TEX\ or by the current user) of the |
| 6807 |
current vertical list the value 1000pt is a signal for special treatment of the |
| 6808 |
skip between \quote {lines}. There is an article on that in the distribution. It |
| 6809 |
also demonstrates that \prm {ignoredepthcriterion} can be used to change this |
| 6810 |
special signal, just in case it is needed. |
| 6811 |
|
| 6812 |
\stopnewprimitive |
| 6813 |
|
| 6814 |
\startnewprimitive[title={\prm {ignorenestedupto}}] |
| 6815 |
|
| 6816 |
This primitive gobbles following tokens and can deal with nested \quote |
| 6817 |
{environments}, for example: |
| 6818 |
|
| 6819 |
\startbuffer |
| 6820 |
\def\StartFoo{\ignorenestedupto\StartFoo\StopFoo} |
| 6821 |
|
| 6822 |
(before |
| 6823 |
\StartFoo |
| 6824 |
test \StartFoo test \StopFoo |
| 6825 |
{test \StartFoo test \StopFoo} |
| 6826 |
\StopFoo |
| 6827 |
after) |
| 6828 |
\stopbuffer |
| 6829 |
|
| 6830 |
\typebuffer |
| 6831 |
|
| 6832 |
delivers: |
| 6833 |
|
| 6834 |
\getbuffer |
| 6835 |
|
| 6836 |
\stopnewprimitive |
| 6837 |
|
| 6838 |
\startnewprimitive[title={\prm {ignorepars}}] |
| 6839 |
|
| 6840 |
This is a variant of \prm {ignorespaces}: following spaces {\em and} \type |
| 6841 |
{\par} equivalent tokens are ignored, so for instance: |
| 6842 |
|
| 6843 |
\startbuffer |
| 6844 |
one + \ignorepars |
| 6845 |
|
| 6846 |
two = \ignorepars \par |
| 6847 |
three |
| 6848 |
\stopbuffer |
| 6849 |
|
| 6850 |
\typebuffer |
| 6851 |
|
| 6852 |
renders as: \inlinebuffer. Traditionally \TEX\ has been sensitive to \prm {par} |
| 6853 |
tokens in some of its building blocks. This has to do with the fact that it could |
| 6854 |
indicate a runaway argument which in the times of slower machines and terminals |
| 6855 |
was best to catch early. In \LUAMETATEX\ we no longer have long macros and the |
| 6856 |
mechanisms that are sensitive can be told to accept \prm {par} tokens (and |
| 6857 |
\CONTEXT\ set them such that this is the case). |
| 6858 |
|
| 6859 |
\stopnewprimitive |
| 6860 |
|
| 6861 |
\startnewprimitive[title={\prm {ignorerest}}] |
| 6862 |
|
| 6863 |
An example shows what this primitive does: |
| 6864 |
|
| 6865 |
\startbuffer |
| 6866 |
\tolerant\def\foo[#1]#*[#2]% |
| 6867 |
{1234 |
| 6868 |
\ifparameter#1\or\else |
| 6869 |
\expandafter\ignorerest |
| 6870 |
\fi |
| 6871 |
/#1/ |
| 6872 |
\ifparameter#2\or\else |
| 6873 |
\expandafter\ignorerest |
| 6874 |
\fi |
| 6875 |
/#2/ } |
| 6876 |
|
| 6877 |
\foo test \foo[456] test \foo[456][789] test |
| 6878 |
\stopbuffer |
| 6879 |
|
| 6880 |
\typebuffer |
| 6881 |
|
| 6882 |
As this likely makes most sense in conditionals you need to make sure the current |
| 6883 |
state is properly finished. Because \prm {expandafter} bumps the input state, |
| 6884 |
here we actually quit two levels; this is because so called \quote {backed up |
| 6885 |
text} is intercepted by this primitive. |
| 6886 |
|
| 6887 |
\getbuffer |
| 6888 |
|
| 6889 |
\stopnewprimitive |
| 6890 |
|
| 6891 |
\startoldprimitive[title={\prm {ignorespaces}}] |
| 6892 |
|
| 6893 |
This traditional \TEX\ primitive signals the scanner to ignore the following |
| 6894 |
spaces, if any. We mention it because we show a companion in the next section. |
| 6895 |
|
| 6896 |
\stopoldprimitive |
| 6897 |
|
| 6898 |
\startnewprimitive[title={\prm {ignoreupto}}] |
| 6899 |
|
| 6900 |
This ignores everything upto the given token, so |
| 6901 |
|
| 6902 |
\startbuffer |
| 6903 |
\ignoreupto \foo not this but\foo only this |
| 6904 |
\stopbuffer |
| 6905 |
|
| 6906 |
\typebuffer |
| 6907 |
|
| 6908 |
will give: \inlinebuffer . |
| 6909 |
|
| 6910 |
\stopnewprimitive |
| 6911 |
|
| 6912 |
\startoldprimitive[title={\prm {immediate}}] |
| 6913 |
|
| 6914 |
This one has no effect unless you intercept it at the \LUA\ end and act upon it. |
| 6915 |
In original \TEX\ immediate is used in combination with read from and write to |
| 6916 |
file operations. So, this is an old primitive with a new meaning. |
| 6917 |
|
| 6918 |
\stopoldprimitive |
| 6919 |
|
| 6920 |
\startnewprimitive[title={\prm {immutable}}] |
| 6921 |
|
| 6922 |
This prefix flags what follows as being frozen and is usually applied to for |
| 6923 |
instance \prm {integerdef}'d control sequences. In that respect is is like \prm |
| 6924 |
{permanent} but it makes it possible to distinguish quantities from macros. |
| 6925 |
|
| 6926 |
\stopnewprimitive |
| 6927 |
|
| 6928 |
\startoldprimitive[title={\prm {indent}}] |
| 6929 |
|
| 6930 |
In engines other than \LUAMETATEX\ a paragraph starts with an indentation box. |
| 6931 |
The width of that (empty) box is determined by \prm {parindent}. In \LUAMETATEX\ |
| 6932 |
we can use a dedicated indentation skip instead (as part of paragraph |
| 6933 |
normalization). An indentation can be zero'd with \prm {undent}. |
| 6934 |
|
| 6935 |
\stopoldprimitive |
| 6936 |
|
| 6937 |
\startnewprimitive[title={\prm {indexedsubprescript}}] |
| 6938 |
|
| 6939 |
This primitive (or \type {____}) puts a flag on the script but renders |
| 6940 |
the same: |
| 6941 |
|
| 6942 |
\startbuffer |
| 6943 |
$ |
| 6944 |
x \indexedsuperprescript{2} \subprescript {2} + |
| 6945 |
x \superprescript {2} \indexedsubprescript{2} + |
| 6946 |
x \superprescript {2} ____ {2} = |
| 6947 |
x \superprescript {2} \subprescript {2} |
| 6948 |
$ |
| 6949 |
\stopbuffer |
| 6950 |
|
| 6951 |
\typebuffer |
| 6952 |
|
| 6953 |
Gives: \inlinebuffer. |
| 6954 |
|
| 6955 |
\stopnewprimitive |
| 6956 |
|
| 6957 |
\startnewprimitive[title={\prm {indexedsubscript}}] |
| 6958 |
|
| 6959 |
This primitive (or \type {__}) puts a flag on the script but renders |
| 6960 |
the same: |
| 6961 |
|
| 6962 |
\startbuffer |
| 6963 |
$ |
| 6964 |
x \indexedsuperscript{2} \subscript {2} + |
| 6965 |
x \superscript {2} \indexedsubscript{2} + |
| 6966 |
x \superscript {2} __ {2} = |
| 6967 |
x \superscript {2} \subscript {2} |
| 6968 |
$ |
| 6969 |
\stopbuffer |
| 6970 |
|
| 6971 |
\typebuffer |
| 6972 |
|
| 6973 |
Gives: \inlinebuffer. |
| 6974 |
|
| 6975 |
\stopnewprimitive |
| 6976 |
|
| 6977 |
\startnewprimitive[title={\prm {indexedsuperprescript}}] |
| 6978 |
|
| 6979 |
This primitive (or \type {^^^^}) puts a flag on the script but renders |
| 6980 |
the same: |
| 6981 |
|
| 6982 |
\startbuffer |
| 6983 |
$ |
| 6984 |
x \indexedsuperprescript{2} \subprescript {2} + |
| 6985 |
x ^^^^ {2} \subprescript {2} + |
| 6986 |
x \superprescript {2} \indexedsubprescript{2} = |
| 6987 |
x \superprescript {2} \subprescript {2} |
| 6988 |
$ |
| 6989 |
\stopbuffer |
| 6990 |
|
| 6991 |
\typebuffer |
| 6992 |
|
| 6993 |
Gives: \inlinebuffer. |
| 6994 |
|
| 6995 |
\stopnewprimitive |
| 6996 |
|
| 6997 |
\startnewprimitive[title={\prm {indexedsuperscript}}] |
| 6998 |
|
| 6999 |
This primitive (or \type {^^}) puts a flag on the script but renders |
| 7000 |
the same: |
| 7001 |
|
| 7002 |
\startbuffer |
| 7003 |
$ |
| 7004 |
x \indexedsuperscript{2} \subscript {2} + |
| 7005 |
x ^^ {2} \subscript {2} + |
| 7006 |
x \superscript {2} \indexedsubscript{2} = |
| 7007 |
x \superscript {2} \subscript {2} |
| 7008 |
$ |
| 7009 |
\stopbuffer |
| 7010 |
|
| 7011 |
\typebuffer |
| 7012 |
|
| 7013 |
Gives: \inlinebuffer. |
| 7014 |
|
| 7015 |
\stopnewprimitive |
| 7016 |
|
| 7017 |
\startnewprimitive[title={\prm {indexofcharacter}}] |
| 7018 |
|
| 7019 |
This primitive is more versatile variant of the backward quote operator, so |
| 7020 |
instead of: |
| 7021 |
|
| 7022 |
\starttyping |
| 7023 |
\number`| |
| 7024 |
\number`~ |
| 7025 |
\number`\a |
| 7026 |
\number`\q |
| 7027 |
\stoptyping |
| 7028 |
|
| 7029 |
you can say: |
| 7030 |
|
| 7031 |
\starttyping |
| 7032 |
\the\indexofcharacter | |
| 7033 |
\the\indexofcharacter ~ |
| 7034 |
\the\indexofcharacter \a |
| 7035 |
\the\indexofcharacter \q |
| 7036 |
\stoptyping |
| 7037 |
|
| 7038 |
In both cases active characters and unknown single character control sequences |
| 7039 |
are valid. In addition this also works: |
| 7040 |
|
| 7041 |
\starttyping |
| 7042 |
\chardef \foo 128 |
| 7043 |
\mathchardef\oof 130 |
| 7044 |
|
| 7045 |
\the\indexofcharacter \foo |
| 7046 |
\the\indexofcharacter \oof |
| 7047 |
\stoptyping |
| 7048 |
|
| 7049 |
An important difference is that \prm {indexofcharacter} returns an integer and |
| 7050 |
not a serialized number. A negative value indicates no valid character. |
| 7051 |
|
| 7052 |
\stopnewprimitive |
| 7053 |
|
| 7054 |
\startnewprimitive[title={\prm {indexofregister}}] |
| 7055 |
|
| 7056 |
You can use this instead of \prm {number} for determining the index of a register |
| 7057 |
but it also returns a number when a register value is seen. The result is an |
| 7058 |
integer, not a serialized number. |
| 7059 |
|
| 7060 |
When you have defined a register with one of the \tex {...def} primitives but for |
| 7061 |
some reasons needs to know the register index you can query that: |
| 7062 |
|
| 7063 |
\startbuffer |
| 7064 |
\the\indexofregister \scratchcounterone, |
| 7065 |
\the\indexofregister \scratchcountertwo, |
| 7066 |
\the\indexofregister \scratchwidth, |
| 7067 |
\the\indexofregister \scratchheight, |
| 7068 |
\the\indexofregister \scratchdepth, |
| 7069 |
\the\indexofregister \scratchbox |
| 7070 |
\stopbuffer |
| 7071 |
|
| 7072 |
\typebuffer |
| 7073 |
|
| 7074 |
% We lie a little here because in \CONTEXT\ the box index \tex {scratchbox} is |
| 7075 |
% actually defined as: \normalexpanded {\typ {\meaningasis \scratchbox}} but it |
| 7076 |
% still is a number so it fits in. |
| 7077 |
|
| 7078 |
We lie a little here because in \CONTEXT\ the box index \tex {scratchbox} is |
| 7079 |
actually defined as: \expanded {\typ {\meaningasis \scratchbox}} but it |
| 7080 |
still is a number so it fits in. |
| 7081 |
|
| 7082 |
\getbuffer |
| 7083 |
|
| 7084 |
\stopnewprimitive |
| 7085 |
|
| 7086 |
\startnewprimitive[title={\prm {inherited}}] |
| 7087 |
|
| 7088 |
When this prefix is used in a definition using \prm {let} the target will inherit |
| 7089 |
all the properties of the source. |
| 7090 |
|
| 7091 |
\stopnewprimitive |
| 7092 |
|
| 7093 |
\startnewprimitive[title={\prm {initcatcodetable}}] |
| 7094 |
|
| 7095 |
This initializes the catcode table with the given index. |
| 7096 |
|
| 7097 |
\stopnewprimitive |
| 7098 |
|
| 7099 |
\startnewprimitive[title={\prm {initialpageskip}}] |
| 7100 |
|
| 7101 |
When a page starts the value of this register are used to initialize \prm |
| 7102 |
{pagetotal}, \prm {pagestretch} and \prm {pageshrink}. This make nicer code than |
| 7103 |
using a \prm {topskip} with weird values. |
| 7104 |
|
| 7105 |
\stopnewprimitive |
| 7106 |
|
| 7107 |
\startnewprimitive[title={\prm {initialtopskip}}] |
| 7108 |
|
| 7109 |
When set this one will be used instead of \prm {topskip}. The rationale is that |
| 7110 |
the \prm {topskip} is often also used for side effects and compensation. |
| 7111 |
|
| 7112 |
\stopnewprimitive |
| 7113 |
|
| 7114 |
\startoldprimitive[title={\prm {input}}] |
| 7115 |
|
| 7116 |
There are several ways to use this primitive: |
| 7117 |
|
| 7118 |
\starttyping |
| 7119 |
\input test |
| 7120 |
\input {test} |
| 7121 |
\input "test" |
| 7122 |
\input 'test' |
| 7123 |
\stoptyping |
| 7124 |
|
| 7125 |
When no suffix is given, \TEX\ will assume the suffix is \type {.tex}. The second |
| 7126 |
one is normally used. |
| 7127 |
|
| 7128 |
\stopoldprimitive |
| 7129 |
|
| 7130 |
\startoldprimitive[title={\prm {inputlineno}}] |
| 7131 |
|
| 7132 |
This integer holds the current linenumber but it is not always reliable. |
| 7133 |
|
| 7134 |
\stopoldprimitive |
| 7135 |
|
| 7136 |
\startoldprimitive[title={\prm {insert}}] |
| 7137 |
|
| 7138 |
This stores content in the insert container with the given index. In \LUAMETATEX\ |
| 7139 |
inserts bubble up to outer boxes so we don't have the \quote {deeply buried |
| 7140 |
insert issue}. |
| 7141 |
|
| 7142 |
\stopoldprimitive |
| 7143 |
|
| 7144 |
\startnewprimitive[title={\prm {insertbox}}] |
| 7145 |
|
| 7146 |
This is the accessor for the box (with results) of an insert with the given |
| 7147 |
index. This is equivalent to the \prm {box} in the traditional method. |
| 7148 |
|
| 7149 |
\stopnewprimitive |
| 7150 |
|
| 7151 |
\startnewprimitive[title={\prm {insertcopy}}] |
| 7152 |
|
| 7153 |
This is the accessor for the box (with results) of an insert with the given |
| 7154 |
index. It makes a copy so the original is kept. This is equivalent to a \prm |
| 7155 |
{copy} in the traditional method. |
| 7156 |
|
| 7157 |
\stopnewprimitive |
| 7158 |
|
| 7159 |
\startnewprimitive[title={\prm {insertdepth}}] |
| 7160 |
|
| 7161 |
This is the (current) depth of the inserted material with the given index. It is |
| 7162 |
comparable to the \prm {dp} in the traditional method. |
| 7163 |
|
| 7164 |
\stopnewprimitive |
| 7165 |
|
| 7166 |
% \startnewprimitive[title={\prm {insertdirection}}] |
| 7167 |
% \stopnewprimitive |
| 7168 |
|
| 7169 |
\startnewprimitive[title={\prm {insertdistance}}] |
| 7170 |
|
| 7171 |
This is the space before the inserted material with the given index. This is |
| 7172 |
equivalent to \prm {glue} in the traditional method. |
| 7173 |
|
| 7174 |
\stopnewprimitive |
| 7175 |
|
| 7176 |
\startnewprimitive[title={\prm {insertheight}}] |
| 7177 |
|
| 7178 |
This is the (current) depth of the inserted material with the given index. It is |
| 7179 |
comparable to the \prm {ht} in the traditional method. |
| 7180 |
|
| 7181 |
\stopnewprimitive |
| 7182 |
|
| 7183 |
\startnewprimitive[title={\prm {insertheights}}] |
| 7184 |
|
| 7185 |
This is the combined height of the inserted material. |
| 7186 |
|
| 7187 |
\stopnewprimitive |
| 7188 |
|
| 7189 |
\startnewprimitive[title={\prm {insertlimit}}] |
| 7190 |
|
| 7191 |
This is the maximum height that the inserted material with the given index can |
| 7192 |
get. This is equivalent to \prm {dimen} in the traditional method. |
| 7193 |
|
| 7194 |
\stopnewprimitive |
| 7195 |
|
| 7196 |
\startnewprimitive[title={\prm {insertlinedepth}}] |
| 7197 |
|
| 7198 |
This property is used in the balancer where the currently checked insert has no |
| 7199 |
depth. It is experimental. |
| 7200 |
|
| 7201 |
\stopnewprimitive |
| 7202 |
|
| 7203 |
\startnewprimitive[title={\prm {insertlineheight}}] |
| 7204 |
|
| 7205 |
This is a reserved property. |
| 7206 |
|
| 7207 |
\stopnewprimitive |
| 7208 |
|
| 7209 |
\startnewprimitive[title={\prm {insertmaxdepth}}] |
| 7210 |
|
| 7211 |
This is the maximum depth that the inserted material with the given index can |
| 7212 |
get. |
| 7213 |
|
| 7214 |
\stopnewprimitive |
| 7215 |
|
| 7216 |
\startnewprimitive[title={\prm {insertmode}}] |
| 7217 |
|
| 7218 |
In traditional \TEX\ inserts are controlled by a \prm {box}, \prm {dimen}, \prm |
| 7219 |
{glue} and \prm {count} register with the same index. The allocators have to take |
| 7220 |
this into account. When this primitive is set to one a different model is |
| 7221 |
followed with its own namespace. There are more abstract accessors to interface |
| 7222 |
to this. \footnote {The old model might be removed at some point.} |
| 7223 |
|
| 7224 |
\stopnewprimitive |
| 7225 |
|
| 7226 |
\startnewprimitive[title={\prm {insertmultiplier}}] |
| 7227 |
|
| 7228 |
This is the height (contribution) multiplier for the inserted material with the |
| 7229 |
given index. This is equivalent to \prm {count} in the traditional method. |
| 7230 |
|
| 7231 |
\stopnewprimitive |
| 7232 |
|
| 7233 |
\startoldprimitive[title={\prm {insertpenalties}}] |
| 7234 |
|
| 7235 |
This dual purpose internal counter holds the sum of penalties for insertions that |
| 7236 |
got split. When we're the output routine in reports the number of insertions that |
| 7237 |
is kept in store. |
| 7238 |
|
| 7239 |
\stopoldprimitive |
| 7240 |
|
| 7241 |
\startnewprimitive[title={\prm {insertpenalty}}] |
| 7242 |
|
| 7243 |
This is the insert penalty associated with the inserted material with the given |
| 7244 |
index. |
| 7245 |
|
| 7246 |
\stopnewprimitive |
| 7247 |
|
| 7248 |
\startnewprimitive[title={\prm {insertprogress}}] |
| 7249 |
|
| 7250 |
This returns the current accumulated insert height of the insert with the given |
| 7251 |
index. |
| 7252 |
|
| 7253 |
\stopnewprimitive |
| 7254 |
|
| 7255 |
\startnewprimitive[title={\prm {insertshrink}}] |
| 7256 |
|
| 7257 |
When set this will be taken into account. It basically turns ann insert into a |
| 7258 |
kind of glue but without it being a valid break point. |
| 7259 |
|
| 7260 |
\stopnewprimitive |
| 7261 |
|
| 7262 |
\startnewprimitive[title={\prm {insertstorage}}] |
| 7263 |
|
| 7264 |
The value passed will enable (one) or disable (zero) the insert with the given |
| 7265 |
index. |
| 7266 |
|
| 7267 |
\stopnewprimitive |
| 7268 |
|
| 7269 |
\startnewprimitive[title={\prm {insertstoring}}] |
| 7270 |
|
| 7271 |
The value passed will enable (one) or disable (zero) inserts. |
| 7272 |
|
| 7273 |
\stopnewprimitive |
| 7274 |
|
| 7275 |
\startnewprimitive[title={\prm {insertstretch}}] |
| 7276 |
|
| 7277 |
When set this will be taken into account. It basically turns ann insert into a |
| 7278 |
kind of glue but without it being a valid break point. |
| 7279 |
|
| 7280 |
\stopnewprimitive |
| 7281 |
|
| 7282 |
\startnewprimitive[title={\prm {insertunbox}}] |
| 7283 |
|
| 7284 |
This is the accessor for the box (with results) of an insert with the given |
| 7285 |
index. It makes a copy so the original is kept. The content is unpacked and |
| 7286 |
injected. This is equivalent to an \prm {unvbox} in the traditional method. |
| 7287 |
|
| 7288 |
\stopnewprimitive |
| 7289 |
|
| 7290 |
\startnewprimitive[title={\prm {insertuncopy}}] |
| 7291 |
|
| 7292 |
This is the accessor for the box (with results) of an insert with the given |
| 7293 |
index. It makes a copy so the original is kept. The content is unpacked and |
| 7294 |
injected. This is equivalent to the \prm {unvcopy} in the traditional method. |
| 7295 |
|
| 7296 |
\stopnewprimitive |
| 7297 |
|
| 7298 |
\startnewprimitive[title={\prm {insertwidth}}] |
| 7299 |
|
| 7300 |
This is the (current) width of the inserted material with the given index. It is |
| 7301 |
comparable to the \prm {wd} in the traditional method. |
| 7302 |
|
| 7303 |
\stopnewprimitive |
| 7304 |
|
| 7305 |
\startnewprimitive[title={\prm {instance}}] |
| 7306 |
|
| 7307 |
This prefix flags a macro as an instance which is mostly relevant when a macro |
| 7308 |
package want to categorize macros. |
| 7309 |
|
| 7310 |
\stopnewprimitive |
| 7311 |
|
| 7312 |
\startnewprimitive[title={\prm {integerdef}}] |
| 7313 |
|
| 7314 |
You can alias to a count (integer) register with \prm {countdef}: |
| 7315 |
|
| 7316 |
\starttyping |
| 7317 |
\countdef\MyCount134 |
| 7318 |
\stoptyping |
| 7319 |
|
| 7320 |
Afterwards the next two are equivalent: |
| 7321 |
|
| 7322 |
\starttyping |
| 7323 |
\MyCount = 99 |
| 7324 |
\count1234 = 99 |
| 7325 |
\stoptyping |
| 7326 |
|
| 7327 |
where \type {\MyCount} can be a bit more efficient because no index needs to be |
| 7328 |
scanned. However, in terms of storage the value (here 99) is always in the register |
| 7329 |
so \type {\MyCount} has to get there. This indirectness has the benefit that directly |
| 7330 |
setting the value is reflected in the indirect accessor. |
| 7331 |
|
| 7332 |
\starttyping |
| 7333 |
\integerdef\MyCount = 99 |
| 7334 |
\stoptyping |
| 7335 |
|
| 7336 |
This primitive also defines a numeric equivalent but this time the number is stored |
| 7337 |
with the equivalent. This means that: |
| 7338 |
|
| 7339 |
\starttyping |
| 7340 |
\let\MyCopyOfCount = \MyCount |
| 7341 |
\stoptyping |
| 7342 |
|
| 7343 |
will store the {\em current} value of \type {\MyCount} in \type {\MyCopyOfCount} and |
| 7344 |
changing either of them is not reflected in the other. |
| 7345 |
|
| 7346 |
The usual \prm {advance}, \prm {multiply} and \prm {divide} can be used with these |
| 7347 |
integers and they behave like any number. But compared to registers they are actually |
| 7348 |
more a constant. |
| 7349 |
|
| 7350 |
\stopnewprimitive |
| 7351 |
|
| 7352 |
\startoldprimitive[title={\prm {interactionmode}}] |
| 7353 |
|
| 7354 |
This internal integer can be used to set or query the current interaction mode: |
| 7355 |
|
| 7356 |
\starttabulate[||||] |
| 7357 |
\NC \type {\batchmode } \NC \the\batchmodecode \NC omits all stops and terminal output \NC \NR |
| 7358 |
\NC \type {\nonstopmode } \NC \the\nonstopmodecode \NC omits all stops \NC \NR |
| 7359 |
\NC \type {\scrollmode } \NC \the\scrollmodecode \NC omits error stops \NC \NR |
| 7360 |
\NC \type {\errorstopmode} \NC \the\errorstopmodecode \NC stops at every opportunity to interact \NC \NR |
| 7361 |
\stoptabulate |
| 7362 |
|
| 7363 |
% In \LUAMETATEX, for consistency, we have enabled these four as integers after |
| 7364 |
% \prm {the} but we can also decide to remove them and do this. So we leave this |
| 7365 |
% as an undocumented feature. It could have been an \ETEX\ way of abstracting the |
| 7366 |
% numeric values. |
| 7367 |
% |
| 7368 |
% \untraced\permanent\protected\def\batchmode {\interactionmode\batchmodecode} |
| 7369 |
% \untraced\permanent\protected\def\nonstopmode {\interactionmode\nonstopmodecode} |
| 7370 |
% \untraced\permanent\protected\def\scrollmode {\interactionmode\scrollmodecode} |
| 7371 |
% \untraced\permanent\protected\def\errorstopmode{\interactionmode\errorstopmodecode} |
| 7372 |
|
| 7373 |
\stopoldprimitive |
| 7374 |
|
| 7375 |
\startoldprimitive[title={\prm {interlinepenalties}}] |
| 7376 |
|
| 7377 |
This is a more granular variant of \prm {interlinepenalty}: an array of penalties |
| 7378 |
to be put between successive line from the start of a paragraph. The list starts |
| 7379 |
with the number of penalties that gets passed. |
| 7380 |
|
| 7381 |
\stopoldprimitive |
| 7382 |
|
| 7383 |
\startoldprimitive[title={\prm {interlinepenalty}}] |
| 7384 |
|
| 7385 |
This is the penalty that is put between lines. |
| 7386 |
|
| 7387 |
\stopoldprimitive |
| 7388 |
|
| 7389 |
\startoldprimitive[title={\prm {jobname}}] |
| 7390 |
|
| 7391 |
This gives the current job name without suffix: {\tttf \jobname}. |
| 7392 |
|
| 7393 |
\stopoldprimitive |
| 7394 |
|
| 7395 |
\startoldprimitive[title={\prm {kern}}] |
| 7396 |
|
| 7397 |
A kern is injected with the given dimension. For variants that switch to a mode |
| 7398 |
we have \prm {hkern} and \prm {vkern}. |
| 7399 |
|
| 7400 |
\stopoldprimitive |
| 7401 |
|
| 7402 |
\startoldprimitive[title={\prm {language}}] |
| 7403 |
|
| 7404 |
Sets (or returns) the current language, a number. In \LUATEX\ and \LUAMETATEX\ |
| 7405 |
the current language is stored in the glyph nodes. |
| 7406 |
|
| 7407 |
\stopoldprimitive |
| 7408 |
|
| 7409 |
\startnewprimitive[title={\prm {lastarguments}}] |
| 7410 |
|
| 7411 |
\startbuffer |
| 7412 |
\def\MyMacro #1{\the\lastarguments (#1) } \MyMacro{1} \crlf |
| 7413 |
\def\MyMacro #1#2{\the\lastarguments (#1) (#2)} \MyMacro{1}{2} \crlf |
| 7414 |
\def\MyMacro#1#2#3{\the\lastarguments (#1) (#2) (#3)} \MyMacro{1}{2}{3} \par |
| 7415 |
|
| 7416 |
\def\MyMacro #1{(#1) \the\lastarguments} \MyMacro{1} \crlf |
| 7417 |
\def\MyMacro #1#2{(#1) (#2) \the\lastarguments} \MyMacro{1}{2} \crlf |
| 7418 |
\def\MyMacro#1#2#3{(#1) (#2) (#3) \the\lastarguments} \MyMacro{1}{2}{3} \par |
| 7419 |
\stopbuffer |
| 7420 |
|
| 7421 |
\typebuffer |
| 7422 |
|
| 7423 |
The value of \prm {lastarguments} can only be trusted in the expansion until |
| 7424 |
another macro is seen and expanded. For instance in these examples, as soon as a |
| 7425 |
character (like the left parenthesis) is seen, horizontal mode is entered and |
| 7426 |
\prm {everypar} is expanded which in turn can involve macros. You can see that |
| 7427 |
in the second block (that is: unless we changed \prm {everypar} in the |
| 7428 |
meantime). |
| 7429 |
|
| 7430 |
{\getbuffer} |
| 7431 |
|
| 7432 |
\stopnewprimitive |
| 7433 |
|
| 7434 |
\startnewprimitive[title={\prm {lastatomclass}}] |
| 7435 |
|
| 7436 |
This returns the class number of the last atom seen in the math input parser. |
| 7437 |
|
| 7438 |
\stopnewprimitive |
| 7439 |
|
| 7440 |
\startnewprimitive[title={\prm {lastboundary}}] |
| 7441 |
|
| 7442 |
This primitive looks back in the list for a user boundary injected with \prm |
| 7443 |
{boundary} and when seen it returns that value or otherwise zero. |
| 7444 |
|
| 7445 |
\stopnewprimitive |
| 7446 |
|
| 7447 |
\startoldprimitive[title={\prm {lastbox}}] |
| 7448 |
|
| 7449 |
When issued this primitive will, if possible, pull the last box from the current |
| 7450 |
list. |
| 7451 |
|
| 7452 |
\stopoldprimitive |
| 7453 |
|
| 7454 |
\startnewprimitive[title={\prm {lastchkdimension}}] |
| 7455 |
|
| 7456 |
When the last check for a dimension with \prm {ifchkdimension} was successful |
| 7457 |
this primitive returns the value. |
| 7458 |
|
| 7459 |
\stopnewprimitive |
| 7460 |
|
| 7461 |
\startnewprimitive[title={\prm {lastchknumber}}] |
| 7462 |
|
| 7463 |
When the last check for an integer with \prm {ifchknumber} was successful this |
| 7464 |
primitive returns the value. |
| 7465 |
|
| 7466 |
\stopnewprimitive |
| 7467 |
|
| 7468 |
\startoldprimitive[title={\prm {lastkern}}] |
| 7469 |
|
| 7470 |
This returns the last kern seen in the list (if possible). |
| 7471 |
|
| 7472 |
\stopoldprimitive |
| 7473 |
|
| 7474 |
\startnewprimitive[title={\prm {lastleftclass}}] |
| 7475 |
|
| 7476 |
This variable registers the first applied math class in a formula. |
| 7477 |
|
| 7478 |
\stopnewprimitive |
| 7479 |
|
| 7480 |
\startoldprimitive[title={\prm {lastlinefit}}] |
| 7481 |
|
| 7482 |
The \ETEX\ manuals explains this parameter in detail but in practice it is enough |
| 7483 |
to know that when set to 1000 spaces in the last line might match those in the |
| 7484 |
previous line. Basically it counters the strong push of a \prm {parfillskip}. |
| 7485 |
|
| 7486 |
\stopoldprimitive |
| 7487 |
|
| 7488 |
\startnewprimitive[title={\prm {lastloopiterator}}] |
| 7489 |
|
| 7490 |
In addition to \prm {currentloopiterator} we have a variant that stores the value |
| 7491 |
in case an unexpanded loop is used: |
| 7492 |
|
| 7493 |
\startbuffer |
| 7494 |
\localcontrolledrepeat 8 { [\the\currentloopiterator\eq\the\lastloopiterator] } |
| 7495 |
\expandedrepeat 8 { [\the\currentloopiterator\eq\the\lastloopiterator] } |
| 7496 |
\unexpandedrepeat 8 { [\the\currentloopiterator\ne\the\lastloopiterator] } |
| 7497 |
\stopbuffer |
| 7498 |
|
| 7499 |
\typebuffer |
| 7500 |
|
| 7501 |
\startlines |
| 7502 |
\getbuffer |
| 7503 |
\stoplines |
| 7504 |
|
| 7505 |
\stopnewprimitive |
| 7506 |
|
| 7507 |
\startnewprimitive[title={\prm {lastnamedcs}}] |
| 7508 |
|
| 7509 |
The example code in the previous section has some redundancy, in the sense that |
| 7510 |
there to be looked up control sequence name \type {mymacro} is assembled twice. |
| 7511 |
This is no big deal in a traditional eight bit \TEX\ but in a \UNICODE\ engine |
| 7512 |
multi|-|byte sequences demand some more processing (although it is unlikely that |
| 7513 |
control sequences have many multi|-|byte \UTF8\ characters). |
| 7514 |
|
| 7515 |
\starttyping |
| 7516 |
\ifcsname mymacro\endcsname |
| 7517 |
\csname mymacro\endcsname |
| 7518 |
\fi |
| 7519 |
\stoptyping |
| 7520 |
|
| 7521 |
Instead we can say: |
| 7522 |
|
| 7523 |
\starttyping |
| 7524 |
\ifcsname mymacro\endcsname |
| 7525 |
\lastnamedcs |
| 7526 |
\fi |
| 7527 |
\stoptyping |
| 7528 |
|
| 7529 |
Although there can be some performance benefits another advantage is that it uses |
| 7530 |
less tokens and parsing. It might even look nicer. |
| 7531 |
|
| 7532 |
\stopnewprimitive |
| 7533 |
|
| 7534 |
\startnewprimitive[title={\prm {lastnodesubtype}}] |
| 7535 |
|
| 7536 |
When possible this returns the subtype of the last node in the current node list. |
| 7537 |
Possible values can be queried (for each node type) via \LUA\ helpers. |
| 7538 |
|
| 7539 |
\stopnewprimitive |
| 7540 |
|
| 7541 |
\startoldprimitive[title={\prm {lastnodetype}}] |
| 7542 |
|
| 7543 |
When possible this returns the type of the last node in the current node list. |
| 7544 |
Possible values can be queried via \LUA\ helpers. |
| 7545 |
|
| 7546 |
\stopoldprimitive |
| 7547 |
|
| 7548 |
\startnewprimitive[title={\prm {lastpageextra}}] |
| 7549 |
|
| 7550 |
This reports the last applied (permitted) overshoot. |
| 7551 |
|
| 7552 |
\stopnewprimitive |
| 7553 |
|
| 7554 |
\startnewprimitive[title={\prm {lastparcontext}}] |
| 7555 |
|
| 7556 |
When a paragraph is wrapped up the reason is reported by this state variable. |
| 7557 |
Possible values are: |
| 7558 |
|
| 7559 |
\startfourrows |
| 7560 |
\getbuffer[engine:syntax:parcontextcodes] |
| 7561 |
\stopfourrows |
| 7562 |
|
| 7563 |
\stopnewprimitive |
| 7564 |
|
| 7565 |
\startnewprimitive[title={\prm {lastpartrigger}}] |
| 7566 |
|
| 7567 |
There are several reasons for entering a paragraphs and some are automatic and |
| 7568 |
triggered by other commands that force \TEX\ into horizontal mode. |
| 7569 |
|
| 7570 |
\startfourrows |
| 7571 |
\getbuffer[engine:syntax:partriggercodes] |
| 7572 |
\stopfourrows |
| 7573 |
|
| 7574 |
\stopnewprimitive |
| 7575 |
|
| 7576 |
\startoldprimitive[title={\prm {lastpenalty}}] |
| 7577 |
|
| 7578 |
This returns the last penalty seen in the list (if possible). |
| 7579 |
|
| 7580 |
\stopoldprimitive |
| 7581 |
|
| 7582 |
\startnewprimitive[title={\prm {lastrightclass}}] |
| 7583 |
|
| 7584 |
This variable registers the last applied math class in a formula. |
| 7585 |
|
| 7586 |
\stopnewprimitive |
| 7587 |
|
| 7588 |
\startoldprimitive[title={\prm {lastskip}}] |
| 7589 |
|
| 7590 |
This returns the last glue seen in the list (if possible). |
| 7591 |
|
| 7592 |
\stopoldprimitive |
| 7593 |
|
| 7594 |
\startoldprimitive[title={\prm {lccode}}] |
| 7595 |
|
| 7596 |
When the \prm {lowercase} operation is applied the lowercase code of a character |
| 7597 |
is used for the replacement. This primitive is used to set that code, so it |
| 7598 |
expects two character number. The code is also used to determine what characters |
| 7599 |
make a word suitable for hyphenation, although in \LUATEX\ we introduced the \prm |
| 7600 |
{hj} code for that. |
| 7601 |
|
| 7602 |
\stopoldprimitive |
| 7603 |
|
| 7604 |
\startoldprimitive[title={\prm {leaders}}] |
| 7605 |
|
| 7606 |
See \prm {gleaders} for an explanation. |
| 7607 |
|
| 7608 |
\stopoldprimitive |
| 7609 |
|
| 7610 |
\startoldprimitive[title={\prm {left}}] |
| 7611 |
|
| 7612 |
Inserts the given delimiter as left fence in a math formula. |
| 7613 |
|
| 7614 |
\stopoldprimitive |
| 7615 |
|
| 7616 |
\startoldprimitive[title={\prm {lefthyphenmin}}] |
| 7617 |
|
| 7618 |
This is the minimum number of characters after the last hyphen in a hyphenated |
| 7619 |
word. |
| 7620 |
|
| 7621 |
\stopoldprimitive |
| 7622 |
|
| 7623 |
\startnewprimitive[title={\prm {leftmarginkern}}] |
| 7624 |
|
| 7625 |
The dimension returned is the protrusion kern that has been added (if at all) |
| 7626 |
to the left of the content in the given box. |
| 7627 |
|
| 7628 |
\stopnewprimitive |
| 7629 |
|
| 7630 |
\startoldprimitive[title={\prm {leftskip}}] |
| 7631 |
|
| 7632 |
This skip will be inserted at the left of every line. |
| 7633 |
|
| 7634 |
\stopoldprimitive |
| 7635 |
|
| 7636 |
\startnewprimitive[title={\prm {lefttwindemerits}}] |
| 7637 |
|
| 7638 |
Additional demerits for a glyph sequence at the left edge when a previous line |
| 7639 |
also has that sequence. |
| 7640 |
|
| 7641 |
\stopnewprimitive |
| 7642 |
|
| 7643 |
\startoldprimitive[title={\prm {leqno}}] |
| 7644 |
|
| 7645 |
This primitive stores the (typeset) content (presumably a number) and when the |
| 7646 |
display formula is wrapped that number will end up left of the formula. |
| 7647 |
|
| 7648 |
\stopoldprimitive |
| 7649 |
|
| 7650 |
\startoldprimitive[title={\prm {let}}] |
| 7651 |
|
| 7652 |
Where a \prm {def} creates a new macro, either or not with argument, a \prm {let} |
| 7653 |
creates an alias. You are not limited to aliasing macros, basically everything |
| 7654 |
can be aliased. |
| 7655 |
|
| 7656 |
\stopoldprimitive |
| 7657 |
|
| 7658 |
\startnewprimitive[title={\prm {letcharcode}}] |
| 7659 |
|
| 7660 |
Assigning a meaning to an active character can sometimes be a bit cumbersome; |
| 7661 |
think of using some documented uppercase magic that one tends to forget as it's |
| 7662 |
used only a few times and then never looked at again. So we have this: |
| 7663 |
|
| 7664 |
\startbuffer |
| 7665 |
{\letcharcode 65 1 \catcode 65 13 A : \meaning A}\crlf |
| 7666 |
{\letcharcode 65 2 \catcode 65 13 A : \meaning A}\par |
| 7667 |
\stopbuffer |
| 7668 |
|
| 7669 |
\typebuffer |
| 7670 |
|
| 7671 |
here we define \type {A} as an active charcter with meaning \type {1} in the |
| 7672 |
first line and \type {2} in the second. |
| 7673 |
|
| 7674 |
{\tttf \getbuffer} |
| 7675 |
|
| 7676 |
Normally one will assign a control sequence: |
| 7677 |
|
| 7678 |
\startbuffer |
| 7679 |
{\letcharcode 66 \bf \catcode 66 13 {B bold}: \meaning B}\crlf |
| 7680 |
{\letcharcode 73 \it \catcode 73 13 {I italic}: \meaning I}\par |
| 7681 |
\stopbuffer |
| 7682 |
|
| 7683 |
\typebuffer |
| 7684 |
|
| 7685 |
Of course \type {\bf} and \type {\it} are \CONTEXT\ specific commands: |
| 7686 |
|
| 7687 |
{\tttf \getbuffer} |
| 7688 |
|
| 7689 |
\stopnewprimitive |
| 7690 |
|
| 7691 |
\startnewprimitive[title={\prm {letcsname}}] |
| 7692 |
|
| 7693 |
It is easy to see that we save two tokens when we use this primitive. As with the |
| 7694 |
\type {..defcs..} variants it also saves a push back of the composed macro name. |
| 7695 |
|
| 7696 |
\starttyping |
| 7697 |
\expandafter\let\csname MyMacro:1\endcsname\relax |
| 7698 |
\letcsname MyMacro:1\endcsname\relax |
| 7699 |
\stoptyping |
| 7700 |
|
| 7701 |
\stopnewprimitive |
| 7702 |
|
| 7703 |
\startnewprimitive[title={\prm {letfrozen}}] |
| 7704 |
|
| 7705 |
You can explicitly freeze an unfrozen macro: |
| 7706 |
|
| 7707 |
\starttyping |
| 7708 |
\def\MyMacro{...} |
| 7709 |
\letfrozen\MyMacro |
| 7710 |
\stoptyping |
| 7711 |
|
| 7712 |
A redefinition will now give: |
| 7713 |
|
| 7714 |
\starttyping |
| 7715 |
! You can't redefine a frozen macro. |
| 7716 |
\stoptyping |
| 7717 |
|
| 7718 |
\stopnewprimitive |
| 7719 |
|
| 7720 |
\startnewprimitive[title={\prm {letmathatomrule}}] |
| 7721 |
|
| 7722 |
You can change the class for a specific style. This probably only makes sense |
| 7723 |
for user classes. It's one of those features that we used when experimenting |
| 7724 |
with more control. |
| 7725 |
|
| 7726 |
\starttyping |
| 7727 |
\letmathatomrule 4 = 4 4 0 0 |
| 7728 |
\letmathatomrule 5 = 5 5 0 0 |
| 7729 |
\stoptyping |
| 7730 |
|
| 7731 |
This changes the classes~4 and~5 into class~ 0 in the two script styles and keeps |
| 7732 |
them the same in display and text. We leave it to the reader to ponder how useful |
| 7733 |
this is. |
| 7734 |
|
| 7735 |
\stopnewprimitive |
| 7736 |
|
| 7737 |
\startnewprimitive[title={\prm {letmathparent}}] |
| 7738 |
|
| 7739 |
This primitive takes five arguments: the target class, and four classes that |
| 7740 |
determine the pre penalty class, post penalty class, options class and a dummy |
| 7741 |
class for future use. |
| 7742 |
|
| 7743 |
\stopnewprimitive |
| 7744 |
|
| 7745 |
\startnewprimitive[title={\prm {letmathspacing}}] |
| 7746 |
|
| 7747 |
By default inter|-|class spacing inherits from the ordinary class but you can |
| 7748 |
remap specific combinations is you want: |
| 7749 |
|
| 7750 |
\starttyping |
| 7751 |
\letmathspacing \mathfunctioncode |
| 7752 |
\mathordinarycode \mathordinarycode |
| 7753 |
\mathordinarycode \mathordinarycode |
| 7754 |
\stoptyping |
| 7755 |
|
| 7756 |
The first value is the target class, and the nest four tell how it behaves in |
| 7757 |
display, text, script and script script style. Here \typ {\mathfunctioncode} is a |
| 7758 |
\CONTEXT\ specific class (\the\mathfunctioncode), one of the many. |
| 7759 |
|
| 7760 |
\stopnewprimitive |
| 7761 |
|
| 7762 |
\startnewprimitive[title={\prm {letprotected}}] |
| 7763 |
|
| 7764 |
Say that you have these definitions: |
| 7765 |
|
| 7766 |
\startbuffer |
| 7767 |
\def \MyMacroA{alpha} |
| 7768 |
\protected \def \MyMacroB{beta} |
| 7769 |
\edef \MyMacroC{\MyMacroA\MyMacroB} |
| 7770 |
\letprotected \MyMacroA |
| 7771 |
\edef \MyMacroD{\MyMacroA\MyMacroB} |
| 7772 |
\meaning \MyMacroC\crlf |
| 7773 |
\meaning \MyMacroD\par |
| 7774 |
\stopbuffer |
| 7775 |
|
| 7776 |
\typebuffer |
| 7777 |
|
| 7778 |
The typeset meaning in this example is: |
| 7779 |
|
| 7780 |
{\tttf \getbuffer} |
| 7781 |
|
| 7782 |
\stopnewprimitive |
| 7783 |
|
| 7784 |
\startnewprimitive[title={\prm {lettolastnamedcs}}] |
| 7785 |
|
| 7786 |
The \prm {lastnamedcs} primitive is somewhat special as it is a (possible) |
| 7787 |
reference to a control sequence which is why we have a dedicated variant of |
| 7788 |
\prm {let}. |
| 7789 |
|
| 7790 |
\startbuffer |
| 7791 |
\csname relax\endcsname\let \foo\lastnamedcs \meaning\foo |
| 7792 |
\csname relax\endcsname\expandafter\let\expandafter \oof\lastnamedcs \meaning\oof |
| 7793 |
\csname relax\endcsname\lettolastnamedcs \ofo \meaning\ofo |
| 7794 |
\stopbuffer |
| 7795 |
|
| 7796 |
\typebuffer % we need oneliners because intermediate csnames kick in |
| 7797 |
|
| 7798 |
These give the following where the first one obviously is not doing what we want |
| 7799 |
and the second one is kind of cumbersome. |
| 7800 |
|
| 7801 |
\startlines |
| 7802 |
\getbuffer |
| 7803 |
\stoplines |
| 7804 |
|
| 7805 |
\stopnewprimitive |
| 7806 |
|
| 7807 |
\startnewprimitive[title={\prm {lettonothing}}] |
| 7808 |
|
| 7809 |
This one let's a control sequence to nothing. Assuming that \type {\empty} |
| 7810 |
is indeed empty, these two lines are equivalent. |
| 7811 |
|
| 7812 |
\starttyping |
| 7813 |
\let \foo\empty |
| 7814 |
\lettonothing\oof |
| 7815 |
\stoptyping |
| 7816 |
|
| 7817 |
\stopnewprimitive |
| 7818 |
|
| 7819 |
\startoldprimitive[title={\prm {limits}}] |
| 7820 |
|
| 7821 |
This is a modifier: it flags the previous math atom to have its scripts above and |
| 7822 |
below the (summation, product, integral etc.) symbol. In \LUAMETATEX\ this can be |
| 7823 |
any atom (that is: any class). In display mode the location defaults to above and |
| 7824 |
below. |
| 7825 |
|
| 7826 |
Like any modifier it looks back for a math specific element. This means that the |
| 7827 |
following will work well: |
| 7828 |
|
| 7829 |
\starttyping |
| 7830 |
\sum \limits ^2 _3 |
| 7831 |
\sum ^2 \limits _3 |
| 7832 |
\sum ^2 _3 \limits |
| 7833 |
\sum ^2 _3 \limits \nolimits \limits |
| 7834 |
\stoptyping |
| 7835 |
|
| 7836 |
because scripts are bound to these elements so looking back just sees the element. |
| 7837 |
|
| 7838 |
\stopoldprimitive |
| 7839 |
|
| 7840 |
\startnewprimitive[title={\prm {linebreakchecks}}] |
| 7841 |
|
| 7842 |
The value of this parameter is passed to the linebreak callback so that one can |
| 7843 |
act on it if needed. |
| 7844 |
|
| 7845 |
\stopnewprimitive |
| 7846 |
|
| 7847 |
\startnewprimitive[title={\prm {linebreakoptional}}] |
| 7848 |
|
| 7849 |
This selects the optional text range that is to be used. Optional content is |
| 7850 |
marked with {optionalboundary} nodes. |
| 7851 |
|
| 7852 |
\stopnewprimitive |
| 7853 |
|
| 7854 |
\startnewprimitive[title={\prm {linebreakpasses}}] |
| 7855 |
|
| 7856 |
When set to a positive value it will apply additional line break runs defined |
| 7857 |
with \prm {parpasses} until the criteria set in there are met. |
| 7858 |
|
| 7859 |
\stopnewprimitive |
| 7860 |
|
| 7861 |
\startnewprimitive[title={\prm {linedirection}}] |
| 7862 |
|
| 7863 |
This sets the text direction (1 for \type {r2l}) to the given value but keeps |
| 7864 |
preceding glue into the range. |
| 7865 |
|
| 7866 |
\stopnewprimitive |
| 7867 |
|
| 7868 |
\startoldprimitive[title={\prm {linepenalty}}] |
| 7869 |
|
| 7870 |
Every line gets this penalty attached, so normally it is a small value, like |
| 7871 |
here: \the \linepenalty. |
| 7872 |
|
| 7873 |
\stopoldprimitive |
| 7874 |
|
| 7875 |
\startoldprimitive[title={\prm {lineskip}}] |
| 7876 |
|
| 7877 |
This is the amount of glue that gets added when the distance between lines falls |
| 7878 |
below \prm {lineskiplimit}. |
| 7879 |
|
| 7880 |
\stopoldprimitive |
| 7881 |
|
| 7882 |
\startoldprimitive[title={\prm {lineskiplimit}}] |
| 7883 |
|
| 7884 |
When the distance between two lines becomes less than \prm {lineskiplimit} a \prm |
| 7885 |
{lineskip} glue item is added. |
| 7886 |
|
| 7887 |
\startbuffer |
| 7888 |
\ruledvbox{ |
| 7889 |
\lineskiplimit 0pt \lineskip3pt \baselineskip0pt |
| 7890 |
\ruledhbox{line 1} |
| 7891 |
\ruledhbox{line 2} |
| 7892 |
\ruledhbox{\tx line 3} |
| 7893 |
} |
| 7894 |
\stopbuffer |
| 7895 |
|
| 7896 |
\typebuffer |
| 7897 |
|
| 7898 |
Normally the \prm {baselineskip} kicks in first but here we've set that to zero, |
| 7899 |
so we get two times a 3pt glue injected. |
| 7900 |
|
| 7901 |
\startlocallinecorrection |
| 7902 |
\getbuffer |
| 7903 |
\stoplocallinecorrection |
| 7904 |
|
| 7905 |
\stopoldprimitive |
| 7906 |
|
| 7907 |
\startnewprimitive[title={\prm {localbreakpar}}] |
| 7908 |
|
| 7909 |
This forces a newline in a paragraph without side effects so that for instance |
| 7910 |
\prm {widowpenalties} work as expected in scenarios where using a \prm {par} |
| 7911 |
would have been the solution. This is an experimental primitive! |
| 7912 |
|
| 7913 |
\stopnewprimitive |
| 7914 |
|
| 7915 |
\startnewprimitive[title={\prm {localbrokenpenalty}}] |
| 7916 |
TODO |
| 7917 |
\stopnewprimitive |
| 7918 |
|
| 7919 |
\startnewprimitive[title={\prm {localcontrol}}] |
| 7920 |
|
| 7921 |
This primitive takes a single token: |
| 7922 |
|
| 7923 |
\startbuffer |
| 7924 |
\edef\testa{\scratchcounter123 \the\scratchcounter} |
| 7925 |
\edef\testc{\testa \the\scratchcounter} |
| 7926 |
\edef\testd{\localcontrol\testa \the\scratchcounter} |
| 7927 |
\stopbuffer |
| 7928 |
|
| 7929 |
\typebuffer |
| 7930 |
|
| 7931 |
The three meanings are: |
| 7932 |
|
| 7933 |
\start \getbuffer |
| 7934 |
\starttabulate[|T|T|] |
| 7935 |
\NC \string\testa \NC \meaning\testa \NC \NR |
| 7936 |
\NC \string\testc \NC \meaning\testc \NC \NR |
| 7937 |
\NC \string\testd \NC \meaning\testd \NC \NR |
| 7938 |
\stoptabulate |
| 7939 |
\stop |
| 7940 |
|
| 7941 |
The \prm {localcontrol} makes that the following token gets expanded so we don't |
| 7942 |
see the yet to be expanded assignment show up in the macro body. |
| 7943 |
|
| 7944 |
\stopnewprimitive |
| 7945 |
|
| 7946 |
\startnewprimitive[title={\prm {localcontrolled}}] |
| 7947 |
|
| 7948 |
The previously described local control feature comes with two extra helpers. The |
| 7949 |
\prm {localcontrolled} primitive takes a token list and wraps this into a local |
| 7950 |
control sidetrack. For example: |
| 7951 |
|
| 7952 |
\startbuffer |
| 7953 |
\edef\testa{\scratchcounter123 \the\scratchcounter} |
| 7954 |
\edef\testb{\localcontrolled{\scratchcounter123}\the\scratchcounter} |
| 7955 |
\stopbuffer |
| 7956 |
|
| 7957 |
\typebuffer |
| 7958 |
|
| 7959 |
The two meanings are: |
| 7960 |
|
| 7961 |
\start \getbuffer |
| 7962 |
\starttabulate[|T|T|] |
| 7963 |
\NC \string\testa \NC \meaningfull\testa \NC \NR |
| 7964 |
\NC \string\testb \NC \meaningfull\testb \NC \NR |
| 7965 |
\stoptabulate |
| 7966 |
\stop |
| 7967 |
|
| 7968 |
The assignment is applied immediately in the expanded definition. |
| 7969 |
|
| 7970 |
\stopnewprimitive |
| 7971 |
|
| 7972 |
\startnewprimitive[title={\prm {localcontrolledendless}}] |
| 7973 |
|
| 7974 |
As the name indicates this will loop forever. You need to explicitly quit the |
| 7975 |
loop with \prm {quitloop} or \prm {quitloopnow}. The first quitter aborts the |
| 7976 |
loop at the start of a next iteration, the second one tries to exit immediately, |
| 7977 |
but is sensitive for interference with for instance nested conditionals. Of |
| 7978 |
course in the next case one can just adapt the final iterator value instead. Here |
| 7979 |
we step by 2: |
| 7980 |
|
| 7981 |
\startbuffer |
| 7982 |
\expandedloop 1 20 2 {% |
| 7983 |
\ifnum\currentloopiterator>10 |
| 7984 |
\quitloop |
| 7985 |
\else |
| 7986 |
[!] |
| 7987 |
\fi |
| 7988 |
} |
| 7989 |
\stopbuffer |
| 7990 |
|
| 7991 |
\typebuffer |
| 7992 |
|
| 7993 |
This results in: |
| 7994 |
|
| 7995 |
\getbuffer |
| 7996 |
|
| 7997 |
\stopnewprimitive |
| 7998 |
|
| 7999 |
\startnewprimitive[title={\prm {localcontrolledloop}}] |
| 8000 |
|
| 8001 |
As with more of the primitives discussed here, there is a manual in the \quote |
| 8002 |
{lowlevel} subset that goes into more detail. So, here a simple example has to |
| 8003 |
do: |
| 8004 |
|
| 8005 |
\startbuffer |
| 8006 |
\localcontrolledloop 1 100 1 {% |
| 8007 |
\ifnum\currentloopiterator>6\relax |
| 8008 |
\quitloop |
| 8009 |
\else |
| 8010 |
[\number\currentloopnesting:\number\currentloopiterator] |
| 8011 |
\localcontrolledloop 1 8 1 {% |
| 8012 |
(\number\currentloopnesting:\number\currentloopiterator) |
| 8013 |
}\par |
| 8014 |
\fi |
| 8015 |
} |
| 8016 |
\stopbuffer |
| 8017 |
|
| 8018 |
\typebuffer |
| 8019 |
|
| 8020 |
Here we see the main loop primitive being used nested. The code shows how we can |
| 8021 |
\prm {quitloop} and have access to the \prm {currentloopiterator} as well as the |
| 8022 |
nesting depth \prm {currentloopnesting}. |
| 8023 |
|
| 8024 |
\startpacked \getbuffer \stoppacked |
| 8025 |
|
| 8026 |
Be aware of the fact that \prm {quitloop} will end the loop at the {\em next} |
| 8027 |
iteration so any content after it will show up. Normally this one will be issued |
| 8028 |
in a condition and we want to end that properly. Also keep in mind that because |
| 8029 |
we use local control (a nested \TEX\ expansion loop) anything you feed back can |
| 8030 |
be injected out of order. |
| 8031 |
|
| 8032 |
The three numbers can be separated by an equal sign which is a trick to avoid |
| 8033 |
look ahead issues that can result from multiple serialized numbers without spaces |
| 8034 |
that indicate the end of sequence of digits. |
| 8035 |
|
| 8036 |
\stopnewprimitive |
| 8037 |
|
| 8038 |
\startnewprimitive[title={\prm {localcontrolledrepeat}}] |
| 8039 |
|
| 8040 |
This one takes one instead three arguments which looks a bit better |
| 8041 |
in simple looping. |
| 8042 |
|
| 8043 |
\stopnewprimitive |
| 8044 |
|
| 8045 |
\startnewprimitive[title={\prm {localinterlinepenalty}}] |
| 8046 |
TODO |
| 8047 |
\stopnewprimitive |
| 8048 |
|
| 8049 |
\startnewprimitive[title={\prm {localleftbox}}] |
| 8050 |
|
| 8051 |
This sets the box that gets injected at the left of every line. |
| 8052 |
|
| 8053 |
\stopnewprimitive |
| 8054 |
|
| 8055 |
\startnewprimitive[title={\prm {localleftboxbox}}] |
| 8056 |
|
| 8057 |
This returns the box set with \prm {localleftbox}. |
| 8058 |
|
| 8059 |
\stopnewprimitive |
| 8060 |
|
| 8061 |
\startnewprimitive[title={\prm {localmiddlebox}}] |
| 8062 |
|
| 8063 |
This sets the box that gets injected at the left of every line but its width |
| 8064 |
is ignored. |
| 8065 |
|
| 8066 |
\stopnewprimitive |
| 8067 |
|
| 8068 |
\startnewprimitive[title={\prm {localmiddleboxbox}}] |
| 8069 |
|
| 8070 |
This returns the box set with \prm {localmiddlebox}. |
| 8071 |
|
| 8072 |
\stopnewprimitive |
| 8073 |
|
| 8074 |
\startnewprimitive[title={\prm {localpretolerance}}] |
| 8075 |
TODO |
| 8076 |
\stopnewprimitive |
| 8077 |
|
| 8078 |
\startnewprimitive[title={\prm {localrightbox}}] |
| 8079 |
|
| 8080 |
This sets the box that gets injected at the right of every line. |
| 8081 |
|
| 8082 |
\stopnewprimitive |
| 8083 |
|
| 8084 |
\startnewprimitive[title={\prm {localrightboxbox}}] |
| 8085 |
|
| 8086 |
This returns the box set with \prm {localrightbox}. |
| 8087 |
|
| 8088 |
\stopnewprimitive |
| 8089 |
|
| 8090 |
\startnewprimitive[title={\prm {localtolerance}}] |
| 8091 |
TODO |
| 8092 |
\stopnewprimitive |
| 8093 |
|
| 8094 |
\startoldprimitive[title={\prm {long}}][obsolete=yes] |
| 8095 |
|
| 8096 |
This original prefix gave the macro being defined the property that it could not |
| 8097 |
have \prm {par} (or the often equivalent empty lines) in its arguments. It was |
| 8098 |
mostly a protection against a forgotten right curly brace, resulting in a so called |
| 8099 |
run|-|away argument. That mattered on a paper terminal or slow system where such a |
| 8100 |
situation should be catched early. In \LUATEX\ it was already optional, and in |
| 8101 |
\LUAMETATEX\ we dropped this feature completely (so that we could introduce others). |
| 8102 |
|
| 8103 |
\stopoldprimitive |
| 8104 |
|
| 8105 |
\startoldprimitive[title={\prm {looseness}}] |
| 8106 |
|
| 8107 |
The number fo lines in the current paragraph will be increased by given number of |
| 8108 |
lines. For this to succeed there need to be enough stretch in the spacing to make |
| 8109 |
that happen. There is some wishful thinking involved. |
| 8110 |
|
| 8111 |
\stopoldprimitive |
| 8112 |
|
| 8113 |
\startoldprimitive[title={\prm {lower}}] |
| 8114 |
|
| 8115 |
This primitive takes two arguments, a dimension and a box. The box is moved down. |
| 8116 |
The operation only succeeds in horizontal mode. |
| 8117 |
|
| 8118 |
\stopoldprimitive |
| 8119 |
|
| 8120 |
\startoldprimitive[title={\prm {lowercase}}] |
| 8121 |
|
| 8122 |
This token processor converts character tokens to their lowercase counterparts as |
| 8123 |
defined per \prm {lccode}. In order to permit dirty tricks active characters are |
| 8124 |
also processed. We don't really use this primitive in \CONTEXT, but for |
| 8125 |
consistency we let it respond to \prm {expand}: \footnote {Instead of providing |
| 8126 |
\type {\lowercased} and \type {\uppercased} primitives that would clash with |
| 8127 |
macros anyway.} |
| 8128 |
|
| 8129 |
\startbuffer |
| 8130 |
\edef \foo {\lowercase{tex TeX \TEX}} \meaningless\foo |
| 8131 |
\lowercase{\edef\foo {tex TeX \TEX}} \meaningless\foo |
| 8132 |
\edef \foo{\expand\lowercase{tex TeX \TEX}} \meaningless\foo |
| 8133 |
\stopbuffer |
| 8134 |
|
| 8135 |
\typebuffer |
| 8136 |
|
| 8137 |
Watch how \prm {lowercase} is not expandable but can be forced to. Of course, as |
| 8138 |
the logo macro is protected the \TEX\ logo remains mixed case. |
| 8139 |
|
| 8140 |
\startlines |
| 8141 |
\getbuffer |
| 8142 |
\stoplines |
| 8143 |
|
| 8144 |
\stopoldprimitive |
| 8145 |
|
| 8146 |
\startnewprimitive[title={\prm {lpcode}}] |
| 8147 |
|
| 8148 |
This one can be used to set the left protrusion factor of a glyph in a font and |
| 8149 |
takes three arguments: font, character code and factor. It is kind of obsolete |
| 8150 |
because we can set up vectors at definition time and tweaking from \TEX\ can have |
| 8151 |
side effects because it globally adapts the font. |
| 8152 |
|
| 8153 |
\stopnewprimitive |
| 8154 |
|
| 8155 |
\startnewprimitive[title={\prm {luaboundary}}] |
| 8156 |
|
| 8157 |
This primive inserts a boundary that takes two integer values. Some mechanisms |
| 8158 |
(like math constructors) can trigger a callback when preceded by such a boundary. |
| 8159 |
As we go more mechanisms might do such a check but we don't want a performance |
| 8160 |
hit on \CONTEXT\ as we do so (nor unwanted interference). |
| 8161 |
|
| 8162 |
\stopnewprimitive |
| 8163 |
|
| 8164 |
\startnewprimitive[title={\prm {luabytecode}}] |
| 8165 |
|
| 8166 |
This behaves like \prm {luafunction} but here the number is a byte code register. |
| 8167 |
These bytecodes are in the \typ {lua.bytecode} array. |
| 8168 |
|
| 8169 |
\stopnewprimitive |
| 8170 |
|
| 8171 |
\startnewprimitive[title={\prm {luabytecodecall}}] |
| 8172 |
|
| 8173 |
This behaves like \prm {luafunctioncall} but here the number is a byte code |
| 8174 |
register. These bytecodes are in the \typ {lua.bytecode} array. |
| 8175 |
|
| 8176 |
\stopnewprimitive |
| 8177 |
|
| 8178 |
\startnewprimitive[title={\prm {luacopyinputnodes}}] |
| 8179 |
|
| 8180 |
When set to a positive value this will ensure that when nodes are printed from |
| 8181 |
\LUA\ to \TEX\ copies are used. |
| 8182 |
|
| 8183 |
\stopnewprimitive |
| 8184 |
|
| 8185 |
\startnewprimitive[title={\prm {luadef}}] |
| 8186 |
|
| 8187 |
% \edef\foocode{\ctxlua{ |
| 8188 |
% context( |
| 8189 |
% context.functions.register( |
| 8190 |
% function() context("!") end |
| 8191 |
% ) |
| 8192 |
% ) |
| 8193 |
% }} |
| 8194 |
|
| 8195 |
This command relates a (user) command to a \LUA\ function registered in the \typ |
| 8196 |
{lua.lualib_get_functions_table()}, so after: |
| 8197 |
|
| 8198 |
\starttyping |
| 8199 |
\luadef\foo123 |
| 8200 |
\stoptyping |
| 8201 |
|
| 8202 |
the \type {\foo} command will trigger the function at index 123. Of course a |
| 8203 |
macro package has to make sure that these definitions are unique. \footnote |
| 8204 |
{Plain \TEX\ established a norm for allocating registers, like \typ {\newdimen} |
| 8205 |
but there is no such convention for \LUA\ functions.} |
| 8206 |
|
| 8207 |
This command is accompanied by \prm {luafunctioncall} and |
| 8208 |
\prm {luafunction}. When we have funciton 123 defined as |
| 8209 |
|
| 8210 |
\starttyping |
| 8211 |
function() tex.sprint("!") end |
| 8212 |
\stoptyping |
| 8213 |
|
| 8214 |
the following: |
| 8215 |
|
| 8216 |
\starttyping |
| 8217 |
(\luafunctioncall \foocode ?) |
| 8218 |
(\normalluafunction\foocode ?) |
| 8219 |
(\foo ?) |
| 8220 |
\stoptyping |
| 8221 |
|
| 8222 |
gives three times \type {(!?)}. But this: |
| 8223 |
|
| 8224 |
\starttyping |
| 8225 |
\edef\oof{\foo } \meaning\oof % protected |
| 8226 |
\edef\oof{\luafunctioncall \foocode} \meaning\oof % protected |
| 8227 |
\edef\oof{\normalluafunction\foocode} \meaning\oof % expands |
| 8228 |
\stoptyping |
| 8229 |
|
| 8230 |
returns: |
| 8231 |
|
| 8232 |
\starttyping |
| 8233 |
macro:! |
| 8234 |
macro:\luafunctioncall 1740 |
| 8235 |
macro:! |
| 8236 |
\stoptyping |
| 8237 |
|
| 8238 |
Because the definition command is like any other |
| 8239 |
|
| 8240 |
\starttyping |
| 8241 |
\permanent\protected\luadef\foo123 |
| 8242 |
\stoptyping |
| 8243 |
|
| 8244 |
boils down to: |
| 8245 |
|
| 8246 |
\starttyping |
| 8247 |
permanent protected luacall 123 |
| 8248 |
\stoptyping |
| 8249 |
|
| 8250 |
\stopnewprimitive |
| 8251 |
|
| 8252 |
\startnewprimitive[title={\prm {luaescapestring}}] |
| 8253 |
|
| 8254 |
This command converts the given (token) list into something that is acceptable |
| 8255 |
for \LUA. It is inherited from \LUATEX\ and not used in \CONTEXT. |
| 8256 |
|
| 8257 |
\startbuffer |
| 8258 |
\directlua { tex.print ("\luaescapestring {{\tt This is a "test".}}") } |
| 8259 |
\stopbuffer |
| 8260 |
|
| 8261 |
\typebuffer |
| 8262 |
|
| 8263 |
Results in: \inlinebuffer\space (Watch the grouping.) |
| 8264 |
|
| 8265 |
\stopnewprimitive |
| 8266 |
|
| 8267 |
\startnewprimitive[title={\prm {luafunction}}] |
| 8268 |
|
| 8269 |
The integer passed to this primitive is the index in the table returned by \typ |
| 8270 |
{lua.lualib_get_functions_table()}. Of course a macro package has to provide |
| 8271 |
reliable management for this. This is a so called convert command so it expands |
| 8272 |
in an expansion context (like an \prm {edef}). |
| 8273 |
|
| 8274 |
\stopnewprimitive |
| 8275 |
|
| 8276 |
\startnewprimitive[title={\prm {luafunctioncall}}] |
| 8277 |
|
| 8278 |
The integer passed to this primitive is the index in the table returned by \typ |
| 8279 |
{lua.lualib_get_functions_table()}. Of course a macro package has to provide |
| 8280 |
reliable management for this. This primitive doesn't expand in an expansion |
| 8281 |
context (like an \prm {edef}). |
| 8282 |
|
| 8283 |
\stopnewprimitive |
| 8284 |
|
| 8285 |
\startnewprimitive[title={\prm {luametatexmajorversion}}] |
| 8286 |
|
| 8287 |
This is the numeric major version number, so it's an integer: \the |
| 8288 |
\luametatexmajorversion, which will only change when we have very drastic |
| 8289 |
changes. The whole repertoire of numbers is: |
| 8290 |
|
| 8291 |
\starttabulate |
| 8292 |
\NC \type {\the\luametatexmajorversion} \NC \the\luametatexmajorversion \NC \NR |
| 8293 |
\NC \type {\the\luametatexminorversion} \NC \the\luametatexminorversion \NC \NR |
| 8294 |
\NC \type {\the\luametatexrelease} \NC \the\luametatexrelease \NC \NR |
| 8295 |
\NC \type {\the\luatexversion} \NC \the\luatexversion \NC \NR |
| 8296 |
\NC \type {\the\luatexrevision} \NC \the\luatexrevision \NC \NR |
| 8297 |
\stoptabulate |
| 8298 |
|
| 8299 |
The last two are there because they might be tested but the first three are the |
| 8300 |
official ones. |
| 8301 |
|
| 8302 |
\stopnewprimitive |
| 8303 |
|
| 8304 |
\startnewprimitive[title={\prm {luametatexminorversion}}] |
| 8305 |
|
| 8306 |
This is a numeric minor version number, so it's an integer: \the |
| 8307 |
\luametatexminorversion. It changes when we add functionality. Intermediate |
| 8308 |
updates |
| 8309 |
|
| 8310 |
\stopnewprimitive |
| 8311 |
|
| 8312 |
\startnewprimitive[title={\prm {luametatexrelease}}] |
| 8313 |
|
| 8314 |
This is a numeric release number, so it's an integer: \the\luametatexrelease. It |
| 8315 |
changes when we are developing functionality. |
| 8316 |
|
| 8317 |
\stopnewprimitive |
| 8318 |
|
| 8319 |
\startnewprimitive[title={\prm {luatexbanner}}] |
| 8320 |
|
| 8321 |
This gives: {\tttf \luatexbanner}. |
| 8322 |
|
| 8323 |
\stopnewprimitive |
| 8324 |
|
| 8325 |
\startnewprimitive[title={\prm {luatexrevision}}] |
| 8326 |
|
| 8327 |
This is an integer. The current value is: {\tttf \number\luatexrevision}. |
| 8328 |
|
| 8329 |
\stopnewprimitive |
| 8330 |
|
| 8331 |
\startnewprimitive[title={\prm {luatexversion}}] |
| 8332 |
|
| 8333 |
This is an integer. The current value is: {\tttf \number\luatexversion}. |
| 8334 |
|
| 8335 |
\stopnewprimitive |
| 8336 |
|
| 8337 |
\startoldprimitive[title={\prm {mark}}][obsolete=yes] |
| 8338 |
|
| 8339 |
The given token list is stored in a node in the current list and might become |
| 8340 |
content of \prm {topmark}, \prm {botmark} or \prm {firstmark} when a page split |
| 8341 |
off, or in the case of a box split in \prm {splitbotmark} or \prm |
| 8342 |
{splitfirstmark}. In \LUAMETATEX\ deeply burried marks bubbly up to an outer box |
| 8343 |
level. |
| 8344 |
|
| 8345 |
\stopoldprimitive |
| 8346 |
|
| 8347 |
\startoldprimitive[title={\prm {marks}}] |
| 8348 |
|
| 8349 |
This command is similar to \prm {mark} but first expects a number of a mark |
| 8350 |
register. Multiple marks were introduced in \ETEX. |
| 8351 |
|
| 8352 |
\stopoldprimitive |
| 8353 |
|
| 8354 |
\startoldprimitive[title={\prm {mathaccent}}][obsolete=yes] |
| 8355 |
|
| 8356 |
This takes a number and a math object to put the accent on. The four byte number |
| 8357 |
has a dummy class byte, a family byte and two index bytes. It is replaced by \prm |
| 8358 |
{Umathaccent} that handles wide fonts. |
| 8359 |
|
| 8360 |
\stopoldprimitive |
| 8361 |
|
| 8362 |
\startnewprimitive[title={\prm {mathatom}}] |
| 8363 |
|
| 8364 |
This operation wraps following content in a atom with the given class. It is part |
| 8365 |
of \LUAMETATEX's extended math support. There are three class related |
| 8366 |
key|/|values: \type {class}, \typ {leftclass} and \typ {rightclass} (or \type |
| 8367 |
{all} for all of them). When none is given this command expects a class number |
| 8368 |
before scanning the content. The \type {options} key expects a bitset but there |
| 8369 |
are also direct option keys, like \type {limits}, \typ {nolimits}, \type |
| 8370 |
{unpack}, \type {unroll}, \type {single}, \type {nooverflow}, \type {void} and |
| 8371 |
\type {phantom}. A \type {source} id can be set, one or more \type {attr} |
| 8372 |
assigned, and for specific purposes \typ {textfont} and \typ {mathfont} |
| 8373 |
directives are accepted. Features like this are discussed in dedicated manuals. |
| 8374 |
|
| 8375 |
\stopnewprimitive |
| 8376 |
|
| 8377 |
\startnewprimitive[title={\prm {mathatomglue}}] |
| 8378 |
|
| 8379 |
This returns the glue that will be inserted between two atoms of a given class |
| 8380 |
for a specific style. |
| 8381 |
|
| 8382 |
\startbuffer |
| 8383 |
\the\mathatomglue \textstyle 1 1 |
| 8384 |
\the\mathatomglue \textstyle 0 2 |
| 8385 |
\the\mathatomglue \scriptstyle 1 1 |
| 8386 |
\the\mathatomglue \scriptstyle 0 2 |
| 8387 |
\stopbuffer |
| 8388 |
|
| 8389 |
\typebuffer |
| 8390 |
|
| 8391 |
\startlines \tttf |
| 8392 |
\getbuffer |
| 8393 |
\stoplines |
| 8394 |
|
| 8395 |
\stopnewprimitive |
| 8396 |
|
| 8397 |
\startnewprimitive[title={\prm {mathatomskip}}] |
| 8398 |
|
| 8399 |
\startbuffer |
| 8400 |
$x x$ |
| 8401 |
$x \mathatomskip \textstyle 1 1 x$ |
| 8402 |
$x \mathatomskip \textstyle 0 2 x$ |
| 8403 |
$x \mathatomskip \scriptstyle 1 1 x$ |
| 8404 |
$x \mathatomskip \scriptstyle 0 2 x$ |
| 8405 |
\stopbuffer |
| 8406 |
|
| 8407 |
This injects a glue with the given style and class pair specification: |
| 8408 |
\inlinebuffer. |
| 8409 |
|
| 8410 |
\typebuffer |
| 8411 |
|
| 8412 |
|
| 8413 |
\stopnewprimitive |
| 8414 |
|
| 8415 |
\startnewprimitive[title={\prm {mathbackwardpenalties}}] |
| 8416 |
|
| 8417 |
See \prm {mathforwardpenalties} for an explanation. |
| 8418 |
|
| 8419 |
\stopnewprimitive |
| 8420 |
|
| 8421 |
\startnewprimitive[title={\prm {mathbeginclass}}] |
| 8422 |
|
| 8423 |
This variable can be set to signal the class that starts the formula (think of an |
| 8424 |
imaginary leading atom). |
| 8425 |
|
| 8426 |
\stopnewprimitive |
| 8427 |
|
| 8428 |
\startoldprimitive[title={\prm {mathbin}}] |
| 8429 |
|
| 8430 |
This operation wraps following content in a atom with class \quote {binary}. |
| 8431 |
|
| 8432 |
\stopoldprimitive |
| 8433 |
|
| 8434 |
\startnewprimitive[title={\prm {mathboundary}}] |
| 8435 |
|
| 8436 |
This primitive is part of an experiment with granular penalties in math. When set |
| 8437 |
nested fences will use the \prm {mathdisplaypenaltyfactor} or \prm |
| 8438 |
{mathinlinepenaltyfactor} to increase nested penalties. A bit more control is |
| 8439 |
possible with \prm {mathboundary}: |
| 8440 |
|
| 8441 |
\starttabulate[||||] |
| 8442 |
\NC 0 \NC begin \NC factor 1000 \NC \NR |
| 8443 |
\NC 1 \NC end \NC factor 1000 \NC \NR |
| 8444 |
\NC 2 \NC begin \NC given factor \NC \NR |
| 8445 |
\NC 3 \NC end \NC given factor \NC \NR |
| 8446 |
\stoptabulate |
| 8447 |
|
| 8448 |
These will be used when the mentioned factors are zero. The last two variants |
| 8449 |
expect factor to be given. |
| 8450 |
|
| 8451 |
\stopnewprimitive |
| 8452 |
|
| 8453 |
\startoldprimitive[title={\prm {mathchar}}][obsolete=yes] |
| 8454 |
|
| 8455 |
Replaced by \prm {Umathchar} this old one takes a four byte number: one byte for |
| 8456 |
the class, one for the family an two for the index. The specified character is |
| 8457 |
appended to to the list. |
| 8458 |
|
| 8459 |
\stopoldprimitive |
| 8460 |
|
| 8461 |
\startnewprimitive[title={\prm {mathcharclass}}] |
| 8462 |
|
| 8463 |
Returns the slot (in the font) of the given math character. |
| 8464 |
|
| 8465 |
\startbuffer |
| 8466 |
\the\mathcharclass\Umathchar 4 2 123 |
| 8467 |
\stopbuffer |
| 8468 |
|
| 8469 |
\typebuffer |
| 8470 |
|
| 8471 |
The first passed number is the class, so we get: \inlinebuffer. |
| 8472 |
|
| 8473 |
\stopnewprimitive |
| 8474 |
|
| 8475 |
\startoldprimitive[title={\prm {mathchardef}}][obsolete=yes] |
| 8476 |
|
| 8477 |
Replaced by \prm {Umathchardef} this primitive relates a control sequence with a |
| 8478 |
four byte number: one byte for the class, one for the family an two for the |
| 8479 |
index. The defined command will insert that character. |
| 8480 |
|
| 8481 |
\stopoldprimitive |
| 8482 |
|
| 8483 |
\startnewprimitive[title={\prm {mathcharfam}}] |
| 8484 |
|
| 8485 |
Returns the family number of the given math character. |
| 8486 |
|
| 8487 |
\startbuffer |
| 8488 |
\the\mathcharfam\Umathchar 4 2 123 |
| 8489 |
\stopbuffer |
| 8490 |
|
| 8491 |
\typebuffer |
| 8492 |
|
| 8493 |
The second passed number is the family, so we get: \inlinebuffer. |
| 8494 |
|
| 8495 |
\stopnewprimitive |
| 8496 |
|
| 8497 |
\startnewprimitive[title={\prm {mathcharslot}}] |
| 8498 |
|
| 8499 |
Returns the slot (or index in the font) of the given math character. |
| 8500 |
|
| 8501 |
\startbuffer |
| 8502 |
\the\mathcharslot\Umathchar 4 2 123 |
| 8503 |
\stopbuffer |
| 8504 |
|
| 8505 |
\typebuffer |
| 8506 |
|
| 8507 |
The third passed number is the slot, so we get: \inlinebuffer. |
| 8508 |
|
| 8509 |
\stopnewprimitive |
| 8510 |
|
| 8511 |
\startnewprimitive[title={\prm {mathcheckfencesmode}}] |
| 8512 |
|
| 8513 |
When set to a positive value there will be no warning if a right fence (\prm |
| 8514 |
{right} or \prm {Uright}) is missing. |
| 8515 |
|
| 8516 |
\stopnewprimitive |
| 8517 |
|
| 8518 |
\startoldprimitive[title={\prm {mathchoice}}] |
| 8519 |
|
| 8520 |
This command expects four subformulas, for display, text, script and scriptscript |
| 8521 |
and it will eventually use one of them depending on circumstances later on. Keep |
| 8522 |
in mind that a formula is first scanned and when that is finished the analysis |
| 8523 |
and typesetting happens. |
| 8524 |
|
| 8525 |
\stopoldprimitive |
| 8526 |
|
| 8527 |
\startnewprimitive[title={\prm {mathclass}}] |
| 8528 |
|
| 8529 |
There are build in classes and user classes. The first possible user class is |
| 8530 |
\cldcontext {tex . magicconstants . mathfirstuserclass} and the last one is |
| 8531 |
\cldcontext {tex . magicconstants . mathlastuserclass}. You can better not touch |
| 8532 |
the special classes \quote {all} (\number \mathallcode), \quote {begin} (\number |
| 8533 |
\mathbegincode) and \quote {end} (\number \mathendcode). The basic 8 classes that |
| 8534 |
original \TEX\ provides are of course also present in \LUAMETATEX. In addition we |
| 8535 |
have some that relate to constructs that the engine builds. |
| 8536 |
|
| 8537 |
\starttabulate[|l|l|T|l|] |
| 8538 |
\FL |
| 8539 |
\NC ordinary \NC ord \NC \the\mathordinarycode \NC the default \NR |
| 8540 |
\NC operator \NC op \NC \the\mathoperatorcode \NC small and large operators \NC \NR |
| 8541 |
\NC binary \NC bin \NC \the\mathbinarycode \NC \NC \NR |
| 8542 |
\NC relation \NC rel \NC \the\mathrelationcode \NC \NC \NR |
| 8543 |
\NC open \NC \NC \the\mathopencode \NC \NC \NR |
| 8544 |
\NC close \NC \NC \the\mathclosecode \NC \NC \NR |
| 8545 |
\NC punctuation \NC punct \NC \the\mathpunctuationcode \NC \NC \NR |
| 8546 |
\NC variable \NC \NC \the\mathvariablecode \NC adapts to the current family \NC \NR |
| 8547 |
\NC active \NC \NC \the\mathactivecode \NC character marked as such becomes active \NR |
| 8548 |
\NC inner \NC \NC \the\mathinnercode \NC this class is not possible for characters \NR |
| 8549 |
\ML |
| 8550 |
\NC under \NC \NC \the\mathundercode \NC \NC \NR |
| 8551 |
\NC over \NC \NC \the\mathovercode \NC \NC \NR |
| 8552 |
\NC fraction \NC \NC \the\mathfractioncode \NC \NC \NR |
| 8553 |
\NC radical \NC \NC \the\mathradicalcode \NC \NC \NR |
| 8554 |
\NC middle \NC \NC \the\mathmiddlecode \NC \NC \NR |
| 8555 |
\NC accent \NC \NC \the\mathaccentcode \NC \NC \NR |
| 8556 |
\NC fenced \NC \NC \the\mathfencedcode \NC \NC \NR |
| 8557 |
\NC ghost \NC \NC \the\mathghostcode \NC \NC \NR |
| 8558 |
\NC vcenter \NC \NC \the\mathvcentercode \NC \NC \NR |
| 8559 |
\LL |
| 8560 |
\stoptabulate |
| 8561 |
|
| 8562 |
There is no standard for user classes but \CONTEXT\ users should be aware of |
| 8563 |
quite some additional ones that are set up. The engine initialized the default |
| 8564 |
properties of classes (spacing, penalties, etc.) the same as original \TEX. |
| 8565 |
|
| 8566 |
Normally characters have class bound to them but you can (temporarily) overload |
| 8567 |
that one. The \prm {mathclass} primitive expects a class number and a valid |
| 8568 |
character number or math character and inserts the symbol as if it were of the |
| 8569 |
given class; so the original class is replaced. |
| 8570 |
|
| 8571 |
\startbuffer |
| 8572 |
\ruledhbox{$(x)$} and \ruledhbox{$\mathclass 1 `(x\mathclass 1 `)$} |
| 8573 |
\stopbuffer |
| 8574 |
|
| 8575 |
\typebuffer |
| 8576 |
|
| 8577 |
Changing the class is likely to change the spacing, compare \inlinebuffer. |
| 8578 |
|
| 8579 |
\stopnewprimitive |
| 8580 |
|
| 8581 |
\startoldprimitive[title={\prm {mathclose}}] |
| 8582 |
|
| 8583 |
This operation wraps following content in a atom with class \quote {close}. |
| 8584 |
|
| 8585 |
\stopoldprimitive |
| 8586 |
|
| 8587 |
\startoldprimitive[title={\prm {mathcode}}][obsolete=yes] |
| 8588 |
|
| 8589 |
This maps a character to one in a family: the assigned value has one byte for the |
| 8590 |
class, one for the family and two for the index. It has little use in an |
| 8591 |
\OPENTYPE\ math setup. |
| 8592 |
|
| 8593 |
\stopoldprimitive |
| 8594 |
|
| 8595 |
\startnewprimitive[title={\prm {mathdictgroup}}] |
| 8596 |
|
| 8597 |
This is an experimental feature that in due time will be explored in \CONTEXT. It |
| 8598 |
currently has no consequences for rendering. |
| 8599 |
|
| 8600 |
\stopnewprimitive |
| 8601 |
|
| 8602 |
\startnewprimitive[title={\prm {mathdictionary}}] |
| 8603 |
|
| 8604 |
This is an experimental feature that in due time will be explored in \CONTEXT. It |
| 8605 |
currently has no consequences for rendering. |
| 8606 |
|
| 8607 |
\stopnewprimitive |
| 8608 |
|
| 8609 |
\startnewprimitive[title={\prm {mathdictproperties}}] |
| 8610 |
|
| 8611 |
This is an experimental feature that in due time will be explored in \CONTEXT. It |
| 8612 |
currently has no consequences for rendering. |
| 8613 |
|
| 8614 |
\stopnewprimitive |
| 8615 |
|
| 8616 |
\startnewprimitive[title={\prm {mathdirection}}] |
| 8617 |
|
| 8618 |
When set to 1 this will result in \type {r2l} typeset math formulas but of course |
| 8619 |
you then also need to set up math accordingly (which is the case in \CONTEXT). |
| 8620 |
|
| 8621 |
\stopnewprimitive |
| 8622 |
|
| 8623 |
\startnewprimitive[title={\prm {mathdiscretionary}}] |
| 8624 |
|
| 8625 |
The usual \prm {discretionary} command is supported in math mode but it has the |
| 8626 |
disadvantage that one needs to make sure that the content triplet does the math |
| 8627 |
right (especially the style). This command takes an optional class specification. |
| 8628 |
|
| 8629 |
\starttyping |
| 8630 |
\mathdiscretionary {+} {+} {+} |
| 8631 |
\mathdiscretionary class \mathbinarycode {+} {+} {+} |
| 8632 |
\stoptyping |
| 8633 |
|
| 8634 |
It uses the same logic as \prm {mathchoice} but in this case we handle three |
| 8635 |
snippets in the current style. |
| 8636 |
|
| 8637 |
A fully automatic mechanism kicks in when a character has a \prm {hmcode} set: |
| 8638 |
|
| 8639 |
\starttabulate[|c|l|p|] |
| 8640 |
\FL |
| 8641 |
\BC bit \BC meaning \BC explanation \NC \NR |
| 8642 |
\TL |
| 8643 |
\NC 1 \NC normal \NC a discretionary is created with the same components \NC \NR |
| 8644 |
\NC 2 \NC italic \NC following italic correction is kept with the component \NC \NR |
| 8645 |
\LL |
| 8646 |
\stoptabulate |
| 8647 |
|
| 8648 |
So we can say: |
| 8649 |
|
| 8650 |
\starttyping |
| 8651 |
\hmcode `+ 3 |
| 8652 |
\stoptyping |
| 8653 |
|
| 8654 |
When the \type {italic} bit is set italic correction is kept at a linebreak. |
| 8655 |
|
| 8656 |
\stopnewprimitive |
| 8657 |
|
| 8658 |
\startnewprimitive[title={\prm {mathdisplaymode}}] |
| 8659 |
|
| 8660 |
Display mode is entered with two dollars (other characters can be used but the |
| 8661 |
dollars are a convention). Mid paragraph display formulas get a different |
| 8662 |
treatment with respect to the width and indentation than stand alone. When \prm |
| 8663 |
{mathdisplaymode} is larger than zero the double dollars (or equivalents) will |
| 8664 |
behave as inline formulas starting out in \prm {displaystyle} and with \prm |
| 8665 |
{everydisplay} expanded. |
| 8666 |
|
| 8667 |
\stopnewprimitive |
| 8668 |
|
| 8669 |
\startnewprimitive[title={\prm {mathdisplaypenaltyfactor}}] |
| 8670 |
|
| 8671 |
This one is simular to \prm {mathinlinepenaltyfactor} but is used when we're in |
| 8672 |
display style. |
| 8673 |
|
| 8674 |
\stopnewprimitive |
| 8675 |
|
| 8676 |
\startnewprimitive[title={\prm {mathdisplayskipmode}}] |
| 8677 |
|
| 8678 |
A display formula is preceded and followed by vertical glue specified by |
| 8679 |
\prm{abovedisplayskip} and \prm {belowdisplayskip} or \prm |
| 8680 |
{abovedisplayshortskip} and \prm {belowdisplayshortskip}. Spacing \quote {above} |
| 8681 |
is always inserted, even when zero, but the spacing \quote {below} is only |
| 8682 |
inserted when it is non|-|zero. There's also \prm {baselineskip} involved. The |
| 8683 |
way spacing is handled can be influenced with \prm {mathdisplayskipmode}, which |
| 8684 |
takes the following values: |
| 8685 |
|
| 8686 |
% use value reporter |
| 8687 |
|
| 8688 |
\starttabulate[|c|l|] |
| 8689 |
\FL |
| 8690 |
\BC value \BC meaning \NC \NR |
| 8691 |
\TL |
| 8692 |
\NC 0 \NC does the same as any \TEX\ engine \NC \NR |
| 8693 |
\NC 1 \NC idem \NC \NR |
| 8694 |
\NC 2 \NC only insert spacing when it is not zero \NC \NR |
| 8695 |
\NC 3 \NC never insert spacing \NC \NR |
| 8696 |
\LL |
| 8697 |
\stoptabulate |
| 8698 |
|
| 8699 |
\stopnewprimitive |
| 8700 |
|
| 8701 |
\startnewprimitive[title={\prm {mathdoublescriptmode}}] |
| 8702 |
|
| 8703 |
When this parameter has a negative value double scripts trigger an error, so with |
| 8704 |
\prm {superscript}, \prm {nosuperscript}, \prm {indexedsuperscript}, \prm |
| 8705 |
{superprescript}, \prm {nosuperprescript}, \prm {indexedsuperprescript}, \prm |
| 8706 |
{subscript}, \prm {nosubscript}, \prm {indexedsubscript}, \prm {subprescript}, |
| 8707 |
\prm {nosubprescript}, \prm {indexedsubprescript} and \prm {primescript}, as well |
| 8708 |
as their (multiple) \type {_} and \type {^} aliases. |
| 8709 |
|
| 8710 |
A value of zero does the normal and inserts a dummy atom (basically a \type {{}}) |
| 8711 |
but a positive value is more interesting. Compare these: |
| 8712 |
|
| 8713 |
\startbuffer |
| 8714 |
{\mathdoublescriptmode 0 $x_x_x$} |
| 8715 |
{\mathdoublescriptmode"000000 $x_x_x$} |
| 8716 |
{\mathdoublescriptmode"030303 $x_x_x$} |
| 8717 |
{$x_x_x$} |
| 8718 |
\stopbuffer |
| 8719 |
|
| 8720 |
\typebuffer |
| 8721 |
|
| 8722 |
The three pairs of bytes indicate the main class, left side class and right side |
| 8723 |
class of the inserted atom, so we get this: \inlinebuffer. The last line gives |
| 8724 |
what \CONTEXT\ is configured for. |
| 8725 |
|
| 8726 |
\stopnewprimitive |
| 8727 |
|
| 8728 |
\startnewprimitive[title={\prm {mathendclass}}] |
| 8729 |
|
| 8730 |
This variable can be set to signal the class that ends the formula (think of an |
| 8731 |
imaginary trailing atom). |
| 8732 |
|
| 8733 |
\stopnewprimitive |
| 8734 |
|
| 8735 |
\startnewprimitive[title={\prm {matheqnogapstep}}] |
| 8736 |
|
| 8737 |
The display formula number placement heuristic puts the number on the same line |
| 8738 |
when there is place and then separates it by a quad. In \LUATEX\ we decided to |
| 8739 |
keep that quantity as it can be tight into the math font metrics but introduce |
| 8740 |
a multiplier \prm {matheqnogapstep} that defaults to 1000. |
| 8741 |
|
| 8742 |
\stopnewprimitive |
| 8743 |
|
| 8744 |
\startnewprimitive[title={\prm {mathfontcontrol}}] |
| 8745 |
|
| 8746 |
This bitset controls how the math engine deals with fonts, and provides a way |
| 8747 |
around dealing with inconsistencies in the way they are set up. The \prm |
| 8748 |
{fontmathcontrol} makes it possible to bind options ot a specific math font. In |
| 8749 |
practice, we just set up the general approach which ii possible because we |
| 8750 |
normalize the math fonts and \quote {fix} issues at runtime. |
| 8751 |
|
| 8752 |
\getbuffer[engine:syntax:mathcontrolcodes] |
| 8753 |
|
| 8754 |
\stopnewprimitive |
| 8755 |
|
| 8756 |
\startnewprimitive[title={\prm {mathforwardpenalties}}] |
| 8757 |
|
| 8758 |
Inline math can have multiple atoms and constructs and one can configure the |
| 8759 |
penalties between then bases on classes. In addition it is possible to configure |
| 8760 |
additional penalties starting from the beginning or end using \prm |
| 8761 |
{mathforwardpenalties} and \prm {mathbackwardpenalties}. This is one the features |
| 8762 |
that we added in the perspective of breaking paragraphs heavy on math into lines. |
| 8763 |
It not that easy to come up with useable values. |
| 8764 |
|
| 8765 |
These penalties are added to the regular penalties between atoms. Here is an |
| 8766 |
example, as with other primitives that take more arguments the first number |
| 8767 |
indicates how much follows. |
| 8768 |
|
| 8769 |
\startbuffer |
| 8770 |
$ a + b + c + d + e + f + g + h = x $\par |
| 8771 |
\mathforwardpenalties 3 300 200 100 |
| 8772 |
\mathbackwardpenalties 3 250 150 50 |
| 8773 |
$ a + b + c + d + e + f + g + h = x $\par |
| 8774 |
\stopbuffer |
| 8775 |
|
| 8776 |
\typebuffer |
| 8777 |
|
| 8778 |
You'll notice that we apply more severe penalties at the edges: |
| 8779 |
|
| 8780 |
{\showmakeup[penalty]\multiply\glyphscale\plustwo \getbuffer} |
| 8781 |
|
| 8782 |
|
| 8783 |
\stopnewprimitive |
| 8784 |
|
| 8785 |
\startnewprimitive[title={\prm {mathgluemode}}] |
| 8786 |
|
| 8787 |
We can influence the way math glue is handled. By default stretch and shrink is applied but |
| 8788 |
this variable can be used to change that. The limit option ensures that the stretch and shrink |
| 8789 |
doesn't go beyond their natural values. |
| 8790 |
|
| 8791 |
\getbuffer[engine:syntax:mathgluecodes] |
| 8792 |
|
| 8793 |
\stopnewprimitive |
| 8794 |
|
| 8795 |
\startnewprimitive[title={\prm {mathgroupingmode}}] |
| 8796 |
|
| 8797 |
Normally a \type {{}} or \type {\bgroup}|-|\type {\egroup} pair in math create a |
| 8798 |
math list. However, users are accustomed to using it also for grouping and then a |
| 8799 |
list being created might not be what a user wants. As an alternative to the more |
| 8800 |
verbose \prm {begingroup}|-|\prm {endgroup} or even less sensitive \prm |
| 8801 |
{beginmathgroup}|-|\prm {endmathgroup} you can set the math grouping mode to a |
| 8802 |
non zero value which makes curly braces (and the aliases) behave as expected. |
| 8803 |
|
| 8804 |
\stopnewprimitive |
| 8805 |
|
| 8806 |
\startnewprimitive[title={\prm {mathinlinepenaltyfactor}}] |
| 8807 |
|
| 8808 |
A math formula can have nested (sub)formulas and one might want to discourage a |
| 8809 |
line break inside those. If this value is non zero it becomes a mulitiplier, so a |
| 8810 |
value of 1000 will make an inter class penalty of 100 into 200 when at nesting |
| 8811 |
level 2 and 500 when at level 5. |
| 8812 |
|
| 8813 |
\stopnewprimitive |
| 8814 |
|
| 8815 |
\startoldprimitive[title={\prm {mathinner}}] |
| 8816 |
|
| 8817 |
This operation wraps following content in a atom with class \quote {inner}. In |
| 8818 |
\LUAMETATEX\ we have more classes and this general wrapper one is therefore kind |
| 8819 |
of redundant. |
| 8820 |
|
| 8821 |
\stopoldprimitive |
| 8822 |
|
| 8823 |
\startnewprimitive[title={\prm {mathleftclass}}] |
| 8824 |
|
| 8825 |
When set this class will be used when a formula starts. |
| 8826 |
|
| 8827 |
\stopnewprimitive |
| 8828 |
|
| 8829 |
\startnewprimitive[title={\prm {mathlimitsmode}}] |
| 8830 |
|
| 8831 |
When this parameter is set to a value larger than zero real dimensions are used |
| 8832 |
and longer limits will not stick out, which is a traditional \TEX\ feature. We |
| 8833 |
could have more advanced control but this will do. |
| 8834 |
|
| 8835 |
\startbuffer |
| 8836 |
\dontleavehmode |
| 8837 |
\ruledhbox{\dm{\left|\integral^{!!!!!!!!!!!}\right|}} |
| 8838 |
\ruledhbox{\dm{\left|\integral^{!!!!!!!!!!} \right|}} |
| 8839 |
\ruledhbox{\dm{\left|\integral^{!!!!!!!!!} \right|}} |
| 8840 |
\ruledhbox{\dm{\left|\integral^{!!!!!!!!} \right|}} |
| 8841 |
\ruledhbox{\dm{\left|\integral^{!!!!!!!} \right|}} |
| 8842 |
\ruledhbox{\dm{\left|\integral^{!!!!!!} \right|}} |
| 8843 |
\ruledhbox{\dm{\left|\integral^{!!!!!} \right|}} |
| 8844 |
\ruledhbox{\dm{\left|\integral^{!!!!} \right|}} |
| 8845 |
\ruledhbox{\dm{\left|\integral^{!!!} \right|}} |
| 8846 |
\ruledhbox{\dm{\left|\integral^{!!} \right|}} |
| 8847 |
\ruledhbox{\dm{\left|\integral^{!} \right|}} |
| 8848 |
\blank |
| 8849 |
\dontleavehmode |
| 8850 |
\ruledhbox{\dm{\left|\integral_{!!!!!!!!!!!}\right|}} |
| 8851 |
\ruledhbox{\dm{\left|\integral_{!!!!!!!!!!} \right|}} |
| 8852 |
\ruledhbox{\dm{\left|\integral_{!!!!!!!!!} \right|}} |
| 8853 |
\ruledhbox{\dm{\left|\integral_{!!!!!!!!} \right|}} |
| 8854 |
\ruledhbox{\dm{\left|\integral_{!!!!!!!} \right|}} |
| 8855 |
\ruledhbox{\dm{\left|\integral_{!!!!!!} \right|}} |
| 8856 |
\ruledhbox{\dm{\left|\integral_{!!!!!} \right|}} |
| 8857 |
\ruledhbox{\dm{\left|\integral_{!!!!} \right|}} |
| 8858 |
\ruledhbox{\dm{\left|\integral_{!!!} \right|}} |
| 8859 |
\ruledhbox{\dm{\left|\integral_{!!} \right|}} |
| 8860 |
\ruledhbox{\dm{\left|\integral_{!} \right|}} |
| 8861 |
\blank |
| 8862 |
\dontleavehmode |
| 8863 |
\ruledhbox{\dm{\left|\integral_{!} ^{!} \right|}} |
| 8864 |
\ruledhbox{\dm{\left|\integral_{!!!!!!!}^{!} \right|}} |
| 8865 |
\ruledhbox{\dm{\left|\integral_{!} ^{!!!!!!!} \right|}} |
| 8866 |
\ruledhbox{\dm{\left|\integral_{!} ^{!!!!!!!!!!} \right|}} |
| 8867 |
\ruledhbox{\dm{\left|\integral_{!!!!!!!}^{!!!!!!!!!} \right|}} |
| 8868 |
\ruledhbox{\dm{\left|\integral_{!!!!!!!}^{!!!!!!!!!!!!!!!}\right|}} |
| 8869 |
\ruledhbox{\dm{\left|\integral^{\mtext{for demanding}}_{\mtext{integral freaks}}\right|}} |
| 8870 |
\stopbuffer |
| 8871 |
|
| 8872 |
Compare the zero setting: |
| 8873 |
|
| 8874 |
{\switchtobodyfont[modern]\setupmathoperators[integral][method=limits]\mathlimitsmode 0 \getbuffer} |
| 8875 |
|
| 8876 |
with the positive variant: |
| 8877 |
|
| 8878 |
{\switchtobodyfont[modern]\setupmathoperators[integral][method=limits]\mathlimitsmode 1 \getbuffer} |
| 8879 |
|
| 8880 |
Here we switched to Latin Modern because it's font dependent how serious this |
| 8881 |
issue is. In Pagella all is fine in both modes. |
| 8882 |
|
| 8883 |
\stopnewprimitive |
| 8884 |
|
| 8885 |
\startnewprimitive[title={\prm {mathmainstyle}}] |
| 8886 |
|
| 8887 |
This inspector returns the outermost math style (contrary to \prm {mathstyle}), |
| 8888 |
as we can see in the next examples where use these snippets: |
| 8889 |
|
| 8890 |
\startbuffer |
| 8891 |
\def\foo{(\the\mathmainstyle,\the\mathstyle)} |
| 8892 |
\def\oof{\sqrt[\foo]{\foo}} |
| 8893 |
\def\ofo{\frac{\foo}{\foo}} |
| 8894 |
\def\fof{\mathchoice{\foo}{\foo}{\foo}{\foo}} |
| 8895 |
\stopbuffer |
| 8896 |
|
| 8897 |
\typebuffer \getbuffer |
| 8898 |
|
| 8899 |
When we use the regular math triggers we get this: |
| 8900 |
|
| 8901 |
\startbuffer |
| 8902 |
$\displaystyle \foo + \oof + \ofo$ |
| 8903 |
$\textstyle \foo + \oof + \ofo$ |
| 8904 |
$\displaystyle \foo + \fof$ |
| 8905 |
$\textstyle \foo + \fof$ |
| 8906 |
$\scriptstyle \foo + \fof$ |
| 8907 |
$\scriptscriptstyle\foo + \fof$ |
| 8908 |
\stopbuffer |
| 8909 |
|
| 8910 |
\typebuffer |
| 8911 |
|
| 8912 |
\startlines |
| 8913 |
\getbuffer |
| 8914 |
\stoplines |
| 8915 |
|
| 8916 |
But we can also do this: |
| 8917 |
|
| 8918 |
\startbuffer |
| 8919 |
\Ustartmathmode \displaystyle \foo + \oof + \ofo \Ustopmathmode |
| 8920 |
\Ustartmathmode \textstyle \foo + \oof + \ofo \Ustopmathmode |
| 8921 |
\Ustartmathmode \displaystyle \foo + \fof \Ustopmathmode |
| 8922 |
\Ustartmathmode \textstyle \foo + \fof \Ustopmathmode |
| 8923 |
\Ustartmathmode \scriptstyle \foo + \fof \Ustopmathmode |
| 8924 |
\Ustartmathmode \scriptscriptstyle\foo + \fof \Ustopmathmode |
| 8925 |
\stopbuffer |
| 8926 |
|
| 8927 |
\typebuffer |
| 8928 |
|
| 8929 |
\startlines |
| 8930 |
\getbuffer |
| 8931 |
\stoplines |
| 8932 |
|
| 8933 |
\stopnewprimitive |
| 8934 |
|
| 8935 |
\startoldprimitive[title={\prm {mathop}}] |
| 8936 |
|
| 8937 |
This operation wraps following content in a atom with class \quote {operator}. |
| 8938 |
|
| 8939 |
\stopoldprimitive |
| 8940 |
|
| 8941 |
\startoldprimitive[title={\prm {mathopen}}] |
| 8942 |
|
| 8943 |
This operation wraps following content in a atom with class \quote {open}. |
| 8944 |
|
| 8945 |
\stopoldprimitive |
| 8946 |
|
| 8947 |
% \startnewprimitive[title={\prm {mathoptions}}] |
| 8948 |
% \stopnewprimitive |
| 8949 |
|
| 8950 |
\startoldprimitive[title={\prm {mathord}}] |
| 8951 |
|
| 8952 |
This operation wraps following content in a atom with class \quote {ordinary}. |
| 8953 |
|
| 8954 |
\stopoldprimitive |
| 8955 |
|
| 8956 |
\startnewprimitive[title={\prm {mathparentstyle}}] |
| 8957 |
|
| 8958 |
This inspector returns the math style used in a construct, so is is either |
| 8959 |
equivalent to \prm {mathmainstyle} or a nested \prm {mathstyle}. For instance |
| 8960 |
in a nested fraction we get this (in \CONTEXT) in display formulas: |
| 8961 |
|
| 8962 |
\def\foo{(\the\mathmainstyle,\the\mathparentstyle,\the\mathstyle)} |
| 8963 |
|
| 8964 |
\dm{ |
| 8965 |
\frac{\frac{\foo}{\foo}}{\frac{\foo}{\foo}} + \foo |
| 8966 |
} |
| 8967 |
|
| 8968 |
but this in inline formulas: |
| 8969 |
|
| 8970 |
\im{ |
| 8971 |
\frac{\frac{\foo}{\foo}}{\frac{\foo}{\foo}} + \foo |
| 8972 |
} |
| 8973 |
|
| 8974 |
where the first element in a nested fraction. |
| 8975 |
|
| 8976 |
\stopnewprimitive |
| 8977 |
|
| 8978 |
\startnewprimitive[title={\prm {mathpenaltiesmode}}] |
| 8979 |
|
| 8980 |
Normally the \TEX\ math engine only inserts penalties when in textstyle. You can |
| 8981 |
force penalties in displaystyle with this parameter. In inline math we always |
| 8982 |
honor penalties, with mode~0 and mode~1 we get this: |
| 8983 |
|
| 8984 |
\pushoverloadmode |
| 8985 |
|
| 8986 |
\startlines |
| 8987 |
{\mathpenaltiesmode=0 \let\mathpenaltiesmode\scratchcounter $\showmakeup[hpenalty]x+2x=0$} |
| 8988 |
{\mathpenaltiesmode=1 \let\mathpenaltiesmode\scratchcounter $\showmakeup[hpenalty]x+2x=1$} |
| 8989 |
\stoplines |
| 8990 |
|
| 8991 |
However in \CONTEXT, where all is done in inline math mode, we set this this |
| 8992 |
parameter to~1, otherwise we wouldn't get these penalties, as shown next: |
| 8993 |
|
| 8994 |
{\mathpenaltiesmode=0 \let\mathpenaltiesmode\scratchcounter \startformula \showmakeup[hpenalty]x+2x=0 \stopformula} |
| 8995 |
{\mathpenaltiesmode=1 \let\mathpenaltiesmode\scratchcounter \startformula \showmakeup[hpenalty]x+2x=1 \stopformula} |
| 8996 |
|
| 8997 |
\popoverloadmode |
| 8998 |
|
| 8999 |
If one uses a callback it is possible to force penalties from there too. |
| 9000 |
|
| 9001 |
\stopnewprimitive |
| 9002 |
|
| 9003 |
\startnewprimitive[title={\prm {mathpretolerance}}] |
| 9004 |
|
| 9005 |
This is used instead of \prm {pretolerance} when a breakpoint is calculated when |
| 9006 |
a math formula starts. |
| 9007 |
|
| 9008 |
\stopnewprimitive |
| 9009 |
|
| 9010 |
\startoldprimitive[title={\prm {mathpunct}}] |
| 9011 |
|
| 9012 |
This operation wraps following content in a atom with class \quote {punctuation}. |
| 9013 |
|
| 9014 |
\stopoldprimitive |
| 9015 |
|
| 9016 |
\startoldprimitive[title={\prm {mathrel}}] |
| 9017 |
|
| 9018 |
This operation wraps following content in a atom with class \quote {relation}. |
| 9019 |
|
| 9020 |
\stopoldprimitive |
| 9021 |
|
| 9022 |
\startnewprimitive[title={\prm {mathrightclass}}] |
| 9023 |
|
| 9024 |
When set this class will be used when a formula ends. |
| 9025 |
|
| 9026 |
\stopnewprimitive |
| 9027 |
|
| 9028 |
\startnewprimitive[title={\prm {mathrulesfam}}] |
| 9029 |
|
| 9030 |
When set, this family will be used for setting rule properties in fractions, |
| 9031 |
under and over. |
| 9032 |
|
| 9033 |
\stopnewprimitive |
| 9034 |
|
| 9035 |
\startnewprimitive[title={\prm {mathrulesmode}}] |
| 9036 |
|
| 9037 |
When set to a non zero value rules (as in fractions and radicals) will be based |
| 9038 |
on the font parameters in the current family. |
| 9039 |
|
| 9040 |
\stopnewprimitive |
| 9041 |
|
| 9042 |
\startnewprimitive[title={\prm {mathscale}}] |
| 9043 |
|
| 9044 |
In \LUAMETATEX\ we can either have a family of three (text, script and |
| 9045 |
scriptscript) fonts or we can use one font that we scale and where we also pass |
| 9046 |
information about alternative shapes for the smaller sizes. When we use this |
| 9047 |
more compact mode this primitive reflects the scale factor used. |
| 9048 |
|
| 9049 |
\startbuffer |
| 9050 |
\im { |
| 9051 |
\textstyle \the\mathscale\textfont \fam\enspace |
| 9052 |
\scriptstyle \the\mathscale\scriptfont \fam\enspace |
| 9053 |
\scriptscriptstyle\the\mathscale\scriptscriptfont\fam\enspace |
| 9054 |
\textstyle \the\mathscale\textfont \fam\enspace |
| 9055 |
\scriptstyle \the\mathscale\textfont \fam\enspace |
| 9056 |
\scriptscriptstyle\the\mathscale\textfont \fam |
| 9057 |
|
| 9058 |
} |
| 9059 |
\stopbuffer |
| 9060 |
|
| 9061 |
What gets reported depends on how math is implemented, where in \CONTEXT\ we can |
| 9062 |
have either normal or compact mode: \inlinebuffer. In compact mode we have the |
| 9063 |
same font three times so then it doesn't matter which of the three is passed. |
| 9064 |
|
| 9065 |
\stopnewprimitive |
| 9066 |
|
| 9067 |
\startnewprimitive[title={\prm {mathscriptsmode}}] |
| 9068 |
|
| 9069 |
There are situations where you don't want \TEX\ to be clever and optimize the |
| 9070 |
position of super- and subscripts by shifting. This parameter can be used to |
| 9071 |
influence this. |
| 9072 |
|
| 9073 |
\startlinecorrection |
| 9074 |
\startcombination[3*2] |
| 9075 |
{\startoverlay |
| 9076 |
{\ruledhbox {\mathscriptsmode 0 0: $x^2_2 + y^x_x + z_2 + w^2$}} |
| 9077 |
{\ruledhbox{\red \mathscriptsmode 1 1: $x^2_2 + y^x_x + z_2 + w^2$}} |
| 9078 |
\stopoverlay} {} |
| 9079 |
{\startoverlay |
| 9080 |
{\ruledhbox {\mathscriptsmode 0 0: $x^2_2 + y^x_x + z_2 + w^2$}} |
| 9081 |
{\ruledhbox{\red \mathscriptsmode 2 2: $x^2_2 + y^x_x + z_2 + w^2$}} |
| 9082 |
\stopoverlay} {} |
| 9083 |
{\startoverlay |
| 9084 |
{\ruledhbox {\mathscriptsmode 1 1: $x^2_2 + y^x_x + z_2 + w^2$}} |
| 9085 |
{\ruledhbox{\red \mathscriptsmode 2 2: $x^2_2 + y^x_x + z_2 + w^2$}} |
| 9086 |
\stopoverlay} {} |
| 9087 |
{\startoverlay |
| 9088 |
{\ruledhbox {\mathscriptsmode 0 0: $x^f_f + y^x_x + z_f + w^f$}} |
| 9089 |
{\ruledhbox{\red \mathscriptsmode 1 1: $x^f_f + y^x_x + z_f + w^f$}} |
| 9090 |
\stopoverlay} {1 over 0} |
| 9091 |
{\startoverlay |
| 9092 |
{\ruledhbox {\mathscriptsmode 0 0: $x^f_f + y^x_x + z_f + w^f$}} |
| 9093 |
{\ruledhbox{\red \mathscriptsmode 2 2: $x^f_f + y^x_x + z_f + w^f$}} |
| 9094 |
\stopoverlay} {2 over 0} |
| 9095 |
{\startoverlay |
| 9096 |
{\ruledhbox {\mathscriptsmode 1 1: $x^f_f + y^x_x + z_f + w^f$}} |
| 9097 |
{\ruledhbox{\red \mathscriptsmode 2 2: $x^f_f + y^x_x + z_f + w^f$}} |
| 9098 |
\stopoverlay} {2 over 1} |
| 9099 |
\stopcombination |
| 9100 |
\stoplinecorrection |
| 9101 |
|
| 9102 |
The next table shows what parameters kick in when: |
| 9103 |
|
| 9104 |
\starttabulate[|l|l|l|p|] |
| 9105 |
\NC \BC or (1) \BC and (2) \BC otherwise \NC \NR |
| 9106 |
\BC super \NC sup shift up \NC sup shift up \NC sup shift up, |
| 9107 |
sup bot min \NC \NR |
| 9108 |
\BC sub \NC sub shift down \NC sub sup shift down \NC sub shift down, |
| 9109 |
sub top max \NC \NR |
| 9110 |
\BC both \NC sub shift down \NC sub sup shift down \NC sub sup shift down, |
| 9111 |
sub sup vgap, |
| 9112 |
sup sub bot max \NC \NR |
| 9113 |
\stoptabulate |
| 9114 |
|
| 9115 |
\stopnewprimitive |
| 9116 |
|
| 9117 |
\startnewprimitive[title={\prm {mathslackmode}}] |
| 9118 |
|
| 9119 |
When positive this parameter will make sure that script spacing is discarded when |
| 9120 |
there is no reason to add it. |
| 9121 |
|
| 9122 |
\startlinecorrection |
| 9123 |
\startcombination[nx=3,ny=1] |
| 9124 |
{\mathslackmode0 |
| 9125 |
\ruledhbox{$\setmscale{3}x^2 + x^2$}\space |
| 9126 |
\ruledhbox{$\setmscale{3}x^2$}} |
| 9127 |
{disabled (0)} |
| 9128 |
{\mathslackmode1 |
| 9129 |
\ruledhbox{$\setmscale{3}x^2 + x^2$}\space |
| 9130 |
\ruledhbox{$\setmscale{3}x^2$}} |
| 9131 |
{enabled (1)} |
| 9132 |
{\startoverlay |
| 9133 |
{\mathslackmode0 \ruledhbox{$\setmscale{3}x^2 + x^2$}} |
| 9134 |
{\mathslackmode1 \red\ruledhbox{$\setmscale{3}x^2 + x^2$}} |
| 9135 |
\stopoverlay |
| 9136 |
\space |
| 9137 |
\startoverlay |
| 9138 |
{\mathslackmode0 \ruledhbox{$\setmscale{3}x^2$}} |
| 9139 |
{\mathslackmode1 \red\ruledhbox{$\setmscale{3}x^2$}} |
| 9140 |
\stopoverlay} |
| 9141 |
{{\red enabled} over disabled} |
| 9142 |
\stopcombination |
| 9143 |
\stoplinecorrection |
| 9144 |
|
| 9145 |
\stopnewprimitive |
| 9146 |
|
| 9147 |
\startnewprimitive[title={\prm {mathspacingmode}}] |
| 9148 |
|
| 9149 |
Zero inter|-|class glue is not injected but setting this parameter to a positive |
| 9150 |
value bypasses that check. This can be handy when checking (tracing) how (and |
| 9151 |
what) spacing is applied. Keep in mind that glue in math is special in the sense |
| 9152 |
that it is not a valid breakpoint. Line breaks in (inline) math are driven by |
| 9153 |
penalties. |
| 9154 |
|
| 9155 |
\stopnewprimitive |
| 9156 |
|
| 9157 |
\startnewprimitive[title={\prm {mathstack}}] |
| 9158 |
|
| 9159 |
There are a few commands in \TEX\ that can behave confusing due to the way they |
| 9160 |
are scanned. Compare these: |
| 9161 |
|
| 9162 |
\starttyping |
| 9163 |
$ 1 \over 2 $ |
| 9164 |
$ 1 + x \over 2 + x$ |
| 9165 |
$ {1 + x} \over {2 + x}$ |
| 9166 |
$ {{1 + x} \over {2 + x}}$ |
| 9167 |
\stoptyping |
| 9168 |
|
| 9169 |
A single $1$ is an atom as is the curly braced ${1 + x}$. The two arguments to |
| 9170 |
\prm {over} eventually will get typeset in the style that this fraction |
| 9171 |
constructor uses for the numerator and denominator but on might actually also |
| 9172 |
like to relate that to the circumstances. It is comparable to using a \prm |
| 9173 |
{mathchoice}. In order not to waste runtime on four variants, which itself can have |
| 9174 |
side effects, for instance when counters are involved, \LUATEX\ introduced |
| 9175 |
\prm {mathstack}, used like: |
| 9176 |
|
| 9177 |
\starttyping |
| 9178 |
$\mathstack {1 \over 2}$ |
| 9179 |
\stoptyping |
| 9180 |
|
| 9181 |
This \prm {mathstack} command will scan the next brace and opens a new math group |
| 9182 |
with the correct (in this case numerator) math style. The \prm {mathstackstyle} |
| 9183 |
primitive relates to this feature that defaults to \quote {smaller unless already |
| 9184 |
scriptscript}. |
| 9185 |
|
| 9186 |
\stopnewprimitive |
| 9187 |
|
| 9188 |
\startnewprimitive[title={\prm {mathstackstyle}}] |
| 9189 |
|
| 9190 |
This returns the (normally) numerator style but the engine can be configured to |
| 9191 |
default to another style. Although all these in the original \TEX\ engines hard |
| 9192 |
coded style values can be changed in \LUAMETATEX\ it is unlikely to happen. So |
| 9193 |
this primitive will normally return the (current) style \quote {smaller unless |
| 9194 |
already scriptscript}. |
| 9195 |
|
| 9196 |
\stopnewprimitive |
| 9197 |
|
| 9198 |
\startnewprimitive[title={\prm {mathstyle}}] |
| 9199 |
|
| 9200 |
This returns the current math style, so \type {$\the \mathstyle$} gives $\the |
| 9201 |
\mathstyle$. |
| 9202 |
|
| 9203 |
\stopnewprimitive |
| 9204 |
|
| 9205 |
\startnewprimitive[title={\prm {mathstylefontid}}] |
| 9206 |
|
| 9207 |
This returns the font id (a number) of a style|/|family combination. What you get |
| 9208 |
back depends on how a macro package implements math fonts. |
| 9209 |
|
| 9210 |
\startbuffer |
| 9211 |
(\the\mathstylefontid\textstyle \fam) |
| 9212 |
(\the\mathstylefontid\scriptstyle \fam) |
| 9213 |
(\the\mathstylefontid\scriptscriptstyle\fam) |
| 9214 |
\stopbuffer |
| 9215 |
|
| 9216 |
\typebuffer |
| 9217 |
|
| 9218 |
In \CONTEXT\ gives: \inlinebuffer. |
| 9219 |
|
| 9220 |
\stopnewprimitive |
| 9221 |
|
| 9222 |
\startoldprimitive[title={\prm {mathsurround}}] |
| 9223 |
|
| 9224 |
The kern injected before and after an inline math formula. In practice it will be |
| 9225 |
set to zero, if only because otherwise nested math will also get that space |
| 9226 |
added. We also have \prm {mathsurroundskip} which, when set, takes precedence. |
| 9227 |
Spacing is controlled by \prm {mathsurroundmode}. |
| 9228 |
|
| 9229 |
\stopoldprimitive |
| 9230 |
|
| 9231 |
\startnewprimitive[title={\prm {mathsurroundmode}}] |
| 9232 |
|
| 9233 |
The possible ways to control spacing around inline math formulas in other manuals |
| 9234 |
and mostly serve as playground. |
| 9235 |
|
| 9236 |
\stopnewprimitive |
| 9237 |
|
| 9238 |
\startnewprimitive[title={\prm {mathsurroundskip}}] |
| 9239 |
|
| 9240 |
When set this one wins over \prm {mathsurround}. |
| 9241 |
|
| 9242 |
\stopnewprimitive |
| 9243 |
|
| 9244 |
\startnewprimitive[title={\prm {maththreshold}}] |
| 9245 |
|
| 9246 |
This is a glue parameter. The amount determines what happens: when it is non zero |
| 9247 |
and the inline formula is less than that value it will become a special kind of |
| 9248 |
box that can stretch and|/| or shrink within the given specification. The par |
| 9249 |
builder will use these stretch and|/| or shrink components but it is up to one of |
| 9250 |
the \LUA\ callbacks to deal with the content eventually (if at all). As this is |
| 9251 |
somewhat specialized, more details can be found on \CONTEXT\ documentation. |
| 9252 |
|
| 9253 |
\stopnewprimitive |
| 9254 |
|
| 9255 |
\startnewprimitive[title={\prm {mathtolerance}}] |
| 9256 |
|
| 9257 |
This is used instead of \prm {tolerance} when a breakpoint is calculated when a |
| 9258 |
math formula starts. |
| 9259 |
|
| 9260 |
\stopnewprimitive |
| 9261 |
|
| 9262 |
\startoldprimitive[title={\prm {maxdeadcycles}}] |
| 9263 |
|
| 9264 |
When the output routine is called this many times and no page is shipped out an |
| 9265 |
error will be triggered. You therefore need to reset its companion counter \prm |
| 9266 |
{deadcycles} if needed. Keep in mind that \LUAMETATEX\ has no real \prm {shipout} |
| 9267 |
because providing a backend is up to the macro package. |
| 9268 |
|
| 9269 |
\stopoldprimitive |
| 9270 |
|
| 9271 |
\startoldprimitive[title={\prm {maxdepth}}] |
| 9272 |
|
| 9273 |
The depth of the page is limited to this value. |
| 9274 |
|
| 9275 |
\stopoldprimitive |
| 9276 |
|
| 9277 |
\startoldprimitive[title={\prm {meaning}}] |
| 9278 |
|
| 9279 |
We start with a primitive that will be used in the following sections. The |
| 9280 |
reported meaning can look a bit different than the one reported by other engines |
| 9281 |
which is a side effect of additional properties and more extensive argument |
| 9282 |
parsing. |
| 9283 |
|
| 9284 |
\startbuffer |
| 9285 |
\tolerant\permanent\protected\gdef\foo[#1]#*[#2]{(#1)(#2)} \meaning\foo |
| 9286 |
\stopbuffer |
| 9287 |
|
| 9288 |
\typebuffer \getbuffer \glet\foo\relax |
| 9289 |
|
| 9290 |
\stopoldprimitive |
| 9291 |
|
| 9292 |
\startnewprimitive[title={\prm {meaningasis}}] |
| 9293 |
|
| 9294 |
Although it is not really round trip with the original due to information |
| 9295 |
being lost this primitive tries to return an equivalent definition. |
| 9296 |
|
| 9297 |
\startbuffer |
| 9298 |
\tolerant\permanent\protected\gdef\foo[#1]#*[#2]{(#1)(#2)} \meaningasis\foo |
| 9299 |
\stopbuffer |
| 9300 |
|
| 9301 |
\typebuffer \getbuffer \glet\foo\relax |
| 9302 |
|
| 9303 |
\stopnewprimitive |
| 9304 |
|
| 9305 |
\startnewprimitive[title={\prm {meaningful}}] |
| 9306 |
|
| 9307 |
This one reports a bit less than \prm {meaningful}. |
| 9308 |
|
| 9309 |
\startbuffer |
| 9310 |
\tolerant\permanent\protected\gdef\foo[#1]#*[#2]{(#1)(#2)} \meaningful\foo |
| 9311 |
\stopbuffer |
| 9312 |
|
| 9313 |
\typebuffer \getbuffer \let\gfoo\relax |
| 9314 |
|
| 9315 |
\stopnewprimitive |
| 9316 |
|
| 9317 |
\startnewprimitive[title={\prm {meaningfull}}] |
| 9318 |
|
| 9319 |
This one reports a bit more than \prm {meaning}. |
| 9320 |
|
| 9321 |
\startbuffer |
| 9322 |
\tolerant\permanent\protected\gdef\foo[#1]#*[#2]{(#1)(#2)} \meaningfull\foo |
| 9323 |
\stopbuffer |
| 9324 |
|
| 9325 |
\typebuffer \getbuffer \let\gfoo\relax |
| 9326 |
|
| 9327 |
\stopnewprimitive |
| 9328 |
|
| 9329 |
\startnewprimitive[title={\prm {meaningles}}] |
| 9330 |
|
| 9331 |
This one reports a bit less than \prm {meaningless}. |
| 9332 |
|
| 9333 |
\startbuffer |
| 9334 |
\tolerant\permanent\protected\gdef\foo[#1]#*[#2]{(#1)(#2)} \meaningles\foo |
| 9335 |
\stopbuffer |
| 9336 |
|
| 9337 |
\typebuffer \getbuffer \let\gfoo\relax |
| 9338 |
|
| 9339 |
\stopnewprimitive |
| 9340 |
|
| 9341 |
\startnewprimitive[title={\prm {meaningless}}] |
| 9342 |
|
| 9343 |
This one reports a bit less than \prm {meaning}. |
| 9344 |
|
| 9345 |
\startbuffer |
| 9346 |
\tolerant\permanent\protected\gdef\foo[#1]#*[#2]{(#1)(#2)} \meaningless\foo |
| 9347 |
\stopbuffer |
| 9348 |
|
| 9349 |
\typebuffer \getbuffer \let\gfoo\relax |
| 9350 |
|
| 9351 |
\stopnewprimitive |
| 9352 |
|
| 9353 |
\startoldprimitive[title={\prm {medmuskip}}] |
| 9354 |
|
| 9355 |
A predefined mu skip register that can be used in math (inter atom) spacing. The |
| 9356 |
current value is {\tt \the\medmuskip}. In traditional \TEX\ most inter atom |
| 9357 |
spacing is hard coded using the predefined registers. |
| 9358 |
|
| 9359 |
\stopoldprimitive |
| 9360 |
|
| 9361 |
\startoldprimitive[title={\prm {message}}] |
| 9362 |
|
| 9363 |
Prints the serialization of the (tokenized) argument to the log file and|/|or |
| 9364 |
console. |
| 9365 |
|
| 9366 |
\stopoldprimitive |
| 9367 |
|
| 9368 |
\startoldprimitive[title={\prm {middle}}] |
| 9369 |
|
| 9370 |
Inserts the given delimiter as middle fence in a math formula. In \LUAMETATEX\ it |
| 9371 |
is a full blown fence and not (as in \ETEX) variation of \prm {open}. |
| 9372 |
|
| 9373 |
\stopoldprimitive |
| 9374 |
|
| 9375 |
\startoldprimitive[title={\prm {mkern}}] |
| 9376 |
|
| 9377 |
This one injects a kern node in the current (math) list and expects a value in so |
| 9378 |
called mu units. |
| 9379 |
|
| 9380 |
\stopoldprimitive |
| 9381 |
|
| 9382 |
\startoldprimitive[title={\prm {month}}] |
| 9383 |
|
| 9384 |
This internal number starts out with the month that the job started. |
| 9385 |
|
| 9386 |
\stopoldprimitive |
| 9387 |
|
| 9388 |
\startoldprimitive[title={\prm {moveleft}}] |
| 9389 |
|
| 9390 |
This primitive takes two arguments, a dimension and a box. The box is moved to |
| 9391 |
the left. The operation only succeeds in vertical mode. |
| 9392 |
|
| 9393 |
\stopoldprimitive |
| 9394 |
|
| 9395 |
\startoldprimitive[title={\prm {moveright}}] |
| 9396 |
|
| 9397 |
This primitive takes two arguments, a dimension and a box. The box is moved to |
| 9398 |
the right. The operation only succeeds in vertical mode. |
| 9399 |
|
| 9400 |
\stopoldprimitive |
| 9401 |
|
| 9402 |
\startoldprimitive[title={\prm {mskip}}] |
| 9403 |
|
| 9404 |
The given math glue (in \type {mu} units) is injected in the horizontal list. For |
| 9405 |
this to succeed we need to be in math mode. |
| 9406 |
|
| 9407 |
\stopoldprimitive |
| 9408 |
|
| 9409 |
\startoldprimitive[title={\prm {muexpr}}] |
| 9410 |
|
| 9411 |
This is a companion of \prm {glueexpr} so it handles the optional stretch and |
| 9412 |
shrink components. Here math units (\type {mu}) are expected. |
| 9413 |
|
| 9414 |
\stopoldprimitive |
| 9415 |
|
| 9416 |
\startnewprimitive[title={\prm {mugluespecdef}}] |
| 9417 |
|
| 9418 |
A variant of \prm {gluespecdef} that expects \type {mu} units is: |
| 9419 |
|
| 9420 |
\starttyping |
| 9421 |
\mugluespecdef\MyGlue = 3mu plus 2mu minus 1mu |
| 9422 |
\stoptyping |
| 9423 |
|
| 9424 |
The properties are comparable to the ones described in the previous sections. |
| 9425 |
|
| 9426 |
\stopnewprimitive |
| 9427 |
|
| 9428 |
\startoldprimitive[title={\prm {multiply}}] |
| 9429 |
|
| 9430 |
The given quantity is multiplied by the given integer (that can be preceded by |
| 9431 |
the keyword \quote {by}, like: |
| 9432 |
|
| 9433 |
\starttyping |
| 9434 |
\scratchdimen=10pt \multiply\scratchdimen by 3 |
| 9435 |
\stoptyping |
| 9436 |
|
| 9437 |
\stopoldprimitive |
| 9438 |
|
| 9439 |
\startnewprimitive[title={\prm {multiplyby}}] |
| 9440 |
|
| 9441 |
This is slightly more efficient variant of \prm {multiply} that doesn't look for |
| 9442 |
\type {by}. See previous section. |
| 9443 |
|
| 9444 |
\stopnewprimitive |
| 9445 |
|
| 9446 |
\startoldprimitive[title={\prm {muskip}}] |
| 9447 |
|
| 9448 |
This is the accessor for an indexed muskip (muglue) register. |
| 9449 |
|
| 9450 |
\stopoldprimitive |
| 9451 |
|
| 9452 |
\startoldprimitive[title={\prm {muskipdef}}] |
| 9453 |
|
| 9454 |
This command associates a control sequence with a muskip (math skip) register |
| 9455 |
(accessed by number). |
| 9456 |
|
| 9457 |
\stopoldprimitive |
| 9458 |
|
| 9459 |
\startnewprimitive[title={\prm {mutable}}] |
| 9460 |
|
| 9461 |
This prefix flags what follows can be adapted and is not subjected to overload |
| 9462 |
protection. |
| 9463 |
|
| 9464 |
\stopnewprimitive |
| 9465 |
|
| 9466 |
\startoldprimitive[title={\prm {mutoglue}}] |
| 9467 |
|
| 9468 |
The sequence \typ {\the \mutoglue 20mu plus 10mu minus 5mu} gives \the \mutoglue |
| 9469 |
20mu plus 10mu minus 5mu. |
| 9470 |
|
| 9471 |
\stopoldprimitive |
| 9472 |
|
| 9473 |
\startnewprimitive[title={\prm {mvlcurrentlyactive}}] |
| 9474 |
|
| 9475 |
This numeric state variable hold the id of the currently active mvl. Unless one |
| 9476 |
is in \prm {beginmlv} it's zero (regular page). |
| 9477 |
|
| 9478 |
\stopnewprimitive |
| 9479 |
|
| 9480 |
\startnewprimitive[title={\prm {nestedloopiterator}}] |
| 9481 |
|
| 9482 |
This is one of the accessors of loop iterators: |
| 9483 |
|
| 9484 |
\startbuffer |
| 9485 |
\expandedrepeat 2 {% |
| 9486 |
\expandedrepeat 3 {% |
| 9487 |
(n=\the\nestedloopiterator 1, |
| 9488 |
p=\the\previousloopiterator1, |
| 9489 |
c=\the\currentloopiterator) |
| 9490 |
}% |
| 9491 |
}% |
| 9492 |
\stopbuffer |
| 9493 |
|
| 9494 |
\typebuffer |
| 9495 |
|
| 9496 |
Gives: |
| 9497 |
|
| 9498 |
\getbuffer |
| 9499 |
|
| 9500 |
Where a nested iterator starts relative to innermost loop, the previous one is |
| 9501 |
relative to the outer loop (which is less predictable because we can already be |
| 9502 |
in a loop). |
| 9503 |
|
| 9504 |
\stopnewprimitive |
| 9505 |
|
| 9506 |
\startoldprimitive[title={\prm {newlinechar}}] |
| 9507 |
|
| 9508 |
When something is printed to one of the log channels the character with this code |
| 9509 |
will trigger a linebreak. That also resets some counters that deal with |
| 9510 |
suppressing redundant ones and possible indentation. Contrary to other engines |
| 9511 |
\LUAMETATEX\ doesn't bother about the length of lines. |
| 9512 |
|
| 9513 |
\stopoldprimitive |
| 9514 |
|
| 9515 |
\startoldprimitive[title={\prm {noalign}}] |
| 9516 |
|
| 9517 |
The token list passed to this primitive signals that we don't enter a table row |
| 9518 |
yet but for instance in a \prm {halign} do something between the lines: some |
| 9519 |
calculation or injecting inter-row material. In \LUAMETATEX\ this primitive can |
| 9520 |
be used nested. |
| 9521 |
|
| 9522 |
{\em Todo: discuss keywords.} |
| 9523 |
|
| 9524 |
\stopoldprimitive |
| 9525 |
|
| 9526 |
\startnewprimitive[title={\prm {noaligned}}] |
| 9527 |
|
| 9528 |
The alignment mechanism is kind of special when it comes to expansion because it |
| 9529 |
has to look ahead for a \prm {noalign}. This interferes with for instance |
| 9530 |
protected macros, but using this prefix we get around that. Among the reasons to |
| 9531 |
use protected macros inside an alignment is that they behave better inside for |
| 9532 |
instance \prm {expanded}. |
| 9533 |
|
| 9534 |
\stopnewprimitive |
| 9535 |
|
| 9536 |
\startnewprimitive[title={\prm {noarguments}}] |
| 9537 |
|
| 9538 |
Sometimes picking up arguments can interfere with intentions, for instance when |
| 9539 |
an optional argument uses square brackets but the ones following the command are |
| 9540 |
to be typeset. The \prm {noarguments} command is a variant on \prm {relax} (and |
| 9541 |
\prm {norelax}) but doesn't push back that command when seen. This permits for |
| 9542 |
instance usage in an \prm {edef} comparable context where one doesn't want to end |
| 9543 |
up with such artifacts. |
| 9544 |
|
| 9545 |
\stopnewprimitive |
| 9546 |
|
| 9547 |
\startnewprimitive[title={\prm {noatomruling}}] |
| 9548 |
|
| 9549 |
Spacing in math is based on classes and this primitive inserts a signal that |
| 9550 |
there is no ruling in place here. Basically we have a zero skip glue tagged as |
| 9551 |
non breakable because in math mode glue is not a valid breakpoint unless we have |
| 9552 |
configured inter|-|class penalties. |
| 9553 |
|
| 9554 |
\stopnewprimitive |
| 9555 |
|
| 9556 |
\startnewprimitive[title={\prm {noboundary}}] |
| 9557 |
|
| 9558 |
This inserts a boundary node with no specific property. It can still serve as |
| 9559 |
boundary but is not interpreted in special ways, like the others. |
| 9560 |
|
| 9561 |
\stopnewprimitive |
| 9562 |
|
| 9563 |
\startoldprimitive[title={\prm {noexpand}}] |
| 9564 |
|
| 9565 |
This prefix prevents expansion in a context where expansion happens. Another way |
| 9566 |
to prevent expansion is to define a macro as \prm {protected}. |
| 9567 |
|
| 9568 |
\startbuffer |
| 9569 |
\def\foo{foo} \edef\oof{we expanded \foo} \meaning\oof |
| 9570 |
\def\foo{foo} \edef\oof{we keep \noexpand\foo} \meaning\oof |
| 9571 |
\protected\def\foo{foo} \edef\oof{we keep \foo} \meaning\oof |
| 9572 |
\stopbuffer |
| 9573 |
|
| 9574 |
\typebuffer |
| 9575 |
|
| 9576 |
\startlines |
| 9577 |
\getbuffer |
| 9578 |
\stoplines |
| 9579 |
|
| 9580 |
\stopoldprimitive |
| 9581 |
|
| 9582 |
\startnewprimitive[title={\prm {nohrule}}] |
| 9583 |
|
| 9584 |
This is a rule but flagged as empty which means that the dimensions kick in as |
| 9585 |
for a normal rule but the backend can decide not to show it. |
| 9586 |
|
| 9587 |
\stopnewprimitive |
| 9588 |
|
| 9589 |
\startoldprimitive[title={\prm {noindent}}] |
| 9590 |
|
| 9591 |
This starts a paragraph. In \LUATEX\ (and \LUAMETATEX) a paragraph starts with a |
| 9592 |
so called par node (see \prm {indent} on how control that. After that comes |
| 9593 |
either \prm {parindent} glue or a horizontal box. The \prm {indent} makes gives |
| 9594 |
them some width, while \prm {noindent} keeps that zero. |
| 9595 |
|
| 9596 |
\stopoldprimitive |
| 9597 |
|
| 9598 |
\startoldprimitive[title={\prm {nolimits}}] |
| 9599 |
|
| 9600 |
This is a modifier: it flags the previous math atom to have its scripts after the |
| 9601 |
the atom (contrary to \prm {limits}. In \LUAMETATEX\ this can be any atom (that |
| 9602 |
is: any class). In display mode the location defaults to above and below. |
| 9603 |
|
| 9604 |
\stopoldprimitive |
| 9605 |
|
| 9606 |
\startnewprimitive[title={\prm {nomathchar}}] |
| 9607 |
|
| 9608 |
This can be used when a math character is expected but not available (or needed). |
| 9609 |
|
| 9610 |
\stopnewprimitive |
| 9611 |
|
| 9612 |
\startoldprimitive[title={\prm {nonscript}}] |
| 9613 |
|
| 9614 |
This prevents \TEX\ from adding inter|-|atom glue at this spot in script or |
| 9615 |
scriptscript mode. It actually is a special glue itself that serves as signal. |
| 9616 |
|
| 9617 |
\stopoldprimitive |
| 9618 |
|
| 9619 |
\startoldprimitive[title={\prm {nonstopmode}}] |
| 9620 |
|
| 9621 |
This directive omits all stops. |
| 9622 |
|
| 9623 |
\stopoldprimitive |
| 9624 |
|
| 9625 |
\startnewprimitive[title={\prm {nooutputboxerror}}] |
| 9626 |
|
| 9627 |
Setting this a positive value will silence the error triggered by a still |
| 9628 |
somewhat full output box after the output routine returns. It is a bitset: |
| 9629 |
|
| 9630 |
\starttabulate[|T||] |
| 9631 |
\NC 0x1 \NC when firing up \NC \NR |
| 9632 |
\NC 0x2 \NC after output \NC \NR |
| 9633 |
\stoptabulate |
| 9634 |
|
| 9635 |
where values larger than two will always silence, |
| 9636 |
|
| 9637 |
\stopnewprimitive |
| 9638 |
|
| 9639 |
\startnewprimitive[title={\prm {norelax}}] |
| 9640 |
|
| 9641 |
The rationale for this command can be shown by a few examples: |
| 9642 |
|
| 9643 |
\startbuffer |
| 9644 |
\dimen0 1pt \dimen2 1pt \dimen4 2pt |
| 9645 |
\edef\testa{\ifdim\dimen0=\dimen2\norelax N\else Y\fi} |
| 9646 |
\edef\testb{\ifdim\dimen0=\dimen2\relax N\else Y\fi} |
| 9647 |
\edef\testc{\ifdim\dimen0=\dimen4\norelax N\else Y\fi} |
| 9648 |
\edef\testd{\ifdim\dimen0=\dimen4\relax N\else Y\fi} |
| 9649 |
\edef\teste{\norelax} |
| 9650 |
\stopbuffer |
| 9651 |
|
| 9652 |
\typebuffer |
| 9653 |
|
| 9654 |
The five meanings are: |
| 9655 |
|
| 9656 |
\start \getbuffer \starttabulate[|T|T|] |
| 9657 |
\NC \string\testa \NC \meaning\testa \NC \NR |
| 9658 |
\NC \string\testb \NC \meaning\testb \NC \NR |
| 9659 |
\NC \string\testc \NC \meaning\testc \NC \NR |
| 9660 |
\NC \string\testd \NC \meaning\testd \NC \NR |
| 9661 |
\NC \string\teste \NC \meaning\teste \NC \NR |
| 9662 |
\stoptabulate \stop |
| 9663 |
|
| 9664 |
So, the \prm {norelax} acts like \prm {relax} but is not pushed back as |
| 9665 |
usual (in some cases). |
| 9666 |
|
| 9667 |
\stopnewprimitive |
| 9668 |
|
| 9669 |
\startnewprimitive[title={\prm {normalizelinemode}}] |
| 9670 |
|
| 9671 |
The \TEX\ engine was not designed to be opened up, and therefore the result of |
| 9672 |
the linebreak effort can differ depending on the conditions. For instance not |
| 9673 |
every line gets the left- or rightskip. The first and last lines have some unique |
| 9674 |
components too. When \LUATEX\ made it possible too get the (intermediate) result |
| 9675 |
manipulating the result also involved checking what one encountered, for instance |
| 9676 |
glue and its origin. In \LUAMETATEX\ we can normalize lines so that they have for |
| 9677 |
instance balanced skips. |
| 9678 |
|
| 9679 |
\starttworows |
| 9680 |
\getbuffer[engine:syntax:normalizelinecodes] |
| 9681 |
\stoptworows |
| 9682 |
|
| 9683 |
The order in which the skips get inserted when we normalize is as follows: |
| 9684 |
|
| 9685 |
\starttabulate |
| 9686 |
\NC \prm {lefthangskip} \NC the hanging indentation (or zero) \NC \NR |
| 9687 |
\NC \prm {leftskip} \NC the value even when zero \NC \NR |
| 9688 |
\NC \prm {parfillleftskip} \NC only on the last line \NC \NR |
| 9689 |
\NC \prm {parinitleftskip} \NC only on the first line \NC \NR |
| 9690 |
\NC \prm {indentskip} \NC the amount of indentation \NC \NR |
| 9691 |
\NC \unknown \NC the (optional) content \NC \NR |
| 9692 |
\NC \prm {parinitrightskip} \NC only on the first line \NC \NR |
| 9693 |
\NC \prm {parfillrightskip} \NC only on the last line \NC \NR |
| 9694 |
\NC \prm {correctionskip} \NC the correction needed to stay within the \prm {hsize} \NC \NR |
| 9695 |
\NC \prm {rightskip} \NC the value even when zero \NC \NR |
| 9696 |
\NC \prm {righthangskip} \NC the hanging indentation (or zero) \NC \NR |
| 9697 |
\stoptabulate |
| 9698 |
|
| 9699 |
The init and fill skips can both show up when we have a single line. The |
| 9700 |
correction skip replaces the traditional juggling with the right skip and shift |
| 9701 |
of the boxed line. |
| 9702 |
|
| 9703 |
For now we leave the other options to your imagination. Some of these can be |
| 9704 |
achieved by callbacks (as we did in older versions of \CONTEXT) but having the |
| 9705 |
engine do the work we get a better performance. |
| 9706 |
|
| 9707 |
\stopnewprimitive |
| 9708 |
|
| 9709 |
\startnewprimitive[title={\prm {normalizeparmode}}] |
| 9710 |
|
| 9711 |
For now we just mention the few options available. It is also worth mentioning that |
| 9712 |
\LUAMETATEX\ tries to balance the direction nodes. |
| 9713 |
|
| 9714 |
\starttworows |
| 9715 |
\getbuffer[engine:syntax:normalizeparcodes] |
| 9716 |
\stoptworows |
| 9717 |
|
| 9718 |
\stopnewprimitive |
| 9719 |
|
| 9720 |
\startnewprimitive[title={\prm {noscript}}] |
| 9721 |
|
| 9722 |
In math we can have multiple pre- and postscript. These get typeset in pairs and |
| 9723 |
this primitive can be used to skip one. More about multiple scripts (and indices) |
| 9724 |
can be found in the \CONTEXT\ math manual. |
| 9725 |
|
| 9726 |
\stopnewprimitive |
| 9727 |
|
| 9728 |
\startnewprimitive[title={\prm {nospaces}}] |
| 9729 |
|
| 9730 |
When \prm {nospaces} is set to~1 no spaces are inserted, when its value is~2 a |
| 9731 |
zero space is inserted. The default value is~0 which means that spaces become |
| 9732 |
glue with properties depending on the font, specific parameters and|/|or space |
| 9733 |
factors determined preceding characters. A value of~3 will inject a glyph node |
| 9734 |
with code \prm {spacechar}. The values~4, 5 and~6 insert a fixed space. With ~5 |
| 9735 |
there is no stretch and~6 sets the width to the width of a zero. |
| 9736 |
|
| 9737 |
\stopnewprimitive |
| 9738 |
|
| 9739 |
\startnewprimitive[title={\prm {nosubprescript}}] |
| 9740 |
|
| 9741 |
This processes the given script in the current style, so: |
| 9742 |
|
| 9743 |
\startbuffer |
| 9744 |
$ x___2 + x\nosubprescript{2} + x\subprescript{2} $ |
| 9745 |
\stopbuffer |
| 9746 |
|
| 9747 |
comes out as: \inlinebuffer. |
| 9748 |
|
| 9749 |
\stopnewprimitive |
| 9750 |
|
| 9751 |
\startnewprimitive[title={\prm {nosubscript}}] |
| 9752 |
|
| 9753 |
This processes the given script in the current style, so: |
| 9754 |
|
| 9755 |
\startbuffer |
| 9756 |
$ x_2 + x\nosubscript{2} + x\subscript{2} $ |
| 9757 |
\stopbuffer |
| 9758 |
|
| 9759 |
comes out as: \inlinebuffer. |
| 9760 |
|
| 9761 |
\stopnewprimitive |
| 9762 |
|
| 9763 |
\startnewprimitive[title={\prm {nosuperprescript}}] |
| 9764 |
|
| 9765 |
This processes the given script in the current style, so: |
| 9766 |
|
| 9767 |
\startbuffer |
| 9768 |
$ x^^^2 + x\nosuperprescript{2} + x\superprescript{2} $ |
| 9769 |
\stopbuffer |
| 9770 |
|
| 9771 |
comes out as: \inlinebuffer. |
| 9772 |
|
| 9773 |
\stopnewprimitive |
| 9774 |
|
| 9775 |
\startnewprimitive[title={\prm {nosuperscript}}] |
| 9776 |
|
| 9777 |
This processes the given script in the current style, so: |
| 9778 |
|
| 9779 |
\startbuffer |
| 9780 |
$ x^2 + x\nosuperprescript{2} + x\superprescript{2} $ |
| 9781 |
\stopbuffer |
| 9782 |
|
| 9783 |
comes out as: \inlinebuffer. |
| 9784 |
|
| 9785 |
\stopnewprimitive |
| 9786 |
|
| 9787 |
\startnewprimitive[title={\prm {novrule}}] |
| 9788 |
|
| 9789 |
This is a rule but flagged as empty which means that the dimensions kick in as |
| 9790 |
for a normal rule but the backend can decide not to show it. |
| 9791 |
|
| 9792 |
\stopnewprimitive |
| 9793 |
|
| 9794 |
\startoldprimitive[title={\prm {nulldelimiterspace}}] |
| 9795 |
|
| 9796 |
In fenced math delimiters can be invisible in which case this parameter |
| 9797 |
determines the amount of space (width) that ghost delimiter takes. |
| 9798 |
|
| 9799 |
\stopoldprimitive |
| 9800 |
|
| 9801 |
\startoldprimitive[title={\prm {nullfont}}] |
| 9802 |
|
| 9803 |
This a symbolic reference to a font with no glyphs and a minimal set of font |
| 9804 |
dimensions. |
| 9805 |
|
| 9806 |
\stopoldprimitive |
| 9807 |
|
| 9808 |
\startoldprimitive[title={\prm {number}}] |
| 9809 |
|
| 9810 |
This \TEX\ primitive serializes the next token into a number, assuming that it |
| 9811 |
is indeed a number, like |
| 9812 |
|
| 9813 |
\starttyping |
| 9814 |
\number`A |
| 9815 |
\number65 |
| 9816 |
\number\scratchcounter |
| 9817 |
\stoptyping |
| 9818 |
|
| 9819 |
For counters and such the \prm {the} primitive does the same, but when you're |
| 9820 |
not sure if what follows is a verbose number or (for instance) a counter the |
| 9821 |
\prm {number} primitive is a safer bet, because \type {\the 65} will not work. |
| 9822 |
|
| 9823 |
\stopoldprimitive |
| 9824 |
|
| 9825 |
\startnewprimitive[title={\prm {numericscale}}] |
| 9826 |
|
| 9827 |
This primitive can best be explained by a few examples: |
| 9828 |
|
| 9829 |
\startbuffer |
| 9830 |
\the\numericscale 1323 |
| 9831 |
\the\numericscale 1323.0 |
| 9832 |
\the\numericscale 1.323 |
| 9833 |
\the\numericscale 13.23 |
| 9834 |
\stopbuffer |
| 9835 |
|
| 9836 |
\typebuffer |
| 9837 |
|
| 9838 |
In several places \TEX\ uses a scale but due to the lack of floats it then uses |
| 9839 |
1000 as 1.0 replacement. This primitive can be used for \quote {real} scales: |
| 9840 |
|
| 9841 |
\startlines \getbuffer \stoplines |
| 9842 |
|
| 9843 |
\stopnewprimitive |
| 9844 |
|
| 9845 |
\startnewprimitive[title={\prm {numericscaled}}] |
| 9846 |
|
| 9847 |
This is a variant if \prm {numericscale}: |
| 9848 |
|
| 9849 |
\startbuffer |
| 9850 |
\scratchcounter 1000 |
| 9851 |
\the\numericscaled 1323 \scratchcounter |
| 9852 |
\the\numericscaled 1323.0 \scratchcounter |
| 9853 |
\the\numericscaled 1.323 \scratchcounter |
| 9854 |
\the\numericscaled 13.23 \scratchcounter |
| 9855 |
\stopbuffer |
| 9856 |
|
| 9857 |
\typebuffer |
| 9858 |
|
| 9859 |
The second number gets multiplied by the first fraction: |
| 9860 |
|
| 9861 |
\startlines \getbuffer \stoplines |
| 9862 |
|
| 9863 |
\stopnewprimitive |
| 9864 |
|
| 9865 |
% \startnewprimitive[title={\prm {numexperimental}}] |
| 9866 |
% \stopnewprimitive |
| 9867 |
|
| 9868 |
\startoldprimitive[title={\prm {numexpr}}] |
| 9869 |
|
| 9870 |
This primitive was introduced by \ETEX\ and supports a simple expression syntax: |
| 9871 |
|
| 9872 |
\startbuffer |
| 9873 |
\the\numexpr 10 * (1 + 2 - 5) / 2 \relax |
| 9874 |
\stopbuffer |
| 9875 |
|
| 9876 |
\typebuffer |
| 9877 |
|
| 9878 |
gives: \inlinebuffer. You can mix in symbolic integers and dimensions. |
| 9879 |
|
| 9880 |
\stopoldprimitive |
| 9881 |
|
| 9882 |
\startnewprimitive[title={\prm {numexpression}}] |
| 9883 |
|
| 9884 |
The normal \prm {numexpr} primitive understands the \type {+}, \type {-}, \type |
| 9885 |
{*} and \type {/} operators but in \LUAMETATEX\ we also can use \type {:} for a |
| 9886 |
non rounded integer division (think of \LUA's \type {//}). if you want more than |
| 9887 |
that, you can use the new expression primitive where you can use the following |
| 9888 |
operators. |
| 9889 |
|
| 9890 |
\starttabulate[||cT|cT|] |
| 9891 |
\BC add \NC + \NC \NC \NR |
| 9892 |
\BC subtract \NC - \NC \NC \NR |
| 9893 |
\BC multiply \NC * \NC \NC \NR |
| 9894 |
\BC divide \NC / : \NC \NC \NR |
| 9895 |
\BC mod \NC \letterpercent \NC mod \NC \NR |
| 9896 |
\BC band \NC & \NC band \NC \NR |
| 9897 |
\BC bxor \NC ^ \NC bxor \NC \NR |
| 9898 |
\BC bor \NC \letterbar \space v \NC bor \NC \NR |
| 9899 |
\BC and \NC && \NC and \NC \NR |
| 9900 |
\BC or \NC \letterbar\letterbar \NC or \NC \NR |
| 9901 |
\BC setbit \NC <undecided> \NC bset \NC \NR |
| 9902 |
\BC resetbit \NC <undecided> \NC breset \NC \NR |
| 9903 |
\BC left \NC << \NC \NC \NR |
| 9904 |
\BC right \NC >> \NC \NC \NR |
| 9905 |
\BC less \NC < \NC \NC \NR |
| 9906 |
\BC lessequal \NC <= \NC \NC \NR |
| 9907 |
\BC equal \NC = == \NC \NC \NR |
| 9908 |
\BC moreequal \NC >= \NC \NC \NR |
| 9909 |
\BC more \NC > \NC \NC \NR |
| 9910 |
\BC unequal \NC <> != \lettertilde = \NC \NC \NR |
| 9911 |
\BC not \NC ! \lettertilde \NC not \NC \NR |
| 9912 |
\stoptabulate |
| 9913 |
|
| 9914 |
An example of the verbose bitwise operators is: |
| 9915 |
|
| 9916 |
\starttyping |
| 9917 |
\scratchcounter = \numexpression |
| 9918 |
"00000 bor "00001 bor "00020 bor "00400 bor "08000 bor "F0000 |
| 9919 |
\relax |
| 9920 |
\stoptyping |
| 9921 |
|
| 9922 |
In the table you might have notices that some operators have equivalents. This |
| 9923 |
makes the scanner a bit less sensitive for catcode regimes. |
| 9924 |
|
| 9925 |
When \prm {tracingexpressions} is set to one or higher the intermediate \quote |
| 9926 |
{reverse polish notation} stack that is used for the calculation is shown, for |
| 9927 |
instance: |
| 9928 |
|
| 9929 |
\starttyping |
| 9930 |
4:8: {numexpression rpn: 2 5 > 4 5 > and} |
| 9931 |
\stoptyping |
| 9932 |
|
| 9933 |
When you want the output on your console, you need to say: |
| 9934 |
|
| 9935 |
\starttyping |
| 9936 |
\tracingexpressions 1 |
| 9937 |
\tracingonline 1 |
| 9938 |
\stoptyping |
| 9939 |
|
| 9940 |
Here are some things that \prm {numexpr} is not suitable for but \prm |
| 9941 |
{numexpression} can handle: |
| 9942 |
|
| 9943 |
\starttyping |
| 9944 |
\scratchcounter = \numexpression |
| 9945 |
"00000 bor "00001 bor "00020 bor "00400 bor "08000 bor "F0000 |
| 9946 |
\relax |
| 9947 |
|
| 9948 |
\ifcase \numexpression |
| 9949 |
(\scratchcounterone > 5) && (\scratchcountertwo > 5) |
| 9950 |
\relax yes\else nop\fi |
| 9951 |
\stoptyping |
| 9952 |
|
| 9953 |
\stopnewprimitive |
| 9954 |
|
| 9955 |
\startoldprimitive[title={\prm {omit}}] |
| 9956 |
|
| 9957 |
This primitive cancels the template set for the upcoming cell. Often it is used |
| 9958 |
in combination with \prm {span}. |
| 9959 |
|
| 9960 |
\stopoldprimitive |
| 9961 |
|
| 9962 |
\startnewprimitive[title={\prm {optionalboundary}}] |
| 9963 |
|
| 9964 |
This boundary is used to mark optional content. An positive \prm |
| 9965 |
{optionalboundary} starts a range and a zero one ends it. Nesting is not |
| 9966 |
supported. Optional content is considered when an additional paragraph pass |
| 9967 |
enables it as part of its recipe. |
| 9968 |
|
| 9969 |
\stopnewprimitive |
| 9970 |
|
| 9971 |
\startoldprimitive[title={\prm {or}}] |
| 9972 |
|
| 9973 |
This traditional primitive is part of the condition testing mechanism and relates |
| 9974 |
to an \prm {ifcase} test (or a similar test to be introduced in later |
| 9975 |
sections). Depending on the value, \TEX\ will do a fast scanning till the right |
| 9976 |
\prm {or} is seen, then it will continue expanding till it sees a \prm {or} |
| 9977 |
or \prm {else} or \prm {orelse} (to be discussed later). It will then do a |
| 9978 |
fast skipping pass till it sees an \prm {fi}. |
| 9979 |
|
| 9980 |
\stopoldprimitive |
| 9981 |
|
| 9982 |
\startnewprimitive[title={\prm {orelse}}] |
| 9983 |
|
| 9984 |
This primitive provides a convenient way to flatten your conditional tests. So |
| 9985 |
instead of |
| 9986 |
|
| 9987 |
\starttyping |
| 9988 |
\ifnum\scratchcounter<-10 |
| 9989 |
too small |
| 9990 |
\else\ifnum\scratchcounter>10 |
| 9991 |
too large |
| 9992 |
\else |
| 9993 |
just right |
| 9994 |
\fi\fi |
| 9995 |
\stoptyping |
| 9996 |
|
| 9997 |
You can say this: |
| 9998 |
|
| 9999 |
\starttyping |
| 10000 |
\ifnum\scratchcounter<-10 |
| 10001 |
too small |
| 10002 |
\orelse\ifnum\scratchcounter>10 |
| 10003 |
too large |
| 10004 |
\else |
| 10005 |
just right |
| 10006 |
\fi |
| 10007 |
\stoptyping |
| 10008 |
|
| 10009 |
You can mix tests and even the case variants will work in most cases \footnote {I |
| 10010 |
just play safe because there are corner cases that might not work yet.} |
| 10011 |
|
| 10012 |
\starttyping |
| 10013 |
\ifcase\scratchcounter zero |
| 10014 |
\or one |
| 10015 |
\or two |
| 10016 |
\orelse\ifnum\scratchcounter<10 less than ten |
| 10017 |
\else ten or more |
| 10018 |
\fi |
| 10019 |
\stoptyping |
| 10020 |
|
| 10021 |
Performance wise there are no real benefits although in principle there is a bit |
| 10022 |
less housekeeping involved than with nested checks. However you might like this: |
| 10023 |
|
| 10024 |
\starttyping |
| 10025 |
\ifnum\scratchcounter<-10 |
| 10026 |
\expandafter\toosmall |
| 10027 |
\orelse\ifnum\scratchcounter>10 |
| 10028 |
\expandafter\toolarge |
| 10029 |
\else |
| 10030 |
\expandafter\justright |
| 10031 |
\fi |
| 10032 |
\stoptyping |
| 10033 |
|
| 10034 |
over: |
| 10035 |
|
| 10036 |
\starttyping |
| 10037 |
\ifnum\scratchcounter<-10 |
| 10038 |
\expandafter\toosmall |
| 10039 |
\else\ifnum\scratchcounter>10 |
| 10040 |
\expandafter\expandafter\expandafter\toolarge |
| 10041 |
\else |
| 10042 |
\expandafter\expandafter\expandafter\justright |
| 10043 |
\fi\fi |
| 10044 |
\stoptyping |
| 10045 |
|
| 10046 |
or the more \CONTEXT\ specific: |
| 10047 |
|
| 10048 |
\starttyping |
| 10049 |
\ifnum\scratchcounter<-10 |
| 10050 |
\expandafter\toosmall |
| 10051 |
\else\ifnum\scratchcounter>10 |
| 10052 |
\doubleexpandafter\toolarge |
| 10053 |
\else |
| 10054 |
\doubleexpandafter\justright |
| 10055 |
\fi\fi |
| 10056 |
\stoptyping |
| 10057 |
|
| 10058 |
But then, some \TEX ies like complex and obscure code and throwing away working |
| 10059 |
old code that took ages to perfect and get working and also showed that one |
| 10060 |
masters \TEX\ might hurt. |
| 10061 |
|
| 10062 |
There is a nice side effect of this mechanism. When you define: |
| 10063 |
|
| 10064 |
\starttyping |
| 10065 |
\def\quitcondition{\orelse\iffalse} |
| 10066 |
\stoptyping |
| 10067 |
|
| 10068 |
you can do this: |
| 10069 |
|
| 10070 |
\starttyping |
| 10071 |
\ifnum\count0<10 |
| 10072 |
less |
| 10073 |
\orelse\ifnum\count0=10 |
| 10074 |
equal |
| 10075 |
\quitcondition |
| 10076 |
indeed |
| 10077 |
\else |
| 10078 |
more |
| 10079 |
\fi |
| 10080 |
\stoptyping |
| 10081 |
|
| 10082 |
Of course it is only useful at the right level, so you might end up with cases like |
| 10083 |
|
| 10084 |
\starttyping |
| 10085 |
\ifnum\count0<10 |
| 10086 |
less |
| 10087 |
\orelse\ifnum\count0=10 |
| 10088 |
equal |
| 10089 |
\ifnum\count2=30 |
| 10090 |
\expandafter\quitcondition |
| 10091 |
\fi |
| 10092 |
indeed |
| 10093 |
\else |
| 10094 |
more |
| 10095 |
\fi |
| 10096 |
\stoptyping |
| 10097 |
|
| 10098 |
\stopnewprimitive |
| 10099 |
|
| 10100 |
\startnewprimitive[title={\prm {orphanlinefactors}}] |
| 10101 |
|
| 10102 |
Normally this (specification) parameter is set in a \prm {parpasses} as it |
| 10103 |
supports multiple orphan penalties with a different weight (starting from the |
| 10104 |
last candidate). |
| 10105 |
|
| 10106 |
\stopnewprimitive |
| 10107 |
|
| 10108 |
\startnewprimitive[title={\prm {orphanpenalties}}] |
| 10109 |
|
| 10110 |
This an (single entry) array parameter: first the size is given followed by that |
| 10111 |
amount of penalties. These penalties are injected before spaces, going backward |
| 10112 |
from the end of a paragraph. When we see a math node with a penalty set then we |
| 10113 |
take the max and jump over a (preceding) skip. |
| 10114 |
|
| 10115 |
\stopnewprimitive |
| 10116 |
|
| 10117 |
\startnewprimitive[title={\prm {orunless}}] |
| 10118 |
|
| 10119 |
This is the negated variant of \prm {orelse} (prefixing that one with \tex |
| 10120 |
{unless} doesn't work well. |
| 10121 |
|
| 10122 |
\stopnewprimitive |
| 10123 |
|
| 10124 |
\startoldprimitive[title={\prm {outer}}][obsolete=yes] |
| 10125 |
|
| 10126 |
An outer macro is one that can only be used at the outer level. This property is |
| 10127 |
no longer supported. Like \prm {long}, the \prm {outer} prefix is now an |
| 10128 |
no|-|op (and we don't expect this to have unfortunate side effects). |
| 10129 |
|
| 10130 |
\stopoldprimitive |
| 10131 |
|
| 10132 |
\startoldprimitive[title={\prm {output}}] |
| 10133 |
|
| 10134 |
This token list register holds the code that will be expanded when \TEX\ enters |
| 10135 |
the output routine. That code is supposed to do something with the content in |
| 10136 |
the box with number \prm {outputbox}. By default this is box 255 but that can be |
| 10137 |
changed with \prm {outputbox}. |
| 10138 |
|
| 10139 |
\stopoldprimitive |
| 10140 |
|
| 10141 |
\startnewprimitive[title={\prm {outputbox}}] |
| 10142 |
|
| 10143 |
This is where the split off page contend ends up when the output routine is |
| 10144 |
triggered. |
| 10145 |
|
| 10146 |
\stopnewprimitive |
| 10147 |
|
| 10148 |
\startoldprimitive[title={\prm {outputpenalty}}] |
| 10149 |
|
| 10150 |
This is the penalty that triggered the output routine. |
| 10151 |
|
| 10152 |
\stopoldprimitive |
| 10153 |
|
| 10154 |
\startoldprimitive[title={\prm {over}}][obsolete=yes] |
| 10155 |
|
| 10156 |
This math primitive is actually a bit of a spoiler for the parser as it is one of |
| 10157 |
the few that looks back. The \prm {Uover} variant is different and takes two |
| 10158 |
arguments. We leave it to the user to predicts the results of: |
| 10159 |
|
| 10160 |
\starttyping |
| 10161 |
$ {1} \over {x} $ |
| 10162 |
$ 1 \over x $ |
| 10163 |
$ 12 \over x / y $ |
| 10164 |
$ a + 1 \over {x} $ |
| 10165 |
\stoptyping |
| 10166 |
|
| 10167 |
and: |
| 10168 |
|
| 10169 |
\starttyping |
| 10170 |
$ \textstyle 1 \over x $ |
| 10171 |
$ {\textstyle 1} \over x $ |
| 10172 |
$ \textstyle {1 \over x} $ |
| 10173 |
\stoptyping |
| 10174 |
|
| 10175 |
It's one of the reasons why macro packages provide \type {\frac}. |
| 10176 |
|
| 10177 |
\stopoldprimitive |
| 10178 |
|
| 10179 |
\startoldprimitive[title={\prm {overfullrule}}] |
| 10180 |
|
| 10181 |
When an overfull box is encountered a rule can be shown in the margin and this |
| 10182 |
parameter sets its width. For the record: \CONTEXT\ does it different. |
| 10183 |
|
| 10184 |
\stopoldprimitive |
| 10185 |
|
| 10186 |
\startoldprimitive[title={\prm {overline}}] |
| 10187 |
|
| 10188 |
This is a math specific primitive that draws a line over the given content. It is |
| 10189 |
a poor mans replacement for a delimiter. The thickness is set with \prm |
| 10190 |
{Umathoverbarrule}, the distance between content and rule is set by \prm |
| 10191 |
{Umathoverbarvgap} and \prm {Umathoverbarkern} is added above the rule. The style |
| 10192 |
used for the content under the rule can be set with \prm {Umathoverlinevariant}. |
| 10193 |
|
| 10194 |
Because \CONTEXT\ set up math in a special way, the following example: |
| 10195 |
|
| 10196 |
\startbuffer[demo] |
| 10197 |
\normaloverline { |
| 10198 |
\blackrule[color=red, height=1ex,depth=0ex,width=2cm]% |
| 10199 |
\kern-2cm |
| 10200 |
\blackrule[color=blue,height=0ex,depth=.5ex,width=2cm] |
| 10201 |
x + x |
| 10202 |
} |
| 10203 |
\stopbuffer |
| 10204 |
|
| 10205 |
\typebuffer[demo] |
| 10206 |
|
| 10207 |
gives: \ruledhbox {$\getbuffer[demo]$}, while: |
| 10208 |
|
| 10209 |
\startbuffer[setup] |
| 10210 |
\mathfontcontrol\zerocount |
| 10211 |
\Umathoverbarkern\allmathstyles10pt |
| 10212 |
\Umathoverbarvgap\allmathstyles5pt |
| 10213 |
\Umathoverbarrule\allmathstyles2.5pt |
| 10214 |
\Umathoverlinevariant\textstyle\scriptstyle |
| 10215 |
\stopbuffer |
| 10216 |
|
| 10217 |
\typebuffer[setup] |
| 10218 |
|
| 10219 |
gives this: \ruledhbox {$\getbuffer[setup,demo]$}. We have to disable the related |
| 10220 |
\prm {mathfontcontrol} bits because otherwise the thickness is taken from the font. The |
| 10221 |
variant is just there to overload the (in traditional \TEX\ engines) default. |
| 10222 |
|
| 10223 |
\stopoldprimitive |
| 10224 |
|
| 10225 |
\startnewprimitive[title={\prm {overloaded}}] |
| 10226 |
|
| 10227 |
This prefix can be used to overload a frozen macro. |
| 10228 |
|
| 10229 |
\stopnewprimitive |
| 10230 |
|
| 10231 |
\startnewprimitive[title={\prm {overloadmode}}] |
| 10232 |
|
| 10233 |
The overload protection mechanism can be used to prevent users from redefining |
| 10234 |
a control sequence. The mode can have several values, the higher the more strict |
| 10235 |
we are: |
| 10236 |
|
| 10237 |
\starttabulate[||||||||] |
| 10238 |
\NC \NC \NC immutable \NC permanent \NC primitive \NC frozen \NC instance \NC \NR |
| 10239 |
\NC 1 \NC warning \NC + \NC + \NC + \NC \NC \NC \NR |
| 10240 |
\NC 2 \NC error \NC + \NC + \NC + \NC \NC \NC \NR |
| 10241 |
\NC 3 \NC warning \NC + \NC + \NC + \NC + \NC \NC \NR |
| 10242 |
\NC 4 \NC error \NC + \NC + \NC + \NC + \NC \NC \NR |
| 10243 |
\NC 5 \NC warning \NC + \NC + \NC + \NC + \NC + \NC \NR |
| 10244 |
\NC 6 \NC error \NC + \NC + \NC + \NC + \NC + \NC \NR |
| 10245 |
\stoptabulate |
| 10246 |
|
| 10247 |
When you set a high error value, you can of course temporary lower or even zero |
| 10248 |
the mode. In \CONTEXT\ all macros and quantities are tagged so there setting the |
| 10249 |
mode to~6 gives a proper protection against overloading. We need to zero the mode |
| 10250 |
when we load for instance tikz, so when you use that generic package, you loose |
| 10251 |
some. |
| 10252 |
|
| 10253 |
\stopnewprimitive |
| 10254 |
|
| 10255 |
\startnewprimitive[title={\prm {overshoot}}] |
| 10256 |
|
| 10257 |
This primitive is a companion to \prm {badness} and reports how much a box |
| 10258 |
overflows. |
| 10259 |
|
| 10260 |
\startbuffer |
| 10261 |
\setbox0\hbox to 1em {mmm} \the\badness\quad\the\overshoot |
| 10262 |
\setbox0\hbox {mm} \the\badness\quad\the\overshoot |
| 10263 |
\setbox0\hbox to 3em {m} \the\badness\quad\the\overshoot |
| 10264 |
\stopbuffer |
| 10265 |
|
| 10266 |
\typebuffer |
| 10267 |
|
| 10268 |
This reports: |
| 10269 |
|
| 10270 |
\startlines |
| 10271 |
\getbuffer |
| 10272 |
\stoplines |
| 10273 |
|
| 10274 |
And: |
| 10275 |
|
| 10276 |
\startbuffer |
| 10277 |
\hbox to 2cm {does it fit} \the\overshoot |
| 10278 |
\hbox to 2cm {does it fit in here} \the\overshoot |
| 10279 |
\hbox to 2cm {how much does fit in here} \the\overshoot |
| 10280 |
\stopbuffer |
| 10281 |
|
| 10282 |
\typebuffer |
| 10283 |
|
| 10284 |
gives: |
| 10285 |
|
| 10286 |
\startlines |
| 10287 |
\getbuffer |
| 10288 |
\stoplines |
| 10289 |
|
| 10290 |
When traditional \TEX\ wraps up the lines in a paragraph it uses a mix of shift |
| 10291 |
(a box property) to position the content suiting the hanging indentation and|/|or |
| 10292 |
paragraph shape, and fills up the line using right skip glue, also in order to |
| 10293 |
silence complaints in packaging. In \LUAMETATEX\ the lines can be normalized so |
| 10294 |
that they all have all possible skips to the left and right (even if they're |
| 10295 |
zero). The \prm {overshoot} primitive fits into this picture and is present as a |
| 10296 |
compensation glue. This all fits better in a situation where the internals are |
| 10297 |
opened up via \LUA. |
| 10298 |
|
| 10299 |
\stopnewprimitive |
| 10300 |
|
| 10301 |
\startoldprimitive[title={\prm {overwithdelims}}][obsolete=yes] |
| 10302 |
|
| 10303 |
This is a variant of \prm {over} but with delimiters. It has a more advanced |
| 10304 |
upgrade in \prm {Uoverwithdelims}. |
| 10305 |
|
| 10306 |
\stopoldprimitive |
| 10307 |
|
| 10308 |
\startnewprimitive[title={\prm {pageboundary}}] |
| 10309 |
|
| 10310 |
In order to avoid side effects of triggering the page builder with a specific |
| 10311 |
penalty we can use this primitive which expects a value that actually gets |
| 10312 |
inserted as zero penalty before triggering the page builder callback. Think of |
| 10313 |
adding a no|-|op to the contribution list. We fake a zero penalty so that all |
| 10314 |
gets processed. The main rationale is that we get a better indication of what we |
| 10315 |
do. Of course a callback can remove this node so that it is never seen. |
| 10316 |
Triggering from the callback is not doable. Consider this experimental code |
| 10317 |
(which is actually used in \CONTEXT\ anyway). |
| 10318 |
|
| 10319 |
\stopnewprimitive |
| 10320 |
|
| 10321 |
\startnewprimitive[title={\prm {pagedepth}}] |
| 10322 |
|
| 10323 |
This page property holds the depth of the page. |
| 10324 |
|
| 10325 |
\stopnewprimitive |
| 10326 |
|
| 10327 |
\startoldprimitive[title={\prm {pagediscards}}] |
| 10328 |
|
| 10329 |
The left|-|overs after a page is split of the main vertical list when glue and |
| 10330 |
penalties are normally discarded. The discards can be pushed back in (for |
| 10331 |
instance) trial runs. |
| 10332 |
|
| 10333 |
\stopoldprimitive |
| 10334 |
|
| 10335 |
\startnewprimitive[title={\prm {pageexcess}}] |
| 10336 |
|
| 10337 |
This page property hold the amount of overflow when a page break occurs. |
| 10338 |
|
| 10339 |
\stopnewprimitive |
| 10340 |
|
| 10341 |
\startnewprimitive[title={\prm {pageextragoal}}] |
| 10342 |
|
| 10343 |
This (experimental) dimension will be used when the page overflows but a bit of |
| 10344 |
overshoot is considered okay. |
| 10345 |
|
| 10346 |
\stopnewprimitive |
| 10347 |
|
| 10348 |
\startoldprimitive[title={\prm {pagefilllstretch}}] |
| 10349 |
|
| 10350 |
The accumulated amount of third order stretch on the current page. |
| 10351 |
|
| 10352 |
\stopoldprimitive |
| 10353 |
|
| 10354 |
\startoldprimitive[title={\prm {pagefillstretch}}] |
| 10355 |
|
| 10356 |
The accumulated amount of second order stretch on the current page. |
| 10357 |
|
| 10358 |
\stopoldprimitive |
| 10359 |
|
| 10360 |
\startoldprimitive[title={\prm {pagefilstretch}}] |
| 10361 |
|
| 10362 |
The accumulated amount of first order stretch on the current page. |
| 10363 |
|
| 10364 |
\stopoldprimitive |
| 10365 |
|
| 10366 |
\startnewprimitive[title={\prm {pagefistretch}}] |
| 10367 |
|
| 10368 |
The accumulated amount of zero order stretch on the current page. |
| 10369 |
|
| 10370 |
\stopnewprimitive |
| 10371 |
|
| 10372 |
\startoldprimitive[title={\prm {pagegoal}}] |
| 10373 |
|
| 10374 |
The target height of a page (the running text). This value will be decreased by |
| 10375 |
the height of inserts something to keep into mind when messing around with this |
| 10376 |
and other (pseudo) page related parameters like \prm {pagetotal}. |
| 10377 |
|
| 10378 |
\stopoldprimitive |
| 10379 |
|
| 10380 |
\startnewprimitive[title={\prm {pagelastdepth}}] |
| 10381 |
|
| 10382 |
The accumulated depth of the current page. |
| 10383 |
|
| 10384 |
\stopnewprimitive |
| 10385 |
|
| 10386 |
\startnewprimitive[title={\prm {pagelastfilllstretch}}] |
| 10387 |
|
| 10388 |
The accumulated amount of third order stretch on the current page. Contrary to |
| 10389 |
\prm {pagefilllstretch} this is the really contributed amount, not the upcoming. |
| 10390 |
|
| 10391 |
\stopnewprimitive |
| 10392 |
|
| 10393 |
\startnewprimitive[title={\prm {pagelastfillstretch}}] |
| 10394 |
|
| 10395 |
The accumulated amount of second order stretch on the current page. Contrary to |
| 10396 |
\prm {pagefillstretch} this is the really contributed amount, not the upcoming. |
| 10397 |
|
| 10398 |
\stopnewprimitive |
| 10399 |
|
| 10400 |
\startnewprimitive[title={\prm {pagelastfilstretch}}] |
| 10401 |
|
| 10402 |
The accumulated amount of first order stretch on the current page. Contrary to |
| 10403 |
\prm {pagefilstretch} this is the really contributed amount, not the upcoming. |
| 10404 |
|
| 10405 |
\stopnewprimitive |
| 10406 |
|
| 10407 |
\startnewprimitive[title={\prm {pagelastfistretch}}] |
| 10408 |
|
| 10409 |
The accumulated amount of zero order stretch on the current page. Contrary to |
| 10410 |
\prm {pagefistretch} this is the really contributed amount, not the upcoming. |
| 10411 |
|
| 10412 |
\stopnewprimitive |
| 10413 |
|
| 10414 |
\startnewprimitive[title={\prm {pagelastheight}}] |
| 10415 |
|
| 10416 |
The accumulated height of the current page. |
| 10417 |
|
| 10418 |
\stopnewprimitive |
| 10419 |
|
| 10420 |
\startnewprimitive[title={\prm {pagelastshrink}}] |
| 10421 |
|
| 10422 |
The accumulated amount of shrink on the current page. Contrary to \prm |
| 10423 |
{pageshrink} this is the really contributed amount, not the upcoming. |
| 10424 |
|
| 10425 |
\stopnewprimitive |
| 10426 |
|
| 10427 |
\startnewprimitive[title={\prm {pagelaststretch}}] |
| 10428 |
|
| 10429 |
The accumulated amount of stretch on the current page. Contrary to \prm |
| 10430 |
{pagestretch} this is the really contributed amount, not the upcoming. |
| 10431 |
|
| 10432 |
\stopnewprimitive |
| 10433 |
|
| 10434 |
\startoldprimitive[title={\prm {pageshrink}}] |
| 10435 |
|
| 10436 |
The accumulated amount of shrink on the current page. |
| 10437 |
|
| 10438 |
\stopoldprimitive |
| 10439 |
|
| 10440 |
\startoldprimitive[title={\prm {pagestretch}}] |
| 10441 |
|
| 10442 |
The accumulated amount of stretch on the current page. |
| 10443 |
|
| 10444 |
\stopoldprimitive |
| 10445 |
|
| 10446 |
\startoldprimitive[title={\prm {pagetotal}}] |
| 10447 |
|
| 10448 |
The accumulated page total (height) of the current page. |
| 10449 |
|
| 10450 |
\stopoldprimitive |
| 10451 |
|
| 10452 |
\startnewprimitive[title={\prm {pagevsize}}] |
| 10453 |
|
| 10454 |
This parameter, when set, is used as the target page height. This lessens the |
| 10455 |
change of \prm {vsize} interfering. |
| 10456 |
|
| 10457 |
\stopnewprimitive |
| 10458 |
|
| 10459 |
\startoldprimitive[title={\prm {par}}] |
| 10460 |
|
| 10461 |
This is the explicit \quote {finish paragraph} command. Internally we distinguish |
| 10462 |
a par triggered by a new line, as side effect of another primitive or this \prm |
| 10463 |
{par} command. |
| 10464 |
|
| 10465 |
\stopoldprimitive |
| 10466 |
|
| 10467 |
\startnewprimitive[title={\prm {parametercount}}] |
| 10468 |
|
| 10469 |
The number of parameters passed to the current macro. |
| 10470 |
|
| 10471 |
\stopnewprimitive |
| 10472 |
|
| 10473 |
\startnewprimitive[title={\prm {parameterdef}}] |
| 10474 |
|
| 10475 |
Here is an example of binding a variable to a parameter. The alternative is of |
| 10476 |
course to use an \prm {edef}. |
| 10477 |
|
| 10478 |
\startbuffer |
| 10479 |
\def\foo#1#2% |
| 10480 |
{\parameterdef\MyIndexOne\plusone % 1 |
| 10481 |
\parameterdef\MyIndexTwo\plustwo % 2 |
| 10482 |
\oof{P}\oof{Q}\oof{R}\norelax} |
| 10483 |
|
| 10484 |
\def\oof#1% |
| 10485 |
{<1:\MyIndexOne><1:\MyIndexOne>% |
| 10486 |
#1% |
| 10487 |
<2:\MyIndexTwo><2:\MyIndexTwo>} |
| 10488 |
|
| 10489 |
\foo{A}{B} |
| 10490 |
\stopbuffer |
| 10491 |
|
| 10492 |
\typebuffer |
| 10493 |
|
| 10494 |
The outcome is: |
| 10495 |
|
| 10496 |
\getbuffer |
| 10497 |
|
| 10498 |
\stopnewprimitive |
| 10499 |
|
| 10500 |
\startnewprimitive[title={\prm {parameterindex}}] |
| 10501 |
|
| 10502 |
This gives the zero based position on the parameter stack. One reason for |
| 10503 |
introducing \prm {parameterdef} is that the position remains abstract so there we |
| 10504 |
don't need to use \prm {parameterindex}. |
| 10505 |
|
| 10506 |
\stopnewprimitive |
| 10507 |
|
| 10508 |
\startnewprimitive[title={\prm {parametermark}}] |
| 10509 |
|
| 10510 |
The meaning of primitive \prm {parametermark} is equivalent to \type {#} in a |
| 10511 |
macro definition, just like \prm {alignmark} is in an alignment. It can be used |
| 10512 |
to circumvent catcode issues. The normal \quotation {duplicate them when nesting} |
| 10513 |
rules apply. |
| 10514 |
|
| 10515 |
\startbuffer |
| 10516 |
\def\foo\parametermark1% |
| 10517 |
{\def\oof\parametermark\parametermark1% |
| 10518 |
{[\parametermark1:\parametermark\parametermark1]}} |
| 10519 |
\stopbuffer |
| 10520 |
|
| 10521 |
\typebuffer \getbuffer |
| 10522 |
|
| 10523 |
Here \type {\foo{X}\oof{Y}} gives: \foo{X}\oof{Y}. |
| 10524 |
|
| 10525 |
\stopnewprimitive |
| 10526 |
|
| 10527 |
\startnewprimitive[title={\prm {parametermode}}] |
| 10528 |
|
| 10529 |
Setting this internal integer to a positive value (best use~1 because future |
| 10530 |
versions might use bit set) will enable the usage of \type {#} for escaped in the |
| 10531 |
main text and body of macros. |
| 10532 |
|
| 10533 |
\stopnewprimitive |
| 10534 |
|
| 10535 |
\startnewprimitive[title={\prm {parattribute}}] |
| 10536 |
|
| 10537 |
This primitive takes an attribute index and value and sets that attribute on the |
| 10538 |
current paragraph. |
| 10539 |
|
| 10540 |
\stopnewprimitive |
| 10541 |
|
| 10542 |
\startnewprimitive[title={\prm {pardirection}}] |
| 10543 |
|
| 10544 |
This set the text direction for the whole paragraph which in the case of \type |
| 10545 |
{r2l} (1) makes the right edge the starting point. |
| 10546 |
|
| 10547 |
\stopnewprimitive |
| 10548 |
|
| 10549 |
\startnewprimitive[title={\prm {parfillleftskip}}] |
| 10550 |
|
| 10551 |
The glue inserted at the start of the last line. |
| 10552 |
|
| 10553 |
\stopnewprimitive |
| 10554 |
|
| 10555 |
\startnewprimitive[title={\prm {parfillrightskip}}] |
| 10556 |
|
| 10557 |
The glue inserted at the end of the last line (aka \prm {parfillskip}). |
| 10558 |
|
| 10559 |
\stopnewprimitive |
| 10560 |
|
| 10561 |
\startoldprimitive[title={\prm {parfillskip}}] |
| 10562 |
|
| 10563 |
The glue inserted at the end of the last line. |
| 10564 |
|
| 10565 |
\stopoldprimitive |
| 10566 |
|
| 10567 |
\startoldprimitive[title={\prm {parindent}}] |
| 10568 |
|
| 10569 |
The amount of space inserted at the start of the first line. When bit \tobit |
| 10570 |
\parindentskipnormalizecode\ is set in \prm {normalizelinemode} a glue is |
| 10571 |
inserted, otherwise an empty \prm {hbox} with the given width is inserted. |
| 10572 |
|
| 10573 |
\stopoldprimitive |
| 10574 |
|
| 10575 |
\startnewprimitive[title={\prm {parinitleftskip}}] |
| 10576 |
|
| 10577 |
The glue inserted at the start of the first line. |
| 10578 |
|
| 10579 |
\stopnewprimitive |
| 10580 |
|
| 10581 |
\startnewprimitive[title={\prm {parinitrightskip}}] |
| 10582 |
|
| 10583 |
The glue inserted at the end of the first line. |
| 10584 |
|
| 10585 |
\stopnewprimitive |
| 10586 |
|
| 10587 |
\startnewprimitive[title={\prm {paroptions}}] |
| 10588 |
|
| 10589 |
This adds options to already set options in a paragraph. It is used for |
| 10590 |
experiments so for now just forget about it. |
| 10591 |
|
| 10592 |
\stopnewprimitive |
| 10593 |
|
| 10594 |
\startnewprimitive[title={\prm {parpasses}}] |
| 10595 |
|
| 10596 |
Specifies one or more recipes for additional second linebreak passes. Examples |
| 10597 |
can be found in the \CONTEXT\ distribution. |
| 10598 |
|
| 10599 |
\stopnewprimitive |
| 10600 |
|
| 10601 |
\startnewprimitive[title={\prm {parpassesexception}}] |
| 10602 |
|
| 10603 |
Specifies al alternative parpass to use in the upcoming paragraph, for instance |
| 10604 |
one with a specific looseness that then demands for instance more emergency |
| 10605 |
stretch. |
| 10606 |
|
| 10607 |
\stopnewprimitive |
| 10608 |
|
| 10609 |
\startoldprimitive[title={\prm {parshape}}] |
| 10610 |
|
| 10611 |
Stores a shape specification. The first argument is the length of the list, |
| 10612 |
followed by that amount of indentation|-|width pairs (two dimensions). |
| 10613 |
|
| 10614 |
\stopoldprimitive |
| 10615 |
|
| 10616 |
\startoldprimitive[title={\prm {parshapedimen}}] |
| 10617 |
|
| 10618 |
This oddly named (\ETEX) primitive returns the width component (dimension) of the |
| 10619 |
given entry (an integer). Obsoleted by \prm {parshapewidth}. |
| 10620 |
|
| 10621 |
\stopoldprimitive |
| 10622 |
|
| 10623 |
\startoldprimitive[title={\prm {parshapeindent}}] |
| 10624 |
|
| 10625 |
Returns the indentation component (dimension) of the given entry (an integer). |
| 10626 |
|
| 10627 |
\stopoldprimitive |
| 10628 |
|
| 10629 |
\startoldprimitive[title={\prm {parshapelength}}] |
| 10630 |
|
| 10631 |
Returns the number of entries (an integer). |
| 10632 |
|
| 10633 |
\stopoldprimitive |
| 10634 |
|
| 10635 |
\startnewprimitive[title={\prm {parshapewidth}}] |
| 10636 |
|
| 10637 |
Returns the width component (dimension) of the given entry (an integer). |
| 10638 |
|
| 10639 |
\stopnewprimitive |
| 10640 |
|
| 10641 |
\startoldprimitive[title={\prm {parskip}}] |
| 10642 |
|
| 10643 |
This is the amount of glue inserted before a new paragraph starts. |
| 10644 |
|
| 10645 |
\stopoldprimitive |
| 10646 |
|
| 10647 |
\startoldprimitive[title={\prm {patterns}}] |
| 10648 |
|
| 10649 |
The argument to this primitive contains hyphenation patterns that are bound to |
| 10650 |
the current language. In \LUATEX\ and \LUAMETATEX\ we can also manage this at the |
| 10651 |
\LUA\ end. In \LUAMETATEX\ we don't store patterns in te format file |
| 10652 |
|
| 10653 |
\stopoldprimitive |
| 10654 |
|
| 10655 |
\startoldprimitive[title={\prm {pausing}}][obsolete=yes] |
| 10656 |
|
| 10657 |
In \LUAMETATEX\ this variable is ignored but in other engines it can be used to |
| 10658 |
single step thought the input file by setting it to a positive value. |
| 10659 |
|
| 10660 |
\stopoldprimitive |
| 10661 |
|
| 10662 |
\startoldprimitive[title={\prm {penalty}}] |
| 10663 |
|
| 10664 |
The given penalty (a number) is inserted at the current spot in the horizontal or |
| 10665 |
vertical list. We also have \prm {vpenalty} and \prm {hpenalty} that first change |
| 10666 |
modes. |
| 10667 |
|
| 10668 |
\stopoldprimitive |
| 10669 |
|
| 10670 |
\startnewprimitive[title={\prm {permanent}}] |
| 10671 |
|
| 10672 |
This is one of the prefixes that is part of the overload protection mechanism. It |
| 10673 |
is normally used to flag a macro as being at the same level as a primitive: don't |
| 10674 |
touch it. primitives are flagged as such but that property cannot be set on |
| 10675 |
regular macros. The similar \prm {immutable} flag is normally used for variables. |
| 10676 |
|
| 10677 |
\stopnewprimitive |
| 10678 |
|
| 10679 |
\startnewprimitive[title={\prm {pettymuskip}}] |
| 10680 |
|
| 10681 |
A predefined mu skip register that can be used in math (inter atom) spacing. The |
| 10682 |
current value is {\tt \the\pettymuskip}. This one complements \prm {thinmuskip}, |
| 10683 |
\prm {medmuskip}, \prm {thickmuskip} and the new \prm {tinymuskip}. |
| 10684 |
|
| 10685 |
\stopnewprimitive |
| 10686 |
|
| 10687 |
\startnewprimitive[title={\prm {positdef}}] |
| 10688 |
|
| 10689 |
The engine uses 32 bit integers for various purposes and has no (real) concept of |
| 10690 |
a floating point quantity. We get around this by providing a floating point data |
| 10691 |
type based on 32 bit unums (posits). These have the advantage over native floats |
| 10692 |
of more precision in the lower ranges but at the cost of a software |
| 10693 |
implementation. |
| 10694 |
|
| 10695 |
The \prm {positdef} primitive is the floating point variant of \prm {integerdef} |
| 10696 |
and \prm {dimensiondef}: an efficient way to implement named quantities other |
| 10697 |
than registers. |
| 10698 |
|
| 10699 |
\startbuffer |
| 10700 |
\positdef \MyFloatA 5.678 |
| 10701 |
\positdef \MyFloatB 567.8 |
| 10702 |
[\the\MyFloatA] [\todimension\MyFloatA] [\tointeger\MyFloatA] |
| 10703 |
[\the\MyFloatB] [\todimension\MyFloatB] [\tointeger\MyFloatB] |
| 10704 |
\stopbuffer |
| 10705 |
|
| 10706 |
\typebuffer |
| 10707 |
|
| 10708 |
For practical reasons we can map posit (or float) onto an integer or dimension: |
| 10709 |
|
| 10710 |
\startlines |
| 10711 |
\getbuffer |
| 10712 |
\stoplines |
| 10713 |
|
| 10714 |
% {\em I might eventually decide to go for 32 bit floats but it all depends on how |
| 10715 |
% unums evolve cq. become native to \CCODE.} |
| 10716 |
|
| 10717 |
\stopnewprimitive |
| 10718 |
|
| 10719 |
\startoldprimitive[title={\prm {postdisplaypenalty}}] |
| 10720 |
|
| 10721 |
This is the penalty injected after a display formula. |
| 10722 |
|
| 10723 |
\stopoldprimitive |
| 10724 |
|
| 10725 |
\startnewprimitive[title={\prm {postexhyphenchar}}] |
| 10726 |
|
| 10727 |
This primitive expects a language number and a character code. A negative |
| 10728 |
character code is equivalent to ignore. In case of an explicit discretionary the |
| 10729 |
character is injected at the beginning of a new line. |
| 10730 |
|
| 10731 |
\stopnewprimitive |
| 10732 |
|
| 10733 |
\startnewprimitive[title={\prm {posthyphenchar}}] |
| 10734 |
|
| 10735 |
This primitive expects a language number and a character code. A negative |
| 10736 |
character code is equivalent to ignore. In case of an automatic discretionary the |
| 10737 |
character is injected at the beginning of a new line. |
| 10738 |
|
| 10739 |
\stopnewprimitive |
| 10740 |
|
| 10741 |
\startnewprimitive[title={\prm {postinlinepenalty}}] |
| 10742 |
|
| 10743 |
When set this penalty is inserted after an inline formula unless we have a short |
| 10744 |
formula and \prm {postshortinlinepenalty} is set. |
| 10745 |
|
| 10746 |
\stopnewprimitive |
| 10747 |
|
| 10748 |
\startnewprimitive[title={\prm {postshortinlinepenalty}}] |
| 10749 |
|
| 10750 |
When set this penalty is inserted after a short inline formula. The criterium is |
| 10751 |
set by \prm {shortinlinemaththreshold} but only applied when it is enabled for |
| 10752 |
the class involved. |
| 10753 |
|
| 10754 |
\stopnewprimitive |
| 10755 |
|
| 10756 |
\startnewprimitive[title={\prm {prebinoppenalty}}] |
| 10757 |
|
| 10758 |
This internal quantity is a compatibility feature because normally we will use |
| 10759 |
the inter atom spacing variables. |
| 10760 |
|
| 10761 |
\stopnewprimitive |
| 10762 |
|
| 10763 |
\startoldprimitive[title={\prm {predisplaydirection}}] |
| 10764 |
|
| 10765 |
This is the direction that the math sub engine will take into account when |
| 10766 |
dealing with right to left typesetting. |
| 10767 |
|
| 10768 |
\stopoldprimitive |
| 10769 |
|
| 10770 |
\startnewprimitive[title={\prm {predisplaygapfactor}}] |
| 10771 |
|
| 10772 |
The heuristics related to determine if the previous line in a formula overlaps |
| 10773 |
with a (display) formula are hard coded but in \LUATEX\ to be two times the quad |
| 10774 |
of the current font. This parameter is a multiplier set to 2000 and permits you |
| 10775 |
to change the overshoot in this heuristic. |
| 10776 |
|
| 10777 |
\stopnewprimitive |
| 10778 |
|
| 10779 |
\startoldprimitive[title={\prm {predisplaypenalty}}] |
| 10780 |
|
| 10781 |
This is the penalty injected before a display formula. |
| 10782 |
|
| 10783 |
\stopoldprimitive |
| 10784 |
|
| 10785 |
\startoldprimitive[title={\prm {predisplaysize}}] |
| 10786 |
|
| 10787 |
This parameter holds the length of the last line in a paragraph when a display |
| 10788 |
formula is part of it. |
| 10789 |
|
| 10790 |
\stopoldprimitive |
| 10791 |
|
| 10792 |
\startnewprimitive[title={\prm {preexhyphenchar}}] |
| 10793 |
|
| 10794 |
This primitive expects a language number and a character code. A negative |
| 10795 |
character code is equivalent to ignore. In case of an explicit discretionary the |
| 10796 |
character is injected at the end of the line. |
| 10797 |
|
| 10798 |
\stopnewprimitive |
| 10799 |
|
| 10800 |
\startnewprimitive[title={\prm {prehyphenchar}}] |
| 10801 |
|
| 10802 |
This primitive expects a language number and a character code. A negative |
| 10803 |
character code is equivalent to ignore. In case of an automatic discretionary the |
| 10804 |
character is injected at the end of the line. |
| 10805 |
|
| 10806 |
\stopnewprimitive |
| 10807 |
|
| 10808 |
\startnewprimitive[title={\prm {preinlinepenalty}}] |
| 10809 |
|
| 10810 |
When set this penalty is inserted before an inline formula unless we have a short |
| 10811 |
formula and \prm {preshortinlinepenalty} is set. These are not real penalties but |
| 10812 |
properties of the math begin and end markers. Just as with spacing as such |
| 10813 |
property, these penalties are not visible as nodes in the list. |
| 10814 |
|
| 10815 |
\stopnewprimitive |
| 10816 |
|
| 10817 |
\startnewprimitive[title={\prm {prerelpenalty}}] |
| 10818 |
|
| 10819 |
This internal quantity is a compatibility feature because normally we will use |
| 10820 |
the inter atom spacing variables. |
| 10821 |
|
| 10822 |
\stopnewprimitive |
| 10823 |
|
| 10824 |
\startnewprimitive[title={\prm {preshortinlinepenalty}}] |
| 10825 |
|
| 10826 |
When set this penalty is inserted before a short inline formula. The criterium is |
| 10827 |
set by \prm {shortinlinemaththreshold} but only applied when it is enabled for |
| 10828 |
the class involved. |
| 10829 |
|
| 10830 |
\stopnewprimitive |
| 10831 |
|
| 10832 |
\startoldprimitive[title={\prm {pretolerance}}] |
| 10833 |
|
| 10834 |
When the badness of a line in a paragraph exceeds this value a second linebreak |
| 10835 |
pass will be enabled. |
| 10836 |
|
| 10837 |
\stopoldprimitive |
| 10838 |
|
| 10839 |
\startoldprimitive[title={\prm {prevdepth}}] |
| 10840 |
|
| 10841 |
The depth of current list. It can also be set to special (signal) values in order |
| 10842 |
to inhibit line corrections. It is not an internal dimension but a (current) list |
| 10843 |
property. |
| 10844 |
|
| 10845 |
\stopoldprimitive |
| 10846 |
|
| 10847 |
\startoldprimitive[title={\prm {prevgraf}}] |
| 10848 |
|
| 10849 |
The number of lines in a previous paragraph. |
| 10850 |
|
| 10851 |
\stopoldprimitive |
| 10852 |
|
| 10853 |
\startnewprimitive[title={\prm {previousloopiterator}}] |
| 10854 |
|
| 10855 |
\startbuffer |
| 10856 |
\edef\testA{ |
| 10857 |
\expandedrepeat 2 {% |
| 10858 |
\expandedrepeat 3 {% |
| 10859 |
(\the\previousloopiterator1:\the\currentloopiterator) |
| 10860 |
}% |
| 10861 |
}% |
| 10862 |
} |
| 10863 |
\edef\testB{ |
| 10864 |
\expandedrepeat 2 {% |
| 10865 |
\expandedrepeat 3 {% |
| 10866 |
(#P:#I) % #G is two levels up |
| 10867 |
}% |
| 10868 |
}% |
| 10869 |
} |
| 10870 |
\stopbuffer |
| 10871 |
|
| 10872 |
\typebuffer \getbuffer |
| 10873 |
|
| 10874 |
These give the same result: |
| 10875 |
|
| 10876 |
\startlines \tt |
| 10877 |
\meaningasis\testA |
| 10878 |
\meaningasis\testB |
| 10879 |
\stoplines |
| 10880 |
|
| 10881 |
The number indicates the number of levels we go up the loop chain. |
| 10882 |
|
| 10883 |
\stopnewprimitive |
| 10884 |
|
| 10885 |
\startnewprimitive[title={\prm {primescript}}] |
| 10886 |
|
| 10887 |
This is a math script primitive dedicated to primes (which are somewhat |
| 10888 |
troublesome on math). It complements the six script primitives (like \prm |
| 10889 |
{subscript} and \prm {presuperscript}). |
| 10890 |
|
| 10891 |
\stopnewprimitive |
| 10892 |
|
| 10893 |
\startoldprimitive[title={\prm {protected}}] |
| 10894 |
|
| 10895 |
A protected macro is one that doesn't get expanded unless it is time to do so. |
| 10896 |
For instance, inside an \prm {edef} it just stays what it is. It often makes |
| 10897 |
sense to pass macros as|-|is to (multi|-|pass) file (for tables of contents). |
| 10898 |
|
| 10899 |
In \CONTEXT\ we use either \prm {protected} or \prm {unexpanded} because the |
| 10900 |
later was the command we used to achieve the same results before \ETEX\ |
| 10901 |
introduced this protection primitive. Originally the \prm {protected} macro was |
| 10902 |
also defined but it has been dropped. |
| 10903 |
|
| 10904 |
\stopoldprimitive |
| 10905 |
|
| 10906 |
\startnewprimitive[title={\prm {protecteddetokenize}}] |
| 10907 |
|
| 10908 |
This is a variant of \prm {protecteddetokenize} that uses some escapes encoded as |
| 10909 |
body parameters, like \type {#H} for a hash. |
| 10910 |
|
| 10911 |
\stopnewprimitive |
| 10912 |
|
| 10913 |
\startnewprimitive[title={\prm {protectedexpandeddetokenize}}] |
| 10914 |
|
| 10915 |
This is a variant of \prm {expandeddetokenize} that uses some escapes encoded as |
| 10916 |
body parameters, like \type {#H} for a hash. |
| 10917 |
|
| 10918 |
\stopnewprimitive |
| 10919 |
|
| 10920 |
\startnewprimitive[title={\prm {protrudechars}}] |
| 10921 |
|
| 10922 |
This variable controls protrusion (into the margin). A value~2 is comparable with |
| 10923 |
other engines, while a value of~3 does a bit more checking when we're doing |
| 10924 |
right|-|to|-|left typesetting. |
| 10925 |
|
| 10926 |
\stopnewprimitive |
| 10927 |
|
| 10928 |
\startnewprimitive[title={\prm {protrusionboundary}}] |
| 10929 |
|
| 10930 |
This injects a boundary with the given value: |
| 10931 |
|
| 10932 |
\getbuffer[engine:syntax:protrusionboundarycodes] |
| 10933 |
|
| 10934 |
This signal makes the protrusion checker skip over a node. |
| 10935 |
|
| 10936 |
\stopnewprimitive |
| 10937 |
|
| 10938 |
\startnewprimitive[title={\prm {pxdimen}}] |
| 10939 |
|
| 10940 |
The current numeric value of this dimension is \tointeger \pxdimen, \todimension |
| 10941 |
\pxdimen: one \type {bp}. We kept it around because it was introduced in \PDFTEX\ |
| 10942 |
and made it into \LUATEX, where it relates to the resolution of included images. |
| 10943 |
In \CONTEXT\ it is not used. |
| 10944 |
|
| 10945 |
\stopnewprimitive |
| 10946 |
|
| 10947 |
\startnewprimitive[title={\prm {quitloop}}] |
| 10948 |
|
| 10949 |
There are several loop primitives and they can be quit with \prm {quitloop} at |
| 10950 |
the next the {\em next} iteration. An immediate quit is possible with \prm |
| 10951 |
{quitloopnow}. An example is given with \prm {localcontrolledloop}. |
| 10952 |
|
| 10953 |
\stopnewprimitive |
| 10954 |
|
| 10955 |
\startnewprimitive[title={\prm {quitloopnow}}] |
| 10956 |
|
| 10957 |
There are several loop primitives and they can be quit with \prm {quitloopnow} |
| 10958 |
at the spot. |
| 10959 |
|
| 10960 |
\stopnewprimitive |
| 10961 |
|
| 10962 |
\startnewprimitive[title={\prm {quitvmode}}] |
| 10963 |
|
| 10964 |
This primitive forces horizontal mode but has no side effects when we're already |
| 10965 |
in that mode. |
| 10966 |
|
| 10967 |
\stopnewprimitive |
| 10968 |
|
| 10969 |
\startoldprimitive[title={\prm {radical}}][obsolete=yes] |
| 10970 |
|
| 10971 |
This old school radical constructor is replaced by \prm {Uradical}. It takes a |
| 10972 |
number where the first byte is the small family, the next two index of this |
| 10973 |
symbol from that family, and the next three the family and index of the first |
| 10974 |
larger variant. |
| 10975 |
|
| 10976 |
\stopoldprimitive |
| 10977 |
|
| 10978 |
\startoldprimitive[title={\prm {raise}}] |
| 10979 |
|
| 10980 |
This primitive takes two arguments, a dimension and a box. The box is moved up. |
| 10981 |
The operation only succeeds in horizontal mode. |
| 10982 |
|
| 10983 |
\stopoldprimitive |
| 10984 |
|
| 10985 |
\startnewprimitive[title={\prm {rdivide}}] |
| 10986 |
|
| 10987 |
This is variant of \prm {divide} that rounds the result. For integers the result |
| 10988 |
is the same as \prm {edivide}. |
| 10989 |
|
| 10990 |
\startbuffer |
| 10991 |
\the\dimexpr .4999pt : 2 \relax =.24994pt |
| 10992 |
\the\dimexpr .4999pt / 2 \relax =.24995pt |
| 10993 |
\the\dimexpr .4999pt ; 2 \relax =.00002pt |
| 10994 |
\scratchdimen.4999pt \divide \scratchdimen 2 \the\scratchdimen =.24994pt |
| 10995 |
\scratchdimen.4999pt \edivide\scratchdimen 2 \the\scratchdimen =.24995pt |
| 10996 |
\scratchdimen 4999pt \rdivide\scratchdimen 2 \the\scratchdimen =2500.0pt |
| 10997 |
\scratchdimen 5000pt \rdivide\scratchdimen 2 \the\scratchdimen =2500.0pt |
| 10998 |
|
| 10999 |
\the\numexpr 1001 : 2 \relax =500 |
| 11000 |
\the\numexpr 1001 / 2 \relax =501 |
| 11001 |
\the\numexpr 1001 ; 2 \relax =1 |
| 11002 |
\scratchcounter1001 \divide \scratchcounter 2 \the\scratchcounter=500 |
| 11003 |
\scratchcounter1001 \edivide\scratchcounter 2 \the\scratchcounter=501 |
| 11004 |
\scratchcounter1001 \rdivide\scratchcounter 2 \the\scratchcounter=501 |
| 11005 |
\stopbuffer |
| 11006 |
|
| 11007 |
\typebuffer |
| 11008 |
|
| 11009 |
\startlines |
| 11010 |
\getbuffer |
| 11011 |
\stoplines |
| 11012 |
|
| 11013 |
The integer division \type{:} and modulo \type {;} are an addition to the \ETEX\ |
| 11014 |
compatible expressions. |
| 11015 |
|
| 11016 |
\stopnewprimitive |
| 11017 |
|
| 11018 |
\startnewprimitive[title={\prm {rdivideby}}] |
| 11019 |
|
| 11020 |
This is the \type {by}|-|less companion to \prm {rdivide}. |
| 11021 |
|
| 11022 |
\stopnewprimitive |
| 11023 |
|
| 11024 |
\startnewprimitive[title={\prm {realign}}] |
| 11025 |
|
| 11026 |
Where \prm {omit} suspends a preamble template, this one overloads is for the |
| 11027 |
current table cell. It expects two token lists as arguments. |
| 11028 |
|
| 11029 |
\stopnewprimitive |
| 11030 |
|
| 11031 |
\startoldprimitive[title={\prm {relax}}] |
| 11032 |
|
| 11033 |
This primitive does nothing and is often used to end a verbose number or |
| 11034 |
dimension in a comparison, for example: |
| 11035 |
|
| 11036 |
\starttyping |
| 11037 |
\ifnum \scratchcounter = 123\relax |
| 11038 |
\stoptyping |
| 11039 |
|
| 11040 |
which prevents a lookahead. A variant would be: |
| 11041 |
|
| 11042 |
\starttyping |
| 11043 |
\ifnum \scratchcounter = 123 % |
| 11044 |
\stoptyping |
| 11045 |
|
| 11046 |
assuming that spaces are not ignored. Another application is finishing |
| 11047 |
an expression like \prm {numexpr} or \prm {dimexpr}. I is also used |
| 11048 |
to prevent lookahead in cases like: |
| 11049 |
|
| 11050 |
\starttyping |
| 11051 |
\vrule height 3pt depth 2pt width 5pt\relax |
| 11052 |
\hskip 5pt plus 3pt minus 2pt\relax |
| 11053 |
\stoptyping |
| 11054 |
|
| 11055 |
Because \prm {relax} is not expandable the following: |
| 11056 |
|
| 11057 |
\startbuffer |
| 11058 |
\edef\foo{\relax} \meaningfull\foo |
| 11059 |
\edef\oof{\norelax} \meaningfull\oof |
| 11060 |
\stopbuffer |
| 11061 |
|
| 11062 |
\typebuffer |
| 11063 |
|
| 11064 |
gives this: |
| 11065 |
|
| 11066 |
\startlines |
| 11067 |
\getbuffer |
| 11068 |
\stoplines |
| 11069 |
|
| 11070 |
A \prm {norelax} disappears here but in the previously mentioned scenarios |
| 11071 |
it has the same function as \prm {relax}. It will not be pushed back either |
| 11072 |
in cases where a lookahead demands that. |
| 11073 |
|
| 11074 |
\stopoldprimitive |
| 11075 |
|
| 11076 |
\startoldprimitive[title={\prm {relpenalty}}] |
| 11077 |
|
| 11078 |
This internal quantity is a compatibility feature because normally we will use |
| 11079 |
the inter atom spacing variables. |
| 11080 |
|
| 11081 |
\stopoldprimitive |
| 11082 |
|
| 11083 |
\startnewprimitive[title={\prm {resetlocalboxes}}] |
| 11084 |
|
| 11085 |
Its purpose should be clear from the name. |
| 11086 |
|
| 11087 |
\stopnewprimitive |
| 11088 |
|
| 11089 |
\startnewprimitive[title={\prm {resetmathspacing}}] |
| 11090 |
|
| 11091 |
This initializes all parameters to their initial values. |
| 11092 |
|
| 11093 |
\stopnewprimitive |
| 11094 |
|
| 11095 |
\startnewprimitive[title={\prm {restorecatcodetable}}] |
| 11096 |
|
| 11097 |
This is an experimental feature that should be used with care. The next example |
| 11098 |
shows usage. It was added when debugging and exploring a side effect. |
| 11099 |
|
| 11100 |
\starttyping |
| 11101 |
\tracingonline1 |
| 11102 |
|
| 11103 |
\bgroup |
| 11104 |
|
| 11105 |
\catcode`6 = 11 \catcode`7 = 11 |
| 11106 |
|
| 11107 |
\bgroup |
| 11108 |
|
| 11109 |
\tracingonline1 |
| 11110 |
|
| 11111 |
current: \the\catcodetable |
| 11112 |
|
| 11113 |
original: \the\catcode`6\quad \the\catcode`7 |
| 11114 |
|
| 11115 |
\catcode`6 = 11 \catcode`7 = 11 |
| 11116 |
|
| 11117 |
\showcodestack\catcode |
| 11118 |
|
| 11119 |
assigned: \the\catcode`6\quad \the\catcode`7 |
| 11120 |
|
| 11121 |
\showcodestack\catcode |
| 11122 |
|
| 11123 |
\catcodetable\ctxcatcodes switched: \the\catcodetable |
| 11124 |
|
| 11125 |
stored: \the\catcode`6\quad \the\catcode`7 |
| 11126 |
|
| 11127 |
\showcodestack\catcode |
| 11128 |
|
| 11129 |
\restorecatcodetable\ctxcatcodes |
| 11130 |
|
| 11131 |
\showcodestack\catcode |
| 11132 |
|
| 11133 |
restored: \the\catcode`6\quad \the\catcode`7 |
| 11134 |
|
| 11135 |
\showcodestack\catcode |
| 11136 |
|
| 11137 |
\egroup |
| 11138 |
|
| 11139 |
\catcodetable\ctxcatcodes |
| 11140 |
|
| 11141 |
inner: \the\catcode`6\quad\the\catcode`7 |
| 11142 |
|
| 11143 |
\egroup |
| 11144 |
|
| 11145 |
outer: \the\catcode`6\quad\the\catcode`7 |
| 11146 |
\stoptyping |
| 11147 |
|
| 11148 |
In \CONTEXT\ this typesets: |
| 11149 |
|
| 11150 |
\starttyping |
| 11151 |
current: 9 |
| 11152 |
original: 11 11 |
| 11153 |
assigned: 11 11 |
| 11154 |
switched: 9 |
| 11155 |
stored: 11 11 |
| 11156 |
restored: 12 12 |
| 11157 |
inner: 11 11 |
| 11158 |
outer; 12 12 |
| 11159 |
\stoptyping |
| 11160 |
|
| 11161 |
and on the console we see: |
| 11162 |
|
| 11163 |
\starttyping |
| 11164 |
3:3: [codestack 1, size 3] |
| 11165 |
3:3: [1: level 2, code 54, value 12] |
| 11166 |
3:3: [2: level 2, code 55, value 12] |
| 11167 |
3:3: [3: level 3, code 54, value 11] |
| 11168 |
3:3: [4: level 3, code 55, value 11] |
| 11169 |
3:3: [codestack 1 bottom] |
| 11170 |
3:3: [codestack 1, size 3] |
| 11171 |
3:3: [1: level 2, code 54, value 12] |
| 11172 |
3:3: [2: level 2, code 55, value 12] |
| 11173 |
3:3: [3: level 3, code 54, value 11] |
| 11174 |
3:3: [4: level 3, code 55, value 11] |
| 11175 |
3:3: [codestack 1 bottom] |
| 11176 |
3:3: [codestack 1, size 3] |
| 11177 |
3:3: [1: level 2, code 54, value 12] |
| 11178 |
3:3: [2: level 2, code 55, value 12] |
| 11179 |
3:3: [3: level 3, code 54, value 11] |
| 11180 |
3:3: [4: level 3, code 55, value 11] |
| 11181 |
3:3: [codestack 1 bottom] |
| 11182 |
3:3: [codestack 1, size 7] |
| 11183 |
3:3: [1: level 2, code 54, value 12] |
| 11184 |
3:3: [2: level 2, code 55, value 12] |
| 11185 |
3:3: [3: level 3, code 54, value 11] |
| 11186 |
3:3: [4: level 3, code 55, value 11] |
| 11187 |
3:3: [5: level 3, code 55, value 11] |
| 11188 |
3:3: [6: level 3, code 54, value 11] |
| 11189 |
3:3: [7: level 3, code 55, value 11] |
| 11190 |
3:3: [8: level 3, code 54, value 11] |
| 11191 |
3:3: [codestack 1 bottom] |
| 11192 |
3:3: [codestack 1, size 7] |
| 11193 |
3:3: [1: level 2, code 54, value 12] |
| 11194 |
3:3: [2: level 2, code 55, value 12] |
| 11195 |
3:3: [3: level 3, code 54, value 11] |
| 11196 |
3:3: [4: level 3, code 55, value 11] |
| 11197 |
3:3: [5: level 3, code 55, value 11] |
| 11198 |
3:3: [6: level 3, code 54, value 11] |
| 11199 |
3:3: [7: level 3, code 55, value 11] |
| 11200 |
3:3: [8: level 3, code 54, value 11] |
| 11201 |
3:3: [codestack 1 bottom] |
| 11202 |
\stoptyping |
| 11203 |
|
| 11204 |
So basically \prm {restorecatcodetable} brings us (temporarily) back to the |
| 11205 |
global settings. |
| 11206 |
|
| 11207 |
\stopnewprimitive |
| 11208 |
|
| 11209 |
\startnewprimitive[title={\prm {retained}}] |
| 11210 |
|
| 11211 |
When a value is assigned inside a group \TEX\ pushes the current value on the save |
| 11212 |
stack in order to be able to restore the original value after the group has ended. You |
| 11213 |
can reach over a group by using the \prm {global} prefix. A mix between local and |
| 11214 |
global assignments can be achieved with the \prm {retained} primitive. |
| 11215 |
|
| 11216 |
\newdimension\MyDim |
| 11217 |
|
| 11218 |
\startbuffer[one] |
| 11219 |
\MyDim 15pt \bgroup \the\MyDim \space |
| 11220 |
\bgroup |
| 11221 |
\bgroup |
| 11222 |
\bgroup \advance\MyDim10pt \the\MyDim \egroup\space |
| 11223 |
\bgroup \advance\MyDim10pt \the\MyDim \egroup\space |
| 11224 |
\egroup |
| 11225 |
\bgroup |
| 11226 |
\bgroup \advance\MyDim10pt \the\MyDim \egroup\space |
| 11227 |
\bgroup \advance\MyDim10pt \the\MyDim \egroup\space |
| 11228 |
\egroup |
| 11229 |
\egroup |
| 11230 |
\egroup \the\MyDim |
| 11231 |
\stopbuffer |
| 11232 |
|
| 11233 |
\startbuffer[two] |
| 11234 |
\MyDim 15pt \bgroup \the\MyDim \space |
| 11235 |
\bgroup |
| 11236 |
\bgroup |
| 11237 |
\bgroup \global\advance\MyDim10pt \the\MyDim \egroup\space |
| 11238 |
\bgroup \global\advance\MyDim10pt \the\MyDim \egroup\space |
| 11239 |
\egroup |
| 11240 |
\bgroup |
| 11241 |
\bgroup \global\advance\MyDim10pt \the\MyDim \egroup\space |
| 11242 |
\bgroup \global\advance\MyDim10pt \the\MyDim \egroup\space |
| 11243 |
\egroup |
| 11244 |
\egroup |
| 11245 |
\egroup \the\MyDim |
| 11246 |
\stopbuffer |
| 11247 |
|
| 11248 |
\startbuffer[three] |
| 11249 |
\MyDim 15pt \bgroup \the\MyDim \space |
| 11250 |
\constrained\MyDim\zeropoint |
| 11251 |
\bgroup |
| 11252 |
\bgroup \retained\advance\MyDim10pt \the\MyDim \egroup\space |
| 11253 |
\bgroup \retained\advance\MyDim10pt \the\MyDim \egroup\space |
| 11254 |
\egroup |
| 11255 |
\bgroup |
| 11256 |
\bgroup \retained\advance\MyDim10pt \the\MyDim \egroup\space |
| 11257 |
\bgroup \retained\advance\MyDim10pt \the\MyDim \egroup\space |
| 11258 |
\egroup |
| 11259 |
\egroup \the\MyDim |
| 11260 |
\stopbuffer |
| 11261 |
|
| 11262 |
\typebuffer[one,two,three] |
| 11263 |
|
| 11264 |
These lines result in: |
| 11265 |
|
| 11266 |
\startlines |
| 11267 |
\hbox{\getbuffer[one]} |
| 11268 |
\hbox{\getbuffer[two]} |
| 11269 |
\hbox{\getbuffer[three]} |
| 11270 |
\stoplines |
| 11271 |
|
| 11272 |
Because \LUAMETATEX\ avoids redundant stack entries and reassignments this |
| 11273 |
mechanism is a bit fragile but the \prm {constrained} prefix makes sure that we |
| 11274 |
do have a stack entry. If it is needed depends on the usage pattern. |
| 11275 |
|
| 11276 |
\stopnewprimitive |
| 11277 |
|
| 11278 |
\startnewprimitive[title={\prm {retokenized}}] |
| 11279 |
|
| 11280 |
This is a companion of \prm {tokenized} that accepts a catcode table, so the |
| 11281 |
whole repertoire is: |
| 11282 |
|
| 11283 |
\startbuffer |
| 11284 |
\tokenized {test $x$ test: current} |
| 11285 |
\tokenized catcodetable \ctxcatcodes {test $x$ test: context} |
| 11286 |
\tokenized catcodetable \vrbcatcodes {test $x$ test: verbatim} |
| 11287 |
\retokenized \ctxcatcodes {test $x$ test: context} |
| 11288 |
\retokenized \vrbcatcodes {test $x$ test: verbatim} |
| 11289 |
\stopbuffer |
| 11290 |
|
| 11291 |
\typebuffer |
| 11292 |
|
| 11293 |
Here we pass the numbers known to \CONTEXT\ and get: |
| 11294 |
|
| 11295 |
\startlines |
| 11296 |
\getbuffer |
| 11297 |
\stoplines |
| 11298 |
|
| 11299 |
\stopnewprimitive |
| 11300 |
|
| 11301 |
\startoldprimitive[title={\prm {right}}] |
| 11302 |
|
| 11303 |
Inserts the given delimiter as right fence in a math formula. |
| 11304 |
|
| 11305 |
\stopoldprimitive |
| 11306 |
|
| 11307 |
\startoldprimitive[title={\prm {righthyphenmin}}] |
| 11308 |
|
| 11309 |
This is the minimum number of characters before the first hyphen in a hyphenated |
| 11310 |
word. |
| 11311 |
|
| 11312 |
\stopoldprimitive |
| 11313 |
|
| 11314 |
\startnewprimitive[title={\prm {rightmarginkern}}] |
| 11315 |
|
| 11316 |
The dimension returned is the protrusion kern that has been added (if at all) to |
| 11317 |
the left of the content in the given box. |
| 11318 |
|
| 11319 |
\stopnewprimitive |
| 11320 |
|
| 11321 |
\startoldprimitive[title={\prm {rightskip}}] |
| 11322 |
|
| 11323 |
This skip will be inserted at the right of every line. |
| 11324 |
|
| 11325 |
\stopoldprimitive |
| 11326 |
|
| 11327 |
\startnewprimitive[title={\prm {righttwindemerits}}] |
| 11328 |
|
| 11329 |
Additional demerits for a glyph sequence at the right edge when a previous line |
| 11330 |
also has that sequence. |
| 11331 |
|
| 11332 |
\stopnewprimitive |
| 11333 |
|
| 11334 |
\startoldprimitive[title={\prm {romannumeral}}] |
| 11335 |
|
| 11336 |
This converts a number into a sequence of characters representing a roman |
| 11337 |
numeral. Because the Romans had no zero, a zero will give no output, a fact that |
| 11338 |
is sometimes used for hacks and showing off ones macro coding capabilities. A |
| 11339 |
large number will for sure result in a long string because after thousand we |
| 11340 |
start duplicating. |
| 11341 |
|
| 11342 |
\stopoldprimitive |
| 11343 |
|
| 11344 |
\startnewprimitive[title={\prm {rpcode}}] |
| 11345 |
|
| 11346 |
This is the companion of \prm {lpcode} (see there) and also takes three |
| 11347 |
arguments: font, character code and factor. |
| 11348 |
|
| 11349 |
\stopnewprimitive |
| 11350 |
|
| 11351 |
\startnewprimitive[title={\prm {savecatcodetable}}] |
| 11352 |
|
| 11353 |
This primitive stores the currently set catcodes in the current table. |
| 11354 |
|
| 11355 |
\stopnewprimitive |
| 11356 |
|
| 11357 |
\startoldprimitive[title={\prm {savinghyphcodes}}] |
| 11358 |
|
| 11359 |
When set to non|-|zero, this will trigger the setting of \prm {hjcode}s from \prm |
| 11360 |
{lccode}s for the current font. These codes determine what characters are taken |
| 11361 |
into account when hyphenating words. |
| 11362 |
|
| 11363 |
\stopoldprimitive |
| 11364 |
|
| 11365 |
\startoldprimitive[title={\prm {savingvdiscards}}] |
| 11366 |
|
| 11367 |
When set to a positive value the page builder will store the discarded items |
| 11368 |
(like glues) so that they can later be retrieved and pushed back if needed with |
| 11369 |
\prm {pagediscards} or \prm {splitdiscards}. |
| 11370 |
|
| 11371 |
\stopoldprimitive |
| 11372 |
|
| 11373 |
\startnewprimitive[title={\prm {scaledemwidth}}] |
| 11374 |
|
| 11375 |
Returns the current (font specific) emwidth scaled according to \prm {glyphscale} |
| 11376 |
and \prm {glyphxscale}. |
| 11377 |
|
| 11378 |
\stopnewprimitive |
| 11379 |
|
| 11380 |
\startnewprimitive[title={\prm {scaledexheight}}] |
| 11381 |
|
| 11382 |
Returns the current (font specific) exheight scaled according to \prm {glyphscale} |
| 11383 |
and \prm {glyphyscale}. |
| 11384 |
|
| 11385 |
\stopnewprimitive |
| 11386 |
|
| 11387 |
\startnewprimitive[title={\prm {scaledextraspace}}] |
| 11388 |
|
| 11389 |
Returns the current (font specific) extra space value scaled according to \prm |
| 11390 |
{glyphscale} and \prm {glyphxscale}. |
| 11391 |
|
| 11392 |
\stopnewprimitive |
| 11393 |
|
| 11394 |
\startnewprimitive[title={\prm {scaledfontcharba}}] |
| 11395 |
|
| 11396 |
Returns the bottom accent position of the given font|-|character pair scaled |
| 11397 |
according to \prm {glyphscale} and \prm {glyphyscale}. |
| 11398 |
|
| 11399 |
\stopnewprimitive |
| 11400 |
|
| 11401 |
\startnewprimitive[title={\prm {scaledfontchardp}}] |
| 11402 |
|
| 11403 |
Returns the depth of the given font|-|character pair scaled according to \prm |
| 11404 |
{glyphscale} and \prm {glyphyscale}. |
| 11405 |
|
| 11406 |
\stopnewprimitive |
| 11407 |
|
| 11408 |
\startnewprimitive[title={\prm {scaledfontcharht}}] |
| 11409 |
|
| 11410 |
Returns the height of the given font|-|character pair scaled according to \prm |
| 11411 |
{glyphscale} and \prm {glyphyscale}. |
| 11412 |
|
| 11413 |
\stopnewprimitive |
| 11414 |
|
| 11415 |
\startnewprimitive[title={\prm {scaledfontcharic}}] |
| 11416 |
|
| 11417 |
Returns the italic correction of the given font|-|character pair scaled according |
| 11418 |
to \prm {glyphscale} and \prm {glyphxscale}. This property is only real for |
| 11419 |
traditional fonts. |
| 11420 |
|
| 11421 |
\stopnewprimitive |
| 11422 |
|
| 11423 |
\startnewprimitive[title={\prm {scaledfontcharta}}] |
| 11424 |
|
| 11425 |
Returns the top accent position of the given font|-|character pair scaled |
| 11426 |
according to \prm {glyphscale} and \prm {glyphxscale}. |
| 11427 |
|
| 11428 |
\stopnewprimitive |
| 11429 |
|
| 11430 |
\startnewprimitive[title={\prm {scaledfontcharwd}}] |
| 11431 |
|
| 11432 |
Returns width of the given font|-|character pair scaled according to \prm |
| 11433 |
{glyphscale} and \prm {glyphxscale}. |
| 11434 |
|
| 11435 |
\stopnewprimitive |
| 11436 |
|
| 11437 |
\startnewprimitive[title={\prm {scaledfontdimen}}] |
| 11438 |
|
| 11439 |
Returns value of a (numeric) font dimension of the given font|-|character pair |
| 11440 |
scaled according to \prm {glyphscale} and \prm {glyphxscale} and|/|or \prm |
| 11441 |
{glyphyscale}. |
| 11442 |
|
| 11443 |
\stopnewprimitive |
| 11444 |
|
| 11445 |
\startnewprimitive[title={\prm {scaledinterwordshrink}}] |
| 11446 |
|
| 11447 |
Returns the current (font specific) shrink of a space value scaled according to |
| 11448 |
\prm {glyphscale} and \prm {glyphxscale}. |
| 11449 |
|
| 11450 |
\stopnewprimitive |
| 11451 |
|
| 11452 |
\startnewprimitive[title={\prm {scaledinterwordspace}}] |
| 11453 |
|
| 11454 |
Returns the current (font specific) space value scaled according to \prm |
| 11455 |
{glyphscale} and \prm {glyphxscale}. |
| 11456 |
|
| 11457 |
\stopnewprimitive |
| 11458 |
|
| 11459 |
\startnewprimitive[title={\prm {scaledinterwordstretch}}] |
| 11460 |
|
| 11461 |
Returns the current (font specific) stretch of a space value scaled according to |
| 11462 |
\prm {glyphscale} and \prm {glyphxscale}. |
| 11463 |
|
| 11464 |
\stopnewprimitive |
| 11465 |
|
| 11466 |
\startnewprimitive[title={\prm {scaledmathaxis}}] |
| 11467 |
|
| 11468 |
This primitive returns the math axis of the given math style. It's a dimension. |
| 11469 |
|
| 11470 |
\stopnewprimitive |
| 11471 |
|
| 11472 |
\startnewprimitive[title={\prm {scaledmathemwidth}}] |
| 11473 |
|
| 11474 |
Returns the emwidth of the given style scaled according to \prm {glyphscale} and |
| 11475 |
\prm {glyphxscale}. |
| 11476 |
|
| 11477 |
\stopnewprimitive |
| 11478 |
|
| 11479 |
\startnewprimitive[title={\prm {scaledmathexheight}}] |
| 11480 |
|
| 11481 |
Returns the exheight of the given style scaled according to \prm {glyphscale} and |
| 11482 |
\prm {glyphyscale}. |
| 11483 |
|
| 11484 |
\stopnewprimitive |
| 11485 |
|
| 11486 |
\startnewprimitive[title={\prm {scaledmathstyle}}] |
| 11487 |
|
| 11488 |
This command inserts a signal in the math list that tells how to scale the (upcoming) |
| 11489 |
part of the formula. |
| 11490 |
|
| 11491 |
\startbuffer |
| 11492 |
$ x + {\scaledmathstyle900 x} + x$ |
| 11493 |
\stopbuffer |
| 11494 |
|
| 11495 |
\typebuffer |
| 11496 |
|
| 11497 |
We get: \inlinebuffer. Of course using this properly demands integration in the macro |
| 11498 |
packages font system. |
| 11499 |
|
| 11500 |
\stopnewprimitive |
| 11501 |
|
| 11502 |
\startnewprimitive[title={\prm {scaledslantperpoint}}] |
| 11503 |
|
| 11504 |
This primitive is equivalent to \typ {\scaledfontdimen1\font} where \quote |
| 11505 |
{scaled} means that we multiply by the glyph scales. |
| 11506 |
|
| 11507 |
\stopnewprimitive |
| 11508 |
|
| 11509 |
\startnewprimitive[title={\prm {scantextokens}}] |
| 11510 |
|
| 11511 |
This primitive scans the input as if it comes from a file. In the next examples |
| 11512 |
the \prm {detokenize} primitive turns tokenized code into verbatim code that is |
| 11513 |
similar to what is read from a file. |
| 11514 |
|
| 11515 |
\startbuffer |
| 11516 |
\edef\whatever{\detokenize{This is {\bf bold} and this is not.}} |
| 11517 |
\detokenize {This is {\bf bold} and this is not.}\crlf |
| 11518 |
\scantextokens{This is {\bf bold} and this is not.}\crlf |
| 11519 |
\scantextokens{\whatever}\crlf |
| 11520 |
\scantextokens\expandafter{\whatever}\par |
| 11521 |
\stopbuffer |
| 11522 |
|
| 11523 |
\typebuffer |
| 11524 |
|
| 11525 |
This primitive does not have the end|-|of|-|file side effects of its precursor |
| 11526 |
\prm {scantokens}. |
| 11527 |
|
| 11528 |
{\getbuffer} |
| 11529 |
|
| 11530 |
\stopnewprimitive |
| 11531 |
|
| 11532 |
\startoldprimitive[title={\prm {scantokens}}] |
| 11533 |
|
| 11534 |
Just forget about this \ETEX\ primitive, just take the one in the previous section. |
| 11535 |
|
| 11536 |
\stopoldprimitive |
| 11537 |
|
| 11538 |
\startoldprimitive[title={\prm {scriptfont}}] |
| 11539 |
|
| 11540 |
This primitive is like \prm {font} but with a family number as (first) argument |
| 11541 |
so it is specific for math. It is the middle one of the three family members; its |
| 11542 |
relatives are \prm {textfont} and \prm {scriptscriptfont}. |
| 11543 |
|
| 11544 |
\stopoldprimitive |
| 11545 |
|
| 11546 |
\startoldprimitive[title={\prm {scriptscriptfont}}] |
| 11547 |
|
| 11548 |
This primitive is like \prm {font} but with a family number as (first) argument |
| 11549 |
so it is specific for math. It is the smallest of the three family members; its |
| 11550 |
relatives are \prm {textfont} and \prm {scriptfont}. |
| 11551 |
|
| 11552 |
\stopoldprimitive |
| 11553 |
|
| 11554 |
\startoldprimitive[title={\prm {scriptscriptstyle}}] |
| 11555 |
|
| 11556 |
One of the main math styles, normally one size smaller than \prm {scriptstyle}: |
| 11557 |
integer representation: \the\scriptscriptstyle. |
| 11558 |
|
| 11559 |
\stopoldprimitive |
| 11560 |
|
| 11561 |
\startoldprimitive[title={\prm {scriptspace}}][obsolete=yes] |
| 11562 |
|
| 11563 |
The math engine will add this amount of space after subscripts and superscripts. |
| 11564 |
It can be seen as compensation for the often too small widths of characters (in |
| 11565 |
the traditional engine italic correction is used too). It prevents scripts from |
| 11566 |
running into what follows. |
| 11567 |
|
| 11568 |
\stopoldprimitive |
| 11569 |
|
| 11570 |
\startnewprimitive[title={\prm {scriptspaceafterfactor}}] |
| 11571 |
|
| 11572 |
This is a (1000 based) multiplier for \prm {Umathspaceafterscript}. |
| 11573 |
|
| 11574 |
\stopnewprimitive |
| 11575 |
|
| 11576 |
\startnewprimitive[title={\prm {scriptspacebeforefactor}}] |
| 11577 |
|
| 11578 |
This is a (1000 based) multiplier for \prm {Umathspacebeforescript}. |
| 11579 |
|
| 11580 |
\stopnewprimitive |
| 11581 |
|
| 11582 |
\startnewprimitive[title={\prm {scriptspacebetweenfactor}}] |
| 11583 |
|
| 11584 |
This is a (1000 based) multiplier for \prm {Umathspacebetweenscript}. |
| 11585 |
|
| 11586 |
\stopnewprimitive |
| 11587 |
|
| 11588 |
\startoldprimitive[title={\prm {scriptstyle}}] |
| 11589 |
|
| 11590 |
One of the main math styles, normally one size smaller than \prm {displaystyle} |
| 11591 |
and \prm {textstyle}; integer representation: \the\scriptstyle. |
| 11592 |
|
| 11593 |
\stopoldprimitive |
| 11594 |
|
| 11595 |
\startoldprimitive[title={\prm {scrollmode}}] |
| 11596 |
|
| 11597 |
This directive omits error stops. |
| 11598 |
|
| 11599 |
\stopoldprimitive |
| 11600 |
|
| 11601 |
\startnewprimitive[title={\prm {semiexpand}}] |
| 11602 |
|
| 11603 |
This command expands the next macro when it is protected with \prm |
| 11604 |
{semprotected}. See that primitive there for an example. |
| 11605 |
|
| 11606 |
\stopnewprimitive |
| 11607 |
|
| 11608 |
\startnewprimitive[title={\prm {semiexpanded}}] |
| 11609 |
|
| 11610 |
This command expands the tokens in the given list including the macros protected |
| 11611 |
by with \prm {semprotected}. See that primitive there for an example. |
| 11612 |
|
| 11613 |
\stopnewprimitive |
| 11614 |
|
| 11615 |
\startnewprimitive[title={\prm {semiprotected}}] |
| 11616 |
|
| 11617 |
% \startbuffer |
| 11618 |
% \def\TestA{A} |
| 11619 |
% \semiprotected\def\TestB{B} |
| 11620 |
% \protected\def\TestC{C} |
| 11621 |
% |
| 11622 |
% \edef\TestD{\TestA \TestB \TestC} |
| 11623 |
% \edef\TestE{\TestA\semiexpand\TestB\semiexpand\TestC} |
| 11624 |
% \edef\TestF{\TestA\expand \TestB\expand \TestC} |
| 11625 |
% |
| 11626 |
% \edef\TestG{\normalexpanded {\TestA\TestB\TestC}} |
| 11627 |
% \edef\TestH{\normalsemiexpanded{\TestA\TestB\TestC}} |
| 11628 |
% \stopbuffer |
| 11629 |
|
| 11630 |
\startbuffer |
| 11631 |
\def\TestA{A} |
| 11632 |
\semiprotected\def\TestB{B} |
| 11633 |
\protected\def\TestC{C} |
| 11634 |
|
| 11635 |
\edef\TestD{\TestA \TestB \TestC} |
| 11636 |
\edef\TestE{\TestA\semiexpand\TestB\semiexpand\TestC} |
| 11637 |
\edef\TestF{\TestA\expand \TestB\expand \TestC} |
| 11638 |
|
| 11639 |
\edef\TestG{\expanded {\TestA\TestB\TestC}} |
| 11640 |
\edef\TestH{\semiexpanded{\TestA\TestB\TestC}} |
| 11641 |
\stopbuffer |
| 11642 |
|
| 11643 |
The working of this prefix can best be explained with an example. We define a few |
| 11644 |
macros first: |
| 11645 |
|
| 11646 |
\typebuffer \getbuffer |
| 11647 |
|
| 11648 |
The meaning of the macros that are made from the other three are: |
| 11649 |
|
| 11650 |
\startbuffer |
| 11651 |
\meaningless\TestD |
| 11652 |
\meaningless\TestE |
| 11653 |
\meaningless\TestF |
| 11654 |
\meaningless\TestG |
| 11655 |
\meaningless\TestH |
| 11656 |
\stopbuffer |
| 11657 |
|
| 11658 |
Here we use the \type {\normal..} variants because (currently) we still have the |
| 11659 |
macro with the \type {\expanded} in the \CONTEXT\ core. |
| 11660 |
|
| 11661 |
\startlines \tttf \getbuffer \stoplines |
| 11662 |
|
| 11663 |
\stopnewprimitive |
| 11664 |
|
| 11665 |
\startoldprimitive[title={\prm {setbox}}] |
| 11666 |
|
| 11667 |
This important primitive is used to set a box register. It expects a number and a |
| 11668 |
box, like \prm {hbox} or \prm {box}. There is no \type {\boxdef} primitive |
| 11669 |
(analogue to other registers) because it makes no sense but numeric registers or |
| 11670 |
equivalents are okay as register value. |
| 11671 |
|
| 11672 |
\stopoldprimitive |
| 11673 |
|
| 11674 |
\startnewprimitive[title={\prm {setdefaultmathcodes}}] |
| 11675 |
|
| 11676 |
This sets the math codes of upper- and lowercase alphabet and digits and the |
| 11677 |
delimiter code of the period. It's not so much a useful feature but more just an |
| 11678 |
accessor to the internal initializer. |
| 11679 |
|
| 11680 |
\stopnewprimitive |
| 11681 |
|
| 11682 |
\startnewprimitive[title={\prm {setfontid}}] |
| 11683 |
|
| 11684 |
Internally a font instance has a number and this number is what gets assigned to |
| 11685 |
a glyph node. You can get the number with \prm {fontid} an set it with \prm |
| 11686 |
{setfontid}. |
| 11687 |
|
| 11688 |
\starttyping |
| 11689 |
\setfontid\fontid\font |
| 11690 |
\stoptyping |
| 11691 |
|
| 11692 |
The code above shows both primitives and effectively does nothing useful but |
| 11693 |
shows the idea. |
| 11694 |
|
| 11695 |
\stopnewprimitive |
| 11696 |
|
| 11697 |
\startoldprimitive[title={\prm {setlanguage}}] |
| 11698 |
|
| 11699 |
In \LUATEX\ and \LUAMETATEX\ this is equivalent to \prm {language} because we |
| 11700 |
carry the language in glyph nodes instead of putting triggers in the list. |
| 11701 |
|
| 11702 |
\stopoldprimitive |
| 11703 |
|
| 11704 |
\startnewprimitive[title={\prm {setmathatomrule}}] |
| 11705 |
|
| 11706 |
The math engine has some built in logic with respect to neighboring atoms that |
| 11707 |
change the class. The following combinations are intercepted and remapped: |
| 11708 |
|
| 11709 |
\starttabulate[|c|c|c|c|] |
| 11710 |
\BC old first \BC old second \NC new first \NC new second \NC \NR |
| 11711 |
\ML |
| 11712 |
\NC begin \NC binary \NC ordinary \NC ordinary \NC \NR |
| 11713 |
\NC \NC \NC \NC \NC \NR |
| 11714 |
\NC operator \NC binary \NC operator \NC ordinary \NC \NR |
| 11715 |
\NC open \NC binary \NC open \NC ordinary \NC \NR |
| 11716 |
\NC punctuation \NC binary \NC punctuation \NC ordinary \NC \NR |
| 11717 |
\NC \NC \NC \NC \NC \NR |
| 11718 |
\NC binary \NC end \NC ordinary \NC ordinary \NC \NR |
| 11719 |
\NC binary \NC binary \NC binary \NC ordinary \NC \NR |
| 11720 |
\NC binary \NC close \NC ordinary \NC close \NC \NR |
| 11721 |
\NC binary \NC punctuation \NC ordinary \NC punctuation \NC \NR |
| 11722 |
\NC binary \NC relation \NC ordinary \NC relation \NC \NR |
| 11723 |
\NC \NC \NC \NC \NC \NR |
| 11724 |
\NC relation \NC binary \NC relation \NC ordinary \NC \NR |
| 11725 |
\NC relation \NC close \NC ordinary \NC close \NC \NR |
| 11726 |
\NC relation \NC punctuation \NC ordinary \NC punctuation \NC \NR |
| 11727 |
\stoptabulate |
| 11728 |
|
| 11729 |
You can change this logic if needed, for instance: |
| 11730 |
|
| 11731 |
\starttyping |
| 11732 |
\setmathatomrule 1 2 \allmathstyles 1 1 |
| 11733 |
\stoptyping |
| 11734 |
|
| 11735 |
Keep in mind that the defaults are what users expect. You might set them up for |
| 11736 |
additional classes that you define but even then you probably clone an existing |
| 11737 |
class and patch its properties. Most extra classes behave like ordinary anyway. |
| 11738 |
|
| 11739 |
\stopnewprimitive |
| 11740 |
|
| 11741 |
\startnewprimitive[title={\prm {setmathdisplaypostpenalty}}] |
| 11742 |
|
| 11743 |
This penalty is inserted after an item of a given class but only in inline math |
| 11744 |
when display style is used, for instance: |
| 11745 |
|
| 11746 |
\starttyping |
| 11747 |
\setmathdisplayprepenalty 2 750 |
| 11748 |
\stoptyping |
| 11749 |
|
| 11750 |
\stopnewprimitive |
| 11751 |
|
| 11752 |
\startnewprimitive[title={\prm {setmathdisplayprepenalty}}] |
| 11753 |
|
| 11754 |
This penalty is inserted before an item of a given class but only in inline math |
| 11755 |
when display style is used, for instance: |
| 11756 |
|
| 11757 |
\starttyping |
| 11758 |
\setmathdisplayprepenalty 2 750 |
| 11759 |
\stoptyping |
| 11760 |
|
| 11761 |
\stopnewprimitive |
| 11762 |
|
| 11763 |
\startnewprimitive[title={\prm {setmathignore}}] |
| 11764 |
|
| 11765 |
You can flag a math parameter to be ignored, like: |
| 11766 |
|
| 11767 |
\starttyping |
| 11768 |
\setmathignore \Umathxscale 2 |
| 11769 |
\setmathignore \Umathyscale 2 |
| 11770 |
\setmathignore \Umathspacebeforescript 1 |
| 11771 |
\setmathignore \Umathspacebetweenscript 1 |
| 11772 |
\setmathignore \Umathspaceafterscript 1 |
| 11773 |
\stoptyping |
| 11774 |
|
| 11775 |
A value of two will not initialize the variable, so its old value (when set) is |
| 11776 |
kept. This is somewhat experimental and more options might show up. |
| 11777 |
|
| 11778 |
\stopnewprimitive |
| 11779 |
|
| 11780 |
\startnewprimitive[title={\prm {setmathoptions}}] |
| 11781 |
|
| 11782 |
This primitive expects a class (number) and a bitset. |
| 11783 |
|
| 11784 |
\testpage[2] |
| 11785 |
|
| 11786 |
\starttworows |
| 11787 |
\getbuffer[engine:syntax:classoptioncodes] % weird: one liner at end of page |
| 11788 |
\stoptworows |
| 11789 |
|
| 11790 |
\stopnewprimitive |
| 11791 |
|
| 11792 |
\startnewprimitive[title={\prm {setmathpostpenalty}}] |
| 11793 |
|
| 11794 |
This penalty is inserted after an item of a given class but only in inline math |
| 11795 |
when text, script or scriptscript style is used, for instance: |
| 11796 |
|
| 11797 |
\starttyping |
| 11798 |
\setmathpostpenalty 2 250 |
| 11799 |
\stoptyping |
| 11800 |
|
| 11801 |
\stopnewprimitive |
| 11802 |
|
| 11803 |
\startnewprimitive[title={\prm {setmathprepenalty}}] |
| 11804 |
|
| 11805 |
This penalty is inserted before an item of a given class but only in inline math |
| 11806 |
when text, script or scriptscript style is used, for instance: |
| 11807 |
|
| 11808 |
\starttyping |
| 11809 |
\setmathprepenalty 2 250 |
| 11810 |
\stoptyping |
| 11811 |
|
| 11812 |
\stopnewprimitive |
| 11813 |
|
| 11814 |
\startnewprimitive[title={\prm {setmathspacing}}] |
| 11815 |
|
| 11816 |
More details about this feature can be found in \CONTEXT\ but it boils down to |
| 11817 |
registering what spacing gets inserted between a pair of classes. It can be |
| 11818 |
defined per style or for a set of styles, like: |
| 11819 |
|
| 11820 |
\starttyping |
| 11821 |
\inherited\setmathspacing |
| 11822 |
\mathimplicationcode \mathbinarycode |
| 11823 |
\alldisplaystyles \thickermuskip |
| 11824 |
\inherited\setmathspacing |
| 11825 |
\mathradicalcode \mathmiddlecode |
| 11826 |
\allunsplitstyles \pettymuskip |
| 11827 |
\stoptyping |
| 11828 |
|
| 11829 |
Here the \prm {inherited} prefix signals that a change in for instance \prm |
| 11830 |
{pettymuskip} is reflected in this spacing pair. In \CONTEXT\ there is a lot of |
| 11831 |
granularity with respect to spacing and it took years of experimenting (and |
| 11832 |
playing with examples) to get at the current stage. In general users are not |
| 11833 |
invited to mess around too much with these values, although changing the bound |
| 11834 |
registers (here \prm {pettymuskip} and \type {thickermuskip}) is no problem as it |
| 11835 |
consistently makes related spacing pairs follow. |
| 11836 |
|
| 11837 |
\stopnewprimitive |
| 11838 |
|
| 11839 |
\startoldprimitive[title={\prm {sfcode}}] |
| 11840 |
|
| 11841 |
You can set a space factor on a character. That factor is used when a space |
| 11842 |
factor is applied (as part of spacing). It is (mostly) used for adding a |
| 11843 |
different space (glue) after punctuation. In some languages different punctuation |
| 11844 |
has different factors. |
| 11845 |
|
| 11846 |
\stopoldprimitive |
| 11847 |
|
| 11848 |
\startnewprimitive[title={\prm {shapingpenaltiesmode}}] |
| 11849 |
|
| 11850 |
Shaping penalties are inserted after the lines of a \prm {parshape} and |
| 11851 |
accumulate according to this mode, a bitset of: |
| 11852 |
|
| 11853 |
\getbuffer[engine:syntax:shapingpenaltiescodes] |
| 11854 |
|
| 11855 |
\stopnewprimitive |
| 11856 |
|
| 11857 |
\startnewprimitive[title={\prm {shapingpenalty}}] |
| 11858 |
|
| 11859 |
In order to prevent a \prm {parshape} to break in unexpected ways we can add a |
| 11860 |
dedicated penalty, specified by this parameter. |
| 11861 |
|
| 11862 |
\stopnewprimitive |
| 11863 |
|
| 11864 |
\startoldprimitive[title={\prm {shipout}}][obsolete=yes] |
| 11865 |
|
| 11866 |
Because there is no backend, this is not supposed to be used. As in traditional |
| 11867 |
\TEX\ a box is grabbed but instead of it being processed it gets shown and then |
| 11868 |
wiped. There is no real benefit of turning it into a callback. |
| 11869 |
|
| 11870 |
\stopoldprimitive |
| 11871 |
|
| 11872 |
\startnewprimitive[title={\prm {shortinlinemaththreshold}}] |
| 11873 |
|
| 11874 |
This parameter determines when an inline formula is considered to be short. This |
| 11875 |
criterium is used for for \prm {preshortinlinepenalty} and \prm |
| 11876 |
{postshortinlinepenalty}. |
| 11877 |
|
| 11878 |
\stopnewprimitive |
| 11879 |
|
| 11880 |
\startnewprimitive[title={\prm {shortinlineorphanpenalty}}] |
| 11881 |
|
| 11882 |
Short formulas at the end of a line are normally not followed by something other |
| 11883 |
than punctuation. This penalty will discourage a break before a short inline |
| 11884 |
formula. In practice one can set this penalty to e.g. a relatively low 200 to get |
| 11885 |
the desired effect. |
| 11886 |
|
| 11887 |
\stopnewprimitive |
| 11888 |
|
| 11889 |
\startoldprimitive[title={\prm {show}}] |
| 11890 |
|
| 11891 |
Prints to the console (and/or log) what the token after |
| 11892 |
it represents. |
| 11893 |
|
| 11894 |
\stopoldprimitive |
| 11895 |
|
| 11896 |
\startoldprimitive[title={\prm {showbox}}] |
| 11897 |
|
| 11898 |
The given box register is shown in the log and on te console (depending on \prm |
| 11899 |
{tracingonline}. How much is shown depends on \prm {showboxdepth} and \prm |
| 11900 |
{showboxbreadth}. In \LUAMETATEX\ we show more detailed information than in the |
| 11901 |
other engines; some specific information is provided via callbacks. |
| 11902 |
|
| 11903 |
\stopoldprimitive |
| 11904 |
|
| 11905 |
\startoldprimitive[title={\prm {showboxbreadth}}] |
| 11906 |
|
| 11907 |
This primitives determine how much of a box is shown when asked for or when |
| 11908 |
tracing demands it. |
| 11909 |
|
| 11910 |
\stopoldprimitive |
| 11911 |
|
| 11912 |
\startoldprimitive[title={\prm {showboxdepth}}] |
| 11913 |
|
| 11914 |
This primitives determine how deep tracing a box goes into the box. Some boxes, |
| 11915 |
like the ones that has the assembled page. |
| 11916 |
|
| 11917 |
\stopoldprimitive |
| 11918 |
|
| 11919 |
\startnewprimitive[title={\prm {showcodestack}}] |
| 11920 |
|
| 11921 |
This inspector is only useful for low level debugging and reports the current |
| 11922 |
state of for instance the current catcode table: \typ {\showcodestack \catcode}. |
| 11923 |
See \prm {restorecatcodes} for an example. |
| 11924 |
|
| 11925 |
\stopnewprimitive |
| 11926 |
|
| 11927 |
\startoldprimitive[title={\prm {showgroups}}] |
| 11928 |
|
| 11929 |
This primitive reports the group nesting. At this spot we have a not so |
| 11930 |
impressive nesting: |
| 11931 |
|
| 11932 |
\starttyping |
| 11933 |
2:3: simple group entered at line 9375: |
| 11934 |
1:3: semisimple group: \begingroup |
| 11935 |
0:3: bottomlevel |
| 11936 |
\stoptyping |
| 11937 |
|
| 11938 |
\stopoldprimitive |
| 11939 |
|
| 11940 |
\startoldprimitive[title={\prm {showifs}}] |
| 11941 |
|
| 11942 |
This primitive will show the conditional stack in the log file or on the console |
| 11943 |
(assuming \prm {tracingonline} being non|-|zero). The shown data is different |
| 11944 |
from other engines because we have more conditionals and also support a more flat |
| 11945 |
nesting model |
| 11946 |
|
| 11947 |
\stopoldprimitive |
| 11948 |
|
| 11949 |
\startoldprimitive[title={\prm {showlists}}] |
| 11950 |
|
| 11951 |
This shows the currently built list. |
| 11952 |
|
| 11953 |
\stopoldprimitive |
| 11954 |
|
| 11955 |
\startoldprimitive[title={\prm {shownodedetails}}] |
| 11956 |
|
| 11957 |
When set to a positive value more details will be shown of nodes when applicable. |
| 11958 |
Values larger than one will also report attributes. What gets shown depends on |
| 11959 |
related callbacks being set. |
| 11960 |
|
| 11961 |
\stopoldprimitive |
| 11962 |
|
| 11963 |
\startoldprimitive[title={\prm {showstack}}] |
| 11964 |
|
| 11965 |
This tracer is only useful for low level debugging of macros, for instance when |
| 11966 |
you run out of save space or when you encounter a performance hit. |
| 11967 |
|
| 11968 |
\starttyping |
| 11969 |
test\scratchcounter0 \showstack |
| 11970 |
{test\scratchcounter1 \showstack} |
| 11971 |
{{test\scratchcounter1 \showstack}} |
| 11972 |
\stoptyping |
| 11973 |
|
| 11974 |
reports |
| 11975 |
|
| 11976 |
\starttyping |
| 11977 |
1:3: [savestack size 0] |
| 11978 |
1:3: [savestack bottom] |
| 11979 |
|
| 11980 |
2:3: [savestack size 2] |
| 11981 |
2:3: [1: restore, level 1, cs \scratchcounter=integer 1] |
| 11982 |
2:3: [0: boundary, group 'bottomlevel', boundary 0, attrlist 3600, line 0] |
| 11983 |
2:3: [savestack bottom] |
| 11984 |
|
| 11985 |
3:3: [savestack size 3] |
| 11986 |
3:3: [2: restore, level 1, cs \scratchcounter=integer 1] |
| 11987 |
3:3: [1: boundary, group 'simple', boundary 0, attrlist 3600, line 12] |
| 11988 |
3:3: [0: boundary, group 'bottomlevel', boundary 0, attrlist 3600, line 0] |
| 11989 |
3:3: [savestack bottom] |
| 11990 |
\stoptyping |
| 11991 |
|
| 11992 |
while |
| 11993 |
|
| 11994 |
\starttyping |
| 11995 |
test\scratchcounter1 \showstack |
| 11996 |
{test\scratchcounter1 \showstack} |
| 11997 |
{{test\scratchcounter1 \showstack}} |
| 11998 |
\stoptyping |
| 11999 |
|
| 12000 |
shows this: |
| 12001 |
|
| 12002 |
\starttyping |
| 12003 |
1:3: [savestack size 0] |
| 12004 |
1:3: [savestack bottom] |
| 12005 |
|
| 12006 |
2:3: [savestack size 1] |
| 12007 |
2:3: [0: boundary, group 'bottomlevel', boundary 0, attrlist 3600, line 0] |
| 12008 |
2:3: [savestack bottom] |
| 12009 |
|
| 12010 |
3:3: [savestack size 2] |
| 12011 |
3:3: [1: boundary, group 'simple', boundary 0, attrlist 3600, line 16] |
| 12012 |
3:3: [0: boundary, group 'bottomlevel', boundary 0, attrlist 3600, line 0] |
| 12013 |
3:3: [savestack bottom] |
| 12014 |
\stoptyping |
| 12015 |
|
| 12016 |
Because in the second example the value of \type {\scratchcounter} doesn't really |
| 12017 |
change inside the group there is no need for a restore entry on the stack. In |
| 12018 |
\LUAMETATEX\ there are checks for that so that we consume less stack space. We |
| 12019 |
also store some states (like the line number and current attribute list pointer) |
| 12020 |
in a stack boundary. |
| 12021 |
|
| 12022 |
\stopoldprimitive |
| 12023 |
|
| 12024 |
\startoldprimitive[title={\prm {showthe}}] |
| 12025 |
|
| 12026 |
Prints to the console (and/or log) the value of token after it. |
| 12027 |
|
| 12028 |
\stopoldprimitive |
| 12029 |
|
| 12030 |
\startoldprimitive[title={\prm {showtokens}}] |
| 12031 |
|
| 12032 |
This command expects a (balanced) token list, like |
| 12033 |
|
| 12034 |
\starttyping |
| 12035 |
\showtokens{a few tokens} |
| 12036 |
\stoptyping |
| 12037 |
|
| 12038 |
Depending on what you want to see you need to expand: |
| 12039 |
|
| 12040 |
\starttyping |
| 12041 |
\showtokens\expandafter{\the\everypar} |
| 12042 |
\stoptyping |
| 12043 |
|
| 12044 |
which is equivalent to \typ {\showthe \everypar}. It is an \ETEX\ extension. |
| 12045 |
|
| 12046 |
\stopoldprimitive |
| 12047 |
|
| 12048 |
\startnewprimitive[title={\prm {singlelinepenalty}}] |
| 12049 |
|
| 12050 |
This is a penalty that gets injected before a paragraph that has only one line. |
| 12051 |
It is a one|-|shot parameter, so like \prm {looseness} it only applies to the |
| 12052 |
upcoming (or current) paragraph. |
| 12053 |
|
| 12054 |
\stopnewprimitive |
| 12055 |
|
| 12056 |
\startoldprimitive[title={\prm {skewchar}}][obsolete=yes] |
| 12057 |
|
| 12058 |
This is an (imaginary) character that is used in math fonts. The kerning pair |
| 12059 |
between this character and the current one determines the top anchor of a |
| 12060 |
possible accent. In \OPENTYPE\ there is a dedicated character property for this |
| 12061 |
(but for some reason not for the bottom anchor). |
| 12062 |
|
| 12063 |
\stopoldprimitive |
| 12064 |
|
| 12065 |
\startoldprimitive[title={\prm {skip}}] |
| 12066 |
|
| 12067 |
This is the accessor for an indexed skip (glue) register. |
| 12068 |
|
| 12069 |
\stopoldprimitive |
| 12070 |
|
| 12071 |
\startoldprimitive[title={\prm {skipdef}}] |
| 12072 |
|
| 12073 |
This command associates a control sequence with a skip register (accessed by number). |
| 12074 |
|
| 12075 |
\stopoldprimitive |
| 12076 |
|
| 12077 |
\startnewprimitive[title={\prm {snapshotpar}}] |
| 12078 |
|
| 12079 |
There are many parameters involved in typesetting a paragraph. One complication |
| 12080 |
is that parameters set in the middle might have unpredictable consequences due to |
| 12081 |
grouping, think of: |
| 12082 |
|
| 12083 |
\starttyping |
| 12084 |
text text <some setting> text text \par |
| 12085 |
text {text <some setting> text } text \par |
| 12086 |
\stoptyping |
| 12087 |
|
| 12088 |
This makes in traditional \TEX\ because there is no state related to the current |
| 12089 |
paragraph. But in \LUATEX\ we have the initial so called par node that remembers |
| 12090 |
the direction as well as local boxes. In \LUAMETATEX\ we store way more when this |
| 12091 |
node is created. That means that later settings no longer replace the stored ones. |
| 12092 |
|
| 12093 |
The \prm {snapshotpar} takes a bitset that determine what stored parameters get |
| 12094 |
updated to the current values. |
| 12095 |
|
| 12096 |
\startthreerows |
| 12097 |
\getbuffer[engine:syntax:frozenparcodes] |
| 12098 |
\stopthreerows |
| 12099 |
|
| 12100 |
One such value covers multiple values, so for instance \type {skip} is good for |
| 12101 |
storing the current \prm {leftskip} and \prm {rightskip} values. More about this |
| 12102 |
feature can be found in the \CONTEXT\ documentation. |
| 12103 |
|
| 12104 |
The list of parameters that gets reset after a paragraph is longer than for |
| 12105 |
\PDFTEX\ and \LUAMETATEX: \prm {emergencyleftskip}, \prm {emergencyrightskip}, \prm |
| 12106 |
{hangafter}, \prm {hangindent}, \prm {interlinepenalties}, \prm |
| 12107 |
{localbrokenpenalty}, \prm {localinterlinepenalty}, \prm {localpretolerance}, |
| 12108 |
\prm {localtolerance}, \prm {looseness}, \prm {parshape} and \prm |
| 12109 |
{singlelinepenalty}. |
| 12110 |
|
| 12111 |
\stopnewprimitive |
| 12112 |
|
| 12113 |
\startnewprimitive[title={\prm {spacechar}}] |
| 12114 |
|
| 12115 |
When \prm {nospaces} is set to~3 a glyph node with the character value of |
| 12116 |
this parameter is injected. |
| 12117 |
|
| 12118 |
\stopnewprimitive |
| 12119 |
|
| 12120 |
\startoldprimitive[title={\prm {spacefactor}}] |
| 12121 |
|
| 12122 |
The space factor is a somewhat complex feature. When during scanning a character |
| 12123 |
is appended that has a \prm {sfcode} other than 1000, that value is saved. When |
| 12124 |
the time comes to insert a space triggered glue, and that factor is 2000 or more, |
| 12125 |
and when \prm {xspaceskip} is nonzero, that value is used and we're done. |
| 12126 |
|
| 12127 |
If these criteria are not met, and \prm {spaceskip} is nonzero, that value is |
| 12128 |
used, otherwise the space value from the font is used. Now, it if the space factor |
| 12129 |
is larger than 2000 the extra space value from the font is added to the set value. |
| 12130 |
Next the engine is going to tweak the stretch and shrink if that value and in |
| 12131 |
\LUAMETATEX\ that can be done in different ways, depending on \prm {spacefactormode}, |
| 12132 |
\prm {spacefactorstretchlimit} and \prm {spacefactorshrinklimit}. |
| 12133 |
|
| 12134 |
First the stretch. When the set limit is 1000 or more and the saved space factor |
| 12135 |
is also 1000 or more, we multiply the stretch by the limit, otherwise the saved |
| 12136 |
space factor is used. |
| 12137 |
|
| 12138 |
Shrink is done differently. When the shrink limit and space factor are both 1000 |
| 12139 |
or more, we will scale the shrink component by the limit, otherwise we multiply |
| 12140 |
by the saved space factor but here we have three variants, determined by the |
| 12141 |
value of \prm {spacefactormode}. |
| 12142 |
|
| 12143 |
In the first case, when the limit kicks in, a mode value~1 will multiply by limit |
| 12144 |
and divides by 1000. A value of~2 multiplies by 2000 and divides by the limit. |
| 12145 |
Other mode values multiply by 1000 and divide by the limit. When the limit is not |
| 12146 |
used, the same happens but with the saved space factor. |
| 12147 |
|
| 12148 |
If this sounds complicated, here is what regular \TEX\ does: stretch is |
| 12149 |
multiplied by the factor and divided by 1000 while shrink is multiplied by 1000 |
| 12150 |
and divided by the saved factor. The (new) mode driven alternatives are the |
| 12151 |
result of extensive experiments done in the perspective of enhancing the |
| 12152 |
rendering of inline math as well as additional par builder passes. For sure |
| 12153 |
alternative strategies are possible and we can always add more modes. |
| 12154 |
|
| 12155 |
A better explanation of the default strategy around spaces can be found in (of |
| 12156 |
course) The \TEX book and \TEX\ by Topic. |
| 12157 |
|
| 12158 |
\stopoldprimitive |
| 12159 |
|
| 12160 |
\startnewprimitive[title={\prm {spacefactormode}}] |
| 12161 |
|
| 12162 |
Its setting determines the way the glue components (currently only shrink) adapts |
| 12163 |
itself to the current space factor (determined by by the character preceding a |
| 12164 |
space). |
| 12165 |
|
| 12166 |
\stopnewprimitive |
| 12167 |
|
| 12168 |
\startnewprimitive[title={\prm {spacefactoroverload}}] |
| 12169 |
|
| 12170 |
When set to value between zero and thousand, this value will be used when \TEX\ |
| 12171 |
encounters a below thousand space factor situation (usually used to suppress |
| 12172 |
additional space after a period following an uppercase character which then gets |
| 12173 |
(often) a 999 space factor. This feature only kicks in when the overload flag is |
| 12174 |
set in the glyph options, so it can be applied selectively. |
| 12175 |
|
| 12176 |
\stopnewprimitive |
| 12177 |
|
| 12178 |
\startnewprimitive[title={\prm {spacefactorshrinklimit}}] |
| 12179 |
|
| 12180 |
This limit is used when \prm {spacefactormode} is set. See \prm {spacefactor} for a |
| 12181 |
bit more explanation. |
| 12182 |
|
| 12183 |
\stopnewprimitive |
| 12184 |
|
| 12185 |
\startnewprimitive[title={\prm {spacefactorstretchlimit}}] |
| 12186 |
|
| 12187 |
This limit is used when \prm {spacefactormode} is set. See \prm {spacefactor} for a |
| 12188 |
bit more explanation. |
| 12189 |
|
| 12190 |
\stopnewprimitive |
| 12191 |
|
| 12192 |
\startoldprimitive[title={\prm {spaceskip}}] |
| 12193 |
|
| 12194 |
Normally the glue inserted when a space is encountered is taken from the font but |
| 12195 |
this parameter can overrule that. |
| 12196 |
|
| 12197 |
\stopoldprimitive |
| 12198 |
|
| 12199 |
\startoldprimitive[title={\prm {span}}] |
| 12200 |
|
| 12201 |
This primitive combined two upcoming cells into one. Often it is used in |
| 12202 |
combination with \prm {omit}. However, in the preamble it forces the next token |
| 12203 |
to be expanded, which means that nested \prm {tabskips} and align content markers |
| 12204 |
are seen. |
| 12205 |
|
| 12206 |
\stopoldprimitive |
| 12207 |
|
| 12208 |
\startnewprimitive[title={\prm {specificationdef}}] |
| 12209 |
|
| 12210 |
There are some datastructures that are like arrays: \prm {adjacentdemerits}, \prm |
| 12211 |
{brokenpenalties}, \prm {clubpenalties}, \prm {displaywidowpenalties}, \prm |
| 12212 |
{fitnessclasses}, \prm {interlinepenalties}, \prm {mathbackwardpenalties}, \prm |
| 12213 |
{mathforwardpenalties}, \prm {orphanpenalties}, \prm {parpasses}, \prm {parshape} |
| 12214 |
and \prm {widowpenalties}. They accept a counter than tells how many entries |
| 12215 |
follow and depending in the specification options, keywords and|/|or just values |
| 12216 |
are expected. |
| 12217 |
|
| 12218 |
With \prm {specificationdef} you can define a command that holds such an array |
| 12219 |
and that can be used afterwards as a fast way to enable that specification. The |
| 12220 |
way it work is as follows: |
| 12221 |
|
| 12222 |
\starttyping |
| 12223 |
\specificationdef\MyWidowPenalties |
| 12224 |
\widowpenalties 4 2000 1000 500 250 |
| 12225 |
\relax |
| 12226 |
\stoptyping |
| 12227 |
|
| 12228 |
where the relax is optional but a reasonabel way to make sure we end the |
| 12229 |
definition (when keywords are used, as in \prm {parpasses} it prevents running |
| 12230 |
into unexpected keywords. |
| 12231 |
|
| 12232 |
\stopnewprimitive |
| 12233 |
|
| 12234 |
\startoldprimitive[title={\prm {splitbotmark}}][obsolete=yes] |
| 12235 |
|
| 12236 |
This is a reference to the last mark on the currently split off box, it gives |
| 12237 |
back tokens. |
| 12238 |
|
| 12239 |
\stopoldprimitive |
| 12240 |
|
| 12241 |
\startoldprimitive[title={\prm {splitbotmarks}}] |
| 12242 |
|
| 12243 |
This is a reference to the last mark with the given id (a number) on the |
| 12244 |
currently split off box, it gives back tokens. |
| 12245 |
|
| 12246 |
\stopoldprimitive |
| 12247 |
|
| 12248 |
\startoldprimitive[title={\prm {splitdiscards}}] |
| 12249 |
|
| 12250 |
When a box is split off, items like glue are discarded. This internal register |
| 12251 |
keeps the that list so that it can be pushed back if needed. |
| 12252 |
|
| 12253 |
\stopoldprimitive |
| 12254 |
|
| 12255 |
\startnewprimitive[title={\prm {splitextraheight}}] |
| 12256 |
|
| 12257 |
A possible (permissive) overrun of the split off part in a \prm {vsplit}. |
| 12258 |
|
| 12259 |
\stopnewprimitive |
| 12260 |
|
| 12261 |
\startoldprimitive[title={\prm {splitfirstmark}}][obsolete=yes] |
| 12262 |
|
| 12263 |
This is a reference to the first mark on the currently split off box, it gives |
| 12264 |
back tokens. |
| 12265 |
|
| 12266 |
\stopoldprimitive |
| 12267 |
|
| 12268 |
\startoldprimitive[title={\prm {splitfirstmarks}}] |
| 12269 |
|
| 12270 |
This is a reference to the first mark with the given id (a number) on the |
| 12271 |
currently split off box, it gives back tokens. |
| 12272 |
|
| 12273 |
\stopoldprimitive |
| 12274 |
|
| 12275 |
\startnewprimitive[title={\prm {splitlastdepth}}] |
| 12276 |
|
| 12277 |
This returns the last depth in a \type {vsplit}. |
| 12278 |
|
| 12279 |
\stopnewprimitive |
| 12280 |
|
| 12281 |
\startnewprimitive[title={\prm {splitlastheight}}] |
| 12282 |
|
| 12283 |
This returns the last (accumulated) height in a \type {vsplit}. |
| 12284 |
|
| 12285 |
\stopnewprimitive |
| 12286 |
|
| 12287 |
\startnewprimitive[title={\prm {splitlastshrink}}] |
| 12288 |
|
| 12289 |
This returns the last (accumulated) shrink in a \type {vsplit}. |
| 12290 |
|
| 12291 |
\stopnewprimitive |
| 12292 |
|
| 12293 |
\startnewprimitive[title={\prm {splitlaststretch}}] |
| 12294 |
|
| 12295 |
This returns the last (accumulated) stretch in a \type {vsplit}. |
| 12296 |
|
| 12297 |
\stopnewprimitive |
| 12298 |
|
| 12299 |
\startoldprimitive[title={\prm {splitmaxdepth}}] |
| 12300 |
|
| 12301 |
The depth of the box that results from a \prm {vsplit}. |
| 12302 |
|
| 12303 |
\stopoldprimitive |
| 12304 |
|
| 12305 |
\startoldprimitive[title={\prm {splittopskip}}] |
| 12306 |
|
| 12307 |
This is the amount of glue that is added to the top of a (new) split of part of a |
| 12308 |
box when \prm {vsplit} is applied. |
| 12309 |
|
| 12310 |
\stopoldprimitive |
| 12311 |
|
| 12312 |
\startnewprimitive[title={\prm {srule}}] |
| 12313 |
|
| 12314 |
This inserts a rule with no width. When a \type {font} and a \type {char} are |
| 12315 |
given the height and depth of that character are taken. Instead of a font \type |
| 12316 |
{fam} is also accepted so that we can use it in math mode. |
| 12317 |
|
| 12318 |
\stopnewprimitive |
| 12319 |
|
| 12320 |
\startoldprimitive[title={\prm {string}}] |
| 12321 |
|
| 12322 |
We mention this original primitive because of the one in the next section. It |
| 12323 |
expands the next token or control sequence as if it was just entered, so normally |
| 12324 |
a control sequence becomes a backslash followed by characters and a space. |
| 12325 |
|
| 12326 |
\stopoldprimitive |
| 12327 |
|
| 12328 |
\startnewprimitive[title={\prm {subprescript}}] |
| 12329 |
|
| 12330 |
Instead of three or four characters with catcode \the\subscriptcatcode\ (\type |
| 12331 |
{__} or \type {____}) this primitive can be used. It will add the following |
| 12332 |
argument as lower left script to the nucleus. |
| 12333 |
|
| 12334 |
\stopnewprimitive |
| 12335 |
|
| 12336 |
\startnewprimitive[title={\prm {subscript}}] |
| 12337 |
|
| 12338 |
Instead of one or two characters with catcode \the\superscriptcatcode\ (\type {_} |
| 12339 |
or \type {__}) this primitive can be used. It will add the following argument as |
| 12340 |
upper left script to the nucleus. |
| 12341 |
|
| 12342 |
\stopnewprimitive |
| 12343 |
|
| 12344 |
\startnewprimitive[title={\prm {superprescript}}] |
| 12345 |
|
| 12346 |
Instead of three or four characters with catcode \the\superscriptcatcode\ (\type |
| 12347 |
{^^^} or \type {^^^^}) this primitive can be used. It will add the following |
| 12348 |
argument as upper left script to the nucleus. |
| 12349 |
|
| 12350 |
\stopnewprimitive |
| 12351 |
|
| 12352 |
\startnewprimitive[title={\prm {superscript}}] |
| 12353 |
|
| 12354 |
Instead of one or two character with catcode \the\superscriptcatcode\ (\type {^} |
| 12355 |
or \type {^^})t his primitive can be used. It will add the following argument as |
| 12356 |
upper right script to the nucleus. |
| 12357 |
|
| 12358 |
\stopnewprimitive |
| 12359 |
|
| 12360 |
\startnewprimitive[title={\prm {supmarkmode}}] |
| 12361 |
|
| 12362 |
As in other languages, \TEX\ has ways to escape characters and get whatever |
| 12363 |
character needed into the input. By default multiple \type {^} are used for this. |
| 12364 |
The dual \type {^^} variant is a bit weird as it is not continuous but \type |
| 12365 |
{^^^^} and \type {^^^^^^} provide four or six byte hexadecimal references ot |
| 12366 |
characters. The single \type {^} is also used for superscripts but because we |
| 12367 |
support prescripts and indices we get into conflicts with the escapes. |
| 12368 |
|
| 12369 |
When this internal quantity is set to zero, multiple \type {^}'s are interpreted |
| 12370 |
in the input and produce characters. Other values disable the multiple parsing in |
| 12371 |
text and|/|or math mode: |
| 12372 |
|
| 12373 |
\startbuffer |
| 12374 |
\normalsupmarkmode0 $ X^58 \quad X^^58 $ |
| 12375 |
\normalsupmarkmode1 $ X^58 \quad X^^58 $ ^^58 |
| 12376 |
\normalsupmarkmode2 $ X^58 \quad X^^58 $ % ^^58 : error |
| 12377 |
\stopbuffer |
| 12378 |
|
| 12379 |
\typebuffer |
| 12380 |
|
| 12381 |
In \CONTEXT\ we default to one but also have the \prm {catcode} set to \the |
| 12382 |
\catcode`^, and the \prm {amcode} to \the \amcode `^. |
| 12383 |
|
| 12384 |
\startlines |
| 12385 |
\catcode`^=\superscriptcatcode % to make sure we handle it in math |
| 12386 |
\amcode `^=\superscriptcatcode |
| 12387 |
\getbuffer |
| 12388 |
\stoplines |
| 12389 |
|
| 12390 |
% \startlines |
| 12391 |
% \amcode \circumflexasciicode\superscriptcatcode |
| 12392 |
% \catcode\circumflexasciicode\superscriptcatcode % to make sure we handle it in math |
| 12393 |
% \getbuffer |
| 12394 |
% \stoplines |
| 12395 |
|
| 12396 |
\stopnewprimitive |
| 12397 |
|
| 12398 |
\startnewprimitive[title={\prm {swapcsvalues}}] |
| 12399 |
|
| 12400 |
Because we mention some \type {def} and \type {let} primitives here, it makes |
| 12401 |
sense to also mention a primitive that will swap two values (meanings). This one |
| 12402 |
has to be used with care. Of course that what gets swapped has to be of the same |
| 12403 |
type (or at least similar enough not to cause issues). Registers for instance |
| 12404 |
store their values in the token, but as soon as we are dealing with token lists |
| 12405 |
we also need to keep an eye on reference counting. So, to some extend this is |
| 12406 |
an experimental feature. |
| 12407 |
|
| 12408 |
\startbuffer |
| 12409 |
\scratchcounterone 1 \scratchcountertwo 2 |
| 12410 |
(\the\scratchcounterone,\the\scratchcountertwo) |
| 12411 |
\swapcsvalues \scratchcounterone \scratchcountertwo |
| 12412 |
(\the\scratchcounterone,\the\scratchcountertwo) |
| 12413 |
\swapcsvalues \scratchcounterone \scratchcountertwo |
| 12414 |
(\the\scratchcounterone,\the\scratchcountertwo) |
| 12415 |
|
| 12416 |
\scratchcounterone 3 \scratchcountertwo 4 |
| 12417 |
(\the\scratchcounterone,\the\scratchcountertwo) |
| 12418 |
\bgroup |
| 12419 |
\swapcsvalues \scratchcounterone \scratchcountertwo |
| 12420 |
(\the\scratchcounterone,\the\scratchcountertwo) |
| 12421 |
\egroup |
| 12422 |
(\the\scratchcounterone,\the\scratchcountertwo) |
| 12423 |
\stopbuffer |
| 12424 |
|
| 12425 |
\typebuffer |
| 12426 |
|
| 12427 |
We get similar results: |
| 12428 |
|
| 12429 |
\startlines |
| 12430 |
\getbuffer |
| 12431 |
\stoplines |
| 12432 |
|
| 12433 |
\stopnewprimitive |
| 12434 |
|
| 12435 |
\startnewprimitive[title={\prm {tabsize}}] |
| 12436 |
|
| 12437 |
This primitive can be used in the preamble of an alignment and sets the size of |
| 12438 |
a column, as in: |
| 12439 |
|
| 12440 |
\startbuffer |
| 12441 |
\halign{% |
| 12442 |
\aligncontent \aligntab |
| 12443 |
\aligncontent\tabsize 3cm \aligntab |
| 12444 |
\aligncontent \aligntab |
| 12445 |
\aligncontent\tabsize 0cm \cr |
| 12446 |
1 \aligntab 111\aligntab 1111\aligntab 11\cr |
| 12447 |
222\aligntab 2 \aligntab 2222\aligntab 22\cr |
| 12448 |
} |
| 12449 |
\stopbuffer |
| 12450 |
|
| 12451 |
\typebuffer |
| 12452 |
|
| 12453 |
As with \prm {tabskip} you need to reset the value explicitly, so that is why we |
| 12454 |
get two wide columns: |
| 12455 |
|
| 12456 |
\blank {\showboxes \getbuffer} \blank |
| 12457 |
|
| 12458 |
\stopnewprimitive |
| 12459 |
|
| 12460 |
\startoldprimitive[title={\prm {tabskip}}] |
| 12461 |
|
| 12462 |
This traditional primitive can be used in the preamble of an alignment and sets the |
| 12463 |
space added between columns, for example: |
| 12464 |
|
| 12465 |
\startbuffer |
| 12466 |
\halign{% |
| 12467 |
\aligncontent \aligntab |
| 12468 |
\aligncontent\tabskip 3cm \aligntab |
| 12469 |
\aligncontent \aligntab |
| 12470 |
\aligncontent\tabskip 0cm \cr |
| 12471 |
1 \aligntab 111\aligntab 1111\aligntab 11\cr |
| 12472 |
222\aligntab 2 \aligntab 2222\aligntab 22\cr |
| 12473 |
} |
| 12474 |
\stopbuffer |
| 12475 |
|
| 12476 |
\typebuffer |
| 12477 |
|
| 12478 |
You need to reset the skip explicitly, which is why we get it applied twice here: |
| 12479 |
|
| 12480 |
\blank {\showboxes \getbuffer} \blank |
| 12481 |
|
| 12482 |
\stopoldprimitive |
| 12483 |
|
| 12484 |
\startnewprimitive[title={\prm {textdirection}}] |
| 12485 |
|
| 12486 |
This set the text direction to \type {l2r} (0) or \type {r2l} (1). It also |
| 12487 |
triggers additional checking for balanced flipping in node lists. |
| 12488 |
|
| 12489 |
\stopnewprimitive |
| 12490 |
|
| 12491 |
\startoldprimitive[title={\prm {textfont}}] |
| 12492 |
|
| 12493 |
This primitive is like \prm {font} but with a family number as (first) argument |
| 12494 |
so it is specific for math. It is the largest one of the three family members; its |
| 12495 |
relatives are \prm {scriptfont} and \prm {scriptscriptfont}. |
| 12496 |
|
| 12497 |
\stopoldprimitive |
| 12498 |
|
| 12499 |
\startoldprimitive[title={\prm {textstyle}}] |
| 12500 |
|
| 12501 |
One of the main math styles; integer representation: \the\textstyle. |
| 12502 |
|
| 12503 |
\stopoldprimitive |
| 12504 |
|
| 12505 |
\startoldprimitive[title={\prm {the}}] |
| 12506 |
|
| 12507 |
The \prm {the} primitive serializes the following token, when applicable: |
| 12508 |
integers, dimensions, token registers, special quantities, etc. The catcodes of |
| 12509 |
the result will be according to the current settings, so in \type {\the \dimen0}, |
| 12510 |
the \type {pt} will have catcode \quote {letter} and the number and period will |
| 12511 |
become \quote {other}. |
| 12512 |
|
| 12513 |
\stopoldprimitive |
| 12514 |
|
| 12515 |
\startnewprimitive[title={\prm {thewithoutunit}}] |
| 12516 |
|
| 12517 |
The \prm{the} primitive, when applied to a dimension variable, adds a \type {pt} |
| 12518 |
unit. because dimensions are the only traditional unit with a fractional part |
| 12519 |
they are sometimes used as pseudo floats in which case \prm {thewithoutunit} can |
| 12520 |
be used to avoid the unit. This is more convenient than stripping it off |
| 12521 |
afterwards (via an expandable macro). |
| 12522 |
|
| 12523 |
\stopnewprimitive |
| 12524 |
|
| 12525 |
\startoldprimitive[title={\prm {thickmuskip}}] |
| 12526 |
|
| 12527 |
A predefined mu skip register that can be used in math (inter atom) spacing. The |
| 12528 |
current value is {\tt \the\thickmuskip}. In traditional \TEX\ most inter atom |
| 12529 |
spacing is hard coded using the predefined registers. |
| 12530 |
|
| 12531 |
\stopoldprimitive |
| 12532 |
|
| 12533 |
\startoldprimitive[title={\prm {thinmuskip}}] |
| 12534 |
|
| 12535 |
A predefined mu skip register that can be used in math (inter atom) spacing. The |
| 12536 |
current value is {\tt \the\thinmuskip}. In traditional \TEX\ most inter atom |
| 12537 |
spacing is hard coded using the predefined registers. |
| 12538 |
|
| 12539 |
\stopoldprimitive |
| 12540 |
|
| 12541 |
\startoldprimitive[title={\prm {time}}] |
| 12542 |
|
| 12543 |
This internal number starts out with minute (starting at midnight) that the job |
| 12544 |
started. |
| 12545 |
|
| 12546 |
\stopoldprimitive |
| 12547 |
|
| 12548 |
\startnewprimitive[title={\prm {tinymuskip}}] |
| 12549 |
|
| 12550 |
A predefined mu skip register that can be used in math (inter atom) spacing. The |
| 12551 |
current value is {\tt \the\tinymuskip}. This one complements \prm {thinmuskip}, |
| 12552 |
\prm {medmuskip}, \prm {thickmuskip} and the new \prm {pettymuskip} |
| 12553 |
|
| 12554 |
\stopnewprimitive |
| 12555 |
|
| 12556 |
\startnewprimitive[title={\prm {tocharacter}}] |
| 12557 |
|
| 12558 |
The given number is converted into an \UTF-8 sequence. In \LUATEX\ this one is |
| 12559 |
named \type {\Uchar}. |
| 12560 |
|
| 12561 |
\stopnewprimitive |
| 12562 |
|
| 12563 |
\startnewprimitive[title={\prm {toddlerpenalties}}] |
| 12564 |
|
| 12565 |
This an (possible double entry) array parameter: first the size is given followed |
| 12566 |
by that amount of penalties (can be pairs). These penalties are injected after |
| 12567 |
(and before) single glyphs bounded by spaces, going backward from the end of a |
| 12568 |
sequence of them. |
| 12569 |
|
| 12570 |
\stopnewprimitive |
| 12571 |
|
| 12572 |
\startnewprimitive[title={\prm {todimension}}] |
| 12573 |
|
| 12574 |
\startbuffer |
| 12575 |
\scratchdimen = 1234pt \todimension\scratchdimen |
| 12576 |
\stopbuffer |
| 12577 |
|
| 12578 |
The following code gives this: {\nospacing\inlinebuffer} and like its numeric |
| 12579 |
counterparts accepts anything that resembles a number this one goes beyond |
| 12580 |
(user, internal or pseudo) registers values too. |
| 12581 |
|
| 12582 |
\typebuffer |
| 12583 |
|
| 12584 |
\stopnewprimitive |
| 12585 |
|
| 12586 |
\startnewprimitive[title={\prm {tohexadecimal}}] |
| 12587 |
|
| 12588 |
\startbuffer |
| 12589 |
\scratchcounter = 1234 \tohexadecimal\scratchcounter |
| 12590 |
\stopbuffer |
| 12591 |
|
| 12592 |
The following code gives this: {\nospacing\inlinebuffer} with uppercase letters. |
| 12593 |
|
| 12594 |
\typebuffer |
| 12595 |
|
| 12596 |
\stopnewprimitive |
| 12597 |
|
| 12598 |
\startnewprimitive[title={\prm {tointeger}}] |
| 12599 |
|
| 12600 |
\startbuffer |
| 12601 |
\scratchcounter = 1234 \tointeger\scratchcounter |
| 12602 |
\stopbuffer |
| 12603 |
|
| 12604 |
The following code gives this: {\nospacing\inlinebuffer} and is equivalent to |
| 12605 |
\prm {number}. |
| 12606 |
|
| 12607 |
\typebuffer |
| 12608 |
|
| 12609 |
\stopnewprimitive |
| 12610 |
|
| 12611 |
\startnewprimitive[title={\prm {tokenized}}] |
| 12612 |
|
| 12613 |
Just as \prm {expanded} has a counterpart \prm {unexpanded}, it makes sense to give |
| 12614 |
\prm {detokenize} a companion: |
| 12615 |
|
| 12616 |
\startbuffer |
| 12617 |
\edef\foo{\detokenize{\inframed{foo}}} |
| 12618 |
\edef\oof{\detokenize{\inframed{oof}}} |
| 12619 |
|
| 12620 |
\meaning\foo \crlf \dontleavehmode\foo |
| 12621 |
|
| 12622 |
\edef\foo{\tokenized{\foo\foo}} |
| 12623 |
|
| 12624 |
\meaning\foo \crlf \dontleavehmode\foo |
| 12625 |
|
| 12626 |
\dontleavehmode\tokenized{\foo\oof} |
| 12627 |
\stopbuffer |
| 12628 |
|
| 12629 |
\typebuffer {\tttf \getbuffer} |
| 12630 |
|
| 12631 |
This primitive is similar to: |
| 12632 |
|
| 12633 |
% \starttyping |
| 12634 |
% \def\tokenized#1{\scantextokens\expandafter{\normalexpanded{#1}}} |
| 12635 |
% \stoptyping |
| 12636 |
|
| 12637 |
\starttyping |
| 12638 |
\def\tokenized#1{\scantextokens\expandafter{\expanded{#1}}} |
| 12639 |
\stoptyping |
| 12640 |
|
| 12641 |
and should be more efficient, not that it matters much as we don't use it that |
| 12642 |
much (if at all). |
| 12643 |
|
| 12644 |
\stopnewprimitive |
| 12645 |
|
| 12646 |
\startoldprimitive[title={\prm {toks}}] |
| 12647 |
|
| 12648 |
This is the accessor of a token register so it expects a number or \prm |
| 12649 |
{toksdef}'d macro. |
| 12650 |
|
| 12651 |
\stopoldprimitive |
| 12652 |
|
| 12653 |
\startnewprimitive[title={\prm {toksapp}}] |
| 12654 |
|
| 12655 |
One way to append something to a token list is the following: |
| 12656 |
|
| 12657 |
\starttyping |
| 12658 |
\scratchtoks\expandafter{\the\scratchtoks more stuff} |
| 12659 |
\stoptyping |
| 12660 |
|
| 12661 |
This works all right, but it involves a copy of what is already in \type |
| 12662 |
{\scratchtoks}. This is seldom a real issue unless we have large token lists and |
| 12663 |
many appends. This is why \LUATEX\ introduced: |
| 12664 |
|
| 12665 |
\starttyping |
| 12666 |
\toksapp\scratchtoks{more stuff} |
| 12667 |
\toksapp\scratchtoksone\scratchtokstwo |
| 12668 |
\stoptyping |
| 12669 |
|
| 12670 |
At some point, when working on \LUAMETATEX, I realized that primitives like this |
| 12671 |
one and the next appenders and prependers to be discussed were always on the |
| 12672 |
radar of Taco and me. Some were even implemented in what we called \type {eetex}: |
| 12673 |
extended \ETEX, and we even found back the prototypes, dating from pre|-|\PDFTEX\ |
| 12674 |
times. |
| 12675 |
|
| 12676 |
\stopnewprimitive |
| 12677 |
|
| 12678 |
\startoldprimitive[title={\prm {toksdef}}] |
| 12679 |
|
| 12680 |
The given name (control sequence) will be bound to the given token register (a |
| 12681 |
number). Often this primitive is hidden in a high level macro that manages |
| 12682 |
allocation. |
| 12683 |
|
| 12684 |
\stopoldprimitive |
| 12685 |
|
| 12686 |
\startnewprimitive[title={\prm {tokspre}}] |
| 12687 |
|
| 12688 |
Where appending something is easy because of the possible \prm {expandafter} |
| 12689 |
trickery a prepend would involve more work, either using temporary token |
| 12690 |
registers and|/|or using a mixture of the (no)expansion added by \ETEX, but all |
| 12691 |
are kind of inefficient and cumbersome. |
| 12692 |
|
| 12693 |
\starttyping |
| 12694 |
\tokspre\scratchtoks{less stuff} |
| 12695 |
\tokspre\scratchtoksone\scratchtokstwo |
| 12696 |
\stoptyping |
| 12697 |
|
| 12698 |
This prepends the token list that is provided. |
| 12699 |
|
| 12700 |
\stopnewprimitive |
| 12701 |
|
| 12702 |
\startoldprimitive[title={\prm {tolerance}}] |
| 12703 |
|
| 12704 |
When the par builder runs into a line with a badness larger than this value and |
| 12705 |
when \prm {emergencystretch} is set a third pass is enabled. In \LUAMETATEX\ we |
| 12706 |
can have more than one second pass and there are more parameters that influence |
| 12707 |
the process. |
| 12708 |
|
| 12709 |
\stopoldprimitive |
| 12710 |
|
| 12711 |
\startnewprimitive[title={\prm {tolerant}}] |
| 12712 |
|
| 12713 |
This prefix tags the following macro as being tolerant with respect to the |
| 12714 |
expected arguments. It only makes sense when delimited arguments are used or when |
| 12715 |
braces are mandate. |
| 12716 |
|
| 12717 |
\startbuffer |
| 12718 |
\tolerant\def\foo[#1]#*[#2]{(#1)(#2)} |
| 12719 |
\stopbuffer |
| 12720 |
|
| 12721 |
\typebuffer \getbuffer |
| 12722 |
|
| 12723 |
This definition makes \type {\foo} tolerant for various calls: |
| 12724 |
|
| 12725 |
\startbuffer |
| 12726 |
\foo \foo[1] \foo [1] \foo[1] [2] \foo [1] [2] |
| 12727 |
\stopbuffer |
| 12728 |
|
| 12729 |
\typebuffer |
| 12730 |
|
| 12731 |
these give: \inlinebuffer. The spaces after the first call disappear because the |
| 12732 |
macro name parser gobbles it, while in the second case the \type {#*} gobbles |
| 12733 |
them. Here is a variant: |
| 12734 |
|
| 12735 |
\startbuffer |
| 12736 |
\tolerant\def\foo[#1]#,[#2]{!#1!#2!} |
| 12737 |
|
| 12738 |
\foo[?] x |
| 12739 |
\foo[?] [?] x |
| 12740 |
|
| 12741 |
\tolerant\def\foo[#1]#*[#2]{!#1!#2!} |
| 12742 |
|
| 12743 |
\foo[?] x |
| 12744 |
\foo[?] [?] x |
| 12745 |
\stopbuffer |
| 12746 |
|
| 12747 |
\typebuffer |
| 12748 |
|
| 12749 |
We now get the following: |
| 12750 |
|
| 12751 |
\getbuffer |
| 12752 |
|
| 12753 |
Here the \type {#,} remembers that spaces were gobbles and they will be put back |
| 12754 |
when there is no further match. These are just a few examples of this tolerant |
| 12755 |
feature. More details can be found in the lowlevel manuals. |
| 12756 |
|
| 12757 |
\stopnewprimitive |
| 12758 |
|
| 12759 |
% \startnewprimitive[title={\prm {tolimitedfloat}}] |
| 12760 |
% \stopnewprimitive |
| 12761 |
|
| 12762 |
\startnewprimitive[title={\prm {tomathstyle}}] |
| 12763 |
|
| 12764 |
Internally math styles are numbers, where \prm {displaystyle} is \tomathstyle |
| 12765 |
\displaystyle \space and \prm {crampedscriptscriptstyle} is \tomathstyle |
| 12766 |
\crampedscriptscriptstyle. You can convert the verbose style to a number with |
| 12767 |
\prm {tomathstyle}. |
| 12768 |
|
| 12769 |
\stopnewprimitive |
| 12770 |
|
| 12771 |
\startoldprimitive[title={\prm {topmark}}][obsolete=yes] |
| 12772 |
|
| 12773 |
This is a reference to the last mark on the previous (split off) page, it gives |
| 12774 |
back tokens. |
| 12775 |
|
| 12776 |
\stopoldprimitive |
| 12777 |
|
| 12778 |
\startoldprimitive[title={\prm {topmarks}}] |
| 12779 |
|
| 12780 |
This is a reference to the last mark with the given id (a number) on the previous |
| 12781 |
page, it gives back tokens. |
| 12782 |
|
| 12783 |
\stopoldprimitive |
| 12784 |
|
| 12785 |
\startoldprimitive[title={\prm {topskip}}] |
| 12786 |
|
| 12787 |
This is the amount of glue that is added to the top of a (new) page. |
| 12788 |
|
| 12789 |
\stopoldprimitive |
| 12790 |
|
| 12791 |
\startnewprimitive[title={\prm {toscaled}}] |
| 12792 |
|
| 12793 |
\startbuffer |
| 12794 |
\scratchdimen = 1234pt \toscaled\scratchdimen |
| 12795 |
\stopbuffer |
| 12796 |
|
| 12797 |
The following code gives this: {\nospacing\inlinebuffer} is similar to \prm |
| 12798 |
{todimension} but omits the \type {pt} so that we don't need to revert to some |
| 12799 |
nasty stripping code. |
| 12800 |
|
| 12801 |
\typebuffer |
| 12802 |
|
| 12803 |
\stopnewprimitive |
| 12804 |
|
| 12805 |
\startnewprimitive[title={\prm {tosparsedimension}}] |
| 12806 |
|
| 12807 |
\startbuffer |
| 12808 |
\scratchdimen = 1234pt \tosparsedimension\scratchdimen |
| 12809 |
\stopbuffer |
| 12810 |
|
| 12811 |
The following code gives this: {\nospacing\inlinebuffer} where \quote {sparse} |
| 12812 |
indicates that redundant trailing zeros are not shown. |
| 12813 |
|
| 12814 |
\typebuffer |
| 12815 |
|
| 12816 |
\stopnewprimitive |
| 12817 |
|
| 12818 |
\startnewprimitive[title={\prm {tosparsescaled}}] |
| 12819 |
|
| 12820 |
\startbuffer |
| 12821 |
\scratchdimen = 1234pt \tosparsescaled\scratchdimen |
| 12822 |
\stopbuffer |
| 12823 |
|
| 12824 |
The following code gives this: {\nospacing\inlinebuffer} where \quote {sparse} |
| 12825 |
means that redundant trailing zeros are omitted. |
| 12826 |
|
| 12827 |
\typebuffer |
| 12828 |
|
| 12829 |
\stopnewprimitive |
| 12830 |
|
| 12831 |
\startnewprimitive[title={\prm {tpack}}] |
| 12832 |
|
| 12833 |
This primitive is like \prm {vtop} but without the callback overhead. |
| 12834 |
|
| 12835 |
\stopnewprimitive |
| 12836 |
|
| 12837 |
\startnewprimitive[title={\prm {tracingadjusts}}] |
| 12838 |
|
| 12839 |
In \LUAMETATEX\ the adjust feature has more functionality and also is carried |
| 12840 |
over. When set to a positive values \prm {vadjust} processing reports details. |
| 12841 |
The higher the number, the more you'll get. |
| 12842 |
|
| 12843 |
\stopnewprimitive |
| 12844 |
|
| 12845 |
\startnewprimitive[title={\prm {tracingalignments}}] |
| 12846 |
|
| 12847 |
When set to a positive value the alignment mechanism will keep you informed about |
| 12848 |
what is done in various stages. Higher values unleash more information, including |
| 12849 |
what callbacks kick in. |
| 12850 |
|
| 12851 |
\stopnewprimitive |
| 12852 |
|
| 12853 |
\startoldprimitive[title={\prm {tracingassigns}}] |
| 12854 |
|
| 12855 |
When set to a positive values assignments to parameters and variables are |
| 12856 |
reported on the console and|/|or in the log file. Because \LUAMETATEX\ avoids |
| 12857 |
redundant assignments these don't get reported. |
| 12858 |
|
| 12859 |
\stopoldprimitive |
| 12860 |
|
| 12861 |
\startnewprimitive[title={\prm {tracingbalancing}}] |
| 12862 |
|
| 12863 |
When set to a positive some insight in the balancing process is given, kind of |
| 12864 |
like with the par builder, so it can be noisy. |
| 12865 |
|
| 12866 |
\stopnewprimitive |
| 12867 |
|
| 12868 |
\startoldprimitive[title={\prm {tracingcommands}}] |
| 12869 |
|
| 12870 |
When set to a positive values the commands (primitives) are reported on the console |
| 12871 |
and|/|or in the log file. |
| 12872 |
|
| 12873 |
\stopoldprimitive |
| 12874 |
|
| 12875 |
\startnewprimitive[title={\prm {tracingexpressions}}] |
| 12876 |
|
| 12877 |
The extended expression commands like \prm {numexpression} and \prm |
| 12878 |
{dimexpression} can be traced by setting this parameter to a positive value. |
| 12879 |
|
| 12880 |
\stopnewprimitive |
| 12881 |
|
| 12882 |
\startnewprimitive[title={\prm {tracingfitness}}] |
| 12883 |
|
| 12884 |
Because we have more fitness classes we also have (need) a (bit) more detailed |
| 12885 |
tracing. |
| 12886 |
|
| 12887 |
\stopnewprimitive |
| 12888 |
|
| 12889 |
\startnewprimitive[title={\prm {tracingfullboxes}}] |
| 12890 |
|
| 12891 |
When set to a positive value the box will be shown in case of an overfull box. |
| 12892 |
When a quality callback is set this will not happen as all reporting is then |
| 12893 |
delegated. |
| 12894 |
|
| 12895 |
\stopnewprimitive |
| 12896 |
|
| 12897 |
\startoldprimitive[title={\prm {tracinggroups}}] |
| 12898 |
|
| 12899 |
When set to a positive values grouping is reported on the console and|/|or in the |
| 12900 |
log file. |
| 12901 |
|
| 12902 |
\stopoldprimitive |
| 12903 |
|
| 12904 |
\startnewprimitive[title={\prm {tracinghyphenation}}] |
| 12905 |
|
| 12906 |
When set to a positive values the hyphenation process is reported on the console |
| 12907 |
and|/|or in the log file. |
| 12908 |
|
| 12909 |
\stopnewprimitive |
| 12910 |
|
| 12911 |
\startoldprimitive[title={\prm {tracingifs}}] |
| 12912 |
|
| 12913 |
When set some details of what gets tested and what results are seen is reported. |
| 12914 |
|
| 12915 |
\stopoldprimitive |
| 12916 |
|
| 12917 |
\startnewprimitive[title={\prm {tracinginserts}}] |
| 12918 |
|
| 12919 |
A positive value enables tracing where values larger than~1 will report more |
| 12920 |
details. |
| 12921 |
|
| 12922 |
\stopnewprimitive |
| 12923 |
|
| 12924 |
\startnewprimitive[title={\prm {tracinglevels}}] |
| 12925 |
|
| 12926 |
The lines in a log file can be prefixed with some details, depending on the bits |
| 12927 |
set: |
| 12928 |
|
| 12929 |
\starttabulate[|T|l|] |
| 12930 |
\NC 0x1 \NC current group \NC \NR |
| 12931 |
\NC 0x2 \NC current input \NC \NR |
| 12932 |
\NC 0x4 \NC catcode table \NC \NR |
| 12933 |
\stoptabulate |
| 12934 |
|
| 12935 |
\stopnewprimitive |
| 12936 |
|
| 12937 |
\startnewprimitive[title={\prm {tracinglists}}] |
| 12938 |
|
| 12939 |
At various stages the lists being processed can be shown. This is mostly an |
| 12940 |
option for developers. |
| 12941 |
|
| 12942 |
\stopnewprimitive |
| 12943 |
|
| 12944 |
\startnewprimitive[title={\prm {tracingloners}}] |
| 12945 |
|
| 12946 |
With loners we mean \quote {widow} and \quote {club} lines. This tracer can be |
| 12947 |
handy when \prm {doublepenaltymode} is set and facing pages have different |
| 12948 |
penalty values. |
| 12949 |
|
| 12950 |
\stopnewprimitive |
| 12951 |
|
| 12952 |
\startnewprimitive[title={\prm {tracinglooseness}}] |
| 12953 |
|
| 12954 |
This tracer reports some details about the decision made towards a possible |
| 12955 |
loose result. |
| 12956 |
|
| 12957 |
\stopnewprimitive |
| 12958 |
|
| 12959 |
\startoldprimitive[title={\prm {tracinglostchars}}] |
| 12960 |
|
| 12961 |
When set to one characters not present in a font will be reported in the log |
| 12962 |
file, a value of two will also report this on the console. In \CONTEXT\ we use |
| 12963 |
the \type {missing_character} instead. Contrary to in \LUATEX\ values larger than |
| 12964 |
two have no special meaning and we don't error. |
| 12965 |
|
| 12966 |
\stopoldprimitive |
| 12967 |
|
| 12968 |
\startoldprimitive[title={\prm {tracingmacros}}] |
| 12969 |
|
| 12970 |
This parameter controls reporting of what macros are seen and expanded. |
| 12971 |
|
| 12972 |
\stopoldprimitive |
| 12973 |
|
| 12974 |
\startnewprimitive[title={\prm {tracingmarks}}] |
| 12975 |
|
| 12976 |
Marks are information blobs that track states that can be queried when a page is |
| 12977 |
handled over to the shipout routine. They travel through the system in a bit |
| 12978 |
different than traditionally: like like adjusts and inserts deeply buried ones |
| 12979 |
bubble up to outer level boxes. This parameters controls what progress gets |
| 12980 |
reported. |
| 12981 |
|
| 12982 |
\stopnewprimitive |
| 12983 |
|
| 12984 |
\startnewprimitive[title={\prm {tracingmath}}] |
| 12985 |
|
| 12986 |
The higher the value, the more information you will get about the various stages |
| 12987 |
in rendering math. Because tracing of nodes is rather verbose you need to know a |
| 12988 |
bit what this engine does. Conceptually there are differences between the |
| 12989 |
\LUAMETATEX\ and traditional engine, like more passes, inter-atom spacing, |
| 12990 |
different low level mechanisms. This feature is mostly meant for developers who |
| 12991 |
tweak the many available parameters. |
| 12992 |
|
| 12993 |
\stopnewprimitive |
| 12994 |
|
| 12995 |
\startnewprimitive[title={\prm {tracingmvl}}] |
| 12996 |
|
| 12997 |
When set to a positive value mvl switching is reported. |
| 12998 |
|
| 12999 |
\stopnewprimitive |
| 13000 |
|
| 13001 |
\startoldprimitive[title={\prm {tracingnesting}}] |
| 13002 |
|
| 13003 |
A positive value triggers log messages about the current level. |
| 13004 |
|
| 13005 |
\stopoldprimitive |
| 13006 |
|
| 13007 |
\startnewprimitive[title={\prm {tracingnodes}}] |
| 13008 |
|
| 13009 |
When set to a positive value more details about nodes (in boxes) will be |
| 13010 |
reported. Because this is also controlled by callbacks what gets reported is |
| 13011 |
macro package dependent. |
| 13012 |
|
| 13013 |
\stopnewprimitive |
| 13014 |
|
| 13015 |
\startoldprimitive[title={\prm {tracingonline}}] |
| 13016 |
|
| 13017 |
The engine has two output channels: the log file and the console and by default |
| 13018 |
most tracing (when enabled) goes to the log file. When this parameter is set to a |
| 13019 |
positive value tracing will also happen in the console. Messages from the \LUA\ |
| 13020 |
end can be channeled independently. |
| 13021 |
|
| 13022 |
\stopoldprimitive |
| 13023 |
|
| 13024 |
\startnewprimitive[title={\prm {tracingorphans}}] |
| 13025 |
|
| 13026 |
When set to a positive value handling of orphans is shown. |
| 13027 |
|
| 13028 |
\stopnewprimitive |
| 13029 |
|
| 13030 |
\startoldprimitive[title={\prm {tracingoutput}}] |
| 13031 |
|
| 13032 |
Values larger than zero result in some information about what gets passed to the |
| 13033 |
output routine. |
| 13034 |
|
| 13035 |
\stopoldprimitive |
| 13036 |
|
| 13037 |
\startoldprimitive[title={\prm {tracingpages}}] |
| 13038 |
|
| 13039 |
Values larger than one result in some information about the page building |
| 13040 |
process. In \LUAMETATEX\ there is more info for higher values. |
| 13041 |
|
| 13042 |
\stopoldprimitive |
| 13043 |
|
| 13044 |
\startoldprimitive[title={\prm {tracingparagraphs}}] |
| 13045 |
|
| 13046 |
Values larger than one result in some information about the par building process. |
| 13047 |
In \LUAMETATEX\ there is more info for higher values. |
| 13048 |
|
| 13049 |
\stopoldprimitive |
| 13050 |
|
| 13051 |
\startnewprimitive[title={\prm {tracingpasses}}] |
| 13052 |
|
| 13053 |
In \LUAMETATEX\ you can configure additional second stage par builder passes and |
| 13054 |
this parameter controls what gets reported on the console and|/|or in the log |
| 13055 |
file. |
| 13056 |
|
| 13057 |
\stopnewprimitive |
| 13058 |
|
| 13059 |
\startnewprimitive[title={\prm {tracingpenalties}}] |
| 13060 |
|
| 13061 |
This setting triggers reporting of actions due to special penalties in the |
| 13062 |
page builder. |
| 13063 |
|
| 13064 |
\stopnewprimitive |
| 13065 |
|
| 13066 |
\startoldprimitive[title={\prm {tracingrestores}}] |
| 13067 |
|
| 13068 |
When set to a positive values (re)assignments after grouping to parameters and |
| 13069 |
variables are reported on the console and|/|or in the log file. Because |
| 13070 |
\LUAMETATEX\ avoids redundant assignments these don't get reported. |
| 13071 |
|
| 13072 |
\stopoldprimitive |
| 13073 |
|
| 13074 |
\startoldprimitive[title={\prm {tracingstats}}] |
| 13075 |
|
| 13076 |
This parameter is a dummy in \LUAMETATEX. There are anyway some statistic |
| 13077 |
reported when the format is made but for a regular run it is up to the macro |
| 13078 |
package to come up with useful information. |
| 13079 |
|
| 13080 |
\stopoldprimitive |
| 13081 |
|
| 13082 |
\startnewprimitive[title={\prm {tracingtoddlers}}] |
| 13083 |
|
| 13084 |
When set to a positive value handling of toddlers is shown. |
| 13085 |
|
| 13086 |
\stopnewprimitive |
| 13087 |
|
| 13088 |
\startnewprimitive[title={\prm {tsplit}}] |
| 13089 |
|
| 13090 |
This splits like \prm {vsplit} but it returns a \prm {vtop} box instead. |
| 13091 |
|
| 13092 |
\stopnewprimitive |
| 13093 |
|
| 13094 |
\startoldprimitive[title={\prm {uccode}}] |
| 13095 |
|
| 13096 |
When the \prm {uppercase} operation is applied the uppercase code of a character |
| 13097 |
is used for the replacement. This primitive is used to set that code, so it |
| 13098 |
expects two character number. |
| 13099 |
|
| 13100 |
\stopoldprimitive |
| 13101 |
|
| 13102 |
\startoldprimitive[title={\prm {uchyph}}] |
| 13103 |
|
| 13104 |
When set to a positive number words that start with a capital will be hyphenated. |
| 13105 |
|
| 13106 |
\stopoldprimitive |
| 13107 |
|
| 13108 |
\startnewprimitive[title={\prm {uleaders}}] |
| 13109 |
|
| 13110 |
This leader adapts itself after a paragraph has been typeset. Here are a few |
| 13111 |
examples: |
| 13112 |
|
| 13113 |
\startbuffer |
| 13114 |
test \leaders \hbox {x}\hfill\ test |
| 13115 |
test \uleaders \hbox{x x x x}\hfill\ test |
| 13116 |
test \hbox{x x x x}\hskip 3cm plus 1cm\ test |
| 13117 |
test \uleaders \hbox{x x x x}\hskip 3cm plus 1cm\ test |
| 13118 |
\stopbuffer |
| 13119 |
|
| 13120 |
\typebuffer |
| 13121 |
|
| 13122 |
When an \prm {uleaders} is used the glue in the given box will be adapted to the |
| 13123 |
available space. |
| 13124 |
|
| 13125 |
\startlines \getbuffer \stoplines |
| 13126 |
|
| 13127 |
\startsetups adaptive:test |
| 13128 |
\setbox\usedadaptivebox\hbox to \usedadaptivewidth yoffset -\usedadaptivedepth \bgroup |
| 13129 |
\externalfigure |
| 13130 |
[cow.pdf] |
| 13131 |
[width=\usedadaptivewidth, |
| 13132 |
height=\dimexpr\usedadaptiveheight+\usedadaptivedepth\relax]% |
| 13133 |
\egroup |
| 13134 |
\stopsetups |
| 13135 |
|
| 13136 |
Optionally the \type {callback} followed by a number can be given, in which case |
| 13137 |
a callback kicks in that gets that the node, a group identifier, and the number |
| 13138 |
passed. It permits (for instance) adaptive graphics: \dostepwiserecurse {1} {100} {5} |
| 13139 |
{\hbox {#1=\romannumerals{#1}} {\adaptivebox [strut=yes, setups=adaptive:test]{}} }. |
| 13140 |
|
| 13141 |
These \prm {uleaders} can be used in horizontal and vertical mode so we give a few more |
| 13142 |
examples. |
| 13143 |
|
| 13144 |
\startbuffer |
| 13145 |
\unexpandedloop 1 30 1 {x \hbox{1 2 3} x } |
| 13146 |
\unexpandedloop 1 30 1 {x {\uleaders \hbox{1 2 3}\hskip 0pt plus 10pt minus 10pt\relax} x } |
| 13147 |
\unexpandedloop 1 30 1 {x {\uleaders \hbox{1 2 3}\hskip 0pt plus \interwordstretch minus \interwordshrink} x } |
| 13148 |
\unexpandedloop 1 30 1 {x {\uleaders \hbox{1 2 3}\hskip 0pt plus 2\interwordstretch minus 2\interwordshrink} x } |
| 13149 |
\stopbuffer |
| 13150 |
|
| 13151 |
\typebuffer |
| 13152 |
|
| 13153 |
This renders as: |
| 13154 |
|
| 13155 |
\startlines |
| 13156 |
\getbuffer |
| 13157 |
\stoplines |
| 13158 |
|
| 13159 |
It is clear that the flexibility of the box plays a role in the line break |
| 13160 |
calculations. But in the end the backend has to do the work which is why it's a |
| 13161 |
\quote {user} leader. Here is an example of a vertical one. Compare: |
| 13162 |
|
| 13163 |
\startbuffer[a] |
| 13164 |
{\green \hrule width \hsize} \par \vskip2pt |
| 13165 |
\vbox to 40pt { |
| 13166 |
{\red\hrule width \hsize} \par \vskip2pt |
| 13167 |
\vbox { |
| 13168 |
\vskip2pt {\blue\hrule width \hsize} \par |
| 13169 |
\vskip 10pt plus 10pt minus 10pt |
| 13170 |
{\blue\hrule width \hsize} \par \vskip2pt |
| 13171 |
} |
| 13172 |
\vskip2pt {\red\hrule width \hsize} \par |
| 13173 |
} |
| 13174 |
\vskip2pt {\green \hrule width \hsize} \par |
| 13175 |
\stopbuffer |
| 13176 |
|
| 13177 |
\startbuffer[b] |
| 13178 |
{\green \hrule width \hsize} \par \vskip2pt |
| 13179 |
\vbox to 40pt { |
| 13180 |
{\red\hrule width \hsize} \par \vskip2pt |
| 13181 |
\uleaders\vbox { |
| 13182 |
\vskip2pt {\blue\hrule width \hsize} \par |
| 13183 |
\vskip 10pt plus 10pt minus 10pt |
| 13184 |
{\blue\hrule width \hsize} \par \vskip2pt |
| 13185 |
}\vskip 0pt plus 10pt minus 10pt |
| 13186 |
\vskip2pt {\red\hrule width \hsize} \par |
| 13187 |
} |
| 13188 |
\vskip2pt {\green \hrule width \hsize} \par |
| 13189 |
\stopbuffer |
| 13190 |
|
| 13191 |
\typebuffer[a] |
| 13192 |
|
| 13193 |
with: |
| 13194 |
|
| 13195 |
\typebuffer[b] |
| 13196 |
|
| 13197 |
In the first case we get the this: |
| 13198 |
|
| 13199 |
\startlinecorrection |
| 13200 |
\getbuffer[a] |
| 13201 |
\stoplinecorrection |
| 13202 |
|
| 13203 |
but with \prm {uleaders} we get: |
| 13204 |
|
| 13205 |
\startlinecorrection |
| 13206 |
\normalizeparmode\zerocount |
| 13207 |
\getbuffer[b] |
| 13208 |
\stoplinecorrection |
| 13209 |
|
| 13210 |
or this: |
| 13211 |
|
| 13212 |
\startlinecorrection |
| 13213 |
\normalizeparmode"FF |
| 13214 |
\getbuffer[b] |
| 13215 |
\stoplinecorrection |
| 13216 |
|
| 13217 |
In the second case we flatten the leaders in the engine by setting the second bit |
| 13218 |
in the \prm {normalizeparmode} parameter (\type {0x2}). We actually do the same |
| 13219 |
with \prm {normalizelinemode} where bit 10 is set (\type {0x200}). The \type |
| 13220 |
{delay} keyword can be passed with a box to prevent flattening. If we don't do |
| 13221 |
this in the engine, the backend has to take care of it. In principle this permits |
| 13222 |
implementing variants in a macro package. Eventually there will be plenty examples in |
| 13223 |
the \CONTEXT\ code base and documentation. Till then, consider this experimental. |
| 13224 |
|
| 13225 |
\stopnewprimitive |
| 13226 |
|
| 13227 |
\startoldprimitive[title={\prm {unboundary}}] |
| 13228 |
|
| 13229 |
When possible a preceding boundary node will be removed. |
| 13230 |
|
| 13231 |
\stopoldprimitive |
| 13232 |
|
| 13233 |
\startnewprimitive[title={\prm {undent}}] |
| 13234 |
|
| 13235 |
When possible the already added indentation will be removed. |
| 13236 |
|
| 13237 |
\stopnewprimitive |
| 13238 |
|
| 13239 |
\startoldprimitive[title={\prm {underline}}] |
| 13240 |
|
| 13241 |
This is a math specific primitive that draws a line under the given content. It |
| 13242 |
is a poor mans replacement for a delimiter. The thickness is set with \prm |
| 13243 |
{Umathunderbarrule}, the distance between content and rule is set by \prm |
| 13244 |
{Umathunderbarvgap} and \prm {Umathunderbarkern} is added above the rule. The |
| 13245 |
style used for the content under the rule can be set with \prm |
| 13246 |
{Umathunderlinevariant}. See \prm {overline} for what these parameters do. |
| 13247 |
|
| 13248 |
\stopoldprimitive |
| 13249 |
|
| 13250 |
\startoldprimitive[title={\prm {unexpanded}}] |
| 13251 |
|
| 13252 |
This is an \ETEX\ enhancement. The content will not be expanded in a context |
| 13253 |
where expansion is happening, like in an \prm {edef}. In \CONTEXT\ you need to |
| 13254 |
use \prm {normalunexpanded} because we already had a macro with that name. |
| 13255 |
|
| 13256 |
\startbuffer |
| 13257 |
\def \A{!} \meaning\A |
| 13258 |
\def \B{?} \meaning\B |
| 13259 |
\edef\C{\A\B} \meaning\C |
| 13260 |
\edef\C{\normalunexpanded{\A}\B} \meaning\C |
| 13261 |
\stopbuffer |
| 13262 |
|
| 13263 |
\typebuffer |
| 13264 |
|
| 13265 |
\startlines \tttf \getbuffer \stoplines |
| 13266 |
|
| 13267 |
\stopoldprimitive |
| 13268 |
|
| 13269 |
\startnewprimitive[title={\prm {unexpandedendless}}] |
| 13270 |
|
| 13271 |
This one loops forever so you need to quit explicitly. |
| 13272 |
|
| 13273 |
\stopnewprimitive |
| 13274 |
|
| 13275 |
\startnewprimitive[title={\prm {unexpandedloop}}] |
| 13276 |
|
| 13277 |
As follow up on \prm {expandedloop} we now show its counterpart: |
| 13278 |
|
| 13279 |
\startbuffer |
| 13280 |
\edef\whatever |
| 13281 |
{\unexpandedloop 1 10 1 |
| 13282 |
{\scratchcounter=\the\currentloopiterator\relax}} |
| 13283 |
|
| 13284 |
\meaningasis\whatever |
| 13285 |
\stopbuffer |
| 13286 |
|
| 13287 |
\typebuffer |
| 13288 |
|
| 13289 |
\start \veryraggedright \tt\tfx \getbuffer \stop \blank |
| 13290 |
|
| 13291 |
The difference between the (un)expanded loops and a local controlled |
| 13292 |
one is shown here. Watch the out of order injection of \type {A}'s. |
| 13293 |
|
| 13294 |
\startbuffer |
| 13295 |
\edef\TestA{\localcontrolledloop 1 5 1 {A}} % out of order |
| 13296 |
\edef\TestB{\expandedloop 1 5 1 {B}} |
| 13297 |
\edef\TestC{\unexpandedloop 1 5 1 {C\relax}} |
| 13298 |
\stopbuffer |
| 13299 |
|
| 13300 |
\typebuffer \getbuffer |
| 13301 |
|
| 13302 |
We show the effective definition as well as the outcome of using them |
| 13303 |
|
| 13304 |
\startbuffer |
| 13305 |
\meaningasis\TestA |
| 13306 |
\meaningasis\TestB |
| 13307 |
\meaningasis\TestC |
| 13308 |
|
| 13309 |
A: \TestA |
| 13310 |
B: \TestB |
| 13311 |
C: \TestC |
| 13312 |
\stopbuffer |
| 13313 |
|
| 13314 |
\typebuffer \startlines \tttf \getbuffer \stoplines |
| 13315 |
|
| 13316 |
Watch how because it is empty \type {\TestA} has become a constant macro because |
| 13317 |
that's what deep down empty boils down to. |
| 13318 |
|
| 13319 |
\stopnewprimitive |
| 13320 |
|
| 13321 |
\startnewprimitive[title={\prm {unexpandedrepeat}}] |
| 13322 |
|
| 13323 |
This one takes one instead of three arguments which looks better in simple loops. |
| 13324 |
|
| 13325 |
\stopnewprimitive |
| 13326 |
|
| 13327 |
\startoldprimitive[title={\prm {unhbox}}] |
| 13328 |
|
| 13329 |
A box is a packaged list and once packed travels through the system as a single |
| 13330 |
object with properties, like dimensions. This primitive injects the original list |
| 13331 |
and discards the wrapper. |
| 13332 |
|
| 13333 |
\stopoldprimitive |
| 13334 |
|
| 13335 |
\startoldprimitive[title={\prm {unhcopy}}] |
| 13336 |
|
| 13337 |
This is like \prm {unhbox} but keeps the original. It is one of the more costly |
| 13338 |
operations. |
| 13339 |
|
| 13340 |
\stopoldprimitive |
| 13341 |
|
| 13342 |
\startnewprimitive[title={\prm {unhpack}}] |
| 13343 |
|
| 13344 |
This primitive is like \prm {unhbox} but without the callback overhead. |
| 13345 |
|
| 13346 |
\stopnewprimitive |
| 13347 |
|
| 13348 |
\startoldprimitive[title={\prm {unkern}}] |
| 13349 |
|
| 13350 |
This removes the last kern, if possible. |
| 13351 |
|
| 13352 |
\stopoldprimitive |
| 13353 |
|
| 13354 |
\startoldprimitive[title={\prm {unless}}] |
| 13355 |
|
| 13356 |
This \ETEX\ prefix will negate the test (when applicable). |
| 13357 |
|
| 13358 |
\starttyping |
| 13359 |
\ifx\one\two YES\else NO\fi |
| 13360 |
\unless\ifx\one\two NO\else YES\fi |
| 13361 |
\stoptyping |
| 13362 |
|
| 13363 |
This primitive is hardly used in \CONTEXT\ and we probably could get rid of these |
| 13364 |
few cases. |
| 13365 |
|
| 13366 |
\stopoldprimitive |
| 13367 |
|
| 13368 |
\startnewprimitive[title={\prm {unletfrozen}}] |
| 13369 |
|
| 13370 |
A frozen macro cannot be redefined: you get an error. But as nothing in \TEX\ is set |
| 13371 |
in stone, you can do this: |
| 13372 |
|
| 13373 |
\starttyping |
| 13374 |
\frozen\def\MyMacro{...} |
| 13375 |
\unletfrozen\MyMacro |
| 13376 |
\stoptyping |
| 13377 |
|
| 13378 |
and \type {\MyMacro} is no longer protected from overloading. It is still |
| 13379 |
undecided to what extend \CONTEXT\ will use this feature. |
| 13380 |
|
| 13381 |
\stopnewprimitive |
| 13382 |
|
| 13383 |
\startnewprimitive[title={\prm {unletprotected}}] |
| 13384 |
|
| 13385 |
The complementary operation of \prm {letprotected} can be used to unprotect |
| 13386 |
a macro, so that it gets expandable. |
| 13387 |
|
| 13388 |
\startbuffer |
| 13389 |
\def \MyMacroA{alpha} |
| 13390 |
\protected \def \MyMacroB{beta} |
| 13391 |
\edef \MyMacroC{\MyMacroA\MyMacroB} |
| 13392 |
\unletprotected \MyMacroB |
| 13393 |
\edef \MyMacroD{\MyMacroA\MyMacroB} |
| 13394 |
\meaning \MyMacroC\crlf |
| 13395 |
\meaning \MyMacroD\par |
| 13396 |
\stopbuffer |
| 13397 |
|
| 13398 |
\typebuffer |
| 13399 |
|
| 13400 |
Compare this with the example in the previous section: |
| 13401 |
|
| 13402 |
{\tttf \getbuffer} |
| 13403 |
|
| 13404 |
\stopnewprimitive |
| 13405 |
|
| 13406 |
\startoldprimitive[title={\prm {unpenalty}}] |
| 13407 |
|
| 13408 |
This removes the last penalty, if possible. |
| 13409 |
|
| 13410 |
\stopoldprimitive |
| 13411 |
|
| 13412 |
\startoldprimitive[title={\prm {unskip}}] |
| 13413 |
|
| 13414 |
This removes the last glue, if possible. |
| 13415 |
|
| 13416 |
\stopoldprimitive |
| 13417 |
|
| 13418 |
\startnewprimitive[title={\prm {untraced}}] |
| 13419 |
|
| 13420 |
Related to the meaning providers is the \prm {untraced} prefix. It marks a macro |
| 13421 |
as to be reported by name only. It makes the macro look like a primitive. |
| 13422 |
|
| 13423 |
\starttyping |
| 13424 |
\def\foo{} |
| 13425 |
\untraced\def\oof{} |
| 13426 |
|
| 13427 |
\scratchtoks{\foo\foo\oof\oof} |
| 13428 |
|
| 13429 |
\tracingall \the\scratchtoks \tracingnone |
| 13430 |
\stoptyping |
| 13431 |
|
| 13432 |
This will show up in the log as follows: |
| 13433 |
|
| 13434 |
\starttyping |
| 13435 |
1:4: {\the} |
| 13436 |
1:5: \foo -> |
| 13437 |
1:5: \foo -> |
| 13438 |
1:5: \oof |
| 13439 |
1:5: \oof |
| 13440 |
\stoptyping |
| 13441 |
|
| 13442 |
This is again a trick to avoid too much clutter in a log. Often it doesn't matter |
| 13443 |
to users what the meaning of a macro is (if they trace at all). \footnote {An |
| 13444 |
earlier variant could also hide the expansion completely but that was just |
| 13445 |
confusing.} |
| 13446 |
|
| 13447 |
\stopnewprimitive |
| 13448 |
|
| 13449 |
\startoldprimitive[title={\prm {unvbox}}] |
| 13450 |
|
| 13451 |
A box is a packaged list and once packed travels through the system as a single |
| 13452 |
object with properties, like dimensions. This primitive injects the original list |
| 13453 |
and discards the wrapper. |
| 13454 |
|
| 13455 |
\stopoldprimitive |
| 13456 |
|
| 13457 |
\startoldprimitive[title={\prm {unvcopy}}] |
| 13458 |
|
| 13459 |
This is like \prm {unvbox} but keeps the original. It is one of the more costly |
| 13460 |
operations. |
| 13461 |
|
| 13462 |
\stopoldprimitive |
| 13463 |
|
| 13464 |
\startnewprimitive[title={\prm {unvpack}}] |
| 13465 |
|
| 13466 |
This primitive is like \prm {unvbox} but without the callback overhead. |
| 13467 |
|
| 13468 |
\stopnewprimitive |
| 13469 |
|
| 13470 |
\startoldprimitive[title={\prm {uppercase}}] |
| 13471 |
|
| 13472 |
See its counterpart \prm {lowercase} for an explanation. |
| 13473 |
|
| 13474 |
\stopoldprimitive |
| 13475 |
|
| 13476 |
\startoldprimitive[title={\prm {vadjust}}] |
| 13477 |
|
| 13478 |
This injects a node that stores material that will injected before or after the |
| 13479 |
line where it has become part of. In \LUAMETATEX\ there are more features, driven |
| 13480 |
by keywords. |
| 13481 |
|
| 13482 |
\stopoldprimitive |
| 13483 |
|
| 13484 |
\startoldprimitive[title={\prm {valign}}] |
| 13485 |
|
| 13486 |
This command starts vertically aligned material. Its counterpart \prm {halign} is |
| 13487 |
used more frequently. Most macro packages provide wrappers around these commands. |
| 13488 |
First one specifies a preamble which is then followed by entries (rows and |
| 13489 |
columns). |
| 13490 |
|
| 13491 |
\stopoldprimitive |
| 13492 |
|
| 13493 |
\startnewprimitive[title={\prm {variablefam}}] |
| 13494 |
|
| 13495 |
In traditional \TEX\ sets the family of what are considered variables (class 7) |
| 13496 |
to the current family (which often means that they adapt to the current alphabet) |
| 13497 |
and then injects a math character of class ordinary. This parameter can be used |
| 13498 |
to obey the given class when the family set for a character is the same as this |
| 13499 |
parameter. So we then use the given class with the current family. It is mostly |
| 13500 |
there for compatibility with \LUATEX\ and experimenting (outside \CONTEXT). |
| 13501 |
|
| 13502 |
\stopnewprimitive |
| 13503 |
|
| 13504 |
\startoldprimitive[title={\prm {vbadness}}] |
| 13505 |
|
| 13506 |
This sets the threshold for reporting a (vertical) badness value, its current |
| 13507 |
value is \the \badness. |
| 13508 |
|
| 13509 |
\stopoldprimitive |
| 13510 |
|
| 13511 |
\startnewprimitive[title={\prm {vbadnessmode}}] |
| 13512 |
|
| 13513 |
This parameter determines what gets reported when the (in the vertical packer) |
| 13514 |
badness exceeds some limit. The current value of this bitset is {\tt |
| 13515 |
"\tohexadecimal \vbadnessmode}. |
| 13516 |
|
| 13517 |
\startfourrows |
| 13518 |
\getbuffer[engine:syntax:badnessmodecodes] |
| 13519 |
\stopfourrows |
| 13520 |
|
| 13521 |
\stopnewprimitive |
| 13522 |
|
| 13523 |
\startnewprimitive[title={\prm {vbalance}}] |
| 13524 |
|
| 13525 |
In addition to the page builder and vbox splitter we have what's called a |
| 13526 |
balancer. This routine splits a vertical list in pieces (slots) according to a |
| 13527 |
specification (see \typ {\balanceshape}). It can do so in multiple passes (see |
| 13528 |
\typ {\balancepasses}). The balancing \quote {framework} operates independently |
| 13529 |
from the page builder and vsplitter. |
| 13530 |
|
| 13531 |
Because there are multiple primitives involved and because one will normally |
| 13532 |
write decent wrapper, wd delegate a more detailed explanation to a \CONTEXT\ low |
| 13533 |
level manual. |
| 13534 |
|
| 13535 |
\startbuffer |
| 13536 |
\setbox 0 \vbox\bgroup \hsize 10em |
| 13537 |
line 1\par line 2\par line 3\par |
| 13538 |
line 4\par line 5\par line 6\par |
| 13539 |
line 7\par line 8\par |
| 13540 |
\egroup |
| 13541 |
\balancetopskip \strutht |
| 13542 |
\balancebottomskip \strutht |
| 13543 |
\balancevsize 3\lineheight |
| 13544 |
\balancetolerance 100 |
| 13545 |
\balanceemergencystretch 0pt |
| 13546 |
\setbox 2 \vbalance 0 |
| 13547 |
\hbox \bgroup |
| 13548 |
\vbalancedbox 2 \hskip2em |
| 13549 |
\vbalancedbox 2 \hskip2em |
| 13550 |
\vbalancedbox 2 |
| 13551 |
\egroup |
| 13552 |
\stopbuffer |
| 13553 |
|
| 13554 |
\typebuffer |
| 13555 |
|
| 13556 |
Here we use a simple specification (no shape). The balancer does a whole list |
| 13557 |
optimization so it does honor penalties and works with some tolerance too. |
| 13558 |
Decisions are made on badness and demerits. Like the par builder you can get |
| 13559 |
overfull slots so in practice one might rebalance with different specifications |
| 13560 |
if that happens. |
| 13561 |
|
| 13562 |
The results are collected in a box (in this example box register 2) which destroys the |
| 13563 |
original. With |
| 13564 |
|
| 13565 |
\starttyping |
| 13566 |
\setbox 2 \vbalance trial 0 |
| 13567 |
\stoptyping |
| 13568 |
|
| 13569 |
we keep the original and the result will have empty boxes with the dimensions of |
| 13570 |
the slots. You can loop over the result and check the real height with \typ |
| 13571 |
{\balanceshapevsize}. |
| 13572 |
|
| 13573 |
\getbuffer |
| 13574 |
|
| 13575 |
\stopnewprimitive |
| 13576 |
|
| 13577 |
\startnewprimitive[title={\prm {vbalancedbox}}] |
| 13578 |
|
| 13579 |
This command take the topmost balanced slot from the given balanced box and wraps |
| 13580 |
it in a \type {\vbox}. When there is is no more to fetch the result is void. |
| 13581 |
|
| 13582 |
\stopnewprimitive |
| 13583 |
|
| 13584 |
\startnewprimitive[title={\prm {vbalanceddeinsert}}] |
| 13585 |
|
| 13586 |
This will convert the inserts in the given balancing result into a form that is |
| 13587 |
useable for the balancer. This is not mandate but needed if you want split |
| 13588 |
insertions. The keyword \type {descend} will locate the relevant box and \type |
| 13589 |
{forcedepth} will make sure that we get constant depths (but expects \prm |
| 13590 |
{insertlinedepth} being set. |
| 13591 |
|
| 13592 |
\stopnewprimitive |
| 13593 |
|
| 13594 |
\startnewprimitive[title={\prm {vbalanceddiscard}}] |
| 13595 |
|
| 13596 |
One of the features of balancing is that we can can have discardable content at |
| 13597 |
the top and|/|or bottom of slots. This primitive will remove discarded content |
| 13598 |
from the given result of \type {\vbalance}, like: |
| 13599 |
|
| 13600 |
\starttyping |
| 13601 |
\setbox 2 \vbalance 0 |
| 13602 |
\vbalanceddiscard 2 |
| 13603 |
\stoptyping |
| 13604 |
|
| 13605 |
\stopnewprimitive |
| 13606 |
|
| 13607 |
\startnewprimitive[title={\prm {vbalancedinsert}}] |
| 13608 |
|
| 13609 |
This one fetches the inserts from a balanced slot result. This happens per insert |
| 13610 |
class. |
| 13611 |
|
| 13612 |
\starttyping |
| 13613 |
\setbox 4 \vbalancedinsert 2 4 |
| 13614 |
\stoptyping |
| 13615 |
|
| 13616 |
Instead you can give: |
| 13617 |
|
| 13618 |
\starttyping |
| 13619 |
\setbox 4 \vbalancedinsert 2 index 4 descend \relax |
| 13620 |
\stoptyping |
| 13621 |
|
| 13622 |
Here \type {descend} will locate the relevant slot box which is handy in case one |
| 13623 |
already wrapped the result in a box. |
| 13624 |
|
| 13625 |
\stopnewprimitive |
| 13626 |
|
| 13627 |
\startnewprimitive[title={\prm {vbalancedreinsert}}] |
| 13628 |
|
| 13629 |
This will convert the inserts in the given balancing slot result into a more |
| 13630 |
original form, assumign that \prm {vbalanceddeinsert} was applied.. This is not |
| 13631 |
mandate and depends on what is expected further down the line (read: this is |
| 13632 |
macro package specific). You can use the keyword \type {descend} to locate the |
| 13633 |
relevant slot box. |
| 13634 |
|
| 13635 |
\stopnewprimitive |
| 13636 |
|
| 13637 |
\startnewprimitive[title={\prm {vbalancedtop}}] |
| 13638 |
|
| 13639 |
This command take the topmost balanced slot from the given balanced box and wraps |
| 13640 |
it in a \type {\vbox}. When there is is no more to fetch the result is void. |
| 13641 |
|
| 13642 |
\stopnewprimitive |
| 13643 |
|
| 13644 |
\startoldprimitive[title={\prm {vbox}}] |
| 13645 |
|
| 13646 |
This creates a vertical box. In the process callbacks can be triggered that can |
| 13647 |
preprocess the content, influence line breaking as well as assembling the |
| 13648 |
resulting paragraph. More can be found in dedicated manuals. The baseline is |
| 13649 |
at the bottom. |
| 13650 |
|
| 13651 |
\stopoldprimitive |
| 13652 |
|
| 13653 |
\startoldprimitive[title={\prm {vcenter}}] |
| 13654 |
|
| 13655 |
In traditional \TEX\ this box packer is only permitted in math mode but in |
| 13656 |
\LUAMETATEX\ it also works in text mode. The content is centered in the vertical |
| 13657 |
box. |
| 13658 |
|
| 13659 |
\stopoldprimitive |
| 13660 |
|
| 13661 |
\startoldprimitive[title={\prm {vfil}}] |
| 13662 |
|
| 13663 |
This is a shortcut for \typ {\vskip plus 1 fil} (first order filler). |
| 13664 |
|
| 13665 |
\stopoldprimitive |
| 13666 |
|
| 13667 |
\startoldprimitive[title={\prm {vfill}}] |
| 13668 |
|
| 13669 |
This is a shortcut for \typ {\vskip plus 1 fill} (second order filler). |
| 13670 |
|
| 13671 |
\stopoldprimitive |
| 13672 |
|
| 13673 |
\startoldprimitive[title={\prm {vfilneg}}] |
| 13674 |
|
| 13675 |
This is a shortcut for \typ {\vskip plus - 1 fil} so it can compensate \prm |
| 13676 |
{vfil}. |
| 13677 |
|
| 13678 |
\stopoldprimitive |
| 13679 |
|
| 13680 |
\startoldprimitive[title={\prm {vfuzz}}] |
| 13681 |
|
| 13682 |
This dimension sets the threshold for reporting vertical boxes that are under- or |
| 13683 |
overfull. The current value is \the \vfuzz. |
| 13684 |
|
| 13685 |
\stopoldprimitive |
| 13686 |
|
| 13687 |
\startnewprimitive[title={\prm {virtualhrule}}] |
| 13688 |
|
| 13689 |
This is a horizontal rule with zero dimensions from the perspective of the |
| 13690 |
frontend but the backend can access them as set. |
| 13691 |
|
| 13692 |
\stopnewprimitive |
| 13693 |
|
| 13694 |
\startnewprimitive[title={\prm {virtualvrule}}] |
| 13695 |
|
| 13696 |
This is a vertical rule with zero dimensions from the perspective of the frontend |
| 13697 |
but the backend can access them as set. |
| 13698 |
|
| 13699 |
\stopnewprimitive |
| 13700 |
|
| 13701 |
\startoldprimitive[title={\prm {vkern}}] |
| 13702 |
|
| 13703 |
This primitive is like \prm {kern} but will force the engine into vertical mode |
| 13704 |
if it isn't yet. |
| 13705 |
|
| 13706 |
\stopoldprimitive |
| 13707 |
|
| 13708 |
\startnewprimitive[title={\prm {vpack}}] |
| 13709 |
|
| 13710 |
This primitive is like \prm {vbox} but without the callback overhead. |
| 13711 |
|
| 13712 |
\stopnewprimitive |
| 13713 |
|
| 13714 |
\startnewprimitive[title={\prm {vpenalty}}] |
| 13715 |
|
| 13716 |
This primitive is like \prm {penalty} but will force the engine into vertical |
| 13717 |
mode if it isn't yet. |
| 13718 |
|
| 13719 |
\stopnewprimitive |
| 13720 |
|
| 13721 |
\startoldprimitive[title={\prm {vrule}}] |
| 13722 |
|
| 13723 |
This creates a vertical rule. Unless the height and depth are set they will |
| 13724 |
stretch to fix the available space. In addition to the traditional \type {width}, |
| 13725 |
\type {height} and \type {depth} specifiers some more are accepted. These are |
| 13726 |
discussed in other manuals. See \prm {hrule} for a simple example. |
| 13727 |
|
| 13728 |
\stopoldprimitive |
| 13729 |
|
| 13730 |
\startoldprimitive[title={\prm {vsize}}] |
| 13731 |
|
| 13732 |
This sets (or gets) the current vertical size. While setting the \prm {hsize} |
| 13733 |
inside a \prm {vbox} has consequences, setting the \prm {vsize} mostly makes |
| 13734 |
sense at the outer level (the page). |
| 13735 |
|
| 13736 |
\stopoldprimitive |
| 13737 |
|
| 13738 |
\startoldprimitive[title={\prm {vskip}}] |
| 13739 |
|
| 13740 |
The given glue is injected in the vertical list. If possible vertical mode is |
| 13741 |
entered. |
| 13742 |
|
| 13743 |
\stopoldprimitive |
| 13744 |
|
| 13745 |
\startoldprimitive[title={\prm {vsplit}}] |
| 13746 |
|
| 13747 |
This operator splits a given amount from a vertical box. In \LUAMETATEX\ we can |
| 13748 |
split \type {to} but also \type {upto}, so that we don't have to repack the |
| 13749 |
result in order to see how much is actually in there. |
| 13750 |
|
| 13751 |
\stopoldprimitive |
| 13752 |
|
| 13753 |
\startnewprimitive[title={\prm {vsplitchecks}}] |
| 13754 |
|
| 13755 |
This parameter is passed to the \type {show_vsplit} callback. |
| 13756 |
|
| 13757 |
\stopnewprimitive |
| 13758 |
|
| 13759 |
\startoldprimitive[title={\prm {vss}}] |
| 13760 |
|
| 13761 |
This is the vertical variant of \prm {hss}. See there for what it means. |
| 13762 |
|
| 13763 |
\stopoldprimitive |
| 13764 |
|
| 13765 |
\startoldprimitive[title={\prm {vtop}}] |
| 13766 |
|
| 13767 |
This creates a vertical box. In the process callbacks can be triggered that can |
| 13768 |
preprocess the content, influence line breaking as well as assembling the |
| 13769 |
resulting paragraph. More can be found in dedicated manuals. The baseline is |
| 13770 |
at the top. |
| 13771 |
|
| 13772 |
\stopoldprimitive |
| 13773 |
|
| 13774 |
\startoldprimitive[title={\prm {wd}}] |
| 13775 |
|
| 13776 |
Returns the width of the given box. |
| 13777 |
|
| 13778 |
\stopoldprimitive |
| 13779 |
|
| 13780 |
\startoldprimitive[title={\prm {widowpenalties}}] |
| 13781 |
|
| 13782 |
This is an array of penalty put before the last lines in a paragraph. High values |
| 13783 |
discourage (or even prevent) a lone line at the beginning of a next page. This |
| 13784 |
command expects a count value indicating the number of entries that will follow. |
| 13785 |
The first entry is ends up before the last line. |
| 13786 |
|
| 13787 |
\stopoldprimitive |
| 13788 |
|
| 13789 |
\startoldprimitive[title={\prm {widowpenalty}}] |
| 13790 |
|
| 13791 |
This is the penalty put before a widow line in a paragraph. High values |
| 13792 |
discourage (or even prevent) a lone line at the beginning of a next page. |
| 13793 |
|
| 13794 |
\stopoldprimitive |
| 13795 |
|
| 13796 |
\startnewprimitive[title={\prm {wordboundary}}] |
| 13797 |
|
| 13798 |
The hypenation routine has to decide where a word begins and ends. If you want to |
| 13799 |
make sure that there is a proper begin or end of a word you can inject this |
| 13800 |
boundary. |
| 13801 |
|
| 13802 |
\stopnewprimitive |
| 13803 |
|
| 13804 |
\startnewprimitive[title={\prm {wrapuppar}}] |
| 13805 |
|
| 13806 |
What this primitive does can best be shown with an example: |
| 13807 |
|
| 13808 |
\startbuffer |
| 13809 |
some text\wrapuppar{one} and some\wrapuppar{two} more |
| 13810 |
\stopbuffer |
| 13811 |
|
| 13812 |
\typebuffer |
| 13813 |
|
| 13814 |
We get: |
| 13815 |
|
| 13816 |
\blank \getbuffer \blank |
| 13817 |
|
| 13818 |
So, it is a complementary command to \prm {everypar}. It can only be issued |
| 13819 |
inside a paragraph. |
| 13820 |
|
| 13821 |
\stopnewprimitive |
| 13822 |
|
| 13823 |
\startoldprimitive[title={\prm {xdef}}] |
| 13824 |
|
| 13825 |
This is an alternative for \type {\global \edef}: |
| 13826 |
|
| 13827 |
\starttyping |
| 13828 |
\xdef\MyMacro{...} |
| 13829 |
\stoptyping |
| 13830 |
|
| 13831 |
\stopoldprimitive |
| 13832 |
|
| 13833 |
\startnewprimitive[title={\prm {xdefcsname}}] |
| 13834 |
|
| 13835 |
This is the companion of \prm {xdef}: |
| 13836 |
|
| 13837 |
\starttyping |
| 13838 |
\expandafter\xdef\csname MyMacro:1\endcsname{...} |
| 13839 |
\xdefcsname MyMacro:1\endcsname{...} |
| 13840 |
\stoptyping |
| 13841 |
|
| 13842 |
\stopnewprimitive |
| 13843 |
|
| 13844 |
\startoldprimitive[title={\prm {xleaders}}] |
| 13845 |
|
| 13846 |
See \prm {gleaders} for an explanation. |
| 13847 |
|
| 13848 |
\stopoldprimitive |
| 13849 |
|
| 13850 |
\startoldprimitive[title={\prm {xspaceskip}}] |
| 13851 |
|
| 13852 |
Normally the glue inserted when a space is encountered after a character with a |
| 13853 |
space factor other than 1000 is taken from the font (fontdimen 7) unless this |
| 13854 |
parameter is set in which case its value is added. |
| 13855 |
|
| 13856 |
\stopoldprimitive |
| 13857 |
|
| 13858 |
\startnewprimitive[title={\prm {xtoks}}] |
| 13859 |
|
| 13860 |
This is the global variant of \prm {etoks}. |
| 13861 |
|
| 13862 |
\stopnewprimitive |
| 13863 |
|
| 13864 |
\startnewprimitive[title={\prm {xtoksapp}}] |
| 13865 |
|
| 13866 |
This is the global variant of \prm {etoksapp}. |
| 13867 |
|
| 13868 |
\stopnewprimitive |
| 13869 |
|
| 13870 |
\startnewprimitive[title={\prm {xtokspre}}] |
| 13871 |
|
| 13872 |
This is the global variant of \prm {etokspre}. |
| 13873 |
|
| 13874 |
\stopnewprimitive |
| 13875 |
|
| 13876 |
\startoldprimitive[title={\prm {year}}] |
| 13877 |
|
| 13878 |
This internal number starts out with the year that the job started. |
| 13879 |
|
| 13880 |
\stopoldprimitive |
| 13881 |
|
| 13882 |
\stopsection |
| 13883 |
|
| 13884 |
\glet\foo\relax |
| 13885 |
|
| 13886 |
\page |
| 13887 |
|
| 13888 |
\startsection[title=Syntax] |
| 13889 |
|
| 13890 |
\startpagecolumns[page=no] |
| 13891 |
\startluacode |
| 13892 |
moduledata.engine.allspecifications() |
| 13893 |
\stopluacode |
| 13894 |
\stoppagecolumns |
| 13895 |
|
| 13896 |
\stopsection |
| 13897 |
|
| 13898 |
\page |
| 13899 |
|
| 13900 |
\startluacode |
| 13901 |
local match = string.match |
| 13902 |
local find = string.match |
| 13903 |
|
| 13904 |
local luatex_code <const> = 4 -- use symbolic instead |
| 13905 |
local luametatex_code <const> = 8 -- use symbolic instead |
| 13906 |
|
| 13907 |
function document.CheckCompleteness() |
| 13908 |
local primitives = token.getprimitives() |
| 13909 |
local luametatex = { } |
| 13910 |
local indexed = { } |
| 13911 |
local everything = { } |
| 13912 |
|
| 13913 |
for i=1,#primitives do |
| 13914 |
local prim = primitives[i] |
| 13915 |
local name = prim[3] |
| 13916 |
local what = prim[4] |
| 13917 |
if not name then |
| 13918 |
print("no name, case 1") |
| 13919 |
elseif what == luatex_code or what == luametatex_code then |
| 13920 |
if find(name,"U") or find(name,"math") then |
| 13921 |
-- ignore |
| 13922 |
luametatex[name] = nil |
| 13923 |
everything[name] = false |
| 13924 |
else |
| 13925 |
luametatex[name] = false |
| 13926 |
end |
| 13927 |
else |
| 13928 |
everything[name] = true |
| 13929 |
end |
| 13930 |
end |
| 13931 |
|
| 13932 |
local function collect(index) |
| 13933 |
if index then |
| 13934 |
local data = index.entries |
| 13935 |
for i=1,#data do |
| 13936 |
local name = match(data[i].list[1][1],"\\tex%s*{(.-)}") or "" |
| 13937 |
if name then |
| 13938 |
if luametatex[name] == false then |
| 13939 |
luametatex[name] = true |
| 13940 |
end |
| 13941 |
indexed[name] = true |
| 13942 |
everything[name] = nil |
| 13943 |
else |
| 13944 |
print("no name, case 2") |
| 13945 |
end |
| 13946 |
end |
| 13947 |
end |
| 13948 |
end |
| 13949 |
|
| 13950 |
collect(structures.registers.collected and structures.registers.collected.index) |
| 13951 |
|
| 13952 |
context.startsection { title = "To be checked primitives (new)" } |
| 13953 |
|
| 13954 |
context.blank() |
| 13955 |
context.startcolumns() |
| 13956 |
-- context.starttworows() |
| 13957 |
for k, v in table.sortedhash(luametatex) do |
| 13958 |
if not v then |
| 13959 |
context.dontleavehmode() |
| 13960 |
context.type(k) |
| 13961 |
context.crlf() |
| 13962 |
end |
| 13963 |
end |
| 13964 |
-- context.stoptworows() |
| 13965 |
context.stopcolumns() |
| 13966 |
|
| 13967 |
context.page() |
| 13968 |
|
| 13969 |
context.stopsection() |
| 13970 |
|
| 13971 |
everything[""] = nil |
| 13972 |
everything[" "] = nil |
| 13973 |
|
| 13974 |
context.startsection { title = "To be checked primitives (math)" } |
| 13975 |
|
| 13976 |
context.blank() |
| 13977 |
context.startcolumns() |
| 13978 |
-- context.starttworows() |
| 13979 |
for k, v in table.sortedhash(everything) do |
| 13980 |
if not v then |
| 13981 |
context.dontleavehmode() |
| 13982 |
context.type(k) |
| 13983 |
context.crlf() |
| 13984 |
end |
| 13985 |
end |
| 13986 |
-- context.stoptworows() |
| 13987 |
context.stopcolumns() |
| 13988 |
|
| 13989 |
context("Many primitives starting with \\type{Umath} are math parameters that are discussed elsewhere, if at all.") |
| 13990 |
|
| 13991 |
context.page() |
| 13992 |
|
| 13993 |
context.stopsection() |
| 13994 |
|
| 13995 |
context.startsection { title = "To be checked primitives (old)" } |
| 13996 |
|
| 13997 |
context.blank() |
| 13998 |
context.startcolumns() |
| 13999 |
-- context.starttworows() |
| 14000 |
for k, v in table.sortedhash(everything) do |
| 14001 |
if v then |
| 14002 |
context.dontleavehmode() |
| 14003 |
context.type(k) |
| 14004 |
context.crlf() |
| 14005 |
end |
| 14006 |
end |
| 14007 |
-- context.stoptworows() |
| 14008 |
context.stopcolumns() |
| 14009 |
|
| 14010 |
context.page() |
| 14011 |
|
| 14012 |
context.stopsection() |
| 14013 |
|
| 14014 |
context.startsection { title = "Indexed primitives" } |
| 14015 |
|
| 14016 |
context.blank() |
| 14017 |
context.startcolumns() |
| 14018 |
-- context.starttworows() |
| 14019 |
for k, v in table.sortedhash(indexed) do |
| 14020 |
context.dontleavehmode() |
| 14021 |
if luametatex[k] == true then |
| 14022 |
-- context("\\color[darkgreen]{\\tttf %s}",k) |
| 14023 |
context("\\color[darkblue]{\\tttf %s}",k) |
| 14024 |
elseif luametatex[k] == false then |
| 14025 |
context("\\color[darkred]{\\tttf %s}",k) |
| 14026 |
else |
| 14027 |
context("{\\tttf %s}",k) |
| 14028 |
end |
| 14029 |
context.crlf() |
| 14030 |
end |
| 14031 |
-- context.stoptworows() |
| 14032 |
context.stopcolumns() |
| 14033 |
|
| 14034 |
context.page() |
| 14035 |
|
| 14036 |
context.stopsection() |
| 14037 |
end |
| 14038 |
\stopluacode |
| 14039 |
|
| 14040 |
\startmode[atpragma] |
| 14041 |
\startluacode |
| 14042 |
context.page() |
| 14043 |
document.CheckCompleteness() |
| 14044 |
\stopluacode |
| 14045 |
|
| 14046 |
% Run \type {s-system-syntax.mkxl} for a complete overview of the \LUAMETATEX\ |
| 14047 |
% primitives. |
| 14048 |
\stopmode |
| 14049 |
|
| 14050 |
\doifmode{checktodo}{\stopbodymatter} |
| 14051 |
|
| 14052 |
\popoverloadmode |
| 14053 |
|
| 14054 |
\stopdocument |
| 14055 |
|
| 14056 |
% disk and math options: orphaned |