% lists.tex \ifx\trivlist\UNDEFINED\else\endinput\fi \ifx\noindentifnofollpar\UNDEFINED \gdef\noindentifnofollpar{\futurelet\next\noindentifnofollparII}% \gdef\noindentifnofollparII{\ifx\next\par\else \noindent\ignorespaces\fi}% \fi \def\trivlist{\trivlistskip\begingroup\vskip0pt} \def\endtrivlist{\vskip0pt\endgroup\trivlistskip \noindentifnofollpar} \def\trivlistskip{\smallskip} \def\indentenv{\advance\leftskip by \parindent} \def\skipbetweenitems{\relax} %\def\skipbetweenitems{\vskip.5\smallskipamount} \def\quotation{\trivlist\indentenv\noindent} \def\endquotation{\endtrivlist} \def\itemizeitem#1{\ifvmode \skipbetweenitems\noindent\fi \hskip-\parindent \setbox0\hbox{#1\enspace}% \ifdim\wd0>\parindent \box0\par\nobreak\noindent\else \hbox to\parindent{\hfill\unhbox0}\fi \ignorespaces} \def\itemize{\trivlist\indentenv \let\item\itemizeitem} \def\enditemize{\endtrivlist} \def\begin#1{\csname #1\endcsname \let\end\endenvironment} \def\endenvironment#1{\csname end#1\endcsname} \def\beginsection#1\par{\bigbreak\noindent {\bf#1}\medskip\noindent} % verb.tex \let\verbatimfont\tt \def\setupverbatim{% \def\do##1{\catcode`##1=12\relax}% \catcode`@=12 \dospecials \verbatimfont \makeverbatimspace \makeverbatimlq \let\successivenewlines0% \def\par{\ifvmode\ifx\successivenewlines0% \let\successivenewlines1\medskip\fi\else \let\successivenewlines0\endgraf\fi}% \obeylines} \begingroup \catcode`\ \active% \gdef\makeverbatimspace{% \catcode`\ \active% \def {\leavevmode\ }}% \endgroup \def\makeverbatimlqactive{\catcode``=\active} \begingroup \catcode``=\active \gdef\makeverbatimlq{\makeverbatimlqactive \let`\lq}% \endgroup \def\verb{\begingroup \setupverbatim \verbI} % \def\verbI#1{\catcode`#1\active % \begingroup % \lccode`\~`#1% % \lowercase{\endgroup\let~\endverb}} \begingroup\catcode`\<1\catcode`\>2 \catcode`\{12 \gdef\verbI#1<% \if#1{\catcode`\}\active\begingroup\lccode`\~`\}\else \catcode`#1\active\begingroup\lccode`\~`#1\fi \lowercase<\endgroup\let~\endverb>>% \endgroup \def\endverb{\ifvmode \def\next{\endgroup\noindentifnofollpar}\else \let\next\endgroup\fi\next} \ifx\noindentifnofollpar\UNDEFINED \gdef\noindentifnofollpar{\futurelet\next\noindentifnofollparII}% \gdef\noindentifnofollparII{\ifx\next\par\else \noindent\ignorespaces\fi}% \fi \begingroup \catcode`\ \active% \catcode`\^^M\active% \gdef\path{\begingroup% \setupverbatim% \catcode`\ \active% \catcode`\^^M\active% \def {\discretionary{}{}{}}% \def^^M{\discretionary{}{}{}}% \verbI}% \endgroup \def\verbatimfile#1{\begingroup \setupverbatim \par \input #1 \par \endverb} % indexmac.tex % \input indexmac before first use of the \index control % sequence. Your TeX source contains \index{name} to % signal that name should be included in the index. % Check the makeindex documentation to see the various % ways `name' can be specified, e.g., for subitems, for % explicitly specifying the alphabetization for a name % involving TeX control sequences, etc. % % The first run of TeX will create \jobname.idx. % makeindex on \jobname[.idx] will create the sorted % index \jobname.ind. % % Use \inputindex (without arguments) to include this % sorted index, typically somewhere to the end of your % document. This will produce the items and subitems. % You will have to typeset a section heading (typically % ``Index'') yourself. \newwrite\indexout \openout\indexout \jobname.idx \def\sanitizeidxletters{\def\do##1{\catcode`##1=11 }% \do\\\do\$\do\&\do\#\do\^\do\_\do\%\do\~% \do\@\do\"\do\!\do\|\do\-\do\ \do\'} \def\index{\unskip\begingroup \sanitizeidxletters \indexI} \def\indexI#1{\endgroup \write\indexout{\string\indexentry{#1}{\folio}}} % The following index style indents subitems on a % separate lines \def\theindex{\begingroup \parskip0pt \parindent0pt \def\indexitem##1{\par\hangindent30pt \hangafter1 \hskip ##1 } \def\item{\indexitem{0em}}% \def\subitem{\indexitem{2em}}% \def\subsubitem{\indexitem{4em}}% \let\indexspace\medskip} \def\endtheindex{\endgroup} \def\inputindex{% \immediate\openin0 \jobname.ind \ifeof0 \immediate\closein0 \message{Use makeindex to generate index file.} \else\immediate\closein0 \begingroup \def\begin##1{\csname##1\endcsname}% \def\end##1{\csname end##1\endcsname}% \input\jobname.ind \endgroup \fi} % xref.tex % Cross references % % \tag{TAG}{VALUE} ties TAG to VALUE. TAG can contain % letters, digits, and the characters taken care of in % \sanitizexrefletters. Don't try using { and }. % % \ref{TAG} gets the VALUE associated with TAG % ``Forward'' references will not be resolved on the % first pass of TeX --- a ? will show up where VALUE % should. It will be resolved on a second pass. % % \pagetag{TAG} ties PAGETAG to the current page number. % % \pageref{TAG} gets the pagenumber for PAGETAG.n % % \label{TAG}{VALUE} ties TAG to VALUE, and PAGETAG to % the current pagenumber. \def\readxreffile{\begingroup \openin0 \jobname.xrf \ifeof0 \closein0 \else\closein0 \input\jobname.xrf \fi} \newwrite\xrefout \openout\xrefout \jobname.xrf \def\sanitizexrefletters{\def\do##1{\catcode`##1=11 }% \do\\\do\$\do\&\do\#\do\^\do\_\do\%\do\~% \do\@\do\"\do\!\do\|\do\-\do\:\do\ \do\'} \def\crossreference{\begingroup \sanitizexrefletters \crossreferenceI} \def\crossreferenceI#1{\endgroup\gdef \csname XREF#1\endcsname} \def\crossreference#1{\expandafter\gdef \csname XREF#1\endcsname} \def\tag{\unskip\begingroup \sanitizexrefletters \tagI} \def\tagI#1{\endgroup \tagII{#1}} \def\tagII#1#2{\write\xrefout{\string\crossreference{#1}{#2}}% \ignorespaces} \def\ref{\begingroup \sanitizexrefletters \refI} \def\refI#1{\endgroup \expandafter\ifx\csname XREF#1\endcsname\relax ?\else\csname XREF#1\endcsname\fi} \def\pagetag{\unskip\begingroup \sanitizexrefletters \pagetagI} \def\pagetagI#1{\endgroup \tagII{PAGE#1}{\folio}} \def\pageref{\begingroup \pagerefI} \def\pagerefI#1{\endgroup \refI{PAGE#1}} \def\label{\unskip\begingroup \sanitizexrefletters \labelI} \def\labelI#1{\endgroup \tagII{PAGE#1}{\folio}% \tagII{#1}} \readxreffile \newcount\footnotenumber \def\nfootnote{\unskip \global\advance\footnotenumber1 \footnote{$^{\the\footnotenumber}$}} % mcol.tex %extracted from Karl Berry's xeplain.tex \catcode`@=11 % Double column output. % % \doublecolumns begins double column output. It can be called % in the midst of a page. \singlecolumn restores single column % output. (It would be wrong to require \enddoublecolumns, because % often one wants double column mode to continue to the end of % the document.) % % The basic approach is that of Appendix E of the TeXbook, p.417. % David Guichard made significant improvements to my original implementation. % % The glue here (the default is intended to be one linespace) is inserted % before double columns start, and after they end. % \newskip\abovecolumnskip \abovecolumnskip = \bigskipamount \newskip\belowcolumnskip \belowcolumnskip = \bigskipamount % % Space between the columns. It can be changed as desired. \newdimen\gutter \gutter = 2pc % % These registers are needed for dealing with switching back and forth. \newbox\@partialpage \newdimen\@columnhsize \newdimen\@normalhsize \newdimen\@normalvsize \newtoks\previousoutput % % Some synonymous ways to refer to multiple column modes. \def\quadcolumns{\@columns4}% \def\triplecolumns{\@columns3}% \def\doublecolumns{\@columns2}% \def\begincolumns#1{\ifcase#1\relax \or \singlecolumn \or \@columns2 \or \@columns3 \or \@columns4 \else \relax \fi}% \let\endcolumns = \singlecolumn \let\@ndcolumns = \relax % % Set this by default so \vfootnote can unconditionally inspect it. \chardef\@numcolumns = 1 % % Start typesetting with #1 columns. \def\@columns#1{% \@ndcolumns % \let\@ndcolumns = \@endcolumns \chardef\@numcolumns = #1 % \par % Shouldn't start in horizontal mode. \previousoutput = \expandafter{\the\output}% % % Figure out how wide the columns should be -- for n columns, % decrement by n - 1 gutters. \@columnhsize = \hsize \count@ = \@numcolumns \advance\count@ by -1 \advance\@columnhsize by -\count@\gutter \divide\@columnhsize by \@numcolumns % % Set up to grab the page so far and save it in \@partialpage. \output = {\global\setbox\@partialpage = \vbox{\unvbox255\vskip\abovecolumnskip}% }% % % \pagegoal is the size that TeX will make \box255. We want a box % exactly the size of the current height of the page, i.e., \pagetotal. \pagegoal = \pagetotal % % Expand the \output we just defined. \eject % % Reset \output to prepare for the first real page break. \output = {\@columnoutput}% \@normalhsize = \hsize \@normalvsize = \vsize \hsize = \@columnhsize % % Compute \vsize based on what's already on the page % and the number of columns. Also change the mag factor for insertions. \advance\vsize by -\ht\@partialpage % \advance\vsize by -\ht\footins \ifvoid\footins\else \advance\vsize by -\skip\footins \fi \multiply\count\footins by \@numcolumns % \advance\vsize by -\ht\topins \ifvoid\topins\else \advance\vsize by -\skip\topins \fi \multiply\count\topins by \@numcolumns % \global\vsize = \@numcolumns\vsize }% % % When this is invoked box 255 contains just the right amount of % material, whether triggered by an output routine or a change in the % number of columns. Because columns have to contain an integral number % of lines of type, we take a bit of care with balancing the heights of % the columns to prevent either losing material or having a very short % last column. % % when a page ends due to \bye or \eject, box 255 will contain lots of % white space, so the columns will not look balanced. To fix this use % \singlecolumn before ending the page. % \def\@columnsplit{% \splittopskip = \topskip \splitmaxdepth = \baselineskip % % \dimen@ will be the height that the double-column material on this % page should have, i.e., the height of the page (\singlecolumvsize) % minus single-column material, which includes insertions. (If you % want your insertions to respect the columns, you will have to % change the output routine.) If you add more insertions, they % should be taken into account both here and in \singlecolumn. % % Unfortunately, we lose on flexible glue because we must % \vsplit to a . \dimen@ = \ht255 \divide\dimen@ by \@numcolumns % % Split the long scroll into columns. \begingroup % We do not want to see underfull \vbox messages unless the final % page is underfull. \vbadness = 10000 % % The first (leftmost) column. \global\setbox1 = \vsplit255 to \dimen@ \global\wd1 = \hsize % % The second column. \global\setbox3 = \vsplit255 to \dimen@ \global\wd3 = \hsize % \ifnum\@numcolumns > 2 % The third column, if requested. \global\setbox5 = \vsplit255 to \dimen@ \global\wd5 = \hsize \fi \ifnum\@numcolumns > 3 % The fourth column, likewise if requested. \global\setbox7 = \vsplit255 to \dimen@ \global\wd7 = \hsize \fi \endgroup % % Preserve what's left over. \setbox0 = \box255 % % Set up \box255 with the real output page, as the previous output % routine expects. \global\setbox255 = \vbox{% \unvbox\@partialpage \ifcase\@numcolumns \relax\or\relax \or \hbox to \@normalhsize{\box1\hfil\box3}% \or \hbox to \@normalhsize{\box1\hfil\box3\hfil\box5}% \or \hbox to \@normalhsize{\box1\hfil\box3\hfil\box5\hfil\box7}% \fi }% % % Save what's left over in a private register before calling their % output routine. \setbox\@partialpage = \box0 }% % % Our output routine splits the columns and then calls the previous one. % \def\@columnoutput{% \@columnsplit \hsize = \@normalhsize % Local to \output's group. \vsize = \@normalvsize \the\previousoutput % % Put back what didn't fit. \unvbox\@partialpage \penalty\outputpenalty % % The correct vsize is the original vsize times the % number of columns. \global\vsize = \@numcolumns\@normalvsize }% % % Go back to single-column typesetting. Assume \doublecolumns has % been called. % \def\singlecolumn{% \@ndcolumns \chardef\@numcolumns = 1 \vskip\belowcolumnskip \nointerlineskip }% % \def\@endcolumns{% \global\let\@ndcolumns = \relax \par % Shouldn't start in horizontal mode. % \global\output = {\global\setbox1 = \box255}% \pagegoal = \pagetotal \eject % Exercise the page builder, i.e., \output. \global\setbox255 = \box1 % Retrieve what the fake \output set. % % \box255 now has the double-column material. On the page where we % switch back to one column, the double-column material might not % fill up the page. We want to split whatever is there. \@columnsplit % \global\vsize = \@normalvsize \global\hsize = \@normalhsize \global\output = \expandafter{\the\previousoutput}% % \ifvoid\topins\else\topinsert\unvbox\topins\endinsert\fi \unvbox255 }% % % We don't have any way to force a column eject, since the \output % routine is only prepared to split up a full page of material. Instead, % we provide the following as a guess at enough space to fill up the % current column. \def\columnfill{% \dimen@ = \@normalvsize \advance\dimen@ by -\pagetotal \kern\dimen@ } % % \let\endcolumns\singlecolumn