summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/math-ini.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/math-ini.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/math-ini.mkiv81
1 files changed, 51 insertions, 30 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/math-ini.mkiv b/Master/texmf-dist/tex/context/base/mkiv/math-ini.mkiv
index c79d3579c8b..d0e18ff4b1b 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/math-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/mkiv/math-ini.mkiv
@@ -103,9 +103,9 @@
\def\Umathaccents {\Umathaccent \s!both }
\ifdefined\Umathcharclass \else
- \def\Umathcharclass{\cldcontext{tex.getmathcode(token.scan_int())[1]}}
- \def\Umathcharfam {\cldcontext{tex.getmathcode(token.scan_int())[2]}}
- \def\Umathcharslot {\cldcontext{tex.getmathcode(token.scan_int())[3]}}
+ \def\Umathcharclass{\numexpr\cldcontext{tex.getmathcode(token.scan_int())[1]}\relax}
+ \def\Umathcharfam {\numexpr\cldcontext{tex.getmathcode(token.scan_int())[2]}\relax}
+ \def\Umathcharslot {\numexpr\cldcontext{tex.getmathcode(token.scan_int())[3]}\relax}
\fi
%D The attributes that we will use (todo: pack some into one but uglier code):
@@ -134,12 +134,12 @@
\fi
\appendtoks
- \attribute\mathmodeattribute\plusone
+ \c_attr_mathmode\plusone
\to \everydisplay
\appendtoks
- \attribute\mathmodeattribute\plusone
- \attribute\displaymathattribute\plusone
+ \c_attr_mathmode \plusone
+ \c_attr_displaymath\plusone
\to \everybeforedisplayformula
\setnewconstant\defaultmathfamily \zerocount % 255
@@ -596,7 +596,7 @@
\appendtoks
\ifcase\c_math_renderings_attribute\else
- \attribute\mathrenderingattribute\c_math_renderings_attribute
+ \c_attr_mathrendering\c_math_renderings_attribute
\fi
\to \everymathematics
@@ -867,10 +867,10 @@
\let\math_tags_mfunctiontxt\gobbletwoarguments
\let\math_tags_mfunctionlab\gobbletwoarguments
-\unexpanded\def\math_tags_mo_indeed#1{\begingroup \attribute\mathcategoryattribute\plusone #1\endgroup}
-\unexpanded\def\math_tags_mi_indeed#1{\begingroup \attribute\mathcategoryattribute\plustwo #1\endgroup}
-\unexpanded\def\math_tags_mn_indeed#1{\begingroup\mathupright\attribute\mathcategoryattribute\plusthree\math_set_o_both#1\endgroup}
-\unexpanded\def\math_tags_ms_indeed#1{\begingroup\mathupright\attribute\mathcategoryattribute\plusfour \math_set_p_both#1\endgroup} % todo: mathoptext
+\unexpanded\def\math_tags_mo_indeed#1{\begingroup \c_attr_mathcategory\plusone #1\endgroup}
+\unexpanded\def\math_tags_mi_indeed#1{\begingroup \c_attr_mathcategory\plustwo #1\endgroup}
+\unexpanded\def\math_tags_mn_indeed#1{\begingroup\mathupright\c_attr_mathcategory\plusthree\math_set_o_both#1\endgroup}
+\unexpanded\def\math_tags_ms_indeed#1{\begingroup\mathupright\c_attr_mathcategory\plusfour \math_set_p_both#1\endgroup} % todo: mathoptext
\newconditional\c_apply_function
@@ -1390,7 +1390,7 @@
\to \everysetupmathematics
\appendtoks
- \attribute\mathbidiattribute\ifconditional\c_math_right_to_left\c_math_bidi\else\attributeunsetvalue\fi
+ \c_attr_mathbidi\ifconditional\c_math_right_to_left\c_math_bidi\else\attributeunsetvalue\fi
\to \everyswitchmathematics
%D Delayed: greek.
@@ -1445,15 +1445,15 @@
% only used local
-\unexpanded\def\mathgreekupright{\attribute\mathgreekattribute"222\relax}
-\unexpanded\def\mathgreekitalic {\attribute\mathgreekattribute"333\relax}
-\unexpanded\def\mathgreekdefault{\attribute\mathgreekattribute"000\relax}
+\unexpanded\def\mathgreekupright{\c_attr_mathgreek"222\relax}
+\unexpanded\def\mathgreekitalic {\c_attr_mathgreek"333\relax}
+\unexpanded\def\mathgreekdefault{\c_attr_mathgreek"000\relax}
\let\mathgreeknormal\mathgreekupright
\let\mathgreeknone \mathgreekdefault
\appendtoks
- \attribute\mathgreekattribute\c_math_greek_attribute
+ \c_attr_mathgreek\c_math_greek_attribute
\to \everymathematics
\setupmathematics
@@ -1488,7 +1488,7 @@
\appendtoks
\math_collapsing_initialize
- \attribute\mathcollapsingattribute\c_math_collapsing_attribute
+ \c_attr_mathcollapsing\c_math_collapsing_attribute
\to \everymathematics
\setupmathematics
@@ -1526,7 +1526,7 @@
\appendtoks
\math_italics_initialize
- \attribute\mathitalicsattribute\c_math_italics_attribute
+ \c_attr_mathitalics\c_math_italics_attribute
\to \everymathematics
% \setupmathematics % done later
@@ -1563,7 +1563,7 @@
\appendtoks
\math_kernpairs_initialize
- \attribute\mathkernpairsattribute\c_math_kernpairs_attribute
+ \c_attr_mathkernpairs\c_math_kernpairs_attribute
\to \everymathematics
\setupmathematics
@@ -1611,13 +1611,13 @@
% \mathcode\c_math_period\c_math_special
% \let,\math_punctuation_comma
% \let.\math_punctuation_period
-% \attribute\mathpunctuationattribute\plustwo}
+% \c_attr_mathpunctuation\plustwo}
%
% \unexpanded\gdef\math_punctuation_initialize_yes
-% {\attribute\mathpunctuationattribute\plustwo}
+% {\c_attr_mathpunctuation\plustwo}
%
% \unexpanded\gdef\math_punctuation_initialize_nop
-% {\attribute\mathpunctuationattribute\plusone}
+% {\c_attr_mathpunctuation\plusone}
%
% \egroup
%
@@ -1760,7 +1760,7 @@
\setupmathematics
[\v!autopunctuation=\v!no] % no | yes | all | comma | yes,semicolon | all,semicolon
-%D The consequences of settign this are as follows:
+%D The consequences of setting this are as follows:
%D
%D \def\TestA#1#2#3%
%D {\ifnum#1=0 \type{#2}\else\setupmathematics[autopunctuation={#2}]$#3$\fi}
@@ -1841,6 +1841,8 @@
% error
\fi}
+\let\mathstyletrigger\triggermathstyle
+
\def\triggeredmathstyleparameter#1% to bypass the relax
{\ifcase\numexpr\normalmathstyle\relax
#1\displaystyle \or % 0
@@ -1980,7 +1982,7 @@
\scriptscriptfont \else
\textfont
\fi
- \zeropoint}
+ \zerocount}
\def\mathemwidth
{\fontdimen
@@ -1996,7 +1998,7 @@
\scriptscriptfont \else
\textfont
\fi
- \zeropoint}
+ \zerocount}
%D A plain inheritance:
@@ -2778,8 +2780,9 @@
%
% 0x002B=plus 0x2212=minus 0x2013=endash
-\unexpanded\def\mathplus {+}
-\unexpanded\def\mathminus{\ifmmode –\else\iffontchar\font`−−\else –\fi\fi}
+\unexpanded\def\mathplus {+}
+\unexpanded\def\mathminus {\ifmmode –\else\iffontchar\font`−−\else –\fi\fi}
+\unexpanded\def\mathplusminus{±}
%D The \type {\displaywidth} is only known inside a display formula, so we need to catch
%D it when still zero.
@@ -2825,7 +2828,7 @@
\to \everyswitchmathematics % only in mathematics
\appendtoks
- \attribute\mathdomainattribute\c_math_domain_attribute
+ \c_attr_mathdomain\c_math_domain_attribute
\to \everymathematics
\setupmathematics
@@ -2899,17 +2902,35 @@
%D Experiment
\unexpanded\def\math_scripts_stack
- {\attribute\mathunstackattribute\attributeunsetvalue}
+ {\c_attr_mathunstack\attributeunsetvalue}
\unexpanded\def\math_scripts_unstack
{\clf_enablescriptunstacking
- \attribute\mathunstackattribute\plusone}
+ \c_attr_mathunstack\plusone}
\appendtoks
\let\stackscripts \math_scripts_stack
\let\unstackscripts\math_scripts_unstack
\to \everymathematics
+%D Expensive (tracing and inject) but a primitive (using factors) is tricky as we
+%D want this frozen support.
+
+\def\math_openup_parameter#1#2%
+ {\ifzeropt#1\displaystyle \else\ifdim#1\displaystyle =\maxdimen\else\frozen#1\displaystyle #2#1\displaystyle \fi\fi
+ \ifzeropt#1\crampeddisplaystyle \else\ifdim#1\crampeddisplaystyle =\maxdimen\else\frozen#1\crampeddisplaystyle #2#1\crampeddisplaystyle \fi\fi
+ \ifzeropt#1\textstyle \else\ifdim#1\textstyle =\maxdimen\else\frozen#1\textstyle #2#1\textstyle \fi\fi
+ \ifzeropt#1\crampedtextstyle \else\ifdim#1\crampedtextstyle =\maxdimen\else\frozen#1\crampedtextstyle #2#1\crampedtextstyle \fi\fi
+ \ifzeropt#1\scriptstyle \else\ifdim#1\scriptstyle =\maxdimen\else\frozen#1\scriptstyle #2#1\scriptstyle \fi\fi
+ \ifzeropt#1\crampedscriptstyle \else\ifdim#1\crampedscriptstyle =\maxdimen\else\frozen#1\crampedscriptstyle #2#1\crampedscriptstyle \fi\fi
+ \ifzeropt#1\scriptscriptstyle \else\ifdim#1\scriptscriptstyle =\maxdimen\else\frozen#1\scriptscriptstyle #2#1\scriptscriptstyle \fi\fi
+ \ifzeropt#1\crampedscriptscriptstyle\else\ifdim#1\crampedscriptscriptstyle=\maxdimen\else\frozen#1\crampedscriptscriptstyle#2#1\crampedscriptscriptstyle\fi\fi}
+
+\unexpanded\def\mathopenupparameter#1#2%
+ {\ifdim#2\points=\zeropoint\else
+ \math_openup_parameter#1{#2}%
+ \fi}
+
\protect \endinput
% % not used (yet)