[latex3-commits] [git/LaTeX3-latex3-latex2e] lthooks: new hook version (still has some bugs) (1c8be89a)
Frank Mittelbach
frank.mittelbach at latex-project.org
Wed Jul 15 10:44:33 CEST 2020
Repository : https://github.com/latex3/latex2e
On branch : lthooks
Link : https://github.com/latex3/latex2e/commit/1c8be89af454da8f4f676e1d1ff08d1d642e0540
>---------------------------------------------------------------
commit 1c8be89af454da8f4f676e1d1ff08d1d642e0540
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Wed Jul 15 10:44:33 2020 +0200
new hook version (still has some bugs)
>---------------------------------------------------------------
1c8be89af454da8f4f676e1d1ff08d1d642e0540
base/ltfilehook.dtx | 222 ++++++++++++++++++++++++++++++++++++++--------------
base/lthooks.dtx | 59 +++++++-------
base/ltshipout.dtx | 20 +++--
3 files changed, 204 insertions(+), 97 deletions(-)
diff --git a/base/ltfilehook.dtx b/base/ltfilehook.dtx
index 41f413e0..20261680 100644
--- a/base/ltfilehook.dtx
+++ b/base/ltfilehook.dtx
@@ -17,8 +17,8 @@
% for those people who are interested or want to report an issue.
%
% \begin{macrocode}
-\providecommand\ltfilehookversion{v0.6c}
-\providecommand\ltfilehookdate{2020/07/13}
+\providecommand\ltfilehookversion{v0.6d}
+\providecommand\ltfilehookdate{2020/07/15}
% \end{macrocode}
%
%<*driver>
@@ -88,13 +88,7 @@
% all \enquote{packages},
% and there are also hooks that are specific to a single file,
% e.g., do something after the package \texttt{foo.sty} has been
-% loaded. The latter type is only available for files that have an
-% extension but not for those that are extensionless such as
-% \texttt{Makefile} (even though they can be loaded on most \TeX{}
-% in many cases).\footnote{For a number of reasons it is best to
-% avoid extensionless files altogether, as they may or may not work
-% depending on the circumstances and we can't guarantee that
-% \LaTeX{} functions always work properly with them!}
+% loaded.
%
%
% \subsection{General hooks for file reading}
@@ -142,23 +136,54 @@
% \>\cs{UseHook}\marg{\hook{file/before/\meta{file name}}} \\
% \>\> \meta{file contents} \\
% \>\cs{UseHook}\marg{\hook{file/after/\meta{file name}}} \\
-% \cs{UseHook}\marg{\hook{file/after}}
+% \>\cs{UseHook}\marg{\hook{file/after}}
% \end{tabbing}
%
-% At the momement a \meta{file-name} with the extension
-% \texttt{.tex} must be given without extension, in all other cases
-% you have to give the extension explicitly.
-%
% \fmi{With a higher-level interface that doesn't matter, but it
% is a bit weird, if you use \cs{AddToHook} or \cs{hook_gput:nnn}
% directly, so I guess that has to be done differently!}
%
+% The file hooks only refer to the file by its name and extension,
+% so the \meta{file name} should be the file name as it is on the
+% filesystem with extension (if any) and without paths. Different
+% from \cs{input} and similar commands, for hooks the \texttt{.tex}
+% extension is not assumed, so \texttt{.tex} files must also be given
+% with their extension.
+% Files within subfolders should also be addressed by their name and
+% extension only.
+%
+% Extensionless files also work, and should then be given without
+% extension. Note however that \TeX{} prioritizes \texttt{.tex}
+% files, so if two files \texttt{foo} and \texttt{foo.tex} exist in
+% the search path, only the latter will be seen.
+%
+% When a file is input, the \meta{file name} is available in
+% \cs{CurrentFile}, which is then used when accessing the
+% \hook{file/before/\meta{file name}} and
+% \hook{file/after/\meta{file name}}.
+%
% \begin{variable}{\CurrentFile}
-% The name of the file about to be read (or just finished) is
-% available to the hook through \cs{CurrentFile} (there is no
-% \texttt{expl3} name for it.
+% The name of the file about to be read (or just finished) is
+% available to the hooks through \cs{CurrentFile} (there is no
+% \texttt{expl3} name for it for now). The file is always provided
+% with its extension, i.e., how it appears on your hard drive, but
+% without any specified path to it. For example,
+% \verb=\input{sample}= and \verb=\input{app/sample.tex}= would
+% both have \cs{CurrentFile} being \texttt{sample.tex}.
% \end{variable}
%
+% \begin{variable}{\CurrentFilePath}
+% The path to the current file (complement to \cs{CurrentFile}) is
+% available in \cs{CurrentFilePath} if needed.
+% The paths returned in \cs{CurrentFilePath} are only user paths,
+% given through \cs{input at path} (or \pkg{expl3}'s equivalent
+% \cs{l_file_search_path_seq}) or by directly typing in the path
+% in the \cs{input} command or equivalent. Files located by
+% \texttt{kpsewhich} get the path added internally by the \TeX{}
+% implementation, so at the macro level it looks as if the file were
+% in the current folder, so the path in \cs{CurrentFilePath} is empty
+% in these cases (package and class files, mostly).
+% \end{variable}
%
% \subsection{Hooks for package and class files}
%
@@ -201,7 +226,7 @@
%
% \end{description}
% \end{variable}
-% All \hook{/after} hooksare implemented as reversed hooks.
+% All \hook{/after} hooks are implemented as reversed hooks.
%
% \noindent The overall sequence of execution for \cs{usepackage}
% and friends is therefore:
@@ -214,7 +239,7 @@
% \>\>\> \meta{package contents} \\
% \>\>\cs{UseHook}\marg{\hook{file/after/\meta{package name}.sty}} \\
% \>\>\cs{UseHook}\marg{\hook{file/after}} \\[5pt]
-% \>\>\>\emph{code from \cs{AtEndOfPackage} if
+% \>\>\emph{code from \cs{AtEndOfPackage} if
% used inside the package} \\[5pt]
% \>\cs{UseHook}\marg{\hook{package/after/\meta{package name}}} \\
% \>\cs{UseHook}\marg{\hook{package/after}}
@@ -223,9 +248,8 @@
% is replaced by \texttt{class/} and \cs{AtEndOfPackage} by
% \cs{AtEndOfClass}.
%
-% If a package or class is not loaded (because it was loaded
-% earlier) none of the hooks are executed!
-%
+% If a package or class is not loaded (or it was loaded before the
+% hooks were set) none of the hooks are executed!
%
% \subsection{Hooks for \cs{include} files}
%
@@ -292,7 +316,6 @@
% normally does nothing, but starts a new page if further material
% got added this way.}
%
-
% \subsection{High-level interfaces for \LaTeX{}}
%
% We do not provide any high-level \LaTeX{} commands (like
@@ -341,13 +364,12 @@
% == (LEVEL 2 STOP) t1lmss.fd
% = (LEVEL 1 STOP) ltfilehook.dtx
%\end{verbatim}
-% Thus if you instpect an issue in the \texttt{.log} it is easy to
-% figure out in which file it occured, simply by searching back for
+% Thus if you inspect an issue in the \texttt{.log} it is easy to
+% figure out in which file it occurred, simply by searching back for
% \texttt{LEVEL} and if it is a \texttt{STOP} then remove 1 from
% the level value and search further for \texttt{LEVEL} with that value
-% whih should then be the \texttt{START} level of the file you are in.
+% which should then be the \texttt{START} level of the file you are in.
%
-
% \StopEventually{\setlength\IndexMin{200pt} \PrintIndex }
%
%
@@ -362,24 +384,33 @@
%<@@=filehook>
% \end{macrocode}
%
-% \begin{macro}{\CurrentFile}
-% User-level name for use in the file hooks.
+% \begin{macro}{\CurrentFile,\CurrentFilePath}
+% User-level macros that hold the current file name and file path.
+% These are used internally as well because the code takes care to
+% protect against a possible redefinition of these macros in the loaded
+% file (it's necessary anyway to make hooks work with nested
+% \cs{input}).
% \begin{macrocode}
\def\CurrentFile{}
+\def\CurrentFilePath{}
% \end{macrocode}
-% \end{macro}
+% \end{macro}
%
+% \begin{macro}{\l_@@_internal_tl}
% \begin{macro}{\@filehook at set@curr at file,\@@_normalise_file_name:n}
-% This macro sets \cs{CurrentFile} so that it holds the name of the
-% current input file. This macro checks that the file exists, and
-% if so sets \cs{CurrentFile} to expand to the actual file found
-% (regardless, for example, if the user input a |.tex| file without
-% typing in the extension).
+% When inputting a file, \cs{@filehook at set@curr at file} does a file
+% lookup (in \cs{input at path} and \cs{l_file_search_path_seq}) and
+% returns the actual file name (\meta{base} plus \meta{ext}) in
+% \cs{CurrentFile}. Only the base and extension are returned,
+% regardless of the input (both \texttt{path/to/file.tex} and
+% \texttt{file.tex} end up as \texttt{file.tex} in \cs{CurrentFile}).
+% The path is returned in \cs{CurrentFilePath}, in case it's needed.
+% \cs{CurrentFile} is then used to run the file hooks with
+% \texttt{file/before/\cs{CurrentFile}} and
+% \texttt{file/after/\cs{CurrentFile}}.
% \begin{macrocode}
\ExplSyntaxOn
-\tl_new:N \l_@@_internal_a_tl
-\tl_new:N \l_@@_internal_b_tl
-\tl_new:N \l_@@_internal_c_tl
+\tl_new:N \l_@@_internal_tl
\cs_new_protected:Npn \@filehook at set@curr at file #1
{ \exp_args:NV \@@_normalise_file_name:n #1 }
\cs_new_protected:Npn \@@_normalise_file_name:n #1
@@ -390,13 +421,47 @@
{ \file_full_name:n {#1} }
}
{ \file_parse_full_name:nNNN {#1} }
- \l_@@_internal_a_tl \l_@@_internal_b_tl \l_@@_internal_c_tl
- \tl_set:Nx \CurrentFile { \l_@@_internal_b_tl \l_@@_internal_c_tl }
+ \CurrentFilePath \CurrentFile \l_@@_internal_tl
+ \tl_set:Nx \CurrentFile { \CurrentFile \l_@@_internal_tl }
}
-\ExplSyntaxOff
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
+% \begin{macro}{\g_@@_input_file_seq}
+% \begin{macro}{\@filehook at file@push,\@filehook at file@pop}
+% \begin{macro}{\@@_file_pop_assign:nn}
+% Yet another stack, to keep track of \cs{CurrentFile} and
+% \cs{CurrentFilePath} with nested \cs{input}s. At the beginning of
+% \cs{InputIfFileExists}, the current value of \cs{CurrentFilePath}
+% and \cs{CurrentFile} is pushed to \cs{g_@@_input_file_seq}, and
+% at the end, it is popped and the value reassigned.
+% \cs{IfFileExists} does \cs{set at curr@file} internally, which changes
+% \cs{CurrentFile}, so \cs{@filehook at file@push} has to be executed
+% before \cs{IfFileExists}.
+% \begin{macrocode}
+\seq_new:N \g_@@_input_file_seq
+\cs_new_protected:Npn \@filehook at file@push
+ {
+ \seq_gpush:Nx \g_@@_input_file_seq
+ { { \CurrentFilePath } { \CurrentFile } }
+ }
+\cs_new_protected:Npn \@filehook at file@pop
+ {
+ \seq_gpop:NNTF \g_@@_input_file_seq \l_@@_internal_tl
+ { \exp_after:wN \@@_file_pop_assign:nn \l_@@_internal_tl }
+ { \ERROR_should_not_happen }
+ }
+\cs_new_protected:Npn \@@_file_pop_assign:nn #1 #2
+ {
+ \tl_set:Nn \CurrentFilePath {#1}
+ \tl_set:Nn \CurrentFile {#2}
+ }
+\ExplSyntaxOff
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
%
% \subsection{Declaring the file-related hooks}
@@ -426,6 +491,7 @@
% \begin{macrocode}
\let\InputIfFileExists\@undefined
\DeclareRobustCommand \InputIfFileExists[2]{%
+ \@filehook at file@push
\IfFileExists{#1}%
{%
% \end{macrocode}
@@ -437,16 +503,17 @@
%
% The hook always refers to the \emph{actual} file that will be
% operated on, regardless of how the user had it written in the
-% document. \pkg{expl3}'s \cs{file_full_name:n} normalises the file
+% document. \pkg{expl3}'s \cs{file_full_name:n} normalizes the file
% name (to factor out differences in the |.tex| extension), and
% then does a file lookup to take into account a possible path from
% \cs{l_file_search_path_seq} and \cs{input at path}. However only
-% the file name and extension are returned: the path is removed so
-% that (say) |\AddToHook{file/before/article.cls}{code}| works
-% regardless of where |article.cls| is in the system.
+% the file name and extension are returned so that file hooks can
+% refer to the file by their name only. The path to the file is
+% returned in \cs{CurrentFilePath}.
% \begin{macrocode}
\edef\reserved at a{\@filef at und
\def\noexpand\CurrentFile{\CurrentFile}%
+ \def\noexpand\CurrentFilePath{\CurrentFilePath}%
}%
\expandafter\@swaptwoargs\expandafter
{\reserved at a}%
@@ -466,7 +533,9 @@
% \begin{macrocode}
\UseHook{file/after/\CurrentFile}%
\UseHook{file/after}%
+ \@filehook at file@pop \@gobble
}%
+ {\@filehook at file@pop \@firstofone}%
}
% \end{macrocode}
% \end{macro}
@@ -524,12 +593,13 @@
\InputIfFileExists
{\@currname.\@currext}%
{%
+%-----------------------------------------
% \end{macrocode}
+% When the current extension is \cs{@pkgextension} we are loading a
% package otherwise, if it is \cs{@clsextension}, a class, so
% depending on that we execute different hooks. If the extension is
% neither, then it is another type of file without special hooks.
% \begin{macrocode}
-%-----------------------------------------
\ifx\@currext\@pkgextension
\UseHook{package/before}%
\UseHook{package/before/\@currname}%
@@ -539,6 +609,18 @@
\UseHook{class/before/\@currname}%
\fi
\fi
+% \end{macrocode}
+% The value of \cs{CurrentFile} holds during \cs{InputIfFileExists},
+% so the hooks above have that available for using. However at this
+% point \cs{CurrentFile} is reset to its previous value by
+% \cs{@filehook at file@pop} because it doesn't know that we'll have
+% more hooks ahead. So here (still in the \meta{true} branch of
+% \cs{InputIfFileExists}, right after actually reading the file in)
+% we'll cheat: use \cs{@filehook at file@push} once more, so there are
+% two entries for the current file in the name stack, so that when
+% \cs{InputIfFileExists} pops it, there's still one (identical) left.
+% \begin{macrocode}
+ \@filehook at file@push
%-----------------------------------------
}%
{\@missingfileerror\@currname\@currext}%
@@ -546,11 +628,11 @@
\csname\@currname.\@currext-h@@k\endcsname
\expandafter\let\csname\@currname.\@currext-h@@k\endcsname
\@undefined
+%-----------------------------------------
% \end{macrocode}
% And same procedure, James, when we are finished loading, except
% that the hook order is now reversed.
% \begin{macrocode}
-%-----------------------------------------
\ifx\@currext\@pkgextension
\UseHook{package/after/\@currname}%
\UseHook{package/after}%
@@ -560,6 +642,12 @@
\UseHook{class/after}%
\fi
\fi
+% \end{macrocode}
+% Now here we do \cs{@filehook at file@pop} to restore the
+% \cs{CurrentFile} before this file being loaded and fix what we've
+% done in the stack right above.
+% \begin{macrocode}
+ \@filehook at file@pop
%-----------------------------------------
\@unprocessedoptions}%
\@ifl at ter\@currext{#1}{#3}{}%
@@ -576,7 +664,7 @@
\reserved at a}
% \end{macrocode}
%
-% The code for this macro has changed between 2020/02/02 nd
+% The code for this macro has changed between 2020/02/02 and
% 2020/10/01 so the never version is this:
% \begin{macrocode}
\@ifl at t@r\fmtversion{2020/10/01}
@@ -623,6 +711,7 @@
\UseHook{class/before/\@currname}%
\fi
\fi
+ \@filehook at file@push
%-----------------------------------------
\expandafter\let\csname unprocessedoptions-\@currname.\@currext\endcsname
\@@unprocessedoptions
@@ -647,6 +736,7 @@
\UseHook{class/after}%
\fi
\fi
+ \@filehook at file@pop
%-----------------------------------------
\@ifl at ter\@currext{#1}{#3}{}%
{\@latex at warning@no at line
@@ -687,11 +777,20 @@
\immediate\openout\@partaux #1.aux
\immediate\write\@partaux{\relax}%
\fi
+%-----------------------------------------
+% \end{macrocode}
+% First we need to fix \cs{CurrentFile}, because due the pesky
+% space-delimited \cs{@include}, \cs{CurrentFile} contains the
+% \cs{include}'d file with a space. To fix that, we re-do
+% \cs{set at curr@file}. The 2020/10/01 release doesn't need this as
+% \cs{include} was changed to do \cs{set at curr@file} on the correct
+% file name, rather than one with a trailing space.
+% \begin{macrocode}
+ \set at curr@file{#1}%
% \end{macrocode}
% Execute the \texttt{before} hooks just after we switched the
% \texttt{.aux} file \ldots
% \begin{macrocode}
-%-----------------------------------------
\UseHook{include/before}%
\UseHook{include/before/#1}%
%-----------------------------------------
@@ -732,7 +831,7 @@
}
% \end{macrocode}
%
-% The code for this macro has changed between 2020/02/02 nd
+% The code for this macro has changed between 2020/02/02 and
% 2020/10/01 so the never version is this:
% \begin{macrocode}
\@ifl at t@r\fmtversion{2020/10/01}
@@ -864,28 +963,37 @@
% \begin{macrocode}
\DeclareDocumentCommand \AtBeginOfPackageFile {smm}
{\IfBooleanTF{#1}%
- {\@ifpackageloaded{#2}{#3}%
+ {\@ifpackageloaded{#2}%
+ {#3}%
{\AddToHook{package/before/#2}{#3}}}%
{\AddToHook{package/before/#2}{#3}}%
}
\DeclareDocumentCommand \AtEndOfPackageFile {smm}
{\IfBooleanTF{#1}%
- {\@ifpackageloaded{#2}{#3}%
+ {\@ifpackageloaded{#2}%
+ {#3}%
{\AddToHook{package/after/#2}{#3}}}%
{\AddToHook{package/after/#2}{#3}}%
}
% \end{macrocode}
%
-% Are the * forms here of any use?
+% Are the * forms here of any use? I know they are use 3--4 times
+% on CTAN but I wonder if those are real or mistaken usages.
% \begin{macrocode}
\DeclareDocumentCommand \AtBeginOfClassFile {smm}
{\IfBooleanTF{#1}%
- {\NOTSUPPORTED}%
- {\AddToHook{class/before/#2}{#3}}}
+ {\@ifclassloaded{#2}%
+ {#3}%
+ {\AddToHook{class/before/#2}{#3}}}%
+ {\AddToHook{class/before/#2}{#3}}%
+ }
\DeclareDocumentCommand \AtEndOfClassFile {smm}
{\IfBooleanTF{#1}%
- {\NOTSUPPORTED}%
- {\AddToHook{class/after/#2}{#3}}}
+ {\@ifclassloaded{#2}%
+ {#3}%
+ {\AddToHook{class/after/#2}{#3}}}%
+ {\AddToHook{class/after/#2}{#3}}%
+ }
% \end{macrocode}
%
% \begin{macrocode}
diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index c1df4e9b..c0e2fc69 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -17,8 +17,8 @@
% for those people who are interested or want to report an issue.
%
% \begin{macrocode}
-\providecommand\lthooksversion{v0.8v}
-\providecommand\lthooksdate{2020/07/13}
+\providecommand\lthooksversion{v0.9a}
+\providecommand\lthooksdate{2020/07/15}
% \end{macrocode}
%
%<*driver>
@@ -307,7 +307,7 @@
% \end{function}\footnotetext{There is
% no mechanism to reorder such code chunks (or delete them).}
%
-% \subsection{Hook names and default labels}
+% \subsubsection{Hook names and default labels}
% \label{sec:default-label}
%
% It is best practice to use \cs{AddToHook} in packages or classes
@@ -404,7 +404,7 @@
% \subsubsection{Defining relations between hook code}
%
% The default assumption is that code added to hooks by different
-% packages is indepedent and the order in which it is executed is
+% packages is independent and the order in which it is executed is
% irrelevant. While this is true in many case it is obviously false
% in many others.
%
@@ -413,7 +413,7 @@
% package got loaded as well (before or after) and find some ways to
% alter its behavior accordingly. In addition is was often the user's
% responsibility to load packages in the right order so that code
-% added to hooks got added in the right orde and some cases even
+% added to hooks got added in the right order and some cases even
% altering the loading order wouldn't resolve the conflicts.
%
% With the new hook management system it is now possible to define
@@ -500,14 +500,14 @@
% with \texttt{??} as the hook name.)
%
% Declaring default rules is only supported in the document
-% premable.\footnote{Trying to do so, e.g., via
-% \cs{DeclareHookRule} with \texttt{??} has bad side-effects and
-% is not supported (though not explicitly caught for performance
-% reasons.}
+% preamble.\footnotemark{}
%
% The \meta{label} can be specified using the dot-syntax to denote
% the current package name. See section~\ref{sec:default-label}.
-% \end{function}
+% \end{function}\footnotetext{Trying to do so, e.g., via
+% \cs{DeclareHookRule} with \texttt{??} has bad side-effects and
+% is not supported (though not explicitly caught for performance
+% reasons).}
%
%
%
@@ -1123,7 +1123,7 @@
%
% This hook is added to by \cs{AtBeginDocument} and is executed
% after the \texttt{.aux} file as be read in and most
-% initialization are done, so they can be altered and inspeced by
+% initialization are done, so they can be altered and inspected by
% the hook code. It is followed by a small number of further
% initializations that shouldn't be altered and are therefore
% coming later.
@@ -1728,7 +1728,7 @@
% \begin{macro}{\@@_gput_undeclared_hook:nnn}
% Often it may happen that a package $A$ defines a hook \verb=foo=,
% but package $B$, that adds code to that hook, is loaded before $A$.
-% In such case we need to add code to the hook before it's declared.
+% In such case we need to add code to the hook before its declared.
% \begin{macrocode}
\cs_new_protected:Npn \@@_gput_undeclared_hook:nnn #1 #2 #3
{
@@ -1746,7 +1746,7 @@
%
% The wrapper \cs{@@_try_declaring_generic_hook:nnn} then defers
% \cs{hook_gput_code:nnn} if the generic hook was declared, or to
-% \cs{@@_gput_undeclared_hook:nnn} otherwse (the hook was tested for
+% \cs{@@_gput_undeclared_hook:nnn} otherwise (the hook was tested for
% existence before, so at this point if it isn't generic, it doesn't
% exist).
%
@@ -1774,7 +1774,7 @@
% \begin{macro}[TF]{\@@_try_declaring_generic_hook:wn}
% \cs{@@_try_declaring_generic_hook:nNNnn} now splits the hook name
% at the first \texttt{/} (if any) and first checks if it is a
-% file-specific hook (they require some normalisation) using
+% file-specific hook (they require some normalization) using
% \cs{@@_if_file_hook:wTF}. If not then check it is one of a
% predefined set for generic names. We also split off the second
% component to see if we have to make a reversed hook. In either case
@@ -1809,7 +1809,7 @@
% After having declared the hook we check the second component (for
% file hooks) or the third component for environment hooks) and
% if it is on the list of components for which we should have declared
-% a reversed hook we alter the hook datastructure accordingly.
+% a reversed hook we alter the hook data structure accordingly.
% \begin{macrocode}
\prop_if_in:NnTF \c_@@_generics_reversed_ii_prop {#2}
{ \tl_gset:cn { g_@@_#5_reversed_tl } { - } }
@@ -1844,7 +1844,7 @@
% \meta{position} is in the \cs{c_@@_generics_file_prop}.
%
% A property list is used here to avoid having to worry with catcodes,
-% because \pkg{expl3}'s file name parsin turns all characters into
+% because \pkg{expl3}'s file name parsing turns all characters into
% catcode-12 tokens, which might differ from hand-input letters.
% \begin{macrocode}
\prg_new_conditional:Npnn \@@_if_file_hook:w
@@ -1870,7 +1870,7 @@
% \begin{macro}[EXP]{\@@_file_hook_normalise:n}
% \begin{macro}[EXP]{\@@_strip_double_slash:n,\@@_strip_double_slash:w}
% When a file-specific hook is found, before being declared it is
-% lightly normalised by \cs{@@_file_hook_normalise:n}. The current
+% lightly normalized by \cs{@@_file_hook_normalise:n}. The current
% implementation just replaces two consecutive slashes (|//|) by a
% single one, to cope with simple cases where the user did something
% like \verb|\def\input at path{{./mypath/}}|, in which case a hook would
@@ -1948,7 +1948,7 @@
% \end{macrocode}
% First check that the hook code pool exists. \cs{hook_if_exist:nTF}
% isn't used here because it should be possible to remove code from a
-% hook before it's defined (see section~\ref{sec:querying}).
+% hook before its defined (see section~\ref{sec:querying}).
% \begin{macrocode}
\@@_if_exist:nTF {#1}
% \end{macrocode}
@@ -2104,7 +2104,7 @@
% \cs{@@_debug_gset_rule:nnnn}\Arg{hook}\Arg{label1}\Arg{relation}\Arg{label2}
% a relation is defined between the two code labels for the given
% \meta{hook}. The special hook \texttt{??} stands for \emph{any}
-% hook describing an default rule.
+% hook describing a default rule.
% \begin{macrocode}
\cs_new_protected:Npn \@@_debug_gset_rule:nnnn #1#2#3#4
{
@@ -2999,21 +2999,21 @@
% \begin{macro}[EXP]{\@@_use_initialized:n}
% \begin{macro}{\@@_preamble_hook:n}
% \cs{hook_use:n} as defined here is used in the preamble, where
-% hooks aren't initialised by default. \cs{@@_use_initialized:n} is
+% hooks aren't initialized by default. \cs{@@_use_initialized:n} is
% also defined, which is the non-\tn{protected} version for use within
% the document. Their definition is identical, except for the
% \cs{@@_preamble_hook:n} (which wouldn't hurt in the expandable
% version, but it would be an unnecessary extra expansion).
%
% \cs{@@_use_initialized:n} holds the expandable definition while in
-% the preamble. \cs{@@_preamble_hook:n} initialises the hook in the
+% the preamble. \cs{@@_preamble_hook:n} initializes the hook in the
% preamble, and is redefined to \cs{use_none:n} at |\begin{document}|.
%
% Both versions do the same internally: check if the hook exist as
% given, and if so use it as quickly as possible. If it doesn't
% exist, the a call to \cs{@@_use:wn} checks for file hooks.
%
-% At |\begin{document}|, all hooks are initialised, and any change in
+% At |\begin{document}|, all hooks are initialized, and any change in
% them causes an update, so \cs{hook_use:n} can be made expandable.
% This one is better not protected so that it can expand into nothing
% if containing no code. Also important in case of generic hooks that
@@ -3044,17 +3044,17 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[EXP]{\@@_use:wn,\@@_try_file_hook:n,\@@_if_exist_use:n}
+% \begin{macro}[EXP]{\@@_use:wn}
+% \begin{macro}{\@@_try_file_hook:n,\@@_if_exist_use:n}
% \cs{@@_use:wn} does a quick check to test if the current hook is a
% file hook: those need a special treatment. If it is not, the hook
% does not exist. If it is, then \cs{@@_try_file_hook:n} is called,
-% and checks that that the current hook is a file-specific hook using
+% and checks that the current hook is a file-specific hook using
% \cs{@@_if_file_hook:wTF}. If it's not, then it's a generic |file/|
% hook and is used if it exist.
%
% If it is a file-specific hook, it passes through the same
-% normalisation as during declaration, and then it is used if defined.
-%
+% normalization as during declaration, and then it is used if defined.
% \cs{@@_if_exist_use:n} checks if the hook exist, and calls
% \cs{@@_preamble_hook:n} if so, then uses the hook.
% \begin{macrocode}
@@ -3064,7 +3064,7 @@
{ \@@_try_file_hook:n {#3} }
{ } % Hook doesn't exist
}
-\cs_new:Npn \@@_try_file_hook:n #1
+\cs_new_protected:Npn \@@_try_file_hook:n #1
{
\@@_if_file_hook:wTF #1 / / \s_@@_mark
{
@@ -3073,7 +3073,7 @@
}
{ \@@_if_exist_use:n {#1} } % file/ generic hook (e.g. file/before)
}
-\cs_new:Npn \@@_if_exist_use:n #1
+\cs_new_protected:Npn \@@_if_exist_use:n #1
{
\tl_if_exist:cT { g_@@_#1_code_tl }
{
@@ -3083,6 +3083,7 @@
}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\hook_use_once:n}
% For hooks that can and should be used only once we have a special
@@ -3461,7 +3462,7 @@
% We need to initialize the mechanism at \verb=\begin{document}=
% but obviously before everything else, so we sneak\footnote{This
% needs to move to \cs{document} directly.}
-% \cs{@@_initialize_all:} into the \LaTeXe{} name of the hook.
+% \cs{@@_initialize_all:} into the \LaTeXe{} hook name.
%
% We can't use \cs{tl_gput_left:Nn} because that complains about
% \cs{@begindocumenthook} not starting with \cs{g_} so we do this
diff --git a/base/ltshipout.dtx b/base/ltshipout.dtx
index bf783cd7..fb765ba3 100644
--- a/base/ltshipout.dtx
+++ b/base/ltshipout.dtx
@@ -17,8 +17,8 @@
% for those people who are interested or want to report an issue.
%
% \begin{macrocode}
-\providecommand\ltshipoutversion{v0.6c}
-\providecommand\ltshipoutdate{2020/07/13}
+\providecommand\ltshipoutversion{v0.9a}
+\providecommand\ltshipoutdate{2020/07/15}
% \end{macrocode}
%
%<*driver>
@@ -198,7 +198,7 @@
% \end{variable}
%
% As mentioned above the hook \hook{shipout/before} is executed
-% first and can manipulate the prepared shiout box stored in
+% first and can manipulate the prepared shipout box stored in
% \cs{ShipoutBox} or set things up for use in \cs{write} during the
% actual shipout. The other hooks are added inside hboxes to the
% box being shipped out in the following
@@ -286,7 +286,7 @@
% Just like with the \texttt{page} counter its value is
% only accurate within the output routine. In the body of the
% document it may be off by one as the output routine is called
-% asychnronously!
+% asynchronously!
%
% Also important: it \emph{must not} be set, only read. There are
% no provisions to prevent that but if you do, chaos will be the
@@ -438,15 +438,13 @@
% \subsection{Emulating \pkg{everypage}}
%
-% This page takes over the orginal \cs{@begindvi} hook and replaces
-% it. It should be all overed by the hooks offered here (details
+% This page takes over the original \cs{@begindvi} hook and replaces
+% it. It should be all covered by the hooks offered here (details
% need checking) and thus could simply use the provided hooks
% rather than defining its own.
-% \fmi{Author needs to be informed! \texttt{sergio.callegar at gmail dot com}}
-
-
-
-
+%
+%
+%
% \StopEventually{\setlength\IndexMin{200pt} \PrintIndex }
%
%
More information about the latex3-commits
mailing list.