[latex3-commits] [git/LaTeX3-latex3-latex3] main: Revert "Exclude accents/letter-likes from ext expansion in a controlled way" (c2c7e3eeb)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Feb 7 08:29:51 CET 2023


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/c2c7e3eeb80216825a15c6a45a54c0efc2af6b23

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

commit c2c7e3eeb80216825a15c6a45a54c0efc2af6b23
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Feb 6 20:11:06 2023 +0000

    Revert "Exclude accents/letter-likes from ext expansion in a controlled way"
    
    This reverts commit f01907b869c3d48c5afed4f6ecd9bdadba046a8c.


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

c2c7e3eeb80216825a15c6a45a54c0efc2af6b23
 l3kernel/CHANGELOG.md       |   3 --
 l3kernel/doc/l3obsolete.txt |   2 -
 l3kernel/l3text-purify.dtx  |   2 +-
 l3kernel/l3text.dtx         | 119 ++++++++++++++++++++++++++++++++++----------
 4 files changed, 95 insertions(+), 31 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index c190bd26a..2c6b3d478 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -11,9 +11,6 @@ this project uses date-based 'snapshot' version identifiers.
 - Swap meaning of `el` and `el-x-iota` when case changing
   Greek: match traditional LaTeX approach
 
-### Removed
-- `\l_text_accents_tl` and `\l_text_letterlike_l`
-
 ## [2023-02-02]
 
 ### Fixed
diff --git a/l3kernel/doc/l3obsolete.txt b/l3kernel/doc/l3obsolete.txt
index 57a70bf66..722f807a6 100644
--- a/l3kernel/doc/l3obsolete.txt
+++ b/l3kernel/doc/l3obsolete.txt
@@ -342,8 +342,6 @@ Function                                      Date removed
 \KV_process_space_removal_sanitize:NNn          2011-09-08
 \l_iow_line_length_int                          2013-01-08
 \l_last_box                                     2012-05-11
-\l_text_accedtns_tl                             2023-02-06
-\l_text_letterlike_tl                           2023-02-06
 \l_tl_replace_toks                              2011-09-08
 \l_tmpa_toks                                    2011-09-08
 \l_tmpb_toks                                    2011-09-08
diff --git a/l3kernel/l3text-purify.dtx b/l3kernel/l3text-purify.dtx
index 07c1d3f78..a28b73fe5 100644
--- a/l3kernel/l3text-purify.dtx
+++ b/l3kernel/l3text-purify.dtx
@@ -547,7 +547,7 @@
         \exp_not:v { c_@@_purify_ \token_to_str:N #1 _tl }
       }
   }
