summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/math
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-01-12 08:12:50 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-01-12 08:12:50 +0100
commitd0edf3e90e8922d9c672f24ecdc5d44fe2716f31 (patch)
tree5b618b87aa5078a8c744c94bbf058d69cd7111b2 /doc/context/sources/general/manuals/math
parent409a95f63883bd3b91699d39645e39a8a761457c (diff)
downloadcontext-d0edf3e90e8922d9c672f24ecdc5d44fe2716f31.tar.gz
2018-01-08 23:11:00
Diffstat (limited to 'doc/context/sources/general/manuals/math')
-rw-r--r--doc/context/sources/general/manuals/math/math-alignments.tex253
-rw-r--r--doc/context/sources/general/manuals/math/math-definitions.tex101
-rw-r--r--doc/context/sources/general/manuals/math/math-features.tex78
-rw-r--r--doc/context/sources/general/manuals/math/math-input.tex100
-rw-r--r--doc/context/sources/general/manuals/math/math-introduction.tex2
-rw-r--r--doc/context/sources/general/manuals/math/math-layout.tex9
-rw-r--r--doc/context/sources/general/manuals/math/math-mkiv.tex4
-rw-r--r--doc/context/sources/general/manuals/math/math-numbering.tex55
-rw-r--r--doc/context/sources/general/manuals/math/math-suboptimal.tex41
-rw-r--r--doc/context/sources/general/manuals/math/math-tricks.tex150
10 files changed, 789 insertions, 4 deletions
diff --git a/doc/context/sources/general/manuals/math/math-alignments.tex b/doc/context/sources/general/manuals/math/math-alignments.tex
new file mode 100644
index 000000000..86fedb569
--- /dev/null
+++ b/doc/context/sources/general/manuals/math/math-alignments.tex
@@ -0,0 +1,253 @@
+\environment math-layout
+
+\startcomponent math-alignments
+
+\startchapter[title=Alignments and such]
+
+\startsection[title=Using ampersands]
+
+When you come from plain \TEX, using ampersands probably comes as a custom, like in:
+
+\startbuffer
+\startformula
+\bordermatrix {
+ a & b & c & d \cr
+ e & f & G & h \cr
+ i & j & k & l \cr
+}
+\stopformula
+\stopbuffer
+
+\typebuffer \getbuffer
+
+or:
+
+\startbuffer
+\startformula
+\bbordermatrix {
+ a & b & c & d \cr
+ e & f & G & h \cr
+ i & j & k & l \cr
+}
+\stopformula
+\stopbuffer
+
+\typebuffer \getbuffer
+
+A more \CONTEXT\ way is this:
+
+\startbuffer
+\startformula
+\startbordermatrix
+ \NC a \NC b \NC c \NC d \NR
+ \NC e \NC f \NC G \NC h \NR
+ \NC i \NC j \NC k \NC l \NR
+\stopbordermatrix
+\stopformula
+\stopbuffer
+
+\typebuffer \getbuffer
+
+and:
+
+\startbuffer
+\startformula
+\startbbordermatrix
+ \NC a \NC b \NC c \NC d \NR
+ \NC e \NC f \NC G \NC h \NR
+ \NC i \NC j \NC k \NC l \NR
+\stopbbordermatrix
+\stopformula
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Just that you know. In general ampersands in \CONTEXT\ text mode are just that:
+ampersands, not something alignment related.
+
+\stopsection
+
+\startsection[title=Locations]
+
+The \type {location} feature gives some control over the alignment of alignments.
+The following examples are taken from an email exchange with Henri Menke.
+
+\startbuffer
+\startplaceformula
+ \startformula
+ \startmathalignment[location=top]
+ \NC a + b \NC= c + d \NR
+ \NC a + b \NC= c + d \NR
+ \NC a + b \NC= c + d \NR
+ \stopmathalignment
+ \quad\text{or}\quad
+ \startmathalignment[location=center]
+ \NC a + b \NC= c + d \NR
+ \NC a + b \NC= c + d \NR
+ \NC a + b \NC= c + d \NR
+ \stopmathalignment
+ \quad\text{or}\quad
+ \startmathalignment[location=bottom]
+ \NC a + b \NC= c + d \NR
+ \NC a + b \NC= c + d \NR
+ \NC a + b \NC= c + d \NR
+ \stopmathalignment
+ \stopformula
+\stopplaceformula
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Numbering works ok for a single mathalignment
+
+\startbuffer
+\startplaceformula
+ \startformula
+ \startmathalignment[number=auto]
+ \NC a + b \NC= c + d \NR
+ \NC a + b \NC= c + d \NR
+ \NC a + b \NC= c + d \NR
+ \stopmathalignment
+ \stopformula
+\stopplaceformula
+\stopbuffer
+
+\typebuffer \getbuffer
+
+But for one with a location the results are suboptimal:
+
+\startbuffer
+\startplaceformula
+ \startformula
+ \startmathalignment[location=center,number=auto]
+ \NC a + b \NC= c + d \NR
+ \NC a + b \NC= c + d \NR
+ \NC a + b \NC= c + d \NR
+ \stopmathalignment
+ \stopformula
+\stopplaceformula
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Here is a real example:
+
+\startbuffer
+\startplaceformula
+ \startformula
+ U_2 = \frac{1}{2!}
+ \int_0^\beta \diff\tau_1 \int_0^\beta \diff\tau_2\;
+ \sum_{\startsubstack k_1,q_1 \NR k_2,q_2 \stopsubstack}
+ \Bigl\langle
+ \startmathalignment[location=top,align=left]
+ \NC
+ \mathcal T \Bigl[
+ c_{k_1}^\dagger (\tau_1)
+ \Delta_{k_1,q_1}^r c_{-k_1}^* (\tau_1) + c_{-q_1}^T (\tau_1)
+ \Delta_{k_1,q_1}^{r\dagger} c_{q_1} (\tau_1)
+ \Bigr]
+ \NR
+ \NC
+ \times \Bigl[
+ c_{k_2}^\dagger(\tau_2) \Delta_{k_2,q_2}^r c_{-k_2}^*
+ (\tau_2) + c_{-q_2}^T (\tau_2) \Delta_{k_2,q_2}^{r\dagger}
+ c_{q_2} (\tau_2)
+ \Bigr] \Bigr\rangle .
+ \NR
+ \stopmathalignment
+ \stopformula
+\stopplaceformula
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\stopsection
+
+\startsection[title=Tuning alignments]
+
+Again a few examples of manipulating alignments. It really helps to play
+with examples if you want to get an idea what is possible.
+
+\startbuffer
+\startformula
+ \startalign[m=2,align={middle}]
+ \NC \text to 6cm{} \NC x = 0 \NR
+ \stopalign
+\stopformula
+
+\startformula
+ \startalign[m=2,align={middle}]
+ \NC \text to 6cm{One\hfill} \NC a = 1 \NR
+ \NC \text to 6cm{One Two\hfill} \NC b = 2 \NR
+ \NC \text to 6cm{One Two Three\hfill} \NC c = 3 \NR
+ \stopalign
+\stopformula
+
+\startformula
+ \startalign[m=2,align={left}]
+ \NC \text to 6cm{One\hfill} \NC a = 1 \NR
+ \NC \text to 6cm{One Two\hfill} \NC b = 2 \NR
+ \NC \text to 6cm{One Two Three\hfill} \NC c = 3 \NR
+ \stopalign
+\stopformula
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startformula
+ \startalign[m=2,align={middle}]
+ \NC \text to 6cm{} \NC x = 0 \NR
+ \stopalign
+\stopformula
+
+\startformula
+ \startalign[m=2,align={middle}]
+ \NC \text to 6cm{One} \NC a = 1 \NR
+ \NC \text to 6cm{One Two} \NC b = 2 \NR
+ \NC \text to 6cm{One Two Three} \NC c = 3 \NR
+ \stopalign
+\stopformula
+
+\startformula
+ \startalign[m=2,align={left}]
+ \NC \text to 6cm{One} \NC a = 1 \NR
+ \NC \text to 6cm{One Two} \NC b = 2 \NR
+ \NC \text to 6cm{One Two Three} \NC c = 3 \NR
+ \stopalign
+\stopformula
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startformula
+ \startalign[m=2,align={middle}]
+ \NC \text{} \NC x = 0 \NR
+ \stopalign
+\stopformula
+
+\startformula
+ \startalign[m=2,align={middle}]
+ \NC \text{One} \NC a = 1 \NR
+ \NC \text{One Two} \NC b = 2 \NR
+ \NC \text{One Two Three} \NC c = 3 \NR
+ \stopalign
+\stopformula
+
+\startformula
+ \startalign[m=2,align={left}]
+ \NC \text{One} \NC a = 1 \NR
+ \NC \text{One Two} \NC b = 2 \NR
+ \NC \text{One Two Three} \NC c = 3 \NR
+ \stopalign
+\stopformula
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/math/math-definitions.tex b/doc/context/sources/general/manuals/math/math-definitions.tex
new file mode 100644
index 000000000..d8903121a
--- /dev/null
+++ b/doc/context/sources/general/manuals/math/math-definitions.tex
@@ -0,0 +1,101 @@
+\environment math-layout
+
+\startcomponent math-definitions
+
+\startchapter[title=Definitions]
+
+\startsection[title=Special stackers]
+
+There are many math symbols but never enough. Here is an example of how you can
+roll out your own. We start out with nothing:
+
+\startbuffer
+\definemathstackers
+ [nosymbol]
+ [voffset=\zeropoint,
+ hoffset=\zeropoint,
+ mathclass=ord,
+ topoffset=\zeropoint,
+ middlecommand=,
+ color=maincolor]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+You can now use this class of stackers:
+
+\startbuffer
+\startformula
+ \mathover [nosymbol] {"2217} {A}
+ \mathover [nosymbol] {"2218} {A}
+ \mathover [nosymbol] {"2219} {A}
+\stopformula
+\stopbuffer
+
+\typebuffer
+
+This looks like this:
+
+\getbuffer
+
+But we want proper math, which means an an italic nucleus, a properly placed
+accent, a shift of that accent matching the slope or the nucleus, so we actually
+need:
+
+\startbuffer
+\definemathstackers
+ [mysymbol]
+ [voffset=-.30\mathexheight,
+ hoffset=\zeropoint,
+ mathclass=ord,
+ topoffset=.4\mathemwidth,
+ middlecommand=\mathematics,
+ color=maincolor]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startformula
+ \mathover [mysymbol]{"2217} {A}
+ \mathover [mysymbol]{"2218} {A}
+ \mathover [mysymbol]{"2219} {A}
+ \mathunder [mysymbol] {"2217}{A}
+ \mathunder [mysymbol] {"2218}{A}
+ \mathunder [mysymbol] {"2219}{A}
+ \mathdouble[mysymbol]{"2217}{"2217}{A}
+ \mathdouble[mysymbol]{"2218}{"2218}{A}
+ \mathdouble[mysymbol]{"2219}{"2219}{A}
+\stopformula
+\stopbuffer
+
+We show both over and under variants:
+
+\typebuffer
+
+So this time we get:
+
+\getbuffer
+
+We can now redefine the \quote {interiorset} symbol to use
+\type {0x2217} instead of \type {0x2218}:
+
+\startbuffer
+\definemathover[mysymbol][interiorset]["2217]
+
+\startformula
+ \interiorset{A}^{\interiorset{A}^{\interiorset{A}}}
+\stopformula
+\stopbuffer
+
+\typebuffer
+
+Of course normally you will not use color:
+
+\getbuffer
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/math/math-features.tex b/doc/context/sources/general/manuals/math/math-features.tex
index 3869c575e..863493804 100644
--- a/doc/context/sources/general/manuals/math/math-features.tex
+++ b/doc/context/sources/general/manuals/math/math-features.tex
@@ -122,6 +122,84 @@ show the plus sign.
\stopsection
+\startsection[title=Script kerning]
+
+Text in math is somewhat special. First of all, a math font is not a text fonts
+because the characters and glyphs have a different purpose. Text features are
+normally not present (and often not even wanted). Anyway, you can force a text
+font, but that doesn't mean you will get for instance kerning. You can force a
+box which in turn will trigger font processing, but then you normally loose the
+script related size properties. So we end up with some juggling possibly combined
+with user intervention, and that is what the \type {\text} macro does.
+
+But still there is the kern between a variable and its subscript to consider,
+something that normally is dealt with with staircase kerns, an \OPENTYPE\ math
+speciality. But, as we progress over the math list, and we bind a subscript to a
+variable, that subscript can be anything: a simple character, or more characters
+(a list) or something wrapped in a box. There is simply no universal solution
+that we can hard code because sometimes you don't want that special kerning. This
+is why in \LUATEX\ the integer variable \type {\mathscriptboxmode} controls the
+way this is dealt with.
+
+\starttabulate[|l|p|]
+\NC \type {0} \NC forget about kerning \NC \NR
+\NC \type {1} \NC kern math sub lists with a valid glyph (default in the engine) \NC \NR
+\NC \type {2} \NC also kern math sub boxes that have a valid glyph (default in \CONTEXT) \NC \NR
+\NC \type {3} \NC only kern math sub boxes with a boundary node present \NC \NR
+\stoptabulate
+
+Here we show some examples of how this parameter controls kerning. Watch the
+difference between a simple font switch and a text wrapped in a box. There are
+differences between fonts: some fonts have kerns, some don't. When present kerns
+are passed to the engine without further user intervention.
+
+\startbuffer[1]
+ $T_{\tf fluff}$
+\stopbuffer
+
+\startbuffer[2]
+ $T_{\text{fluff}}$
+\stopbuffer
+
+\startbuffer[3]
+ $T_{\text{\boundary1 fluff}}$
+\stopbuffer
+
+\unexpanded\def\Show#1#2#3%
+ {\doifelsenothing{#3}
+ {\typeinlinebuffer[#1]}
+ {\doifelse{#3}{-}
+ {\type{mode #2}}
+ {\switchtobodyfont[#3,big]\setstrut\strut\showfontkerns\showglyphs\mathscriptboxmode#2\relax\inlinebuffer[#1]}}}
+
+% \starttabulate[|lT|c|c|c|c|c|]
+% \NC \NC \Show{1}{0}{} \NC\Show{1}{1}{} \NC \Show{2}{1}{} \NC \Show{2}{2}{} \NC \Show{3}{3}{} \NC \NR
+% \NC \NC \Show{1}{0}{-} \NC\Show{1}{1}{-} \NC \Show{2}{1}{-} \NC \Show{2}{2}{-} \NC \Show{3}{3}{-} \NC \NR
+% \NC modern \NC \Show{1}{0}{modern} \NC\Show{1}{1}{modern} \NC \Show{2}{1}{modern} \NC \Show{2}{2}{modern} \NC \Show{3}{3}{modern} \NC \NR
+% \NC lucidaot \NC \Show{1}{0}{lucidaot} \NC\Show{1}{1}{lucidaot} \NC \Show{2}{1}{lucidaot} \NC \Show{2}{2}{lucidaot} \NC \Show{3}{3}{lucidaot} \NC \NR
+% \NC pagella \NC \Show{1}{0}{pagella} \NC\Show{1}{1}{pagella} \NC \Show{2}{1}{pagella} \NC \Show{2}{2}{pagella} \NC \Show{3}{3}{pagella} \NC \NR
+% \NC cambria \NC \Show{1}{0}{cambria} \NC\Show{1}{1}{cambria} \NC \Show{2}{1}{cambria} \NC \Show{2}{2}{cambria} \NC \Show{3}{3}{cambria} \NC \NR
+% \NC dejavu \NC \Show{1}{0}{dejavu} \NC\Show{1}{1}{dejavu} \NC \Show{2}{1}{dejavu} \NC \Show{2}{2}{dejavu} \NC \Show{3}{3}{dejavu} \NC \NR
+% \stoptabulate
+
+\def\ShowMore#1#2%
+ {\subsubject{\Show{#1}{#2}{} (\Show{#1}{#2}{-})}
+ \starttabulate[|lT|c|c|c|c|c|]
+ \NC modern \NC \Show{#1}{#2}{modern} \NC \NR
+ \NC lucidaot \NC \Show{#1}{#2}{lucidaot} \NC \NR
+ \NC pagella \NC \Show{#1}{#2}{pagella} \NC \NR
+ \NC cambria \NC \Show{#1}{#2}{cambria} \NC \NR
+ \NC dejavu \NC \Show{#1}{#2}{dejavu} \NC \NR
+ \stoptabulate}
+
+\ShowMore{1}{0}
+\ShowMore{1}{1}
+\ShowMore{2}{1}
+\ShowMore{2}{2}
+\ShowMore{3}{3}
+
+\stopsection
+
\stopchapter
\stopcomponent
diff --git a/doc/context/sources/general/manuals/math/math-input.tex b/doc/context/sources/general/manuals/math/math-input.tex
new file mode 100644
index 000000000..d395e1865
--- /dev/null
+++ b/doc/context/sources/general/manuals/math/math-input.tex
@@ -0,0 +1,100 @@
+% language=uk
+
+\environment math-layout
+
+\startcomponent math-input
+
+\startchapter[title=Inputting math]
+
+\startsection[title=Collapsing]
+
+When in text mode you enter a combination of combining accent and character, a
+composed character is assumed and often you then get one shape in your document.
+A similar feature is available in math mode. After some discussion and analysis
+of the potential clashes and confusion (thanks to Aditya Mahajan) we settled on a
+combination of methods: so called math lists entries that we entered in the
+character database and|/|or so called special sequences that are part of
+\UNICODE. In the next tables we use \type {ml} for math list and \type {sp} for
+specials. Collapsing mode \type {1} only uses the specials, while \type {2} first
+checks the specials and then the math lists, and \type {3} does the reverse.
+
+In the database you can find this (a few fields have been omitted):
+
+\starttyping
+[0x2260] = {
+ adobename = "notequal",
+ category = "sm",
+ description = "NOT EQUAL TO",
+ mathlist = { 0x2F, 0x3D },
+ mathspec = {
+ {
+ class = "relation",
+ name = "neq",
+ },
+ {
+ class = "relation",
+ name = "ne",
+ },
+ },
+ specials = { "char", 0x3D, 0x338 },
+ unicodeslot = 0x2260,
+}
+\stoptyping
+
+and
+
+\starttyping
+[0x2261] = {
+ adobename = "equivalence",
+ category = "sm",
+ description = "IDENTICAL TO",
+ mathclass = "relation",
+ mathextensible = "h",
+ mathname = "equiv",
+ mathlist = { 0x3D, 0x3D },
+ unicodeslot = 0x2261,
+}
+\stoptyping
+
+Here are a few examples:
+
+\def\Test#1%
+ {\NC \bf \type{$#1$}
+ \NC \setupmathematics[collapsing=0] $#1$
+ \NC \setupmathematics[collapsing=1] $#1$
+ \NC \setupmathematics[collapsing=2] $#1$
+ \NC \setupmathematics[collapsing=3] $#1$ \NC \NR}
+
+\starttabulate[|c|cp|cp|cp|cp|]
+ \NC \BC \ttbf 0 \BC \ttbf 1 (sp) \BC \ttbf 2 (sp ml) \BC \ttbf 3 (ml sp) \BC \NR
+ \Test{==}
+ \Test{/=}
+ \Test{>=}
+\stoptabulate
+
+A complete list of collapses can be generated after loading one of the tracing
+modules:
+
+\startbuffer
+\usemodule[math-ligatures]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+This provides the command:
+
+\startbuffer
+\showmathligatures
+\stopbuffer
+
+\typebuffer
+
+which gives:
+
+\start \switchtobodyfont[8pt] \getbuffer \stop
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/math/math-introduction.tex b/doc/context/sources/general/manuals/math/math-introduction.tex
index c89d1d7b1..de7c0a960 100644
--- a/doc/context/sources/general/manuals/math/math-introduction.tex
+++ b/doc/context/sources/general/manuals/math/math-introduction.tex
@@ -7,7 +7,7 @@
This manual is not a systematic discussion about math in \CONTEXT\ but more a
collection of wrap|-|ups. The file also serves as testcase. The content can
change over time and can also serve as a trigger for discussions on the mailing
-list. Suggestions are welcome.
+list. Content gets added sort of random. Suggestions are welcome.
We discuss high level as well as low level commands. Some of the low level
commands (primitives) are wrapped in high level commands but you can of course
diff --git a/doc/context/sources/general/manuals/math/math-layout.tex b/doc/context/sources/general/manuals/math/math-layout.tex
index 5e84c996e..83137444d 100644
--- a/doc/context/sources/general/manuals/math/math-layout.tex
+++ b/doc/context/sources/general/manuals/math/math-layout.tex
@@ -39,21 +39,24 @@
height=middle,
width=middle]
+\definecolor[maincolor] [darkmagenta]
+\definecolor[extracolor][darkyellow]
+
\setuphead
[chapter]
[header=high,
style=\bfc,
- color=darkmagenta]
+ color=maincolor]
\setuphead
[section]
[style=\bfb,
- color=darkmagenta]
+ color=maincolor]
\setuphead
[subsection]
[style=\bfa,
- color=darkmagenta]
+ color=maincolor]
\usemodule[abr-02]
diff --git a/doc/context/sources/general/manuals/math/math-mkiv.tex b/doc/context/sources/general/manuals/math/math-mkiv.tex
index f36b1032d..93409fd79 100644
--- a/doc/context/sources/general/manuals/math/math-mkiv.tex
+++ b/doc/context/sources/general/manuals/math/math-mkiv.tex
@@ -31,11 +31,15 @@
\stopfrontmatter
\startbodymatter
+ \component math-input
+ \component math-definitions
\component math-spacing
\component math-framing
\component math-numbering
\component math-combining
\component math-features
+ \component math-alignments
+ \component math-suboptimal
\component math-tricks
\stopbodymatter
diff --git a/doc/context/sources/general/manuals/math/math-numbering.tex b/doc/context/sources/general/manuals/math/math-numbering.tex
index 64f766628..1576e17bb 100644
--- a/doc/context/sources/general/manuals/math/math-numbering.tex
+++ b/doc/context/sources/general/manuals/math/math-numbering.tex
@@ -69,6 +69,61 @@ are some examples:
\typebuffer \getbuffer
+In the next examples we demonstrate how we can avoid numbering, pass a reference as key,
+use assignments instead and add a title or suffix.
+
+\startbuffer
+\startplaceformula
+ \startformula e=mc^2 \stopformula
+\stopplaceformula
+\startplaceformula[-]
+ \startformula e=mc^2 \stopformula
+\stopplaceformula
+\startplaceformula[p]
+ \startformula e=mc^2 \stopformula
+\stopplaceformula
+\startplaceformula[reference=foo]
+ \startformula e=mc^2 \stopformula
+\stopplaceformula
+\startplaceformula[title=whatever]
+ \startformula e=mc^2 \stopformula
+\stopplaceformula
+\startplaceformula[suffix=q]
+ \startformula e=mc^2 \stopformula
+\stopplaceformula
+\startplaceformula[r]
+ \startformula e=mc^2 \stopformula
+\stopplaceformula
+\stopbuffer
+
+\typebuffer \getbuffer
+
+If you want consistent spacing you can enforce this:
+
+\startbuffer
+\startplaceformula[s]
+ \startformula e=mc^2 \stopformula
+\stopplaceformula
+\startplaceformula[-]
+ \startformula e=mc^2 \stopformula
+\stopplaceformula
+\startplaceformula[-]
+ \startformula e=mc^2 \stopformula
+\stopplaceformula
+\setupformulas[numberstrut=always]
+\startplaceformula[-]
+ \startformula e=mc^2 \stopformula
+\stopplaceformula
+\startplaceformula[-]
+ \startformula e=mc^2 \stopformula
+\stopplaceformula
+\stopbuffer
+
+\typebuffer \start \showstruts \getbuffer \stop
+
+Possible values for \type {numberstrut} are \type {yes} (the default), \type
+{always} and \type {no}.
+
\stopchapter
\stopcomponent
diff --git a/doc/context/sources/general/manuals/math/math-suboptimal.tex b/doc/context/sources/general/manuals/math/math-suboptimal.tex
new file mode 100644
index 000000000..f86539d55
--- /dev/null
+++ b/doc/context/sources/general/manuals/math/math-suboptimal.tex
@@ -0,0 +1,41 @@
+\environment math-layout
+
+\startcomponent math-subtoptimal
+
+\startchapter[title=Suboptimal]
+
+\startsection[title=Extensibles]
+
+Extensibles are implemented as follows: we start with the default shape, and when
+that doesn't cover the body of text, a next size is chosen. When we run out of
+sizes, a glyph is made from snippets (often a start glyph, overlapping middle
+pieces and an end piece. Of course a font needs to provide these variants and
+snippets.
+
+However, the quality of the coverage can differ per font. Here we show how Latin
+Modern, Pagella, Cambria, Lucida and Dejavu look like:
+
+\showglyphs
+
+\starttexdefinition ShowSample #1#2
+ \start
+ \switchtobodyfont [#1]
+ #2: \dorecurse{50}{$\vec{\blackrule[width=##1pt]}$\space}\unskip
+ \par
+ \stop
+\stoptexdefinition
+
+\ShowSample{modern} {Latin Modern} \blank
+\ShowSample{pagella} {Pagella} \blank
+\ShowSample{cambria} {Cambria} \blank
+\ShowSample{lucidaot}{Lucida} \blank
+\ShowSample{dejavu} {Dejavu}
+
+Of course fonts can be improved (or patched) and these samples might come out
+better compared to previous renderings.
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/math/math-tricks.tex b/doc/context/sources/general/manuals/math/math-tricks.tex
index 5c0315f8d..7efcec50b 100644
--- a/doc/context/sources/general/manuals/math/math-tricks.tex
+++ b/doc/context/sources/general/manuals/math/math-tricks.tex
@@ -454,6 +454,156 @@ defined explicitly.
\stopsection
+\startsection[title=Middle class fences]
+
+The next examples are somewhat obscure. They are a side effect of some extensions
+to the engine that were introduced to control spacing around the \type {\middle}
+class fences. Actually there is no real middle class and spacing was somewhat
+hard codes when \type {\middle} was added to \ETEX. In \LUATEX\ we have
+introduced keywords to some primitives that control spacing and other properties.
+This permits better control over spacing than messing around with (for instance)
+injected \type {\mathrel} commands that can have their own side effects.
+
+\startbuffer
+\def\Middle{\middle|}
+\def\Riddle{\Umiddle class 5 |}
+\def\Left {\left (}
+\def\Right {\right )}
+\def\Rel {\mathrel{}}
+\def\Per {\mathrel{.}}
+\stopbuffer
+
+\startbuffer[1a]
+$ a b $
+\stopbuffer
+\startbuffer[1b]
+$ \Rel a\Rel b\Rel $
+\stopbuffer
+
+\startbuffer[2a]
+$ a b $
+\stopbuffer
+\startbuffer[2b]
+$ \Per a\Per b\Per $
+\stopbuffer
+
+\startbuffer[3a]
+$\Left a \Middle b \Right$
+\stopbuffer
+\startbuffer[3b]
+$\Left\Rel a \Middle\Rel b\Rel\Right$
+\stopbuffer
+
+\startbuffer[4a]
+$\Left a \Middle b \Right$
+\stopbuffer
+\startbuffer[4b]
+$\Left\Rel a \Middle\Per b\Per\Right$
+\stopbuffer
+
+\startbuffer[5a]
+$\Left a \Middle b \Right$
+\stopbuffer
+\startbuffer[5b]
+$\Left\Rel a\Rel\Middle\Rel b\Rel\Right$
+\stopbuffer
+
+\startbuffer[6a]
+$\Left a \Middle b \Right$
+\stopbuffer
+\startbuffer[6b]
+$\Left\Per a\Per\Middle\Per b\Per\Right$
+\stopbuffer
+
+\startbuffer[7a]
+$\Left a \Riddle b \Right$
+\stopbuffer
+\startbuffer[7b]
+$\Left\Rel a \Riddle\Rel b\Rel\Right$
+\stopbuffer
+
+\startbuffer[8a]
+$\Left a \Riddle b \Right$
+\stopbuffer
+\startbuffer[8b]
+$\Left\Rel a \Riddle\Per b\Per\Right$
+\stopbuffer
+
+\startbuffer[9a]
+$\Left a \Riddle b \Right$
+\stopbuffer
+\startbuffer[9b]
+$\Left\Rel a\Rel\Riddle\Rel b\Rel\Right$
+\stopbuffer
+
+\startbuffer[10a]
+$\Left a \Riddle b \Right$
+\stopbuffer
+\startbuffer[10b]
+$\Left\Per a\Per\Riddle\Per b\Per\Right$
+\stopbuffer
+
+We use the following definitions:
+
+\typebuffer
+
+Applied to samples these give the following outcome and spacing:
+
+\start
+ \getbuffer
+
+ \starttabulate
+ \NC \ruledhbox{\typeinlinebuffer[1a]} \NC \showglyphs \inlinebuffer[1a] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[1b]} \NC \showglyphs \inlinebuffer[1b] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[2a]} \NC \showglyphs \inlinebuffer[2a] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[2b]} \NC \showglyphs \inlinebuffer[2b] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[3a]} \NC \showglyphs \inlinebuffer[3a] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[3b]} \NC \showglyphs \inlinebuffer[3b] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[4a]} \NC \showglyphs \inlinebuffer[4a] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[4b]} \NC \showglyphs \inlinebuffer[4b] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[5a]} \NC \showglyphs \inlinebuffer[5a] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[5b]} \NC \showglyphs \inlinebuffer[5b] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[6a]} \NC \showglyphs \inlinebuffer[6a] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[6b]} \NC \showglyphs \inlinebuffer[6b] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[7a]} \NC \showglyphs \inlinebuffer[7a] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[7b]} \NC \showglyphs \inlinebuffer[7b] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[8a]} \NC \showglyphs \inlinebuffer[8a] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[8b]} \NC \showglyphs \inlinebuffer[8b] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[9a]} \NC \showglyphs \inlinebuffer[9a] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[9b]} \NC \showglyphs \inlinebuffer[9b] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[10a]} \NC \showglyphs \inlinebuffer[10a] \NC \NR
+ \NC \ruledhbox{\typeinlinebuffer[10b]} \NC \showglyphs \inlinebuffer[10b] \NC \NR
+ \stoptabulate
+\stop
+
+\stopsection
+
+\startsection[title=Auto|-|punctuation]
+
+\def\TestA#1#2#3%
+ {\ifnum#1=0 \type{#2}\else\setupmathematics[autopunctuation={#2}]$#3$\fi}
+
+\def\TestB#1#2%
+ {\NC \TestA{#1}{no} {#2}
+ \NC \TestA{#1}{yes} {#2}
+ \NC \TestA{#1}{yes,semicolon}{#2}
+ \NC \TestA{#1}{all} {#2}
+ \NC \TestA{#1}{all,semicolon}{#2}
+ \NC \NR}
+
+The \type {\setupmathematics} command has an option \type {autopunctuation} that
+influences the way spacing after punctuatuon is handled, especially in cases like
+the following (coordinates and such):
+
+\starttabulate[|c|c|c|c|c|]
+ \TestB{0}{}
+ \TestB{1}{(1,2)=(1, 2)}
+ \TestB{1}{(1.2)=(1. 2)}
+ \TestB{1}{(1;2)=(1; 2)}
+\stoptabulate
+
+\stopsection
+
\stopcomponent
% \enabletrackers[math.makeup=boxes]