\part The Style Files\label{SFPART}\endpart \begingroup \newword\chapter{} \chapter""Introduction\endchapter *lamstex.tex* provides default treatments for all the main \lamstex\ constructions, while *lamstex.stf* and *lamstex.stb* provide default treatments for front matter and back matter constructions. In some styles, some of these constructions are a little more complicated, or have to be combined in different ways; and certain features, like running heads, haven't yet been considered at all. So in this Part we discuss the standard \lamstex\ style files, although in a somewhat more perfunctory manner than the treatment of previous Parts. As usual (compare section~\Sref{GENDEFS}), we will be using double horizontal lines for code from these files. \endgroup \chapter The {\tt paper} style\endchapter The file *paper.st* begins \CC** \catcode`\@=11 ** to allow us to access and create private control sequences, followed by \CC** \ifx\paperst@\relax\catcode`\@=\active \endinput\else\let\paperst@=\relax\fi ** which prevents *paper.st* from being read in twice (compare section~\Sref{AC}), a necessity because of the *\NameHL* commands that occur later (we can't *\NameHL1\heading* twice, since that involves *\define\heading* twice).\linebreak Then we have \CC** \let\alloc@=\alloc@@ ** so that we can create new counters, etc., without having them written to the *.log* file (compare page~\ref{NEWALLOC}). \section{Basic settings}Next we set basic parameters that differ from the default style: \CC** \hsize=30pc \vsize=42pc \parindent=1em \normallineskiplimit=1pt \advance\hoffset 48pt \advance\voffset 78pt ** *\hoffset* and *\voffset* are changed to center these small pages within an 8\piecefrac12 $\times$ 11 inch piece of paper. \section{Fonts and point sizes} Since parts of the paper will be set in 8~point type, we first have to introduce numerous extra fonts: \CC** \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 . . . ** \amstex's *\font@* is basically like the \tex\ primitive *\font*, except that the font name is added to *\fontlist@* (see section~\Sref{LISTS}), for use by \amstex's *\syntax* command. The only slightly surprising things here are the *\ninerm* and *\ninesy*---% they are needed only because they are used fleetingly in the definition of *\big* for eight point type (see below). If the additional AMS fonts have been loaded, using any of ** \loadmsam \loadmsbm \loadeufm ** then flags *\ifmsamloaded@*, *\ifmsbmloaded@*, and *\ifeufmloaded@*, respectively, will have been set true. And if ** \loadbold ** was used to load *cmmib..* and *cmmbsy...* fonts, flags *\ifcmmibloaded@* and *\ifcmbsyloaded@* will have been set true. In each case, we should then load additional fonts for eight point: \CC** \ifmsamloaded@ \font@\eightmsa=msam8 \font@\sixmsa=msam6 \fi "2 . . . "2 \ifcmbsyloaded@ \font@\eightcmbsy=cmbsy8 \skewchar\eightcmbsy='60 \font@\sixcmbsy=cmbsy6 \skewchar\sixcmbsy='60 \fi ** (If even more crazy families are to be loaded, like *eufb*, *eusm*, *eusb*, *eurm*, *eurb*, further clauses will have to be added, but I couldn't bear including them.) Now we want to define *\tenpoint* and *\eightpoint*, following the basic scheme used in Appendix~E of {\it The \tex book}. For literal mode, we will want spaces to give different amounts of glue in the two different point sizes, so we first declare a new glue register, \CC** \newskip\ttglue@ ** A few macros need to know what point size is currently used, so this information is kept in a control sequence *\pointsize@*. Thus, the definition of *\tenpoint* will be of the form: \CC** \def\tenpoint{\def\pointsize@{10}% . . . } ** After *\pointsize@* is defined, *\normalbaselineskip* is set to~*12pt* (at the end of the definition, *\normalbaselines* will be stated, which actually sets *\baselineskip* to this value); on the other hand, *\normallineskip* and *\normallineskiplimit* will each have the value~*1pt* for both 10~point and 8~point type. Then values of *\abovedisplayskip*, \dots, for the spacing above and below displayed formulas are set. Next we use ** \textonlyfont@\rm\tenrm . . . \textonlyfont@\bf\tenbf ** so that *\rm* means *\tenrm* in 10~point type, etc. \amstex's *\textonlyfont@* construction means that *\rm*, \dots, will give error messages if used in math mode. (However, if the file *pcompat.tex* has been *\input*, and *\plainfonts* has been specified, then *\textonlyfont@* will be redefined so that *\rm*, \dots, will function exactly as in *plain* \tex@.) Next we have to set up the families for math fonts, and then\linebreak *\let\big=\tenbig@*, which is defined separately, since *\big* is different for 10~point type and 8~point type (following Appendix~E, however, *\bigg*, \dots, are kept the same). If the user has typed *\syntax*, so that *\ifsyntax@* is true, then we might as well skip all these font assignments, and we can give *\big* a simpler definition, in which the actual size used is irrelevant, ** \ifsyntax@ \def\big##1{{\hbox{$\left##1\right.$}}} \else \let\big=\tenbig@ \textfont0=\tenrm . . . "2 . . . "2 \textfont3=\tenex . . . \textfont\itfam=\tenit "2 . . . "2 \textfont\bffam=\tenbf . . . \ifmsamloaded@ . . . \fi . . . \fi ** We also *\let\tt=\tentt*, although we don't bother producing a *\tt* math family, and we then use ** \tt\ttglue@=.5em minus.15em ** Thus, we switch to this *\tt* font (so that *em* refers to that font), and then assign the value of *\ttglue@*). This switch to *\tt* is temporary, since we will switch to *\rm* at the end. Before ending, however, we have to set *\box\strutbox*, which determines struts, ** \setbox\strutbox=\hbox{\vrule\height8.5pt\depth3.5pt\width0pt} ** as well as *\strutbox@*, which \amstex\ uses for its special math struts, ** \setbox\strutbox@=\hbox{\vrule\height8pt\depth3pt\width0pt} ** We also set the \amstex\ dimen ** \ex@=.2326ex ** (as explained in *amstex.doc*, I don't remember why this value is chosen!). And then the definition of *\tenpoint* ends with ** \normalbaselines ** so that we have set *\baselineskip*, etc., to their ``normal'' values, and then ** \ifmmode\else\rm\fi ** to switch to *\rm*; the *\ifmmode* test is required in case a construction like ** $$ \tenpoint ... $$ ** is used, since *\rm* will give an error message in math mode! After the definition of *\tenpoint*, we still have to give the definition \CC** \def\tenbig@#1{{\hbox{$\left#1\vbox to8.5pt{} \right.\n@space$}}} ** and then we can switch to *\tenpoint*: \CC** \tenpoint ** {\bf NOTICE }that we must not say *\tenpoint* until *\tenbig@* has been defined, or *\big* will initially be undefined. The definition of *\eightpoint* is exactly analogous, and followed by the definition \CC** \def\eightbig@#1{{\hbox{$\textfont0=\ninerm\textfont2=\ninesy \left#1\vbox to6.5pt{}\right.\n@space$}}} ** which is where *\ninerm* and *\ninesy* get used; then, for example, *\big(* in *\tenpoint* selects the *\ninerm*~(. Then we use \CC** {\catcode` =\active \gdef\litcodes@@{\def {\allowbreak\hskip\ttglue@}}} ** so that if literal mode is used within *\tenpoint* or *\eightpoint*, the active space will have the desired width. With the fonts now declared, we can properly print the \lamstex\ logo; for best effects somewhat different choices are required at different point sizes: \CC** \def\LamSTeX{L\kern-.4em\raise.3ex\hbox{$\ssize\Cal A$}% \def\next@{10}\ifx\next@\pointsize@ \kern-.25em\else\kern-.3em\fi "2 \lower.4ex\hbox{\def\next@{10}\ifx\next@\pointsize@ \eightsy\else\sixsy\fi M}% \kern-.1em{$\Cal S$}-\TeX} ** Although *\claimformat* is supposed to be the same as in the default style, most people don't have an 8~point ``caps and small caps'' font, so *\tenpoint* and *\eightpoint* don't define *\smc*, which simply has the default *lamstex.tex* meaning of *\tensmc* (choosing the font *cmcsc10*). So we substitute *\rm\uppercase* instead: \CC** \def\claimformat@#1#2#3{\medbreak\noindent@@ \def\next@{8}\ifx\pointsize@\next@ \rm\uppercase{#1 {\claim@@@F#2} #3}% \punct@{\null.}\addspace@\enspace "2 \else \smc#1 {\claim@@@F#2} #3\punct@{\null.}% \addspace@\enspace \fi \sl} ** Finally, since we have the smaller *\eightpoint* fonts, we might as well use them in the *\windex@* routine for printing index entries at the right margin, for proofing; we change the strut so that it gives only~ *10pt* between lines. \CC** \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} ** \section{The {\tt.toc} levels} Since *paper.st* has so many different heading levels, $$\vcenter{\halign{\tt#\hfil&\quad{\it alias\/}\quad\tt#\hfil\cr \bs HL1&\bs chapter\cr \bs hl1&\bs section\cr \bs hl2&\bs subsection\cr \bs hl3&\bs topic\cr \bs hl4&\bs subtopic\cr}}$$ we want to allow *\toclevel* to indicate how many levels should be written to the *.toc* file: *\toclevel1* should indicate that only *\chapter*'s are written, *\toclevel2* that *\chapter*'s and *\section*'s are written, etc. We might as well allow *\toclevel0* to mean nothing is written (although then it was fairly silly to specify *\tocfile* to begin with). We do this in terms of a counter *\toclevel@*, initially with the value~*3* (so that *\chapter*'s, *\section*'s and *\subsection*'s---the only numbered heading levels in this style---are written): \CC** \newcount\toclevel@ \toclevel@=3 \def\toclevel#1{\toclevel@=#1\relax} ** To get this to work, we have to restate the definitions of *\HLtoc@* and *\hltoc@* from *lamstex.tex*. The only difference in the definition of *\HLtoc@* is that we don't do anything if *\toclevel@* is less than~*1*: \setbox0\hbox{\} \CC** \def\HLtoc@{% \iftoc@ \ifnum\toclevel@ < 1 "2 \else "box0 \fi \fi} ** Similarly, *\hltoc@* only writes to the *.toc* file when *\hllevel* is less than *\toclevel@* (so if *\toclevel@* is~*1*, no *\hl* is written, if *\toclevel@* is~*2*, only *\hl1* is written, etc., as desired): \setbox0\hbox{\} \CC** \def\hltoc@{% \iftoc@ "2 \ifnum\hllevel@ < \toclevel@ "box0 \fi \fi} ** \section{Setting up heading levels} Next we have to set up the heading levels. As mentioned on page~\ref{USESFPART}, we want to make sure that the basic *\NameHL*'s in this style file don't write information to the *.toc* file even if *\tocfile* has been specified before the *\docstyle* line. So we define \CC** \def\notocwrite@#1#2#3{\iftoc@\test@true\else\test@false\fi \toc@false#1{#2}#3\iftest@\toc@true\fi} ** For example, \CC** \notocwrite@\NameHL1\heading ** first stores the value of *\iftoc@* in *\iftest@*, declares *\tocfalse@*, calls *\NameHL1\heading*, and restores *\toc@true* if *\iftoc@* was initially true. The *\NameHL* and *\Namehl* constructions don't involve *\iftest@*, so this is safe. (The definition of *\notocwrite@* encloses argument~*#2* in braces in case we have something like *\NameHL{10}...*.) Next we state \CC** \newfontstyle\heading{\smc} ** Thus, *\HL1*, {\it alias\/} *\heading*, has numbers set in *\smc* (which will also be used for the heading title, in the definitions to follow). One additional feature of the *paper* style is that a *\subsection* (*\hl2*) is only allowed within a *\section* (*\hl1*), not directly within a *\heading*. So we need a flag \CC** \newif\ifinsection@ ** which *\heading* will set false and *\section* will set true. Aside from this, *\heading* is handled by defining `*\HL@1*' almost exactly as in the default style, \CC** \expandafter\def\csname HL@1\endcsname#1\endHL{% \global\insection@false "2 \bigbreak"9\medskip"9 "2 {\locallabel@ \global\setbox1=\vbox{\Let@\tabskip\hss@ \halign to\hsize{"9\smc"9\hfil\ignorespaces##\unskip\hfil\cr "2 \expandafter\ifx\csname HL@W1\endcsname\empty\else \csname HL@W1\endcsname\space\fi "2 {\HL@@F\ifx\thelabel@@\empty\else\thelabel@@\space\fi}% \ignorespaces#1\crcr}}}% \unvbox1 \nobreak\medskip} ** merely adding some extra space before the heading, and setting the heading in *\smc*. One of the interesting features of the *paper* style is the definition \CC** \def\appendices{% \NameHL1\appendix \Reset\appendix1% \newnumstyle\appendix\Alph \newword\appendix{Appendix}% } ** This means that after *\appendices* has appeared, *\appendix* may be used (and *\heading* may no longer be used---compare page~\ref{NHLUD}); the new headings created by *\appendix* will be numbered `A', `B', \dots, and the headings will now say `Appendix A \dots', etc. Notice that when *\appendices* is used, *\NameHL1\appendix* {\it will\/} be written to the *.toc* file. As we will see in section~\ref{Pmaketoc}, this will enable *\maketoc* to properly process any *\appendix* lines that appear afterwards. Next we have \CC** \notocwrite@\Namehl1\section \newstyle\section#1{#1\null.} ** so that *\section* can be used for *\hl1*; in addition, we now have a period printed after the *\section* number (the default style omits the period). Although each *\heading* normally resets *\section* numbers to~1 (this will be handled by `*\HL@I1*', to be defined shortly), we will allow ** \keepsection ** analogous to *\keepitem*, to be typed before *\heading*, to prevent this. *\keepsection* will merely set a flag \CC** \newif\ifcontinuesection@ \def\keepsection{\global\continuesection@true} ** which each *\section* should set false (with this arrangement, if\linebreak *\keepsection* is typed before a *\heading* with no *\section*'s, then it carries over to the next *\heading*). The definition of *\section*, via `*\hl@1'*, also sets *\ifinsection@* to be true, and the formatting is somewhat different from the default style: instead of running the *\section* title into the text, we start a new paragraph, after a *\smallskip*: \CC** \expandafter\def\csname hl@1\endcsname#1{% \global\insection@true \global\continuesection@false \medbreak\noindent@@ {\locallabel@ \bf{\hl@@F\ifx\thelabel@@\empty\else\thelabel@@\space\fi}% \ignorespaces#1\unskip\punct@{\null.}}% \par\nobreak\smallskip} ** For *\hl2*, eventually to be named *\subsection*, we must first declare counters and default values: \CC** \expandafter\newcount\csname hl@C2\endcsname \csname hl@C2\endcsname=0 "2 \expandafter\def\csname hl@S2\endcsname#1{#1\null.} "2 \expandafter\let\csname hl@N2\endcsname=\arabic "2 \expandafter\let\csname hl@P2\endcsname=\empty \expandafter\let\csname hl@Q2\endcsname=\empty "2 \expandafter\def\csname hl@F2\endcsname{\bf} \expandafter\let\csname hl@W2\endcsname=\empty ** Then we can \CC** \notocwrite@\Namehl2\subsection ** [recall (page~\ref{NameNOTE}) that *\Namehl2* must be used after `*\hl@C2*', \dots\ have been defined]. Then we define *\subsection*, via `*\hl@2*', giving an error message if the flag *\ifinsection@* is false: \CC** \expandafter\def\csname hl@2\endcsname#1{% \ifinsection@ "2 \smallbreak \noindent@@ "2 {\locallabel@ {\hl@@F\ifx\thelabel@@\empty\else \thelabel@@\space\fi}\bf "2 \ignorespaces#1\unskip\punct@{\null.}% \addspace@\enspace}% "2 \else \Err@{\noexpand\subsection not in a \string\section}% \fi} ** The declaration of counters and default values for *\hl3* and *\hl4* are analogous, except that we can even ** \expandafter\let\csname hl@F3\endcsname=\empty \expandafter\let\csname hl@F4\endcsname=\empty ** since the numbers for these heading levels aren't even going to be printed. We can then state \CC** \notocwrite@\Namehl3\topic ** and \CC** \notocwrite@\Namehl4\subtopic ** The definition of *\topic*, via `*\hl@3*', is \CC** \expandafter\def\csname hl@3\endcsname#1{% \smallbreak "2 \noindent@@ "2 {\locallabel@ \bf\ignorespaces#1\unskip\punct@{\null.}% \addspace@\enspace}} ** while *\subtocic*, defined via `*\hl@4*', starts as an ordinary paragraph: \CC** \expandafter\def\csname hl@4\endcsname#1{% "2 \smallbreak "2 {\locallabel@\bf\ignorespaces#1\unskip \punct@{\null.}\addspace@\enspace}} ** The initializations are fairly simple: \CC** \expandafter\def\csname HL@I1\endcsname{\ifcontinuesection@ \else\Reset\hl11\fi} "2 \expandafter\def\csname hl@I1\endcsname{\Reset\hl21% \ifx\pref\empty\newpre\hl2{}\else\new\hl2{\pref.}\fi} "2 \expandafter\def\csname hl@I2\endcsname{\Reset\hl31} "2 \expandafter\def\csname hl@I3\endcsname{\Reset\hl41} ** Thus, *\section* numbers are reset to~1 after each *\heading*, unless\linebreak *\keepsection* preceded it; *\subsection* numbers are reset to~1 at each *\section*, and the {\it n}$^{\text{th}}$ subsection number is printed as {\it m}.{\it n}, where {\it m\/} is the *\section* number, unless empty (because of a *\section""""* command); and *\subsection* resets *\topic* numbers to~1, while *\topic* resets *\subtopic* numbers to~1, even though these numbers aren't printed (they can still be referred to by *\nref*, if the *\topic* or *\subtopic* is given a *\label*). \section{Footnotes} The definition of *\vfootnote@* is modified so that the footnotes will be printed in 8~point type: \C** \def\vfootnote@#1{\insert\footins \bgroup "2 \floatingpenalty2000 "2 \interlinepenalty=\interfootnotelinepenalty "2 \leftskip=0pt \rightskip=0pt \spaceskip=0pt \xspaceskip=0pt "9\eightpoint"9 \splittopskip=\ht\strutbox \splitmaxdepth=\dp\strutbox "2 \locallabel@\noindent@@{\foottext@F#1}\modifyfootnote@ \footstrut\futurelet\next\fo@t} ** Note that the *\strutbox* will now have the value set by *\eightpoint*. \section{Additional ``top matter'' and ``end matter'' constructions} In addition to *\title*, *\author*, *\affil*, and *\date*, which already appear in the default style, the *paper* style also has several other constructions that go at the beginning of the paper, and a few that go at the end. For *\abstract...\endabstract*, as for *\title* and *\author*, we declare a box \CC** \newbox\abstractbox@ ** to hold the abstract. Because we are printing a word `Abstract' at the beginning, followed by punctuation and spacing, we then \CC** \rightadd@\abstract\to\nofrillslist@ \def\abstract@W{Abstract} ** The *\box\abstractbox@* is going to be set with ** \leftskip=24pt \rightskip=\leftskip ** rather than as a *\vbox* with smaller *\hsize*, so that we can simply *\unvbox* it at the proper time, instead of having to include it in *\centerline*, and worrying about spacing before and after it. We will increase the *\tolerance* to~*800* for these smaller lines. Unfortunately, these values of *\leftskip* and *\rightskip* {\it do not\/} influence *\displaywidth* and *\displayindent*, which determine the positioning of displayed formulas within the *\abstract*; the latter are influenced only by *\parshape*---see {\it The \tex book}, page~188. Moreover, we can't simply assign them the desired values, because, as explained on that page, \tex\ assigns them values immediately after the *$$* that begins a display, based on the value of *\parshape*. Instead we will have to change *\everydisplay* (which, recall from section~\Sref{pretend1}, is already non-empty in \lamstex) to include the desired changes. \CC** \def\abstract{\begingroup \global\setbox\abstractbox@=\vbox\bgroup "2 \eightpoint\leftskip=24pt \rightskip=\leftskip "2 \everydisplay{\advance\displaywidth by -48pt \displayindent=24pt \csname displaymath \endcsname}% "2 \tolerance=800 \noindent@@ "2 \ifx\abstract@W\empty\else\abstract@W\punct@{\null.}% \addspace@\enspace\fi} "slip \def\endabstract{\egroup\endgroup} ** *\thanks*, *\keywords*, and *\subjclass* are handled like *\date*: \CC** \let\thanks@=\relax \long\def\thanks#1{\gdef\thanks@{{\ignorespaces#1}}} "slip \let\keywords@=\relax \def\keywords#1{\gdef\keywords@{{\ignorespaces#1}}} "slip \let\subjclass@=\relax \def\subjclass#1{\gdef\subjclass@{{\ignorespaces#1}}} ** The *\long* allows several paragraphs of thanks. Extra group is included in the definitions of *\keywords* and *\subjclass* in case a font change is included; but, as we will see, that is unnecessary for *\thanks*. None of these need *\unskip* at the end, because they will all eventually be ended by a *\par*. *\address* is somewhat different, because it can be used arbitrarily many times. A counter *\addresscount@* is used to keep track of the number, and each use of *\address* creates a new control sequence to store the argument: \CC** \newcount\addresscount@ \addresscount@=0 "2 \long\def\address#1{\global\advance\addresscount@ by 1 \expandafter\gdef \csname address\number\addresscount@\endcsname {{\ignorespaces#1}}} ** Since *\keywords*, *\subjclass*, and *\address*'s are printed at the end of the paper in the *paper* style, we redefine *\bye* to include this material before adding the *\vfill\supereject\end*: \CC** \def\bye{\par \nobreak "2 \vskip12pt minus6pt "2 \eightpoint "2 \ifx\keywords@\relax\else \noindent@@{\it Keywords.\enspace}\keywords@\par\fi "2 \ifx\subjclass@\relax\else \noindent@@ 1980 {\it Mathematics subject classifications\/}\colon@\space\subjclass@\par\fi "2 \ifnum\addresscount@ > 0 \nobreak \vskip12pt minus6pt "2 \loop\ifnum\addresscount@>0 \csname address\number\addresscount@\endcsname\endgraf \global\advance\addresscount@ by -1 \repeat "2 \fi \vfill\supereject \end} ** Notice that instead of a *:* we used *\colon@* (page~\ref{COLONAT}). No *\keywords@W* or *\subjclass@W* has been provided, to change `Keywords' or `Mathematics subject classifications', since those are presumably somewhat standard terms; but they could easily be added if needed. In the *\loop* for the *\address*'s, we needed *\endgraf* instead of *\par*, since *\loop* isn't *\long*. And then we make *\enddocument* synonymous with this new *\bye*: \CC** \let\enddocuent=\bye ** The remaining constructions, which occur at the top, are placed by\linebreak *\maketitle*, just as in the default style. We also declare initially empty elements \CC** \let\pretitle=\empty \let\preauthor=\empty "2 \let\preaffil=\empty "2 \let\predate=\empty "2 \let\preabstract=\empty \let\prepaper=\empty ** which can be redefined to add additional elements: \CC** \def\maketitle{\hrule\height 0pt \vskip-\topskip "2 \pretitle "2 \vskip24pt plus12pt minus12pt \unvbox\titlebox@ "2 \preauthor "2 \ifvoid\authorbox@\else \vskip12pt plus6pt minus3pt \unvbox\authorbox@\fi "2 \preaffil "2 \ifvoid\affilbox@\else \vskip10pt plus5pt minus2pt \unvbox\affilbox@\fi "2 \predate "2 \ifx\date@\relax\else \vskip6pt plus2pt minus2pt\centerline{\rm\date@}% \let\date@=\relax\fi "2 \preabstract "2 \ifx\thanks@\relax\else \vfootnote@{}\thanks@ \let\thanks@=\relax\fi "2 \ifvoid\abstractbox@\else \vskip15pt plus12pt minus12pt \unvbox\abstractbox@ \fi "2 \prepaper \vskip18pt plus12pt minus6pt} ** Notice that the *\thanks* is treated like the text of a footnote, but with no number. \section{Bibliography} The only modification required for *\makebib* in the *paper* style is to switch to 8~point type: \CC** \def\makebib{\begingroup\eightpoint \bigbreak \centerline{\smc\makebib@W}\nobreak\medskip "2 \sfcode`\.=1000 \everypar{}\parindent=0pt \def\nopunct{\nopunct@true}\def\nospace{\nospace@true}% "2 \nopunct@false\nospace@false \def\lkerns@{\null\kern-1sp\kern1sp}% \def\nkerns@{\null\kern-2sp\kern2sp}% } ** For the case where *\UseBibTeX* has been specified, so that the ** \makebib . . . \endmakebib ** region is replaced by a ** \bibliography{...} ** line, we redefine *\beginthebibliography@* so that it will also print in 8~point type: \CC** \def\beginthebibliography@#1{\eightpoint \setbox0=\hbox{#1\ }\bibindent@=\wd0 \bigbreak\centerline{\smc\bibliography@W}\nobreak\medskip \sfcode`\.=1000 \everypar{}\parindent=0pt} ** \section{\CS{maketoc}\label{Pmaketoc}} Finally, the *\maketoc* command is special, because it is used right in the *paper* style, rather than in a ``front matter file''. So most of the definitions of *lamstex.stf* are also required in *paper.st*: \CC** \def\dotleaders ... \def\Page@ ... \long\def\widerthanhsize@ "2 \long\def\setentry@##1##2##3##4{% . . . \else \hbox to\hsize{"9\kern24pt"9 ...} \fi} "2 \def\endstrut@ \newdimen\thehang@ "2 \long\def\longentry@##1##2##3##4{. . . . . . \hangafter1 \hangindent\thehang@ "9\leftskip=24pt"9 . . .} "2 \newif\ifemptynumber@ \def\Style@ ... . . . \def\Style@@@@ ... \newdimen\digits ** with the difference that all entries will be indented 24~points from the left margin (the same amount of indentation that occurs for the *\abstract*). We also need to have the definition \CC** \def\maketoc@W{Contents} ** so that *\newword\maketoc* can be used before *\maketoc* itself. Then the definition of *\maketoc* starts ** \def\maketoc{\par \begingroup \eightpoint \tolerance=800 \unlabel@\noset@ \let\nopunct=\relax \let\nospace=\relax \let\overlong=\relax \everypar={}\parindent=0pt \lineskiplimit=0pt ** The *\checkmainfile@* in the *lamstex.stf* definition is naturally deleted, and the *\par\vfill\break* is replaced by a *\par*. We use *\begingroup*, because we will be making redefinitions of *\HL*, etc., and the old definitions will have to be restored after the table of contents is finished; and the *\lineskiplimit=0pt*, which is so important for the entries of the table of contents (compare section~\Sref{SETENTRY}), will also be confined to this group. And then come the various redefinitions that also occur in *\maketoc* in *lamstex.stf*: ** \def\HL ... \setbox0=\hbox{0.00} \digits=\wd0 \def\hl ... \def\NameHL ... \def\Namehl ... ** The definitions of *\HL* and *\hl* are somewhat different, reflecting both the larger number of heading levels, and somewhat different formatting in the table of contents. Then we have to add ** \NameHL1\heading \Namehl1\section \Namehl2\subsection \Namehl3\topic \Namehl4\subtopic ** so that *\heading*, \dots, *\subtopic* will be suitably redefined while making the table of contents. Naturally we can't add *\NameHL1\appendix* at the same time, but *\appendices* will add this to the *.toc* file, so that *\appendix* will be suitably redefined at the necessary time when printing the Contents. Finally, we print the properly centered heading, diminish *\hsize* by\linebreak 24~points, (so that the right margin will match that of the *\abstract*), *\input* the file *\jobname.toc*, end the group, and add some vertical space: ** \centerline{\smc\maketoc@W} \nobreak \vskip18pt plus12pt minus6pt "2 \advance\hsize by -24pt "2 \input \jobname.toc \endgroup \vskip 12pt plus8pt minus4pt ** \medskip The definitions involving *\island*'s from *lamstex.stf* are not needed, since *paper.st* does not print a list of Figures, Tables, etc., even when a table of contents is made. And nothing from *lamstex.stb* is required, since *paper.st* does not provide for an index. \chapter The {\tt book} style\label{BOOKSTYLE}\endchapter \section{Basic settings} The *book* style has ** \ifx\bookst@\relax\catcode`\@=\active \endinput\else\let\bookst@=\relax\fi ** analogous to the code in *paper.st*, and then some slightly different basic settings, ** \hsize=30pc \vsize=42pc ** Then, more significantly, it changes *\makeheadline* so that running heads will be separated from the main body of the text by a different amount of space; in addition, the running head is not made into a *\vbox to0pt*, as in *plain* \tex@---the running heads are a measurable part of the page (the final pages might even be printed with ``crop marks'' on them, which should naturally take into account the presence of the running heads). *\makefootline* is also changed, although that will only effect the page numbers at the bottoms of special pages, like the initial pages of each chapter: \CC** \def\makeheadline{\hbox{% \botsmash{\line{\vbox to8.5pt{}\the\headline}}}% \nointerlineskip\vskip20pt} \def\makefootline{\baselineskip=2.5pc \line{\the\footline}} ** Just for good measure, we make things like *\title*, \dots, undefined, since they should appear only in the ``front matter file'' for the book: \CC** \let\title=\undefined "2 \let\author=\undefined "2 \let\affil=\undefined "2 \let\date=\undefined ** and, in particular, we \CC** \let\makebib=\undefined ** since *\makebib* should only occur in the ``back matter file''. \section{Fonts and point sizes}Exactly the same new fonts are declared as in the *paper* style, and *\tenpoint* and *\eightpoint* are defined in the same way. \section{The {\tt.toc} levels} *\toclevel* is defined just as in the *paper* style, and *\HLtoc@* and *\hltoc@* are redefined in exactly the same way. \section{Flushing out figures\label{FLUSHF}} Both *\part* and *\chapter* are going to flush out any figures from previous *\chapter*'s. As discussed in section~\Sref{FLUSHSEC}, this means that we will have to modify the *\plainoutput* routine so that empty pages produced at the ends of chapters won't increase the page numbers, and won't get printed. Since this additional process is memory intensive, however, we don't want it to be invoked unless a flag \CC** \newif\ifflush@ ** is true, where *\FlushedFigs* and *\NoFlushedFigs* are used to set the flag: \CC** \def\FlushedFigs{\global\flush@true} \def\NoFlushedFigs{\global\flush@false} ** (The savvy user will specify *\FlushedFigs* near the end of a *\chapter* with *\Aplace*'s and add *\NoFlushedFigs* at the beginning of the next *\chapter*.) It might seem that *\part* and *\chapter* will flush out figures from a previous *\chapter* if their definitions are of the form ** \par\vfill\supereject . . . {\locallabel@ . . . } . . . ** (using the *\par\vfill\supereject* that occurs in the definition of *\bye*). Unfortunately, that may not be sufficient when we have a situation like ** . . . \Aplace{...} \chapter ** because the *\Aplace*'d material may not get printed until after the remaining aspects of *\chapter* have already set things up for preparing pages for this next *\chapter*. For example, flushed out figures from Chapter~9 might end up having heading levels saying `Chapter~10 \dots'!---which is even worse than having extra blank pages. Therefore *\part* and *\chapter* will, in all situations, use something like ** \par\vfill\break\null\kern-\topskip\nobreak\vfill\supereject ** (essentially the construction that appears in the *plain* definition of\linebreak *\dosupereject*), so that we can be sure that any held-over figures are flushed out before the remaining aspects of *\chapter* are brought into play. The problem with this approach is that a blank page will now be produced when there are no figures to be flushed out. However, we will take care of that problem later, during the *\output* routine. We will need a flag \CC** \newif\ifSflush@ ** to indicate such special pages, and then we define \CC** \def\flush@{\par\vfill\break\null\kern-\topskip\nobreak \global\Sflush@true\vfill\supereject} ** \section{\CS{part} and \CS{chapter}} The *book* style has a new heading level *\HL0*, {\it alias\/} *\part*. We will need a new font for setting it, \CC** \font\BF=cmbx10 scaled \magstep3 ** and then we set up things for *\HL0*: \CC** \expandafter\newcount\csname HL@C0\endcsname \csname HL@C0\endcsname=0 "2 \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} ** So *\HL0* levels will be numbered I, II, \dots. The word preceding the number will actually be `PART' rather than `Part', but we will use *\uppercase* for this, rather than defining `*\HL@W0*' as *PART*, so that *Part* will appear in the *.toc* file; this allows the style file for the front matter to print things differently, if desired.\pagelabel{UCPART} Once these definitions have been made, we can then *\NameHL0\part* (see page~\ref{NameNOTE}). As with the *paper* style, however, we need to have \CC** \def\notocwrite@#1#2#3{\iftoc@\test@true\else\test@false\fi \toc@false#1{#2}#3\iftest@\toc@true\fi} ** so that we can \CC** \notocwrite@\NameHL0\part ** We introduce a new flag \CC** \newif\ifpart@ ** since *\part* pages will be special (they will have no number at the bottom and also no running head). Then we define *\part*, via `*\HL@0*', which involves quite a few tricky maneuvers. Our definition of *\csname HL@0\endcsname* begins with ** \flush@ \global\part@true \ifodd\pageno\else\advancepageno\fi ** where the *\flush@* (section~\Sref{FLUSHF}) flushes out any figures remaining from the previous *\chapter*, and the third clause insures that *\part*'s always begin on odd-numbered pages. And then we want something like ** {\locallabel@ \global\setbox1=\vbox{\Let@ \baselineskip=21pt \halign{\BF\ignorespaces##\unskip\hfil\cr \expandafter\ifx\csname HL@W0\endcsname\empty \else\csname HL@W0\endcsname\space\space\fi {\HL@@F\thelabel@@}\cr \noalign{\vskip30pt}% \uppercase{\ignorespaces#1\crcr}}} ** printing something like `PART\ \ II' on the first line, an extra 30~points of vertical space, and then the title *#1* in uppercase letters. But we want to eliminate the first line and the extra 30~points if both the \ and the number happen to be empty. Moreover, ** \uppercase{\csname HL@W0\endcsname} ** won't uppercase the letters in *\csname HL@W0\endcsname*, and even ** \uppercase\expandafter{\csname HL@W0\endcsname} ** won't do the trick, so we need to resort to a strategy used before (compare pages~\ref{LNIII} and ~\ref{USELNIII}), \CC** \expandafter\def\csname HL@0\endcsname#1\endHL{% \flush@ \global\part@true \ifodd\pageno\else\advancepageno\fi {\locallabel@ \global\setbox1=\vbox{\Let@ \baselineskip=21pt "2 \halign{\BF\ignorespaces##\unskip\hfil\cr "2 \test@false \expandafter\ifx\csname HL@W0\endcsname\empty \ifx\thelabel@@\empty\global\let\Next@=T\fi\fi "2 \ifx\Next@ T% "2 \else \expandafter\ifx\csname HL@W0\endcsname\empty \else "2 \def\next@{\let\nextii@=}% \expandafter\next@\csname HL@W0\endcsname \uppercase\expandafter{\nextii@}\space\space\fi "2 {\HL@@F\thelabel@@}% \fi \cr "2 \noalign{\ifx\Next@ T\vskip-\baslineskip\else\vskip30pt\fi}% \uppercase{\ignorespaces#1}\crcr}}}% \def\aftertoc@{\vfill\break\advancepageno\global\part@false}% \hrule\height0pt\mark{}\vskip1.25in\unvbox 1 } ** The *\hrule* keeps the *\vskip1.25in* from disappearing at the top of the page, and the *\mark{}* clears any marks from previous *\section*'s (see below). Notice that *\aftertoc@* causes the page number to jump to the next odd number after the *\part* page, but the proper page for the *\part* will appear in the *.toc* file (compare page~\ref{AFTERTOC}); *\advancepageno* requires less work from \tex\ than *\Offset\Page2*, which could also have been used. We needed the globally defined *\Next@* here, since each line of the *\halign* is already within a group; although *\Next@* is used in various other \lamstex\ routines, none of them will be involved when we typeset (the *\uppercase*'d) *\HL@W* (for greater security, we could always use some new scratch token instead). Next we have \CC** \notocwrite@\NameHL1\chapter \newword\chapter{Chapter} \newif\iffirstchapterpage@ ** We need the new flag *\iffirstchapterpage@*, because initial pages of chapters will be treated specially, with no running heads, and page numbers at the bottom. As with the *paper* style, we also have the flag \CC** \newif\ifinsection@ ** Even-numbered pages will normally have the *\chapter* title at the top. However, we will allow ** \runningchapter{...} ** to be used before *\chapter* to specify a different running chapter (this change from version~*1*, where *\runningchapter* was supposed to occur after the *\chapter*, makes things much easier). We need a new flag to alert *\chapter* to the fact that *\runningchapter* has been used; the argument of *\runningchapter* will be stored in a token list, for reasons that will soon become apparent: \CC** \newif\ifrunningchapter@ \newtoks\runningchaptertoks@ \def\runningchapter#1{\global\runningchapter@true \runningchaptertoks@={#1}} ** The running heads at the top of odd-numbered pages will normally contain the most recent *\section* title, an arrangement that will require the use of *\mark*'s, except that we will use the *\chapter* title if no *\section* has appeared. *\chapter* is going to start a new page, issue an empty *\mark{}*, to clear *\mark*'s from the previous *\section*'s, and then define *\thechapter@* to be the desired running head on even-numbered pages. Just in case there are pages before a *\chapter*, we begin with \CC** \let\thechapter@=\relax ** We then define *\chapter*, via `*\HL@1*', by \CC** \expandafter\def\csname HL@1\endcsname#1\endHL{% \flush@ \global\insection@false "2 \ifrunningchapter@\else\runningchaptertoks@={#1}\fi \global\runningchapter@false "2 {\noexpands@ \xdef\thechapter@{\ifx\Thepref@\empty\else \Thepref@\null. \fi\the\runningchaptertoks@}}% \global\firstchapterpage@true "2 {\locallabel@ "2 \global\setbox1=\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 "2 {\HL@@F\ifx\thelabel@@\empty\else\thelabel@@\space\fi}% \ignorespaces#1\crcr}}% }% \unvbox1 \mark{}% \nobreak\vskip\baselineskip %\firstparflush@ } ** Note that: \Pitem As with `*\HL@0*,' we need to flush out any figures from the previous *\chapter*. \pitem The tokens *#1* are stored in the token list *\runningchaptertoks@*, unless *\runningchapter* has already been used, and has thus already\linebreak stored something in *\runningchaptertoks@*. After this decision for\linebreak *\runningchaptergtoks@* has been made, we can reset the flag\linebreak *\ifrunningchaptertoks@* to be false. \pitem Then *\thechapter@* is created by an *\xdef*, inside a group containing\linebreak *\noexpands@*, so that appropriate control sequences in *\Thepref@* are left alone. Even though we have an *\xdef*, our chapter title (or abbreviated title, specified by *\runningchapter*) appears as originally typed, since it is the value of *\the\runningchaptertoks@*---thus, we do not have to worry about expansion of control sequences in *\thechapter@*, and do not have to resort to the *\unmacro@\meaning* trick (this works because *\thechapter@* is not going to be written to a file, but merely typeset at the appropriate time). \pitem At the very end of the definition the line ** \firstparflush@ ** is designed to start the next paragraph unindented; it has been commented out, since it is not used in the *book* style, but other book styles might want to use it. \small The definition of *\firstparflush@*, for those styles that want it, is given immediately afterwards: \CC** \def\firstparflush@{\parindent=0pt \everypar{\global\parindent=10pt \global\everypar{}}} ** Thus, the first paragraph will be set with *\parindent* equal to~*0pt*, but this paragraph will set *\everypar*, for all successive paragraphs, to ** \global\parindent=10pt \global\everypar{} ** This means that *\parindent* will be *10pt* for the second paragraph, and, moreover, *\everypar* will be back to the empty list for the third paragraph. The *\global*'s are needed because a paragraph might start with something like ** {\it Consequently}, we see that ... ** \endsmall Having defined *\part* and *\chapter*, which set special flags *\ifpart@* and *\iffirstchapterpage@*, we also define *\footline*, which uses them, printing nothing at the bottom of *\part* pages, but a centered page number, in 9~point type at the bottom of the first page of each chapter. In essence we want ** \ninepoint\folio ** except that there is no *\ninepoint* command, merely *\ninerm* to switch to the 9~point roman font. So we have to use \CC** \footline={\ifpart@\hfil \else \iffirstchapterpage@\hfil \ninerm\page@S{\page@P\page@N{\number\page@C}\page@Q}\hfil \fi \global\firstchapterpage@false \fi} ** ---thus, *\newfontstyle\page* won't effect the page numbers at the bottom of initial chapter pages. At this point we also want to prevent any *\Aplace*'d material from occurring on the first page of each *\chapter*, by modifying *\advancedimtopins@*, as indicated on page~\ref{MODADT}: \CC** \def\advancedimtopins@{% \iffirstchapterpage@ \else \advance\dimen@ by \dimen\topins \global\dimen\topins=\dimen@ \fi} ** \section{\CS{plainoutput}}The *\part* and *\chapter* heading levels are the only ones that flush out figures, so now is the time to consider the necessary modifications to *\plainoutput*, as already indicated in section~\Sref{FLUSHF}. We are going to need a new flag and a new box, \CC** \newif\ifblankpage@ \newbox\topinsbox@ ** and also a counter in which we store the special penalty \setbox0\hbox{($={}$*-'10000000000*)} ** -1073741824 "box0 ** that \tex\ inserts when it sees *\end* (page~\ref{WEIRDPEN}): \CC** \newcount\endpenalty@ \endpenalty@=-'10000000000 ** Most of our extra manipulations will be done only when *\ifflush@* is true. However, we will also be doing extra manipulations when *\ifSflush@* is true and *\insertpenalties* is~*0* (which is when the additional ** \null\kern-\topskip\nobreak\vfill ** will create a blank page). So we first use ** \test@false \ifflush@\test@true \else\ifSflush@\global\Sflush@false \ifnum\insertpenalties=0 \test@true\fi \fi\fi ** to set *\iftest@* true in either of these cases, and reset *\ifSflush@* to false. Then, if this test is passed, we first test if *\box\footins* is void and also *\box\topins* is void or has height~*0pt*; and if that test is true, we then use the code on page~\ref{BPGTEST} to test whether *box255* is essentially blank, reducing the page number by~1, and setting *\ifblankpage@* true, if it is: ** \def\plainoutput{% \test@false \ifflush@\test@true \else\ifSflush@\global\Sflush@false \ifnum\insertpenalties=0 \test@true\fi \fi\fi \iftest@ "2 \test@false \ifvoid\footins \ifvoid\topins\test@true \else\ifdim\ht\topins=0pt\test@true \fi\fi "2 \fi \iftest@ "2 \setbox0=\vbox{\unvcopy255 \unskip\unpenalty\unkern \global\setbox1=\lastbox\unskip}% "2 \ifdim\ht0=0pt \ifdim\ht1=0pt \global\advance\pageno by -1 \global\blankpage@true \fi\fi "2 \fi \fi ** Then we could continue with the commands from the standard\linebreak *\plainoutput* routine: ** \specialsplit@false\ifvoid\topins\else\ifdim\ht\topins=0pt \specialsplit@true\advance\minpagesize by -\skip\topins\fi\fi \fliptopins@ \setbox\outbox@=\vbox{\makeheadline\pagebody\makefootline}% "2 {\noexpands@ \let\style=\relax \shipout@\box\outbox@ }% "2 \advancepageno \resetdimtopins@ \ifvoid 255 \else \unvbox 255 \penalty\outputpenalty\fi \ifnum\outputpenalty>-20000 \else\dosupereject\fi} ** That would insure that the page numbers don't increase for the spurious blank pages. But we can do better than that. If we replace the ** \shipout@\box\outbox@ ** with ** \ifblankpage@ \global\blankpage@false \else\shipout@\box\outbox@\fi ** then the spurious blank pages shouldn't even be printed. This seems to work fine at the end of all *\chapter*'s except when there are figures to be flushed out at the end of the last *\chapter*, before the *\bye* or *\enddocument*. In that case, after each round of the *\output* routine, which now increases *\deadcycles* by~*1*, since nothing is shipped out, \tex\ keeps adding ** \line{} \vfill \penalty -'10000000000 ** so that we eventually get an error message like ** ! Output loop---25 consecutive dead cycles. ** Page~264 of {\it The \tex book\/} says ``When \tex\ sees an *\end* command, it terminates the job only if the main vertical list has been entirely output and if *\deadcycles=0*. Otherwise it inserts the equivalent of ** \line{} \vfill \penalty-'10000000000 ** into the main vertical list, and prepares to read the `*\end*' token again.'' Apparently, the main vertical list has not been ``entirely output'' because *\box\topins* hasn't been shipped out. Emptying out *\box\topins* with something like ** \setbox0=\box\topins ** doesn't seem to help, so I resorted to ** \ifblankpage@ \ifnum\outputpenalty=\endpenalty@ \shipout\vbox{\hrule\width1pt\height0pt\box\topins}% \fi \global\blankpage@false \else \shipout@\box\outbox@ \fi ** which seems to work---the only adverse side-effect is the possibility of extra, totally blank, pages at the end. There is also one other modification that we need: instead of always using ** \setbox\outbox@=\vbox{\makeheadline\pagebody\makefootline} ** we use ** \ifblankpage@ \setbox\outbox@=\pagebody\else \setbox\outbox@=\vbox{\makeheadline\pagebody\makefootline}\fi ** The takes care of spurious blank pages that might be created by the first *\part* or *\chapter*, since *\makeheadline* or *\makefootline* might involve quantities that haven't even been determined yet. So the whole definition is: \CC** \def\plainoutput{% \test@false \ifflush@\test@true \else\ifSflush@\global\Sflush@false \ifnum\insertpenalties=0 \test@true\fi \fi\fi \iftest@ "2 \test@false \ifvoid\footins \ifvoid\topins\test@true \else\ifdim\ht\topins=0pt \test@true \fi\fi "2 \fi \iftest@ \setbox0=\vbox{\unvcopy255 \unskip\unpenalty\unkern \global\setbox1=\lastbox\unskip}% \ifdim\ht0=0pt \ifdim\ht1=0pt \global\advance\pageno by -1 \global\blankpage@true \fi\fi "2 \fi \fi "2 \specialsplit@false \ifvoid\topins\else \ifdim\ht\topins=0pt \specialsplit@true \advance\minpagesize by -\skip\topins \fi\fi "2 \fliptopins@ "2 \ifblankpage@ \setbox\outbox@=\pagebody\else \setbox\outbox@=\vbox{\makeheadline \pagebody\makefootline}% \fi "2 {\noexpands@ \let\style=\relax \ifblankpage@ \ifnum\outputpenalty=\endpenalty@ \shipout\vbox{\hrule\width1pt\height0pt \box\topins}% \fi \global\blankpage@false "2 \else \shipout@\box\outbox@ \fi}% "2 \advancepageno "2 \resetdimtopins@ \ifvoid 255 \else \unvbox 255 \penalty\outputpenalty\fi \ifnum\outputpenalty>-20000 \else \dosupereject \fi} ** \small For the clause ** \ifblankpage@ \setbox\outbox@=\pagebody\else \setbox\outbox@=\vbox{\makeheadline \pagebody\makefootline} \fi ** I originally had simply ** \ifblankpage@\else \setbox\outbox@=\vbox{\makeheadline \pagebody\makefootline} \fi ** But this lead to the dead cycles error message, though I don't understand why. \andsmall! Since the extra test in *\plainoutput* always regards a ``blank'' page as a mistake, actual blank pages can't be produced with something like \setbox0\hbox{or} ** \newpage\null\vfill\break "box0 \pagebreak\null\vfill\break ** but we can use something like ** \newpage\blankpage ** where we have defined \CC** \def\blankpage{\null\null\vfill\break} ** just in case that's needed. [Of course ** \Aplace{\Figure\Hbyw{...}\endFigure} ** possibly with a *\caption*, would be used if a blank page were required for a picture, the most usual reason for such a request. Also, ** \NoFlushedFigs \newpage\null\vfill\break ** would work.] \endsmall \section{Other heading levels} *\appendices* is treated exactly as in the *paper* style, so we won't repeat the definition here. Next we have \CC** \notocwrite@\Namehl1\section \newstyle\section#1{#1\null.} ** as in the *paper* style. The running heads at the top of odd-numbered pages will normally contain the most recent *\section* title, except that we will use the *\chapter* title if no *\section* has yet appeared. We also want to allow *\runningsection* to be used before *\section* (again a change from version~*1*), which is treated just like *\runningchapter*: \CC** \newif\ifrunningsection@ \newtoks\runningsectiontoks@ \def\runningsection#1{\global\runningsection@true \runningsectiontoks@{#1}} ** In the definition of *\section*, via `*\hl@1*', instead of defining\linebreak *\thechapter@*, we need to make an appropriate *\mark*; since *\mark*'s are expanded, this requires a little more care, using now familiar tricks: ** {\noexpands@ \edef\next@{\toks@={\ifx\Thepref@\empty\else \Thepref@\null. \fi \the\runningsectiontoks@}}% \next@ \mark{\the\toks@}} ** Here the *\edef\next@* makes *\next@* mean \setbox0\hbox{\<*\section* number\>} \setbox1\hbox{\<*\section* title\>} ** \toks@="box0. "box1 ** so that *\next@* actually assigns *\toks@* that value, and then ** \mark{\the\toks@} ** produces the *\mark*, with no further expansions. The whole definition is \CC** \expandafter\def\csname hl@1\endcsname#1{% \global\insection@true "2 \medbreak \ifrunningsection@\else\runningsectiontoks@{#1}\fi \global\runningsection@false "2 \noindent@@ "2 {\noexpands@ \edef\next@{\toks@{\ifx\Thepref@\empty\else \Thepref@\null. \fi \the\runningsectiontoks@}}\next@ \mark{\the\toks@}}% "2 {\locallabel@ {\hl@@F\ifx\thelabel@@\empty\else\thelabel@@\space\fi}\bf \ignorespaces#1\unskip\punct@{\null.}\addspace@\enspace}% \par\nobreak\smallskip} ** *\section* is the only heading level that will produce *\mark*'s, except for *\chapter*, which emits *\mark{}*; so we should now define *\headline*. On odd-numbered pages this will usually involve *\botmark*, unless *\botmark* is empty, in which case we will use *\thechapter@*. However, *\botmark* being ``empty'' cannot be checked using the test *\ifx\botmark\empty*, which is never true, since *\botmark* is a primitive that is not equivalent to *\empty*. So we first define a routine \CC** \def\BotOrChap@#1\BotOrChap@{% \def\next@{#1}\ifx\next@\empty\thechapter@ \else\ignorespaces#1\unskip\fi} ** which will be used after an *\expandafter* in the definition \CC** \headline={\unlabel@ \noset@ \def\\{\unskip\space\ignorespaces}% \ifpart@\hfil "2 \else \iffirstchapterpage@\hfil "2 \else \ifodd\pageno \hfil \smc\expandafter\BotOrChap@\botmark\BotOrChap@ \hfil \llap{\tenpoint\folio}% "2 \else \rlap{\tenpoint\folio}% \hfil\smc\thechapter@ \hfil \fi \fi\fi} ** The *\unlabel* and *\noset* are used in case some *\Reset* or *\Offset* or some *\label* or *\pagelabel* appeared within a *\chapter* or *\section* title. The definition of *\\* is provided for an unedited *\\* in a *\chapter* title. *\subsection*, *\topic* and *\subtopic* are handled just as in the *paper* style, so we won't repeat the definitions here. The initializations for *\chapter* are a little more complicated than in the *paper* style: \CC** \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{}% "2 \else \newpre\section{\pref.}\edef\tag@P{\pref.}% \edef\claim@P{\pref.}\edef\island@P{\pref.}% \fi } ** As before, we reset the *\section* counter to~*1* (there is no *\keepsection* command for this style). Moreover, we also want the numbering for displayed formulas, *\claim*'s, *\Figure*'s and *\Table*'s to be reset to~*1*. If *\pref* is *\empty* (only because the user has typed something like *\chapter""""*), then the ``pre'' material for *\section*, *\tag*, *\claim* and all types of *\island* numbers should be empty; otherwise it should be the *\chapter* number followed by a period. Notice that we explicitly use *\edef\tag@P{\pref.}*, \dots, rather than *\newpre*, since that takes less \tex\ processing, but we definitely want *\newpre\section*, since that takes care of *\newpre\hl1* automatically. The initializations for other heading levels are the same as in the *paper* style. \section{Footnotes}*\vfootnote@* is redefined exactly as in the *paper* style, to get footnotes in 8~point type. \section{Bibliography} Although *\makebib* isn't allowed in the *book* style, *\UseBibTeX* is allowed, causing an *.aux* file to be written, on which \bibtex\ can operate, thereby creating a *.bbl* file that can be used by the ``back matter file''. The definition from *lamstex.tex* has to be changed so that *\bibliography{...}* only writes *\bibdata{...}* to the *.aux* file, without trying to read the *.bbl* file. Also, *\bibliography@W* shouldn't be defined, since ** \newword\bibliography ** shouldn't be allowed in the main file, only in the back matter file. \CC** \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}}}} ** \section{{\tt book.stf}} The front matter style file *book.stf* does not require a mechanism to prevent it from being read in twice. Aside for this, it begins with the same basic settings as *book.st* itself, including the redefinition of *\makeheadline* and *\makefootline*. It also specifies \CC** \newnumstyle\page\roman ** and then loads the same fonts as *book.st*, and defines *\tenpoint* and *\eightpoint* as in that file. Two new fonts \CC** \font\Bf=cmbx10 scaled \magstep1 \font\BF=cmbx10 scaled \magstep3 ** are also loaded; *\BF* is used for the `CONTENTS' headings, etc., while *\Bf* is used for the Part entries in the table of contents (Chapter entries will be printed in ordinary *\bf* and other heading level entries in *\rm*). Pages with *\BF* headings are handled specially, with no running heads, and page numbers at the bottom, and we have the flag \CC** \newif\ifspecialpage@ ** to indicate such pages. The material for running heads will be stored in *\headline@*, initialized by \CC** \let\headline@=\relax ** The *\makepiece* command is supplied for special pieces like a Preface: \CC** \def\makepiece#1{\par\vfill\break \global\specialpage@true \gdef\headline@{\ignorespaces#1\unskip}% \centerline{\BF\uppercase{\ignorespaces#1\unskip}}% \vskip30pt plus10pt minus 10pt} ** The argument *#1* is stored in *\headline@*, which will be used in the running heads of this piece, except for the first page. Here we assume that the heading fits on a single line. A variant ** \makepiece#1\endmakepiece ** command, allowing *\\* to indicate line breaks, could be specified in an obvious way. If this were allowed, then there should probably be a ** \runningpiece ** command to specify a shortened form for the running heads. This would work like the *\runningchapter* command. As with *paper.st*, for *\maketoc* we now how to include many of the definitions from *lamstex.stf*: \CC** \def\dotleaders ... \def\Page@ ... \long\def\widerthanhsize@ ... "2 \long\def\setentry@ ... "2 \def\endstrut@ ... \newdimen\thehang@ "2 \long\def\longentry@ ... "2 \newif\ifemptynumber@ \def\Style@ ... . . . \def\Style@@@@ ... ** *\digits* isn't used, because the *\hl* entries are set differently. Because the *\Style@ . . . \Style@@@@* complex involves *\style*, which will be set to *\HL@@S* or *\hl@@S*, we need to provide definitions for all cases that will occur: \CC** \expandafter\def\csname HL@S0\endcsname#1{#1\/} \expandafter\def\csname HL@S1\endcsname#1{#1\null.} \expandafter\def\csname hl@S1\endcsname#1{#1\null.} \expandafter\def\csname hl@S2\endcsname#1{#1\null.} \expandafter\def\csname hl@S3\endcsname#1{#1\/} \expandafter\def\csname hl@S4\endcsname#1{#1\/} ** As in *paper.st*, we \CC** \def\maketoc@W{Contents} ** We will also need a new flag \CC** \newif\ifbib@ ** for one part of the contents. The definition of *\maketoc* is something of a cross between the definitions in *lamstex.stf* (page~\ref{STFMAKETOC}) and *paper.st* (section~\Sref{Pmaketoc}), adding extra information needed for running heads and *\footline*: \setbox0\hbox{\} \CC** \def\maketoc{\checkmainfile@\par\vfill\break \begingroup \unlabel@ . . . \lineskiplimipt=0pt \def\HL ... \def\hl ... \def\NameHL ... \def\Namehl ... \NameHL0\part . . . \Namehl4\subtopic "box0 "box1 \global\specialpage@true \gdef\headline@{\maketoc@W}% \centerline{\BF\uppercase\expandafter\maketoc@W}}% \vskip30pt plus10pt minus10pt \input\mainfile@.toc \endgroup} ** The \ starts with ** \def\makebib##1\Page##2##3##4##5{\bigbreak\bigskip\bigskip \setentry@{\Bf##1}{}{\dotleaders}% {\Page@{##2}{##3}{##4}{##5}}% \bib@true}% ** This definition is added for the situation where a *\makebib* in the ``back matter file'' (see the next section) creates an entry in the *.toc* file for the back matter file, which is then transferred to the *.toc* file for the main file. Then we ** \let\biliography=\makebib ** in case *\bibliography* appears instead of *\makebib*; this is for the situation where *\UseBibTeX* appeared in the main file, so that a *.bbl* file was created, and the corresponding entry in the *.toc* file for the back matter file was transferred to the *.toc* file for the main file. Similarly, we add ** \def\makeindex##1\Page##2##3##4##5{\ifbib@\bigskip\else \bigbreak\bigskip\bigskip\fi \setentry@{\Bf##1}{}{\dotleaders}% {\Page@{##2}{##3}{##4}{##5}}}}% ** in case a *\makeindex* in the *.toc* file for the back matter file is transferred to the *.toc* file for the main file. Note that the spacing before this entry depends on whether or not a *\makebib* or *\bibliography* has already appeared. The definition of *\HL* in the above definition has an extra clause for *\part*'s: ** \ifnum\HLlevel@=0 \bigbreak\bigskip "2 \begingroup \def\\{\unskip\space\ignorespaces}% "2 \setentry@{\Bf\def\next@{##2}\ifx\next@\empty\else \uppercase{##2} \fi \let\style=\HL@@S\hbox to35pt{\Style@##3\Style@\hss}\ifemptynumber@ \nobreak\hskip-35pt\fi \uppercase{\ignorespaces##4\unskip}}{}\hfil{}% "2 \endgroup \nobreak\smallskip "2 \else \ifnum\HLlevel@=1 . . . \else \Err@ ... \fi} ** So the first argument of *\setentry@* contains the \medskip\font\Bf=cmbx10 scaled \magstep1 \leftline{\Bf PART \hbox to35pt{I\hfil} PART TITLE} \medskip \noindent with the Part title, in *\uppercase*, starting 35~points from the word `PART' (but if there is no part number, we *\hskip* back 35~points). We use\linebreak *\uppercase{#2}*, since, as mentioned on page~\ref{UCPART}, the *.toc* file has `*\HL@W0*', which is `*Part*', rather than `*PART*', allowing other front matter style files to handle things differently. The second argument (which normally would be the part title) is empty; the third argument, normally *\dotleaders* is *\hfil*, and the fourth argument, normally *\Page...* is also empty, so that `Part' entries are printed without dot leaders or page numbers. \medskip Similarly, the definition of *\makelist* in *book.stf* is almost the same as that in *lamstex.stf*, except that we add ** \global\spsecialpage@true \gdef\headline@{\ignorespace#2\unskip} ** and use ** \BF\baselineskip=22pt ** for setting the heading instead of *\bf*. Finally, *\footline* and *\headline* are reset as in *book.st*, except using the flag *\ifspecialpage@* rather than the flags *\ifpart@* and\linebreak *\iffirstchapterpage@*. \section{{\tt book.stb}} The back matter style file *book.stb* also begins with the same basic settings as *book.st*, except that redefinition of *\makeheadline* and *\makefootline* is deferred; and then it loads the same fonts as before. Then we have numerous definitions from *lamstex.stb*: \CC** \def\adjustpunct@ ... \def\ignorepars@ ... \def\ignorepars@@ ... "2 \newcount\ctype@ \newcount\Ctype@ "2 \newif\ifleftcolbreak@ \def\cbreak@ ... "2 \newif\ifletter@ \newtoks\marktoks@i . . . \newtoks\marktoks@v "2 \newif\ifentry@ \newcount\dii@ \def\Topage@ ... ** as well as \CC** \newdimen\pageheight@ \pageheight@=\vsize "2 \newdimen\doublepageheight@ \doublepageheight@=2\pageheight@ \advance\doublepageheight@ by 1pc "2 \newdimen\pagewidth@ \pagewidth@=\hsize ** and then we redefine *\makeheadline* and *\makefootline* in terms of *\pagewidth@*: \CC** \def\makeheadline{% \hbox{\botsmash{\hbox to\pagewidth@ {\vbox to8.5pt{}\the\headline}}}% \nointerlineskip\vskip26pt} \def\makefootline{\baselineskip=2.5pc\relax \hbox to \pagewidth@{\the\footline}} ** As in *lamstex.stb*, we will need a new flag for the first page of the index, \CC** \newif\iffirstindexpage@ ** Recall that in *lamstex.stb* it is the definition of *\combinecolumns@* that actually prints the heading at the top of the first page. The same is true in *book.stb*, so we first \CC** \def\makeindex@W{Index} ** and declare the font \CC** \font\Bf=cmbx10 scaled \magstep1 ** Then the definition of *\combinecolumns@* from *lamstex.stb* is modified as follows: \CC** \def\combinecolumns@{% \setbox\outbox@=\vbox{\makeheadline \vbox to\pageheight@{\boxmaxdepth=\maxdepth \iffirstindexpage@ \vbox to30pt{% \hbox to\pagewidth@{\hfil\Bf \uppercase\expandafter{\makeindex@W}\hfil}% \vfil}% \nointerlineskip \fi \wd0=\hsize \wd2=\hsize \setbox0=\hbox to\pagewidth@{\box0 \kern1pc \box2}% \dimen@=\dp0 \box0 \kern-\dimen@\vfill}% \makefootline}% {\noexpands@\let\style=\relax \shipout@\box\outbox@ }% \global\vsize=\doublepageheight@ \global\firstindexpage@false \advancepageno} ** Then we continue with other material from *lamstex.stb*: \CC** \newdimen\prevcoldepth@ \def\doublecolumns@ ... \def\continue@ ... \newif\ifshortlastcolumn@ \def\balancecolumns@ ... ** With these definitions---used mainly for the index---out of the way, we first start on the bibliography. As with *book.stf*, we need \CC** \newif\ifspecialpage@ \let\headline@=\relax ** The definition of *\makebib* is similar to that in *paper.st*, except that we also write to the *.toc* file (compare page~\ref{XXZZXX}): \C** \def\makebib{\par\vfill\break \global\specialpage@true \gdef\headline@{\makebib@W}% "2 \begingroup "2 \eightpoint "2 \sfcode`\.=1000 \everypar{}\parindent=0pt "2 \def\nopunct{\nopunct@true} \def\nospace{\nospace@true}% \nopunct@false\nospace@false "2 \def\lkerns@{\null\kern-1sp\kern1sp}% \def\nkerns@{\null\kern-2sp\kern2sp}% "2 \hbox to\pagewidth@ {\hfil\Bf\uppercase\expandafter{\makebib@W}\hfil}% "2 \iftoc@ \expandafter\unmacro@\meaning\makebib@W\unmacro@ {\noexpands@ \edef\next@{\write\toc@{\noexpand\noexpand \noexpand\makebib{\macdef@}}}\next@}% \write\toc@{\noexpand\Page {\number\pageno}{\page@N}{\page@P}{\page@Q}^^J}% \fi \nobreak\bigskip} ** \medskip If *\UseBibTeX* was specified in the main file, and a *.bbl* file was created, then instead of a *\makebib"allowbreak..."allowbreak\endmakebib* region, the user can simply type ** \bibliography ** (but with no argument). We will need to define \CC** \def\bibliography@W{Bibliography} ** so that ** \newword\bibliography ** can be used prior to this (in *lamstex.tex* this definition is made by\linebreak *\UseBibTeX*, which won't appear in the back matter file). The redefinition of *\bibliography*, with no argument, will begin with\linebreak *\checkmainfile@*, since *\mainfile@.bbl* is the file we will want to *\input*: \CC** \def\bibliography{\checkmainfile@ \immediate\openin\bbl@=\mainfile@.bbl \ifeof\bbl@ \W@{No .bbl file}% \else \immediate\closein\bbl@ \begingroup \input bibtex \input\mainfile@.bbl \endgroup \fi}% ** Recall that *bibtex.tex* defines *\begin{thebibliography}{...}* in\linebreak terms of *\begingthebibliography@{...}*, which now has to be redefined to give the same sort of information and formatting as *\makebib* for this file: \CC** \def\beginthebibliography@#1{\par\vfill\break \global\specialpage@true \gdef\headline@{\makebib@W}% "2 \eightpoint \setbox0=\hbox{#1\ }\bibindent@=\wd0 \sfcode`\.=1000 \everypar{}\parindent=0pt "2 \hbox to\pagewidth@ {\hfil\Bf\uppercase\expandafter{\bibliography@W}\hfil}% "2 \iftoc@ \expandafter\unmacro@\meaning\makebib@W\unmacro@ {\noexpands@ \edef\next@{\write\toc@{\noexpand\noexpand \noexpand\bibliography{\macdef@}}}\next@}% \write\toc@{\noexpand\Page {\number\pageno}{\page@N}{\page@P}{\page@Q}^^J}% \fi \nobreak\bigskip} ** The definition of *\makeindex* is virtually the same as in *lamstex.stb*, except that we again write to the *.toc* file, and set up information for the heading levels and foot line, \setbox0\hbox{\