summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/luametatex/luametatex-math.tex
diff options
context:
space:
mode:
Diffstat (limited to 'doc/context/sources/general/manuals/luametatex/luametatex-math.tex')
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-math.tex526
1 files changed, 304 insertions, 222 deletions
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-math.tex b/doc/context/sources/general/manuals/luametatex/luametatex-math.tex
index 30ce11c3b..eb3f6c61d 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-math.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-math.tex
@@ -10,6 +10,9 @@
\topicindex {math}
+End 2021 this chapter started with this:
+
+\startquotation
At this point there is no difference between \LUAMETATEX\ and \LUATEX\ with
respect to math. \footnote {This might no longer be true because we have more
control options that define default behavior and also have a more extensive
@@ -30,6 +33,24 @@ than gradually add more and more. At some point we should be able to say \quote
{This is it}. Also, when looking at these features, you need to keep in mind that
when it comes to math, \LATEX\ is the dominant macro package and it never needed
these engine features, so most are probably just here for exploration purposes.
+\stopquotation
+
+Although we still process math as \TEX\ does, there have been some fundamental
+changes to the machinery. Most of that is discussed in documents that come with
+\CONTEXT\ and in Mikael Sundqvist math manual. Together we explored some new ways
+to deal with math spacing, penalties, fencing, operators, fractions, atoms and
+other features of the \TEX\ engine. We started from the way \CONTEXT\ used the
+already present functionality combine with sometimes somewhat dirty (but on the
+average working well) tricks.
+
+It will take a while before this chapter is updated. If you find errors or things
+missing, let me know. A lot of pairwise spacing primitives were dropped but also
+quite a bit of new ones introduced to control matters. Much in \LUAMETATEX\ math
+handling is about micro|-|typography and for us the results are quite visible.
+But, as far as we know, there have never been complaints or demands in the
+direction of the features discussed here. Also, \TEX\ math usage outside
+\CONTEXT\ is rather chiselled in stone (already for nearly three decades) so we
+don't expect other macro packages to use the new features anyway.
\stopsection
@@ -38,18 +59,19 @@ these engine features, so most are probably just here for exploration purposes.
\topicindex {math+\UNICODE}
\topicindex {\UNICODE+math}
-Character handling is now extended up to the full \UNICODE\ range (the \type {\U}
-prefix), which is compatible with \XETEX.
+For various reasons we need to encode a math character in a 32 bit number and
+because we often also need to keep track of families and classes the range of
+characters is limited to 20 bits. There are upto 64 classes (more than in
+\LUATEX) and 64 families (less than in \LUATEX). The upper limit of characters is
+less that what \UNICODE\ offers but for math we're okay. If needed we can provide
+less families.
The math primitives from \TEX\ are kept as they are, except for the ones that
convert from input to math commands: \type {mathcode}, and \type {delcode}. These
-two now allow for a 21-bit character argument on the left hand side of the equals
-sign.
-
-Some of the new \LUATEX\ primitives read more than one separate value. This is
-shown in the tables below by a plus sign.
-
-The input for such primitives would look like this:
+two now allow for the larger character codes argument on the left hand side of
+the equals sign. The number variants of some primitives might be dropped in favor
+of the primitives that read more than one separate value (class, family and
+code), for instance:
\starttyping
\def\overbrace{\Umathaccent 0 1 "23DE }
@@ -78,70 +100,128 @@ The unaltered ones are:
\LL
\stoptabulate
-For practical reasons \prm {mathchardef} will silently accept values larger
-that \type {0x8000} and interpret it as \prm {Umathcharnumdef}. This is needed
-to satisfy older macro packages.
-
-The following new primitives are compatible with \XETEX:
-
-% somewhat fuzzy:
+In \LUATEX\ we support the single number primitives *with \type {num} in their
+name) conforming the \XETEX\ method. For the moment that still works but you need
+to figure out the number yourself. The split number variants are more future safe
+with respect to classes and families. Wd don't document \prm {Umathcharnumdef},
+\prm {Umathcharnum}, \prm {Umathcodenum} and \prm {Udelcodenum} here any longer.
-\starttabulate[|l|l|r|c|l|r|]
-\DB primitive \BC min \BC max \BC \kern 2em \BC min \BC max \NC \NR
+\starttabulate[|l|l|c|c|c|]
+\DB primitive \BC \BC class \BC family \BC character \NC \NR
\TB
-\NC \prm {Umathchardef} \NC 0+0+0 \NC 7+FF+10FFFF \NC \NC \NC \NC \NR
-\NC \prm {Umathcharnumdef}\rlap{\high{5}} \NC -80000000 \NC 7FFFFFFF \NC \NC \NC \NC \NR
-\NC \prm {Umathcode} \NC 0 \NC 10FFFF \NC = \NC 0+0+0 \NC 7+FF+10FFFF \NC \NR
-\NC \prm {Udelcode} \NC 0 \NC 10FFFF \NC = \NC 0+0 \NC FF+10FFFF \NC \NR
-\NC \prm {Umathchar} \NC 0+0+0 \NC 7+FF+10FFFF \NC \NC \NC \NC \NR
-\NC \prm {Umathaccent} \NC 0+0+0 \NC 7+FF+10FFFF \NC \NC \NC \NC \NR
-\NC \prm {Udelimiter} \NC 0+0+0 \NC 7+FF+10FFFF \NC \NC \NC \NC \NR
-\NC \prm {Uradical} \NC 0+0 \NC FF+10FFFF \NC \NC \NC \NC \NR
-\NC \prm {Umathcharnum} \NC -80000000 \NC 7FFFFFFF \NC \NC \NC \NC \NR
-\NC \prm {Umathcodenum} \NC 0 \NC 10FFFF \NC = \NC -80000000 \NC 7FFFFFFF \NC \NR
-\NC \prm {Udelcodenum} \NC 0 \NC 10FFFF \NC = \NC -80000000 \NC 7FFFFFFF \NC \NR
+\NC \prm {Umathchardef} \NC csname \NC "40 \NC "40 \NC "FFFFF \NC \NR
+\NC \prm {Umathcode} \NC \NC "40 \NC "40 \NC "FFFFF \NC \NR
+\NC \prm {Udelcode} \NC "FFFFF \NC "40 \NC "40 \NC "FFFFF \NC \NR
+\NC \prm {Umathchar} \NC \NC "40 \NC "40 \NC "FFFFF \NC \NR
+\NC \prm {Umathaccent} \NC \NC "40 \NC "40 \NC "FFFFF \NC \NR
+\NC \prm {Udelimiter} \NC \NC "40 \NC "40 \NC "FFFFF \NC \NR
+\NC \prm {Uradical} \NC \NC "40 \NC "40 \NC "FFFFF \NC \NR
\LL
\stoptabulate
-Specifications typically look like:
+So, there are upto 64 classes of which at this moment about 20 are predefined so,
+taking some future usage by the engine into account,you can assume 32 upto 63 to
+be available for any purpose. The number of families has been reduced from 256 to
+64 which is plenty for daily use in an \OPENTYPE\ setup. If we ever need to
+expand the \UNICODE\ range there will be less families. The values of begin and
+end classes and the number of classes can be fetched from the \LUA\ status
+table.
+
+Given the above, specifications typically look like:
\starttyping
-\Umathchardef\xx="1"0"456
-\Umathcode 123="1"0"789
+\Umathchardef \xx = "1 "0 "456
+\Umathcode 123 = "1 "0 "789
\stoptyping
The new primitives that deal with delimiter|-|style objects do not set up a
\quote {large family}. Selecting a suitable size for display purposes is expected
-to be dealt with by the font via the \prm {Umathoperatorsize} parameter.
-
-For some of these primitives, all information is packed into a single signed
-integer. For the first two (\prm {Umathcharnum} and \prm {Umathcodenum}), the
-lowest 21 bits are the character code, the 3 bits above that represent the math
-class, and the family data is kept in the topmost bits. This means that the values
-for math families 128--255 are actually negative. For \prm {Udelcodenum} there
-is no math class. The math family information is stored in the bits directly on
-top of the character code. Using these three commands is not as natural as using
-the two- and three|-|value commands, so unless you know exactly what you are
-doing and absolutely require the speedup resulting from the faster input
-scanning, it is better to use the verbose commands instead.
+to be dealt with by the font via the \prm {Umathoperatorsize} parameter. Old
+school fonts can still be handled but you need to set up the engine to do that;
+this can be done per font. In principle we assume that \OPENTYPE\ fonts are used,
+which is no big deal because loading fonts is already under \LUA\ control. At
+that moment the distinction between small and large delimiters will be gone. Of
+course an alternative is to support a specific large size but that is unlikely to
+happen.
+
+% For some of these primitives, all information is packed into a single signed
+% integer. For the first two (\prm {Umathcharnum} and \prm {Umathcodenum}), the
+% lowest 21 bits are the character code, the 3 bits above that represent the math
+% class, and the family data is kept in the topmost bits. This means that the values
+% for math families 128--255 are actually negative. For \prm {Udelcodenum} there
+% is no math class. The math family information is stored in the bits directly on
+% top of the character code. Using these three commands is not as natural as using
+% the two- and three|-|value commands, so unless you know exactly what you are
+% doing and absolutely require the speedup resulting from the faster input
+% scanning, it is better to use the verbose commands instead.
The \prm {Umathaccent} command accepts optional keywords to control various
details regarding math accents. See \in {section} [mathacc] below for details.
There are more new primitives and all of these will be explained in following
-sections:
+sections. For instance these are variants of radicals and delimiters all are
+set the same::
-\starttabulate[|l|l|]
-\DB primitive \BC value range (in hex) \NC \NR
+\starttabulate[|l|c|c|c|]
+\DB primitive \BC class \BC family \NC character \NC \NR
+\TB
+\NC \prm {Uroot} \NC "40 \NC "40 \NC "FFFFF \NC \NR
+\NC \prm {Uoverdelimiter} \NC "40 \NC "40 \NC "FFFFF \NC \NR
+\NC \prm {Uunderdelimiter} \NC "40 \NC "40 \NC "FFFFF \NC \NR
+\NC \prm {Udelimiterover} \NC "40 \NC "40 \NC "FFFFF \NC \NR
+\NC \prm {Udelimiterunder} \NC "40 \NC "40 \NC "FFFFF \NC \NR
+\LL
+\stoptabulate
+
+In addition there are \prm {UVextensible} and \prm {Uoperator} and extended
+versions of fenced: \prm {Uleft}, \prm {Uright} and \prm {Umiddle}. There is also
+\prm {Uover} and similar primitives that expect the numerator and denominator
+after the primitive. In addition to regular scripts there are prescripts and a
+dedicated prime script. Many of these \type {U} primitives can be controlled by
+options and keywords.
+
+\stopsection
+
+\startsection[title=Setting up the engine]
+
+\topicindex{math+control}
+
+Processing math is controlled by \prm {mathfontcontrol}, a numeric bitset
+parameter. The recommended bits are marked with a star but it really depends on
+the macro package to set up the machinery well. Of course one can just enable all
+and see what happens.
+
+\starttabulate[|l|l|c|]
+\DB bit \BC name \NC \NC \NR
\TB
-\NC \prm {Uroot} \NC 0 + 0--FF + 10FFFF \NC \NR
-\NC \prm {Uoverdelimiter} \NC 0 + 0--FF + 10FFFF \NC \NR
-\NC \prm {Uunderdelimiter} \NC 0 + 0--FF + 10FFFF \NC \NR
-\NC \prm {Udelimiterover} \NC 0 + 0--FF + 10FFFF \NC \NR
-\NC \prm {Udelimiterunder} \NC 0 + 0--FF + 10FFFF \NC \NR
+\NC \type {0x00001} \NC \type {usefontcontrol} \NC \star \NR
+\NC \type {0x00002} \NC \type {overrule} \NC \star \NR
+\NC \type {0x00004} \NC \type {underrule} \NC \star \NR
+\NC \type {0x00008} \NC \type {radicalrule} \NC \star \NR
+\NC \type {0x00010} \NC \type {fractionrule} \NC \star \NR
+\NC \type {0x00020} \NC \type {accentskewhalf} \NC \star \NR
+\NC \type {0x00040} \NC \type {accentskewapply} \NC \star \NR
+\NC \type {0x00080} \NC \type {checkligatureandkern} \NC \NR
+\NC \type {0x00100} \NC \type {applyverticalitalickern} \NC \star \NR
+\NC \type {0x00200} \NC \type {applyordinaryitalickern} \NC \star \NR
+\NC \type {0x00400} \NC \type {applycharitalickern} \NC \NR
+\NC \type {0x00800} \NC \type {reboxcharitalickern} \NC \NR
+\NC \type {0x01000} \NC \type {applyboxeditalickern} \NC \star \NR
+\NC \type {0x02000} \NC \type {staircasekern} \NC \star \NR
+\NC \type {0x04000} \NC \type {applytextitalickern} \NC \star \NR
+\NC \type {0x08000} \NC \type {checktextitalickern} \NC \star \NR
+\NC \type {0x10000} \NC \type {checkspaceitalickern} \NC \NR
+\NC \type {0x20000} \NC \type {applyscriptitalickern} \NC \star \NR
+\NC \type {0x40000} \NC \type {italicshapekern} \NC \star \NR
\LL
\stoptabulate
+One reason for this approach is that traditional and \OPENTYPE\ fonts have
+different approaches (especially when it comes to dealing with the width and
+italic corrections) and is even more complicated by the fact that the fonts are
+often inconsistent (within and between). In \CONTEXT\ we deal with this by
+runtime fixes to fonts. In any case the Cambria font is taken as reference.
+
\stopsection
\startsection[title={Math styles}]
@@ -346,8 +426,8 @@ we force styles in the script using \prm {scriptstyle} and \prm
Now we set the following parameters
\startbuffer[setup]
-\Umathordrelspacing\scriptstyle=30mu
-\Umathordordspacing\scriptstyle=30mu
+\setmathspacing 0 3 \scriptstyle = 30mu
+\setmathspacing 0 3 \scriptstyle = 30mu
\stopbuffer
\typebuffer[setup]
@@ -359,10 +439,10 @@ This gives a different result:
But, as this is not what is expected (visually) we should say:
\startbuffer[setup]
-\Umathordrelspacing\scriptstyle=30mu
-\Umathordordspacing\scriptstyle=30mu
-\Umathordrelspacing\crampedscriptstyle=30mu
-\Umathordordspacing\crampedscriptstyle=30mu
+\setmathspacing 0 3 \scriptstyle = 30mu
+\setmathspacing 0 3 \scriptstyle = 30mu
+\setmathspacing 0 3 \crampedscriptstyle = 30mu
+\setmathspacing 0 3 \crampedscriptstyle = 30mu
\stopbuffer
\typebuffer[setup]
@@ -386,7 +466,7 @@ now accessible via primitive commands. In fact, refactoring of the math engine
has resulted in turning some hard codes properties into parameters.
\starttabulate
-\DB primitive name \BC description \NC \NR
+\DB primitive name \BC description \NC \NR
\TB
\NC \prm {Umathquad} \NC the width of 18 mu's \NC \NR
\NC \prm {Umathaxis} \NC height of the vertical center axis of
@@ -441,12 +521,39 @@ has resulted in turning some hard codes properties into parameters.
\NC \prm {Umathsupsubbottommax} \NC the bottom of the superscript of a combined super- and subscript
be at least as high as this above the baseline \NC \NR
\NC \prm {Umathsubsupvgap} \NC vertical clearance between super- and subscript \NC \NR
-\NC \prm {Umathspacebeforescript} \NC additional space added before a super- or subprescript (bonus setting) \NC \NR
\NC \prm {Umathspaceafterscript} \NC additional space added after a super- or subscript \NC \NR
\NC \prm {Umathconnectoroverlapmin}\NC minimum overlap between parts in an extensible recipe \NC \NR
\LL
\stoptabulate
+In addition to the above official \OPENTYPE\ font parameters we have these:
+
+\starttabulate
+\DB primitive name \BC description \NC \NR
+\TB
+\NC \prm{Umathprimeraisepercent} \NC the percentage that the vertical position is scaled \NC \NR
+\NC \prm{Umathprimeshiftup} \NC the prime variant of \prm {SuperscriptShiftUp} \NC \NR
+\NC \prm{Umathprimebaselinedropmax} \NC the prime variant of \prm {SuperscriptBaselineDropMax} \NC \NR
+\NC \prm{Umathprimeshiftupcramped} \NC the prime variant of \prm {SuperscriptShiftUpCramped} \NC \NR
+\NC \prm{Umathprimespaceafter} \NC the prime variant of \prm {UmathSpaceAfterScript} \NC \NR
+\NC \prm{Umathprimewidthpercent} \NC the percentage of width that gets added \NC \NR
+\NC \prm{Umathspacebeforescript} \NC the prescript variant of \prm {UmathSpaceAfterScript} \NC \NR
+\NC \prm{Umathnolimitsupfactor} \NC a multiplier for the way limits are shifted up and down \NC \NR
+\NC \prm{Umathnolimitsubfactor} \NC a multiplier for the way limits are shifted up and down \NC \NR
+\NC \prm{Umathaccenttopshiftup} \NC the amount that a top accent is shifted up \NC \NR
+\NC \prm{Umathaccentbottomshiftdown} \NC the amount that a bottom accent is shifted down \NC \NR
+\NC \prm{Umathflattenedaccenttopshiftup} \NC the amount that a wide top accent is shifted up \NC \NR
+\NC \prm{Umathflattenedaccentbottomshiftdown} \NC the amount that a wide bottom accent is shifted down \NC \NR
+\NC \prm{Umathaccentbasedepth} \NC the complement of \prm {UmathAccentBaseHeight} \NC \NR
+\NC \prm{Umathaccentflattenedbasedepth} \NC the complement of \prm {UmathFlattenedAccentBaseHeight} \NC \NR
+\LL
+\stoptabulate
+
+These parameters not only provide a bit more control over rendering, they also
+can be used in compensating issues in font, because no font is perfect. Some are
+the side effects of experiments and they have CamelCase companions in the \type
+{MathConstants} table.
+
Each of the parameters in this section can be set by a command like this:
\starttyping
@@ -456,6 +563,26 @@ Each of the parameters in this section can be set by a command like this:
they obey grouping, and you can use \type {\the\Umathquad\displaystyle} if
needed.
+There are quite some parameters that can be set and there are eight styles, which means a lot
+of keying in. For that reason is is possible to set parameters groupwise
+
+\starttabulate
+\DB primitive name \BC description \NC \NR
+\TB
+\NC \prm {alldisplaystyles} \NC set both display styles \NC \NR
+\NC \prm {alltextstyles} \NC set both text styles \NC \NR
+\NC \prm {allscriptstyles} \NC set both script styles \NC \NR
+\NC \prm {allscriptscriptstyles} \NC set both scriptscript styles \NC \NR
+\NC \prm {allmathstyles} \NC set all eight styles \NC \NR
+\NC \prm {allsplitstyles} \NC set all display and text styles, and reset all script(script) styles \NC \NR
+\NC \prm {alluncrampedstyles} \NC set all four uncramped styles \NC \NR
+\NC \prm {allcrampedstyles} \NC set all four cramped styles \NC \NR
+\LL
+\stoptabulate
+
+These groups are especially handy when you set up inter atom spacing, pre- and
+post atom penalties and atom rules.
+
\stopsubsection
\startsubsection[title={Font|-|based math parameters}]
@@ -552,6 +679,8 @@ dimension parameter. For math fonts, this should be set to zero.
\LL
\stoptabulate
+{\em Todo: add the extra ones.}
+
Note 1: \OPENTYPE\ fonts set \prm {Umathlimitabovekern} and \prm
{Umathlimitbelowkern} to zero and set \prm {Umathquad} to the font size of the
used font, because these are not supported in the \type {MATH} table,
@@ -660,104 +789,51 @@ applicable in the first occasion that checks them (linebreaking or packaging).
\stopsubsection
-\startsubsection[title={Pairwise spacing and \tex {Umath...spacing} commands}]
+\startsubsection[title={Pairwise spacing}]
\topicindex {math+spacing}
-Besides the parameters mentioned in the previous sections, there are also 64 new
+Besides the parameters mentioned in the previous sections, there are also
primitives to control the math spacing table (as explained in Chapter~18 of the
-\TEX book). The primitive names are a simple matter of combining two math atom
-types, but for completeness' sake, here is the whole list:
+\TEX book). This happens per class pair. Because we have many possible classes,
+we no longer hand the many primitives that \LUATEX\ has but you can define then
+using the generic \prm {setmathspacing} primitive:
-\starttwocolumns
-\startlines
-\prm {Umathordordspacing}
-\prm {Umathordopspacing}
-\prm {Umathordbinspacing}
-\prm {Umathordrelspacing}
-\prm {Umathordopenspacing}
-\prm {Umathordclosespacing}
-\prm {Umathordpunctspacing}
-\prm {Umathordinnerspacing}
-\prm {Umathopordspacing}
-\prm {Umathopopspacing}
-\prm {Umathopbinspacing}
-\prm {Umathoprelspacing}
-\prm {Umathopopenspacing}
-\prm {Umathopclosespacing}
-\prm {Umathoppunctspacing}
-\prm {Umathopinnerspacing}
-\prm {Umathbinordspacing}
-\prm {Umathbinopspacing}
-\prm {Umathbinbinspacing}
-\prm {Umathbinrelspacing}
-\prm {Umathbinopenspacing}
-\prm {Umathbinclosespacing}
-\prm {Umathbinpunctspacing}
-\prm {Umathbininnerspacing}
-\prm {Umathrelordspacing}
-\prm {Umathrelopspacing}
-\prm {Umathrelbinspacing}
-\prm {Umathrelrelspacing}
-\prm {Umathrelopenspacing}
-\prm {Umathrelclosespacing}
-\prm {Umathrelpunctspacing}
-\prm {Umathrelinnerspacing}
-\prm {Umathopenordspacing}
-\prm {Umathopenopspacing}
-\prm {Umathopenbinspacing}
-\prm {Umathopenrelspacing}
-\prm {Umathopenopenspacing}
-\prm {Umathopenclosespacing}
-\prm {Umathopenpunctspacing}
-\prm {Umathopeninnerspacing}
-\prm {Umathcloseordspacing}
-\prm {Umathcloseopspacing}
-\prm {Umathclosebinspacing}
-\prm {Umathcloserelspacing}
-\prm {Umathcloseopenspacing}
-\prm {Umathcloseclosespacing}
-\prm {Umathclosepunctspacing}
-\prm {Umathcloseinnerspacing}
-\prm {Umathpunctordspacing}
-\prm {Umathpunctopspacing}
-\prm {Umathpunctbinspacing}
-\prm {Umathpunctrelspacing}
-\prm {Umathpunctopenspacing}
-\prm {Umathpunctclosespacing}
-\prm {Umathpunctpunctspacing}
-\prm {Umathpunctinnerspacing}
-\prm {Umathinnerordspacing}
-\prm {Umathinneropspacing}
-\prm {Umathinnerbinspacing}
-\prm {Umathinnerrelspacing}
-\prm {Umathinneropenspacing}
-\prm {Umathinnerclosespacing}
-\prm {Umathinnerpunctspacing}
-\prm {Umathinnerinnerspacing}
-\stoplines
-\stoptwocolumns
+\starttyping
+\def\Umathordordspacing {\setmathspacing 0 0 }
+\def\Umathordordopenspacing {\setmathspacing 0 4 }
+\stoptyping
These parameters are of type \prm {muskip}, so setting a parameter can be done
like this:
\starttyping
-\Umathopordspacing\displaystyle=4mu plus 2mu
+\setmathspacing 1 0 \displaystyle=4mu plus 2mu % op ord Umathopordspacing
\stoptyping
-They are all initialized by \type {initex} to the values mentioned in the table
-in Chapter~18 of the \TEX book.
+The atom pairs known by the engine are all initialized by \type {initex} to the
+values mentioned in the table in Chapter~18 of the \TEX book.
+
+For ease of use as well as for backward compatibility, \prm {thinmuskip}, \prm
+{medmuskip} and \prm {thickmuskip} are treated specially. In their case a pointer
+to the corresponding internal parameter is saved, not the actual \prm {muskip}
+value. This means that any later changes to one of these three parameters will be
+taken into account. As a bonus we also introduced a \prm {tinymuskip} primitive.
-Note 1: For ease of use as well as for backward compatibility, \prm {thinmuskip},
-\prm {medmuskip} and \prm {thickmuskip} are treated specially. In their case a
-pointer to the corresponding internal parameter is saved, not the actual \prm
-{muskip} value. This means that any later changes to one of these three
-parameters will be taken into account.
+In \LUAMETATEX\ we go a bit further. Any named dimension, glue and mu glue
+register as well as the constants with these properties can be bound to a pair by
+prefixing \prm {setmathspacing} by \prm {inherited}.
-Note 2: Careful readers will realise that there are also primitives for the items
-marked \type {*} in the \TEX book. These will not actually be used as those
-combinations of atoms cannot actually happen, but it seemed better not to break
-orthogonality. They are initialized to zero.
+Careful readers will realize that there are also primitives for the items marked
+\type {*} in the \TEX book. These will actually be used because we pose no
+restrictions. However, you can enforce the remapping rules to conform to the
+rules of \TEX\ (or yourself).
+
+{\em Todo: explain rules.}
+
+{\em Todo: explain penalties.}
+
+{\em Todo: explain let, set and copy primitives.}
\stopsubsection
@@ -1413,8 +1489,8 @@ where the options can be \type {noaxis} and \type {exact}. By default we add hal
the axis to the shifts and by default we zero the width of the middle character.
For Latin Modern the result looks as follows:
-\def\ShowA#1#2#3{$x + { {#1} \Uskewed / #3 {#2} } + x$}
-\def\ShowB#1#2#3{$x + { {#1} \Uskewedwithdelims / () #3 {#2} } + x$}
+\def\ShowA#1#2#3{$x + { \Uskewed / #3 {#1} {#2} } + x$}
+\def\ShowB#1#2#3{$x + { \Uskewedwithdelims / () #3 {#1} {#2} } + x$}
\start
\switchtobodyfont[modern]
@@ -1659,7 +1735,7 @@ and \prm {Usubscript}}]
\type {^}, \type {_}, \type {$}, and \type {$$}:
\starttabulate[|l|l|]
-\DB primitive \BC explanation \NC \NR
+\DB primitive \BC explanation \NC \NR
\TB
\NC \prm {Usuperscript} \NC duplicates the functionality of \type {^} \NC \NR
\NC \prm {Usubscript} \NC duplicates the functionality of \type {_} \NC \NR
@@ -1703,85 +1779,12 @@ results in \inlinebuffer[script].
\stopsubsection
-\startsubsection[title={Allowed math commands in non|-|math modes}]
-
-\topicindex {math+text}
-\topicindex {text+math}
-
-The commands \prm {mathchar}, and \prm {Umathchar} and control sequences that are
-the result of \prm {mathchardef} or \prm {Umathchardef} are also acceptable in
-the horizontal and vertical modes. In those cases, the \prm {textfont} from the
-requested math family is used.
-
-\stopsubsection
-
-\stopsection
-
-\startsection[title={Goodies}]
-
-\startsubsection[title={Flattening: \prm {mathflattenmode}}]
-
-\topicindex {math+flattening}
-
-The \TEX\ math engine collapses \type {ord} noads without sub- and superscripts
-and a character as nucleus, which has the side effect that in \OPENTYPE\ mode
-italic corrections are applied (given that they are enabled).
-
-\startbuffer[sample]
-\switchtobodyfont[modern]
-$V \mathbin{\mathbin{v}} V$\par
-$V \mathord{\mathord{v}} V$\par
-\stopbuffer
-
-\typebuffer[sample]
-
-This renders as:
-
-\blank \start \mathflattenmode\plusone \getbuffer[sample] \stop \blank
-
-When we set \prm {mathflattenmode} to 31 we get:
-
-\blank \start \mathflattenmode\numexpr1+2+4+8+16\relax \getbuffer[sample] \stop \blank
-
-When you see no difference, then the font probably has the proper character
-dimensions and no italic correction is needed. For Latin Modern (at least till
-2018) there was a visual difference. In that respect this parameter is not always
-needed unless of course you want efficient math lists anyway.
-
-You can influence flattening by adding the appropriate number to the value of the
-mode parameter. The default value is~1.
-
-\starttabulate[|Tc|c|]
-\DB mode \BC class \NC \NR
-\TB
-\NC 1 \NC ord \NC \NR
-\NC 2 \NC bin \NC \NR
-\NC 4 \NC rel \NC \NR
-\NC 8 \NC punct \NC \NR
-\NC 16 \NC inner \NC \NR
-\LL
-\stoptabulate
-
-\stopsubsection
-
-\startsubsection[title={Less Tracing}]
+\startsubsection[title={Injecting primes with {Uprimescript}}]
-\topicindex {math+tracing}
-
-Because there are quite some math related parameters and values, it is possible
-to limit tracing. Only when \type {tracingassigns} and|/|or \type
-{tracingrestores} are set to~2 or more they will be traced.
+{\em Todo: explain this one.}
\stopsubsection
-\stopsection
-
-\startsection[title={Experiments}]
-
-There are a couple of experimental features. They will stay but details might
-change, for instance more control over spacing. We just show some examples and
-let your imagination work it out. First we have prescripts:
-
\startsubsection[title={Prescripts with \prm {Usuperprescript} and {Usubprescript}}]
\startbuffer
@@ -1829,6 +1832,85 @@ These more verbose triggers can be used to build interfaces:
\stopsubsection
+\startsubsection[title={Allowed math commands in non|-|math modes}]
+
+\topicindex {math+text}
+\topicindex {text+math}
+
+The commands \prm {mathchar}, and \prm {Umathchar} and control sequences that are
+the result of \prm {mathchardef} or \prm {Umathchardef} are also acceptable in
+the horizontal and vertical modes. In those cases, the \prm {textfont} from the
+requested math family is used.
+
+\stopsubsection
+
+\stopsection
+
+\startsection[title={Goodies}]
+
+% \startsubsection[title={Flattening: \prm {mathflattenmode}}]
+%
+% \topicindex {math+flattening}
+%
+% The \TEX\ math engine collapses \type {ord} noads without sub- and superscripts
+% and a character as nucleus, which has the side effect that in \OPENTYPE\ mode
+% italic corrections are applied (given that they are enabled).
+%
+% \startbuffer[sample]
+% \switchtobodyfont[modern]
+% $V \mathbin{\mathbin{v}} V$\par
+% $V \mathord{\mathord{v}} V$\par
+% \stopbuffer
+%
+% \typebuffer[sample]
+%
+% This renders as:
+%
+% \blank \start \mathflattenmode\plusone \getbuffer[sample] \stop \blank
+%
+% When we set \prm {mathflattenmode} to 31 we get:
+%
+% \blank \start \mathflattenmode\numexpr1+2+4+8+16\relax \getbuffer[sample] \stop \blank
+%
+% When you see no difference, then the font probably has the proper character
+% dimensions and no italic correction is needed. For Latin Modern (at least till
+% 2018) there was a visual difference. In that respect this parameter is not always
+% needed unless of course you want efficient math lists anyway.
+%
+% You can influence flattening by adding the appropriate number to the value of the
+% mode parameter. The default value is~1.
+%
+% \starttabulate[|Tc|c|]
+% \DB mode \BC class \NC \NR
+% \TB
+% \NC 1 \NC ord \NC \NR
+% \NC 2 \NC bin \NC \NR
+% \NC 4 \NC rel \NC \NR
+% \NC 8 \NC punct \NC \NR
+% \NC 16 \NC inner \NC \NR
+% \LL
+% \stoptabulate
+%
+% \stopsubsection
+
+\startsubsection[title={Less Tracing}]
+
+\topicindex {math+tracing}
+
+Because there are quite some math related parameters and values, it is possible
+to limit tracing. Only when \type {tracingassigns} and|/|or \type
+{tracingrestores} are set to~2 or more they will be traced.
+
+\stopsubsection
+
+\stopsection
+
+\startsection[title={Experiments}]
+
+There are a couple of experimental features. They will stay but details might
+change, for instance more control over spacing. We just show some examples and
+let your imagination work it out.
+
\startsubsection[title={Forcing classes with \prm {Umathclass}}]
You can change the class of a math character on the fly: