%%
%% This is file `everyhook.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% everyhook.dtx 
%% Copyright (C) 2010, 2011 by Stephen Checkoway
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version.  The latest version of this license is in:
%% 
%%     http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status 'maintained'.
%% 
%% The Current Maintainer of this work is Stephen Checkoway.
%% 
%% This work consists of everyhook.dtx and the derived file
%% everyhook.sty.
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\RequirePackage{svn-prov}
\ProvidesPackageSVN
{$Id: everyhook.dtx 10 2011-02-04 06:43:36Z steve $}
[v1.1 \revinfo\ Hooks for low level TeX everyX primitives.]
\DeclareOption{excludeor}{%
\AtBeginDocument{%
\output\expandafter{%
\expandafter\eh@saveclearallhooks
\the\output
\eh@restoreallhooks
}%
}%
}
\ProcessOptions\relax
\RequirePackage{etoolbox}
\def\eh@definehook#1#2{%
\cslet{eh@every#1}#2%
\newtoks#2%
#2\csuse{eh@every#1}%
\csdef{eh@pre#1}{}%
\csdef{eh@post#1}{}%
\csuse{eh@every#1}\expandafter{\csname eh@pre#1\expandafter\endcsname
\expandafter\the\expandafter\expandafter\expandafter#2%
\csname eh@post#1\endcsname}%
}
\eh@definehook{par}\everypar
\eh@definehook{math}\frozen@everymath
\eh@definehook{display}\frozen@everydisplay
\eh@definehook{hbox}\everyhbox
\eh@definehook{vbox}\everyvbox
\eh@definehook{cr}\everycr
\undef\eh@definehook
\def\eh@hookseparator{}
\def\eh@checkhook#1#2{%
\ifcsdef{eh@every#1}{}{\PackageError{everyhook}{Argument #1 to
\protect#2\space is invalid}{There is no hook for
\protect\every#1.}}%
}
\def\eh@checkhooknotempty#1#2#3{%
\eh@checkhook{#2}#3%
\ifcsempty{eh@#1#2}{\PackageError{everyhook}{The #1 hook for
\protect\every#2\space is empty}{I have seen too many
\protect#3{#2}s.}{}}%
}
\newrobustcmd\PushPreHook[2]{%
\eh@checkhook{#1}\PushPreHook
\def\eh@tempi{#2}%
\letcs\eh@tempii{eh@pre#1}%
\expandafter\gdef\csname eh@pre#1\expandafter\expandafter
\expandafter\endcsname\expandafter\expandafter
\expandafter{\expandafter\eh@tempi\expandafter
             \eh@hookseparator\eh@tempii}%
\undef\eh@tempi
\undef\eh@tempii
}
\newrobustcmd\PopPreHook[1]{%
\eh@checkhooknotempty{pre}{#1}\PopPreHook
\expandafter\eh@popprehook\csname eh@pre#1\expandafter
\expandafter\expandafter\endcsname
\csname eh@pre#1\endcsname\eh@hookend
}
\def\eh@popprehook#1#2\eh@hookseparator#3\eh@hookend{\gdef#1{#3}}
\newrobustcmd\PushPostHook[2]{%
\eh@checkhook{#1}\PushPostHook
\letcs\eh@tempi{eh@post#1}%
\expandafter\gdef\csname eh@post#1\expandafter\endcsname
\expandafter{\eh@tempi\eh@hookseparator#2}%
\undef\eh@tempi
}
\newrobustcmd\PopPostHook[1]{%
\eh@checkhooknotempty{post}{#1}\PopPostHook
\letcs\eh@tempi{eh@post#1}%
\expandafter\eh@popposthook\csname eh@post#1\expandafter
\endcsname\expandafter{\expandafter}\eh@tempi
\eh@hookend\eh@hookseparator\eh@sentinel\eh@hookend
\undef\eh@tempi
}
\def\eh@popposthook#1#2\eh@hookseparator#3\eh@hookseparator#4\eh@hookend{%
\def\eh@tempi{#4}%
\ifdefequal\eh@sentinel\eh@tempi%
{\gdef#1{#2}\undef\eh@tempi}%
{\eh@popposthook#1{#2\eh@hookseparator#3}\eh@hookseparator#4\eh@hookend}%
}
\def\eh@sentinel{\eh@sentinel}
\def\eh@clearhook#1{%
\global\csdef{eh@#1}{}%
}
\newrobustcmd\ClearPreHook[1]{%
\eh@checkhook{#1}\ClearPreHook
\eh@clearhook{pre#1}%
}
\newrobustcmd\ClearPostHook[1]{%
\eh@checkhook{#1}\ClearPostHook
\eh@clearhook{post#1}%
}
\def\eh@savehook#1#2{%
\letcs#2{eh@#1}%
}
\def\eh@restorehook#1#2{%
\global\cslet{eh@#1}#2%
}
\newrobustcmd\SavePreHook[2]{%
\eh@checkhook{#1}\SavePreHook
\eh@savehook{pre#1}#2%
}
\newrobustcmd\SavePostHook[2]{%
\eh@checkhook{#1}\SavePostHook
\eh@savehook{post#1}#2%
}
\newrobustcmd\RestorePreHook[2]{%
\eh@checkhook{#1}\RestorePreHook
\eh@restorehook{pre#1}#2%
}
\newrobustcmd\RestorePostHook[2]{%
\eh@checkhook{#1}\RestorePostHook
\eh@restorehook{post#1}#2%
}
\def\eh@saveclearallhooks{%
\global\eh@savehook{prepar}\eh@or@prepar
\global\eh@savehook{postpar}\eh@or@postpar
\global\eh@savehook{premath}\eh@or@premath
\global\eh@savehook{postmath}\eh@or@postmath
\global\eh@savehook{predisplay}\eh@or@predisplay
\global\eh@savehook{postdisplay}\eh@or@postdisplay
\global\eh@savehook{prehbox}\eh@or@prehbox
\global\eh@savehook{posthbox}\eh@or@posthbox
\global\eh@savehook{prevbox}\eh@or@prevbox
\global\eh@savehook{postvbox}\eh@or@postvbox
\global\eh@savehook{precr}\eh@or@precr
\global\eh@savehook{postcr}\eh@or@postcr
\eh@clearhook{prepar}%
\eh@clearhook{postpar}%
\eh@clearhook{premath}%
\eh@clearhook{postmath}%
\eh@clearhook{predisplay}%
\eh@clearhook{postdisplay}%
\eh@clearhook{prehbox}%
\eh@clearhook{posthbox}%
\eh@clearhook{prevbox}%
\eh@clearhook{postvbox}%
\eh@clearhook{precr}%
\eh@clearhook{postcr}%
}
\def\eh@restoreallhooks{%
\eh@restorehook{prepar}\eh@or@prepar
\eh@restorehook{postpar}\eh@or@postpar
\eh@restorehook{premath}\eh@or@premath
\eh@restorehook{postmath}\eh@or@postmath
\eh@restorehook{predisplay}\eh@or@predisplay
\eh@restorehook{postdisplay}\eh@or@postdisplay
\eh@restorehook{prehbox}\eh@or@prehbox
\eh@restorehook{posthbox}\eh@or@posthbox
\eh@restorehook{prevbox}\eh@or@prevbox
\eh@restorehook{postvbox}\eh@or@postvbox
\eh@restorehook{precr}\eh@or@precr
\eh@restorehook{postcr}\eh@or@postcr
}
\endinput
%%
%% End of file `everyhook.sty'.
