summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex-dev/base/ltcounts.dtx')
-rw-r--r--Master/texmf-dist/source/latex-dev/base/ltcounts.dtx52
1 files changed, 39 insertions, 13 deletions
diff --git a/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx b/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx
index 1d3f2024898..da88a92b7a5 100644
--- a/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx
+++ b/Master/texmf-dist/source/latex-dev/base/ltcounts.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2024
+% Copyright (C) 1993-2025
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltcounts.dtx}
- [2024/10/26 v1.1p LaTeX Kernel (Counters)]
+ [2025/01/22 v1.2a LaTeX Kernel (Counters)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltcounts.dtx}
@@ -56,6 +56,7 @@
%</driver>
% \fi
%
+% \providecommand\env[1]{\texttt{#1}}
%
% \changes{v1.0c}{1994/03/29}
% {Create file from parts of ltmiscen and ltherest.}
@@ -63,7 +64,9 @@
% \changes{v1.1d}{1996/04/23}{Documentation improvements}
%
% \section{Counters and Lengths}
-% Commands for defining and using counters. This file defines:
+% Commands for defining and using counters.
+% This file defines the following commands. In each case \marg{counter} may be
+% |*| denoting the current counter as set by a previous |\refstepcounter|.
%
% \DescribeMacro{\newcounter}
% To define a new counter.
@@ -72,13 +75,13 @@
% To set the value of counters.
%
% \DescribeMacro{\addtocounter}
-% Increase the counter |#1| by the number |#2|.
+% Increase the \marg{counter} |#1| by the number |#2|.
%
% \DescribeMacro{\stepcounter}
-% Increase a counter by one.
+% Increase the \marg{counter} by one.
%
% \DescribeMacro{\refstepcounter}
-% Increase a counter by one, also setting the value used by |\label|.
+% Increase the \marg{counter} by one, also setting the value used by |\label|.
%
%
% \DescribeMacro{\value}
@@ -113,7 +116,8 @@
% |\the|\meta{within-counter}.\meta{format}\marg{counter} with \cs{arabic} as
% the default for \meta{format}.
% Star form omits redefining the print representation.
-
+%
+% The |*| alias for the current counter may not be used in either argument.
%
% \DescribeMacro\counterwithout
% |\counterwithout|\oarg{format}\marg{counter}\marg{within-counter}:
@@ -124,6 +128,8 @@
% the default for \meta{format}.
% Star form omits redefining the print representation.
%
+% The |*| alias for the current counter may not be used in either argument.
+%
% \MaybeStop{}
%
% \begin{macrocode}
@@ -246,7 +252,19 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@newctr}
+% \begin{macro}{\c@*}
+% \changes{v1.2a}{2025/01/22}{\cs{c@*} added (gh/1632)}
+% Make the current counter available as a \LaTeX\ counter
+% with name |*|, so |\alph*| returns the current
+% counter as a letter, |\stepcounter{*}| increments the current
+% counter, etc.
+% \begin{macrocode}
+\protected\expandafter
+ \def\csname c@*\endcsname{\value\@currentcounter}
+% \end{macrocode}
+% \end{macro}
+%
+%\begin{macro}{\@newctr}
% \changes{v1.0d}{1994/04/09}
% {\cs{@nocnterr} now has counter name argument}
% \changes{v1.0e}{1994/04/17}
@@ -422,19 +440,27 @@
\endgroup}}
% \end{macrocode}
% \end{macro}
-
-
-
+%
% \begin{macro}{\@ifbothcounters}
% \changes{v1.1k}{2018/03/08}{Interface added}
+% \changes{v1.2a}{2025/01/22}{Guard against star alias.}
% Test if arg |#1| and |#2| are counters and if so execute |#3|.
% \begin{macrocode}
+\begingroup\catcode`\*=11 \lowercase{\endgroup
\def\@ifbothcounters#1#2#3{%
+% \end{macrocode}
+% \begin{macrocode}
+ \begingroup\let\c@*\@undefined
+% \end{macrocode}
+% \begin{macrocode}
\@ifundefined{c@#1}{\@nocounterr{#1}}%
{% else counter is defined
\@ifundefined{c@#2}{\@nocounterr{#2}}%
{% else both counter and within are defined
- #3}}}
+ #3}}%
+% \end{macrocode}
+% \begin{macrocode}
+ \endgroup}}
% \end{macrocode}
% \end{macro}
%
@@ -621,7 +647,7 @@
% |\@Roman\FOOcounter|
% Representation of |\FOOcounter| as upper-case
% Roman numerals.
-
+%
% \changes{v1.1f}{1997/10/06}{Change \cs{@Roman} to be fully
% expandable, so that the result is written properly to files.}
% \begin{macrocode}