[latex3-commits] [git/LaTeX3-latex3-latex2e] latex-lab-toc-sec: move 'kernel changes' to extra file to avoid repetitions (e230065c)
Ulrike Fischer
fischer at troubleshooting-tex.de
Fri Feb 24 19:43:56 CET 2023
Repository : https://github.com/latex3/latex2e
On branch : latex-lab-toc-sec
Link : https://github.com/latex3/latex2e/commit/e230065c972b77f2df9ee79a16728095d35a90f3
>---------------------------------------------------------------
commit e230065c972b77f2df9ee79a16728095d35a90f3
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Fri Feb 24 19:43:56 2023 +0100
move 'kernel changes' to extra file to avoid repetitions
>---------------------------------------------------------------
e230065c972b77f2df9ee79a16728095d35a90f3
required/latex-lab/latex-lab-sec-tagging.dtx | 46 +++++++---------------
.../latex-lab/latex-lab-toc-kernel-changes.dtx | 10 +++--
required/latex-lab/latex-lab.ins | 5 +++
3 files changed, 26 insertions(+), 35 deletions(-)
diff --git a/required/latex-lab/latex-lab-sec-tagging.dtx b/required/latex-lab/latex-lab-sec-tagging.dtx
index ad2bf503..c8efc650 100644
--- a/required/latex-lab/latex-lab-sec-tagging.dtx
+++ b/required/latex-lab/latex-lab-sec-tagging.dtx
@@ -160,7 +160,7 @@
% it means we can't safely close the \texttt{Sect} and so we issue a warning
% and do nothing.
%
-% \subsubsection{Assigning the headings level numbers}
+% \subsubsection{Loading general kernel changes}
% [kernel?]
% Also done in the toc-tagging, only repeated here for the record and
% for consistency in case the toc-tagging code is not loaded.
@@ -169,45 +169,22 @@
% and by hyperref.
% The numbers are a bit different to the one in hyperref, but imho sensible.
% \begin{macrocode}
-\def\toclevel at part{-1}
-\def\toclevel at chapter{0}
-\def\toclevel at section{1}
-\def\toclevel at subsection{2}
-\def\toclevel at subsubsection{3}
-\def\toclevel at paragraph{4}
-\def\toclevel at subparagraph{5}
-\def\toclevel at figure{1}
-\def\toclevel at table{1}
+\RequirePackage{latex-lab-kernel-changes}
% \end{macrocode}
-%
-% \subsubsection{Providing and updating \cs{@currentHref}}
-% [kernel?]
-%
-% Copied from the code from the toc-tagging.
-%
-% \cs{@currentHref} contains the current unique representation of a counter.
-% It is useful also without hyperref as it allows to connect with a |/Ref|
-% key a toc entry with the heading it refers too. So \cs{refstepcounter}
-% is extended to update the command. This is done at the begin so that the
-% hyperref code can still adapt it later (using the cmd/refstepcounter/after hook
-% would be too late, and could also break with cleveref.)
-%
-%
% \begin{macrocode}
-\def\@currentHref{}
-\def\refstepcounter#1{\stepcounter{#1}%
- \edef\@currentcounter{#1}%
- \xdef\@currentHref {#1.\csname theH#1\endcsname}%
- \protected at edef\@currentlabel
- {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}%
-}
+%</package>
% \end{macrocode}
%
-% We also must ensure that manual targets (e.g. in unnumbered sections)
+% \subsubsection{updating \cs{@currentHref}}
+% [kernel?]
+%
+% We must ensure that manual targets (e.g. in unnumbered sections)
% correctly update \cs{@currentHref}. For this we extend the kernel definition of
% \cs{MakeLinkTarget}
%
% \begin{macrocode}
+%<*kernelchange>
+\ExplSyntaxOn
\int_new:N\g__kernel_target_int
\RenewDocumentCommand\MakeLinkTarget{sO{}m}
{%
@@ -221,8 +198,13 @@
\int_gincr:N\g__kernel_target_int
\tl_gset:Nx \@currentHref {target*.\int_use:N\g__kernel_target_int}
}
+\ExplSyntaxOff
+%</kernelchange>
% \end{macrocode}
%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
% \subsubsection{Tagging commands}
%
%
diff --git a/required/latex-lab/latex-lab-toc-kernel-changes.dtx b/required/latex-lab/latex-lab-toc-kernel-changes.dtx
index 36c37a98..523f5e07 100644
--- a/required/latex-lab/latex-lab-toc-kernel-changes.dtx
+++ b/required/latex-lab/latex-lab-toc-kernel-changes.dtx
@@ -48,9 +48,6 @@
%
% The followings contains various changes to kernel commands
% needed for the tagging of table of contents and similar lists.
-% \begin{macrocode}
-%<*package>
-% \end{macrocode}
% \section{General kernel and class changes}
%
% Some of the changes can probably could go into the kernel.
@@ -70,6 +67,7 @@
%
% At first we suppress the patches from hyperref:
% \begin{macrocode}
+%<*kernelchange>
\def\hyper at nopatch@counter{}
% \end{macrocode}
%
@@ -137,6 +135,12 @@
\def\toclevel at subparagraph{5}
\def\toclevel at figure{1}
\def\toclevel at table{1}
+%</kernelchange>
+% \end{macrocode}
+% \subsection{load kernel changes}
+% \begin{macrocode}
+%<*package>
+\RequirePackage{latex-lab-kernel-changes}
% \end{macrocode}
%
% \subsection{\cs{contentsline} extension}
diff --git a/required/latex-lab/latex-lab.ins b/required/latex-lab/latex-lab.ins
index 8af160de..49c5aaed 100644
--- a/required/latex-lab/latex-lab.ins
+++ b/required/latex-lab/latex-lab.ins
@@ -101,4 +101,9 @@ where one can also log issues in case there are any.
\generate{\file{toc-tagging-latex-lab-testphase.ltx}{%
\from{latex-lab-toc-kernel-changes.dtx}{latex-lab}}}
+\generate{\file{latex-lab-kernel-changes.sty}
+ {\from{latex-lab-toc-kernel-changes.dtx}{kernelchange}
+ \from{latex-lab-sec-tagging.dtx}{kernelchange}
+ }}
+
\endbatchfile
More information about the latex3-commits
mailing list.