[latex3-commits] [git/LaTeX3-latex3-latex2e] gh881: change log (c245e046)
David Carlisle
d.p.carlisle at gmail.com
Thu Jun 30 22:42:01 CEST 2022
Repository : https://github.com/latex3/latex2e
On branch : gh881
Link : https://github.com/latex3/latex2e/commit/c245e0460325cf21b37b2f032c6d159ad037eb79
>---------------------------------------------------------------
commit c245e0460325cf21b37b2f032c6d159ad037eb79
Author: David Carlisle <d.p.carlisle at gmail.com>
Date: Thu Jun 30 21:42:01 2022 +0100
change log
>---------------------------------------------------------------
c245e0460325cf21b37b2f032c6d159ad037eb79
base/changes.txt | 6 ++++
base/ltfinal.dtx | 95 +++++++++++++++++++++-----------------------------------
2 files changed, 41 insertions(+), 60 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index dff00a29..db1dd18f 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -10,6 +10,12 @@ are not part of the distribution.
All changes above are only part of the development branch for the next release.
================================================================================
+2022-06-30 David Carlisle <David.Carlisle at latex-project.org>
+
+ * ltfinal.dtx: update MakeUppercase and \MakeLowercase fo gh/881
+ \protectd at edef no longer needed with latest l3 code.
+ added \AddToNoCaseChangeList
+
#########################
# 2022-06-01 PL3 Release
########################
diff --git a/base/ltfinal.dtx b/base/ltfinal.dtx
index b1b8ff95..b8f85ded 100644
--- a/base/ltfinal.dtx
+++ b/base/ltfinal.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltfinal.dtx}
- [2022/06/02 v2.2u LaTeX Kernel (Final Settings)]
+ [2022/06/30 v2.2v LaTeX Kernel (Final Settings)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltfinal.dtx}
@@ -1065,9 +1065,7 @@
% \begin{macro}{\MakeUppercase}
% \begin{macro}{\MakeUppercase}
% \begin{macro}{\NoCaseChange}
-% \begin{macro}{\@uclclist}
-% \begin{macro}{\@expl at text@lowercase@@n}
-% \begin{macro}{\@expl at text@uppercase@@n}
+% \begin{macro}{\AddToNoCaseChangeList}
% \begin{macro}{\@uclclist}
%
%
@@ -1077,84 +1075,61 @@
% And whilst we're doing things with uc/lc tables, here are two
% commands to upper- and lower-case a string.
%
-% \emph{Note} that this implementation is subject to change! At
-% the moment we're not providing any way to extend the list of
-% uc/lc commands, since finding a good interface is difficult.
-% These commands have some nasty features, such as uppercasing
-% mathematics, environment names, labels, etc. A much better
-% long-term solution is to use all-caps fonts, but these aren't
-% generally available.
%
+% \changes{v2.1h}{2019/09/14}{Expand UTF8 chars when case changing (github/177)}
+% \changes{v2.2r}{2022/02/20}
+% {Use \cs{@expl at text@uppercase@@n}, removing local redefinition of \cs{UTF at two@octets at noexpand}}%
+% \changes{v2.2t}{2022/04/21}{Support \cs{noexpand} in argument of \cs{@expl at text@uppercase@@n}}
+% \changes{v2.2v}{2022/026/30}{Just use \cs{text_lowercase:n} without \cs{protectd at edf} gh/881x}%
% Two wrappers around the L3 case changing functions.
% |\protected| to make them mostly safe as replacements for |uppercase|
% and |\lowercase|.
+%
+% In
+%\begin{verbatim}
+% \markboth{\MakeUppercase\contentsname}
+% {\MakeUppercase\contentsname}
+%\end{verbatim}
+% then the uppercasing is only done to the first letter of the
+% contents name, since the mark expands out to:
+%\begin{verbatim}
+% \mark{\protect\MakeUppercase Table of Contents}
+% {\protect\MakeUppercase Table of Contents}
+%\end{verbatim}
+% In order to get round this, we redefine |\MakeUppercase| and
+% |\MakeLowercase| to grab their argument and brace it.
+%
+% Earlier versions needed to procsss |\@uclclist| in an |\edef|
+% to handle legacy input encodings, but recent (2022) expl3 versions
+% handle non-UTF8 text natively so we simply call the |\text_...case:n|
+% functions.
% \begin{macrocode}
\ExplSyntaxOn
-\protected\def\@expl at text@lowercase@@n{\text_lowercase:n}
-\protected\def\@expl at text@uppercase@@n{\text_uppercase:n}
+\protected\def\MakeUppercase#1{\text_uppercase:n{#1}}
+\protected\def\MakeLowercase#1{\text_lowercase:n{#1}}
% \end{macrocode}
%
% \changes{v2.2u}{2022/06/02}{Add \cs{NoCaseChange}}
+% \changes{v2.2uv}{2022/06/02}{Add \cs{AddToNoCaseChangeList}}
% |\NoCaseChange| protects its argument from the case change functions.
+%
+% |\AddToNoCaseChangeList| Allows new commands to protect their arguments, eg
+% |AddToNoCaseChangeList{\eqref}| would protect the argument of |\eqref|
+% in the same way as the argument of |\ref|.
% \begin{macrocode}
+\def\AddToNoCaseChangeList{\tl_put_right:Nn \l_text_case_exclude_arg_tl}
\tl_put_right:Nn \l_text_case_exclude_arg_tl { \NoCaseChange }
\cs_new_protected:Npn \NoCaseChange #1 {#1}
\ExplSyntaxOff
% \end{macrocode}
%
-% \begin{macrocode}
-\DeclareRobustCommand{\MakeUppercase}[1]{{%
- \def\i{I}\def\j{J}%
- \def\reserved at a##1##2{\let##1##2\reserved at a}%
- \expandafter\reserved at a\@uclclist\reserved at b{\reserved at b\@gobble}%
-% \end{macrocode}
-% Tell UTF-8 processing to process chars even though we are in an \cs{protected at edef}.
-% \changes{v2.1h}{2019/09/14}{Expand UTF8 chars when case changing (github/177)}
-% \changes{v2.2r}{2022/02/20}
-% {Use \cs{@expl at text@uppercase@@n}, removing local redefinition of \cs{UTF at two@octets at noexpand}}%
-% \changes{v2.2t}{2022/04/21}{Support \cs{noexpand} in argument of \cs{@expl at text@uppercase@@n}}
-% \begin{macrocode}
- \protected at edef\reserved at a{\@expl at text@uppercase@@n{\noexpand\unexpanded{#1}}}%
- \reserved at a
- }}
-\DeclareRobustCommand{\MakeLowercase}[1]{{%
- \def\reserved at a##1##2{\let##2##1\reserved at a}%
- \expandafter\reserved at a\@uclclist\reserved at b{\reserved at b\@gobble}%
- \protected at edef\reserved at a{\@expl at text@lowercase@@n{\noexpand\unexpanded{#1}}}%
- \reserved at a
- }}
-% \end{macrocode}
-%
% \changes{v2.2q}{2021/09/06}{Correctly upper and lowercase
% \cs{ij} and \cs{IJ} (gh/658)}
% \begin{macrocode}
\def\@uclclist{\oe\OE\o\O\ae\AE
\dh\DH\dj\DJ\l\L\ng\NG\ss\SS\ij\IJ\th\TH}
% \end{macrocode}
-% The above code works, but has the nasty side-effect that if you
-% say something like:
-%\begin{verbatim}
-% \markboth{\MakeUppercase\contentsname}
-% {\MakeUppercase\contentsname}
-%\end{verbatim}
-% then the uppercasing is only done to the first letter of the
-% contents name, since the mark expands out to:
-%\begin{verbatim}
-% \mark{\protect\MakeUppercase Table of Contents}
-% {\protect\MakeUppercase Table of Contents}
-%\end{verbatim}
-% In order to get round this, we redefine |\MakeUppercase| and
-% |\MakeLowercase| to grab their argument and brace it. This is a
-% very low-level hack, and is \emph{not} recommended practice!
-% This is an instance of a general problem that makes it unsafe to
-% grab arguments unbraced, and probably needs a more general
-% solution. For the moment though, this hack will do:
-% \begin{macrocode}
-\protected at edef\MakeUppercase#1{\MakeUppercase{#1}}
-\protected at edef\MakeLowercase#1{\MakeLowercase{#1}}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
+%
% \end{macro}
% \end{macro}
% \end{macro}
More information about the latex3-commits
mailing list.