diff options
author | Karl Berry <karl@freefriends.org> | 2010-09-28 16:03:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-09-28 16:03:57 +0000 |
commit | c298d4d9179fd47c8a610670a8d8a9b4a2dc3c83 (patch) | |
tree | 0b4919e1bb934c20e0371720d535db7de681fd42 /Master/texmf-dist/tex/latex/everyhook | |
parent | da57eb4aaebcac1afd9b194915a995517b9972ef (diff) |
new latex package everyhook (27sep10)
git-svn-id: svn://tug.org/texlive/trunk@19935 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/everyhook')
-rw-r--r-- | Master/texmf-dist/tex/latex/everyhook/everyhook.sty | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/everyhook/everyhook.sty b/Master/texmf-dist/tex/latex/everyhook/everyhook.sty new file mode 100644 index 00000000000..6f546801a64 --- /dev/null +++ b/Master/texmf-dist/tex/latex/everyhook/everyhook.sty @@ -0,0 +1,128 @@ +%% +%% This is file `everyhook.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% everyhook.dtx (with options: `package') +%% Copyright (C) 2010 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 9 2010-09-27 07:39:15Z steve $} +[v1.0 \revinfo\ Hooks for low level TeX everyX primitives.] +\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} +\newrobustcmd\ClearPreHook[1]{% +\eh@checkhook{#1}\ClearPreHook +\global\csdef{eh@pre#1}{}% +} +\newrobustcmd\ClearPostHook[1]{% +\eh@checkhook{#1}\ClearPostHook +\global\csdef{eh@post#1}{}% +} +\newrobustcmd\SavePreHook[2]{% +\eh@checkhook{#1}\SavePreHook +\letcs#2{eh@pre#1}% +} +\newrobustcmd\SavePostHook[2]{% +\eh@checkhook{#1}\SavePostHook +\letcs#2{eh@post#1}% +} +\newrobustcmd\RestorePreHook[2]{% +\eh@checkhook{#1}\RestorePreHook +\global\cslet{eh@pre#1}#2% +} +\newrobustcmd\RestorePostHook[2]{% +\eh@checkhook{#1}\RestorePostHook +\global\cslet{eh@post#1}#2% +} +\endinput +%% +%% End of file `everyhook.sty'. |