summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/math-ini.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/math-ini.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/math-ini.mkiv867
1 files changed, 725 insertions, 142 deletions
diff --git a/Master/texmf-dist/tex/context/base/math-ini.mkiv b/Master/texmf-dist/tex/context/base/math-ini.mkiv
index 710a65f5b36..89116084791 100644
--- a/Master/texmf-dist/tex/context/base/math-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/math-ini.mkiv
@@ -13,28 +13,21 @@
\writestatus{loading}{ConTeXt Math Macros / Initializations}
-%D This module provides namespaces for math fonts, thereby
-%D permitting mixed usage of math fonts. Although not strictly
-%D needed, we also provide a family name mapping mechanism as
-%D used in the (original) AMS math definition files, but here
-%D these names can recursively be remapped and if needed,
-%D dynamically be changed. We've tried to minimize the number
-%D of definition commands and use plain \TEX\ definitions as
-%D fallback. We've tried to follow a couple of conventions
-%D from plain and AMS math in order to achieve backward
-%D compatinility. We also kept an eye on future usage of these
-%D modules in the perspective of MathML and unicode fonts.
+%D This module provides namespaces for math fonts, thereby permitting mixed usage of
+%D math fonts. Although not strictly needed, we also provide a family name mapping
+%D mechanism as used in the (original) AMS math definition files, but here these
+%D names can recursively be remapped and if needed, dynamically be changed. We've
+%D tried to minimize the number of definition commands and use plain \TEX\
+%D definitions as fallback. We've tried to follow a couple of conventions from plain
+%D and AMS math in order to achieve backward compatinility. We also kept an eye on
+%D future usage of these modules in the perspective of MathML and unicode fonts.
+
+%D There is a subtle issue with grouping: the \type {\begingroup} method will not
+%D restore a changed mathstyle so best avoid that one. However, there are cases where
+%D we really need to use such grouping.
\unprotect
-\ifdefined\v!autopunctuation \else \def\v!autopunctuation{autopunctuation} \fi
-\ifdefined\v!integral \else \def\v!integral {integral} \fi
-
-\def\s!lcgreek {lcgreek}
-\def\s!ucgreek {ucgreek}
-\def\s!italics {italics}
-\def\s!integral{integral}
-
%D We move these definitions into the format:
% test [[\char948 \cldcontext{utf.char(948)}]]
@@ -45,21 +38,25 @@
\registerctxluafile{math-act}{1.001}
\registerctxluafile{math-ext}{1.001}
\registerctxluafile{math-vfu}{1.001}
+\registerctxluafile{math-ttv}{1.001}
\registerctxluafile{math-map}{1.001}
\registerctxluafile{math-ren}{1.001}
\registerctxluafile{math-noa}{1.001}
\registerctxluafile{math-tag}{1.001}
+\registerctxluafile{math-fbk}{1.001}
\definesystemattribute[mathalphabet] [public]
\definesystemattribute[mathsize] [public]
\definesystemattribute[mathpunctuation][public]
-\definesystemattribute[mathgreek] [public]
+\definesystemattribute[mathgreek] [public] % will become generic
\definesystemattribute[mathalternate] [public]
\definesystemattribute[mathrendering] [public]
\definesystemattribute[mathcategory] [public]
\definesystemattribute[mathmode] [public]
\definesystemattribute[mathitalics] [public]
+\definesystemattribute[displaymath] [public]
+
\appendtoks
\attribute\mathmodeattribute\plusone
\to \everydisplay
@@ -68,6 +65,10 @@
\attribute\mathmodeattribute\plusone
\to \everybeforedisplayformula
+\appendtoksonce
+ \attribute\displaymathattribute\plusone
+\to \everybeforedisplayformula
+
\setnewconstant\defaultmathfamily \zerocount % 255
%D Some measures (maybe spac-mth):
@@ -82,18 +83,6 @@
%D Configuration for integrals. (If needed we can speed this up and make it
%D installable; no processaction is needed then).
-% \newtoks\everysetupmathematics
-%
-% \unexpanded\def\setupmathematics
-% {\dosingleargument\dosetupmathematics}
-%
-% \def\dosetupmathematics[#1]%
-% {\getparameters[\??mo][#1]%
-% \the\everysetupmathematics}
-%
-% \def\mathematicsparameter#1%
-% {\ifcsname\??mo#1\endcsname\csname\??mo#1\endcsname\fi}
-
\installcorenamespace{mathematics}
\installswitchcommandhandler \??mathematics {mathematics} \??mathematics
@@ -123,25 +112,20 @@
% todo: only in mmode
-\unexpanded\def\mathgreekupright{\attribute\c_math_greek_attribute22 }
-\unexpanded\def\mathgreekitalic {\attribute\c_math_greek_attribute33 }
-\unexpanded\def\mathgreekdefault{\attribute\c_math_greek_attribute\attributeunsetvalue}
-
-\let\mathgreeknormal\mathgreekupright
-\let\mathgreeknone \mathgreekdefault
+% these commands are semi-public but should not be used directly (lua names wil change)
-\unexpanded\def\setmathattribute#1#2{\ifmmode\ctxcommand{setmathattribute("#1","#2")}\fi}
-\unexpanded\def\setmathalphabet #1{\ifmmode\ctxcommand{setmathalphabet("#1")}\fi}
-\unexpanded\def\setmathstyle #1{\ifmmode\ctxcommand{setmathstyle("#1")}\fi}
-\unexpanded\def\setmathalternate #1{\ifmmode\ctxcommand{setmathalternate(\number\defaultmathfamily,"#1")}\fi}
+\unexpanded\def\math_set_attribute #1#2{\ifmmode\ctxcommand{setmathattribute("#1","#2")}\fi}
+\unexpanded\def\math_set_alphabet #1{\ifmmode\ctxcommand{setmathalphabet("#1")}\fi}
+\unexpanded\def\math_set_font_style #1{\ifmmode\ctxcommand{setmathstyle("#1")}\fi}
+\unexpanded\def\math_set_font_alternate#1{\ifmmode\ctxcommand{setmathalternate(\number\defaultmathfamily,"#1")}\fi}
\installcorenamespace{mathstylealternate} % might become a setuphandler
-\unexpanded\def\setmathstylealterternate#1%
+\unexpanded\def\math_set_font_style_alterternate#1%
{\ifcsname\??mathstylealternate\fontclass:#1\endcsname
- \expandafter\setmathalternate\csname\??mathstylealternate\fontclass:#1\endcsname
+ \expandafter\math_set_font_alternate\csname\??mathstylealternate\fontclass:#1\endcsname
\else\ifcsname\??mathstylealternate#1\endcsname
- \expandafter\setmathalternate\csname\??mathstylealternate#1\endcsname
+ \expandafter\math_set_font_alternate\csname\??mathstylealternate#1\endcsname
\fi\fi}
\unexpanded\def\setupmathrendering % the name might change
@@ -154,28 +138,33 @@
\getparameters[\??mathstylealternate][#1]%
\fi}
-\unexpanded\def\mathaltcal{\setmathalternate{cal}\cal} % ss01 in xits
+\unexpanded\def\mathaltcal{\math_set_font_alternate{cal}\cal} % ss01 in xits
-\let\mathalternate\setmathalternate % obsolete
+\let\setmathattribute \math_set_attribute
+\let\setmathalphabet \math_set_alphabet
+\let\setmathfontstyle \math_set_font_style
+\let\setmathfontalternate \math_set_font_alternate
+\let\setmathfontstylealterternate\math_set_font_style_alterternate
-\unexpanded\def\mr {\setmathattribute\s!regular\s!tf\setmathstylealterternate\s!tf}
+\let\mathalternate \math_set_font_alternate % obsolete
-\unexpanded\def\mathdefault {\setmathattribute\s!regular\s!it\setmathstylealterternate\s!it}
-\unexpanded\def\mathscript {\setmathalphabet \s!script \setmathstylealterternate\s!script}
-\unexpanded\def\mathfraktur {\setmathalphabet \s!fraktur \setmathstylealterternate\s!fraktur}
-\unexpanded\def\mathblackboard{\setmathalphabet \s!blackboard \setmathstylealterternate\s!blackboard}
+\unexpanded\def\mathupright {\math_set_attribute\s!regular\s!tf\math_set_font_style_alterternate\s!tf}
+\unexpanded\def\mathdefault {\math_set_attribute\s!regular\s!it\math_set_font_style_alterternate\s!it}
+\unexpanded\def\mathscript {\math_set_alphabet \s!script \math_set_font_style_alterternate\s!script}
+\unexpanded\def\mathfraktur {\math_set_alphabet \s!fraktur \math_set_font_style_alterternate\s!fraktur}
+\unexpanded\def\mathblackboard{\math_set_alphabet \s!blackboard \math_set_font_style_alterternate\s!blackboard}
-\unexpanded\def\mathrm {\setmathattribute\s!rm\s!tf \setmathstylealterternate\s!tf}
-\unexpanded\def\mathss {\setmathattribute\s!ss\s!tf \setmathstylealterternate\s!tf}
-\unexpanded\def\mathtt {\setmathattribute\s!tt\s!tf \setmathstylealterternate\s!tf}
+\unexpanded\def\mathrm {\math_set_attribute\s!rm\s!tf \math_set_font_style_alterternate\s!tf}
+\unexpanded\def\mathss {\math_set_attribute\s!ss\s!tf \math_set_font_style_alterternate\s!tf}
+\unexpanded\def\mathtt {\math_set_attribute\s!tt\s!tf \math_set_font_style_alterternate\s!tf}
-\unexpanded\def\mathtf {\setmathstyle\s!tf \setmathstylealterternate\s!tf}
-\unexpanded\def\mathsl {\setmathstyle\s!it \setmathstylealterternate\s!it} % no sl
-\unexpanded\def\mathit {\setmathstyle\s!it \setmathstylealterternate\s!it}
+\unexpanded\def\mathtf {\math_set_font_style\s!tf \math_set_font_style_alterternate\s!tf}
+\unexpanded\def\mathsl {\math_set_font_style\s!it \math_set_font_style_alterternate\s!it} % no sl
+\unexpanded\def\mathit {\math_set_font_style\s!it \math_set_font_style_alterternate\s!it}
-\unexpanded\def\mathbf {\setmathstyle\s!bf \setmathstylealterternate\s!bf}
-\unexpanded\def\mathbs {\setmathstyle\s!bi \setmathstylealterternate\s!bi} % no sl
-\unexpanded\def\mathbi {\setmathstyle\s!bi \setmathstylealterternate\s!bi}
+\unexpanded\def\mathbf {\math_set_font_style\s!bf \math_set_font_style_alterternate\s!bf}
+\unexpanded\def\mathbs {\math_set_font_style\s!bi \math_set_font_style_alterternate\s!bi} % no sl
+\unexpanded\def\mathbi {\math_set_font_style\s!bi \math_set_font_style_alterternate\s!bi}
\let\tfmath\mathtf % maybe a grouped command
\let\slmath\mathsl
@@ -198,8 +187,6 @@
\unexpanded\def\mathfrak#1{{\mathfraktur #1}} % for AMS compatibility
\unexpanded\def\mathbb #1{{\mathblackboard#1}} % for AMS compatibility
-\let\normalmr\mr
-
\let\normaltf\tf \unexpanded\def\tf{\ifmmode\mathtf\else\normaltf\fi}
\let\normalbf\bf \unexpanded\def\bf{\ifmmode\mathbf\else\normalbf\fi}
\let\normalit\it \unexpanded\def\it{\ifmmode\mathit\else\normalit\fi}
@@ -210,15 +197,17 @@
\let\normalrm\rm \unexpanded\def\rm{\ifmmode\mathrm\else\normalrm\fi}
\let\normalss\ss \unexpanded\def\ss{\ifmmode\mathss\else\normalss\fi}
\let\normaltt\tt \unexpanded\def\tt{\ifmmode\mathtt\else\normaltt\fi}
- \unexpanded\def\mr{\ifmmode \normalmr\fi}
+
+\ifdefined\mr \else \let\mr\relax \fi
+\ifdefined\mb \else \let\mb\relax \fi
\prependtoks
\mathdefault
\to \everymathematics
-%D We could set the rendering attribute at the \LUA\ end but as there
-%D can be many small math snippets we keep track of the state at the
-%D \TEX\ end (mapping is export safe).
+%D We could set the rendering attribute at the \LUA\ end but as there can be many
+%D small math snippets we keep track of the state at the \TEX\ end (mapping is
+%D export safe).
%D
%D \starttyping
%D \startformula
@@ -265,13 +254,19 @@
\def\utfmathcommand#1{\ctxcommand{utfmathcommand(\!!bs#1\!!es)}}
\def\utfmathfiller #1{\ctxcommand{utfmathfiller (\!!bs#1\!!es)}}
+\def\utfmathclassfiltered #1#2{\ctxcommand{utfmathclass (\!!bs#1\!!es,nil,"#2")}}
+\def\utfmathcommandfiltered#1#2{\ctxcommand{utfmathcommand(\!!bs#1\!!es,nil,"#2")}}
+
+\unexpanded\def\doifelseutfmathaccent #1{\ctxcommand{doifelseutfmathaccent(\!!bs#1\!!es)}}
+\unexpanded\def\doifelseutfmathaccentfiltered#1#2{\ctxcommand{doifelseutfmathaccent(\!!bs#1\!!es,"#2")}}
+
%D Not used that much:
\installcorenamespace{mathcodecommand}
-\unexpanded\def\mathlimop #1{\mathop{#1}} %no \limits
-\unexpanded\def\mathbox #1{\dontleavehmode\hbox\Ustartmath\mathsurround\zeropoint#1\Ustopmath}
-\unexpanded\def\mathnolop #1{\mathop{#1}\nolimits}
+\unexpanded\def\mathlimop#1{\mathop{#1}} %no \limits
+\unexpanded\def\mathbox #1{\dontleavehmode\hbox\Ustartmath\mathsurround\zeropoint#1\Ustopmath}
+\unexpanded\def\mathnolop#1{\mathop{#1}\nolimits}
\let\mathnothing\firstofoneunexpanded
\let\mathalpha \firstofoneunexpanded
@@ -383,11 +378,11 @@
\let\math_tags_mo\firstofoneunexpanded
\let\math_tags_mi\firstofoneunexpanded
-\unexpanded\def\math_tags_mn#1{\begingroup\mr#1\endgroup}
-\unexpanded\def\math_tags_ms#1{\begingroup\mr#1\endgroup}
+\unexpanded\def\math_tags_mn#1{\begingroup\mathupright#1\endgroup}
+\unexpanded\def\math_tags_ms#1{\begingroup\mathupright#1\endgroup}
-\unexpanded\def\mfunction #1{{\mr\math_tags_function{#1}}}
-\unexpanded\def\mfunctionlabeltext#1{{\mr\math_tags_functionlabeltext{#1}}}
+\unexpanded\def\mfunction #1{{\mathupright\math_tags_function{#1}}}
+\unexpanded\def\mfunctionlabeltext#1{{\mathupright\math_tags_functionlabeltext{#1}}}
% Once this is stable we can store the number at the tex end which is
% faster. Functions getnumbers >= 1000.
@@ -395,10 +390,10 @@
\expanded\def\math_tags_mathfunction_indeed #1{\ctxcommand{taggedmathfunction("#1",false,\ifconditional\c_apply_function true\else false\fi)}}
\expanded\def\math_tags_mathfunctionlabeltext_indeed#1{\ctxcommand{taggedmathfunction("#1",true ,\ifconditional\c_apply_function true\else false\fi)}}
-\expanded\def\math_tags_mo_indeed#1{\begingroup \attribute\mathcategoryattribute\plusone #1\endgroup}
-\expanded\def\math_tags_mi_indeed#1{\begingroup \attribute\mathcategoryattribute\plustwo #1\endgroup}
-\expanded\def\math_tags_mn_indeed#1{\begingroup\mr\attribute\mathcategoryattribute\plusthree#1\endgroup}
-\expanded\def\math_tags_ms_indeed#1{\begingroup\mr\attribute\mathcategoryattribute\plusfour #1\endgroup}
+\expanded\def\math_tags_mo_indeed#1{\begingroup \attribute\mathcategoryattribute\plusone #1\endgroup}
+\expanded\def\math_tags_mi_indeed#1{\begingroup \attribute\mathcategoryattribute\plustwo #1\endgroup}
+\expanded\def\math_tags_mn_indeed#1{\begingroup\mathupright\attribute\mathcategoryattribute\plusthree#1\endgroup}
+\expanded\def\math_tags_ms_indeed#1{\begingroup\mathupright\attribute\mathcategoryattribute\plusfour #1\endgroup}
\newconditional\c_apply_function
@@ -432,8 +427,8 @@
% \def\mlimitsfunction #1{\mathlimopcomm{{\mr#1}}
% \def\mnolimitsfunction#1{\mathnolopcomm{{\mr#1}}
-%D Taco posted this solution as response to a mail by Olivier, so
-%D let's integrate it here.
+%D Taco posted this solution as response to a mail by Olivier, so let's integrate
+%D it here.
\def\currentmscaledstyle{rm} % will be plugged into the typeface text=ss option
@@ -455,8 +450,7 @@
{\hbox{\csname\currentmscaledstyle\endcsname\tfx #1}}
{\hbox{\csname\currentmscaledstyle\endcsname\tfxx#1}}}
-%D We can force the way functions are typeset by manipulating the text
-%D option:
+%D We can force the way functions are typeset by manipulating the text option:
%D
%D \starttyping
%D \definetypeface[iwona][ss][sans][iwona][default][encoding=texnansi]
@@ -509,7 +503,7 @@
\newtoks\activatedmathcharacters
-\def\activatemathcharacter#1%
+\unexpanded\def\activatemathcharacter#1%
{\appendtoks
\global\mathcode#1=\activemathcharcode
\to \activatedmathcharacters}
@@ -540,12 +534,11 @@
% Here follows some plain legacy: primes.
%
-% The \let\prime\math_prime_indeed might become an obsolete as we have
-% \doubleprime and \tripleprime and collapsing can nicely handle the
-% script then.
+% The \let\prime\math_prime_indeed might become an obsolete as we have \doubleprime
+% and \tripleprime and collapsing can nicely handle the script then.
%
% Collapsing to 0x2033 and 0x2034 happens elsewhere.
-
+%
% \switchtobodyfont[modern]
% \switchtobodyfont[cambria]
% \switchtobodyfont[xits]
@@ -805,31 +798,40 @@
\newconstant\c_math_greek_attribute
-\setvalue{\??mathgreek\v!normal :\v!normal}{22}
-\setvalue{\??mathgreek\v!normal :\v!italic}{23}
-\setvalue{\??mathgreek\v!normal :\v!none }{21}
-
-\setvalue{\??mathgreek\v!italic :\v!normal}{32}
-\setvalue{\??mathgreek\v!italic :\v!italic}{33}
-\setvalue{\??mathgreek\v!italic :\v!none }{31}
-
-\setvalue{\??mathgreek\v!none :\v!normal}{12}
-\setvalue{\??mathgreek\v!none :\v!italic}{13}
-\letvalue{\??mathgreek\v!none :\v!none }\attributeunsetvalue
+\setvalue{\??mathgreek\v!none }{1}
+\setvalue{\??mathgreek\v!normal}{2}
+\setvalue{\??mathgreek\v!italic}{3}
\appendtoks
- \edef\p_lcgreek_ucgreek{\mathematicsparameter\s!lcgreek:\mathematicsparameter\s!ucgreek}%
- \c_math_greek_attribute\csname\??mathgreek
- \ifcsname\??mathgreek\p_lcgreek_ucgreek\endcsname\p_lcgreek_ucgreek\else\v!none\fi
- \endcsname\relax
+ \edef\p_sygreek{\mathematicsparameter\s!sygreek}%
+ \edef\p_lcgreek{\mathematicsparameter\s!lcgreek}%
+ \edef\p_ucgreek{\mathematicsparameter\s!ucgreek}%
+ \c_math_greek_attribute"% hex digits
+ \csname\??mathgreek\ifcsname\??mathgreek\p_sygreek\endcsname\p_sygreek\else\v!none\fi\endcsname
+ \csname\??mathgreek\ifcsname\??mathgreek\p_lcgreek\endcsname\p_lcgreek\else\v!none\fi\endcsname
+ \csname\??mathgreek\ifcsname\??mathgreek\p_ucgreek\endcsname\p_ucgreek\else\v!none\fi\endcsname
+ \relax
+ \ifcase\c_math_greek_attribute
+ \c_math_greek_attribute\attributeunsetvalue
+ \fi
\to \everyswitchmathematics
+% only used local
+
+\unexpanded\def\mathgreekupright{\attribute\mathgreekattribute"222\relax}
+\unexpanded\def\mathgreekitalic {\attribute\mathgreekattribute"333\relax}
+\unexpanded\def\mathgreekdefault{\attribute\mathgreekattribute"000\relax}
+
+\let\mathgreeknormal\mathgreekupright
+\let\mathgreeknone \mathgreekdefault
+
\appendtoks
\attribute\mathgreekattribute\c_math_greek_attribute
\to \everymathematics
\setupmathematics
- [\s!lcgreek=\v!italic,
+ [\s!sygreek=\v!normal,
+ \s!lcgreek=\v!italic,
\s!ucgreek=\v!normal] % was: none
%D Math italics (experiment)
@@ -857,15 +859,16 @@
\c_math_italics_attribute\csname\??mathitalics
\ifcsname\??mathitalics\p_italics\endcsname\p_italics\else\v!none\fi
\endcsname\relax
- \math_italics_initialize
+ % \math_italics_initialize
\to \everyswitchmathematics % only in mathematics
\appendtoks
+ \math_italics_initialize
\attribute\mathitalicsattribute\c_math_italics_attribute
\to \everymathematics
\setupmathematics
- [\s!italics=]
+ [\s!italics=3] % for the moment only this one makes sense .. still experimental
% looks nicer but can generate bogus csnames
%
@@ -890,27 +893,124 @@
%D
%D \blank{\getbuffer}\blank
-\newconditional\automathpunctuation
+% \newconditional\automathpunctuation
+%
+% \unexpanded\def\enablemathpunctuation {\settrue \automathpunctuation}
+% \unexpanded\def\disablemathpunctuation{\setfalse\automathpunctuation}
+%
+% \appendtoks
+% \doifelse{\mathematicsparameter\v!autopunctuation}\v!yes\settrue\setfalse\automathpunctuation
+% \to \everyswitchmathematics
+%
+% \setupmathematics
+% [\v!autopunctuation=\v!no]
+%
+% \def\math_punctuation_next{\ifx\nexttoken\blankspace\char\zerocount\fi}
+%
+% \unexpanded\def\math_punctuation_comma {\textcomma \futurelet\nexttoken\math_punctuation_next}
+% \unexpanded\def\math_punctuation_period{\textperiod\futurelet\nexttoken\math_punctuation_next}
+%
+% \setnewconstant\c_math_comma "002C
+% \setnewconstant\c_math_period "002E
+% \setnewconstant\c_math_special"8000
+%
+% \bgroup
+%
+% \catcode\c_math_comma \activecatcode
+% \catcode\c_math_period\activecatcode
+%
+% \unexpanded\gdef\math_punctuation_initialize_indeed
+% {\mathcode\c_math_comma \c_math_special
+% \mathcode\c_math_period\c_math_special
+% \let,\math_punctuation_comma
+% \let.\math_punctuation_period
+% \attribute\mathpunctuationattribute\plustwo}
+%
+% \unexpanded\gdef\math_punctuation_initialize_yes
+% {\attribute\mathpunctuationattribute\plustwo}
+%
+% \unexpanded\gdef\math_punctuation_initialize_nop
+% {\attribute\mathpunctuationattribute\plusone}
+%
+% \egroup
+%
+% \appendtoks
+% \ifconditional\automathpunctuation
+% \math_punctuation_initialize_indeed
+% \math_punctuation_initialize_yes
+% \let\enablemathpunctuation \math_punctuation_initialize_yes
+% \let\disablemathpunctuation\math_punctuation_initialize_nop
+% \fi
+% \to \everymathematics
+
+% Later I will look again into a \LUATEX\ based solution. It only makes sense
+% to delegate to \LUA\ when we have more variants and need analysis (experimental
+% trickery removed for a while).
-\unexpanded\def\enablemathpunctuation {\settrue \automathpunctuation}
-\unexpanded\def\disablemathpunctuation{\setfalse\automathpunctuation}
+\def\math_punctuation_comma_next {\ifx\nexttoken\blankspace \mathpunct{\textcomma }\else\mathord{\textcomma }\fi}
+\def\math_punctuation_period_next{\ifx\nexttoken\blankspace \mathpunct{\textperiod}\else\mathord{\textperiod}\fi}
-\appendtoks
- \doifelse{\mathematicsparameter\v!autopunctuation}\v!yes\settrue\setfalse\automathpunctuation
-\to \everyswitchmathematics
+\unexpanded\def\math_punctuation_nop_comma {\mathpunct{\textcomma}}
+\unexpanded\def\math_punctuation_all_comma {\futurelet\nexttoken\math_punctuation_comma_next}
+ \let\math_punctuation_yes_comma \math_punctuation_all_comma
+
+\unexpanded\def\math_punctuation_nop_period{\mathord{\textperiod}}
+\unexpanded\def\math_punctuation_all_period{\futurelet\nexttoken\math_punctuation_period_next}
+ \let\math_punctuation_yes_period\math_punctuation_nop_period
+
+\setnewconstant\c_math_comma "002C
+\setnewconstant\c_math_period "002E
+\setnewconstant\c_math_special"8000
+
+\installcorenamespace {mathautopunctuation}
+
+\bgroup
+
+ \catcode\c_math_comma \activecatcode
+ \catcode\c_math_period\activecatcode
+
+ \setgvalue{\??mathautopunctuation\v!no}%
+ {\let,\math_punctuation_nop_comma
+ \let.\math_punctuation_nop_period}
+
+ \setgvalue{\??mathautopunctuation\v!yes}%
+ {\let,\math_punctuation_yes_comma
+ \let.\math_punctuation_yes_period}
+
+ \setgvalue{\??mathautopunctuation\v!all}%
+ {\let,\math_punctuation_all_comma
+ \let.\math_punctuation_all_period}
+
+\egroup
+
+% \appendtoks
+% \global\mathcode\c_math_comma \c_math_special
+% \global\mathcode\c_math_period\c_math_special
+% \to \everyjob
\appendtoks
- \ifconditional\automathpunctuation\attribute\mathpunctuationattribute\plusone\fi
+ \mathcode\c_math_comma \c_math_special
+ \mathcode\c_math_period\c_math_special
+ \csname\??mathautopunctuation\mathematicsparameter\v!autopunctuation\endcsname
\to \everymathematics
+\appendtoks
+ \ifcsname\??mathautopunctuation\mathematicsparameter\v!autopunctuation\endcsname \else
+ \letmathematicsparameter\v!autopunctuation\v!no
+ \fi
+\to \everysetupmathematics
+
+\def\enablemathpunctuation {\csname\??mathautopunctuation\v!no \endcsname}
+\def\disablemathpunctuation{\csname\??mathautopunctuation\v!yes\endcsname}
+
\setupmathematics
- [\v!autopunctuation=\v!no]
+ [\v!autopunctuation=\v!no] % no | yes | all
%D \macros
%D {mathstyle}
%D
-%D If one want to be sure that something is typeset in the
-%D appropriate style, \type {\mathstyle} can be used:
+%D If one want to be sure that something is typeset in the appropriate style, \type
+%D {\mathstyle} can be used:
%D
%D \starttyping
%D \mathstyle{something}
@@ -923,10 +1023,9 @@
% {\scriptstyle #1}%
% {\scriptscriptstyle#1}}
%
-% We now have a primitive operation for this. As the
-% macro overloads a new primitive introduced in \LUATEX,
-% we need to use \type {\normalmathstyle} when we consult
-% the current math style.
+% We now have a primitive operation for this. As the macro overloads a new
+% primitive introduced in \LUATEX, we need to use \type {\normalmathstyle} when we
+% consult the current math style.
%
% \let \mathstyle \Ustack % spoils cramped
%
@@ -981,7 +1080,58 @@
\scriptscriptfont \or
\scriptscriptfont \else
\textfont
- \fi\zerocount}
+ \fi\zerocount} % hm, can ie other value as well
+
+\def\mathsmallstylefont#1% #1 is number (\normalmathstyle)
+ {\ifcase#1\relax
+ \scriptfont \or
+ \scriptfont \or
+ \scriptfont \or
+ \scriptfont \or
+ \scriptscriptfont \or
+ \scriptscriptfont \or
+ \scriptscriptfont \or
+ \scriptscriptfont \else
+ \scriptfont
+ \fi\zerocount} % hm, can ie other value as well
+
+\def\mathstyleface#1% #1 is number (\normalmathstyle)
+ {\ifcase#1
+ \textface \or
+ \textface \or
+ \textface \or
+ \textface \or
+ \scriptface \or
+ \scriptface \or
+ \scriptscriptface \or
+ \scriptscriptface \else
+ \textface
+ \fi}
+
+\def\mathsmallstyleface#1% #1 is number (\normalmathstyle)
+ {\ifcase#1
+ \scriptface \or
+ \scriptface \or
+ \scriptface \or
+ \scriptface \or
+ \scriptscriptface \or
+ \scriptscriptface \or
+ \scriptscriptface \or
+ \scriptscriptface \else
+ \scriptface
+ \fi}
+
+\def\mathstylecommand#1#2#3%
+ {\ifcase\normalmathstyle
+ \expandafter#1\or
+ \expandafter#1\or
+ \expandafter#1\or
+ \expandafter#1\or
+ \expandafter#2\or
+ \expandafter#2\or
+ \expandafter#3\or
+ \expandafter#3\else
+ \expandafter#1\fi}
%D A plain inheritance:
@@ -1002,42 +1152,451 @@
\unexpanded\def\mathstylehbox#1%
{\normalexpanded{\hbox\bgroup
- $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup}
+ \startimath\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1\stopimath\egroup}
\unexpanded\def\mathstylevbox#1%
{\normalexpanded{\vbox\bgroup
- $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup}
+ \startimath\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1\stopimath\egroup}
\unexpanded\def\mathstylevcenter#1%
{\normalexpanded{\vcenter\bgroup
- $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup}
+ \startimath\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1\stopimath\egroup}
\unexpanded\def\mathstylevcenteredhbox#1%
{\normalexpanded{\vcenter\bgroup\hbox\bgroup
- $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup\egroup}
+ \startimath\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1\stopimath\egroup\egroup}
\unexpanded\def\mathstylevcenteredvbox#1%
{\normalexpanded{\vcenter\bgroup\vbox\bgroup
- $\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1$\egroup\egroup}
+ \startimath\triggermathstyle\normalmathstyle}\mathsurround\zeropoint#1\stopimath\egroup\egroup}
+
+\unexpanded\def\setmathsmalltextbox#1#2#%
+ {\normalizebodyfontsize\m_math_text_choice_face{\mathsmallstyleface\normalmathstyle}%
+ \setbox#1#2\bgroup
+ \font_basics_switchtobodyfont\m_math_text_choice_face
+ \let\next}
+
+\unexpanded\def\setmathtextbox#1#2#%
+ {\normalizebodyfontsize\m_math_text_choice_face{\mathstyleface\normalmathstyle}%
+ \setbox#1#2\bgroup
+ \font_basics_switchtobodyfont\m_math_text_choice_face
+ \let\next}
+
+%D Here is the new mechanism ... it might replace some of the above but we will do
+%D that stepwise. Keep in mind that cramped only affects superscripts and even then,
+%D only when in a smaller size than normal.
+%D
+%D \def\TestMe#1%
+%D {\NC \ttbf #1
+%D \NC \ruledhbox{$\setupmathstyle[#1]x + x_j^2 + x_i^{e^2} + \frac{1}{x}$}
+%D \NC \ruledhbox{$\setupmathstyle[#1,small]x + x_j^2 + x_i^{e^2} + \frac{1}{x}$}
+%D \NC \NR}
+%D
+%D \starttabulate[|l|r|l|]
+%D \HL
+%D \NC \NC \NC \ttbf ...,small \NC \NR
+%D \HL
+%D \TestMe{text} \TestMe{text,cramped}
+%D \TestMe{script} \TestMe{script,cramped}
+%D \TestMe{scriptscript} \TestMe{scriptscript,cramped}
+%D \TestMe{display} \TestMe{display,cramped}
+%D \HL
+%D \stoptabulate
+
+\def\triggerdisplaystyle
+ {\ifcase\normalmathstyle\relax
+ \displaystyle \or
+ \crampeddisplaystyle \or
+ \displaystyle \or
+ \crampeddisplaystyle \or
+ \displaystyle \or
+ \crampeddisplaystyle \or
+ \displaystyle \or
+ \crampeddisplaystyle \or
+ \fi}
-%D Something similar can be used in the (re|)|definition
-%D of \type {\text}. This version is a variation on the one
-%D in the math module (see \type{m-math} and|/|or \type
-%D {m-newmat}).
+\def\triggertextstyle
+ {\ifcase\normalmathstyle\relax
+ \textstyle \or
+ \crampedtextstyle \or
+ \textstyle \or
+ \crampedtextstyle \or
+ \textstyle \or
+ \crampedtextstyle \or
+ \textstyle \or
+ \crampedtextstyle \else
+ \fi}
+
+\def\triggerscriptstyle
+ {\ifcase\normalmathstyle\relax
+ \scriptstyle \or
+ \crampedscriptstyle \or
+ \scriptstyle \or
+ \crampedscriptstyle \or
+ \scriptstyle \or
+ \crampedscriptstyle \or
+ \scriptstyle \or
+ \crampedscriptstyle \or
+ \fi}
+
+\def\triggerscriptscriptstyle
+ {\ifcase\normalmathstyle\relax
+ \scriptscriptstyle \or
+ \crampedscriptscriptstyle \or
+ \scriptscriptstyle \or
+ \crampedscriptscriptstyle \or
+ \scriptscriptstyle \or
+ \crampedscriptscriptstyle \or
+ \scriptscriptstyle \or
+ \crampedscriptscriptstyle \or
+ \fi}
+
+\def\triggeruncrampedstyle
+ {\ifcase\normalmathstyle\relax
+ \or \displaystyle \or
+ \or \textstyle \or
+ \or \scriptstyle \or
+ \or \scriptscriptstyle \fi}
+
+\def\triggercrampedstyle
+ {\ifcase\normalmathstyle\relax
+ \crampeddisplaystyle \or \or
+ \crampedtextstyle \or \or
+ \crampedscriptstyle \or \or
+ \crampedscriptscriptstyle \fi}
+
+\def\triggersmallstyle
+ {\ifcase\normalmathstyle\relax
+ \scriptstyle \or
+ \crampedscriptstyle \or
+ \scriptstyle \or
+ \crampedscriptstyle \or
+ \scriptscriptstyle \or
+ \crampedscriptscriptstyle \or
+ \scriptscriptstyle \or
+ \crampedscriptscriptstyle \or
+ \fi}
+
+\def\triggeruncrampedsmallstyle
+ {\ifcase\normalmathstyle\relax
+ \scriptstyle \or
+ \scriptstyle \or
+ \scriptstyle \or
+ \scriptstyle \or
+ \scriptscriptstyle \or
+ \scriptscriptstyle \or
+ \scriptscriptstyle \or
+ \scriptscriptstyle \or
+ \fi}
+
+\def\triggercrampedsmallstyle
+ {\ifcase\normalmathstyle\relax
+ \crampedscriptstyle \or
+ \crampedscriptstyle \or
+ \crampedscriptstyle \or
+ \crampedscriptstyle \or
+ \crampedscriptscriptstyle \or
+ \crampedscriptscriptstyle \or
+ \crampedscriptscriptstyle \or
+ \crampedscriptscriptstyle \or
+ \fi}
+
+\def\triggerbigstyle
+ {\ifcase\normalmathstyle\relax
+ \displaystyle \or
+ \crampeddisplaystyle \or
+ \textstyle \or
+ \crampedtextstyle \or
+ \textstyle \or
+ \crampedtextstyle \or
+ \scriptstyle \or
+ \crampedscriptstyle \or
+ \fi}
+
+\def\triggeruncrampedbigstyle
+ {\ifcase\normalmathstyle\relax
+ \displaystyle \or
+ \displaystyle \or
+ \textstyle \or
+ \textstyle \or
+ \textstyle \or
+ \textstyle \or
+ \scriptstyle \or
+ \scriptstyle \or
+ \fi}
+
+\def\triggercrampedbigstyle
+ {\ifcase\normalmathstyle\relax
+ \crampeddisplaystyle \or
+ \crampeddisplaystyle \or
+ \crampedtextstyle \or
+ \crampedtextstyle \or
+ \crampedtextstyle \or
+ \crampedtextstyle \or
+ \crampedscriptstyle \or
+ \crampedscriptstyle \or
+ \fi}
+
+\installcorenamespace{mathstylecommand}
+\installcorenamespace{mathstylecache}
+
+\newconstant\c_math_styles_state_style
+\newconstant\c_math_styles_state_cramped
+\newconstant\c_math_styles_state_size
+
+\def\math_style_add_to_cache_choice {%
+ \ifcase\c_math_styles_state_size
+ \ifcase\c_math_styles_state_style
+ \ifcase\c_math_styles_state_cramped
+ \relax \or
+ \noexpand\triggeruncrampedstyle \or
+ \noexpand\triggercrampedstyle \fi
+ \or\ifcase\c_math_styles_state_cramped
+ \noexpand\triggerdisplaystyle \or
+ \displaystyle \or
+ \crampeddisplaystyle \fi
+ \or\ifcase\c_math_styles_state_cramped
+ \noexpand\triggertextstyle \or
+ \textstyle \or
+ \crampedtextstyle \fi
+ \or\ifcase\c_math_styles_state_cramped
+ \noexpand\triggerscriptstyle \or
+ \scriptstyle \or
+ \crampedscriptstyle \fi
+ \or\ifcase\c_math_styles_state_cramped
+ \noexpand\triggerscriptscriptstyle \or
+ \scriptscriptstyle \or
+ \crampedscriptscriptstyle \fi
+ \fi
+ \or % small
+ \ifcase\c_math_styles_state_style
+ \ifcase\c_math_styles_state_cramped
+ \noexpand\triggersmallstyle \or
+ \noexpand\triggeruncrampedsmallstyle \or
+ \noexpand\triggercrampedsmallstyle \fi
+ \or\ifcase\c_math_styles_state_cramped
+ \noexpand\triggerscriptstyle \or
+ \scriptstyle \or
+ \crampedscriptstyle \fi
+ \or\ifcase\c_math_styles_state_cramped
+ \noexpand\triggerscriptstyle \or
+ \scriptstyle \or
+ \crampedscriptstyle \fi
+ \or\ifcase\c_math_styles_state_cramped
+ \noexpand\triggerscriptscriptstyle \or
+ \scriptscriptstyle \or
+ \crampedscriptscriptstyle \fi
+ \or\ifcase\c_math_styles_state_cramped
+ \noexpand\triggerscriptscriptstyle \or
+ \scriptscriptstyle \or
+ \crampedscriptscriptstyle \fi
+ \fi
+ \or % large
+ \ifcase\c_math_styles_state_style
+ \ifcase\c_math_styles_state_cramped
+ \noexpand\triggerbigstyle \or
+ \noexpand\triggeruncrampedbigstyle \or
+ \noexpand\triggercrampedbigstyle \fi
+ \or\ifcase\c_math_styles_state_cramped
+ \noexpand\triggerdisplaystyle \or
+ \displaystyle \or
+ \crampeddisplaystyle \fi
+ \or\ifcase\c_math_styles_state_cramped
+ \noexpand\triggertextstyle \or
+ \textstyle \or
+ \crampedtextstyle \fi
+ \or\ifcase\c_math_styles_state_cramped
+ \noexpand\triggertextstyle \or
+ \textstyle \or
+ \crampedtextstyle \fi
+ \or\ifcase\c_math_styles_state_cramped
+ \noexpand\triggerscriptstyle \or
+ \scriptstyle \or
+ \crampedscriptstyle \fi
+ \fi
+ \fi
+}
+
+\unexpanded\def\math_style_set#1%
+ {\edef\m_math_style_asked{#1}%
+ \ifx\m_math_style_asked\empty \else
+ \math_style_set_indeed
+ \fi}
+
+\let\setmathstyle\math_style_set
+
+\def\installmathstyle#1#2%
+ {\ifcsname\??mathstylecommand#1\endcsname \else
+ \setvalue{\??mathstylecommand#1}{#2}%
+ \fi}
+
+\def\math_style_collect#1%
+ {\csname\??mathstylecommand#1\endcsname}
+
+\setvalue{\??mathstylecommand\s!display }{\c_math_styles_state_style \plusone}
+\setvalue{\??mathstylecommand\s!text }{\c_math_styles_state_style \plustwo}
+\setvalue{\??mathstylecommand\s!script }{\c_math_styles_state_style \plusthree}
+\setvalue{\??mathstylecommand\s!scriptscript}{\c_math_styles_state_style \plusfour}
+
+\setvalue{\??mathstylecommand\s!uncramped }{\c_math_styles_state_cramped\plusone}
+\setvalue{\??mathstylecommand\s!cramped }{\c_math_styles_state_cramped\plustwo}
+\setvalue{\??mathstylecommand\v!normal }{\c_math_styles_state_cramped\plusone}
+\setvalue{\??mathstylecommand\v!packed }{\c_math_styles_state_cramped\plustwo}
+
+\setvalue{\??mathstylecommand\v!small }{\c_math_styles_state_size \plusone}
+\setvalue{\??mathstylecommand\v!big }{\c_math_styles_state_size \plustwo}
+
+\unexpanded\def\setupmathstyle[#1]%
+ {\edef\m_math_style_asked{#1}%
+ \ifx\m_math_style_asked\empty \else
+ \math_style_set_indeed
+ \fi}
+
+\unexpanded\def\usemathstyleparameter#1% faster local variant
+ {\edef\m_math_style_asked{#1\c!mathstyle}%
+ \ifx\m_math_style_asked\empty \else
+ \math_style_set_indeed
+ \fi}
+
+%D \startbuffer
+%D \definemathstyle[mystyle][scriptscript]
+%D
+%D $text\startmathstyle[mystyle]scriptscript\stopmathstyle text$
+%D \stopbuffer
+%D
+%D \typebuffer \blank \start \getbuffer \stop \blank
+
+\installcorenamespace {mathstyle}
+
+\unexpanded\def\definemathstyle
+ {\dodoubleargument\math_style_define}
+
+\def\math_style_define[#1][#2]%
+ {\c_math_styles_state_style \zerocount
+ \c_math_styles_state_cramped\zerocount
+ \c_math_styles_state_size \zerocount
+ \rawprocesscommacommand[#2]\math_style_collect
+ \expandafter\let\csname\??mathstyle#1\normalexpanded{\endcsname\math_style_add_to_cache_choice}}
+
+% \def\math_style_set_indeed
+% {\ifcsname\??mathstyle\m_math_style_asked\endcsname
+% \csname\??mathstyle\m_math_style_asked\endcsname
+% \else
+% \math_style_set_indeed_cached
+% \fi}
+%
+% \def\math_style_set_indeed_cached
+% {\ifcsname\??mathstylecache\m_math_style_asked\endcsname
+% % already in cache
+% \else
+% \math_style_add_to_cache
+% \fi
+% \csname\??mathstylecache\m_math_style_asked\endcsname}
+%
+% \def\math_style_add_to_cache
+% {\c_math_styles_state_style \zerocount
+% \c_math_styles_state_cramped\zerocount
+% \c_math_styles_state_size \zerocount
+% \rawprocesscommacommand[\m_math_style_asked]\math_style_collect
+% \global\expandafter\let\csname\??mathstylecache\m_math_style_asked\normalexpanded{\endcsname\math_style_add_to_cache_choice}}
+%
+% ugly but more efficient (as called often)
+
+\def\math_style_set_indeed
+ {\csname\??mathstyle
+ \ifcsname\??mathstyle\m_math_style_asked\endcsname
+ \m_math_style_asked
+ \else
+ \??mathstyle
+ \fi
+ \endcsname}
+
+\setvalue{\??mathstyle\??mathstyle}%
+ {\csname\??mathstylecache
+ \ifcsname\??mathstylecache\m_math_style_asked\endcsname
+ \m_math_style_asked
+ \else
+ \??mathstylecache
+ \fi
+ \endcsname}
+
+\setvalue{\??mathstylecache\??mathstylecache}%
+ {\c_math_styles_state_style \zerocount
+ \c_math_styles_state_cramped\zerocount
+ \c_math_styles_state_size \zerocount
+ \rawprocesscommacommand[\m_math_style_asked]\math_style_collect
+ \global\expandafter\let\csname\??mathstylecache\m_math_style_asked\normalexpanded{\endcsname\math_style_add_to_cache_choice}%
+ \csname\??mathstylecache\m_math_style_asked\endcsname}
+
+%D \startbuffer
+%D $x\begingroup\setupmathstyle[script]x\endgroup x$
+%D $x{\setupmathstyle[script]x}x$
+%D $x\startmathstyle[script]x\stopmathstyle x$
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+
+\unexpanded\def\startmathstyle[#1]%
+ {\edef\m_math_style_asked{#1}%
+ \ifx\m_math_style_asked\empty
+ \let\stopmathstyle\relax
+ \else
+ \bgroup
+ \math_style_set_indeed
+ \let\stopmathstyle\egroup
+ \fi}
+
+\let\stopmathstyle\relax
+
+\unexpanded\def\startusemathstyleparameter#1%
+ {\edef\m_math_style_asked{#1\c!mathstyle}%
+ \ifx\m_math_style_asked\empty
+ \let\stopusemathstyleparameter\relax
+ \else
+ \bgroup
+ \math_style_set_indeed
+ \let\stopusemathstyleparameter\egroup
+ \fi}
+
+\let\stopusemathstyleparameter\relax
+
+%D Something similar can be used in the (re|)|definition of \type {\text}. This
+%D version is a variation on the one in the math module (see \type{m-math} and|/|or
+%D \type {m-newmat}).
\unexpanded\def\mathtext
{\mathortext\math_text_choice\hbox}
-\def\math_text_choice#1%
- {\mathchoice
- {\math_text_choice_indeed\displaystyle\textface {#1}}%
- {\math_text_choice_indeed\textstyle \textface {#1}}%
- {\math_text_choice_indeed\textstyle \scriptface {#1}}%
- {\math_text_choice_indeed\textstyle \scriptscriptface{#1}}}
+% \def\math_text_choice#1%
+% {\mathchoice
+% {\math_text_choice_indeed\displaystyle\textface {#1}}%
+% {\math_text_choice_indeed\textstyle \textface {#1}}%
+% {\math_text_choice_indeed\textstyle \scriptface {#1}}%
+% {\math_text_choice_indeed\textstyle \scriptscriptface{#1}}}
+%
+% \def\math_text_choice_indeed#1#2#3% no \everymath !
+% {\hbox{\everymath{#1}\switchtobodyfont[#2]#3}} % 15 sec
+
+% \let\m_math_text_choice_style\relax
+%
+% \def\math_text_choice#1%
+% {\edef\m_math_text_choice_style{\normalmathstyle}%
+% \hbox\bgroup
+% % \everymath{\triggermathstyle\m_math_text_choice_style}%
+% \normalizebodyfontsize\m_math_text_choice_style{\mathstylefont\m_math_text_choice_style}%
+% \font_basics_switchtobodyfont\m_math_text_choice_style
+% #1%
+% \egroup}
+
+\let\m_math_text_choice_face \relax
+
+% \def\math_text_choice#1% if needed we can get rid of the normalize (predo in font code)
+% {\normalizebodyfontsize\m_math_text_choice_face{\mathstyleface\normalmathstyle}%
+% \hbox{\font_basics_switchtobodyfont\m_math_text_choice_face#1}}
-\def\math_text_choice_indeed#1#2#3% no \everymath !
- %{\hbox{\everymath{#1}\switchtobodyfont [#2]#3}} % 15 sec
- {\hbox{\everymath{#1}\setcurrentfontbody{#2}#3}} % 3 sec (no math)
+\def\math_text_choice% if needed we can get rid of the normalize (predo in font code)
+ {\normalizebodyfontsize\m_math_text_choice_face{\mathstyleface\normalmathstyle}%
+ \hbox\bgroup\font_basics_switchtobodyfont\m_math_text_choice_face\let\next}
%D Safeguard against redefinitions:
@@ -1045,8 +1604,7 @@
\let\_\normalunderscore % is textunderscore or fakeunderscore
\to \everymathematics
-%D Because we may overload \type {\text} in other (structuring)
-%D macros, we say:
+%D Because we may overload \type {\text} in other (structuring) macros, we say:
\appendtoks \let\text\mathtext \to \everymathematics
@@ -1115,8 +1673,33 @@
\unexpanded\def\mathoptext#1{\mathop{\text{#1}}}
-% for a while:
+% new:
+
+% \startsetups math:morespacing
+% \Umathordordspacing\textstyle 1mu plus .5mu minus .25mu\relax
+% \stopsetups
+%
+% \setupmathematics
+% [setups=math:morespacing]
+
+\appendtoks
+ \edef\p_setups{\mathematicsparameter\c!setups}%
+ \ifx\p_setups\empty\else
+ \directsetup\p_setups
+ \fi
+\to \everyswitchmathematics
+
+% new:
+
+\unexpanded\def\smallmathsymbol#1%
+ {\mathematics{\mathbin{\normalexpanded{\raise.15\exheight\hbox{$\triggermathstyle{\the\numexpr\normalmathstyle+2\relax}#1$}}}}}
+
+% this should be a primitive:
+
+% \def\mathextensiblecode#1#2%
+% {\cldcontext{mathematics.extensiblecode(\number#1,\number#2)}}
-\def\Umathbotaccent{\Umathaccent bottom }
+\def\mathextensiblecode#1#2{\ctxcommand{extensiblecode(\number#1,\number#2)}}
+\def\mathhorizontalcode#1#2{\ctxcommand{horizontalcode(\number#1,\number#2)}}
\protect \endinput