Skip to content

Commit

Permalink
Merge branch 'develop' into gh1438
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright authored Oct 13, 2024
2 parents 61ca0b4 + d0c0924 commit 0204780
Show file tree
Hide file tree
Showing 136 changed files with 1,322 additions and 252 deletions.
11 changes: 11 additions & 0 deletions base/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ not part of the distribution.
* lttagging.dtx: dummy for \tag_suspend:n and \tag_resume:n
* lttagging.dtx: declare tagging sockets for floats and caption.


2024-09-21 Ulrike Fischer <Ulrike.Fischer@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}):
Use sockets in \refstepcounter for target and tagging support.
* ltmeta.dtx: move patches and change of \MakeLinkTarget from latex-lab.
* lttagging.dtx: add tagging socket for targets.


2024-09-15 Joseph Wright <Joseph.Wright@latex-project.org>
* lttemplates-doc.tex, lttemplates-code.tex:
New files
Expand Down
22 changes: 22 additions & 0 deletions base/doc/ltnews40.tex
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ \section{Switch to T1 as default encoding in documents using \cs{DocumentMetadat
\texttt{OT1} encoding in their document can do so with
\verb+\usepackage[OT1]{fontenc}+.



\section{News from the \enquote{\LaTeX{} Tagged PDF} project}

The tagging of tabulars has been extended: it is now possible to tag
Expand Down Expand Up @@ -300,6 +302,26 @@ \subsection{Improved error raised by empty hook}
%
\githubissue{1423}

\subsection{Provide counter representations for link targets}

To create unique target names for links the package
\pkg{hyperref} uses a special counter representation
\verb+\theH+\meta{counter}. To ensure that this
counter representation exists, \pkg{hyperref} redefined the
commands \verb+\@definecounter+, \verb+\@addtoreset+
and \verb+\refstepcounter+. This counter representation is also
needed for the Tagged PDF project and and so these augmented command definitions
have now been incorporated
into the kernel.
Thus from now on every \verb+\newcounter{+\meta{counter}\verb+}+ will not
only define \verb+\the+\meta{counter} but also \verb+\theH+\meta{counter}.

\subsection{Extending \cs{refstepcounter}}

The package \pkg{hyperref} redefines since many years \verb+\refstepcounter+ and
adds code that creates link targets. The kernel definition has now been extended
with socket interfaces that will allow \pkg{hyperref} to avoid the redefinitions. The new interfaces are also used by the Tagged PDF code that needs target names to resolve
references between structures.

\section{Bug fixes}

Expand Down
58 changes: 52 additions & 6 deletions base/ltcounts.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltcounts.dtx}
[2021/11/08 v1.1n LaTeX Kernel (Counters)]
[2024/09/20 v1.1o LaTeX Kernel (Counters)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltcounts.dtx}
Expand Down Expand Up @@ -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@foo| and |\thefoo| to be null. Also adds \meta{foo}
% |\p@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.
Expand Down Expand Up @@ -306,13 +308,18 @@
% \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)}
%
% \changes{v1.1o}{2024/09/20}{define theHfoo (used for internal links)}
% \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2024/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}}%
% \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
Expand All @@ -328,12 +335,51 @@
\@latex@warning{Command `\string\the#1' already
defined -- not changed}%
\fi}
%<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> \ifx\csname the#1\endcsname\relax
%<latexrelease> \expandafter
%<latexrelease> \gdef\csname the#1\expandafter\endcsname\expandafter
%<latexrelease> {\expandafter\@arabic\csname c@#1\endcsname}%
%<latexrelease> \else
%<latexrelease> \@latex@warning{Command `\string\the#1' already
%<latexrelease> defined -- not changed}%
%<latexrelease> \fi}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@addtoreset}
% \changes{v1.1o}{2024/09/20}{add the parent theHfoo if a counter is reset}
% If a counter is reset when a parent counter changes it no longer has an unique value
% across the document. As |\theH<counter>| should be unique
% this representation is changed to include also the
% representation of the parent. This is not 100\% guaranteed to work
% but has been used this way by hyperref for many years without causing problems.
% \begin{macrocode}
\def\@addtoreset#1#2{\expandafter\@cons\csname cl@#2\endcsname {{#1}}}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2024/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}
%
Expand Down Expand Up @@ -423,7 +469,7 @@
}%
}
% \end{macrocode}
%
%
% \begin{macrocode}
\NewDocumentCommand \counterwithin {sO{\arabic}mm}{%
\@ifbothcounters{#3}{#4}{%
Expand Down
34 changes: 31 additions & 3 deletions base/ltmeta.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
%<*driver>
% \fi
\ProvidesFile{ltmeta.dtx}
[2024/05/16 v1.0b LaTeX Kernel (Document Metadata)]
[2024/09/21 v1.0c LaTeX Kernel (Document Metadata)]
% \iffalse
%
\documentclass{l3doc}
Expand Down Expand Up @@ -152,20 +152,48 @@
% we provide also the new interface commands of the hyperref package
% for the creation of targets.
% \changes{v1.0b}{2022/05/17}{Default definition for targets added}
% \changes{v1.0c}{2024/09/21}{Added tagging support}
% \begin{macro}{\MakeLinkTarget}
% \begin{macro}{\LinkTargetOn}
% \begin{macro}{\LinkTargetOff}
% \begin{macro}{\NextLinkTarget}
% \begin{macrocode}
%<latexrelease>\IncludeInRelease{2024/11/01}%
%<latexrelease> {\MakeLinkTarget}{Record target name for tagging support}%
\ExplSyntaxOn
\int_new:N\g__kernel_target_int
\NewDocumentCommand\MakeLinkTarget{sO{}m}{%
\ifvmode
\special{}%
\else
\@savsf\spacefactor
\smash{}%
\spacefactor\@savsf
\fi}
\NewDocumentCommand\LinkTargetOn{}{}
\fi
\IfBooleanTF {#1}
{
\tl_gset:Ne \@currentHref {#3}
}
{
\int_gincr:N\g__kernel_target_int
\tl_gset:Ne \@currentHref {target*.\int_use:N\g__kernel_target_int}
}
\UseTaggingSocket{recordtarget}
}
\ExplSyntaxOff
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{2022/06/01}%
%<latexrelease> {\MakeLinkTarget}{Record target name for tagging support}%
%<latexrelease>\NewDocumentCommand\MakeLinkTarget{sO{}m}{%
%<latexrelease> \ifvmode
%<latexrelease> \special{}%
%<latexrelease> \else
%<latexrelease> \@savsf\spacefactor
%<latexrelease> \smash{}%
%<latexrelease> \spacefactor\@savsf
%<latexrelease> \fi}
%<latexrelease>\EndIncludeInRelease
\NewDocumentCommand\LinkTargetOn{}{}
\NewDocumentCommand\LinkTargetOff{}{}
\NewDocumentCommand\NextLinkTarget{m}{}
% \end{macrocode}
Expand Down
39 changes: 31 additions & 8 deletions base/lttagging.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{lttagging.dtx}
[2024/10/09 v1.0i LaTeX Kernel (tagging support)]
[2024/10/11 v1.0j LaTeX Kernel (tagging support)]
% \iffalse
\documentclass{l3doc}
\GetFileInfo{lttagging.dtx}
Expand Down Expand Up @@ -253,7 +253,6 @@
\bool_set_true:N \l__tag_para_bool
}
\AssignSocketPlug{tagsupport/para/restore}{default}
\ExplSyntaxOff
% \end{macrocode}
% \end{plugdecl}
%
Expand All @@ -264,6 +263,34 @@
% TODO: move this into lttagging.
% \end{socketdecl}

% \subsubsection{Tagging socket for targets}

% \begin{socketdecl}{tagsupport/refstepcounter}
% When tagging is active we want to track the current structure number
% when targets are set. This will be mostly used in \cs{refstepcounter}
% but also if targets are set manually.
% \begin{macrocode}
\NewSocket{tagsupport/recordtarget}{0}
% \end{macrocode}
% \end{socketdecl}
%
% \begin{plugdecl}{kernel (tagsupport/recordtarget)}
% \begin{macrocode}
%
\NewSocketPlug{tagsupport/recordtarget}{kernel}
{
\tl_if_blank:VF \@currentHref
{
\prop_gput:Nee
\g__tag_struct_dest_num_prop
{\@currentHref}
{\tag_get:n{struct_num}}
}
}
\AssignSocketPlug{tagsupport/recordtarget}{kernel}
\ExplSyntaxOff
% \end{macrocode}
% \end{plugdecl}
% \subsubsection{Tagging sockets for toc}

% \begin{socketdecl}{tagsupport/toc/contentsline/before,
Expand Down Expand Up @@ -898,14 +925,10 @@
%<@@=>
% \end{macrocode}
%
% \changes{v1.0h}{2024/09/20}{moved \cs{@kernel@refstepcounter} into ltxref}
% This is needed for \pkg{longtable} because \cs{refstepcounter} is
% setting up a target when \pkg{hyperref} is loaded and we don't
% want that in \pkg{longtable}.
%
% TODO: move to right .dtx file
% \begin{macrocode}
\let\@kernel@refstepcounter\refstepcounter
% \end{macrocode}
% want that in \pkg{longtable}.%%
% Prevent longtable patching by hyperref until hyperref does so automatically:
% \begin{macrocode}
\def\hyper@nopatch@longtable{}
Expand Down
Loading

0 comments on commit 0204780

Please sign in to comment.