summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hyperref/nameref.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-05-27 03:00:50 +0000
committerNorbert Preining <norbert@preining.info>2023-05-27 03:00:50 +0000
commitae89135e23ed84909287c5d84a2c38c044789b51 (patch)
tree95b05bd94ed8d8406242a7018fe1fd237dd518ce /macros/latex/contrib/hyperref/nameref.dtx
parent8057c647880f05a2624b3d04ab0eb38d5cbf8c18 (diff)
CTAN sync 202305270300
Diffstat (limited to 'macros/latex/contrib/hyperref/nameref.dtx')
-rw-r--r--macros/latex/contrib/hyperref/nameref.dtx94
1 files changed, 55 insertions, 39 deletions
diff --git a/macros/latex/contrib/hyperref/nameref.dtx b/macros/latex/contrib/hyperref/nameref.dtx
index 2baa4bb114..e370a40fe1 100644
--- a/macros/latex/contrib/hyperref/nameref.dtx
+++ b/macros/latex/contrib/hyperref/nameref.dtx
@@ -33,7 +33,7 @@
%<driver>\ProvidesFile{nameref.drv}
% \fi
% \ProvidesFile{nameref.dtx}
- [2022-05-17 v2.50 Cross-referencing by name of section]%
+ [2023-05-16 v2.51 Cross-referencing by name of section]%
%
%
% \iffalse
@@ -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;
@@ -269,57 +270,72 @@
\endgroup
}{}
% \end{macrocode}
-% \end{macro}
+% \end{macro}
% \begin{macro}{\label@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@hook} for now as it is used below in \cs{slabel}
+% and also in hyperref.
% \begin{macrocode}
\providecommand*{\label@hook}{}
\ltx@GlobalAppendToMacro{\label@hook}{%
- \NR@sanitize@labelname
-}
+ \NR@sanitize@labelname
+ }
+\@ifl@t@r\fmtversion{2023-06-01}
+ {
+ \AddToHookWithArguments{label}{\def\label@name{#1}\label@hook}
+ }
+ {
+
% \end{macrocode}
% \end{macro}
% \begin{macro}{\label}
% \begin{macrocode}
-\def\label#1{%
- \@bsphack
- \begingroup
- \def\label@name{#1}%
- \label@hook
- \protected@write\@auxout{}{%
- \string\newlabel{#1}{%
- {\@currentlabel}%
- {\thepage}%
- {\@currentlabelname}%
- {\@currentHref}{}%
- }%
- }%
- \endgroup
- \@esphack
-}%
-\ifNR@showkeys
- \def\label#1{%
- \@bsphack
- \SK@\SK@@label{#1}%
- \begingroup
- \def\label@name{#1}%
- \label@hook
- \protected@write\@auxout{}{%
- \string\newlabel{#1}{%
- {\@currentlabel}%
- {\thepage}%
- {\@currentlabelname}%
- {\@currentHref}{}%
+ \def\label#1{%
+ \@bsphack
+ \begingroup
+ \def\label@name{#1}%
+ \label@hook
+ \protected@write\@auxout{}{%
+ \string\newlabel{#1}{%
+ {\@currentlabel}%
+ {\thepage}%
+ {\@currentlabelname}%
+ {\@currentHref}{}%
+ }%
}%
+ \endgroup
+ \@esphack
+ }%
+ \ifNR@showkeys
+ \def\label#1{%
+ \@bsphack
+ \SK@\SK@@label{#1}%
+ \begingroup
+ \def\label@name{#1}%
+ \label@hook
+ \protected@write\@auxout{}{%
+ \string\newlabel{#1}{%
+ {\@currentlabel}%
+ {\thepage}%
+ {\@currentlabelname}%
+ {\@currentHref}{}%
+ }%
+ }%
+ \endgroup
+ \@esphack
}%
- \endgroup
- \@esphack
- }%
-\fi
+ \fi
+ }
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ltx@label}
+% Starting with LaTeX 2023-06-01 it is not longer needed to update the
+% amsmath command \cs{ltx@label} as nameref no longer changes \cs{label}
% \begin{macrocode}
-\let\ltx@label\label
+\@ifl@t@r\fmtversion{2023-06-01}
+ {}{\let\ltx@label\label}
% \end{macrocode}
% \end{macro}
% Needed for the \emph{subeqnarray} package.