% BOOK.ST  VERSION 2.0
% COPYRIGHT (C) 1989, 1990, 1991 BY THE TEXPLORATORS CORPORATION
% ALL RIGHTS RESERVED

% IF THIS FILE IS MODIFIED IN ANY WAY, IT SHOULD BE GIVEN A DIFFERENT NAME !

\catcode`\@=11
\ifx\bookst@\relax\catcode`\@=\active\endinput\else\let\bookst@\relax\fi
\let\alloc@\alloc@@

\vbadness=10000

\hsize=29pc
\vsize=40pc
\normallineskiplimit=1pt
\parindent=10pt
\advance\hoffset 42pt
\advance\voffset 90pt

\def\makeheadline{\hbox{\botsmash{\line{\vbox to8.5pt{}\the\headline}}}%
 \nointerlineskip\vskip20pt}
\def\makefootline{\baselineskip=2.5pc\relax\line{\the\footline}}

\let\title\undefined
\let\author\undefined
\let\affil\undefined
\let\endaffil\undefined
\let\date\undefined
\let\makebib\undefined

\font@\ninerm=cmr9
\font@\eightrm=cmr8
\font@\sixrm=cmr6
\font@\eighti=cmmi8   \skewchar\eighti='177
\font@\sixi=cmmi6     \skewchar\sixi='177
\font@\ninesy=cmsy9   \skewchar\ninesy='60
\font@\eightsy=cmsy8  \skewchar\eightsy='60
\font@\sixsy=cmsy6    \skewchar\sixsy='60
\font@\eightbf=cmbx8
\font@\sixbf=cmbx6
\font@\eightit=cmti8
\font@\eightsl=cmsl8
\font@\eighttt=cmtt8

\ifmsamloaded@
 \font@\eightmsa=msam8
 \font@\sixmsa=msam6
\fi

\ifmsbmloaded@
 \font@\eightmsb=msbm8
 \font@\sixmsb=msbm6
\fi

\ifeufmloaded@
 \font@\eighteufm=eufm8
 \font@\sixeufm=eufm6
\fi

\ifcmmibloaded@
 \font@\eightcmmib=cmmib8 \skewchar\eightcmmib='177
 \font@\sixcmmib=cmmib6 \skewchar\sixcmmib='177
\fi

\ifcmbsyloaded@
 \font@\eightcmbsy=cmbsy8 \skewchar\eightcmbsy='60
 \font@\sixcmbsy=cmbsy6 \skewchar\sixcmbsy='60
\fi

\newskip\ttglue@

\def\tenpoint{\def\pointsize@{10}%
 \normalbaselineskip12\p@
 \abovedisplayskip12\p@ plus3\p@ minus9\p@
 \belowdisplayskip12\p@ plus3\p@ minus9\p@
 \abovedisplayshortskip\z@ plus3\p@
 \belowdisplayshortskip7\p@ plus3\p@ minus4\p@
 \textonlyfont@\rm\tenrm
 \textonlyfont@\it\tenit
 \textonlyfont@\sl\tensl
 \textonlyfont@\bf\tenbf
 \ifsyntax@\def\big##1{{\hbox{$\left##1\right.$}}}\else
  \let\big\tenbig@
  \textfont\z@\tenrm  \scriptfont\z@\sevenrm  \scriptscriptfont\z@\fiverm
  \textfont\@ne\teni  \scriptfont\@ne\seveni  \scriptscriptfont\@ne\fivei
  \textfont\tw@\tensy \scriptfont\tw@\sevensy \scriptscriptfont\tw@\fivesy
  \textfont\thr@@\tenex \scriptfont\thr@@\tenex \scriptscriptfont\thr@@\tenex
  \textfont\itfam\tenit
  \textfont\slfam\tensl
  \textfont\bffam\tenbf \scriptfont\bffam\sevenbf
   \scriptscriptfont\bffam\fivebf
  \ifmsamloaded@
   \textfont\msafam\tenmsa \scriptfont\msafam\sevenmsa
    \scriptscriptfont\msafam\fivemsa
  \fi
  \ifmsbmloaded@
   \textfont\msbfam\tenmsb \scriptfont\msbfam\sevenmsb
    \scriptscriptfont\msbfam\fivemsb
  \fi
  \ifeufmloaded@
   \textfont\eufmfam\teneufm \scriptfont\eufmfam\seveneufm
    \scriptscriptfont\eufmfam\fiveeufm
  \fi
  \ifcmmibloaded@
   \textfont\cmmibfam\tencmmib \scriptfont\cmmibfam\sevencmmib
    \scriptscriptfont\cmmibfam\fivecmmib
  \fi
  \ifcmbsyloaded@
   \textfont\cmbsyfam\tencmbsy \scriptfont\cmbsyfam\sevencmbsy
    \scriptscriptfont\cmbsyfam\fivecmbsy
  \fi
 \fi
 \let\tt\tentt
 \tt\ttglue@.5emminus.15em
 \setbox\strutbox\hbox{\vrule\height8.5\p@\depth3.5\p@\width\z@}%
 \setbox\strutbox@\hbox{\vrule\height8\p@\depth3\p@\width\z@}%
 \ex@.2326ex\normalbaselines\ifmmode\else\rm\fi}

