| 1 |
%% Copyright (c) 2011-2022 by Martin Scharrer <[email protected]> |
| 2 |
%% ---------------------------------------------------------------------- |
| 3 |
%% This work may be distributed and/or modified under the |
| 4 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 5 |
%% of this license or (at your option) any later version. |
| 6 |
%% The latest version of this license is in |
| 7 |
%% http://www.latex-project.org/lppl.txt |
| 8 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 9 |
%% version 2005/12/01 or later. |
| 10 |
%% |
| 11 |
%% This work has the LPPL maintenance status `maintained'. |
| 12 |
%% |
| 13 |
%% The Current Maintainer of this work is Martin Scharrer. |
| 14 |
%% |
| 15 |
%% This work consists of the files filehook.dtx and filehook.ins |
| 16 |
%% and the derived files filehook.sty, filehook-fink.sty, |
| 17 |
%% filehook-listings.sty, filehook-memoir.sty, filehook-scrlfile.sty |
| 18 |
%% and pgf-filehook.sty |
| 19 |
%% |
| 20 |
\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
| 21 |
\ProvidesPackage{filehook-scrlfile}[2020/02/02 v0.2 filehook patch for scrlfile package] |
| 22 |
\RequirePackage{filehook} |
| 23 |
\begingroup |
| 24 |
\expandafter\def\expandafter\sclrfile@InputIfFileExists\expandafter{% |
| 25 |
\expandafter\protect\csname InputIfFileExists\space\endcsname |
| 26 |
} |
| 27 |
\expandafter\long\expandafter\def\csname scrlfile@InputIfFileExists\space\endcsname#1#2{% |
| 28 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 29 |
\expandafter\ifx\csname #1-@alias\endcsname\relax |
| 30 |
\expandafter\@secondoftwo |
| 31 |
\else |
| 32 |
\scr@replacefile@msg{\csname #1-@alias\endcsname}{#1}% |
| 33 |
\expandafter\@firstoftwo |
| 34 |
\fi |
| 35 |
{% |
| 36 |
\expandafter\InputIfFileExists\expandafter{\csname |
| 37 |
#1-@alias\endcsname}{#2}% |
| 38 |
}% |
| 39 |
{\IfFileExists{#1}{% |
| 40 |
\expandafter\scr@input@withhook\expandafter{\@filef@und}{#1}{#2}}% |
| 41 |
}% |
| 42 |
} |
| 43 |
\DeclareRobustCommand\filehook@scrlfile@InputIfFileExists[2]{% |
| 44 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 45 |
\expandafter\ifx\csname #1-@alias\endcsname\relax |
| 46 |
\expandafter\@secondoftwo |
| 47 |
\else |
| 48 |
\scr@replacefile@msg{\csname #1-@alias\endcsname}{#1}% |
| 49 |
\expandafter\@firstoftwo |
| 50 |
\fi |
| 51 |
{% |
| 52 |
\expandafter\InputIfFileExists\expandafter{\csname |
| 53 |
#1-@alias\endcsname}{#2}% |
| 54 |
}% |
| 55 |
{\IfFileExists{#1}{% |
| 56 |
\expandafter\filehook@swap |
| 57 |
\expandafter{\@filef@und}% |
| 58 |
{\scr@load@hook{before}{#1}% |
| 59 |
#2\@addtofilelist{#1}% |
| 60 |
\filehook@every@atbegin{#1}% |
| 61 |
\filehook@atbegin{#1}% |
| 62 |
\@@input}% |
| 63 |
\filehook@atend{#1}% |
| 64 |
\filehook@every@atend{#1}% |
| 65 |
\scr@load@hook{after}{#1}% |
| 66 |
}}% |
| 67 |
} |
| 68 |
\filehook@glet{filehook@scrlfile@InputIfFileExists}{filehook@scrlfile@InputIfFileExists}% |
| 69 |
\DeclareRobustCommand\filehook@@scrlfile@InputIfFileExists[2]{% |
| 70 |
\filehook@let{InputIfFileExists}{filehook@InputIfFileExists}% |
| 71 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 72 |
\expandafter\ifx\csname #1-@alias\endcsname\relax |
| 73 |
\expandafter\@secondoftwo |
| 74 |
\else |
| 75 |
\scr@replacefile@msg{\csname #1-@alias\endcsname}{#1}% |
| 76 |
\expandafter\@firstoftwo |
| 77 |
\fi |
| 78 |
{% |
| 79 |
\expandafter\InputIfFileExists\expandafter{\csname |
| 80 |
#1-@alias\endcsname}{#2}% |
| 81 |
}% |
| 82 |
{\IfFileExists{#1}{% |
| 83 |
\expandafter\filehook@swap |
| 84 |
\expandafter{\@filef@und}% |
| 85 |
{\scr@load@hook{before}{#1}% |
| 86 |
#2\@addtofilelist{#1}% |
| 87 |
\filehook@atbegin{#1}% |
| 88 |
\@@input}% |
| 89 |
\filehook@atend{#1}% |
| 90 |
\scr@load@hook{after}{#1}% |
| 91 |
}}% |
| 92 |
} |
| 93 |
\filehook@glet{filehook@@scrlfile@InputIfFileExists}{filehook@@scrlfile@InputIfFileExists}% |
| 94 |
\@tempswafalse |
| 95 |
\filehook@cmp{InputIfFileExists}{filehook@InputIfFileExists}% |
| 96 |
{\@tempswatrue}% |
| 97 |
{% |
| 98 |
\filehook@cmp{InputIfFileExists}{scrlfile@InputIfFileExists}% |
| 99 |
{\@tempswatrue}% |
| 100 |
{}% |
| 101 |
}% |
| 102 |
|
| 103 |
\if@tempswa |
| 104 |
\filehook@glet{filehook@InputIfFileExists}{filehook@scrlfile@InputIfFileExists}% |
| 105 |
\filehook@glet{filehook@@InputIfFileExists}{filehook@@scrlfile@InputIfFileExists}% |
| 106 |
\filehook@glet{InputIfFileExists}{filehook@InputIfFileExists}% |
| 107 |
\PackageInfo{filehook}{Package 'scrlfile' detected and compensated for}% |
| 108 |
\else |
| 109 |
\iffilehook@force |
| 110 |
\filehook@glet{filehook@InputIfFileExists}{filehook@scrlfile@InputIfFileExists}% |
| 111 |
\filehook@glet{filehook@@InputIfFileExists}{filehook@@scrlfile@InputIfFileExists}% |
| 112 |
\filehook@glet{InputIfFileExists}{filehook@InputIfFileExists}% |
| 113 |
\PackageWarning{filehook}{Detected 'scrlfile' package with unknown definition of \string\InputIfFileExists.^^J% |
| 114 |
The 'force' option of 'filehook' is in effect. Macro is overwritten with default!}% |
| 115 |
\else |
| 116 |
\PackageError{filehook}{Detected 'scrlfile' package with unknown definition of \string\InputIfFileExists.^^J% |
| 117 |
Use the 'force' option of 'filehook' to overwrite it.}{}% |
| 118 |
\fi |
| 119 |
\fi |
| 120 |
\endgroup |
| 121 |
\endinput |
| 122 |
%% |
| 123 |
%% End of file `filehook-scrlfile.sty'. |