summaryrefslogtreecommitdiff
path: root/macros/latex-dev/base/doc.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex-dev/base/doc.dtx')
-rw-r--r--macros/latex-dev/base/doc.dtx55
1 files changed, 33 insertions, 22 deletions
diff --git a/macros/latex-dev/base/doc.dtx b/macros/latex-dev/base/doc.dtx
index 82eb8dc5b8..af4d9508e9 100644
--- a/macros/latex-dev/base/doc.dtx
+++ b/macros/latex-dev/base/doc.dtx
@@ -34,9 +34,9 @@
%\catcode`\<=14
%<+package|shortvrb>\NeedsTeXFormat{LaTeX2e}[1994/12/01]
%<+package>
-%<+package>\providecommand\DeclareRelease[3]{}
-%<+package>\providecommand\DeclareCurrentRelease[2]{}
-%<+package>
+% Any rollback request before 2016-02-15 we try to fullfil with the 2016 version:
+%<+package>\DeclareRelease{}{1994-06-01}
+%<+package> {doc-2016-02-15.sty}
%<+package>\DeclareRelease{v2.1g}{2016-02-15}
%<+package> {doc-2016-02-15.sty}
%<+package>\DeclareRelease{v2}{2021-06-01}
@@ -45,7 +45,7 @@
%<+package>
%<+package>\ProvidesPackage{doc}
%<+shortvrb>\ProvidesPackage{shortvrb}
-%<+package|shortvrb> [2024/02/08 v3.0o
+%<+package|shortvrb> [2024/06/04 v3.0q
%<+package|shortvrb> Standard LaTeX documentation package V3 (FMi)]
%\catcode`\<=12
%
@@ -5463,26 +5463,14 @@
% \end{macrocode}
% We require the package without any option so if it was already
% loaded there is no option clash.
+% \changes{v3.0q}{2024/06/04}{Use hooks to save and restore
+% definitions when hypdoc gets loaded (gh/1000)}
% \begin{macrocode}
\RequirePackage{hypdoc}
\expandafter\let\csname doc.sty-h@@k\endcsname\doc@eoph@@k
% \end{macrocode}
-% After \pkg{hypdoc} got loaded we need to undefine those macros
-% again so that later on \texttt{Macro} and \texttt{Env} \DOC items
-% appear to be undefined.
-% \begin{macrocode}
- \let\PrintDescribeMacro \@@PrintDescribeMacro
- \let\PrintDescribeEnv \@@PrintDescribeEnv
- \let\PrintMacroName \@@PrintMacroName
- \let\PrintEnvName \@@PrintEnvName
- \let\SpecialUsageIndex \@@SpecialUsageIndex
- \let\SpecialEnvIndex \@@SpecialEnvIndex
- \let\SortIndex \@@SortIndex
- \let\DescribeMacro \@@DescribeMacro
- \let\DescribeEnv \@@DescribeEnv
-% \end{macrocode}
% The package adds new definitions for \cs{special@index} into
-% \cs{CodelineIndex} and \cs{PageIndex} but since we are loading it
+% \cs{CodelineIndex} and \cs{PageIndex} but since we might be loading it
% very late we are already past them (in the preamble). So we test
% the final state and do it here, if necessary.
% \begin{macrocode}
@@ -6203,10 +6191,16 @@
%
%
% To be able to restore the definition after \pkg{hypdoc} is loaded
-% we better save them here. We only load the package at the end of
+% we better save them beforehand. We only load the package at the end of
% the preamble, but the user might do this earlier and then chaos
-% is ensured.
-% \begin{macrocode}
+% is ensured. Thus, to support this generally we save them directly
+% before the package is loaded.
+% In this way the user can still alter the definition for
+% \cs{PrintDescribeMacro} and friends in the preamble.
+% \changes{v3.0q}{2024/06/04}{Use hooks to save and restore
+% definitions when hypdoc gets loaded (gh/1000)}
+% \begin{macrocode}
+\AddToHook{package/hypdoc/before}{%
\let\@@PrintDescribeMacro \PrintDescribeMacro
\let\@@PrintDescribeEnv \PrintDescribeEnv
\let\@@PrintMacroName \PrintMacroName
@@ -6216,6 +6210,23 @@
\let\@@SortIndex \SortIndex
\let\@@DescribeMacro \DescribeMacro
\let\@@DescribeEnv \DescribeEnv
+}
+% \end{macrocode}
+% After \pkg{hypdoc} got loaded we need to reset those macros
+% again. This is done in the generic hook
+% \texttt{package/hypdoc/after}.
+% \begin{macrocode}
+\AddToHook{package/hypdoc/after}{%
+ \let\PrintDescribeMacro \@@PrintDescribeMacro
+ \let\PrintDescribeEnv \@@PrintDescribeEnv
+ \let\PrintMacroName \@@PrintMacroName
+ \let\PrintEnvName \@@PrintEnvName
+ \let\SpecialUsageIndex \@@SpecialUsageIndex
+ \let\SpecialEnvIndex \@@SpecialEnvIndex
+ \let\SortIndex \@@SortIndex
+ \let\DescribeMacro \@@DescribeMacro
+ \let\DescribeEnv \@@DescribeEnv
+}
% \end{macrocode}
%
%