summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/hyperref/nameref.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-05-27 20:23:26 +0000
committerKarl Berry <karl@freefriends.org>2023-05-27 20:23:26 +0000
commit20c66c2bed5aacce90e2c856486481ffccf4df72 (patch)
tree9255edfc16d078d0202df3ab67658606f2c4f19d /Master/texmf-dist/source/latex/hyperref/nameref.dtx
parent418f9e6faf1f09fcfb5efd02b2030bcea23ddec3 (diff)
hyperref (27may23)
git-svn-id: svn://tug.org/texlive/trunk@67233 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/hyperref/nameref.dtx')
-rw-r--r--Master/texmf-dist/source/latex/hyperref/nameref.dtx94
1 files changed, 55 insertions, 39 deletions
diff --git a/Master/texmf-dist/source/latex/hyperref/nameref.dtx b/Master/texmf-dist/source/latex/hyperref/nameref.dtx
index 2baa4bb1142..e370a40fe11 100644
--- a/Master/texmf-dist/source/latex/hyperref/nameref.dtx
+++ b/Master/texmf-dist/source/latex/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.