[latex3-commits] [git/LaTeX3-latex3-latex3] main: Handle accents separately from other case exlcusiosn (e31bb39ec)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Jun 14 22:49:35 CEST 2021


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

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

commit e31bb39ecf1e40152494b1d66d852c49462e6da1
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Jun 14 21:49:35 2021 +0100

    Handle accents separately from other case exlcusiosn
    
    See #946.


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

e31bb39ecf1e40152494b1d66d852c49462e6da1
 l3kernel/CHANGELOG.md |  2 ++
 l3kernel/l3text.dtx   | 33 +++++++++++++++++++++++++++++----
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 29582608b..b7c97ac1a 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -11,6 +11,8 @@ this project uses date-based 'snapshot' version identifiers.
 - Local assignment to `\g__sys_backend_tl`
 - Incorrect internal function name (issue #939)
 - Case-changing exceptions for (u)pTeX (issue #939)
+- Low-level error if accent commands are not followed by
+  letter when case changing (see #946)
 
 ## [2021-06-01]
 
diff --git a/l3kernel/l3text.dtx b/l3kernel/l3text.dtx
index 724c19068..a192135ea 100644
--- a/l3kernel/l3text.dtx
+++ b/l3kernel/l3text.dtx
@@ -625,6 +625,8 @@
 % \begin{macro}[EXP]{\@@_expand_exclude:nN}
 % \begin{macro}[EXP]{\@@_expand_exclude:NN}
 % \begin{macro}[EXP]{\@@_expand_exclude:Nn}
+% \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, \@@_expand_encoding:N}
@@ -858,15 +860,13 @@
   }
 %    \end{macrocode}
 %   Next we exclude math commands: this is mainly as there \emph{might} be an
-%   \cs{ensuremath}. We also handle accents, which are basically the same issue
-%   but are kept separate for semantic reasons.
+%   \cs{ensuremath}.
 %    \begin{macrocode}
 \cs_new:Npn \@@_expand_exclude:N #1
   {
     \exp_args:Ne \@@_expand_exclude:nN
       {
         \exp_not:V \l_text_math_arg_tl
-        \exp_not:V \l_text_accents_tl
         \exp_not:V \l_text_expand_exclude_tl
       }
     #1
@@ -879,7 +879,7 @@
 \cs_new:Npn \@@_expand_exclude:NN #1#2
   {
     \@@_if_recursion_tail_stop_do:Nn #2
-      { \@@_expand_letterlike:N #1 }
+      { \@@_expand_accent:N #1 }
     \str_if_eq:nnTF {#1} {#2}
       {
         \@@_use_i_delimit_by_q_recursion_stop:nw
@@ -893,6 +893,29 @@
     \@@_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_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}
@@ -1091,6 +1114,8 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \begin{macro}
 %   {





More information about the latex3-commits mailing list.