Mercurial > hg > Applications > mh
diff papers/doclib/diss.sty @ 0:bce86c4163a3
Initial revision
author | kono |
---|---|
date | Mon, 18 Apr 2005 23:46:02 +0900 |
parents | |
children | 441a2190cfae |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/papers/doclib/diss.sty Mon Apr 18 23:46:02 2005 +0900 @@ -0,0 +1,2164 @@ +% UCI Dissertation Style for AmSTeX. +% @(#)$Id$ + +% Tim Morgan with many suggestions, bug fixes, etc, from Marshall Rose +% Based originally on Michael Spivak's AMSPPT.STY. + +% When edits are made to this file, the version number should be incremented. +\def\version{103} +\let\fmtversion=\version % These two control sequences are defined +\def\fmtname{dissertation} % in plain.tex, so we do it here too. + +% Assumes the following hidden definitions from plain.tex: +% \z@ is defined from plain.tex as 0pt (and magically can +% be used as the integer constant 0 also). +% \p@ is the same, but 1pt +% \@ne is 1 +% \m@ne is -1 +% \tw@ is 2 +% \thr@@ is 3 +% \@m is 1000 +% \@M is 10000 +% And the following scratch register definitions: +% \dimen@ is \dimendef'd to be \dimen0 +% \skip@ is \skipdef'd to be \skip0 +% \count@ is \count255 + +\catcode`\@=11 % So we can use a special character + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% PARAMETERS DIFFERENT THAN IN PLAIN % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% These are words which TeX doesn't hyphenate perfectly. +% Unfortunately, the plural forms must be included also. +\hyphenation{com-put-er com-mun ap-pen-dix cart-wheel data-base Dijk-stra} +\hyphenation{in-fra-struc-ture man-u-script mi-cro-fiche para-mil-i-tary} +\hyphenation{post-am-ble pre-am-ble sub-scrib-er wave-guide sub-scrib-ers} +\hyphenation{com-put-ers cart-wheels data-bases in-fra-struc-tures} +\hyphenation{man-u-scripts mi-cro-fiches post-am-bles pre-am-bles} +\hyphenation{buf-fer buf-fers des-ig-na-ted par-a-graph par-a-graphs} +\hyphenation{key-stroke key-strokes usu-al-ly} + + +\def\normal@topskip{0.48cm} +\topskip=\normal@topskip % For correct page positioning, do NOT +\hoffset=0.5in % change any of these values!!! +\voffset=0.07cm +\hsize=15.2cm +\vsize=22.2cm + +\normallineskiplimit=\p@ % Min. dist. btw. lines. +\parindent=1cm % Normal indentation. +\hfuzz=0.115\p@ % So we hear fewer complaints. Good up to +\vfuzz=0.115\p@ % 300 dpi. + +\pretolerance=200 % At 12pt, these margins are kind of narrow +\tolerance=300 % so we have to be more tolerant. +\clubpenalty=\@M % Never allow these. +\widowpenalty=\@M +\newlinechar=`\^^J % For writing output to tty. +\uchyph=\z@ % Don't take any chances. +\brokenpenalty=\@M % Never hyphenate last line on a page. +\newcount\defaultinterlinepenalty % This probably won't make any +\defaultinterlinepenalty=\thr@@ % difference, so why not?? +\interlinepenalty=\defaultinterlinepenalty + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% PARAMETERS DIFFERENT from AmSTeX % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\TagsOnRight % Set tags like a sane person does + + +%%%%%%%%%%%%%%%%%%%%%%%% +% EXTRA FONTS NEEDED % +%%%%%%%%%%%%%%%%%%%%%%%% + +\newif\ifolddigits +\olddigitsfalse % Allow use of amcscod10 for citations +\def\useolddigits{% + \olddigitstrue + \oktell{Old Digits Mode}% +} + +\font\sixrm=cmr6 \font\sixbf=cmbx6 +\font\sixi=cmmi6 \skewchar\sixi='177 +\font\sixsy=cmsy6 \skewchar\sixsy='60 + +\font\eightrm=cmr8 \font\eightsl=cmsl8 \font\eightit=cmti8 +\font\eightsy=cmsy8 \skewchar\eightsy='60 +\skewchar\eightsy='60 \font\eightbf=cmbx8 +\font\eightex=cmex10 at 8\p@ +\font\eighti=cmmi8 \skewchar\eighti='177 + +\font\ninerm=cmr9 \font\nineit=cmti9 +\font\ninei=cmmi9 \skewchar\ninei='177 +\font\ninesy=cmsy9 \skewchar\ninesy='60 +\font\ninesl=cmsl9 \font\ninebf=cmbx9 + +\font\twelvecsc=cmcsc10 scaled \magstep1 +\font\tencsc=cmcsc10 +\font\eightcsc=cmcsc10 at 8\p@ +\font\elevencsc=cmcsc10 scaled \magstephalf +\font\ninecsc=cmcsc10 at 9\p@ + +\let\tencscod=\tencsc +\let\eightcscod=\eightcsc + +\font\eightsf=cmss10 at 8\p@ +\font\tensf=cmss10 +\font\twelvesf=cmss10 at 12\p@ + +\font\twelvett=cmtt10 scaled \magstep1 +\font\eighttt=cmtt10 at 8\p@ % \tentt is predefined in plain.tex + +\font\twelvebti=cmbti at 12\p@ +\font\tenbti=cmbti +\font\eightbti=cmbti at 8\p@ + +\font\twelveex=cmex10 scaled \magstep1 \font\twelverm=cmr10 scaled \magstep1 +\font\twelvesl=cmsl10 scaled \magstep1 \font\twelvebf=cmbx10 scaled \magstep1 +\font\twelvei=cmmi10 scaled \magstep1 \skewchar\twelvei='177 +\font\twelvesy=cmsy10 scaled \magstep1 \skewchar\twelvesy='60 +\font\twelveit=cmti10 scaled \magstep1 + +\font\twelvechap@font=cmssbx10 at 14\p@ +\font\twelvesec@font=cmss10 at 13\p@ +\font\twelvesubsec@font=cmssi10 scaled \magstep1 + +\font\tenchap@font=cmssbx10 scaled \magstep1 +\font\tensec@font=cmssbx10 scaled \magstephalf +\font\tensubsec@font=cmssi10 + +\font\eightchap@font=cmssbx10 +\font\eightsec@font=cmss10 at 9\p@ +\font\eightsubsec@font=cmssqi8 + +% Font selection +\newcount\font@no +\def\curfont{\ifcase\font@no\rm\or\it\or\sl\or\bf\or\tt\or\csc\or\bti\or\sf + \else\errmessage{Internal font confusion}\fi} + +%%%%%%%%%%%%%%%%%%%%% +% SPACING CONTROL % +%%%%%%%%%%%%%%%%%%%%% + +\newskip\normalabovedisplayskip +\newskip\normalbelowdisplayskip +\newskip\normalabovedisplayshortskip +\newskip\normalbelowdisplayshortskip +\newdimen\normalparskip \normalparskip=22.5\p@ +\newdimen\parstretch \parstretch=8\p@ + +\newif\ifsinglespacing % Tells if we are currently in single space mode +\newif\ifhalfspacing % Special version of singlespacing, a little bigger. + +% Actually tell TeX what spacing is wanted +\def\setbaselines{% + \baselineskip=\normalbaselineskip + \abovedisplayskip=\normalabovedisplayskip + \belowdisplayskip=\normalbelowdisplayskip + \abovedisplayshortskip=\normalabovedisplayshortskip + \belowdisplayshortskip=\normalbelowdisplayshortskip + % Compute \parskip for even paragraph spacing at all pt sizes + \dimen@=\normalparskip + \advance\dimen@ by -\normalbaselineskip + \parskip=\dimen@ plus\parstretch +} + +% Go from double to single spacing +\def\reducespacing{% + \normalbaselineskip=0.64\normalbaselineskip + \normalabovedisplayskip=0.64\normalabovedisplayskip + \normalbelowdisplayskip=0.64\normalbelowdisplayskip + \normalabovedisplayshortskip=0.64\normalabovedisplayshortskip + \normalbelowdisplayshortskip=0.64\normalbelowdisplayshortskip +} + +% Set halfspacing baseline etc starting from singlespacing mode +\def\sethalfspacing{% + \normalbaselineskip=1.28125\normalbaselineskip + \abovedisplayskip=1.28125\abovedisplayskip + \belowdisplayskip=1.28125\belowdisplayskip + \abovedisplayshortskip=1.28125\abovedisplayshortskip + \belowdisplayshortskip=1.28125\belowdisplayshortskip +} + +% Go to single spacing if we're not there already +\def\singlespace{% + \normalspacing \reducespacing + \halfspacingfalse \singlespacingtrue + \setbaselines +} + +% Go to 1-1/2 spacing. +\def\halfspace{% + \normalspacing \reducespacing \sethalfspacing + \singlespacingtrue \halfspacingtrue + \setbaselines +} + +% Go to normal, doublespacing mode +\def\doublespace{% + \normalspacing + \singlespacingfalse \halfspacingfalse + \setbaselines +} + +% Make sure we're doing the spacing we're supposed to be. +\def\setspacing{% + \normalspacing + \ifsinglespacing + \reducespacing + \ifhalfspacing \sethalfspacing \fi + \fi + \setbaselines +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% FOUR DIFFERENT POINT SIZES % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\def\twelvepoint{% + \def\big@@AmS{10.2\p@}% + \def\Big@@AmS{13.8\p@}% + \def\bigg@@AmS{17.4\p@}% + \def\Bigg@@AmS{21.0\p@}% + \let\smallertype=\tenpoint + \let\curtype=\twelvepoint + \def\biggertype{\errmessage{No larger point size available}}% + \def\normalspacing{% + \normalbaselineskip=22.8\p@ + \normalabovedisplayskip=14.5\p@ plus 3\p@ minus 9\p@ + \normalbelowdisplayskip=14.5\p@ plus 3\p@ minus 9\p@ + \normalabovedisplayshortskip=\z@ plus 4\p@ + \normalbelowdisplayshortskip=9\p@ plus 4\p@ minus 5\p@ + }% + \def\rm{\font@no=0\fam\z@\twelverm}% + \def\it{\font@no=1\fam\itfam\twelveit}% + \def\sl{\font@no=2\fam\slfam\twelvesl}% + \def\bf{\font@no=3\fam\bffam\twelvebf}% + \def\tt{\font@no=4\fam\ttfam\twelvett \spaceskip.5em plus.25em + minus.15em }% + \def\csc{\font@no=5\twelvecsc}% + \def\bti{\font@no=6\twelvebti}% + \def\sf{\font@no=7\twelvesf}% + \let\sc=\csc + \ifolddigits + \let\cite@font=\tencscod + \else + \let\cite@font=\elevencsc + \fi + \textfont\z@=\twelverm \scriptfont\z@=\ninerm \scriptscriptfont\z@=\sixrm + \textfont\@ne=\twelvei \scriptfont\@ne=\ninei \scriptscriptfont\@ne=\sixi + \textfont\tw@=\twelvesy \scriptfont\tw@=\ninesy \scriptscriptfont\tw@=\sixsy + \textfont\thr@@=\twelveex \scriptfont\thr@@=\twelveex + \scriptscriptfont\thr@@=\twelveex + \textfont\itfam=\twelveit + \textfont\slfam=\twelvesl + \textfont\ttfam=\twelvett + \textfont\bffam=\twelvebf \scriptfont\bffam=\ninebf + \scriptscriptfont\bffam=\sixbf + \let\chap@font=\twelvechap@font + \let\sec@font=\twelvesec@font + \let\subsec@font=\twelvesubsec@font + \let\subsubsec@font=\twelvebf + \def\oldstyle{\fam1\twelvei}% + \setspacing + \curfont + \ifundefined{everypointsize}\else\everypointsize{twelve}{12}\fi +} + +\def\tenpoint{% + \def\big@@AmS{8.5\p@}% + \def\Big@@AmS{11.5\p@}% + \def\bigg@@AmS{14.5\p@}% + \def\Bigg@@AmS{17.5\p@}% + \let\smallertype=\eightpoint + \let\curtype=\tenpoint + \let\biggertype=\twelvepoint + \def\normalspacing{% + \normalbaselineskip=18.9\p@ + \normalabovedisplayskip=12\p@ plus 3\p@ minus 9\p@ + \normalbelowdisplayskip=12\p@ plus 3\p@ minus 9\p@ + \normalabovedisplayshortskip=\z@ plus 3\p@ + \normalbelowdisplayshortskip=7\p@ plus 3\p@ minus 4\p@ + }% + \def\rm{\font@no=0\fam\z@\tenrm}% + \def\it{\font@no=1\fam\itfam\tenit}% + \def\sl{\font@no=2\fam\slfam\tensl}% + \def\bf{\font@no=3\fam\bffam\tenbf}% + \def\tt{\font@no=4\fam\ttfam\tentt \spaceskip.5em plus.25em + minus.15em }% + \def\csc{\font@no=5\tencsc} + \def\bti{\font@no=6\tenbti}% + \def\sf{\font@no=7\tensf}% + \let\sc=\csc + \ifolddigits + \let\cite@font=\eightcscod + \else + \let\cite@font=\ninecsc + \fi + \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\ttfam=\tentt + \textfont\bffam=\tenbf \scriptfont\bffam=\sevenbf + \scriptscriptfont\bffam=\fivebf + \let\chap@font=\tenchap@font + \let\sec@font=\tensec@font + \let\subsec@font=\tensubsec@font + \let\subsubsec@font=\tenbf + \def\oldstyle{\fam1\teni}% + \setspacing + \curfont + \ifundefined{everypointsize}\else\everypointsize{ten}{10}\fi +} + +\def\eightpoint{% + \def\big@@AmS{6.8\p@}% + \def\Big@@AmS{9.2\p@}% + \def\bigg@@AmS{11.6\p@}% + \def\Bigg@@AmS{14.0\p@}% + \def\smallertype{\errmessage{No smaller point size available}}% + \let\curtype=\eightpoint + \let\biggertype=\tenpoint + \def\normalspacing{% + \normalbaselineskip=15\p@ + \normalabovedisplayskip=10\p@ plus 2.4\p@ minus 7.2\p@ + \normalbelowdisplayskip=10\p@ plus 2.4\p@ minus 7.2\p@ + \normalabovedisplayshortskip=\z@ plus 2.4\p@ + \normalbelowdisplayshortskip=55.6\p@ plus 2.4\p@ minus 3.2\p@ + }% + \def\rm{\font@no=0\fam\z@\eightrm}% + \def\it{\font@no=1\fam\itfam\eightit}% + \def\sl{\font@no=2\fam\slfam\eightsl}% + \def\bf{\font@no=3\fam\bffam\eightbf}% + \def\tt{\font@no=4\fam\ttfam\eighttt \spaceskip.5em plus.25em + minus.15em }% + \def\csc{\font@no=5\eightcsc}% + \def\bti{\font@no=6\eightbti}% + \def\sf{\font@no=7\eightsf}% + \let\sc=\csc + \def\cite@font{\errmessage{You may not do citations in 8 point}} + \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@@=\eightex \scriptfont\thr@@=\eightex + \scriptscriptfont\thr@@=\eightex + \textfont\itfam=\eightit + \textfont\slfam=\eightsl + \textfont\ttfam=\eighttt + \textfont\bffam=\eightbf \scriptfont\bffam=\sixbf + \scriptscriptfont\bffam=\fivebf + \let\chap@font=\eightchap@font + \let\sec@font=\eightsec@font + \let\subsec@font=\eightsubsec@font + \let\subsubsec@font=\eightbf + \def\oldstyle{\fam1\eighti}% + \setspacing + \curfont + \ifundefined{everypointsize}\else\everypointsize{eight}{10}\fi +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% TABLE of CONTENTS Macros % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% This set of macros allows you to build a table of contents for a document +% automatically in TeX. There are only three control sequences which you +% will need to use. The first is \inicont, which initializes the macros. +% This package works by writing the appropriate lines into a file called +% \jobname.toc in your account. This file is read by \printcontents or +% by \printcont in PRINT-PRELIM.TEX. +% +\newwrite\cont@file % Get a free channel to write to +\newif\ifcont@closed +\cont@closedtrue % Haven't opened contents file yet +\newwrite\fig@file +\newwrite\tab@file +\newif\iffig@closed +\fig@closedtrue % Or the list of figures file +\newif\iftab@closed +\tab@closedtrue % Or the tables file + +\def\contitle{\jobname.toc} % Default name of contents file +\def\figtitle{\jobname.lof} % ditto for figures file +\def\tabtitle{\jobname.lot} % ditto for tables file + +% Make sure the contents file is open before writing to it +\def\opencontfile{% + \ifcont@closed + \immediate\openout\cont@file=\contitle + \cont@closedfalse + \fi +} + +% +% This control sequence adds its argument to the table of contents. +% +\def\content#1{% + \opencontfile + \let\\=\space + \write\cont@file{\string\Z{#1}{\the\pageno}}% +} + +% +% This control sequence is the same as \content except that the first +% box written will have two leading spaces to indent it. +% +\def\subcontent#1{% + \opencontfile + \let\\=\space + \write\cont@file{\string\Z{\string\hskip \parindent{}#1}{\the\pageno}}% +} + +% And the same thing for sub-sections +\def\subsubcontent#1{% + \opencontfile + \let\\=\space + \write\cont@file{\string\Z{\string\hskip 2\parindent{}#1}{\the\pageno}}% +} + +% And the same thing for sub-sub-sections +\def\subsubsubcontent#1{% + \opencontfile + \let\\=\space + \write\cont@file{\string\Z{\string\hskip 3\parindent{}#1}{\the\pageno}}% +} + +% Simple table-of-contents printer for \articlestyle. +% For dissertations, use the one in print-prelim.tex. +% Use this macro as the last thing in your report, since it makes +% the page numbers be in romannumerals at the bottom of the page. +\def\printcontents{% + \closeout \cont@file + \null\vfill\supereject % Close output, end last page + \twelvepoint\rm % Make sure we're in normal mode + \pageno=\m@ne % Contents get roman numerals. + \plain@page@numbers % Put page #s at bottom only + \oktell{Table of Contents} + \null \vskip .8in minus\baselineskip + \centerline{\chap@font Contents} + \vskip \tw@\baselineskip + \rightline{Page} + \begingroup % Temporarily change \baselineskip to avoid + % underfull \vbox's during output errors. + \baselineskip=\@ne\baselineskip plus .05\baselineskip + \def\Z##1##2{\line{\ignorespaces##1\leaders + \hbox to.7em{.\hfil}\hfil\hbox to2em{\hss##2}}} + \catcode`@=11 + \let\\=\space + \input\contitle \relax + \endgroup % Also undoes the \catcode change +} + + +%%%%%%%%%%%%%%%%%%%%%%%% +% NUMBERED FOOTNOTES % +%%%%%%%%%%%%%%%%%%%%%%%% + +% First, modify \vfootnote from Plain to use smallertype and singlespace +\def\vfootnote#1{% + \insert\footins\bgroup\tenpoint\singlespace + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox \floatingpenalty\@MM + \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip + \parindent=.13in + \textindent{#1}\footstrut\futurelet\next\fo@t +} + +% Allocate a counter for the numbered footnotes +\newcount\note@count \note@count=\@ne + +\def\nfootnote#1{% + \unskip\footnote{$^{\number\note@count}$}{#1}% + \global\advance\note@count by\@ne +} + +% Same except that trailing period or comma is ``tucked'' under +% the note mark. \ntucknote provides auto numbering. +\def\ntucknote#1#2{\nfootnote{#1}\llap{#2}} +\def\tucknote#1#2#3{\footnote{#1}{#2}\llap{#3}} + + +%%%%%%%%%%%%%%%%%%%% +% UTILITY MACROS % +%%%%%%%%%%%%%%%%%%%% + +% Insert a discretionary hyphen. For use in restricted +% horizontal mode, as in the bibliography. +\def\hyphenbreak{\discretionary{-}{}{-}} + +% Check if a macro name is currently undefined (from The TeXbook) +\def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax} + +% Terminal input and output routines and auxilary stuff +\newwrite\undef@out@chan % Allocate a channel for the tty +\def\tell#1{{\let\\=\space\immediate\write\undef@out@chan{#1}}} +\def\ask#1{\read-16 to #1} % Read from tty w/o prompt + +% Sanitize a string before \write'ing it. +% Call with \unexpanded{op}{msg} +% Modified from version in The TeXbook, originally by Todd Allen +\long\def\unexpanded#1#2{% + \def\finwrite{#1}% + {\aftergroup\finwrite\aftergroup{\sanitize@uci#2\endsanity@uci}}% +} +\def\sanitize@uci{\futurelet\next@uci\sanswitch@uci} +\def\sanswitch@uci{\ifx\next@uci\endsanity@uci + \else\ifx\next@uci\\\aftergroup\space\let\next@uci=\eat@uci + \else\ifcat\noexpand\next@uci\space\aftergroup\space\let\next@uci=\eat@uci + \else\ifcat\noexpand\next@uci\bgroup\aftergroup{\let\next@uci=\eat@uci + \else\ifcat\noexpand\next@uci\egroup\aftergroup}\let\next@uci=\eat@uci + \else\let\next@uci=\copytoken@uci\fi\fi\fi\fi\fi \next@uci +} +\def\eat@uci{\afterassignment\sanitize@uci \let\next@uci= } +\long\def\copytoken@uci#1{% + \ifcat\noexpand#1\relax\aftergroup\noexpand + \else\ifcat\noexpand#1\noexpand~\aftergroup\noexpand + \fi + \fi + \aftergroup#1\sanitize@uci +} +\def\endsanity@uci\endsanity@uci{} + +% Now use the sanity stuff to make a sane tell command. This macro +% actually takes one argument, but since it's the last for \unexpanded, +% we avoid scanning it twice by not picking it up here. +\def\sanetell{\unexpanded{\immediate\write\undef@out@chan}} + +% Produce verbatim listings of various sorts + +\def\uncatcodespecials{\def\do##1{\catcode`##1=12 } \dospecials} +\def\setupverbatim{% + \par \tt \spaceskip=\z@ % Want fixed tt spacing now + \obeylines \uncatcodespecials \obeyspaces \verbatimdefs +} + +% This macro turns on verbatim mode until ?endverbatim is seen. +\def\verbatim{% + \begingroup \setupverbatim + \parskip=\z@ plus .05\baselineskip \parindent=\z@ + \catcode`\ =13 \catcode`\^^M=13 \catcode`\?=\z@ + \verbatimgobble +} +{\catcode`\^^M=13{\catcode`\ =13\gdef\verbatimdefs{\def^^M{\ \par}\let =\ }} + \gdef\verbatimgobble#1^^M{}% +} + +% This defines ?endverbatim to end the group which begins with \verbatim +\let\endverbatim=\endgroup + +% Input a file in verbatim mode. Sometimes useful for including +% real-life examples into a paper. +\def\verbfile#1{% + \begingroup\setupverbatim + \parskip=\z@ plus .05\baselineskip \parindent=\z@ + \input#1 \endgroup +} + +% This is the same as the above, but it adds line numbers to each +% line of the file printed. \lineno@uci has the obvious use. +\newcount\lineno@uci +\def\listing#1{% + \lineno@uci=\z@ + \begingroup\setupverbatim + \parskip=\z@ plus .05\baselineskip \parindent=20\p@ + \everypar{\advance\lineno@uci by\@ne \llap{\the\lineno@uci\ \ }}% + \input#1 + \endgroup +} + +% Draw a little qed symbol (black box) +\def\qed{\hbox{\hskip\p@ \vrule width4\p@ height6\p@ depth1.5\p@ \hskip\p@}} + +% Conditions -- from AmSppt +\newif\ifrunin@AmS +\runin@AmSfalse +\let\runin=\runin@AmStrue +\newdimen\cond@dimen +\newdimen\condindent % Amount each nested condition is indented +\condindent=.5in % Default indentation amount + +% This is used in \conditions +\def\firstcon@AmS#1:{% + \ifrunin@AmS + {\rm\ignorespaces#1\unskip}\ignorespaces + \runin@AmSfalse + \else + \par + \ifdim\lastskip<\smallskipamount + \removelastskip \penalty55 \smallskip + \fi + \\#1:% + \fi +} + +% Do one item of the conditions. This is really \\ in disguise. +\def\cond@item#1:{% + \par\noindent + \hbox to \cond@dimen{\hfil\rm\ignorespaces#1\unskip\quad}% + \hangafter1 + \hangindent\cond@dimen\ignorespaces +} + +\cond@dimen=\z@ % Value for outermost block +% Do the main stuff for \conditions. +\def\conditions{% + \par + \let\\=\cond@item + \begingroup + \advance\cond@dimen by\condindent + \firstcon@AmS +} + +% Exit special stuff for \conditions. +\def\endconditions{% + \par\smallbreak\endgroup + \ifdim\cond@dimen>\z@ \cond@item \fi % If ending an inner condition +} + +% Automatically numbered items +\newcount\item@count +\newdimen\item@dimen \item@dimen=\z@ +\def\item@prefix{} +\def\beginitems{% + \begingroup + \advance \parindent by\item@dimen + \ifnum\item@dimen>\z@ + \edef\item@prefix{\item@prefix\number\item@count.} + \else + \item@dimen=1cm + \fi + \item@count=\z@ \singlespace \interlinepenalty=200 +} +\def\enditems{\par\endgroup} +\def\nitem{\advance\item@count by\@ne \item{\item@prefix\number\item@count.}} + +% Turn back on the \+ construct of plain TeX. +\def\tabalign{\us@true\m@ketabbox} +\outer\def\+{\tabalign} + +% Fix AmSTeX's definition used in its definition of ~ (tie). +\def\s@AmS{\penalty\@M\ifx\tok@AmS\Space@AmS\else\ \fi} + +% And make \/ work the way it does in plain.tex +\let\/=\ic@AmS + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% PAGE CONTROL and OBJECT MANIPULATION % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% This definition doesn't blow up if you're in vertical mode already +\def\pagebreak{\ifhmode\vadjust{\break}\else\break\relax} + +% This definition clears out all previous inserts etc to +% guarantee that the following stuff is at the top of a page. +\def\clearpage{\vfill\supereject} + +% This macro keeps the stuff in the argument on the same page, leaving +% blank space on this page if necessary +\def\keep{\par\setbox\z@=\vbox\bgroup} +\def\endkeep{% + \egroup + \dimen@=\ht\z@ + \advance\dimen@ by\dp\z@ + \vskip\z@ plus\dimen@ + \penalty\z@ + \vskip\z@ plus-\dimen@ + \vskip\parskip + \box\z@ + \goodbreak +} +\def\filkeep{% + \egroup + \filbreak + \vskip\parskip + \box\z@ + \goodbreak +} + +% List macros from the TeXbook + +\toksdef\ta=\z@ \toksdef\tb=\tw@ +\newif\ifresult@uci + +% usage: \newlist\list +\def\newlist#1{\let#1=\empty} + +% usage: \append{item}\to\list +\def\append#1\to#2{\ta={\\{#1}}\tb=\expandafter{#2}\edef#2{\the\tb\the\ta}} +\def\gappend#1\to#2{\ta={\\{#1}}\tb=\expandafter{#2}\xdef#2{\the\tb\the\ta}} + +% usage: \cardinality\list\to\counter +\def\cardinality#1\to#2{#2=\z@ \long\def\\##1{\advance#2 by\@ne }#1} + +% usage: \ifismember{item}\of\list ... \else ... \fi +\def\ifismember#1\of#2{% + \def\given@uci{#1}% + \result@ucifalse + \def\\##1{% + \def\next@uci{##1}% + \ifx\next@uci\given@uci \result@ucitrue\fi + }% + #2% + \ifresult@uci +} + +% usage: \ifwasmember{item}\of\list ... \else ... \fi +% side effect: removes {item} from \list if present +\def\ifwasmember#1\of#2{% + \newlist\ref@mtr + \def\given@uci{#1}% + \result@ucifalse + \def\\##1{% + \def\next@uci{##1}% + \ifx\next@uci\given@uci + \result@ucitrue + \else + \append ##1\to\ref@mtr + \fi + }% + #2% + \let#2=\ref@mtr + \ifresult@uci +} + +% Append #1 to list #2 if #1 is not already in #2 +\def\addtolist#1\to#2{% + \ifismember#1\of#2% + \else + \append #1\to #2% + \fi +} +% Same thing, but do it \global'ly +\def\gaddtolist#1\to#2{% + \ifismember#1\of#2% + \else + \gappend#1\to#2% + \fi +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% STUFF for BIBLIOGRAPHY and APPENDICES % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Bibliography Package: +% Original version by Michal Spivak +% Updated for JACM format and automated by Tim Morgan +% Final cleanup, and much-improved automation, by Marshall Rose +% Additional work and IEEE support by TM. + +% Simple appendix entry builder +\def\appendix#1#2{% + \par + \clearpage + \ifoddpages + \ifodd\pageno \else \null\vfill\eject\fi + \fi + \pageno@foot + \begingroup + \setbox\z@=\hbox{#1}% + \ifdim\wd\z@>\z@ + \content{Appendix #1: #2}% + \oktell{Appendix #1: #2}% + \def\title{Appendix #1\\#2}% + \else + \content{Appendix: #2}% + \oktell{Appendix: #2}% + \def\title{Appendix\\#2}% + \fi + \let\\=\cr \tabskip=\z@ \chap@font + \halign to\hsize{\centerline{\ignorespaces##\unskip}\cr\title\cr}% + \endgroup + \nobreak + \vskip 1.0in minus 0.15in +} + + +% Citations: +% We keep a running list, \ref@set, which is +% all the things which were \cite'd throughout the paper, with +% only one entry for each different key. +% +% There are three versions of each of the citation +% commands: +% 1. The \def'd version is the normal one used throughout the paper. +% 2. Within a figure, table, etc,'s caption, because of the use of +% \def and \edef, a special version which just produces the +% citation without the \gaddtolist command is used. These +% definitions are predefined, and are \let to be \cite etc with +% \no@cites, for speed. +% +% When the user requests a citation with key, we first look it up +% in a translation table called \key@table, organized as a list of +% <key, printed-key> pairs, to see if it really should be +% printed differently. The user can specify this translation table using +% the \printkey command. If a key is not in the table, it is printed +% as-is. + +% We keep the dimension \key@size as the largest printed key so far. +% This value can then be used to print the keys in the bibliography +% optimally, rather than just trying to guess. Each time we print a +% (in \use@key), we see if it's longer than \key@size, and if so then +% we set \key@size = its width. +\newdimen\key@size +\key@size=\z@ % Init. value so \key@size is made as small as possible + +% Invisible citation. usage: \icite{key} +\def\icite#1{% + \gaddtolist#1\to\ref@set +} + +% Management of \key@table stuff. This table is formatted as +% \\{real-key}{printed-key}... +\newlist\key@table + +% Add a pair of items to the list. This should be done before any +% citations are made, for obvious reasons. +% #1=real key (the one you use in the paper and bibliography) +% #2=the key that gets printed in the output +\def\printkey#1#2{% + \ta={\\{#1}{#2}}% + \tb=\expandafter{\key@table}% + \xdef\key@table{\the\tb\the\ta}% +} + +% Print a key, looking it up in the table. #1 is \whatever which +% expands to the key used by the user. The definition of \\ here +% makes use of the format of the \key@table, so that the table is +% actually EXECUTED, hence making lookup relatively fast. +\newif\if@not@printed@ +\def\use@key#1{% + \@not@printed@true + \def\\##1##2{% + \if@not@printed@ + \def\temp@uci{##1}% + \ifx\temp@uci#1% + \@not@printed@false + \setbox\z@=\hbox{[##2]\enspace}% + \ifdim\wd\z@>\key@size \global\key@size=\wd\z@ \fi + ##2% + \fi + \fi + }% + \key@table + \if@not@printed@ + \setbox\z@=\hbox{\cite@font[\ignorespaces#1\unskip]\enspace}% + \ifdim\wd\z@>\key@size \global\key@size=\wd\z@ \fi + #1% + \fi +} + +% This macro moves forward until it hits \end, skipping spaces. +% Each time it hits a comma, or when it hits and \end, it +% adds whatever has been collected so far (in \@total) to +% \ref@set and to the output list. It is assumed that \@total +% has been set to \empty before this routine is called (this is done +% by \@@cite, below). +\def\@icite#1{% + \if#1\end + \expandafter\gaddtolist\@total\to\ref@set + \use@key\@total + \let\@next=\relax % Exit loop after this time + \else + \if#1,% % We have a complete key now. + \expandafter\gaddtolist\@total\to\ref@set + \use@key\@total,\space + \global\let\@total=\empty + \else + \xdef\@total{\@total#1}% Add new char to total + \fi + \let\@next=\@icite % Continue looping until done + \fi + \@next +} + +% Initialize and call \@icite. Used in \cite, \citep, \citepp +\def\@@cite#1{\global\let\@total=\empty\@icite#1\end} + +% usage: \cite{key [, key...]} +\def\cite#1{% + {\cite@font[\@@cite{#1}]}% +} + +% usage: \citep{key}{page} +\def\citep#1#2{% + {\cite@font[\@@cite{#1}, \hbox{\rm p \ignorespaces#2\unskip}]}% +} + +% usage: \citepp{key}{pages} +\def\citepp#1#2{% + {\cite@font[\@@cite{#1}, \hbox{\rm pp \ignorespaces#2\unskip}]}% +} + +% These three definitions are used in \no@cites, below. They +% don't handle extraneous spaces as well as the normal +% definition, but they should be sufficient for most people. +\def\i@cite#1{{\cite@font[\noexpand\noexpand\noexpand\@@cite{#1}]}} + +\def\i@citep#1#2{{\cite@font[\noexpand\noexpand\noexpand\@@cite{#1},\space + \hbox{\noexpand\noexpand\noexpand\rm p \ignorespaces#2\unskip}]}% +} + +\def\i@citepp#1#2{{\cite@font[\noexpand\noexpand\noexpand\@@cite{#1},\space + \hbox{\noexpand\noexpand\noexpand\rm pp \ignorespaces#2\unskip}]}% +} + +% Turn off adding citations to \ref@set. This is needed when +% using \cite etc inside a caption for tables, figures, etc. +% \no@cites is undone by exiting an enclosing group. +\def\no@cites{% + \let\citepp=\i@citepp + \let\citep=\i@citep + \let\cite=\i@cite +} + +%%%%%%%%%%%%%%%%%%%%%% +% References Section % +%%%%%%%%%%%%%%%%%%%%%% + +% The basic strategy is as follows. We read the bib. file, which is +% assumed to be in sorted order of keys/author names. Each +% entry is of the form \ref{key}. We see if that key is in the table +% \ref@set, which is a table of all the keys we've \cite'd. If the key +% isn't in the list, we print it in parens and go on to the next entry. +% Otherwise, we print the key in square brackets, and format the +% bibliography entry according to the format (JACM or IEEE). We print a +% warning if the key is in the \ref@seen list. We add the key to +% the \ref@seen list. The key is removed from the \ref@set list if it +% was there. At the end of the references (\endreferences), we check +% if there are any keys left in \ref@set. If so, the bib. file was +% deficient, and we print a warning message (it should probably be a +% fatal error message). + +% Annotation control +\newif\ifinclude@annos % Should annotations be printed? +\include@annosfalse % By default, no +\def\annotate{% % ``official'' command + \include@annostrue + \oktell{Annotating bibliography}% +} + +\newif\ifin@anno % True while doing an annotation +\in@annofalse + +\def\refi@AmS{F} % This starts as False + +% Begin an annotation -- must be in vertical mode. Just gather +% text into box0 for use by \endanno. We do a couple of consistency +% checks at the beginning. +\def\anno{% + \ifhmode + \message{You forgot the \noexpand\endref command!} + \message{I've inserted one for you.} + \endanno + \fi + \if F\refi@AmS + \errmessage{No \noexpand\ref command before first \noexpand\anno} + \fi + \let\\=\newline + \in@annotrue + \setbox\z@=\vbox\bgroup +} + +% End of an annotation. Decide if it should be typeset or skipped. +\def\endanno{% + \egroup % End the group for box0 + \in@annofalse % No longer doing an annotation + \if T\refed@uci % If previous reference was used, + \ifinclude@annos {% And if we're producing an annotated bib., + \vskip\parskip + \interlinepenalty=\defaultinterlinepenalty + \unvbox\z@ % Then include annotation as normal paragraph(s) + \par + }\fi + \fi +} + +\global\newlist\ref@set % list of all references cited +\global\newlist\ref@seen % list of all references defined + +\def\reftitle{References} % Default title for bibliography + +% usage: \references (begin the References section) +\def\references{% + \vfill\supereject % Begin new page, clear out everything + \ifoddpages % Make sure start on even page. + \ifodd\pageno \relax \else \null\vfill\eject \fi + \fi + \begingroup % Following changes are local to bib. + + \twelvepoint % Get good appearance + \singlespace + \no@cites % \cite's just produce [key] + \parskip=0.6\baselineskip plus5\p@ minus4\p@ + \tolerance=5000 % Must be extremely tolerant! + \pretolerance=300 + \interlinepenalty=400 % To discourage breaking a reference + % across page boundaries + \uchyph=\@ne % Needed to try hyphenating title words + \sfcode`.=\@m % Like \frenchspacing, but only for + % periods + + % Now we output the title and so forth. + \centerline{\csc \reftitle}% + \nobreak + \medskip + \content\reftitle % Tell user and TOC. + \oktell\reftitle + \pageno@foot % Put page # in special place + + % Special definitions within reference mode + \let\year=\yr + \let\month=\mon +} + +% usage: \endreferences (end the References section) +\def\endreferences{% + \par % Make sure last printed reference is finished up. + \cardinality\ref@set\to\count@ + \ifnum\count@>\z@ + \def\\##1{[##1] } + \ifnum\count@>1 + \message{Warning: \number\count@\space undefined citations: \ref@set} + \else + \message{Warning: One undefined citation: \ref@set} + \fi + \fi + \endgroup % End of \references group +} + + +% References Database + + +\newbox\bybox@AmS \newbox\bysamebox@AmS +\newbox\paperbox@AmS \newbox\paperinfobox@AmS +\newbox\jourbox@AmS \newbox\jourinfobox@AmS +\newbox\volbox@AmS \newbox\issuebox@AmS +\newbox\monbox@AmS \newbox\yrbox@AmS +\newbox\pagesbox@AmS \newbox\editorbox@AmS +\newbox\bookbox@AmS \newbox\bookinfobox@AmS +\newbox\publbox@AmS \newbox\publaddrbox@AmS +\newbox\finalinfobox@AmS\newbox\wastebox@uci +\newbox\talkbox@AmS \newbox\keybox@AmS +\newbox\editorsbox@AmS + +\def\using@IEEE{F} % By default, not using IEEE format + +% reset a \keyword to the ``not used'' condition +\def\refset@AmS#1{% + \expandafter\gdef\csname is\expandafter\eat@AmS + \string#1@AmS\endcsname{F}\expandafter + \setbox\csname\expandafter\eat@AmS\string#1box@AmS\endcsname=\null +} + +% reset \keyword's +\def\ref@AmS{% + \refset@AmS\key \refset@AmS\finalinfo + \refset@AmS\by \gdef\isbysame@AmS{F}% + \refset@AmS\paper \refset@AmS\paperinfo + \refset@AmS\jour \refset@AmS\jourinfo + \refset@AmS\vol \refset@AmS\issue + \refset@AmS\mon \refset@AmS\yr + \refset@AmS\pages \gdef\ispage@AmS{F}% + \refset@AmS\book \refset@AmS\bookinfo + \refset@AmS\publ \refset@AmS\publaddr + \refset@AmS\editor \refset@AmS\talk + \refset@AmS\editors + \gdef\istoappear@AmS{F}% + \gdef\isinbook@AmS{F}% + \bgroup + \ignorespaces +} + +% usage: \ref{citation} \keywords arguments ... \endref. We make sure +% we aren't still doing an \anno first. +\def\ref#1{% + \ifin@anno + \message{You forgot an \noexpand\endanno command,} + \message{but I forgive you this time.} + \endanno + \fi + \def\refi@AmS{T}% + \ifwasmember#1\of\ref@set + \def\refed@uci{T}% + \okmessage{[#1]}% + \else + \def\refed@uci{F}% + \okmessage{(#1)}% + \fi + \ifismember#1\of\ref@seen + \sanetell{multiply defined: [#1]}% + \else + \append#1\to\ref@seen + \fi + \def\refl@AmS{F}% + \def\\{\egroup\endref@AmS\gdef\refi@AmS{F}\ref@AmS}% + \ref@AmS + \gdef\@total{#1}% + \key \if T\refed@uci + \use@key\@total + \fi\egroup\setbox\wastebox@uci=\hbox\bgroup\ignorespaces +} + +% End of a reference. +% +% Note that \endref@AmS is \let to be whichever \endref@xxx command +% is being used; default is \endref@JACM for JACM format. +% +% If we printed the reference, \endref@AmS will +% have set \bysamebox@AmS to be a box containing a box +% containing a rule and a period. This is unboxed if a subsequent +% reference which gets printed uses \bysame. Otherwise, we here +% save the \by field (if given) so that if a subsequent reference +% using \bysame gets used, we'll know who the author was, even though +% the reference which gave the author(s) wasn't printed. Tricky, huh? +\def\endref{% + \egroup\gdef\refl@AmS{T}% + \if T\refed@uci + \endref@AmS + \else + \if T\isby@AmS + \setbox\bysamebox@AmS=\box\bybox@AmS + \fi + \fi + \par +} + +% define a \keyword. #1=keyword, #2=font to use, or {} +\def\refdef@AmS#1#2{% + \def#1{% + \egroup + \expandafter\gdef + \csname is\expandafter\eat@AmS\string#1@AmS\endcsname{T}% + \expandafter\setbox + \csname\expandafter\eat@AmS\string#1box@AmS\endcsname + =\hbox\bgroup#2\ignorespaces + }% +} + +% define the keywords + +\refdef@AmS\by\by@font \refdef@AmS\paper{} +\refdef@AmS\paperinfo{} \refdef@AmS\jour\book@font +\refdef@AmS\vol\book@font \refdef@AmS\issue{} +\refdef@AmS\mon{} \refdef@AmS\yr{} +\refdef@AmS\pages{} \refdef@AmS\talk{} +\refdef@AmS\book\book@font \refdef@AmS\bookinfo{} +\refdef@AmS\publ{} \refdef@AmS\publaddr{} +\refdef@AmS\finalinfo{} \refdef@AmS\editor{} +\refdef@AmS\jourinfo{} \refdef@AmS\key\cite@font +\refdef@AmS\editors{} + +% These don't fit the normal pattern. +\def\bysame{\egroup\gdef\isbysame@AmS{T}\bgroup} +\def\page{\egroup\gdef\ispage@AmS{T}\setbox\pagesbox@AmS=\hbox\bgroup + \ignorespaces} +\def\toappear{\egroup\gdef\istoappear@AmS{T}\bgroup} +\def\inbook{\egroup\gdef\isinbook@AmS{T}\setbox\bookbox@AmS=\hbox\bgroup + \book@font\ignorespaces +} + +% This is the font we normally print book and journal titles in, but we +% use \twelveit for IEEE format. +\let\book@font=\twelvesl + +% Similarly, this is the font to use for the author's name(s). +% Optionally, the user can ask for the cite font instead (this is +% not necessarily related to use of the IEEE format). +\let\by@font=\twelverm + +% As an option, the user can have the author's name(s) in caps-small-caps. +\def\AuthorsInCSC{% + \let\by@font=\elevencsc + \oktell{Authors in CSC mode}% +} + +% Define some aliases for some of the above, for user convenience. +\let\pp=\pages +\let\pgs=\pages +\let\pg=\page +\let\p=\page +\let\journal=\jour +\let\volume=\vol +\let\author=\by +\let\authors=\by +\let\ieee@editors=\editors % Save it in case we use IEEE format +\let\editors=\editor % If using default JACM format +\let\other=\talk +\let\no=\issue + +% Helpers to \endref@AmS, which speed things up a lot, and/or +% make the code more compact. +\def\a@comma{, } % Used in next routine. Predefined for speed of \let. +\def\setpunct@AmS{\let\prepunct@AmS=\a@comma} +\def\ppunbox@AmS#1{\prepunct@AmS\unhbox#1\unskip} + + +% Actually do some typesetting (finally). As mentioned above, +% \endref@AmS is called to print a reference if we want it. It +% is \let to be either \endref@JACM or \endref@IEEE (or possibly +% some other format in the future) depending on the desired +% format. +% +% For some reason, the ~'s don't see to tie things, so some +% \hbox's were introduced. +% +% There is unfortunately a lot of common code between the +% different formats. Here are some sections which were easy to +% pull out: +\def\endref@startup{% + % Test to see if there is anything in the wastebox + \setbox\wastebox@uci=\hbox{\unhbox\wastebox@uci\unskip}% + \ifdim\wd\wastebox@uci>\z@ + \errmessage{Keyword omitted after \noexpand\ref}% + \fi + \let\prepunct@AmS=\empty + \vskip\parskip + \noindent \hangafter=\@ne +} + +% This is the text printed for the JACM format for papers +% appearing in a book. +\def\appearing@in{Appearing in } + +% Common code at the end of \endref@JACM and \endref@IEEE. +% The argument is the date routine to use. +\def\endref@finishup#1{% + \if T\istalk@AmS + \dimen@=\wd\talkbox@AmS + \ifdim\dimen@>\z@ + \ppunbox@AmS\talkbox@AmS\setpunct@AmS + \fi + \fi + \if T\isbook@AmS + \ppunbox@AmS\bookbox@AmS \setpunct@AmS + \editor@ref + \fi + \if T\isinbook@AmS + \prepunct@AmS\appearing@in\unhbox\bookbox@AmS\unskip \setpunct@AmS + \editor@ref \gdef\isbook@AmS{T}% + \fi + \if T\isbookinfo@AmS + \ppunbox@AmS\bookinfobox@AmS\setpunct@AmS + \fi + \if T\using@IEEE + \if T\ispubladdr@AmS + \ppunbox@AmS\publaddrbox@AmS + \if T\ispubl@AmS \def\prepunct@AmS{: }\else\setpunct@AmS\fi + \fi + \if T\ispubl@AmS + \ppunbox@AmS\publbox@AmS\setpunct@AmS + \fi + \else + \if T\ispubl@AmS + \ppunbox@AmS\publbox@AmS\setpunct@AmS + \fi + \if T\ispubladdr@AmS + \ppunbox@AmS\publaddrbox@AmS\setpunct@AmS + \fi + \fi + \if T\isbook@AmS + \if T\isvol@AmS + \prepunct@AmS Vol.~\unhbox\volbox@AmS\unskip\setpunct@AmS + \fi + \if T\isyr@AmS + \ppunbox@AmS\yrbox@AmS\setpunct@AmS + \fi + \if T\istoappear@AmS + \ (to appear)\setpunct@AmS + \fi + \if T\ispages@AmS + \prepunct@AmS pp.~\unhbox\pagesbox@AmS\unskip\setpunct@AmS + \fi + \if T\ispage@AmS + \prepunct@AmS p.~\unhbox\pagesbox@AmS\unskip\setpunct@AmS + \fi + \fi + \if T\istalk@AmS + #1% This is the date routine to use. + \fi + \if T\isfinalinfo@AmS + \period\unhbox\finalinfobox@AmS + \else + \if T\refl@AmS . + \else ; + \fi + \fi +} + +% Print editor(s) if and as appropriate. +\def\editor@ref{% + \if T\using@IEEE + \if T\iseditor@AmS + \ppunbox@AmS\editorbox@AmS, Ed.\setpunct@AmS + \fi + \if T\iseditors@AmS + \ppunbox@AmS\editorsbox@AmS, Eds.\setpunct@AmS + \fi + \else + \if T\iseditor@AmS + \ppunbox@AmS\editorbox@AmS\ (ed.)\setpunct@AmS + \fi + \fi +} + +% This routine prints the date in the JACM format +\def\date@JACM{% + \if T\isyr@AmS + \/\ (% + \if T\ismon@AmS + \unhbox\monbox@AmS\unskip, + \fi + \unhbox\yrbox@AmS\unskip)\setpunct@AmS + \else + \if T\ismon@AmS + \ppunbox@AmS\monbox@AmS\setpunct@AmS + \fi + \fi +} + +% This prints the date in the IEEE format. +\def\date@IEEE{% + \if T\isyr@AmS + \prepunct@AmS + \if T\ismon@AmS + \unhbox\monbox@AmS\unskip\a@comma + \fi + \unhbox\yrbox@AmS\unskip\setpunct@AmS + \else + \if T\ismon@AmS + \ppunbox@AmS\monbox@AmS\setpunct@AmS + \fi + \fi +} + + +% This version produces JACM format references. +\def\endref@JACM{% + \endref@startup + \if T\refi@AmS + \hbox to \key@size{\cite@font [\unhbox\keybox@AmS\unskip]\hfil}% + \hangindent=\key@size + \if T\isby@AmS + \unhcopy\bybox@AmS\unskip + \def\prepunct@AmS{\hskip7\p@ plus5\p@\relax}% + \setbox\z@=\hbox{\unhbox\bybox@AmS\unskip}% + \dimen@=\wd\z@ % We want \dimen0=max(\wd0, 2in) + \ifdim\dimen@>2in \dimen@=2in \fi + \setbox\bysamebox@AmS=\hbox{\hbox to\dimen@{\leaders\hrule\hfill.}}% + \else + \if T\isbysame@AmS + \unhcopy\bysamebox@AmS\unskip + \def\prepunct@AmS{\hskip7\p@ plus5\p@\relax}% + \fi + \fi + \fi + \if T\ispaper@AmS + \ppunbox@AmS\paperbox@AmS\def\prepunct@AmS{. }% + \fi + \if T\ispaperinfo@AmS + \ppunbox@AmS\paperinfobox@AmS\def\prepunct@AmS{. }% + \fi + \if T\isjour@AmS + \ppunbox@AmS\jourbox@AmS\setpunct@AmS + \editor@ref + \if T\isjourinfo@AmS + \ppunbox@AmS\jourinfobox@AmS\setpunct@AmS + \fi + \if T\isvol@AmS + \ \unhbox\volbox@AmS\unskip + \fi + \if T\isissue@AmS + \ppunbox@AmS\issuebox@AmS\setpunct@AmS + \fi + \date@JACM + \if T\istoappear@AmS + \ (to appear)\setpunct@AmS + \fi + \if T\ispages@AmS + \ppunbox@AmS\pagesbox@AmS\setpunct@AmS + \fi + \if T\ispage@AmS + \prepunct@AmS p.~\unhbox\pagesbox@AmS\unskip\setpunct@AmS + \fi + \fi + \endref@finishup\date@JACM +} + + +% This version produces IEEE format references. +\def\endref@IEEE{% + \endref@startup + \if T\refi@AmS + \hbox to \key@size{\cite@font [\unhbox\keybox@AmS\unskip]\hfil}% + \hangindent=\key@size + \if T\isby@AmS \unhcopy\bybox@AmS\unskip\setpunct@AmS + \setbox\z@=\hbox{\unhbox\bybox@AmS\unskip}% + \dimen@=\wd\z@ % We want \dimen0=max(\wd0, 2in) + \ifdim\dimen@>2in \dimen@=2in \fi + \setbox\bysamebox@AmS=\hbox{\hbox to\dimen@{\leaders\hrule\hfill}}% + \else + \if T\isbysame@AmS + \unhcopy\bysamebox@AmS\unskip\setpunct@AmS + \fi + \fi + \fi + \if T\ispaper@AmS + \prepunct@AmS``\unhbox\paperbox@AmS\unskip,'' + \let\prepunct@AmS=\empty + \fi + \if T\ispaperinfo@AmS + \ppunbox@AmS\paperinfobox@AmS\def\prepunct@AmS{, }% + \fi + \if T\isjour@AmS + \ppunbox@AmS\jourbox@AmS\setpunct@AmS + \editor@ref + \if T\isjourinfo@AmS + \ppunbox@AmS\jourinfobox@AmS\setpunct@AmS + \fi + \if T\isvol@AmS + \prepunct@AmS vol.~\unhbox\volbox@AmS\unskip\setpunct@AmS + \fi + \if T\isissue@AmS + \prepunct@AmS no.~\unhbox\issuebox@AmS\unskip\setpunct@AmS + \fi + \if T\istoappear@AmS + \ (to appear)\setpunct@AmS + \fi + \if T\ispages@AmS + \prepunct@AmS pp.~\unhbox\pagesbox@AmS\unskip\setpunct@AmS + \fi + \if T\ispage@AmS + \prepunct@AmS p.~\unhbox\pagesbox@AmS\unskip\setpunct@AmS + \fi + \if T\ispubladdr@AmS + \ppunbox@AmS\publaddrbox@AmS + \if T\ispubl@AmS \def\prepunct@AmS{: }\else\setpunct@AmS\fi + \fi + \if T\ispubl@AmS + \ppunbox@AmS\publbox@AmS\setpunct@AmS + \fi + \let\ispubl@AmS=F\let\ispubladdr@AmS=F% For finishup routine + \date@IEEE + \fi + \endref@finishup\date@IEEE +} + + +% By default, we use JACM format references +\let\endref@AmS=\endref@JACM + +% But it's possible to get the other format +\def\IEEE{% + \gdef\using@IEEE{T}% Now we're using IEEE format. + \let\editors=\ieee@editors + \let\endref@AmS=\endref@IEEE + \refdef@AmS\vol{}% Vol not printed in slanted any more. + \global\let\appearing@in=\empty % Don't say that in IEEE format. + \let\volume=\vol + \let\book@font=\twelveit % Book and journal titles in this font. + \oktell{IEEE Bibliography Style}% +} + + +% References Dump + +\newwrite\dump@file + +\catcode`\{=12 \catcode`\}=12 \catcode`\%=12 \catcode`\[=1 \catcode`\]=2 +\def\ref@open[{] +\def\ref@close[}] +\def\ref@comment[%] +\catcode`\{=1 \catcode`\}=2 \catcode`\%=14 \catcode`\[=12 \catcode`\]=12 + +\def\refdump{% + \vfill\supereject + \begingroup + \content\reftitle + \tell{Dumping \reftitle\space to refdump.tex}% + \immediate\openout\dump@file=refdump + \immediate\write\dump@file{% + \noexpand\catcode`\noexpand\@=11 ^^J% + \noexpand\let\noexpand\content=\noexpand\eat@AmS^^J% + \noexpand\pageno=\the\pageno^^J% + \noexpand\def\noexpand\ref@set\ref@open\ref@comment + }% + \def\\##1{\immediate\write\dump@file{ \noexpand\\{##1}\ref@comment}}% + \ref@set + \immediate\write\dump@file{% + \ref@close^^J% + }% + \immediate\closeout\dump@file + \endgroup +} + + +%%%%%%%%%%%%%%%%%%%% +% OUTPUT CONTROL % +%%%%%%%%%%%%%%%%%%%% + +% Control for informational messages. Default is \verbose mode. +\newif\iftell@all +\let\verbose=\tell@alltrue +\let\quiet=\tell@allfalse +\verbose +\def\oktell#1{\iftell@all\tell{#1}\fi} +\def\okmessage#1{\iftell@all\message{#1}\fi} + +% Chapter macro parameters +\newcount\chapterno +\chapterno=\z@ % Number of current chapter +\newif\ifnumber@chapters +\number@chapterstrue % By default, number the chapters +\def\nochapternumbers{% + \number@chaptersfalse + \oktell{No Chapter Numbers mode}% +} + +% Same thing for sections, subsections, etc +\newcount\sectno \sectno=\@ne +\newcount\subsectno \subsectno=\@ne +\newcount\subsubsectno \subsubsectno=\@ne +\newif\ifnumber@sections +\def\numbersections{% + \number@sectionstrue + \oktell{Section Numbers mode}% +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% OUTPUT CONTROL MACROS % +%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +% Center, left justify, right justify -- avoid exceeding margins +\def\centerline#1{\line{\hfill#1\hfill}} +\def\leftline#1{\line{#1\hfill}} +\def\rightline#1{\line{\hfill#1}} +\def\threepart#1#2#3{\line{\hskip\leftskip\rlap{#1}\hfill#2\hfill + \llap{#3}\hskip\rightskip}} + +% End of the main body of the document +\let\enddiss=\bye + +% Summary Information +\outer\def\showsummary{% + \begingroup + \def\note##1##2##3##4{% + \count@=##1 + \advance\count@ by##3 + \ifcase\count@ + \message{No ##2s##4}\or + \message{1 ##2##4}\else + \message{\the\count@\space ##2s##4}\fi + }% + \note\fignumber{figure}{-1}{,}% + \note\tablenumber{table}{-1}{,}% + \note\note@count{footnote}{-1}{,}% + \cardinality\ref@set\to\count@ + \note\count@{citation}{0}{.}% + \endgroup +} + + +% Real version of ragged right margins +\def\raggedright{% + \rightskip=\z@ plus 2em + \oktell{Raggedright mode}% +} + +% Disallow hyphenation -- a very dangerous thing +\def\nohyphens{% + \hyphenpenalty=\@M\tolerance=500\pretolerance=\@M + \oktell{Nohyphens mode}% +} + +% Allow capitalized words to be hyphenated +\def\hyphenall{% + \uchyph=\@ne + \oktell{Hyphenating all words}% +} + +% Handle a long quotation in a standard way +\def\bigquote#1\endbigquote{% + \par + \vskip \baselineskip \vskip -\parskip + { \advance\rightskip by30\p@ + \advance\leftskip by30\p@ + \smallertype + \singlespace + \let\\=\newline + \noindent\llap{``}\ignorespaces#1\unskip''\par + }% End of singlespacing and special indentation + \vskip \baselineskip \vskip -\parskip +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% CHAPTERS, SECTIONS, FIGURES, TABLES % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% What to do at the beginning of a chapter +\def\chapter#1\endchapter{ + \chapter@base #1\endchapter + \oktell{Chapter \number\chapterno: #1} + \content{Chapter \number\chapterno: #1} +} + + +% This boolean controls whether chapters are made to start only on +% odd pages. +\newif\ifoddpages +\oddpagesfalse +\def\twosided{% This is the ``official'' command + \oddpagestrue + \oktell{Twosided mode}% +} + +% The guts of the \chapter command. \chapter==\chapter@base when +% in \articlestyle. +\def\chapter@base#1\endchapter{ + \par + \clearpage % Clean up from prev chapter + \ifoddpages % Make sure start on even page. + \ifodd\pageno \relax \else \null\vfill\eject \fi + \fi + \pageno@foot % Page #ing special for chap pages + \advance\chapterno by\@ne + \ifnumber@chapters + \centerline{\chap@font CHAPTER \number\chapterno}% Do heading + \fi + \sectno=\z@ + \subsectno=\z@ + \subsubsectno=\z@ + {\let\\=\cr \tabskip=\z@ \chap@font % Center the chapter title + \halign to\hsize{\centerline{\ignorespaces##\unskip}\cr#1\cr} + } + \nobreak % Shouldn't happen anyway + \vskip 1.0in minus 0.15in +} + +% What to do at the beginning of a section +\outer\def\section{\dosection} +\def\dosection#1{% + \skip@=\lastskip % \par resets \lastskip, apparently + \par + % This junk trys to provide consistent spacing + \dimen@=\baselineskip + \ifdim\skip@<\dimen@ + \ifdim\skip@=\z@ + \penalty-200 + \fi + \vskip \dimen@ plus .5\baselineskip + \fi + \ifnumber@sections + \advance\sectno by\@ne + \subsectno=\z@ + \subsubsectno=\z@ + \leftline{\sec@font\number\sectno. #1} + \else + \leftline{\sec@font#1} + \fi + \subcontent{#1} + \sanetell{ Section: #1} + \nobreak + \vskip \z@ plus .15\baselineskip + \vskip -\parskip +} + +% And for sub-sections +\outer\def\subsection{\dosubsection} +\def\dosubsection#1{% + \skip@=\lastskip + \par + \dimen@=.6\baselineskip + \ifdim\skip@<\dimen@ + \ifdim\skip@=\z@ + \penalty-100 + \fi + \vskip \dimen@ plus .3\baselineskip + \fi + \ifnumber@sections + \advance\subsectno by\@ne + \subsubsectno=\z@ + \leftline{\subsec@font\number\sectno.\number\subsectno. #1} + \else + \leftline{\subsec@font#1} + \fi + \subsubcontent{#1} + \sanetell{ \\Subsection: #1} + \nobreak + \vskip \z@ plus .1\baselineskip + \vskip -\parskip +} + +% And for sub-sub-sections +\outer\def\subsubsection{\dosubsubsection} +\def\dosubsubsection#1{% + \skip@=\lastskip + \par + \dimen@=.5\baselineskip + \ifdim\skip@<\dimen@ + \ifdim\skip@=\z@ + \penalty-50 + \fi + \vskip \dimen@ plus .3\baselineskip + \fi + \ifnumber@sections + \advance\subsubsectno by\@ne + \leftline{\subsubsec@font\number\sectno.\number\subsectno + .\number\subsubsectno. #1} + \else + \leftline{\subsubsec@font#1} + \fi + \subsubsubcontent{#1} + \sanetell{ \\\\Subsubsection: #1} + \nobreak + \vskip -\parskip +} + +% This is an alternate definition for plain TeX's \@ins, +% omitting the \par. It is for use during \figure etc. Reason: +% If you use \figure right after \section, it would otherwise +% become a legal place for a page break. +\def\@ins@uci{\begingroup\setbox\z@\vbox\bgroup} + +% This is \endinsert from plain.tex, but \midinsert's are not converted +% to \topinsert's, since that can lead to figures getting out of order. +% This can lead to excessive blank space at the bottom of the page, but +% that's life. Makes use of \keep...\endkeep type stuff. +\def\endinsert{\egroup % finish the \vbox + \if@mid \dimen@\ht\z@ \advance\dimen@\dp\z@ + \advance\dimen@12\p@ + \vskip\z@ plus\dimen@ + \penalty\z@ + \vskip\z@ plus-\dimen@ + \bigskip\box\z@\bigbreak + \else\insert\topins{\penalty100 % floating insertion + \splittopskip\z@skip + \splitmaxdepth\maxdimen \floatingpenalty\z@ + \ifp@ge \dimen@\dp\z@ + \vbox to\vsize{\unvbox\z@\kern-\dimen@}% depth is zero + \else \box\z@\nobreak\bigskip\fi}\fi\endgroup} + + +% This macro provides rudamentary support for figures. The +% argument to \figure is the name of the file containing the tpic (or whatever) +% output. The second argument is the caption for the picture. +% As usual, TeX's delayed paging and midinserting causes expansion-timing +% problems which have to be kludged around. +\newif\iftopfigs \topfigstrue +\def\domidfigs{% + \topfigsfalse + \oktell{Midfigs mode}% +} + +% Counters for figures/diagrams/examples and tables +\newcount\fignumber \fignumber=\@ne +\newcount\tablenumber \tablenumber=\@ne + +% Helper for \figure, \example, and \diagram. Define \lastfigure and +% \this@insert, increment the figure number for next time, and make sure +% the figures list file is open for writing. +% #1=the caption, to be written to the figures list file +\def\advance@figno#1{% + \xdef\lastfigure{\the\fignumber}% Remember the current figure number + \begingroup\no@cites + \let\\=\space + \xdef\this@insert{\write\noexpand\fig@file{\noexpand\noexpand + \noexpand\listfig{\lastfigure}{#1}% + {\noexpand\number\noexpand\pageno}% + }% + }% + \endgroup + \global\advance\fignumber by\@ne + \iffig@closed % Open figures file if not already + \immediate\openout\fig@file=\figtitle + \global\fig@closedfalse + \fi +} + +% Bump the table number after defining \lasttable. Prepare \this@insert. +% Define \table@caption. +\def\advance@tablenumber#1{% + \xdef\lasttable{\the\tablenumber}% Remember the current figure number + \begingroup \no@cites \let\\=\space + \xdef\this@insert{\write\noexpand\tab@file{\noexpand\noexpand + \noexpand\listfig{\lasttable}{#1}% + {\noexpand\number\noexpand\pageno}% + }% + }% + \endgroup + \global\advance\tablenumber by\@ne + \gdef\table@caption{#1}% +} + +\newif\ifpage@figs \page@figsfalse + +% Special mode to put figures/diagrams/examples on separate pages +\def\pagefigs{% + \oktell{Page Figures mode}% + \page@figstrue +} + +% Usage: \figure{filename}{caption with \\'s} +\def\figure#1#2{% + \begingroup % Hide anything that crazy user does! + \advance@figno{#2}% + % Now do mid or top insert as appropriate + \let\@ins=\@ins@uci + \ifpage@figs + \shipout\vbox to\vsize\bgroup + {\smallertype\rm\input #1\relax\centerline{\box\graph}}% + \vfill + \centerline{Figure \lastfigure}\this@insert + \egroup + \else \iftopfigs \topinsert \else \midinsert \fi + \hrule + \vskip .5\baselineskip + {\smallertype\rm\input #1\relax\centerline{\box\graph}}% + \vskip .5\baselineskip plus .5\baselineskip + \centerline{\twelvebf Figure \lastfigure}% + \this@insert + \let\\=\cr \tabskip=\z@ + \halign to\hsize{\centerline{\ignorespaces##\unskip}\cr#2\cr}% + \vskip2\p@ + \hrule + \endinsert + \fi + \endgroup +} + + +% Allow user to specify arbitrary diagrams. The arguments are: +% #1=name of the file containing the commands to form the diagram, +% #2=caption for the figure, possibly containing \\'s. +\def\diagram#1#2{% + \begingroup + \advance@figno{#2}% + % Do mid or top insert as appropriate + \let\@ins=\@ins@uci + \ifpage@figs + \shipout\vbox to\vsize\bgroup + {\smallertype\rm\input #1\relax}% + \vfill + \centerline{\twelverm Figure \lastfigure}\this@insert + \egroup + \else \iftopfigs \topinsert \else \midinsert \fi + \hrule + \vskip .5\baselineskip + {\smallertype\rm\input #1\relax}% + \vskip .5\baselineskip plus .5\baselineskip + \centerline{\twelvebf Figure \lastfigure}% + \this@insert + \let\\=\cr \tabskip=\z@ + \halign to \hsize{\centerline{\ignorespaces##\unskip}\cr#2\cr}% + \vskip2\p@ + \hrule + \endinsert + \fi + \endgroup +} + + +% Allow user to include verbatim examples from files. The arguments are: +% #1=name of the file containing the text of the example, +% #2=caption for the figure, possibly containing \\'s. +\def\example#1#2{% + \begingroup + \advance@figno{#2}% + % Do mid or top insert as appropriate + \let\@ins=\@ins@uci + \ifpage@figs + \shipout\vbox to\vsize\bgroup + \vbox{\smallertype\singlespace\verbfile{#1}}% + \vfill + \centerline{\twelverm Figure \lastfigure}\this@insert + \egroup + \else \iftopfigs \topinsert \else \midinsert \fi + \hrule + \vskip .5\baselineskip + \vbox{\smallertype\singlespace\verbfile{#1}}% + \vskip .5\baselineskip plus .5\baselineskip + \centerline{\twelvebf Figure \lastfigure}% + \this@insert + \let\\=\cr \tabskip=\z@ + \halign to \hsize{\centerline{\ignorespaces##\unskip}\cr#2\cr}% + \vskip2\p@ + \hrule + \endinsert + \fi + \endgroup +} + + +% Similar thing for tables +% usage: \table{caption} ...text... \endtable +\def\table#1{% + \begingroup % Hide user zingers + \advance@tablenumber{#1}% + \setbox\z@=\vbox\bgroup +} + + +% End of the table body specification. +\def\endtable{% + \egroup % End the definition of \box0. + % Now do top or mid insert + \let\@ins=\@ins@uci + \iftab@closed % Open output file if necessary + \immediate\openout\tab@file=\tabtitle + \global\tab@closedfalse + \fi + \ifpage@figs + \shipout\vbox to\vsize\bgroup + \box\z@ + \vfill + \centerline{\twelverm Table \lasttable}\this@insert + \egroup + \else \iftopfigs \topinsert \else \midinsert \fi + \hrule + \vskip .5\baselineskip + \box\z@ % Insert the material here. + \vskip .5\baselineskip plus .5\baselineskip + \centerline{\twelvebf Table \lasttable}% + \this@insert + \let\\=\cr \tabskip=\z@ + \halign to\hsize{\centerline{\ignorespaces##\unskip}\cr\table@caption + \cr}% + \vskip2\p@ + \hrule + \endinsert + \fi + \endgroup +} + + +% End of the table body specification for a full-page table. +\def\endtablepage{% + \egroup % End the definition of \box0. + % Now do top or mid insert + \let\@ins=\@ins@uci + \iftab@closed % Open output file if necessary + \immediate\openout\tab@file=\tabtitle + \global\tab@closedfalse + \fi + \ifpage@figs + \shipout\vbox to\vsize\bgroup + \box\z@ + \vfill + \centerline{\twelverm Table \lasttable}\this@insert + \egroup + \else \pageinsert + \hrule + \vskip .5\baselineskip + \box\z@ % Insert the material here. + \vskip .5\baselineskip plus .5\baselineskip + \centerline{\twelvebf Table \lasttable}% + \this@insert + \let\\=\cr \tabskip=\z@ + \halign to\hsize{\centerline{\ignorespaces##\unskip}\cr\table@caption + \cr}% + \vskip2\p@ + \hrule + \endinsert + \fi + \endgroup +} + +% Environment for report generation -- use only at the beginning! +% Since sections are the biggest division, the table of contents +% stuff is redefined, and chapter numbering is turned off so that +% \chapter can be used for the first-page title. The title page +% gets no page number (page # 0). The user can get to the +% normal chapter font as \titlefont, and the section font as +% \authorfont. +\def\articlestyle{% + \nochapternumbers + \let\subsubsubcontent=\subsubcontent + \let\subsubcontent=\subcontent + \let\subcontent=\content + \let\chapter=\chapter@base + \pageno=\z@ + \let\titlefont=\chap@font + \let\authorfont=\sec@font + \oktell{Articlestyle mode}% +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% PAGE NUMBERING and OUTPUT ROUTINES % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% This macro produces a blank, numbered page of output +\def\blankpage{\pageinsert \null\vfill \endinsert} + +% This defintion of \folio differs from Plain's in that (a) page +% numbers are printed in 12pt, and (b) roman numeral ones are +% printed in italics. It makes use of a trick, that +% \romannumeral0 produces no output, which we need for title +% pages and things, so we make their page numbers be 0. +\def\folio{\ifnum\pageno>\z@ + {\twelverm\number\pageno}\else + {\twelveit\romannumeral-\pageno}\fi +} + +% Permanent definitions of macros which get switched in and out +% with \let's. Do not change any of these !!! +\def\uci@headpage{\hfill\folio} +\def\uci@footpage{\hfill\folio\hfill} +\headline={\uci@headline} +\footline={\uci@footline} + +% If this is used as the footline, it causes a page number to be +% printed, but with the side-effect of making the headline blank +% and the footline a page number again. This is used on pages +% like the first of a chapter. +\def\no@foot{% + \uci@footpage + \global\let\uci@footline=\hfil + \global\let\uci@headline=\uci@headpage +} + +% This macro causes the page number to be at the bottom of the current +% page, and after it has been used there once, it moves to the +% top right of each page. It also sets \dimen\topins=0pt so that +% any material \topinsert'd on these pages will get carried over +% to subsequent pages. +\def\pageno@foot{% + \dimen\topins=\z@ + \let\uci@headline=\hfil + \let\uci@footline=\no@foot +} + +% Executing this causes page numbers to be at the bottom only, as +% with the plain TeX format. +\def\plain@page@numbers{% + \let\uci@headline=\hfil % Initial values similar to plain's + \let\uci@footline=\uci@footpage +} + +% Change plain's \makeheadline and \makefootline to position page +% numbers as required. +\def\makeheadline{% + \vbox to\z@{\vskip-22.65\p@ + \line{\vbox to8.5\p@{}\the\headline}\vss}\nointerlineskip +} +\def\makefootline{\baselineskip=1.6cm\line{\the\footline}} + +% Define an output routine which will restore \dimen\topins +% after \chapter, \references, etc, title pages, which have +% \dimen\topins=0pt +\def\dissoutput{\shipout\vbox{\makeheadline\pagebody\makefootline}% + \advancepageno \global\dimen\topins=\vsize + \ifnum\outputpenalty>-\@MM \else\dosupereject\fi +} +\let\output@AmS=\dissoutput +\dimen\topins=\vsize % Don't insert more than will fit on one page + +% Output Routines: We adjust the \raggedbottom command of plain +% TeX so that the extra space is no more than 1in, and so that +% the space is put above footnotes instead of below. NOTE: Since +% we put a \vfil below the page contents, the topskip glue will +% never actually be stretched. Its stretchability is just to +% let TeX know about the raggedness in computing when to make a +% page break. Since it's 1in, the \vfil will never be stretched to +% more than that amount. + +\def\raggedbottom{\topskip=\normal@topskip plus1in \r@ggedbottomtrue + \oktell{Ragged bottom mode}} +\def\normalbottom{\topskip=\normal@topskip\r@ggedbottomfalse + \oktell{Normal bottom mode}} + +\def\pagecontents{% + \ifvoid\topins\else\unvbox\topins\fi + \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255 + \ifr@ggedbottom \kern-\dimen@ \vfil\fi + \ifvoid\footins \else % footnote info is present + \vskip\skip\footins + \footnoterule + \unvbox\footins + \fi +} + + +%%%%%%%%%%%%%%%%%%%% +% INITIALIZATION % +%%%%%%%%%%%%%%%%%%%% + +\font@no=0 % Default font=\rm, +\twelvepoint % point size, +\doublespace % and spacing +\plain@page@numbers % Page nos like plain's + +% Note that normally in AmSTeX, the @ character may not be used. +% But in the dissertation style, @ may be used as a normal character, +% As it can in plain TeX. +\catcode`\@=12 + +% Eat any further \documentstyle commands +\def\documentstyle#1{} + +% This prints out our welcome message, and it computes the time +% and date string once per run, which saves time if they're used +% more than once. Since \catcode`@=12 at the time this is +% executed, it can't contain any @-type macros. +\everyjob={% + \begingroup + \xdef\today{% + \ifcase\month + \the\month\or + January\or + February\or + March\or + April\or + May\or + June\or + July\or + August\or + September\or + October\or + November\or + December\else + \the\month + \fi\space\the\day, \the\year + }% + \count0=\time + \count1=\count0 + \divide\count0by60 + \count2=\count0 + \multiply\count0by60 + \advance\count1by-\count0 + \ifnum\count2>11 + \ifnum\count2>12 \advance\count2by-12\fi + \def\ampm{PM}% + \else + \ifnum\count2=0 \advance\count2by12\fi + \def\ampm{AM}% + \fi + \xdef\daytime{% + \ifnum\count2<10 0\fi \the\count2:% + \ifnum\count1<10 0\fi \the\count1 + \ampm + }% + \endgroup + \tell{AmSTeX Dissertation Style, version \version}% +} + +\edef\temp@uci{\the\everyjob} +\temp@uci