summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/filehook
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-10-04 03:01:00 +0000
committerNorbert Preining <norbert@preining.info>2019-10-04 03:01:00 +0000
commit9d9c04e14d0da9dd7829d0ec896aabfd50414fd8 (patch)
treef67d308a037384664193d9a2cfca27d8b0579701 /macros/latex/contrib/filehook
parent93c3758895674cc9ea3e8aaeeb3cf5d1bdc0e3be (diff)
CTAN sync 201910040301
Diffstat (limited to 'macros/latex/contrib/filehook')
-rw-r--r--macros/latex/contrib/filehook/filehook.dtx94
-rw-r--r--macros/latex/contrib/filehook/filehook.pdfbin264783 -> 267294 bytes
2 files changed, 51 insertions, 43 deletions
diff --git a/macros/latex/contrib/filehook/filehook.dtx b/macros/latex/contrib/filehook/filehook.dtx
index 3db7301e64..efaeb3d5a8 100644
--- a/macros/latex/contrib/filehook/filehook.dtx
+++ b/macros/latex/contrib/filehook/filehook.dtx
@@ -26,10 +26,10 @@
%<*driver>
\ProvidesFile{filehook.dtx}[%
%<=*DATE>
- 2019/08/19
+ 2019/10/03
%<=/DATE>
%<=*VERSION>
- v0.5e
+ v0.6
%<=/VERSION>
Hooks for input files]
\documentclass{ydoc}
@@ -55,7 +55,7 @@
%</driver>
% \fi
%
-% \CheckSum{1051}
+% \CheckSum{1093}
%
% \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
@@ -95,6 +95,8 @@
% \changes{v0.5b}{2011/07/18}{Replaced \cs{@nameuse} for use with eTeX code to avoid the definition of non-existing hooks to \cs{relax}.}
% \changes{v0.5c}{2011/10/07}{Added fall-back code for non-eTeX compilers.}
% \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.}
%
% \GetFileInfo{filehook.dtx}
%
@@ -1106,39 +1108,28 @@
% 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{macro}{\oldlatex@InputIfFileExists}
-% Original standard \LaTeX\ definition of \Macro\InputIfFileExists.
% \begin{macrocode}
-\long\def\oldlatex@InputIfFileExists#1#2{%
- \IfFileExists{#1}%
- {#2\@addtofilelist{#1}%
- \@@input\@filef@und
- }%
-}
+\newif\iffilehook@newfmt
+\@ifl@t@r\fmtversion{2019/10/01}{\filehook@newfmttrue}{\filehook@newfmtfalse}
% \end{macrocode}
-% \end{macro}
-%
%
% \begin{macro}{\latex@InputIfFileExists}
-% Standard \`LaTeX\ definition of \Macro\InputIfFileExists starting from LaTeX Kernal 2019/02/07 v1.1n.
+% Standard \LaTeX\ definition of \Macro\InputIfFileExists.
% \begin{macrocode}
-\long\def\newlatex@InputIfFileExists#1#2{%
+\iffilehook@newfmt
+\DeclareRobustCommand \latex@InputIfFileExists[2]{%
\IfFileExists{#1}%
{%
\expandafter\@swaptwoargs\expandafter
{\@filef@und}{#2\@addtofilelist{#1}\@@input}}}
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\latex@InputIfFileExists}
-% Standard \`LaTeX\ definition of \Macro\InputIfFileExists starting from LaTeX Kernal 2019/02/07 v1.1n.
-% \begin{macrocode}
-\@ifundefined{@swaptwoargs}{%
- \let\latex@InputIfFileExists\oldlatex@InputIfFileExists
-}{%
- \let\latex@InputIfFileExists\newlatex@InputIfFileExists
-}%
+\else
+\long\def\latex@InputIfFileExists#1#2{%
+ \IfFileExists{#1}%
+ {#2\@addtofilelist{#1}%
+ \@@input\@filef@und
+ }%
+}
+\fi
% \end{macrocode}
% \end{macro}
%
@@ -1300,40 +1291,57 @@
\RequirePackage{filehook-memoir}%
}%
% \end{macrocode}
-%
% Finally, if no specific alternate definition is detected the original \LaTeX\ definition is checked for and a
% 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}
-\ifcase
- \ifx\InputIfFileExists\filehook@InputIfFileExists 0\else
- \ifx\InputIfFileExists\newlatex@InputIfFileExists 1\else
- \ifx\InputIfFileExists\oldlatex@InputIfFileExists 1\else
- 9%
- \fi\fi\fi
+\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
- \let\InputIfFileExists\filehook@InputIfFileExists
-\else
+ \iffilehook@newfmt
+ \expandafter\let\csname InputIfFileExists\space\endcsname\filehook@InputIfFileExists
+ \else
+ \let\InputIfFileExists\filehook@InputIfFileExists
+ \fi
\iffilehook@force
- \let\filehook@InputIfFileExists\filehook@default@InputIfFileExists
- \let\filehook@@InputIfFileExists\filehook@@default@InputIfFileExists
- \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
+\else
+ \PackageError{filehook}{Detected unknown definition of \string\InputIfFileExists.^^J%
+ Use the 'force' option of 'filehook' to overwrite it.}{}%
\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
\AtBeginDocument{%
- \ifx\InputIfFileExists\filehook@InputIfFileExists\else
+ % 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
\PackageWarning{filehook}{Macro \string\InputIfFileExists\space got redefined after 'filehook' was loaded.^^J%
Certain file hooks might now be dysfunctional!}
\fi
diff --git a/macros/latex/contrib/filehook/filehook.pdf b/macros/latex/contrib/filehook/filehook.pdf
index c63846379a..ce6afd430f 100644
--- a/macros/latex/contrib/filehook/filehook.pdf
+++ b/macros/latex/contrib/filehook/filehook.pdf
Binary files differ