[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh441: Provide \PushDefaultHookLabel and \PopDefaultHookLabel (2feb3ac7)

PhelypeOleinik phelype.oleinik at latex-project.org
Tue Dec 15 15:20:57 CET 2020


Repository : https://github.com/latex3/latex2e
On branch  : hotfix/gh441
Link       : https://github.com/latex3/latex2e/commit/2feb3ac793ea68da412903065b189333b1615c17

>---------------------------------------------------------------

commit 2feb3ac793ea68da412903065b189333b1615c17
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Tue Dec 15 11:20:57 2020 -0300

    Provide \PushDefaultHookLabel and \PopDefaultHookLabel
    
    Also solves #441


>---------------------------------------------------------------

2feb3ac793ea68da412903065b189333b1615c17
 base/lthooks.dtx | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 29e5a347..e4ba442c 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -4095,6 +4095,21 @@
     \SetDefaultHookLabel {#1}
   }
 %    \end{macrocode}
+%
+%   The label is only automatically updated with \cs{@onefilewithoptions}
+%   (\cs{usepackage} and \cs{documentclass}), but some packages, like
+%   Ti\emph{k}Z, define package-like interfaces, like
+%   \cs{usetikzlibrary} that are wrappers around \cs{input}, so they
+%   inherit the default label currently in force (usually |top-level|,
+%   but it may change if loaded in another package).  To provide a
+%   package-like behaviour also for hooks in these files, we provide
+%   high-level access to the default label stack.
+%    \begin{macrocode}
+\NewDocumentCommand \PushDefaultHookLabel { m }
+  { \@@_curr_name_push:n {#1} }
+\NewDocumentCommand \PopDefaultHookLabel { }
+  { \@@_curr_name_pop: }
+%    \end{macrocode}
 %   The current label stack holds the labels for all files but the
 %   current one (more or less like \cs{@currnamestack}), and the current
 %   label token list, \cs{g_@@_hook_curr_name_tl}, holds the label for





More information about the latex3-commits mailing list.