% flipbook.sty: display a flipbook in the margins.
% $Id$
%
% It's all the fault of Craig Fields (and the English grammar)!
% Implementation by Albert Dvornik <bert@mit.edu> (1997)

% This is designed to work with dvips; other formatters will likely barf.
% It also assumes nothing else is trying extremely hard to bash in the
% brains of the output routine.  Or even slightly hard.

% Assumptions about the universe will be listed here once I'm done. =)

%%% No user-serviceable parts inside!

\newtoks\page@hook
\newdimen\flip@x    \flip@x=6.5in
\newdimen\flip@y    \flip@y=0in

\page@hook={\vbox to 0pt{\vskip\flip@y
            \hbox to 0pt{\hskip\flip@x \flip@dot \hss}\vss}}
\def\endflipbook{\page@hook={}}

\def\flip@dot{\vbox to 0pt{\vss\hbox to 0pt{\flip@body\hss}}}
%\def\flip@body{\vbox{\hbox to.8in{\flip@image\hss}\vskip0.125in}}
\def\flip@body{\vbox to .7in{\hbox to.8in{\flip@image\hss}\vss}}
\def\flip@image{\epsfxsize=.8in%
\ifcase\c@page \or\or\or\or \or\or\or\or % start on page 8
\epsfbox{plots/hack/prop_0.eps}\or
\epsfbox{plots/hack/prop_25.eps}\or
\epsfbox{plots/hack/prop_50.eps}\or
\epsfbox{plots/hack/prop_75.eps}\or
\epsfbox{plots/hack/prop_100.eps}\or
\epsfbox{plots/hack/prop_125.eps}\or
\epsfbox{plots/hack/prop_150.eps}\or
\epsfbox{plots/hack/prop_175.eps}\or
\epsfbox{plots/hack/prop_200.eps}\or
\epsfbox{plots/hack/prop_225.eps}\or
\epsfbox{plots/hack/prop_250.eps}\or
\epsfbox{plots/hack/prop_275.eps}\or
\epsfbox{plots/hack/prop_300.eps}\or
\epsfbox{plots/hack/prop_325.eps}\or
\epsfbox{plots/hack/prop_350.eps}\or
\epsfbox{plots/hack/prop_375.eps}\or
\epsfbox{plots/hack/prop_400.eps}\or
\epsfbox{plots/hack/prop_425.eps}\or
\epsfbox{plots/hack/prop_450.eps}\or
\epsfbox{plots/hack/prop_475.eps}\or
\epsfbox{plots/hack/prop_500.eps}\or
\epsfbox{plots/hack/prop_525.eps}\or
\epsfbox{plots/hack/prop_550.eps}\or
\epsfbox{plots/hack/prop_575.eps}\or
\epsfbox{plots/hack/prop_600.eps}\or
\epsfbox{plots/hack/prop_625.eps}\or
\epsfbox{plots/hack/prop_650.eps}\or
\epsfbox{plots/hack/prop_675.eps}\or
\epsfbox{plots/hack/prop_700.eps}\or
\epsfbox{plots/hack/prop_725.eps}\or
\epsfbox{plots/hack/prop_750.eps}\or
\epsfbox{plots/hack/prop_775.eps}\or
\epsfbox{plots/hack/prop_800.eps}\or
\epsfbox{plots/hack/prop_825.eps}\or
\epsfbox{plots/hack/prop_850.eps}\or
\epsfbox{plots/hack/prop_875.eps}\or
\epsfbox{plots/hack/prop_900.eps}\or
\epsfbox{plots/hack/prop_925.eps}\or
\epsfbox{plots/hack/prop_950.eps}\or
\epsfbox{plots/hack/prop_975.eps}\or
\epsfbox{plots/hack/prop_1000.eps}\or
\epsfbox{plots/hack/prop_1025.eps}\or
\epsfbox{plots/hack/prop_1050.eps}\or
\epsfbox{plots/hack/prop_1075.eps}\or
\epsfbox{plots/hack/prop_1100.eps}\or
\epsfbox{plots/hack/prop_1125.eps}\or
\epsfbox{plots/hack/prop_1150.eps}\or
\epsfbox{plots/hack/prop_1175.eps}\or
\epsfbox{plots/hack/prop_1200.eps}\or
\epsfbox{plots/hack/prop_1225.eps}\or
\epsfbox{plots/hack/prop_1250.eps}\or
\epsfbox{plots/hack/prop_1275.eps}\or
\epsfbox{plots/hack/prop_1300.eps}\or
\epsfbox{plots/hack/prop_1325.eps}\or
\epsfbox{plots/hack/prop_1350.eps}\or
\epsfbox{plots/hack/prop_1375.eps}\or
\epsfbox{plots/hack/prop_1400.eps}\or
\epsfbox{plots/hack/prop_1425.eps}\or
\epsfbox{plots/hack/prop_1450.eps}\or
\epsfbox{plots/hack/prop_1475.eps}\or
\epsfbox{plots/hack/prop_1500.eps}\fi}

%%% redefine @outputpage to reference @pagehook

\let\noflip@outputpage=\@outputpage
\def\@outputpage{\begingroup\catcode`\ =10
     \let\-\@dischyph \let\'\@acci \let\`\@accii \let\=\@acciii
    \if@specialpage
     \global\@specialpagefalse\@nameuse{ps@\@specialstyle}\fi
     \if@twoside
       \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
            \let\@themargin\oddsidemargin
          \else \let\@thehead\@evenhead
          \let\@thefoot\@evenfoot \let\@themargin\evensidemargin
     \fi\fi
     \shipout
     \vbox{\reset@font %% RmS 91/08/15
           \normalsize \baselineskip\z@ \lineskip\z@
           \let\par\@@par %% 15 Sep 87
           {\the\page@hook} %% <--- addition to the standard LaTeX version!
           \vskip \topmargin \moveright\@themargin
           \vbox{\setbox\@tempboxa
                   \vbox to\headheight{\vfil \hbox to\textwidth
                                       {\let\label\@gobble \let\index\@gobble
                                        \let\glossary\@gobble %% 21 Jun 91
                                         \@thehead}}% %% 22 Feb 87
                 \dp\@tempboxa\z@
                 \box\@tempboxa
                 \vskip \headsep
                 \box\@outputbox
                 \baselineskip\footskip
                 \hbox to\textwidth{\let\label\@gobble
                           \let\index\@gobble  %% 22 Feb 87
                           \let\glossary\@gobble %% 21 Jun 91
                           \@thefoot}}}\global\@colht\textheight
           \endgroup\stepcounter{page}\let\firstmark\botmark}