\def\tenbig@#1{{\hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}}}

\tenpoint

\def\eightpoint{\def\pointsize@{8}%
 \normalbaselineskip10\p@
 \abovedisplayskip10\p@ plus2.4\p@ minus7.2\p@
 \belowdisplayskip10\p@ plus2.4\p@ minus7.2\p@
 \abovedisplayshortskip\z@ plus2.4\p@
 \belowdisplayshortskip5.6\p@ plus2.4\p@ minus3.2\p@
 \textonlyfont@\rm\eightrm
 \textonlyfont@\it\eightit
 \textonlyfont@\sl\eightsl
 \textonlyfont@\bf\eightbf
 \ifsyntax@\def\big##1{{\hbox{$\left##1\right.$}}}\else
  \let\big\eightbig@
  \textfont\z@\eightrm \scriptfont\z@\sixrm  \scriptscriptfont\z@\fiverm
  \textfont\@ne\eighti \scriptfont\@ne\sixi  \scriptscriptfont\@ne\fivei
  \textfont\tw@\eightsy \scriptfont\tw@\sixsy \scriptscriptfont\tw@\fivesy
  \textfont\thr@@\tenex \scriptfont\thr@@\tenex \scriptscriptfont\thr@@\tenex
  \textfont\itfam\eightit
  \textfont\slfam\eightsl
  \textfont\bffam\eightbf \scriptfont\bffam\sixbf
   \scriptscriptfont\bffam\fivebf
  \ifmsamloaded@
   \textfont\msafam\eightmsa \scriptfont\msafam\sixmsa
    \scriptscriptfont\msafam\fivemsa
  \fi
  \ifmsbmloaded@
   \textfont\msbfam\eightmsb \scriptfont\msbfam\sixmsb
    \scriptscriptfont\msbfam\fivemsb
  \fi
  \ifeufmloaded@
   \textfont\eufmfam\eighteufm \scriptfont\eufmfam\sixeufm
    \scriptscriptfont\eufmfam\fiveeufm
  \fi
  \ifcmmibloaded@
   \textfont\cmmibfam\eightcmmib \scriptfont\cmmibfam\sixcmmib
    \scriptscriptfont\cmmibfam\fivecmmib
  \fi
  \ifcmbsyloaded@
   \textfont\cmbsyfam\eightcmbsy \scriptfont\cmbsyfam\sixcmbsy
    \scriptscriptfont\cmbsyfam\fivecmbsy
  \fi
 \fi
 \let\tt\eighttt
 \tt\ttglue@.4emminus.12em
 \setbox\strutbox\hbox{\vrule\height7\p@\depth3\p@\width\z@}%
 \setbox\strutbox@\hbox{\vrule\height6.5\p@\depth2.5\p@\width\z@}%
 \ex@.2326ex\normalbaselines\ifmmode\else\rm\fi}

\def\eightbig@#1{{\hbox{$\textfont\z@\ninerm\textfont\tw@\ninesy
 \left#1\vbox to6.5\p@{}\right.\n@space$}}}

