[latex3-commits] [git/LaTeX3-latex3-latex2e] lthooks-doc-updates: on behavior of one-time hook (aa78ff57)

Frank Mittelbach frank.mittelbach at latex-project.org
Thu Jul 22 09:54:34 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : lthooks-doc-updates
Link       : https://github.com/latex3/latex2e/commit/aa78ff57d47811551376266ef8a7bef2882920b3

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

commit aa78ff57d47811551376266ef8a7bef2882920b3
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Thu Jul 22 09:54:34 2021 +0200

    on behavior of one-time hook


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

aa78ff57d47811551376266ef8a7bef2882920b3
 base/lthooks.dtx | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 2a6a114e..cbb0cd84 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -384,6 +384,15 @@
 %    used several times before the hook is executed then all code is
 %    executed in the order in which it was declared.\footnotemark
 %
+%    If this command is used with a one-time hook the code is only
+%    used if the call happens before the hook execution, i.e., in
+%    contrast to \cs{AddToHook} it is not executed immediately if it
+%    comes afterwards---in other words it truely executes on the next
+%    invocation only there is none in case of a one-time hook.  This
+%    gives you a choice: should my code executes always or should it
+%    only execute exactly at the point where the one-time hook is
+%    called or not at all? For both there are use cases.
+%
 %    It is possible to nest declarations using the same hook (or
 %    different hooks), e.g.,
 %   \begin{quote}
@@ -1354,8 +1363,8 @@
 %
 % \subsection{Legacy \LaTeXe{} interfaces}
 %
-% \newcommand\onetimetext{%
-%   This is a one-time hook, so after it is executed, all further
+% \newcommand\onetimetext{This is a one-time hook, so after it
+%   is executed, all further
 %   attempts to add code to it will execute such code immediately
 %   (see section~\ref{sec:onetime-hooks}).}
 %





More information about the latex3-commits mailing list.