[latex3-commits] [latex3/hyperref] newlabel: adapt nameref to new label handling (697ed67)
github at latex-project.org
github at latex-project.org
Sat May 13 17:06:26 CEST 2023
Repository : https://github.com/latex3/hyperref
On branch : newlabel
Link : https://github.com/latex3/hyperref/commit/697ed67f60dbf235d7843ec43e6f09114e707a81
>---------------------------------------------------------------
commit 697ed67f60dbf235d7843ec43e6f09114e707a81
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Sat May 13 17:06:26 2023 +0200
adapt nameref to new label handling
>---------------------------------------------------------------
697ed67f60dbf235d7843ec43e6f09114e707a81
nameref.dtx | 90 ++++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 53 insertions(+), 37 deletions(-)
diff --git a/nameref.dtx b/nameref.dtx
index 2baa4bb..4e62c08 100644
--- a/nameref.dtx
+++ b/nameref.dtx
@@ -220,7 +220,8 @@
\RequirePackage{ltxcmds}[2009/12/12]
% \end{macrocode}
%
-% We redefine |\label| so that it also writes the name of the
+% In formats older than 2023-06-01
+% we redefine |\label| so that it also writes the name of the
% current section to the .aux file; if the name ends in a dot,
% we zap it. To allow for the \xpackage{hyperref} package, also write
% fourth and fifth fields (empty by default;
@@ -271,55 +272,70 @@
% \end{macrocode}
% \end{macro}
% \begin{macro}{\label at hook}
+% Starting with LaTeX 2023-06-01 it is not longer needed to
+% redefine \cs{label} as the kernel provides a hook and
+% stores \cs{@currentlabelname}. We still support
+% \cs{label at hook} for now as it is used below in \cs{slabel}
+% and also in hyperref.
% \begin{macrocode}
\providecommand*{\label at hook}{}
\ltx at GlobalAppendToMacro{\label at hook}{%
- \NR at sanitize@labelname
-}
+ \NR at sanitize@labelname
+ }
+\@ifl at t@r\fmtversion{2023-06-01}
+ {
+ \AddToHookWithArguments{label}{\def\label at name{#1}\label at hook}
+ }
+ {
+
% \end{macrocode}
% \end{macro}
% \begin{macro}{\label}
% \begin{macrocode}
-\def\label#1{%
- \@bsphack
- \begingroup
- \def\label at name{#1}%
- \label at hook
- \protected at write\@auxout{}{%
- \string\newlabel{#1}{%
- {\@currentlabel}%
- {\thepage}%
- {\@currentlabelname}%
- {\@currentHref}{}%
- }%
- }%
- \endgroup
- \@esphack
-}%
-\ifNR at showkeys
- \def\label#1{%
- \@bsphack
- \SK@\SK@@label{#1}%
- \begingroup
- \def\label at name{#1}%
- \label at hook
- \protected at write\@auxout{}{%
- \string\newlabel{#1}{%
- {\@currentlabel}%
- {\thepage}%
- {\@currentlabelname}%
- {\@currentHref}{}%
+ \def\label#1{%
+ \@bsphack
+ \begingroup
+ \def\label at name{#1}%
+ \label at hook
+ \protected at write\@auxout{}{%
+ \string\newlabel{#1}{%
+ {\@currentlabel}%
+ {\thepage}%
+ {\@currentlabelname}%
+ {\@currentHref}{}%
+ }%
}%
+ \endgroup
+ \@esphack
+ }%
+ \ifNR at showkeys
+ \def\label#1{%
+ \@bsphack
+ \SK@\SK@@label{#1}%
+ \begingroup
+ \def\label at name{#1}%
+ \label at hook
+ \protected at write\@auxout{}{%
+ \string\newlabel{#1}{%
+ {\@currentlabel}%
+ {\thepage}%
+ {\@currentlabelname}%
+ {\@currentHref}{}%
+ }%
+ }%
+ \endgroup
+ \@esphack
}%
- \endgroup
- \@esphack
- }%
-\fi
+ \fi
+ }
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ltx at label}
+% Starting with LaTeX 2023-06-01 it is not longer needed to update the
+% amsmath command \cs{ltx at label} as nameref no longer changes \cs{label}
% \begin{macrocode}
-\let\ltx at label\label
+\@ifl at t@r\fmtversion{2023-06-01}
+ {}{\let\ltx at label\label}
% \end{macrocode}
% \end{macro}
% Needed for the \emph{subeqnarray} package.
More information about the latex3-commits
mailing list.