[latex3-commits] [git/LaTeX3-latex3-latex3] mathcolor: Hard-code \limits treatment (e01f114be)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Jan 28 07:53:56 CET 2022


Repository : https://github.com/latex3/latex3
On branch  : mathcolor
Link       : https://github.com/latex3/latex3/commit/e01f114beee8c0a02f5f69689b7dd6dc2a42d799

>---------------------------------------------------------------

commit e01f114beee8c0a02f5f69689b7dd6dc2a42d799
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Jan 28 06:53:56 2022 +0000

    Hard-code \limits treatment


>---------------------------------------------------------------

e01f114beee8c0a02f5f69689b7dd6dc2a42d799
 l3kernel/l3color.dtx | 37 ++++++++++++-------------------------
 1 file changed, 12 insertions(+), 25 deletions(-)

diff --git a/l3kernel/l3color.dtx b/l3kernel/l3color.dtx
index b177a478a..9eccf2033 100644
--- a/l3kernel/l3color.dtx
+++ b/l3kernel/l3color.dtx
@@ -323,12 +323,9 @@
 %   handled.
 % \end{function}
 %
-% \begin{variable}[added = 2022-01-26]
-%   {\l_color_math_limits_tl, \l_color_math_active_tl}
-%   These token list control some aspects of \cs{color_math:nn(n)}. The
-%   \texttt{limits} list holds tokens which act in the same way as
-%   \cs{limits}. The \texttt{active} list holds tokens which are math active
-%   and should be replaced by their definition during searching for
+% \begin{variable}[added = 2022-01-26]{\l_color_math_active_tl}
+%   This list controls which tokens are considered as math active and
+%   should therefore be replaced by their definition during searching for
 %   sub/superscripts.
 % \end{variable}
 %
@@ -1401,14 +1398,6 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\l_color_math_limits_tl}
-%   Tokens representing limits.
-%    \begin{macrocode}
-\tl_new:N \l_color_math_limits_tl
-\tl_set:Nn \l_color_math_limits_tl { \limits \nolimits \displaylimits }
-%    \end{macrocode}
-% \end{macro}
-%
 % \begin{macro}{\g_@@_math_seq}
 %   Not all engines have multiple color stacks, and at the same time we are
 %   not expecting breaking within a colored math fragment. So we track the
@@ -1479,10 +1468,9 @@
   }
 %    \end{macrocode}
 %   Dealing with literal |_| and |^| is easy, and as we have exactly two cases,
-%   we can hard-code this. Finding limits is a bit more fun, as the list
-%   could grow: here we use a mapping. The end of that code cleans up 
-%   the dangling \cs{@@_math_scan_auxii:}, then also removes the test token
-%   (using \cs{use_none:n}).
+%   we can hard-code this. We use a hard-coded list for limits: these are all
+%   primitives. The \cs{use_none:n} herealso removes the test token so it is
+%   left just in the right place.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_math_scan_auxi:
   {
@@ -1493,15 +1481,14 @@
       }
       { \@@_math_scripts:Nw }
       {
-        \tl_map_inline:Nn \l_color_math_limits_tl
+        \token_case_meaning:NnTF \l_peek_token
           {
-            \token_if_eq_meaning:NNT \l_peek_token ##1
-              {
-                \tl_map_break:n
-                  { \use_i:nn { ##1 \@@_math_scan:w \use_none:n } }
-               }
+            \tex_limits:D        { \tex_limits:D }
+            \tex_nolimits:D      { \tex_nolimits:D }
+            \tex_displaylimits:D { \tex_displaylimits:D }
           }
-        \@@_math_scan_auxii:
+          { \@@_math_scan:w \use_none:n }
+          { \@@_math_scan_auxii: }
       }
   }
 %    \end{macrocode}





More information about the latex3-commits mailing list.