{\catcode` =\active
\gdef\litcodes@@{\def {\allowbreak\hskip\ttglue@}}}

\def\LamSTeX{L\kern-.4em\raise.3ex\hbox{$\ssize\Cal A$}%
 \DN@{10}\ifx\next@\pointsize@\kern-.25em\else\kern-.3em\fi
 \lower.4ex\hbox{\DN@{10}\ifx\next@\pointsize@\eightsy\else\sixsy\fi M}%
 \kern-.1em{$\Cal S$}-\TeX}

\def\windex@{\ifindexing@
 \expandafter\unmacro@\meaning\stari@\unmacro@
 \edef\macdef@{\string"\macdef@\string"}%
 \edef\next@{\write\ndx@{\macdef@}}\next@
 \write\ndx@{{\number\pageno}{\page@N}{\page@P}{\page@Q}}%
 \fi
 \ifindexproofing@
  \ifx\stariii@\empty\else
   \expandafter\unmacro@\meaning\stariii@\unmacro@\fi
  \insert\margin@{\hbox{\eightpoint
  \vrule\height7\p@\depth3\p@\width\z@\starii@
  \ifx\stariii@\empty\else\tt\macdef@\fi}}\fi}

\newcount\toclevel@
\toclevel@=3
\def\toclevel#1{\toclevel@#1\relax}

\def\HLtoc@{%
 \iftoc@
  \ifnum\toclevel@<\@ne\else
   {\noexpands@\let\style\relax
   \edef\next@{\write\toc@{%
   \noexpand\noexpand\expandafter\noexpand\HLname@
   {\expandafter\noexpand\csname HL@W\HLlevel@\endcsname}{\QorThelabel@@@@}}}%
   \next@}%
   \expandafter\unmacro@\meaning\entry@\unmacro@
   \Sixtoc@
   \write\toc@{\noexpand\Page{\number\pageno}{\page@N}%
    {\page@P}{\page@Q}^^J}%
  \fi
 \fi}

\def\hltoc@{%
 \iftoc@ 
  \ifnum\hllevel@<\toclevel@
   {\noexpands@\let\style\relax
   \edef\next@{\write\toc@{%
    \ifnopunct@\noexpand\noexpand\noexpand\nopunct\fi
    \ifnospace@\noexpand\noexpand\noexpand\nospace\fi
    \noexpand\noexpand\expandafter\noexpand\hlname@
   {\expandafter\noexpand\csname hl@W\hllevel@\endcsname}{\QorThelabel@@@@}}}%
   \next@}%
   \expandafter\unmacro@\meaning\entry@\unmacro@
   \Sixtoc@
   \write\toc@{\noexpand\Page{\number\pageno}{\page@N}%
   {\page@P}{\page@Q}^^J}%
  \fi
 \fi}

\newif\ifflush@
\def\FlushedFigs{\global\flush@true}
\def\NoFlushedFigs{\global\flush@false}

\newif\ifSflush@

\def\flush@{\par\vfill\break\null\kern-\topskip\nobreak
 \global\Sflush@true\vfill
 \supereject}


\font\BF=cmbx10 scaled \magstep3

\expandafter\newcount\csname HL@C0\endcsname
\csname HL@C0\endcsname\z@
\expandafter\def\csname HL@S0\endcsname#1{#1\/}
\expandafter\let\csname HL@N0\endcsname\Roman
\expandafter\let\csname HL@P0\endcsname\empty
\expandafter\let\csname HL@Q0\endcsname\empty
\expandafter\def\csname HL@F0\endcsname{\BF}
\expandafter\def\csname HL@W0\endcsname{Part}

\def\notocwrite@#1#2#3{\iftoc@\test@true\else\test@false\fi
 \toc@false#1{#2}#3\iftest@\toc@true\fi}

\notocwrite@\NameHL0\part

\newif\ifpart@

\expandafter\def\csname HL@0\endcsname#1\endHL{\flush@
 \global\part@true
 \ifodd\pageno\else\advancepageno\fi
 {\locallabel@
  \global\setbox\@ne\vbox{\Let@\baselineskip21\p@
  \halign{\BF\ignorespaces##\unskip\hfil\cr 
  \test@false
  \expandafter\ifx\csname HL@W0\endcsname\empty
   \ifx\thelabel@@\empty\global\let\Next@ T\fi\fi
  \ifx\Next@ T%
  \else
   \expandafter\ifx\csname HL@W0\endcsname\empty\else
   \def\next@{\let\nextii@}\expandafter\next@\csname HL@W0\endcsname
    \uppercase\expandafter{\nextii@}\space\space\fi
   {\HL@@F\thelabel@@}\fi\cr
  \noalign{\ifx\Next@ T\vskip-\baselineskip\else\vskip30pt\fi}%
  \uppercase{\ignorespaces#1}\crcr}}}%
 \def\aftertoc@{\vfill\break\advancepageno\global\part@false}%
 \hrule\height\z@\mark{}\vskip1.25in\unvbox\@ne}

\notocwrite@\NameHL1\chapter
\newword\chapter{Chapter}
\newif\iffirstchapterpage@
\newif\ifinsection@

\newif\ifrunningchapter@
\newtoks\runningchaptertoks@
\def\runningchapter#1{\global\runningchapter@true\runningchaptertoks@{#1}}

\let\thechapter@\relax

\expandafter\def\csname HL@1\endcsname#1\endHL{\flush@\global\insection@false
 \ifrunningchapter@\else\runningchaptertoks@{#1}\fi
 \global\runningchapter@false
 {\noexpands@
  \xdef\thechapter@{\ifx\Thepref@\empty\else\Thepref@\null. \fi
  \the\runningchaptertoks@}}%
 \global\firstchapterpage@true
 {\locallabel@
 \global\setbox\@ne\vbox{\Let@\tabskip\hss@
 \halign to\hsize{\bf\hfil\ignorespaces##\unskip\hfil\cr
  \expandafter\ifx\csname HL@W1\endcsname\empty\else
   \csname HL@W1\endcsname\space\fi
  {\HL@@F\ifx\thelabel@@\empty\else\thelabel@@\space\fi}%
  \ignorespaces#1\crcr}}%
 }%
 \unvbox\@ne\mark{}\nobreak\vskip\baselineskip
 %\firstparflush@
}

\def\firstflush@{\parindent\z@
 \everypar{\global\parindent10\p@\global\everypar{}}}

\footline={\ifpart@\hfil
 \else
  \iffirstchapterpage@\hfil\ninerm\page@S{\page@P\page@N{\number\page@C}%
    \page@Q}\hfil\fi
  \global\firstchapterpage@false
 \fi}

\def\advancedimtopins@{%
 \iffirstchapterpage@
 \else
  \advance\dimen@\dimen\topins
  \global\dimen\topins\dimen@
 \fi}


\newif\ifblankpage@
\newbox\topinsbox@
\newcount\endpenalty@
\endpenalty@=-'10000000000

\def\plainoutput{%
 \test@false 
  \ifflush@\test@true
  \else\ifSflush@\global\Sflush@false
   \ifnum\insertpenalties=\z@\test@true\fi
  \fi\fi 
 \iftest@
  \test@false
  \ifvoid\footins
   \ifvoid\topins\test@true\else\ifdim\ht\topins=\z@\test@true\fi\fi
  \fi
  \iftest@
   \setbox\z@\vbox{\unvcopy\@cclv\unskip\unpenalty\unkern
    \global\setbox\@ne\lastbox\unskip}%
   \ifdim\ht\z@=\z@\ifdim\ht\@ne=\z@\global\advance\pageno\m@ne
   \global\blankpage@true\fi\fi
  \fi
 \fi
 \specialsplit@false\ifvoid\topins\else\ifdim\ht\topins=\z@
  \specialsplit@true\advance\minpagesize-\skip\topins\fi\fi
 \fliptopins@
 \ifblankpage@\setbox\outbox@\pagebody\else
 \setbox\outbox@\vbox{\makeheadline\pagebody\makefootline}\fi
 {\noexpands@\let\style\relax
  \ifblankpage@
   \ifnum\outputpenalty=\endpenalty@
    \shipout\vbox{\hrule\width\p@\height\z@\box\topins}%
   \fi
  \global\blankpage@false
  \else
  \shipout@\box\outbox@\fi}%
 \advancepageno
 \resetdimtopins@
 \ifvoid\@cclv\else\unvbox\@cclv\penalty\outputpenalty\fi
 \ifnum\outputpenalty>-\@MM\else\dosupereject\fi}

\def\blankpage{\null\null\vfill\break}

\def\appendices{%
 \NameHL1\appendix
 \Reset\appendix1%
 \newnumstyle\appendix\Alph
 \newword\appendix{Appendix}% 
}

\notocwrite@\Namehl1\section
\newstyle\section#1{#1\null.}

\newif\ifrunningsection@
\newtoks\runningsectiontoks@
\def\runningsection#1{\global\runningsection@true\runningsectiontoks@{#1}}

\expandafter\def\csname hl@1\endcsname#1{\global\insection@true
 \medbreak
 \ifrunningsection@\else\runningsectiontoks@{#1}\fi
 \global\runningsection@false
 \noindent@@
 {\noexpands@
  \edef\next@{\toks@{\ifx\Thepref@\empty\else\Thepref@\null. \fi
  \the\runningsectiontoks@}}\next@
 \mark{\the\toks@}}%
 {\locallabel@
 {\hl@@F\ifx\thelabel@@\empty\else\thelabel@@\space\fi}\bf
 \ignorespaces#1\unskip\punct@{\null.}}%
 \par\nobreak\smallskip}

\def\BotOrChap@#1\BotOrChap@{\DN@{#1}\ifx\next@\empty
 \thechapter@\else\ignorespaces#1\unskip\fi}

\headline={\unlabel@\noset@
 \def\\{\unskip\space\ignorespaces}%
 \ifpart@\hfil\else\iffirstchapterpage@\hfil\else
  \ifodd\pageno
   \hfil
   \smc\expandafter\BotOrChap@\botmark\BotOrChap@
   \hfil
   \llap{\tenpoint\folio}%
  \else
   \rlap{\tenpoint\folio}%
   \hfil\smc\thechapter@
   \hfil
  \fi
 \fi\fi}

\expandafter\newcount\csname hl@C2\endcsname
\csname hl@C2\endcsname\z@
\expandafter\def\csname hl@S2\endcsname#1{#1\null.}
\expandafter\let\csname hl@N2\endcsname\arabic
\expandafter\def\csname hl@P2\endcsname{}
\expandafter\def\csname hl@Q2\endcsname{}
\expandafter\def\csname hl@F2\endcsname{\bf}
\expandafter\let\csname hl@W2\endcsname\empty

\notocwrite@\Namehl2\subsection

\expandafter\def\csname hl@2\endcsname#1{%
 \ifinsection@
  \smallbreak
  \noindent@@
  {\locallabel@
   {\hl@@F\ifx\thelabel@@\empty\else\thelabel@@\space\fi}\bf
   \ignorespaces#1\unskip\punct@{\null.}\addspace@\enspace}%
 \else
  \Err@{\string\subsection\space not in a \string\section}%
 \fi}

\expandafter\newcount\csname hl@C3\endcsname
\csname hl@C3\endcsname\z@
\expandafter\def\csname hl@S3\endcsname#1{#1}
\expandafter\let\csname hl@N3\endcsname\arabic
\expandafter\let\csname hl@P3\endcsname\empty
\expandafter\let\csname hl@Q3\endcsname\empty
\expandafter\let\csname hl@F3\endcsname\empty
\expandafter\let\csname hl@W3\endcsname\empty

\notocwrite@\Namehl3\topic

\expandafter\def\csname hl@3\endcsname#1{%
  \smallbreak
  \noindent@@
  {\locallabel@
   \bf\ignorespaces#1\unskip\punct@{\null.}\addspace@\enspace}}

\expandafter\newcount\csname hl@C4\endcsname
\csname hl@C4\endcsname\z@
\expandafter\def\csname hl@S4\endcsname#1{#1}
\expandafter\let\csname hl@N4\endcsname\arabic
\expandafter\let\csname hl@P4\endcsname\empty
\expandafter\let\csname hl@Q4\endcsname\empty
\expandafter\let\csname hl@F4\endcsname\empty
\expandafter\let\csname hl@W4\endcsname\empty

\notocwrite@\Namehl4\subtopic

\expandafter\def\csname hl@4\endcsname#1{%
 \smallbreak
 {\locallabel@\bf\ignorespaces#1\unskip
 \punct@{\null.}\addspace@\enspace}}

\expandafter\def\csname HL@I1\endcsname{\Reset\hl11%
 \Reset\tag1\Reset\claim1\Reset\Figure1\Reset\Table1%
 \ifx\pref\empty\newpre\section{}\def\tag@P{}\def\claim@P{}\def\island@P{}%
 \else
  \newpre\section{\pref.}\edef\tag@P{\pref.}\edef\claim@P{\pref.}%
  \edef\island@P{\pref.}%
 \fi
}
\expandafter\def\csname hl@I1\endcsname{\Reset\hl21%
 \newpre\hl2{\ifx\pref\empty\else\pref.\fi}}
\expandafter\def\csname hl@I2\endcsname{\Reset\hl31}
\expandafter\def\csname hl@I3\endcsname{\Reset\hl41}

\def\vfootnote@#1{\insert\footins
 \bgroup
 \floatingpenalty\@MM\interlinepenalty\interfootnotelinepenalty
 \leftskip\z@\rightskip\z@\spaceskip\z@\xspaceskip\z@
 \eightpoint
 \splittopskip\ht\strutbox\splitmaxdepth\dp\strutbox
 \locallabel@\noindent@@{\foottext@F#1}\,\modifyfootnote@
 \strut\FN@\fo@t}

\def\UseBibTeX{\immediate\openout\auxwrite@=\jobname.aux 
 \let\cite\BTcite@
 \def\nocite##1{\immediate\write\auxwrite@{\string\citation{##1}}}%
 \def\bibliographystyle##1{\immediate\write\auxwrite@{\string
  \bibstyle{##1}}}%
 \def\bibliography##1{\immediate\write\auxwrite@{\string\bibdata{##1}}}}

\def\alloc@#1#2#3#4#5{\global\advance\count1#1by\@ne
 \ch@ck#1#4#2\allocationnumber=\count1#1
 \global#3#5=\allocationnumber
 \wlog{\string#5=\string#2\the\allocationnumber}}

\catcode`\@=13
