summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/luatex/luatex-math.tex
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-11-19 20:15:06 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-11-19 20:15:06 +0100
commitadc43c3c243ed95215af6fe02d71e393c178da23 (patch)
treeaad04954cbfb0378c65fd2b98e7c924245aad372 /doc/context/sources/general/manuals/luatex/luatex-math.tex
parent726a663be481042003566d4614266b940b5a0c91 (diff)
downloadcontext-adc43c3c243ed95215af6fe02d71e393c178da23.tar.gz
2015-11-19 19:15:00
Diffstat (limited to 'doc/context/sources/general/manuals/luatex/luatex-math.tex')
-rw-r--r--doc/context/sources/general/manuals/luatex/luatex-math.tex478
1 files changed, 422 insertions, 56 deletions
diff --git a/doc/context/sources/general/manuals/luatex/luatex-math.tex b/doc/context/sources/general/manuals/luatex/luatex-math.tex
index 88809d9d9..6c83b7786 100644
--- a/doc/context/sources/general/manuals/luatex/luatex-math.tex
+++ b/doc/context/sources/general/manuals/luatex/luatex-math.tex
@@ -91,7 +91,7 @@ Unaltered:
New primitives that are compatible with \XETEX:
\starttabulate[|l|l|l|l|]
-\NC \bf primitive \NC \bf value range (in hex) \NC \NR
+\NC \bf primitive \NC \bf value range (in hex) \NC \NR
\NC \type {\Umathchardef} \NC 0+0+0--7+FF+10FFFF$^1$ \NC \NR
\NC \type {\Umathcharnumdef}$^5$ \NC -80000000--7FFFFFFF$^3$ \NC \NR
\NC \type {\Umathcode} \NC 0--10FFFF = 0+0+0--7+FF+10FFFF$^1$ \NC \NR
@@ -105,15 +105,19 @@ New primitives that are compatible with \XETEX:
\NC \type {\Udelcodenum} \NC 0--10FFFF = -80000000--7FFFFFFF$^3$ \NC \NR
\stoptabulate
-Note 1: \type {\Umathchardef<csname>="8"0"0} and \type
-{\Umathchardef<number>="8"0"0} are also accepted.
+Specifications typically look like:
-Note 2: The new primitives that deal with delimiter-style objects do not set up a
+\starttyping
+\Umathchardef\xx="1"0"456
+\Umathcode 123="1"0"789
+\stoptyping
+
+Note 1: 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 \type {\Umathoperatorsize} parameter (more
information can be found in a following section).
-Note 3: For these three primitives, all information is packed into a single
+Note 2: For these three primitives, all information is packed into a single
signed integer. For the first two (\type {\Umathcharnum} and \type {\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
@@ -124,7 +128,7 @@ 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.
-Note 4: The \type {\Umathaccent} command accepts optional keywords to control
+Note 3: The \type {\Umathaccent} command accepts optional keywords to control
various details regarding math accents. See \in {section} [mathacc] below for
details.
@@ -154,6 +158,74 @@ in following sections):
These additional commands are not all that valuable on their own, but they come
in handy as arguments to the math parameter settings that will be added shortly.
+In Eijkhouts \quotation {\TEX\ by Topic} the rules for handling styles in scripts
+are described as follows:
+
+\startitemize
+\startitem
+ In any style superscripts and subscripts are taken from the next smaller style.
+ Exception: in display style they are taken in script style.
+\stopitem
+\startitem
+ Subscripts are always in the cramped variant of the style; superscripts are only
+ cramped if the original style was cramped.
+\stopitem
+\startitem
+ In an \type {..\over..} formula in any style the numerator and denominator are
+ taken from the next smaller style.
+\stopitem
+\startitem
+ The denominator is always in cramped style; the numerator is only in cramped
+ style if the original style was cramped.
+\stopitem
+\startitem
+ Formulas under a \type {\sqrt} or \type {\overline} are in cramped style.
+\stopitem
+\stopitemize
+
+In \LUATEX\ one can set the styles in more detail which means that you sometimes
+have to set both normal and cramped styles to get the effect you want. If we
+force styles in the scriptr using \type {\scriptstyle} and \type {\crampedscriptstyle}
+we get this:
+
+\startbuffer[demo]
+\starttabulate
+\NC default \NC $b_{x=xx}^{x=xx}$ \NC \NR
+\NC script \NC $b_{\scriptstyle x=xx}^{\scriptstyle x=xx}$ \NC \NR
+\NC crampedscript \NC $b_{\crampedscriptstyle x=xx}^{\crampedscriptstyle x=xx}$ \NC \NR
+\stoptabulate
+\stopbuffer
+
+\getbuffer[demo]
+
+Now we set the following parameters
+
+\startbuffer[setup]
+\Umathordrelspacing\scriptstyle=30mu
+\Umathordordspacing\scriptstyle=30mu
+\stopbuffer
+
+\typebuffer[setup]
+
+This gives:
+
+\start\getbuffer[setup,demo]\stop
+
+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
+\stopbuffer
+
+\typebuffer[setup]
+
+Now we get:
+
+\start\getbuffer[setup,demo]\stop
+
\section{Math parameter settings}
In \LUATEX, the font dimension parameters that \TEX\ used in math typesetting are
@@ -161,10 +233,10 @@ now accessible via primitive commands. In fact, refactoring of the math engine
has resulted in many more parameters than were accessible before.
\starttabulate
-\NC \bf primitive name \NC \bf description \NC \NR
+\NC \bf primitive name \NC \bf description \NC \NR
\NC \type {\Umathquad} \NC the width of 18mu's \NC \NR
\NC \type {\Umathaxis} \NC height of the vertical center axis of
- the math formula above the baseline \NC \NR
+ the math formula above the baseline \NC \NR
\NC \type {\Umathoperatorsize} \NC minimum size of large operators in display mode \NC \NR
\NC \type {\Umathoverbarkern} \NC vertical clearance above the rule \NC \NR
\NC \type {\Umathoverbarrule} \NC the width of the rule \NC \NR
@@ -176,15 +248,15 @@ has resulted in many more parameters than were accessible before.
\NC \type {\Umathradicalrule} \NC the width of the rule \NC \NR
\NC \type {\Umathradicalvgap} \NC vertical clearance below the rule \NC \NR
\NC \type {\Umathradicaldegreebefore}\NC the forward kern that takes place before placement of
- the radical degree \NC \NR
+ the radical degree \NC \NR
\NC \type {\Umathradicaldegreeafter} \NC the backward kern that takes place after placement of
- the radical degree \NC \NR
+ the radical degree \NC \NR
\NC \type {\Umathradicaldegreeraise} \NC this is the percentage of the total height and depth of
- the radical sign that the degree is raised by. It is
- expressed in \type {percents}, so 60\% is expressed as the
- integer $60$. \NC \NR
+ the radical sign that the degree is raised by. It is
+ expressed in \type {percents}, so 60\% is expressed as the
+ integer $60$. \NC \NR
\NC \type {\Umathstackvgap} \NC vertical clearance between the two
- elements in a \type {\atop} stack \NC \NR
+ elements in a \type {\atop} stack \NC \NR
\NC \type {\Umathstacknumup} \NC numerator shift upward in \type {\atop} stack \NC \NR
\NC \type {\Umathstackdenomdown} \NC denominator shift downward in \type {\atop} stack \NC \NR
\NC \type {\Umathfractionrule} \NC the width of the rule in a \type {\over} \NC \NR
@@ -209,11 +281,11 @@ has resulted in many more parameters than were accessible before.
\NC \type {\Umathsupshiftup} \NC superscript raise for characters \NC \NR
\NC \type {\Umathsubsupshiftdown} \NC subscript drop in the presence of a superscript \NC \NR
\NC \type {\Umathsubtopmax} \NC the top of standalone subscripts cannot be higher than this
- above the baseline \NC \NR
+ above the baseline \NC \NR
\NC \type {\Umathsupbottommin} \NC the bottom of standalone superscripts cannot be less than
- this above the baseline \NC \NR
+ this above the baseline \NC \NR
\NC \type {\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
+ be at least as high as this above the baseline \NC \NR
\NC \type {\Umathsubsupvgap} \NC vertical clearance between super- and subscript \NC \NR
\NC \type {\Umathspaceafterscript} \NC additional space added after a super- or subscript \NC \NR
\NC \type {\Umathconnectoroverlapmin}\NC minimum overlap between parts in an extensible recipe \NC \NR
@@ -228,6 +300,20 @@ 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.
+\section{Skips around display math}
+
+The injection of \type {\abovedisplayskip} and \type {\belowdisplayskip} is not symmetrical. An
+above one is always inserted, also when zero, but the below is only inserted when larger than
+zero. Especially the later mkes it sometimes hard to fully control spacing. Therefore \LUATEX\
+comes with a new directive: \type {\mathdisplayskipmode}. The following values apply:
+
+\starttabulate
+\NC 0 \NC normal tex behaviour: always above, only below when larger than zero \NC \NR
+\NC 1 \NC always \NC \NR
+\NC 2 \NC only when not zero \NC \NR
+\NC 3 \NC never, not even when not zero \NC \NR
+\stoptabulate
+
\section{Font-based Math Parameters}
While it is nice to have these math parameters available for tweaking, it would
@@ -257,20 +343,22 @@ dimension parameter. For math fonts, this should be set to zero.
\switchtobodyfont[8pt]
\starttabulate[|l|l|l|p|]
-\NC \bf variable \NC \bf style \NC \bf default value opentype \NC \bf default value tfm \NC \NR
+\NC \bf variable \NC \bf style \NC \bf default value opentype \NC \bf default value tfm \NC \NR
\NC \type {\Umathaxis} \NC -- \NC AxisHeight \NC axis_height \NC \NR
\NC \type {\Umathoperatorsize} \NC D, D' \NC DisplayOperatorMinHeight \NC $^6$ \NC \NR
\NC \type {\Umathfractiondelsize} \NC D, D' \NC FractionDelimiterDisplayStyleSize$^9$ \NC delim1 \NC \NR
-\NC " \NC T, T', S, S', SS, SS' \NC FractionDelimiterSize$^9$ \NC delim2 \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC FractionDelimiterSize$^9$ \NC delim2 \NC \NR
\NC \type {\Umathfractiondenomdown} \NC D, D' \NC FractionDenominatorDisplayStyleShiftDown \NC denom1 \NC \NR
-\NC " \NC T, T', S, S', SS, SS' \NC FractionDenominatorShiftDown \NC denom2 \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC FractionDenominatorShiftDown \NC denom2 \NC \NR
\NC \type {\Umathfractiondenomvgap} \NC D, D' \NC FractionDenominatorDisplayStyleGapMin \NC 3*default_rule_thickness \NC \NR
-\NC " \NC T, T', S, S', SS, SS' \NC FractionDenominatorGapMin \NC default_rule_thickness \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC FractionDenominatorGapMin \NC default_rule_thickness \NC \NR
\NC \type {\Umathfractionnumup} \NC D, D' \NC FractionNumeratorDisplayStyleShiftUp \NC num1 \NC \NR
-\NC " \NC T, T', S, S', SS, SS' \NC FractionNumeratorShiftUp \NC num2 \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC FractionNumeratorShiftUp \NC num2 \NC \NR
\NC \type {\Umathfractionnumvgap} \NC D, D' \NC FractionNumeratorDisplayStyleGapMin \NC 3*default_rule_thickness \NC \NR
-\NC " \NC T, T', S, S', SS, SS' \NC FractionNumeratorGapMin \NC default_rule_thickness \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC FractionNumeratorGapMin \NC default_rule_thickness \NC \NR
\NC \type {\Umathfractionrule} \NC -- \NC FractionRuleThickness \NC default_rule_thickness \NC \NR
+\NC \type {\Umathskewedfractionhgap} \NC -- \NC SkewedFractionHorizontalGap \NC math_quad/2 \NC \NR
+\NC \type {\Umathskewedfractionvgap} \NC -- \NC SkewedFractionVerticalGap \NC math_x_height \NC \NR
\NC \type {\Umathlimitabovebgap} \NC -- \NC UpperLimitBaselineRiseMin \NC big_op_spacing3 \NC \NR
\NC \type {\Umathlimitabovekern} \NC -- \NC 0$^1$ \NC big_op_spacing5 \NC \NR
\NC \type {\Umathlimitabovevgap} \NC -- \NC UpperLimitGapMin \NC big_op_spacing1 \NC \NR
@@ -288,30 +376,30 @@ dimension parameter. For math fonts, this should be set to zero.
\NC \type {\Umathradicalkern} \NC -- \NC RadicalExtraAscender \NC default_rule_thickness \NC \NR
\NC \type {\Umathradicalrule} \NC -- \NC RadicalRuleThickness \NC <not set>$^2$ \NC \NR
\NC \type {\Umathradicalvgap} \NC D, D' \NC RadicalDisplayStyleVerticalGap \NC (default_rule_thickness+\crlf
- (abs(math_x_height)/4))$^3$ \NC \NR
-\NC " \NC T, T', S, S', SS, SS' \NC RadicalVerticalGap \NC (default_rule_thickness+\crlf
- (abs(default_rule_thickness)/4))$^3$ \NC \NR
+ (abs(math_x_height)/4))$^3$ \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC RadicalVerticalGap \NC (default_rule_thickness+\crlf
+ (abs(default_rule_thickness)/4))$^3$ \NC \NR
\NC \type {\Umathradicaldegreebefore} \NC -- \NC RadicalKernBeforeDegree \NC <not set>$^2$ \NC \NR
\NC \type {\Umathradicaldegreeafter} \NC -- \NC RadicalKernAfterDegree \NC <not set>$^2$ \NC \NR
\NC \type {\Umathradicaldegreeraise} \NC -- \NC RadicalDegreeBottomRaisePercent \NC <not set>$^{2,7}$ \NC \NR
\NC \type {\Umathspaceafterscript} \NC -- \NC SpaceAfterScript \NC script_space$^4$ \NC \NR
\NC \type {\Umathstackdenomdown} \NC D, D' \NC StackBottomDisplayStyleShiftDown \NC denom1 \NC \NR
-\NC " \NC T, T', S, S', SS, SS' \NC StackBottomShiftDown \NC denom2 \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC StackBottomShiftDown \NC denom2 \NC \NR
\NC \type {\Umathstacknumup} \NC D, D' \NC StackTopDisplayStyleShiftUp \NC num1 \NC \NR
-\NC " \NC T, T', S, S', SS, SS' \NC StackTopShiftUp \NC num3 \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC StackTopShiftUp \NC num3 \NC \NR
\NC \type {\Umathstackvgap} \NC D, D' \NC StackDisplayStyleGapMin \NC 7*default_rule_thickness \NC \NR
-\NC " \NC T, T', S, S', SS, SS' \NC StackGapMin \NC 3*default_rule_thickness \NC \NR
+\NC \NC T, T', S, S', SS, SS' \NC StackGapMin \NC 3*default_rule_thickness \NC \NR
\NC \type {\Umathsubshiftdown} \NC -- \NC SubscriptShiftDown \NC sub1 \NC \NR
\NC \type {\Umathsubshiftdrop} \NC -- \NC SubscriptBaselineDropMin \NC sub_drop \NC \NR
\NC \type {\Umathsubsupshiftdown} \NC -- \NC SubscriptShiftDownWithSuperscript$^8$ \NC \NC \NR
-\NC \NC \NC \quad\ or SubscriptShiftDown \NC sub2 \NC \NR
+\NC \NC \NC \quad\ or SubscriptShiftDown \NC sub2 \NC \NR
\NC \type {\Umathsubtopmax} \NC -- \NC SubscriptTopMax \NC (abs(math_x_height * 4) / 5) \NC \NR
\NC \type {\Umathsubsupvgap} \NC -- \NC SubSuperscriptGapMin \NC 4*default_rule_thickness \NC \NR
\NC \type {\Umathsupbottommin} \NC -- \NC SuperscriptBottomMin \NC (abs(math_x_height) / 4) \NC \NR
\NC \type {\Umathsupshiftdrop} \NC -- \NC SuperscriptBaselineDropMax \NC sup_drop \NC \NR
\NC \type {\Umathsupshiftup} \NC D \NC SuperscriptShiftUp \NC sup1 \NC \NR
-\NC " \NC T, S, SS, \NC SuperscriptShiftUp \NC sup2 \NC \NR
-\NC " \NC D', T', S', SS' \NC SuperscriptShiftUpCramped \NC sup3 \NC \NR
+\NC \NC T, S, SS, \NC SuperscriptShiftUp \NC sup2 \NC \NR
+\NC \NC D', T', S', SS' \NC SuperscriptShiftUpCramped \NC sup3 \NC \NR
\NC \type {\Umathsupsubbottommax} \NC -- \NC SuperscriptBottomMaxWithSubscript \NC (abs(math_x_height * 4) / 5) \NC \NR
\NC \type {\Umathunderbarkern} \NC -- \NC UnderbarExtraDescender \NC default_rule_thickness \NC \NR
\NC \type {\Umathunderbarrule} \NC -- \NC UnderbarRuleThickness \NC default_rule_thickness \NC \NR
@@ -498,13 +586,23 @@ font of the accentee (as explained in the \TEX book), but if value that turns ou
to be zero and the font had a MathConstants table, then \type {AccentBaseHeight}
is used instead.
-If a math bottom accent has to be placed, the \type {bot_accent} value is checked
-instead of \type {top_accent}. Because bottom accents do not exist in \TEX82, the
-\type {\skewchar} kern is ignored.
+% there is no bot_accent in opentype math
+%
+% If a math bottom accent has to be placed, the \type {bot_accent} value is checked
+% instead of \type {top_accent}. Because bottom accents do not exist in \TEX82, the
+% \type {\skewchar} kern is ignored.
The vertical placement of a bottom accent is straight below the accentee, no
correction takes place.
+Possible locations are \type {top}, \type {bottom}, \type {both} and \type
+{center}. When no location is given \type {top} is assumed. An additional
+parameter \type {fraction} can be specified followed by a number; a value of for
+instance 1200 means that the criterium is 1.2 times the width of the nuclues. The
+fraction only aplies to the stepwise selected shapes and is mostly meant for the
+\type {overlay} location. It also works for the other locations but then it
+concerns the width.
+
\section{Math root extension}
The new primitive \type {\Uroot} allows the construction of a radical noad
@@ -607,12 +705,126 @@ The vertical placements are controlled by \type {\Umathunderdelimiterbgap}, \typ
The superscript in \type {\Uoverdelimiter} is typeset in a suitable scripted style,
the subscript in \type {\Uunderdelimiter} is cramped as well.
-\section {Extensible delimiters}
+These primitives accepts an option \type {width} specification. When used the
+also optional keywords \type {left}, \type {middle} and \type {right} will
+determine what happens when a requested size can't be met (which can happen when
+we step to successive larger variants).
+
+An extra primitive \type {\Uhextensible} is available that can be used like this:
+
+\startbuffer
+$\Uhextensible width 10cm 0 "2194$
+\stopbuffer
+
+\typebuffer This will render this:
+
+\blank \startnarrower \getbuffer \stopnarrower \blank
+
+Here you can also pass options, like:
+
+\startbuffer
+$\Uhextensible width 1pt middle 0 "2194$
+\stopbuffer
+
+\typebuffer This gives:
+
+\blank \startnarrower \getbuffer \stopnarrower \blank
\LUATEX\ internally uses a structure that supports \OPENTYPE\ \quote
{MathVariants} as well as \TFM\ \quote {extensible recipes}.
-\section{Other Math changes}
+\section {Extracting values}
+
+You can extract the components of a math character. Say that we have defined:
+
+\starttyping
+\Umathcode 1 2 3 4
+\stoptyping
+
+then
+
+\starttyping
+[\Umathcharclass1] [\Umathcharfam1] [\Umathcharslot1]
+\stoptyping
+
+will return:
+
+\starttyping
+[2] [3] [4]
+\stoptyping
+
+These commands are provides as convenience. before they came available you could
+do the following:
+
+\starttyping
+\def\Umathcharclass{\directlua{tex.print(tex.getmathcode(token.scan_int())[1])}}
+\def\Umathcharfam {\directlua{tex.print(tex.getmathcode(token.scan_int())[2])}}
+\def\Umathcharslot {\directlua{tex.print(tex.getmathcode(token.scan_int())[3])}}
+\stoptyping
+
+\section{fractions}
+
+The \type {\abovewithdelims} command accepts a keyword \type {exact}. When issued
+the extra space relative to the rule thickness is not added. One can of course
+use the \type {\Umathfraction..gap} commands to influence the spacing. Also the
+rule is still positioned around the math axis.
+
+\starttyping
+$$ { {a} \abovewithdelims() exact 4pt {b} }$$
+\stoptyping
+
+The math parameter table contains some parameters that specify a horizontal and
+vertical gap for skewed fractions. Of course some guessing is needed in order to
+implement something that uses then. And so we now provide a primitive similar to the
+other fraction related ones but with a few options so that one can influence the
+rendering. Of course a user can mess around a bit with the parameters
+\type {\Umathskewedfractionhgap} and \type {\Umathskewedfractionvgap}.
+
+The syntax used here is:
+
+\starttyping
+{ {1} \Uskewed / <options> {2} }
+{ {1} \Uskewedwithdelims / () <options> {2} }
+\stoptyping
+
+where the options can be \type {noaxis} and \type {exact}. By default we add half
+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$}
+
+\start
+ \switchtobodyfont[modern]
+ \starttabulate[||||||]
+ \NC \NC
+ \ShowA{a}{b}{} \NC
+ \ShowA{1}{2}{} \NC
+ \ShowB{a}{b}{} \NC
+ \ShowB{1}{2}{} \NC
+ \NR
+ \NC \type{exact} \NC
+ \ShowA{a}{b}{exact} \NC
+ \ShowA{1}{2}{exact} \NC
+ \ShowB{a}{b}{exact} \NC
+ \ShowB{1}{2}{exact} \NC
+ \NR
+ \NC \type{noaxis} \NC
+ \ShowA{a}{b}{noaxis} \NC
+ \ShowA{1}{2}{noaxis} \NC
+ \ShowB{a}{b}{noaxis} \NC
+ \ShowB{1}{2}{noaxis} \NC
+ \NR
+ \NC \type{exact noaxis} \NC
+ \ShowA{a}{b}{exact noaxis} \NC
+ \ShowA{1}{2}{exact noaxis} \NC
+ \ShowB{a}{b}{exact noaxis} \NC
+ \ShowB{1}{2}{exact noaxis} \NC
+ \NR
+ \stoptabulate
+\stop
+
+\section {Other Math changes}
\subsection {Verbose versions of single-character math commands}
@@ -644,27 +856,181 @@ are the result of \type {\mathchardef} or \type {\Umathchardef} are also
acceptable in the horizontal and vertical modes. In those cases, the \type
{\textfont} from the requested math family is used.
-\section{Math todo}
+\section{Math surrounding skips}
+
+Inline math is surrounded by (optional) \type {\mathsurround} spacing but that is fixed
+dimension. There is now an additional parameter \type {\mathsurroundskip}. When set to a
+non|-|zero value (or zero with some stretch or shrink) this parameter will replace
+\type {\mathsurround}. By using an additional parameter instead of changing the nature
+of \type {\mathsurround}, we can remain compatible.
+
+% \section{Math todo}
+%
+% The following items are still todo.
+%
+% \startitemize
+% \startitem
+% Pre-scripts.
+% \stopitem
+% \startitem
+% Multi-story stacks.
+% \stopitem
+% \startitem
+% Flattened accents for high characters (maybe).
+% \stopitem
+% \startitem
+% Better control over the spacing around displays and handling of equation numbers.
+% \stopitem
+% \startitem
+% Support for multi|-|line displays using \MATHML\ style alignment points.
+% \stopitem
+% \stopitemize
+
+\subsection {Delimiters: \type{\Uleft}, \type {\Umiddle} and \type {\Uright}}
+
+Normally you will force delimiters to certain sizes by putting an empty box or
+rule next to it. The resulting delimiter will either be a character from the
+stepwise size range or an extensible. The latter can be quite differently
+positioned that the characters as it depends on the fit aas well as the fact if
+the used characters in the font have depth or height. Commands like (plain \TEX
+s) \type {\big} need use this feature. In \LUATEX\ we provide a bit more control
+by three variants that supporting optional parameters \type {height}, \type
+{depth} and \type {axis}. The following example uses this:
-The following items are still todo.
+\startbuffer
+\Uleft height 30pt depth 10pt \Udelimiter "0 "0 "000028
+\quad x\quad
+\Umiddle height 40pt depth 15pt \Udelimiter "0 "0 "002016
+\quad x\quad
+\Uright height 30pt depth 10pt \Udelimiter "0 "0 "000029
+\quad \quad \quad
+\Uleft height 30pt depth 10pt axis \Udelimiter "0 "0 "000028
+\quad x\quad
+\Umiddle height 40pt depth 15pt axis \Udelimiter "0 "0 "002016
+\quad x\quad
+\Uright height 30pt depth 10pt axis \Udelimiter "0 "0 "000029
+\stopbuffer
-\startitemize
-\startitem
- Pre-scripts.
-\stopitem
-\startitem
- Multi-story stacks.
-\stopitem
-\startitem
- Flattened accents for high characters (maybe).
-\stopitem
-\startitem
- Better control over the spacing around displays and handling of equation numbers.
-\stopitem
-\startitem
- Support for multi|-|line displays using \MATHML\ style alignment points.
-\stopitem
-\stopitemize
+\typebuffer
+
+\startlinecorrection
+\ruledhbox{\mathematics{\getbuffer}}
+\stoplinecorrection
+
+The keyword \type {exact} can be used as directive that the real dimensions
+should be applied when the criteria can't be met which can happen when we're
+still stepping through the succesively larger variants. When no dimensions are
+given the \type {noaxis} command can be used to prevent shifting over the axis.
+
+You can influence the final class with the keyword \type {class} which will
+influence the spacing.
+
+\subsection{Fixed scripts}
+
+We have three parameters that are used for this fixed anchoring:
+
+\starttabulate[|l|l|]
+\NC $d$ \NC \type {\Umathsubshiftdown} \NC \NR
+\NC $u$ \NC \type {\Umathsupshiftup} \NC \NR
+\NC $s$ \NC \type {\Umathsubsupshiftdown} \NC \NR
+\stoptabulate
+
+When we set \type {\mathscriptsmode} to a value other than zero these are used
+for calculating fixed positions. This is something that is needed for instance
+for chemistry. You can manipulate the mentioned variables to achive different
+effects.
+
+\def\SampleMath#1%
+ {$\mathscriptsmode#1\mathupright CH_2 + CH^+_2 + CH^2_2$}
+
+\starttabulate[|c|c|c|l|]
+\NC \bf mode \NC \bf down \NC \bf up \NC \NC \NR
+\NC 0 \NC dynamic \NC dynamic \NC \SampleMath{0} \NC \NR
+\NC 1 \NC $d$ \NC $u$ \NC \SampleMath{1} \NC \NR
+\NC 2 \NC $s$ \NC $u$ \NC \SampleMath{2} \NC \NR
+\NC 3 \NC $s$ \NC $u + s - d$ \NC \SampleMath{3} \NC \NR
+\NC 4 \NC $d + (s-d)/2$ \NC $u + (s-d)/2$ \NC \SampleMath{4} \NC \NR
+\NC 5 \NC $d$ \NC $u + s - d$ \NC \SampleMath{5} \NC \NR
+\stoptabulate
+
+The value of this parameter obeys grouping but applies to the whole current
+formula.
+
+% if needed we can put the value in stylenodes but maybe more should go there
+
+
+\subsection {Math options}
+
+The logic in the math engine is rather complex and there are often no universal
+solutions (read: what works out well for one font, fails for another). Therefore
+some variations in the implementation will be driven by options for which a new
+primitive \type {\mathoption} has been introduced (so that we don't end up with
+many new commands). The approach of options also permits us to see what effect a
+specific solution has.
+
+\subsubsection {\type {\mathoption noitaliccompensation}}
+
+This option compensates placement for characters with a built|-|in italic
+correction.
+
+\startbuffer
+{\showboxes\int}\quad
+{\showboxes\int_{|}^{|}}\quad
+{\showboxes\int\limits_{|}^{|}}
+\stopbuffer
+
+\typebuffer
+
+Gives (with computer modern that has such italics):
+
+\startlinecorrection[blank]
+ \switchtobodyfont[modern]
+ \startcombination[nx=2,ny=2,distance=5em]
+ {\mathoption noitaliccompensation 0\relax \mathematics{\getbuffer}}
+ {\nohyphens\type{0:inline}}
+ {\mathoption noitaliccompensation 0\relax \mathematics{\displaymath\getbuffer}}
+ {\nohyphens\type{0:display}}
+ {\mathoption noitaliccompensation 1\relax \mathematics{\getbuffer}}
+ {\nohyphens\type{1:inline}}
+ {\mathoption noitaliccompensation 1\relax \mathematics{\displaymath\getbuffer}}
+ {\nohyphens\type{1:display}}
+ \stopcombination
+\stoplinecorrection
+
+\subsubsection {\type {\mathoption nocharitalic}}
+
+When two characters follow each other italic correction can interfere. The
+following example shows what this option does:
+
+\startbuffer
+\catcode"1D443=11
+\catcode"1D444=11
+\catcode"1D445=11
+P( PP PQR
+\stopbuffer
+
+\typebuffer
+
+Gives (with computer modern that has such italics):
+
+\startlinecorrection[blank]
+ \switchtobodyfont[modern]
+ \startcombination[nx=2,ny=2,distance=5em]
+ {\mathoption nocharitalic 0\relax \mathematics{\getbuffer}}
+ {\nohyphens\type{0:inline}}
+ {\mathoption nocharitalic 0\relax \mathematics{\displaymath\getbuffer}}
+ {\nohyphens\type{0:display}}
+ {\mathoption nocharitalic 1\relax \mathematics{\getbuffer}}
+ {\nohyphens\type{1:inline}}
+ {\mathoption nocharitalic 1\relax \mathematics{\displaymath\getbuffer}}
+ {\nohyphens\type{1:display}}
+ \stopcombination
+\stoplinecorrection
+
+\subsubsection {\type {\mathoption useoldfractionscaling}}
+
+This option has been introduced as solution for tracker item 604 for fuzzy cases
+around either or not present fraction related settings for new fonts.
\stopchapter