diff options
author | Norbert Preining <norbert@preining.info> | 2024-02-15 03:01:30 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-02-15 03:01:30 +0000 |
commit | 5b6839a58ea5468b40ebd52b579e680b8e62ff13 (patch) | |
tree | 1dfc09f53794115129a07bf566b466cc337606f5 /macros/latex-dev/base/ltcounts.dtx | |
parent | a90336c3069c198b41b7b6eb76e3389610ad5eb7 (diff) |
CTAN sync 202402150301
Diffstat (limited to 'macros/latex-dev/base/ltcounts.dtx')
-rw-r--r-- | macros/latex-dev/base/ltcounts.dtx | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/macros/latex-dev/base/ltcounts.dtx b/macros/latex-dev/base/ltcounts.dtx index 69025fa479..006486d23b 100644 --- a/macros/latex-dev/base/ltcounts.dtx +++ b/macros/latex-dev/base/ltcounts.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 1993-2023 +% Copyright (C) 1993-2024 % The LaTeX Project and any individual authors listed elsewhere % in this file. % @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltcounts.dtx} - [2021/07/08 v1.1m LaTeX Kernel (Counters)] + [2021/11/08 v1.1n LaTeX Kernel (Counters)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltcounts.dtx} @@ -305,6 +305,7 @@ % \begin{macro}{\@definecounter} % \changes{v1.1b}{1995/05/20}{Streamlined code} % \changes{v1.1c}{1995/05/20}{And do it right} +% \changes{v1.1n}{2023/11/07}{Do not change \cs{the...} if already defined (gh/823)} % % \begin{macrocode} \def\@definecounter#1{\expandafter\newcount\csname c@#1\endcsname @@ -312,9 +313,21 @@ \global\expandafter\let\csname cl@#1\endcsname\@empty \@addtoreset{#1}{@ckpt}% \global\expandafter\let\csname p@#1\endcsname\@empty +% \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} \expandafter - \gdef\csname the#1\expandafter\endcsname\expandafter - {\expandafter\@arabic\csname c@#1\endcsname}} + \ifx\csname the#1\endcsname\relax + \expandafter + \gdef\csname the#1\expandafter\endcsname\expandafter + {\expandafter\@arabic\csname c@#1\endcsname}% + \else + \@latex@warning{Command `\string\the#1' already + defined -- not changed}% + \fi} % \end{macrocode} % \end{macro} % |