summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/filehook
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/filehook')
-rw-r--r--macros/latex/contrib/filehook/README2
-rw-r--r--macros/latex/contrib/filehook/filehook.dtx688
-rw-r--r--macros/latex/contrib/filehook/filehook.ins2
-rw-r--r--macros/latex/contrib/filehook/filehook.pdfbin266229 -> 301526 bytes
4 files changed, 687 insertions, 5 deletions
diff --git a/macros/latex/contrib/filehook/README b/macros/latex/contrib/filehook/README
index 25cc0e39b1..aeac2f848e 100644
--- a/macros/latex/contrib/filehook/README
+++ b/macros/latex/contrib/filehook/README
@@ -1,7 +1,7 @@
LaTeX package 'filehook'
~~~~~~~~~~~~~~~~~~~~~~~~
Copyright (c) 2010-2020 by Martin Scharrer <martin@scharrer-online.de>
-Code repository: https://bitbucket.org/martin_scharrer/filehook
+Code repository: ssh://hth@helixteamhub.cloud/scharrer/projects/filehook/
Provides several file hooks for files read by \input, \include and \InputIfFileExists.
diff --git a/macros/latex/contrib/filehook/filehook.dtx b/macros/latex/contrib/filehook/filehook.dtx
index 0cd0f63354..07cb49537f 100644
--- a/macros/latex/contrib/filehook/filehook.dtx
+++ b/macros/latex/contrib/filehook/filehook.dtx
@@ -26,15 +26,17 @@
%<*driver>
\ProvidesFile{filehook.dtx}[%
%<=*DATE>
- 2020/02/03
+ 2020/09/27
%<=/DATE>
%<=*VERSION>
- v0.7
+ v0.8
%<=/VERSION>
Hooks for input files]
\documentclass{ydoc}
\GetFileInfo{filehook.dtx}
\usepackage{filehook}[\filedate]
+\usepackage[utf8]{inputenc}
+\usepackage[TS1,T1]{fontenc}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@@ -55,7 +57,7 @@
%</driver>
% \fi
%
-% \CheckSum{1011}
+% \CheckSum{1478}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -526,6 +528,37 @@
%
% \subsection{Options}
% \begin{macrocode}
+\DeclareOption{force}{\PassOptionsToPackage{forse}{filehook-2019}}
+\ProcessOptions\relax
+% \end{macrocode}
+%
+% \subsection{Load actual package}
+% \begin{macrocode}
+\@ifl@t@r\fmtversion{2020/10/01}{\RequirePackage{filehook-2020}}{\RequirePackage{filehook-2019}}
+% \end{macrocode}
+%
+% \iffalse
+%</filehook.sty>
+% \fi
+%
+% \iffalse
+%<*filehook-2019.sty>
+% \fi
+% \begin{macrocode}
+%<!COPYRIGHT>
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{filehook-2019}[%
+%<!DATE>
+%<!VERSION>
+%<*DRIVER>
+ 2099/01/01 develop
+%</DRIVER>
+ Hooks for input files]
+% \end{macrocode}
+%
+%
+% \subsection{Options}
+% \begin{macrocode}
\newif\iffilehook@force
\DeclareOption{force}{\filehook@forcetrue}
\ProcessOptions\relax
@@ -1311,7 +1344,654 @@
% \end{macrocode}
%
% \iffalse
-%</filehook.sty>
+%</filehook-2019.sty>
+% \fi
+%
+% \iffalse
+%<*filehook-2020.sty>
+% \fi
+% \begin{macrocode}
+%<!COPYRIGHT>
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{filehook-2020}[%
+%<!DATE>
+%<!VERSION>
+%<*DRIVER>
+ 2099/01/01 develop
+%</DRIVER>
+ Hooks for input files]
+% \end{macrocode}
+%
+%
+% \subsection{Options}
+% \begin{macrocode}
+\DeclareOption{force}{}
+\ProcessOptions\relax
+% \end{macrocode}
+%
+% \subsection{General stuff}
+%
+% \subsection{Initialisation of Hooks}
+% The general hooks are initialised to call the file specific hooks.
+%
+% \begin{macro}{\filehook@csuse}
+% \begin{macrocode}
+\begingroup
+\gdef\filehook@csuse#1{\ifcsname #1\endcsname\csname #1\expandafter\endcsname\fi}
+\expandafter\ifx\csname csuse\endcsname\relax
+ \expandafter\ifx\csname ifcsname\endcsname\relax
+ \gdef\filehook@csuse#1{\expandafter\ifx\csname #1\endcsname\relax\else\csname #1\expandafter\endcsname\fi}
+ \fi
+\else
+ \global\let\filehook@csuse\csuse
+\fi
+\endgroup
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@include@atbegin}
+% \begin{macrocode}
+\def\filehook@include@atbegin#1{%
+ \filehook@csuse{\filehook@include@atbegin@#1}%
+ \filehook@include@@atbegin
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@include@@atbegin}
+% \begin{macrocode}
+\def\filehook@include@@atbegin{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@include@atend}
+% \begin{macrocode}
+\def\filehook@include@atend#1{%
+ \filehook@include@@atend
+ \filehook@csuse{\filehook@include@atend@#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@include@@atend}
+% \begin{macrocode}
+\def\filehook@include@@atend{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@include@after}
+% \begin{macrocode}
+\def\filehook@include@after#1{%
+ \filehook@include@@after
+ \filehook@csuse{\filehook@include@after@#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@include@@after}
+% \begin{macrocode}
+\def\filehook@include@@after{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@input@atbegin}
+% \begin{macrocode}
+\def\filehook@input@atbegin#1{%
+ \filehook@csuse{\filehook@input@atbegin@\filehook@ensureext{#1}}%
+ \filehook@input@@atbegin
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@input@@atbegin}
+% \begin{macrocode}
+\def\filehook@input@@atbegin{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@input@atend}
+% \begin{macrocode}
+\def\filehook@input@atend#1{%
+ \filehook@input@@atend
+ \filehook@csuse{\filehook@input@atend@\filehook@ensureext{#1}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@input@@atend}
+% \begin{macrocode}
+\def\filehook@input@@atend{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@atbegin}
+% \begin{macrocode}
+\def\filehook@atbegin#1{%
+ \filehook@csuse{\filehook@atbegin@\filehook@ensureext{#1}}%
+ \filehook@@atbegin
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@@atbegin}
+% \begin{macrocode}
+\def\filehook@@atbegin{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@atend}
+% \begin{macrocode}
+\def\filehook@atend#1{%
+ \filehook@@atend
+ \filehook@csuse{\filehook@atend@\filehook@ensureext{#1}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@@atend}
+% \begin{macrocode}
+\def\filehook@@atend{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@every@atbegin}
+% \begin{macrocode}
+\def\filehook@every@atbegin#1{%
+ \filehook@every@@atbegin
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@every@@atbegin}
+% \begin{macrocode}
+\def\filehook@every@@atbegin{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@every@atend}
+% \begin{macrocode}
+\def\filehook@every@atend#1{%
+ \filehook@every@@atend
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@every@@atend}
+% \begin{macrocode}
+\def\filehook@every@@atend{}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{Hook Modification Macros}
+% The following macros are used to modify the hooks, i.e.\ to prefix or append code to them.
+%
+%
+% \subsubsection*{Internal Macros}
+%
+% The macro prefixes for the file specific hooks are stored in macros to reduce the number of
+% tokens in the following macro definitions.
+% \begin{macrocode}
+\def\filehook@include@atbegin@{filehook@include@atbegin@}
+\def\filehook@include@atend@{filehook@include@atend@}
+\def\filehook@include@after@{filehook@include@after@}
+\def\filehook@input@atbegin@{filehook@input@atbegin@}
+\def\filehook@input@atend@{filehook@input@atend@}
+\def\filehook@input@after@{filehook@input@after@}
+\def\filehook@atbegin@{filehook@atbegin@}
+\def\filehook@atend@{filehook@atend@}
+\def\filehook@after@{filehook@after@}
+% \end{macrocode}
+%
+%
+% \begin{macro}{\filehook@append}
+% Uses default \LaTeX{} macro.
+% \begin{macrocode}
+\def\filehook@append{\g@addto@macro}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@appendwarg}
+% Appends code with one macro argument. The |\@tempa| intermediate step is required because of the
+% included |##1| which wouldn't correctly expand otherwise.
+% \begin{macrocode}
+\long\def\filehook@appendwarg#1#2{%
+ \begingroup
+ \toks@\expandafter{#1{##1}#2}%
+ \edef\@tempa{\the\toks@}%
+ \expandafter\gdef\expandafter#1\expandafter##\expandafter1\expandafter{\@tempa}%
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@prefix}
+% Prefixes code to a hook.
+% \begin{macrocode}
+\long\def\filehook@prefix#1#2{%
+ \begingroup
+ \@temptokena{#2}%
+ \toks@\expandafter{#1}%
+ \xdef#1{\the\@temptokena\the\toks@}%
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@prefixwarg}
+% Prefixes code with an argument to a hook.
+% \begin{macrocode}
+\long\def\filehook@prefixwarg#1#2{%
+ \begingroup
+ \@temptokena{#2}%
+ \toks@\expandafter{#1{##1}}%
+ \edef\@tempa{\the\@temptokena\the\toks@}%
+ \expandafter\gdef\expandafter#1\expandafter##\expandafter1\expandafter{\@tempa}%
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@addtohook}[3]{Macro which should be used to add the material to the hook}{Macro name prefix}{End of macro name (file name)}
+% The macro first expands the file name (|#3|) to flatten all included macros. An extension is added if missing, as well as the prefix.
+% All modifications of |\@tempa| are made inside a group to keep them local.
+% \begin{macrocode}
+\def\filehook@addtohook#1#2#3{%
+ \begingroup
+ \edef\@tempa{#3}%
+ \edef\@tempa{#2\filehook@ensureext{\@tempa}}%
+ \@ifundefined{\@tempa}{\global\@namedef{\@tempa}{}}{}%
+ \expandafter\endgroup
+ \expandafter#1\csname\@tempa\endcsname
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection*{User Level Macros}
+% The user level macros simple use the above defined macros on the appropriate hook.
+%
+% \begin{macro}{\AtBeginOfIncludes}
+% \begin{macrocode}
+\newcommand*\AtBeginOfIncludes{%
+ \filehook@append\filehook@include@@atbegin
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtEndOfIncludes}
+% \begin{macrocode}
+\newcommand*\AtEndOfIncludes{%
+ \filehook@prefix\filehook@include@@atend
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AfterIncludes}
+% \begin{macrocode}
+\newcommand*\AfterIncludes{%
+ \filehook@prefix\filehook@include@@after
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtBeginOfIncludeFile}
+% \begin{macrocode}
+\newcommand*\AtBeginOfIncludeFile[1]{%
+ \filehook@addtohook\filehook@append\filehook@include@atbegin@{\filehook@ensuretex{#1}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtEndOfIncludeFile}
+% \begin{macrocode}
+\newcommand*\AtEndOfIncludeFile[1]{%
+ \filehook@addtohook\filehook@prefix\filehook@include@atend@{\filehook@ensuretex{#1}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AfterIncludeFile}
+% \begin{macrocode}
+\newcommand*\AfterIncludeFile[1]{%
+ \filehook@addtohook\filehook@prefix\filehook@include@after@{\filehook@ensuretex{#1}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtBeginOfInputs}
+% \begin{macrocode}
+\newcommand*\AtBeginOfInputs{%
+ \filehook@append\filehook@input@@atbegin
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtEndOfInputs}
+% \begin{macrocode}
+\newcommand*\AtEndOfInputs{%
+ \filehook@prefix\filehook@input@@atend
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtBeginOfInputFile}
+% \begin{macrocode}
+\newcommand*\AtBeginOfInputFile{%
+ \filehook@addtohook\filehook@append\filehook@input@atbegin@
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtEndOfInputFile}
+% \begin{macrocode}
+\newcommand*\AtEndOfInputFile{%
+ \filehook@addtohook\filehook@prefix\filehook@input@atend@
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtBeginOfFiles}
+% \begin{macrocode}
+\newcommand*\AtBeginOfFiles{%
+ \filehook@append\filehook@@atbegin
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtEndOfFiles}
+% \begin{macrocode}
+\newcommand*\AtEndOfFiles{%
+ \filehook@prefix\filehook@@atend
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtBeginOfEveryFile}
+% \begin{macrocode}
+\newcommand*\AtBeginOfEveryFile{%
+ \filehook@append\filehook@every@@atbegin
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtEndOfEveryFile}
+% \begin{macrocode}
+\newcommand*\AtEndOfEveryFile{%
+ \filehook@prefix\filehook@every@@atend
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtBeginOfFile}
+% \begin{macrocode}
+\newcommand*\AtBeginOfFile{%
+ \filehook@addtohook\filehook@append\filehook@atbegin@
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtEndOfFile}
+% \begin{macrocode}
+\newcommand*\AtEndOfFile{%
+ \filehook@addtohook\filehook@prefix\filehook@atend@
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\AtBeginOfClassFile}
+% \begin{macrocode}
+\newcommand*\AtBeginOfClassFile{%
+ \@ifnextchar*
+ {\AtBeginOfXFile@star\@clsextension}%
+ {\AtBeginOfXFile@normal\@clsextension}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtBeginOfPackageFile}
+% \begin{macrocode}
+\newcommand*\AtBeginOfPackageFile{%
+ \@ifnextchar*
+ {\AtBeginOfXFile@star\@pkgextension}%
+ {\AtBeginOfXFile@normal\@pkgextension}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtBeginOfXFile@star}[2]{extension}{name}
+% If the class or package is already loaded the code is executed right away.
+% Otherwise it is installed normally.
+% \begin{macrocode}
+\def\AtBeginOfXFile@star#1*#2{%
+ \@ifl@aded{#1}{#2}%
+ {\@firstofone}%
+ {\AtBeginOfXFile@normal{#1}{#2}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtBeginOfXFile@normal}[2]{extension}{name}
+% \begin{macrocode}
+\def\AtBeginOfXFile@normal#1#2{%
+ \AtBeginOfFile{#2.#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\AtEndOfClassFile}
+% \begin{macrocode}
+\newcommand*\AtEndOfClassFile{%
+ \@ifnextchar*
+ {\AtEndOfXFile@star\@clsextension}%
+ {\AtEndOfXFile@normal\@clsextension}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtEndOfPackageFile}
+% \begin{macrocode}
+\newcommand*\AtEndOfPackageFile{%
+ \@ifnextchar*
+ {\AtEndOfXFile@star\@pkgextension}%
+ {\AtEndOfXFile@normal\@pkgextension}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\AtEndOfXFile@star}[2]{extension}{name}
+% If the class or package is already loaded the code is executed right away.
+% Otherwise it is installed normally.
+% \begin{macrocode}
+\def\AtEndOfXFile@star#1*#2{%
+ \@ifl@aded{#1}{#2}%
+ {\@firstofone}%
+ {\AtEndOfXFile@normal{#1}{#2}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\AtEndOfXFile@normal}[2]{extension}{name}
+% Note that \Macro\AtEndOfClass is identical to \Macro\AtEndOfPackage, so no
+% differentiation between classes and packages is needed here.
+% \begin{macrocode}
+\long\def\AtEndOfXFile@normal#1#2#3{%
+ \AtEndOfFile{#2.#1}{\AtEndOfPackage{#3}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ClearHook}
+% Clears the hook by temporary redefining the prefix and append macros
+% to do a simple definition to empty.
+% \begin{macrocode}
+\newcommand*\ClearHook{%
+ \begingroup
+ \def\filehook@prefix##1##2{%
+ \gdef##1{}%
+ \endgroup
+ }%
+ \let\filehook@append\filehook@prefix
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \subsection{Installation of Hooks}
+% The \Macro\@input@ and \Macro\@iinput macros from |latex.ltx| are redefined to install the hooks.
+%
+% \begin{macro}{\@input@}
+% This macro is redefined for the \Macro\include file hooks.
+% Checks if the next command is \Macro\clearpage which indicates that we are inside \Macro\@include.
+% If so the hooks are installed, otherwise the original macro is used unchanged.
+% For the `after' hook an own \Macro\clearpage is inserted and the original one is gobbled.
+%
+% \begin{macrocode}
+\def\DEPRECATED@input@#1{%
+ \@ifnextchar\clearpage
+ {%
+ \filehook@every@atbegin{#1}%
+ \filehook@include@atbegin{#1}%
+ \filehook@orig@@input@{#1}%
+ \filehook@include@atend{#1}%
+ \clearpage
+ \filehook@include@after{#1}%
+ \filehook@every@atend{#1}%
+ \@gobble
+ }%
+ {\filehook@orig@@input@{#1}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@iinput}
+% This macro is redefined for the \Macro\input file hooks.
+% it simply surrounds the original macro with the hooks.
+% \begin{macrocode}
+\def\filehook@@iinput#1{%
+ \filehook@every@atbegin{#1}%
+ \filehook@input@atbegin{#1}%
+ \filehook@orig@@iinput{#1}%
+ \filehook@input@atend{#1}%
+ \filehook@every@atend{#1}%
+}
+%\let\@iinput\filehook@@iinput
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@ensureext}
+% This macro ensures the existence of a file name extension. If non is given `|.tex|' is
+% added.
+% \begin{macrocode}
+\def\filehook@ensureext#1{%
+ \expandafter\filehook@@ensureext#1\empty.tex\empty\empty
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@@ensureext}
+% \begin{macrocode}
+\def\filehook@@ensureext#1.#2\empty#3\empty{#1.#2}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\filehook@ensuretex}
+% Ensures a `|.tex|' extension, i.e. adds it if missing, even if there is a different one.
+% \begin{macrocode}
+\def\filehook@ensuretex#1{%
+ \expandafter\filehook@@ensuretex#1\empty.tex\empty\empty
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@@ensuretex}
+% \begin{macrocode}
+\def\filehook@@ensuretex#1.tex\empty#2\empty{#1.tex}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Hook}
+% \begin{macrocode}
+\AddToHook{include/before}{%
+ \filehook@include@atbegin{\CurrentFile}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Hook}
+% \begin{macrocode}
+\AddToHook{include/end}{%
+ \filehook@include@atend{\CurrentFile}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Hook}
+% \begin{macrocode}
+\AddToHook{include/after}{%
+ \filehook@include@after{\CurrentFile}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@istexfile}
+% \begin{macrocode}
+\begingroup
+\edef\dottex{\expandafter\expandafter\expandafter\@gobble\expandafter\string\csname.tex\endcsname}
+\expandafter
+\gdef\expandafter\filehook@istexfile\expandafter#\expandafter1\expandafter{%
+ \expandafter\expandafter\expandafter\filehook@istexfile@\expandafter#\expandafter1\expandafter\empty\dottex\empty\empty\@nil
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@istexfile@}
+% \begin{macrocode}
+\expandafter\gdef\expandafter\filehook@istexfile@\expandafter#\expandafter1\dottex\empty#2\empty#3\@nil{%
+ \begingroup
+ \def\@tempa{#2}%
+ \ifx\@tempa\empty
+ \endgroup
+ \expandafter\@secondoftwo
+ \else
+ \endgroup
+ \expandafter\@firstoftwo
+ \fi
+}
+\endgroup
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\Hook}
+% \begin{macrocode}
+\AddToHook{file/before}{%
+ \filehook@every@atbegin{\CurrentFile}%
+ \filehook@istexfile\CurrentFile{\filehook@input@atbegin{\CurrentFile}}{}%
+ \filehook@atbegin{\CurrentFile}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Hook}
+% \begin{macrocode}
+\AddToHook{file/after}{%
+ \filehook@atend{\CurrentFile}%
+ \filehook@istexfile\CurrentFile{\filehook@input@atend{\CurrentFile}}{}%
+ \filehook@every@atend{\CurrentFile}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \iffalse
+%</filehook-2020.sty>
% \fi
%
% \iffalse
diff --git a/macros/latex/contrib/filehook/filehook.ins b/macros/latex/contrib/filehook/filehook.ins
index 0d381c3b77..baead81637 100644
--- a/macros/latex/contrib/filehook/filehook.ins
+++ b/macros/latex/contrib/filehook/filehook.ins
@@ -5,6 +5,8 @@
\askforoverwritefalse
\generate{%
\file{filehook.sty}{\nopreamble\from{filehook.dtx}{filehook.sty}}%
+ \file{filehook-2019.sty}{\nopreamble\from{filehook.dtx}{filehook-2019.sty}}%
+ \file{filehook-2020.sty}{\nopreamble\from{filehook.dtx}{filehook-2020.sty}}%
\file{filehook-scrlfile.sty}{\nopreamble\from{filehook.dtx}{filehook-scrlfile.sty}}%
\file{filehook-memoir.sty}{\nopreamble\from{filehook.dtx}{filehook-memoir.sty}}%
\file{filehook-listings.sty}{\nopreamble\from{filehook.dtx}{filehook-listings.sty}}%
diff --git a/macros/latex/contrib/filehook/filehook.pdf b/macros/latex/contrib/filehook/filehook.pdf
index 4d3462623b..dcd978b5f2 100644
--- a/macros/latex/contrib/filehook/filehook.pdf
+++ b/macros/latex/contrib/filehook/filehook.pdf
Binary files differ