summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/math-ini.mkxl
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl/math-ini.mkxl')
-rw-r--r--tex/context/base/mkxl/math-ini.mkxl91
1 files changed, 49 insertions, 42 deletions
diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl
index 901d187b0..fd1cb2243 100644
--- a/tex/context/base/mkxl/math-ini.mkxl
+++ b/tex/context/base/mkxl/math-ini.mkxl
@@ -2609,18 +2609,18 @@
% \protected\def\math_punctuation_comma {\textcomma \futurelet\nexttoken\math_punctuation_next}
% \protected\def\math_punctuation_period{\textperiod\futurelet\nexttoken\math_punctuation_next}
%
-% \setnewconstant\c_math_comma "002C
-% \setnewconstant\c_math_period "002E
+% \setnewconstant\commaasciicode "002C
+% \setnewconstant\periodasciicode "002E
% \setnewconstant\c_math_special"8000
%
% \bgroup
%
-% \catcode\c_math_comma \activecatcode
-% \catcode\c_math_period\activecatcode
+% \catcode\commaasciicode \activecatcode
+% \catcode\periodasciicode\activecatcode
%
% \protected\gdef\math_punctuation_initialize_indeed
-% {\mathcode\c_math_comma \c_math_special
-% \mathcode\c_math_period\c_math_special
+% {\mathcode\commaasciicode \c_math_special
+% \mathcode\periodasciicode\c_math_special
% \let,\math_punctuation_comma
% \let.\math_punctuation_period
% \c_attr_mathpunctuation\plustwo}
@@ -2660,38 +2660,49 @@
%
% The next one is more efficient as it produces more flat noad lists for numbers.
-\setnewconstant\c_math_comma "002C
-\setnewconstant\c_math_period "002E
-%setnewconstant\c_math_colon "003A
-\setnewconstant\c_math_semicolon"003B
-\setnewconstant\c_math_special "8000
-
-% todo: use \Umathclass\c_math_comma\mathpunctcode etc for temporary switching
-
%D This is a dirty trick. In order to prevent a loop due to reinjection, when a
%D active one is seen, the amcode is set to other. So, afterwards we need to
%D reactivate. Eventually this feature will be dropped in favor of a more modern
%D mechanism.
-\def\math_activeate_comma {\amcode\c_math_comma \activecatcode}
-\def\math_activeate_period {\amcode\c_math_period \activecatcode}
-\def\math_activeate_semicolon{\amcode\c_math_semicolon\activecatcode}
+%D These amcodes can be alignmenttab, superscript, subscript, letter, otherchar, or
+%D active. That way we can avoid the "8000 hackery and let characters keep the
+%D proper class. The code is checked when we run into an active character in math
+%D mode
+
+\def\math_activeate_comma {\amcode\commaasciicode \activecatcode}
+\def\math_activeate_period {\amcode\periodasciicode \activecatcode}
+\def\math_activeate_semicolon{\amcode\semicolonasciicode\activecatcode}
+
+\def\math_set_o_comma {\Umathcode\commaasciicode \mathordinarycode \zerocount\commaasciicode}
+\def\math_set_p_comma {\Umathcode\commaasciicode \mathpunctuationcode\zerocount\commaasciicode}
+\def\math_set_o_period {\Umathcode\periodasciicode \mathordinarycode \zerocount\periodasciicode}
+\def\math_set_p_period {\Umathcode\periodasciicode \mathpunctuationcode\zerocount\periodasciicode}
+\def\math_set_o_semicolon{\Umathcode\semicolonasciicode\mathordinarycode \zerocount\semicolonasciicode}
+\def\math_set_p_semicolon{\Umathcode\semicolonasciicode\mathpunctuationcode\zerocount\semicolonasciicode}
-\def\math_set_o_comma {\Umathcode\c_math_comma \mathordinarycode \zerocount\c_math_comma}
-\def\math_set_p_comma {\Umathcode\c_math_comma \mathpunctuationcode\zerocount\c_math_comma}
-\def\math_set_o_period {\Umathcode\c_math_period \mathordinarycode \zerocount\c_math_period}
-\def\math_set_p_period {\Umathcode\c_math_period \mathpunctuationcode\zerocount\c_math_period}
-\def\math_set_o_semicolon{\Umathcode\c_math_semicolon\mathordinarycode \zerocount\c_math_semicolon}
-\def\math_set_p_semicolon{\Umathcode\c_math_semicolon\mathpunctuationcode\zerocount\c_math_semicolon}
+\edef\math_set_o_both{\math_set_o_period\math_set_o_comma}
+\edef\math_set_p_both{\math_set_p_period\math_set_p_comma}
-\edef\math_set_o_both {\math_set_o_period\math_set_o_comma}
-\edef\math_set_p_both {\math_set_p_period\math_set_p_comma}
+% We cannot use \mathchardef'd variants because then are intercepted as active, so:
\protected\def\math_punctuation_nop_comma {\begingroup\math_set_p_comma ,\endgroup\math_activeate_comma }
\protected\def\math_punctuation_nop_period {\begingroup\math_set_o_period .\endgroup\math_activeate_period }
\protected\def\math_punctuation_nop_semicolon{\begingroup\math_set_p_semicolon;\endgroup\math_activeate_semicolon}
-% todo: use new lookahead stuff
+\def\math_punctuation_comma_next {\begingroup\Umathcode\commaasciicode \ifx\nexttoken\blankspace\mathpunctuationcode\else\mathordinarycode\fi\zerocount\commaasciicode ,\endgroup\math_activeate_comma }
+\def\math_punctuation_period_next {\begingroup\Umathcode\periodasciicode \ifx\nexttoken\blankspace\mathpunctuationcode\else\mathordinarycode\fi\zerocount\periodasciicode .\endgroup\math_activeate_period }
+\def\math_punctuation_semicolon_next{\begingroup\Umathcode\semicolonasciicode\ifx\nexttoken\blankspace\mathpunctuationcode\else\mathordinarycode\fi\zerocount\semicolonasciicode;\endgroup\math_activeate_semicolon}
+
+% So, nicer is:
+%
+% \protected\def\math_punctuation_nop_comma {\Umathclass\mathpunctuationcode\commaasciicode \math_activeate_comma }
+% \protected\def\math_punctuation_nop_period {\Umathclass\mathordinarycode \periodasciicode \math_activeate_period }
+% \protected\def\math_punctuation_nop_semicolon{\Umathclass\mathpunctuationcode\semicolonasciicode\math_activeate_semicolon}
+%
+% \def\math_punctuation_comma_next {\Umathclass\ifx\nexttoken\blankspace\mathpunctuationcode\else\mathordinarycode\fi\commaasciicode \math_activeate_comma }
+% \def\math_punctuation_period_next {\Umathclass\ifx\nexttoken\blankspace\mathpunctuationcode\else\mathordinarycode\fi\periodasciicode \math_activeate_period }
+% \def\math_punctuation_semicolon_next{\Umathclass\ifx\nexttoken\blankspace\mathpunctuationcode\else\mathordinarycode\fi\semicolonasciicode\math_activeate_semicolon}
\protected\def\math_punctuation_all_comma {\futurelet\nexttoken\math_punctuation_comma_next}
\protected\def\math_punctuation_all_period {\futurelet\nexttoken\math_punctuation_period_next}
@@ -2701,19 +2712,15 @@
\let\math_punctuation_yes_period \math_punctuation_nop_period
\let\math_punctuation_yes_semicolon\math_punctuation_all_semicolon
-\def\math_punctuation_comma_next {\begingroup\Umathcode\c_math_comma \ifx\nexttoken\blankspace\mathpunctuationcode\else\mathordinarycode\fi\zerocount\c_math_comma ,\endgroup\math_activeate_comma }
-\def\math_punctuation_period_next {\begingroup\Umathcode\c_math_period \ifx\nexttoken\blankspace\mathpunctuationcode\else\mathordinarycode\fi\zerocount\c_math_period .\endgroup\math_activeate_period }
-\def\math_punctuation_semicolon_next{\begingroup\Umathcode\c_math_semicolon\ifx\nexttoken\blankspace\mathpunctuationcode\else\mathordinarycode\fi\zerocount\c_math_semicolon;\endgroup\math_activeate_semicolon}
-
\installcorenamespace {mathautopunctuation}
\bgroup
% This can and will be replaced by classes:
- \catcode\c_math_comma \activecatcode
- \catcode\c_math_period \activecatcode
- \catcode\c_math_semicolon\activecatcode
+ \catcode\commaasciicode \activecatcode
+ \catcode\periodasciicode \activecatcode
+ \catcode\semicolonasciicode\activecatcode
\gdefcsname\??mathautopunctuation\v!no\endcsname
{\let,\math_punctuation_nop_comma
@@ -2753,19 +2760,19 @@
\egroup
% \appendtoks
-% \global\mathcode\c_math_comma \c_math_special
-% \global\mathcode\c_math_period \c_math_special
-% \global\mathcode\c_math_semicolon\c_math_special
+% \global\mathcode\commaasciicode \c_math_special
+% \global\mathcode\periodasciicode \c_math_special
+% \global\mathcode\semicolonasciicode\c_math_special
% \to \everyjob
-% \activatemathcharacter\c_math_comma
-% \activatemathcharacter\c_math_period
-% \activatemathcharacter\c_math_semicolon
+% \activatemathcharacter\commaasciicode
+% \activatemathcharacter\periodasciicode
+% \activatemathcharacter\semicolonasciicode
% \appendtoks
-% \mathcode\c_math_comma \c_math_special
-% \mathcode\c_math_period \c_math_special
-% \mathcode\c_math_semicolon\c_math_special
+% \mathcode\commaasciicode \c_math_special
+% \mathcode\periodasciicode \c_math_special
+% \mathcode\semicolonasciicode\c_math_special
% \begincsname\??mathautopunctuation\mathematicsparameter\c!autopunctuation\endcsname
% \to \everymathematics