[latex3-commits] [git/LaTeX3-latex3-latex3] l3text: Split 'text' cmd exclusions into math and 'non-text' (41f2a89eb)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Nov 26 10:36:06 CET 2019


Repository : https://github.com/latex3/latex3
On branch  : l3text
Link       : https://github.com/latex3/latex3/commit/41f2a89eb6836d8508cfb51cb09eb17f9efddae3

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

commit 41f2a89eb6836d8508cfb51cb09eb17f9efddae3
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Nov 26 09:36:06 2019 +0000

    Split 'text' cmd exclusions into math and 'non-text'
    
    We will later want to re-use the two lists independently.


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

41f2a89eb6836d8508cfb51cb09eb17f9efddae3
 l3kernel/l3text.dtx | 38 +++++++++++++++++++++++++++++++++-----
 1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/l3kernel/l3text.dtx b/l3kernel/l3text.dtx
index 40aa36599..5747d290e 100644
--- a/l3kernel/l3text.dtx
+++ b/l3kernel/l3text.dtx
@@ -80,7 +80,10 @@
 %
 % \begin{variable}{\l_text_exclude_arg_tl}
 %   Lists commands present in the \meta{text} where the argument of the
-%   command should be excluded from expansion, etc.
+%   command should be excluded from expansion, etc. The argument is regarded
+%   as non-textual by all functions in the module: depending on the treatment
+%   of non-text, the command and its argument may be left unchanged, or
+%   removed entirely.
 % \end{variable}
 %
 % \begin{variable}{\l_text_letterlike_tl}
@@ -88,6 +91,13 @@
 %   expansion.
 % \end{variable}
 %
+% \begin{variable}{\l_text_math_arg_tl}
+%   Lists commands present in the \meta{text} where the argument of the
+%   command should be treated as math mode material. The treatment here is
+%   similar to \cs{l_text_math_delims_tl} but for a command rather than
+%   paired delimiters.
+% \end{variable}
+%
 % \begin{variable}{\l_text_math_delims_tl}
 %   Lists pairs of tokens which delimit (in-line) math mode content; such
 %   content \emph{may} be excluded from processing.
@@ -258,7 +268,15 @@
 %   Non-textual arguments.
 %    \begin{macrocode}
 \tl_new:N \l_text_exclude_arg_tl
-\tl_set:Nn \l_text_exclude_arg_tl { \cite \ensuremath \label \ref }
+\tl_set:Nn \l_text_exclude_arg_tl { \cite \label \ref }
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_text_math_arg_tl}
+%   Math mode as arguments.
+%    \begin{macrocode}
+\tl_new:N \l_text_math_arg_tl
+\tl_set:Nn \l_text_math_arg_tl { \ensuremath }
 %    \end{macrocode}
 % \end{variable}
 %
@@ -305,6 +323,7 @@
 % \begin{macro}[rEXP]{\@@_expand_math_group:Nn}
 % \begin{macro}[rEXP]{\@@_expand_math_space:Nw}
 % \begin{macro}[rEXP]{\@@_expand_exclude:N}
+% \begin{macro}[rEXP]{\@@_expand_exclude:nN}
 % \begin{macro}[rEXP]{\@@_expand_exclude:NN}
 % \begin{macro}[rEXP]{\@@_expand_exclude:Nn}
 % \begin{macro}[rEXP]{\@@_expand_letterlike:N}
@@ -497,9 +516,17 @@
 %    \begin{macrocode}
 \cs_new:Npn \@@_expand_exclude:N #1
   {
-    \exp_after:wN \exp_after:wN \exp_after:wN \@@_expand_exclude:NN
-      \exp_after:wN \exp_after:wN \exp_after:wN #1
-      \exp_after:wN \l_text_exclude_arg_tl \l_text_accents_tl
+    \exp_args:Ne \@@_expand_exclude:nN
+      {
+        \exp_not:V \l_text_exclude_arg_tl
+        \exp_not:V \l_text_math_arg_tl
+        \l_text_accents_tl
+      }
+      #1
+  }
+\cs_new:Npn \@@_expand_exclude:nN #1#2
+  {
+    \@@_expand_exclude:NN #1 #2
       \q_recursion_tail \q_recursion_stop
   }
 \cs_new:Npn \@@_expand_exclude:NN #1#2
@@ -644,6 +671,7 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 %    \begin{macrocode}
 %</initex|package>





More information about the latex3-commits mailing list