summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-10-07 23:16:56 +0000
committerKarl Berry <karl@freefriends.org>2011-10-07 23:16:56 +0000
commit9693c8c2b4815a4b5206a0ad001c44eb36f1fd13 (patch)
tree96dc0967b06772d2b2bec8fbc05476b3827f2bef /Master
parenta04931aaec1f922807f83ac7a7e3498ad54c0cb7 (diff)
filehook (7oct11)
git-svn-id: svn://tug.org/texlive/trunk@24236 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/filehook/filehook.pdfbin416996 -> 261968 bytes
-rw-r--r--Master/texmf-dist/source/latex/filehook/filehook.dtx247
-rw-r--r--Master/texmf-dist/source/latex/filehook/filehook.ins14
-rw-r--r--Master/texmf-dist/tex/latex/filehook/filehook.sty18
4 files changed, 156 insertions, 123 deletions
diff --git a/Master/texmf-dist/doc/latex/filehook/filehook.pdf b/Master/texmf-dist/doc/latex/filehook/filehook.pdf
index c12f85b9032..347ea5e0ae9 100644
--- a/Master/texmf-dist/doc/latex/filehook/filehook.pdf
+++ b/Master/texmf-dist/doc/latex/filehook/filehook.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/filehook/filehook.dtx b/Master/texmf-dist/source/latex/filehook/filehook.dtx
index 2feb5425f91..ce45eaef8b3 100644
--- a/Master/texmf-dist/source/latex/filehook/filehook.dtx
+++ b/Master/texmf-dist/source/latex/filehook/filehook.dtx
@@ -29,7 +29,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{filehook}
%<*package>
- [2011/07/18 v0.5b Hooks for input files]
+ [2011/10/07 v0.5c Hooks for input files]
%</package>
%
%<*driver>
@@ -55,7 +55,7 @@
%</driver>
% \fi
%
-% \CheckSum{989}
+% \CheckSum{1019}
%
% \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
@@ -93,6 +93,7 @@
% \changes{v0.5}{2011/01/09}{Added PGF key interface for hooks. Added macro to clear hooks.}
% \changes{v0.5a}{2011/03/09}{Added required \string\long\space to an internal macro.}
% \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.}
%
% \GetFileInfo{filehook.dtx}
%
@@ -115,8 +116,8 @@
% using \Macro\AtBeginDocument{<\TeX\ code>}.
%
%
-% This package provides hooks for files read by the \LaTeX{} macros \Macro\input, \Macro\include and
-% \Macro\InputIfFileExists as well as (since v0.3 from 2010/12/20) for class and package files,
+% This package provides hooks for files read by the \LaTeX{} macros \Macro\input, \Macro\include and
+% \Macro\InputIfFileExists as well as (since v0.3 from 2010/12/20) for class and package files,
% i.e. macros \Macro\documentclass, \Macro\LoadClassWithOptions and \Macro\LoadClass
% as well as \Macro\usepackage, \Macro\RequirePackageWithOptions and \Macro\RequirePackage.
% Note that \Macro\InputIfFileExists, and therefore its hooks, is used by the aforementioned macros.
@@ -125,7 +126,7 @@
%
% For all files a `AtBegin' and a `AtEnd' hook is installed. For \Macro\include files there is also a `After' hook which
% it is executed \emph{after} the page break (\Macro\clearpage) is inserted by the \Macro\include code.
-% In contrast, the `AtEnd' hook is executed before the trailing page break
+% In contrast, the `AtEnd' hook is executed before the trailing page break
% and the `AtBegin' hook is executed after the \emph{leading} page break.
% The `AtBegin' hook can be used to set macros to file specific values.
% These macros can be reset in the `AtEnd' hook to the parent file values.
@@ -167,7 +168,7 @@
% }}}%
% }}%
% }%
-%
+%
% \def\DrawInputIf#1{%
% \hbox{\vbox{%
% \sffamily
@@ -218,7 +219,7 @@
%
% \DescribeMacro{\AtBeginOfFiles}{<\TeX\ code>}
% \DescribeMacro{\AtEndOfFiles}{<\TeX\ code>}
-% These macros add the given \marg{code} to two hooks executed for all files read using the \Macro\InputIfFileExists macro. This macro is used internally by the
+% These macros add the given \marg{code} to two hooks executed for all files read using the \Macro\InputIfFileExists macro. This macro is used internally by the
% \Macro\input, \Macro\include and \Macro\usepackage/\Macro\RequirePackage macros. Packages and classes might use it to include additional or auxiliary files.
% Authors can exclude those files from the hooks by using the following code instead:\\\hspace*{\bigskipamount}\Macro\IfFileExists{<file name>}'{\@input\@filef@und}{}'
%
@@ -370,22 +371,22 @@
% This interface is heavily used by \pkg{pgf} (portable graphics format) and its higher level format Ti\textit{k}Z.
% It allows the definition and execution of styles and commands (macros) using a \MacroArgs<key>'='<value> format.
% Main benefits over similar formats is the support for a ``directory structure'' inside the key and the ability
-% to call functions on the value before it gets processed by the key. The main way to define and execute keys
+% to call functions on the value before it gets processed by the key. The main way to define and execute keys
% is the macro \Macro\pgfkeys{<key>'='<value>',...'}. Ti\textit{k}Z provides the similar macro \Macro\tikzstyle
% which defaults to the main path `|/tikz|'.
% More detailed information can be found in the official |pgfmanual|.
%
-% All |filehook| macros described in the previous section (\Macro{AtXXXOfYYY}) can also be accessed using the
+% All |filehook| macros described in the previous section (\Macro{AtXXXOfYYY}) can also be accessed using the
% pgf keys directory `|/filehook|', where all hook type have an own sub-directory (|/filehook/YYY|) in which
% the hooks for this type are located (|/filehook/YYY/AtXXX|).
-% For example {\Macro\AtBeginOfInputs{<code>}} can also be
+% For example {\Macro\AtBeginOfInputs{<code>}} can also be
% accessed using \\\hspace*{\parindent}\Macro\pgfkeys{'/filehook/Inputs/AtBegin='{<code>}}\\ or \Macro\AfterIncludeFile{<file name>}{<code>} as
% \\\hspace*{\parindent}{\Macro\pgfkeys{'/filehook/IncludeFile/After='{<file name>}{<code>}}}\\ as well as
-% \Macro\AtEndOfClassFile*{<file name>}{<code>} as
+% \Macro\AtEndOfClassFile*{<file name>}{<code>} as
% \\\hspace*{\parindent}{\Macro\pgfkeys{'/filehook/ClassFile/AtEnd='*{<file name>}{<code>}}.}
%
% \DescribeMacro\pgffilehook{<key>'='<value>',...'}
-% This macro is like \Macro\pgfkeys but defaults to the `|/filehook|' directory, so that it can be dropped from the
+% This macro is like \Macro\pgfkeys but defaults to the `|/filehook|' directory, so that it can be dropped from the
% \meta{key}. Note that |pgfkeys| also supports to ``change the directory'' using \MacroArgs<directory>'/.cd', so that
% it does not need to be included in further keys. All directories are defined as `\textit{is family}' so that the |/.cd| is
% assumed if the directory is used on its own.
@@ -396,7 +397,7 @@
% Some of the pgf key functions can become useful, e.g.\ if the hook code should be expanded before it is added to the hook:\\
% \hspace*{\parindent}\Macro\pgffilehook{'EveryFile/AtBegin/.expand once='{\AlsoMacro\headertext\space\AlsoMacro\currfilename}}\\
% will expand the first macro \Macro\headertext\relax (actually the first token) in the hook code once (using \Macro\expandafter), but
-% not any other tokens. In this example future changes of \Macro\headertext would not have any effect on the hook code, but
+% not any other tokens. In this example future changes of \Macro\headertext would not have any effect on the hook code, but
% \Macro\currfilename will be expanded for every file.
% Other useful functions are `|.expand twice|' (expand the first token twice) and `|.expanded|' (expand the whole hook code using \Macro\edef).
%
@@ -446,7 +447,7 @@
% The \pkg{listings} package uses \Macro\input inside \Macro\lstinputlisting. Therefore the |InputFile|(|s|) and |File|(|s|) hooks are also triggered for these files.
% Please note that this hooks are executing inside a verbatim environment. While the code in the hook is not affected (because it was added outside the verbatim
% environment), any further code read using any input macro (\Macro\input, \Macro\@input, \Macro\@@input\relax (\TeX's \Macro\input), \ldots) will be processed verbatim and typeset
-% as part of the listing.
+% as part of the listing.
% Since v0.4 this macro is automatically patched so \Macro\@input is used instead to avoid this issue.
%
%
@@ -504,8 +505,13 @@
% \section{Implementation}\label{sec:impl}
%
% \iffalse
-%<*package>
+%<*filehook.sty>
% \fi
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{filehook}
+ [2011/10/07 v0.5c Hooks for input files]
+% \end{macrocode}
%
% \subsection{Options}
% \begin{macrocode}
@@ -520,13 +526,21 @@
% The general hooks are initialised to call the file specific hooks.
%
%
+% \begin{macro}{\filehook@csuse}
% \begin{macrocode}
-\@ifpackageloaded{etoolbox}{%
- \let\filehook@csuse\csuse
-}{%
- \def\filehook@csuse#1{\ifcsname #1\endcsname\csname #1\expandafter\endcsname\fi}
-}
+\begingroup
+\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}
+ \else
+ \gdef\filehook@csuse#1{\ifcsname #1\endcsname\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}
@@ -671,7 +685,7 @@
%
% \subsubsection*{Internal Macros}
%
-% The macro prefixes for the file specific hooks are stored in macros to reduce the number of
+% 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@}
@@ -1215,9 +1229,88 @@
% \end{macrocode}
% \end{macro}
%
+%
+% \begin{macro}{\InputIfFileExists}
+% First we test for the |scrlfile| package. The test macro adds the necessary patches if so.
+% 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
+}%
+\AtEndOfPackageFile*{scrlfile}{%
+ \RequirePackage{filehook-scrlfile}%
+}%
+% \end{macrocode}
+% Fink:
+% \begin{macrocode}
+\AtBeginOfPackageFile*{fink}{%
+ \RequirePackage{kvoptions}%
+ \begingroup
+ \let\InputIfFileExists\latex@InputIfFileExists
+}%
+\AtEndOfPackageFile*{fink}{%
+ \edef\@tempa{\noexpand\PassOptionsToPackage{mainext=\fnk@mainext,maindir=\fnk@maindir}{currfile}}%
+ \expandafter\endgroup\@tempa
+ \RequirePackage{filehook-fink}%
+}%
+% \end{macrocode}
+% If |memoir| is detected its hooks
+% are added to the appropriate `At...OfFiles' hooks. This works fine because its hooks have the
+% 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
+ \let\@iinput\filehook@orig@@iinput
+}%
+\AtEndOfClassFile*{memoir}{%
+ \let\@iinput\filehook@@iinput
+ \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\latex@InputIfFileExists 1\else
+ \iffilehook@force 1\else
+ 9%
+ \fi\fi\fi
+\relax% 0
+\or% 1
+ \let\filehook@InputIfFileExists\filehook@default@InputIfFileExists
+ \let\filehook@@InputIfFileExists\filehook@@default@InputIfFileExists
+ \let\InputIfFileExists\filehook@InputIfFileExists
+ \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
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\AtBeginDocument{%
+ \ifx\InputIfFileExists\filehook@InputIfFileExists\else
+ \PackageWarning{filehook}{Macro \string\InputIfFileExists\space got redefined after 'filehook' was loaded.^^J%
+ Certain file hooks might now be dysfunctional!}
+ \fi
+}
+% \end{macrocode}
+%
% \iffalse
-%</package>
-%<*memoir>
+%</filehook.sty>
+% \fi
+%
+% \iffalse
+%<*filehook-memoir.sty>
% \fi
%
% \begin{macrocode}
@@ -1270,9 +1363,13 @@
% \end{macrocode}
%
% \iffalse
-%</memoir>
-%<*listings>
+%</filehook-memoir.sty>
+% \fi
+%
+% \iffalse
+%<*filehook-listings.sty>
% \fi
+%
% \begin{macrocode}
\ProvidesPackage{filehook-listings}[2011/01/02 v0.1 Patch for listings to avoid hooks for verbatim input files]
\begingroup
@@ -1298,8 +1395,11 @@
% \end{macrocode}
%
% \iffalse
-%</listings>
-%<*scrlfile>
+%</filehook-listings.sty>
+% \fi
+%
+% \iffalse
+%<*filehook-scrlfile.sty>
% \fi
%
% \begin{macrocode}
@@ -1426,8 +1526,11 @@
%
%
% \iffalse
-%</scrlfile>
-%<*fink>
+%</filehook-scrlfile.sty>
+% \fi
+%
+% \iffalse
+%<*filehook-fink.sty>
% \fi
%
% \begin{macrocode}
@@ -1483,89 +1586,11 @@
% \end{macrocode}
%
% \iffalse
-%</fink>
-%<*package>
+%</filehook-fink.sty>
% \fi
%
-%
-% \begin{macro}{\InputIfFileExists}
-% First we test for the |scrlfile| package. The test macro adds the necessary patches if so.
-% 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
-}%
-\AtEndOfPackageFile*{scrlfile}{%
- \RequirePackage{filehook-scrlfile}%
-}%
-% \end{macrocode}
-% Fink:
-% \begin{macrocode}
-\AtBeginOfPackageFile*{fink}{%
- \RequirePackage{kvoptions}%
- \begingroup
- \let\InputIfFileExists\latex@InputIfFileExists
-}%
-\AtEndOfPackageFile*{fink}{%
- \edef\@tempa{\noexpand\PassOptionsToPackage{mainext=\fnk@mainext,maindir=\fnk@maindir}{currfile}}%
- \expandafter\endgroup\@tempa
- \RequirePackage{filehook-fink}%
-}%
-% \end{macrocode}
-% If |memoir| is detected its hooks
-% are added to the appropriate `At...OfFiles' hooks. This works fine because its hooks have the
-% 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
- \let\@iinput\filehook@orig@@iinput
-}%
-\AtEndOfClassFile*{memoir}{%
- \let\@iinput\filehook@@iinput
- \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\latex@InputIfFileExists 1\else
- \iffilehook@force 1\else
- 9%
- \fi\fi\fi
-\relax% 0
-\or% 1
- \let\filehook@InputIfFileExists\filehook@default@InputIfFileExists
- \let\filehook@@InputIfFileExists\filehook@@default@InputIfFileExists
- \let\InputIfFileExists\filehook@InputIfFileExists
- \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
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macrocode}
-\AtBeginDocument{%
- \ifx\InputIfFileExists\filehook@InputIfFileExists\else
- \PackageWarning{filehook}{Macro \string\InputIfFileExists\space got redefined after 'filehook' was loaded.^^J%
- Certain file hooks might now be dysfunctional!}
- \fi
-}
-% \end{macrocode}
-%
% \iffalse
-%</package>
-%<*pgf>
+%<*pgf-filehook.sty>
% \fi
%
% \subsection{Support for PGF Keys}
@@ -1641,8 +1666,10 @@
\newcommand{\pgffilehook}{\pgfqkeys{/filehook}}
% \end{macrocode}
+%
% \iffalse
-%</pgf>
+%</pgf-filehook.sty>
% \fi
+%
% \Finale
\endinput
diff --git a/Master/texmf-dist/source/latex/filehook/filehook.ins b/Master/texmf-dist/source/latex/filehook/filehook.ins
index 15a92d9856f..15684aa2846 100644
--- a/Master/texmf-dist/source/latex/filehook/filehook.ins
+++ b/Master/texmf-dist/source/latex/filehook/filehook.ins
@@ -1,14 +1,14 @@
-% $Id$
% See file 'filehook.dtx' for copyright and licence.
%
\input docstrip.tex
\keepsilent
+\askforoverwritefalse
\generate{%
- \file{filehook.sty}{\nopreamble\from{filehook.dtx}{package}}%
- \file{filehook-scrlfile.sty}{\nopreamble\from{filehook.dtx}{scrlfile}}%
- \file{filehook-memoir.sty}{\nopreamble\from{filehook.dtx}{memoir}}%
- \file{filehook-listings.sty}{\nopreamble\from{filehook.dtx}{listings}}%
- \file{filehook-fink.sty}{\nopreamble\from{filehook.dtx}{fink}}%
- \file{pgf-filehook.sty}{\nopreamble\from{filehook.dtx}{pgf}}%
+ \file{filehook.sty}{\nopreamble\from{filehook.dtx}{filehook.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}}%
+ \file{filehook-fink.sty}{\nopreamble\from{filehook.dtx}{filehook-fink.sty}}%
+ \file{pgf-filehook.sty}{\nopreamble\from{filehook.dtx}{pgf-filehook.sty}}%
}
\endbatchfile
diff --git a/Master/texmf-dist/tex/latex/filehook/filehook.sty b/Master/texmf-dist/tex/latex/filehook/filehook.sty
index acdce91068a..377d7ee2171 100644
--- a/Master/texmf-dist/tex/latex/filehook/filehook.sty
+++ b/Master/texmf-dist/tex/latex/filehook/filehook.sty
@@ -21,15 +21,21 @@
%% $Id: filehook.dtx 2504 2011-07-18 17:22:50Z martin $
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{filehook}
- [2011/07/18 v0.5b Hooks for input files]
+ [2011/10/07 v0.5c Hooks for input files]
\newif\iffilehook@force
\DeclareOption{force}{\filehook@forcetrue}
\ProcessOptions\relax
-\@ifpackageloaded{etoolbox}{%
- \let\filehook@csuse\csuse
-}{%
- \def\filehook@csuse#1{\ifcsname #1\endcsname\csname #1\expandafter\endcsname\fi}
-}
+\begingroup
+\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}
+ \else
+ \gdef\filehook@csuse#1{\ifcsname #1\endcsname\csname #1\expandafter\endcsname\fi}
+ \fi
+\else
+ \global\let\filehook@csuse\csuse
+\fi
+\endgroup
\def\filehook@include@atbegin#1{%
\let\InputIfFileExists\filehook@@InputIfFileExists
\filehook@csuse{\filehook@include@atbegin@#1}%