summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/filehook
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-02-04 03:01:28 +0000
committerNorbert Preining <norbert@preining.info>2020-02-04 03:01:28 +0000
commitfc358ce7332053945afe16ced2a271556cdccfb7 (patch)
treed723e8bbffaaffd6c8c6d51d46c54db70c61f67a /macros/latex/contrib/filehook
parent34897eebd22c3de968b64f09bb4a371d96cb0b89 (diff)
CTAN sync 202002040301
Diffstat (limited to 'macros/latex/contrib/filehook')
-rw-r--r--macros/latex/contrib/filehook/README3
-rw-r--r--macros/latex/contrib/filehook/filehook.dtx352
-rw-r--r--macros/latex/contrib/filehook/filehook.pdfbin267294 -> 266229 bytes
3 files changed, 171 insertions, 184 deletions
diff --git a/macros/latex/contrib/filehook/README b/macros/latex/contrib/filehook/README
index a521e4f062..25cc0e39b1 100644
--- a/macros/latex/contrib/filehook/README
+++ b/macros/latex/contrib/filehook/README
@@ -1,7 +1,6 @@
LaTeX package 'filehook'
~~~~~~~~~~~~~~~~~~~~~~~~
-Copyright (c) 2010-2019 by Martin Scharrer <martin@scharrer-online.de>
-WWW: http://latex.scharrer-online.de/
+Copyright (c) 2010-2020 by Martin Scharrer <martin@scharrer-online.de>
Code repository: https://bitbucket.org/martin_scharrer/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 efaeb3d5a8..0cd0f63354 100644
--- a/macros/latex/contrib/filehook/filehook.dtx
+++ b/macros/latex/contrib/filehook/filehook.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%<=*COPYRIGHT>
-%% Copyright (C) 2011-2019 by Martin Scharrer <martin@scharrer-online.de>
+%% Copyright (C) 2011-2020 by Martin Scharrer <martin@scharrer-online.de>
%% ----------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -26,10 +26,10 @@
%<*driver>
\ProvidesFile{filehook.dtx}[%
%<=*DATE>
- 2019/10/03
+ 2020/02/03
%<=/DATE>
%<=*VERSION>
- v0.6
+ v0.7
%<=/VERSION>
Hooks for input files]
\documentclass{ydoc}
@@ -55,7 +55,7 @@
%</driver>
% \fi
%
-% \CheckSum{1093}
+% \CheckSum{1011}
%
% \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
@@ -97,6 +97,7 @@
% \changes{v0.5d}{2011/10/12}{Fix for fall-back code.}
% \changes{v0.5e}{2019/08/19}{Fix for new LaTeX format.}
% \changes{v0.6}{2019/10/03}{Fix for InputIfFileExists for LaTeX format 2019/10/01.}
+% \changes{v0.7}{2020/02/03}{Further fixes for InputIfFileExists for LaTeX format 2019/10/01.}
%
% \GetFileInfo{filehook.dtx}
%
@@ -530,11 +531,67 @@
\ProcessOptions\relax
% \end{macrocode}
%
+% \subsection{General stuff}
+%
+% \begin{macro}{\iffilehook@newfmt}
+% \begin{macrocode}
+\newif\iffilehook@newfmt
+\@ifl@t@r\fmtversion{2019/10/01}{\filehook@newfmttrue}{\filehook@newfmtfalse}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@let}[2]{<macro name 1>}{<macro name 2>}
+% \begin{macrocode}
+\def\filehook@let#1#2{%
+ \expandafter\ifx\csname #2\space\endcsname\relax
+ \expandafter\let\csname #1\expandafter\endcsname\csname #2\endcsname
+ \else
+ \expandafter\def\csname #1\expandafter\endcsname\expandafter{\expandafter\protect\csname #1\space\endcsname}%
+ \expandafter\let\csname #1\space\expandafter\endcsname\csname #2\space\endcsname
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\filehook@glet}[2]{<macro name 1>}{<macro name 2>}
+% \begin{macrocode}
+\def\filehook@glet#1#2{%
+ \expandafter\ifx\csname #2\space\endcsname\relax
+ \expandafter\global\expandafter\let\csname #1\expandafter\endcsname\csname #2\endcsname
+ \else
+ \expandafter\global\expandafter\def\csname #1\expandafter\endcsname\expandafter{\expandafter\protect\csname #1\space\endcsname}%
+ \expandafter\global\expandafter\let\csname #1\space\expandafter\endcsname\csname #2\space\endcsname
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\filehook@cmp}[2]{<macro name 1>}{<macro name 2>}
+% Compare two macros definition including its space form in case of robust macros.
+% \begin{macrocode}
+\def\filehook@cmp#1#2{%
+ \expandafter\ifx\csname #2\space\endcsname\relax
+ \expandafter\ifx\csname #1\expandafter\endcsname\csname #2\endcsname
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi
+ \else
+ \expandafter\ifx\csname #1\space\expandafter\endcsname\csname #2\space\endcsname
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
%
% \subsection{Initialisation of Hooks}
% The general hooks are initialised to call the file specific hooks.
%
-%
% \begin{macro}{\filehook@csuse}
% \begin{macrocode}
\begingroup
@@ -553,7 +610,7 @@
% \begin{macro}{\filehook@include@atbegin}
% \begin{macrocode}
\def\filehook@include@atbegin#1{%
- \let\InputIfFileExists\filehook@@InputIfFileExists
+ \filehook@let{InputIfFileExists}{filehook@@InputIfFileExists}%
\filehook@csuse{\filehook@include@atbegin@#1}%
\filehook@include@@atbegin
}
@@ -599,7 +656,7 @@
% \begin{macro}{\filehook@input@atbegin}
% \begin{macrocode}
\def\filehook@input@atbegin#1{%
- \let\InputIfFileExists\filehook@@InputIfFileExists
+ \filehook@let{InputIfFileExists}{filehook@@InputIfFileExists}%
\filehook@csuse{\filehook@input@atbegin@\filehook@ensureext{#1}}%
\filehook@input@@atbegin
}
@@ -1108,16 +1165,14 @@
% This is always done inside a group to keep them temporary only.
% The token register is used to avoid doubling of macro argument characters.
%
-% \begin{macrocode}
-\newif\iffilehook@newfmt
-\@ifl@t@r\fmtversion{2019/10/01}{\filehook@newfmttrue}{\filehook@newfmtfalse}
-% \end{macrocode}
-%
% \begin{macro}{\latex@InputIfFileExists}
% Standard \LaTeX\ definition of \Macro\InputIfFileExists.
% \begin{macrocode}
\iffilehook@newfmt
-\DeclareRobustCommand \latex@InputIfFileExists[2]{%
+\expandafter\def\expandafter\latex@InputIfFileExists\expandafter{%
+ \expandafter\protect\csname InputIfFileExists\space\endcsname
+}
+\expandafter\long\expandafter\def\csname latex@InputIfFileExists\space\endcsname#1#2{%
\IfFileExists{#1}%
{%
\expandafter\@swaptwoargs\expandafter
@@ -1136,7 +1191,7 @@
%
% \begin{macro}{\filehook@default@InputIfFileExists}
% \begin{macrocode}
-\long\gdef\filehook@default@InputIfFileExists#1#2{%
+\DeclareRobustCommand\filehook@default@InputIfFileExists[2]{%
\IfFileExists{#1}%
{\expandafter\filehook@swap
\expandafter{\@filef@und}%
@@ -1149,12 +1204,16 @@
}%
}
% \end{macrocode}
+% Make sure definition is global:
+% \begin{macrocode}
+\filehook@glet{filehook@default@InputIfFileExists}{filehook@default@InputIfFileExists}%
+% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\filehook@@default@InputIfFileExists}
% \begin{macrocode}
-\long\gdef\filehook@@default@InputIfFileExists#1#2{%
- \let\InputIfFileExists\filehook@InputIfFileExists
+\DeclareRobustCommand\filehook@@default@InputIfFileExists[2]{%
+ \filehook@let{InputIfFileExists}{filehook@InputIfFileExists}%
\IfFileExists{#1}%
{\expandafter\filehook@swap
\expandafter{\@filef@und}%
@@ -1165,88 +1224,9 @@
}%
}
% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\scrlfile@InputIfFileExists}
-% \begin{macrocode}
-\long\def\scrlfile@InputIfFileExists#1#2{%
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname #1-@alias\endcsname\relax
- \expandafter\@secondoftwo
- \else
- \scr@replacefile@msg{\csname #1-@alias\endcsname}{#1}%
- \expandafter\@firstoftwo
- \fi
- {%
- \expandafter\InputIfFileExists\expandafter{\csname
- #1-@alias\endcsname}{#2}%
- }%
- {\IfFileExists{#1}{%
- \scr@load@hook{before}{#1}%
- #2\@addtofilelist{#1}%
- \@@input \@filef@und
- \scr@load@hook{after}{#1}%
- }}%
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\filehook@scrlfile@InputIfFileExists}
-% \begin{macrocode}
-\long\def\filehook@scrlfile@InputIfFileExists#1#2{%
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname #1-@alias\endcsname\relax
- \expandafter\@secondoftwo
- \else
- \scr@replacefile@msg{\csname #1-@alias\endcsname}{#1}%
- \expandafter\@firstoftwo
- \fi
- {%
- \expandafter\InputIfFileExists\expandafter{\csname
- #1-@alias\endcsname}{#2}%
- }%
- {\IfFileExists{#1}{%
- \expandafter\filehook@swap
- \expandafter{\@filef@und}%
- {\scr@load@hook{before}{#1}%
- #2\@addtofilelist{#1}%
- \filehook@every@atbegin{#1}%
- \filehook@atbegin{#1}%
- \@@input}%
- \filehook@atend{#1}%
- \filehook@every@atend{#1}%
- \scr@load@hook{after}{#1}%
- }}%
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\filehook@@scrlfile@InputIfFileExists}
+% Make sure definition is global:
% \begin{macrocode}
-\long\def\filehook@@scrlfile@InputIfFileExists#1#2{%
- \let\InputIfFileExists\filehook@InputIfFileExists
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname #1-@alias\endcsname\relax
- \expandafter\@secondoftwo
- \else
- \scr@replacefile@msg{\csname #1-@alias\endcsname}{#1}%
- \expandafter\@firstoftwo
- \fi
- {%
- \expandafter\InputIfFileExists\expandafter{\csname
- #1-@alias\endcsname}{#2}%
- }%
- {\IfFileExists{#1}{%
- \expandafter\filehook@swap
- \expandafter{\@filef@und}%
- {\scr@load@hook{before}{#1}%
- #2\@addtofilelist{#1}%
- \filehook@atbegin{#1}%
- \@@input}%
- \filehook@atend{#1}%
- \scr@load@hook{after}{#1}%
- }}%
-}
+\filehook@glet{filehook@@default@InputIfFileExists}{filehook@@default@InputIfFileExists}%
% \end{macrocode}
% \end{macro}
%
@@ -1256,8 +1236,8 @@
% In order to also support it when it is loaded afterwards the two hooks below are used to revert the definition
% before the package and patch it afterwards.
% \begin{macrocode}
-\AtBeginOfPackageFile*{scrlfile}{%
- \let\InputIfFileExists\latex@InputIfFileExists
+\AtBeginOfPackageFile{scrlfile}{%
+ \filehook@glet{InputIfFileExists}{latex@InputIfFileExists}%
}%
\AtEndOfPackageFile*{scrlfile}{%
\RequirePackage{filehook-scrlfile}%
@@ -1268,7 +1248,7 @@
\AtBeginOfPackageFile*{fink}{%
\RequirePackage{kvoptions}%
\begingroup
- \let\InputIfFileExists\latex@InputIfFileExists
+ \filehook@let{InputIfFileExists}{latex@InputIfFileExists}%
}%
\AtEndOfPackageFile*{fink}{%
\edef\@tempa{\noexpand\PassOptionsToPackage{mainext=\fnk@mainext,maindir=\fnk@maindir}{currfile}}%
@@ -1281,9 +1261,8 @@
% exact same position. Please note that the case when |memoir| is used together with |scrlfile| is not explicitly covered.
% In this case the |scrlfile| package will overwrite |memoir|s definition.
% \begin{macrocode}
-\AtBeginOfClassFile*{memoir}{%
- \let\filehook@@InputIfFileExists\latex@InputIfFileExists
- \let\InputIfFileExists\latex@InputIfFileExists
+\AtBeginOfClassFile{memoir}{%
+ \filehook@let{InputIfFileExists}{latex@InputIfFileExists}%
\let\@iinput\filehook@orig@@iinput
}%
\AtEndOfClassFile*{memoir}{%
@@ -1295,45 +1274,28 @@
% error is given if any other unknown definition is detected.
% The \opt{force} option will change the error into a warning and overwrite the macro with the default.
% \begin{macrocode}
-\def\@tempa{9}%
-\ifx\InputIfFileExists\filehook@InputIfFileExists
- \def\@tempa{0}%
-\else
- \iffilehook@force
- \def\@tempa{1}%
- \else
- \iffilehook@newfmt
- % check if both the robust \InputIfFileExist and its internal macro match the default LaTeX definition
- \edef\@tempb{\noexpand\protect\expandafter\noexpand\csname InputIfFileExists\space\endcsname}%
- \ifx\InputIfFileExists\@tempb
- \expandafter\ifx\csname InputIfFileExists\space\expandafter\endcsname\csname latex@InputIfFileExists\space\endcsname
- \def\@tempa{1}%
- \fi
- \fi
- \else\ifx\InputIfFileExists\latex@InputIfFileExists
- \def\@tempa{1}%
- \fi\fi
- \fi
-\fi
-%
-\ifcase\@tempa
-\relax% 0
-\or% 1
- \let\filehook@InputIfFileExists\filehook@default@InputIfFileExists
- \let\filehook@@InputIfFileExists\filehook@@default@InputIfFileExists
- \iffilehook@newfmt
- \expandafter\let\csname InputIfFileExists\space\endcsname\filehook@InputIfFileExists
- \else
- \let\InputIfFileExists\filehook@InputIfFileExists
- \fi
- \iffilehook@force
- \PackageWarning{filehook}{Detected unknown definition of \string\InputIfFileExists.^^J%
- The 'force' option of 'filehook' is in effect. Macro is overwritten with default!}%
- \fi
-\else
- \PackageError{filehook}{Detected unknown definition of \string\InputIfFileExists.^^J%
- Use the 'force' option of 'filehook' to overwrite it.}{}%
-\fi
+\filehook@cmp{InputIfFileExists}{filehook@InputIfFileExists}%
+ {}% already set up
+ {%
+ \filehook@cmp{InputIfFileExists}{latex@InputIfFileExists}%
+ {%
+ \filehook@let{filehook@InputIfFileExists}{filehook@default@InputIfFileExists}%
+ \filehook@let{filehook@@InputIfFileExists}{filehook@@default@InputIfFileExists}%
+ \filehook@let{InputIfFileExists}{filehook@InputIfFileExists}%
+ }%
+ {%
+ \iffilehook@force
+ \filehook@let{filehook@InputIfFileExists}{filehook@default@InputIfFileExists}%
+ \filehook@let{filehook@@InputIfFileExists}{filehook@@default@InputIfFileExists}%
+ \filehook@let{InputIfFileExists}{filehook@InputIfFileExists}%
+ \PackageWarning{filehook}{Detected unknown definition of \string\InputIfFileExists.^^J%
+ The 'force' option of 'filehook' is in effect. Macro is overwritten with default!}%
+ \else
+ \PackageError{filehook}{Detected unknown definition of \string\InputIfFileExists.^^J%
+ Use the 'force' option of 'filehook' to overwrite it.}{}%
+ \fi
+ }%
+ }%
% \end{macrocode}
% \end{macro}
%
@@ -1341,10 +1303,10 @@
\AtBeginDocument{%
% Check if definition got changed again. For the new LaTeX format we check again \InputIfFileExists<space>,
% for the old format to \InputIfFileExists directly.
- \expandafter\ifx\csname InputIfFileExists\iffilehook@newfmt\space\fi\endcsname\filehook@InputIfFileExists\else
+ \filehook@cmp{InputIfFileExists}{filehook@InputIfFileExists}{}{%
\PackageWarning{filehook}{Macro \string\InputIfFileExists\space got redefined after 'filehook' was loaded.^^J%
- Certain file hooks might now be dysfunctional!}
- \fi
+ Certain file hooks might now be dysfunctional!}%
+ }%
}
% \end{macrocode}
%
@@ -1358,7 +1320,7 @@
% \begin{macrocode}
%<!COPYRIGHT>
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesPackage{filehook-memoir}[2011/01/03 v0.1 filehook patch for memoir class]
+\ProvidesPackage{filehook-memoir}[2020/02/02 v0.2 filehook patch for memoir class]
% \end{macrocode}
%
% \begin{macrocode}
@@ -1367,35 +1329,53 @@
% \end{macrocode}
%
% \begin{macro}{\memoir@InputIfFileExists}
+% The definition taken from memoir.cls. Copyright see there.
% \begin{macrocode}
-\long\def\memoir@InputIfFileExists#1#2{%
+\ifcsname InputIfFileExists\space\endcsname
+ \DeclareRobustCommand \memoir@InputIfFileExists[2]{%
+ \IfFileExists{#1}%
+ {%
+ \expandafter\@swaptwoargs\expandafter
+ {\@filef@und\m@matendf{#1}\killm@matf{#1}}{%
+ #2\@addtofilelist{#1}\m@matbeginf{#1}\@@input%
+ }%
+ }%
+ }
+\else
+ % Old definition
+\renewcommand{\memoir@InputIfFileExists}[2]{%
\IfFileExists{#1}%
{#2\@addtofilelist{#1}\m@matbeginf{#1}%
\@@input \@filef@und
\m@matendf{#1}%
\killm@matf{#1}}%
}
+\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
-\ifcase
- \ifx\InputIfFileExists\latex@InputIfFileExists 0\else
- \ifx\InputIfFileExists\memoir@InputIfFileExists 0\else
- 1%
- \fi\fi
-\relax
- \global\let\filehook@InputIfFileExists\filehook@default@InputIfFileExists
- \global\let\filehook@@InputIfFileExists\filehook@@default@InputIfFileExists
- \global\let\InputIfFileExists\filehook@InputIfFileExists
+\@tempswafalse
+\filehook@cmp{InputIfFileExists}{filehook@InputIfFileExists}%
+ {\@tempswatrue}%
+ {%
+ \filehook@cmp{InputIfFileExists}{memoir@InputIfFileExists}%
+ {\@tempswatrue}%
+ {}%
+ }%
+
+\if@tempswa
+ \filehook@glet{filehook@InputIfFileExists}{filehook@default@InputIfFileExists}%
+ \filehook@glet{filehook@@InputIfFileExists}{filehook@@default@InputIfFileExists}%
+ \filehook@glet{InputIfFileExists}{filehook@InputIfFileExists}%
\filehook@appendwarg\filehook@atbegin{\m@matbeginf{#1}}%
\filehook@prefixwarg\filehook@atend{\m@matendf{#1}\killm@matf{#1}}%
\PackageInfo{filehook}{Detected 'memoir' class: the memoir hooks will be moved to the `At...OfFiles' hooks}
\else
\iffilehook@force
- \global\let\filehook@InputIfFileExists\filehook@default@InputIfFileExists
- \global\let\filehook@@InputIfFileExists\filehook@@default@InputIfFileExists
- \global\let\InputIfFileExists\filehook@InputIfFileExists
+ \filehook@glet{filehook@InputIfFileExists}{filehook@default@InputIfFileExists}%
+ \filehook@glet{filehook@@InputIfFileExists}{filehook@@default@InputIfFileExists}%
+ \filehook@glet{InputIfFileExists}{filehook@InputIfFileExists}%
\PackageWarning{filehook}{Detected 'memoir' class with unknown definition of \string\InputIfFileExists.^^J%
The 'force' option of 'filehook' is in effect. Macro is overwritten with default!}%
\else
@@ -1455,14 +1435,17 @@
% \begin{macrocode}
%<!COPYRIGHT>
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesPackage{filehook-scrlfile}[2011/01/03 v0.1 filehook patch for scrlfile package]
+\ProvidesPackage{filehook-scrlfile}[2020/02/02 v0.2 filehook patch for scrlfile package]
\RequirePackage{filehook}
\begingroup
% \end{macrocode}
%
% \begin{macro}{\scrlfile@InputIfFileExists}
% \begin{macrocode}
-\long\def\scrlfile@InputIfFileExists#1#2{%
+\expandafter\def\expandafter\sclrfile@InputIfFileExists\expandafter{%
+ \expandafter\protect\csname InputIfFileExists\space\endcsname
+}
+\expandafter\long\expandafter\def\csname scrlfile@InputIfFileExists\space\endcsname#1#2{%
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname #1-@alias\endcsname\relax
\expandafter\@secondoftwo
@@ -1472,21 +1455,19 @@
\fi
{%
\expandafter\InputIfFileExists\expandafter{\csname
- #1-@alias\endcsname}{#2}%
+#1-@alias\endcsname}{#2}%
}%
{\IfFileExists{#1}{%
- \scr@load@hook{before}{#1}%
- #2\@addtofilelist{#1}%
- \@@input \@filef@und
- \scr@load@hook{after}{#1}%
- }}%
+ \expandafter\scr@input@withhook\expandafter{\@filef@und}{#1}{#2}}%
+ }%
}
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\filehook@scrlfile@InputIfFileExists}
% \begin{macrocode}
-\long\def\filehook@scrlfile@InputIfFileExists#1#2{%
+\DeclareRobustCommand\filehook@scrlfile@InputIfFileExists[2]{%
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname #1-@alias\endcsname\relax
\expandafter\@secondoftwo
@@ -1511,13 +1492,15 @@
\scr@load@hook{after}{#1}%
}}%
}
+\filehook@glet{filehook@scrlfile@InputIfFileExists}{filehook@scrlfile@InputIfFileExists}%
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\filehook@@scrlfile@InputIfFileExists}
% \begin{macrocode}
-\long\def\filehook@@scrlfile@InputIfFileExists#1#2{%
- \let\InputIfFileExists\filehook@InputIfFileExists
+\DeclareRobustCommand\filehook@@scrlfile@InputIfFileExists[2]{%
+ \filehook@let{InputIfFileExists}{filehook@InputIfFileExists}%
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname #1-@alias\endcsname\relax
\expandafter\@secondoftwo
@@ -1540,6 +1523,7 @@
\scr@load@hook{after}{#1}%
}}%
}
+\filehook@glet{filehook@@scrlfile@InputIfFileExists}{filehook@@scrlfile@InputIfFileExists}%
% \end{macrocode}
% \end{macro}
%
@@ -1548,21 +1532,25 @@
% not after the |#2\@addtofilelist{#1}| code. Otherwise the |filehook|s could simply be added to these hooks.
% Note that this will stop working if |scrlfile| ever changes its definition of the \Macro\InputIfFileExists macro.
% \begin{macrocode}
-\ifcase
- \ifx\InputIfFileExists\latex@InputIfFileExists 0\else
- \ifx\InputIfFileExists\scrlfile@InputIfFileExists 0\else
- 1%
- \fi\fi
-\relax
- \global\let\filehook@InputIfFileExists\filehook@scrlfile@InputIfFileExists
- \global\let\filehook@@InputIfFileExists\filehook@@scrlfile@InputIfFileExists
- \global\let\InputIfFileExists\filehook@InputIfFileExists
+\@tempswafalse
+\filehook@cmp{InputIfFileExists}{filehook@InputIfFileExists}%
+ {\@tempswatrue}%
+ {%
+ \filehook@cmp{InputIfFileExists}{scrlfile@InputIfFileExists}%
+ {\@tempswatrue}%
+ {}%
+ }%
+
+\if@tempswa
+ \filehook@glet{filehook@InputIfFileExists}{filehook@scrlfile@InputIfFileExists}%
+ \filehook@glet{filehook@@InputIfFileExists}{filehook@@scrlfile@InputIfFileExists}%
+ \filehook@glet{InputIfFileExists}{filehook@InputIfFileExists}%
\PackageInfo{filehook}{Package 'scrlfile' detected and compensated for}%
\else
\iffilehook@force
- \global\let\filehook@InputIfFileExists\filehook@default@InputIfFileExists
- \global\let\filehook@@InputIfFileExists\filehook@@default@InputIfFileExists
- \global\let\InputIfFileExists\filehook@InputIfFileExists
+ \filehook@glet{filehook@InputIfFileExists}{filehook@scrlfile@InputIfFileExists}%
+ \filehook@glet{filehook@@InputIfFileExists}{filehook@@scrlfile@InputIfFileExists}%
+ \filehook@glet{InputIfFileExists}{filehook@InputIfFileExists}%
\PackageWarning{filehook}{Detected 'scrlfile' package with unknown definition of \string\InputIfFileExists.^^J%
The 'force' option of 'filehook' is in effect. Macro is overwritten with default!}%
\else
diff --git a/macros/latex/contrib/filehook/filehook.pdf b/macros/latex/contrib/filehook/filehook.pdf
index ce6afd430f..4d3462623b 100644
--- a/macros/latex/contrib/filehook/filehook.pdf
+++ b/macros/latex/contrib/filehook/filehook.pdf
Binary files differ