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

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Feb 6 21:11:06 CET 2023


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

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

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

    Exclude accents/letter-likes from ext expansion in a controlled way
    
    This is a beer approach than the reverted checkin here:
    it allows the same ideas to be explored but
    as a wider re-working not just an ah hoc change.


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

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

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 2c6b3d478..c190bd26a 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -11,6 +11,9 @@ 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 722f807a6..57a70bf66 100644
--- a/l3kernel/doc/l3obsolete.txt
+++ b/l3kernel/doc/l3obsolete.txt
@@ -342,6 +342,8 @@ 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 a28b73fe5..07c1d3f78 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 \l_text_accents_tl
+\tl_map_inline:nn { \` \' \^ \~ \= \u \. \" \r \H \v \d \c \k \b \t }
   { \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 6bd33f190..0a5d40a46 100644
--- a/l3kernel/l3text.dtx
+++ b/l3kernel/l3text.dtx
@@ -58,7 +58,7 @@
 %
 % \section{Expanding text}
 %
-% \begin{function}[EXP, added = 2020-01-02]{\text_expand:n}
+% \begin{function}[EXP, added = 2020-01-02, updated = 2023-02-06]{\text_expand:n}
 %   \begin{syntax}
 %     \cs{text_expand:n} \Arg{text}
 %   \end{syntax}
@@ -69,8 +69,7 @@
 %   \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},
-%   \cs{l_text_accents_tl} and \cs{l_text_letterlike_tl} are excluded from
+%   Any commands listed in \cs{l_text_expand_exclude_tl} are excluded from
 %   expansion.
 % \end{function}
 %
@@ -256,16 +255,6 @@
 %
 % \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
@@ -794,31 +783,6 @@
 %
 % \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}.
@@ -951,10 +915,6 @@
 % \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}
@@ -1239,7 +1199,7 @@
 \cs_new:Npn \@@_expand_exclude:NN #1#2
   {
     \@@_if_q_recursion_tail_stop_do:Nn #2
-      { \@@_expand_accent:N #1 }
+      { \@@_expand_cs:N #1 }
     \str_if_eq:nnTF {#1} {#2}
       {
         \@@_use_i_delimit_by_q_recursion_stop:nw
@@ -1255,53 +1215,6 @@
     \@@_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.
@@ -1493,10 +1406,6 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
 %
 % \begin{macro}
 %   {
@@ -1514,6 +1423,28 @@
 %    \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.