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

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


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

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

commit aec0bcf0f9a8d83aa38adad7e727d74e6ff75e71
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Feb 7 07:41:23 2023 +0000

    Exclude accents/letter-likes from text expansion in a controlled way
    
    Better again than the last attempt:
    accept that we cannot remove commands, but
    avoid adding any content to the lists and instead
    use the updated approach. This means that any
    third-party use will still work and we stick to
    our 'no more removals' line.


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

aec0bcf0f9a8d83aa38adad7e727d74e6ff75e71
 l3kernel/CHANGELOG.md       |  3 +++
 l3kernel/doc/l3obsolete.txt |  2 ++
 l3kernel/l3text-purify.dtx  |  2 +-
 l3kernel/l3text.dtx         | 63 ++++++++++++++++++++++-----------------------
 4 files changed, 37 insertions(+), 33 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 2c6b3d478..376d07972 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
 
+### Deprecated
+- `\l_text_accents_tl` and `\l_text_letterlike_tl`
+
 ## [2023-02-02]
 
 ### Fixed
diff --git a/l3kernel/doc/l3obsolete.txt b/l3kernel/doc/l3obsolete.txt
index 722f807a6..0be4e4d5e 100644
--- a/l3kernel/doc/l3obsolete.txt
+++ b/l3kernel/doc/l3obsolete.txt
@@ -33,6 +33,8 @@ Function                            Date deprecated
 \cs_argument_spec:N                      2022-06-24
 \l_keys_key_tl                           2020-02-08
 \l_keys_path_tl                          2020-02-08
+\l_text_accents_tl                       2023-02-07
+\l_text_letterlike_tl                    2023-02-07
 \peek_catcode_ignore_spaces:N            2022-01-11
 \peek_catcode_remove_ignore_spaces:N     2022-01-11
 \peek_charcode_ignore_spaces:N           2022-01-11
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..4f10c134e 100644
--- a/l3kernel/l3text.dtx
+++ b/l3kernel/l3text.dtx
@@ -58,7 +58,8 @@
 %
 % \section{Expanding text}
 %
-% \begin{function}[EXP, added = 2020-01-02]{\text_expand:n}
+% \begin{function}[EXP, added = 2020-01-02, updated = 2023-02-07]
+%   {\text_expand:n}
 %   \begin{syntax}
 %     \cs{text_expand:n} \Arg{text}
 %   \end{syntax}
@@ -69,8 +70,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}
 %
@@ -84,7 +84,11 @@
 %   \end{syntax}
 %   Declares that the \meta{replacement} tokens should be used whenever the
 %   \meta{cmd} (a single token) is encountered. The \meta{replacement} tokens
-%   should be expandable.
+%   should be expandable. A token can be \enquote{replaced} by itself if
+%   the defined replacement wraps it in \cs{exp_not:n}, for example
+%   \begin{verbatim}
+%     \text_declare_expand_equivalent:Nn \' { \exp_not:n { \' } }
+%   \end{verbatim}
 % \end{function}
 %
 % \section{Case changing}
@@ -256,16 +260,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
@@ -795,27 +789,10 @@
 % \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.
+%   Used to be used for excluding these ideas from expansion: now deprecated.
 %    \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}
 %
@@ -1514,6 +1491,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.