[latex3-commits] [latex3/latex2e] gh823: try again (60520a7a)

github at latex-project.org github at latex-project.org
Tue Nov 7 19:13:18 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : gh823
Link       : https://github.com/latex3/latex2e/commit/60520a7a397d017d76085efa013608f462e58253

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

commit 60520a7a397d017d76085efa013608f462e58253
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Tue Nov 7 19:13:18 2023 +0100

    try again


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

60520a7a397d017d76085efa013608f462e58253
 base/ltcounts.dtx | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/base/ltcounts.dtx b/base/ltcounts.dtx
index c9dd05c5..c0175d7a 100644
--- a/base/ltcounts.dtx
+++ b/base/ltcounts.dtx
@@ -313,13 +313,20 @@
      \global\expandafter\let\csname cl@#1\endcsname\@empty
      \@addtoreset{#1}{@ckpt}%
      \global\expandafter\let\csname p@#1\endcsname\@empty
-     \ifcsname the#1\endcsname
-     \@latex at warning{Command `\string\the#1' already
-                     defined -- not changed}%
-     \else
+     \expandafter
+%    \end{macrocode}
+%    If \cs{the\#1} is undefined or \cs{relax} we define it with the
+%    standard definition for counters, otherwise we warn. This will
+%    catch, for example, that somebody defines a counter named
+%    ``index'' conflicting with the \env{theindex} environment.
+%    \begin{macrocode}
+     \ifx\csname the#1\endcsname\relax
        \expandafter
        \gdef\csname the#1\expandafter\endcsname\expandafter
               {\expandafter\@arabic\csname c@#1\endcsname}%
+     \else
+       \@latex at warning{Command `\string\the#1' already
+                       defined -- not changed}%
      \fi}
 %    \end{macrocode}
 %  \end{macro}





More information about the latex3-commits mailing list.