[latex3-commits] [latex3/latex2e] add-theHcount: add support for theHcounter representation (253b6e44)
github at latex-project.org
github at latex-project.org
Thu Jun 15 20:09:30 CEST 2023
Repository : https://github.com/latex3/latex2e
On branch : add-theHcount
Link : https://github.com/latex3/latex2e/commit/253b6e441e2a88dc449fe221f23d0658ece129da
>---------------------------------------------------------------
commit 253b6e441e2a88dc449fe221f23d0658ece129da
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Thu Jun 15 20:09:30 2023 +0200
add support for theHcounter representation
>---------------------------------------------------------------
253b6e441e2a88dc449fe221f23d0658ece129da
base/changes.txt | 8 ++++++++
base/doc/ltnews38.tex | 10 ++++++++++
base/ltcounts.dtx | 44 ++++++++++++++++++++++++++++++++++++++++----
base/ltxref.dtx | 30 ++++++++++++++++++++++++------
4 files changed, 82 insertions(+), 10 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 5d243c86..ff26d4c6 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,14 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================
+2023-06-15 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
+
+ * ltcounts.dtx (subsection{Environment Counter Macros}):
+ extend \@definecounter and \@addtoreset so that they define also \theH<counter>
+ * ltxref.dtx (subsection{Cross Referencing}):
+ \refstepcounter sets also \@currentHref
+ provide a kernel definition \@kernel at refstepcounter
+
2023-06-09 Joseph Wright <Joseph.Wright at latex-project.org>
* usrguide.tex
diff --git a/base/doc/ltnews38.tex b/base/doc/ltnews38.tex
index c527c8e4..689076b9 100644
--- a/base/doc/ltnews38.tex
+++ b/base/doc/ltnews38.tex
@@ -144,6 +144,16 @@
\section{New or improved commands}
+\subsection{Proving counter representations for link targets}
+
+To create unique link targets the package
+\pkg{hyperref} needs special counter representations
+\verb+\theH+\meta{counter}. For this it patches the
+commands \verb+\@definecounter+, \verb+\@addtoreset+
+and \verb+\refstepcounter+. These counter representations are also
+needed for the tagged PDF project and so these patches have now been incorporated
+into the kernel.
+
%
\githubissue{xxx}
diff --git a/base/ltcounts.dtx b/base/ltcounts.dtx
index 69025fa4..287e2b19 100644
--- a/base/ltcounts.dtx
+++ b/base/ltcounts.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltcounts.dtx}
- [2021/07/08 v1.1m LaTeX Kernel (Counters)]
+ [2023/06/15 v1.1n LaTeX Kernel (Counters)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltcounts.dtx}
@@ -171,13 +171,15 @@
%
% |\refstepcounter|\marg{foo}\\
% Same as |\stepcounter|, but it also defines
-% |\@currentreference| so that a subsequent
+% |\@currentlabel|, |\@currentHref| and |\@currentcounter|
+% and so that a subsequent
% |\label|\marg{bar} command causes |\ref|\marg{bar} to
% generate the current value of counter \meta{foo}.
%
% |\@definecounter|\marg{foo}\\
% Initializes counter \marg{foo} (with empty reset list), defines
-% |\p at foo| and |\thefoo| to be null. Also adds \meta{foo}
+% |\p at foo| and |\thefoo| to be null and |\theHfoo| to be
+% |\number\value{foo}|. Also adds \meta{foo}
% to |\cl@@ckpt| --
% the reset list of a dummy counter |@ckpt| used for taking
% checkpoints for the |\include| system.
@@ -305,22 +307,56 @@
% \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/06/15}{define theHfoo (used for internal links)}
%
% \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2023/11/01}{\@definecounter}
+%<latexrelease> {provide theHfoo commands}%
+%<*2ekernel|latexrelease>
\def\@definecounter#1{\expandafter\newcount\csname c@#1\endcsname
\setcounter{#1}\z@
\global\expandafter\let\csname cl@#1\endcsname\@empty
\@addtoreset{#1}{@ckpt}%
\global\expandafter\let\csname p@#1\endcsname\@empty
+ \expandafter\gdef\csname theH#1\endcsname{\the\value{#1}}%
\expandafter
\gdef\csname the#1\expandafter\endcsname\expandafter
{\expandafter\@arabic\csname c@#1\endcsname}}
+%<latexrelease>\EndIncludeInRelease
+%</2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{0000/00/00}{\@definecounter}
+%<latexrelease> {provide theHfoo commands}%%
+%<latexrelease>\def\@definecounter#1{\expandafter\newcount\csname c@#1\endcsname
+%<latexrelease> \setcounter{#1}\z@
+%<latexrelease> \global\expandafter\let\csname cl@#1\endcsname\@empty
+%<latexrelease> \@addtoreset{#1}{@ckpt}%
+%<latexrelease> \global\expandafter\let\csname p@#1\endcsname\@empty
+%<latexrelease> \expandafter
+%<latexrelease> \gdef\csname the#1\expandafter\endcsname\expandafter
+%<latexrelease> {\expandafter\@arabic\csname c@#1\endcsname}}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@addtoreset}
+% \changes{v1.1n}{2023/06/15}{add the parent theHfoo if a counter is reset}
% \begin{macrocode}
-\def\@addtoreset#1#2{\expandafter\@cons\csname cl@#2\endcsname {{#1}}}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2023/11/01}{\@addtoreset}
+%<latexrelease> {provide theHfoo commands}%
+%<*2ekernel|latexrelease>
+\def\@addtoreset#1#2{\expandafter\@cons\csname cl@#2\endcsname {{#1}}%
+ \expandafter\gdef\csname theH#1\endcsname{\csname theH#2\endcsname.\the\value{#1}}%
+}
+%<latexrelease>\EndIncludeInRelease
+%</2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{0000/00/00}{\@addtoreset}
+%<latexrelease> {provide theHfoo commands}%%
+%<latexrelease>\def\@addtoreset#1#2{\expandafter\@cons\csname cl@#2\endcsname {{#1}}}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
diff --git a/base/ltxref.dtx b/base/ltxref.dtx
index 0f842e43..f786ee8b 100644
--- a/base/ltxref.dtx
+++ b/base/ltxref.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltxref.dtx}
- [2023/05/16 v1.1q LaTeX Kernel (Cross Referencing)]
+ [2023/06/15 v1.1r LaTeX Kernel (Cross Referencing)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltxref.dtx}
@@ -413,19 +413,23 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macrocode}
-%<latexrelease>\IncludeInRelease{2022/06/01}%
-%<latexrelease> {\Ref}{Add starred version}%
-% \end{macrocode}
%
% \begin{macro}{\refstepcounter}
% Step the counter and allow for labels to point to its current value.
% \changes{v1.1n}{2020/05/05}{record the counter name in \cs{@currentcounter}}
% \changes{v1.1o}{2020/08/23}{add default definition of \cs{@currentcounter}}
+% \changes{v1.1r}{2023/06/15}{set also \@currentHref}
+% \changes{v1.1r}{2023/06/15}{provide a kernel copy \@kernel at refstepcounter}
% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2022/06/01}%
+%<latexrelease> {\Ref}{Add starred version}%
\def\@currentcounter{}
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2023/11/01}%
+%<latexrelease> {\@currentHref}{set theHcounter representation}%
\def\refstepcounter#1{\stepcounter{#1}%
\edef\@currentcounter{#1}%
+ \xdef\@currentHref {#1.\csname theH#1\endcsname}
\protected at edef\@currentlabel
% \end{macrocode}
% By generating the second csname first the |\p at ...| command can
@@ -450,9 +454,23 @@
% \begin{macrocode}
{\csname p@#1\expandafter\endcsname\csname the#1\endcsname}%
}
+\let\@kernel at refstepcounter\refstepcounter
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2022/06/01}%
+%<latexrelease> {\@currentHref}{set theHcounter representation}%
+%<latexrelease>\def\refstepcounter#1{\stepcounter{#1}%
+%<latexrelease> \edef\@currentcounter{#1}%
+%<latexrelease> \protected at edef\@currentlabel
+%<latexrelease> {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}%
+%<latexrelease>}
+%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
-% \end{macro}
%
+% \end{macro}
+% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2022/06/01}%
+%<latexrelease> {\Ref}{Add starred version}%
+% \end{macrocode}
% \begin{macro}{\labelformat}
% A shortcut to set the |\p at ...| macro for a counter. It will pick
% up the counter representation as an argument so that it can be
More information about the latex3-commits
mailing list.