[latex3-commits] [git/LaTeX3-latex3-latex2e] gh386: Add \string at makeletter (0ac4ba70)

PhelypeOleinik phelype.oleinik at latex-project.org
Mon Sep 7 02:38:15 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : gh386
Link       : https://github.com/latex3/latex2e/commit/0ac4ba703ba13c22fb17ed0c9b4653096330d833

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

commit 0ac4ba703ba13c22fb17ed0c9b4653096330d833
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Sun Sep 6 21:38:15 2020 -0300

    Add \string at makeletter


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

0ac4ba703ba13c22fb17ed0c9b4653096330d833
 base/ltdefns.dtx | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 base/ltexpl.dtx  | 10 +++++++++-
 2 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/base/ltdefns.dtx b/base/ltdefns.dtx
index ea6a924f..27c15e23 100644
--- a/base/ltdefns.dtx
+++ b/base/ltdefns.dtx
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltdefns.dtx}
-             [2020/08/21 v1.5m LaTeX Kernel (definition commands)]
+             [2020/09/06 v1.5n LaTeX Kernel (definition commands)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltdefns.dtx}
@@ -2194,6 +2194,58 @@
 %  \end{macro}
 %
 %
+% \begin{macro}{\string at makeletter}
+% \begin{macro}{\@string at makeletter}
+% \begin{macro}{\char at if@alph}
+%   Iterates through a string, turning each alphabetic character into
+%   a catcode-11 token (partly undoes a \cs{detokenize}).  Useful for
+%   \cs{ifx}-based string comparisons where \cs{detokenize}-ing the
+%   other string would break too much code.
+%
+%   \changes{v1.5n}{2020/09/06}
+%         {Macro added}
+%
+%   The macro uses \textsf{expl3}'s \cs{@expl at str@map at function@@NN} to
+%   iterate on the string (without losing spaces) and applies
+%   \cs{@string at makeletter} on each character.  The latter checks if
+%   character is between a--z or A--Z, and uses \cs{@alph} or \cs{@Alph}
+%   to get the corresponding catcode-11 token.  Other tokens are passed
+%   through unchanged.
+%    \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2020/10/01}{\string at makeletter}
+%<latexrelease>  {Add \string at makeletter}%
+%<*2ekernel|latexrelease>
+\def\string at makeletter#1{%
+  \@expl at str@map at function@@NN#1\@string at makeletter}
+\def\@string at makeletter#1{%
+  \char at if@alph#1%
+    {\ifnum`#1<`a \@Alph{\numexpr`#1-`A+1\relax}%
+     \else \@alph{\numexpr`#1-`a+1\relax}%
+     \fi}%
+    {#1}}
+\def\char at if@alph#1{%
+  \ifnum0\ifnum`#1<`A 1\fi\ifnum`#1>`z 1\fi
+      \if\ifnum`#1>`Z @\fi\ifnum`#1<`a @\fi01\fi>0
+    \expandafter\@secondoftwo
+  \else
+    \expandafter\@firstoftwo
+  \fi}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%
+%<latexrelease>\IncludeInRelease{0000/00/00}{\string at makeletter}
+%<latexrelease>  {Undefine \string at makeletter}%
+%<latexrelease>\let\string at makeletter\@undefined
+%<latexrelease>\let\@string at makeletter\@undefined
+%<latexrelease>\let\char at if@alph\@undefined
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
 %
 % \begin{macro}{\makeatletter}
 % \begin{macro}{\makeatother}
@@ -2207,7 +2259,6 @@
 % \end{macro}
 % \end{macro}
 %
-
 %
 % \section{Discretionary Hyphenation}
 % \begin{macro}{\-}
diff --git a/base/ltexpl.dtx b/base/ltexpl.dtx
index 16ca2609..cbd0c9a2 100644
--- a/base/ltexpl.dtx
+++ b/base/ltexpl.dtx
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltexpl.dtx}
-             [2020/08/21 v1.2e LaTeX Kernel (expl3-dependent code)]
+             [2020/09/06 v1.2f LaTeX Kernel (expl3-dependent code)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltexpl.dtx}
@@ -280,6 +280,13 @@
 \cs_gset_eq:NN \@expl at cs@replacement at spec@@N \cs_replacement_spec:N
 %    \end{macrocode}
 %
+% \changes{v1.2f}{2020/09/06}
+%         {Add \cs{\@expl at str@map at function@@NN}
+%          for \cs{string at makeletter} (gh/386)}
+%    \begin{macrocode}
+\cs_gset_eq:NN \@expl at str@map at function@@NN \str_map_function:NN
+%    \end{macrocode}
+%
 %    \begin{macrocode}
 %<latexrelease>\EndIncludeInRelease
 %<latexrelease>\IncludeInRelease{0000/00/00}{expl3~2020-10-01}%
@@ -289,6 +296,7 @@
 %<latexrelease>\cs_undefine:N \@expl at cs@prefix at spec@@N
 %<latexrelease>\cs_undefine:N \@expl at cs@argument at spec@@N
 %<latexrelease>\cs_undefine:N \@expl at cs@replacement at spec@@N
+%<latexrelease>\cs_undefine:N \@expl at str@map at function@@NN
 %<latexrelease>\EndIncludeInRelease
 %</2ekernel|latexrelease>
 %    \end{macrocode}





More information about the latex3-commits mailing list.