-\tl_map_inline:nn { \` \' \^ \~ \= \u \. \" \r \H \v \d \c \k \b \t }
+\tl_map_inline:Nn \l_text_accents_tl
   { \text_declare_purify_equivalent:Nn #1 { \@@_purify_accent:NN #1 } }
 %    \end{macrocode}
 %   First set up the combining accents.
diff --git a/l3kernel/l3text.dtx b/l3kernel/l3text.dtx
index 0a5d40a46..6bd33f190 100644
--- a/l3kernel/l3text.dtx
+++ b/l3kernel/l3text.dtx
@@ -58,7 +58,7 @@
 %
 % \section{Expanding text}
 %
-% \begin{function}[EXP, added = 2020-01-02, updated = 2023-02-06]{\text_expand:n}
+% \begin{function}[EXP, added = 2020-01-02]{\text_expand:n}
 %   \begin{syntax}
 %     \cs{text_expand:n} \Arg{text}
 %   \end{syntax}
@@ -69,7 +69,8 @@
 %   \cs{l_text_math_delims_tl} or as the argument to commands listed
 %   in \cs{l_text_math_arg_tl}). Commands which are neither engine-
 %   nor \LaTeX{} protected are expanded exhaustively.
-%   Any commands listed in \cs{l_text_expand_exclude_tl} are excluded from
+%   Any commands listed in \cs{l_text_expand_exclude_tl},
+%   \cs{l_text_accents_tl} and \cs{l_text_letterlike_tl} are excluded from
 %   expansion.
 % \end{function}
 %
@@ -255,6 +256,16 @@
 %
 % \section{Control variables}
 %
+% \begin{variable}{\l_text_accents_tl}
+%   Lists commands which represent accents, and which are left unchanged
+%   by expansion. (Defined only for the \LaTeXe{} package.)
+% \end{variable}
+%
+% \begin{variable}{\l_text_letterlike_tl}
+%   Lists commands which represent  letters; these are left unchanged by
+%   expansion. (Defined only for the \LaTeXe{} package.)
+% \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
@@ -783,6 +794,31 @@
 %
 % \subsection{Configuration variables}
 %
+% \begin{variable}{\l_text_accents_tl, \l_text_letterlike_tl}
+%   Special cases for accents and letter-like symbols, which in some cases will
+%   need to be converted further.
+%    \begin{macrocode}
+\tl_new:N \l_text_accents_tl
+\tl_set:Nn \l_text_accents_tl
+  { \` \' \^ \~ \= \u \. \" \r \H \v \d \c \k \b \t }
+\tl_new:N \l_text_letterlike_tl
+\tl_set:Nn \l_text_letterlike_tl
+  {
+    \AA \aa
+    \AE \ae
+    \DH \dh
+    \DJ \dj
+    \IJ \ij
+    \L  \l
+    \NG \ng
+    \O  \o
+    \OE \oe
+    \SS \ss
+    \TH \th
+  }
+%    \end{macrocode}
+% \end{variable}
+%
 % \begin{variable}{\l_text_case_exclude_arg_tl}
 %   Non-text arguments, including covering the case of \tn{protected at edef}
 %   applied to \cs{cite}.
@@ -915,6 +951,10 @@
 % \begin{macro}[EXP]{\@@_expand_exclude:NN}
 % \begin{macro}[EXP]{\@@_expand_exclude:Nw}
 % \begin{macro}[EXP]{\@@_expand_exclude:Nnn}
+% \begin{macro}[EXP]{\@@_expand_accent:N}
+% \begin{macro}[EXP]{\@@_expand_accent:NN}
+% \begin{macro}[EXP]{\@@_expand_letterlike:N}
+% \begin{macro}[EXP]{\@@_expand_letterlike:NN}
 % \begin{macro}[EXP]{\@@_expand_cs:N}
 % \begin{macro}[EXP]{\@@_expand_protect:w}
 % \begin{macro}[EXP]{\@@_expand_protect:N}
@@ -1199,7 +1239,7 @@
 \cs_new:Npn \@@_expand_exclude:NN #1#2
   {
     \@@_if_q_recursion_tail_stop_do:Nn #2
-      { \@@_expand_cs:N #1 }
+      { \@@_expand_accent:N #1 }
     \str_if_eq:nnTF {#1} {#2}
       {
         \@@_use_i_delimit_by_q_recursion_stop:nw
@@ -1215,6 +1255,53 @@
     \@@_expand_loop:w
   }
 %    \end{macrocode}
+%   Accents.
+%    \begin{macrocode}
+\cs_new:Npn \@@_expand_accent:N #1
+  {
+    \exp_after:wN \@@_expand_accent:NN \exp_after:wN
+      #1 \l_text_accents_tl
+      \q_@@_recursion_tail \q_@@_recursion_stop
+  }
+\cs_new:Npn \@@_expand_accent:NN #1#2
+  {
+    \@@_if_q_recursion_tail_stop_do:Nn #2
+      { \@@_expand_letterlike:N #1 }
+    \cs_if_eq:NNTF #2 #1
+      {
+        \@@_use_i_delimit_by_q_recursion_stop:nw
+          {
+            \@@_expand_store:n {#1}
+            \@@_expand_loop:w
+          }
+      }
+      { \@@_expand_accent:NN #1 }
+  }
+%    \end{macrocode}
+%   Another list of exceptions: these ones take no arguments so are
+%   easier to handle.
+%    \begin{macrocode}
+\cs_new:Npn \@@_expand_letterlike:N #1
+  {
+    \exp_after:wN \@@_expand_letterlike:NN \exp_after:wN
+      #1 \l_text_letterlike_tl
+      \q_@@_recursion_tail \q_@@_recursion_stop
+  }
+\cs_new:Npn \@@_expand_letterlike:NN #1#2
+  {
+    \@@_if_q_recursion_tail_stop_do:Nn #2
+      { \@@_expand_cs:N #1 }
+    \cs_if_eq:NNTF #2 #1
+      {
+        \@@_use_i_delimit_by_q_recursion_stop:nw
+          {
+            \@@_expand_store:n {#1}
+            \@@_expand_loop:w
+          }
+      }
+      { \@@_expand_letterlike:NN #1 }
+  }
+%    \end{macrocode}
 %   \LaTeXe{}'s \cs{protect} makes life interesting. Where possible, we
 %   simply remove it and replace with the \enquote{parent} command; of course,
 %   the \cs{protect} might be explicit, in which case we need to leave it alone.
@@ -1406,6 +1493,10 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \begin{macro}
 %   {
@@ -1423,28 +1514,6 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% Prevent expansion of various standard values.
-%    \begin{macrocode}
-\tl_map_inline:nn
-  { \` \' \^ \~ \= \u \. \" \r \H \v \d \c \k \b \t }
-  { \text_declare_expand_equivalent:Nn #1 { \exp_not:n {#1} } }
-\tl_map_inline:nn
-  {
-    \AA \aa
-    \AE \ae
-    \DH \dh
-    \DJ \dj
-    \IJ \ij
-    \L  \l
-    \NG \ng
-    \O  \o
-    \OE \oe
-    \SS \ss
-    \TH \th
-  }
-  { \text_declare_expand_equivalent:Nn #1 { \exp_not:n {#1} } }
-%    \end{macrocode}
-%
 %    \begin{macrocode}
 %</package>
 %    \end{macrocode}





More information about the latex3-commits mailing list.