Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / papers / doclib / diss.sty
1 % UCI Dissertation Style for AmSTeX.
2 % @(#)$Id: diss.sty,v 1.3 1990/04/05 15:20:23 sources Exp $
3
4 % Tim Morgan with many suggestions, bug fixes, etc, from Marshall Rose
5 % Based originally on Michael Spivak's AMSPPT.STY.
6
7 % When edits are made to this file, the version number should be incremented.
8 \def\version{103}
9 \let\fmtversion=\version        % These two control sequences are defined
10 \def\fmtname{dissertation}      % in plain.tex, so we do it here too.
11
12 % Assumes the following hidden definitions from plain.tex:
13 %       \z@ is defined from plain.tex as 0pt (and magically can
14 %               be used as the integer constant 0 also).
15 %       \p@ is the same, but 1pt
16 %       \@ne is 1
17 %       \m@ne is -1
18 %       \tw@ is 2
19 %       \thr@@ is 3
20 %       \@m is 1000
21 %       \@M is 10000
22 % And the following scratch register definitions:
23 %       \dimen@ is \dimendef'd to be \dimen0
24 %       \skip@  is \skipdef'd to be \skip0
25 %       \count@ is \count255
26
27 \catcode`\@=11               % So we can use a special character
28
29
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 %  PARAMETERS DIFFERENT THAN IN PLAIN  %
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33
34 % These are words which TeX doesn't hyphenate perfectly.
35 % Unfortunately, the plural forms must be included also.
36 \hyphenation{com-put-er com-mun ap-pen-dix cart-wheel data-base Dijk-stra}
37 \hyphenation{in-fra-struc-ture man-u-script mi-cro-fiche para-mil-i-tary}
38 \hyphenation{post-am-ble pre-am-ble sub-scrib-er wave-guide sub-scrib-ers}
39 \hyphenation{com-put-ers cart-wheels data-bases in-fra-struc-tures}
40 \hyphenation{man-u-scripts mi-cro-fiches post-am-bles pre-am-bles}
41 \hyphenation{buf-fer buf-fers des-ig-na-ted par-a-graph par-a-graphs}
42 \hyphenation{key-stroke key-strokes usu-al-ly}
43
44
45 \def\normal@topskip{0.48cm}
46 \topskip=\normal@topskip     % For correct page positioning, do NOT
47 \hoffset=0.5in               % change any of these values!!!
48 \voffset=0.07cm
49 \hsize=15.2cm
50 \vsize=22.2cm
51
52 \normallineskiplimit=\p@     % Min. dist. btw. lines.
53 \parindent=1cm               % Normal indentation.
54 \hfuzz=0.115\p@              % So we hear fewer complaints.  Good up to
55 \vfuzz=0.115\p@              % 300 dpi.
56
57 \pretolerance=200            % At 12pt, these margins are kind of narrow
58 \tolerance=300               % so we have to be more tolerant.
59 \clubpenalty=\@M             % Never allow these.
60 \widowpenalty=\@M
61 \newlinechar=`\^^J           % For writing output to tty.
62 \uchyph=\z@                  % Don't take any chances.
63 \brokenpenalty=\@M           % Never hyphenate last line on a page.
64 \newcount\defaultinterlinepenalty       % This probably won't make any
65 \defaultinterlinepenalty=\thr@@         % difference, so why not??
66 \interlinepenalty=\defaultinterlinepenalty
67
68
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 %  PARAMETERS DIFFERENT from AmSTeX  %
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72
73 \TagsOnRight                 % Set tags like a sane person does
74
75
76 %%%%%%%%%%%%%%%%%%%%%%%%
77 %  EXTRA FONTS NEEDED  %
78 %%%%%%%%%%%%%%%%%%%%%%%%
79
80 \newif\ifolddigits
81 \olddigitsfalse                 % Allow use of amcscod10 for citations
82 \def\useolddigits{%
83     \olddigitstrue
84     \oktell{Old Digits Mode}%
85 }
86
87 \font\sixrm=cmr6 \font\sixbf=cmbx6
88 \font\sixi=cmmi6 \skewchar\sixi='177
89 \font\sixsy=cmsy6 \skewchar\sixsy='60
90
91 \font\eightrm=cmr8 \font\eightsl=cmsl8 \font\eightit=cmti8
92 \font\eightsy=cmsy8 \skewchar\eightsy='60
93 \skewchar\eightsy='60 \font\eightbf=cmbx8
94 \font\eightex=cmex10 at 8\p@
95 \font\eighti=cmmi8 \skewchar\eighti='177
96
97 \font\ninerm=cmr9  \font\nineit=cmti9
98 \font\ninei=cmmi9   \skewchar\ninei='177
99 \font\ninesy=cmsy9 \skewchar\ninesy='60
100 \font\ninesl=cmsl9 \font\ninebf=cmbx9
101
102 \font\twelvecsc=cmcsc10 scaled \magstep1
103 \font\tencsc=cmcsc10
104 \font\eightcsc=cmcsc10 at 8\p@
105 \font\elevencsc=cmcsc10 scaled \magstephalf
106 \font\ninecsc=cmcsc10 at 9\p@
107
108 \let\tencscod=\tencsc
109 \let\eightcscod=\eightcsc
110
111 \font\eightsf=cmss10 at 8\p@
112 \font\tensf=cmss10
113 \font\twelvesf=cmss10 at 12\p@
114
115 \font\twelvett=cmtt10 scaled \magstep1
116 \font\eighttt=cmtt10 at 8\p@    % \tentt is predefined in plain.tex
117
118 \font\twelvebti=cmbti at 12\p@
119 \font\tenbti=cmbti
120 \font\eightbti=cmbti at 8\p@
121
122 \font\twelveex=cmex10 scaled \magstep1 \font\twelverm=cmr10 scaled \magstep1
123 \font\twelvesl=cmsl10 scaled \magstep1 \font\twelvebf=cmbx10 scaled \magstep1
124 \font\twelvei=cmmi10 scaled \magstep1  \skewchar\twelvei='177
125 \font\twelvesy=cmsy10 scaled \magstep1 \skewchar\twelvesy='60
126 \font\twelveit=cmti10 scaled \magstep1
127
128 \font\twelvechap@font=cmssbx10 at 14\p@
129 \font\twelvesec@font=cmss10 at 13\p@
130 \font\twelvesubsec@font=cmssi10 scaled \magstep1
131
132 \font\tenchap@font=cmssbx10 scaled \magstep1
133 \font\tensec@font=cmssbx10 scaled \magstephalf
134 \font\tensubsec@font=cmssi10
135
136 \font\eightchap@font=cmssbx10
137 \font\eightsec@font=cmss10 at 9\p@
138 \font\eightsubsec@font=cmssqi8
139
140 % Font selection
141 \newcount\font@no
142 \def\curfont{\ifcase\font@no\rm\or\it\or\sl\or\bf\or\tt\or\csc\or\bti\or\sf
143         \else\errmessage{Internal font confusion}\fi}
144
145 %%%%%%%%%%%%%%%%%%%%%
146 %  SPACING CONTROL  %
147 %%%%%%%%%%%%%%%%%%%%%
148
149 \newskip\normalabovedisplayskip
150 \newskip\normalbelowdisplayskip
151 \newskip\normalabovedisplayshortskip
152 \newskip\normalbelowdisplayshortskip
153 \newdimen\normalparskip \normalparskip=22.5\p@
154 \newdimen\parstretch    \parstretch=8\p@
155
156 \newif\ifsinglespacing  % Tells if we are currently in single space mode
157 \newif\ifhalfspacing    % Special version of singlespacing, a little bigger.
158
159 % Actually tell TeX what spacing is wanted
160 \def\setbaselines{%
161     \baselineskip=\normalbaselineskip
162     \abovedisplayskip=\normalabovedisplayskip
163     \belowdisplayskip=\normalbelowdisplayskip
164     \abovedisplayshortskip=\normalabovedisplayshortskip
165     \belowdisplayshortskip=\normalbelowdisplayshortskip
166     % Compute \parskip for even paragraph spacing at all pt sizes
167     \dimen@=\normalparskip
168     \advance\dimen@ by -\normalbaselineskip
169     \parskip=\dimen@ plus\parstretch
170 }
171
172 % Go from double to single spacing
173 \def\reducespacing{%
174     \normalbaselineskip=0.64\normalbaselineskip
175     \normalabovedisplayskip=0.64\normalabovedisplayskip
176     \normalbelowdisplayskip=0.64\normalbelowdisplayskip
177     \normalabovedisplayshortskip=0.64\normalabovedisplayshortskip
178     \normalbelowdisplayshortskip=0.64\normalbelowdisplayshortskip
179 }
180
181 % Set halfspacing baseline etc starting from singlespacing mode
182 \def\sethalfspacing{%
183         \normalbaselineskip=1.28125\normalbaselineskip
184         \abovedisplayskip=1.28125\abovedisplayskip
185         \belowdisplayskip=1.28125\belowdisplayskip
186         \abovedisplayshortskip=1.28125\abovedisplayshortskip
187         \belowdisplayshortskip=1.28125\belowdisplayshortskip
188 }
189
190 % Go to single spacing if we're not there already
191 \def\singlespace{%
192     \normalspacing \reducespacing
193     \halfspacingfalse \singlespacingtrue
194     \setbaselines
195 }
196
197 % Go to 1-1/2 spacing.
198 \def\halfspace{%
199     \normalspacing \reducespacing \sethalfspacing
200     \singlespacingtrue \halfspacingtrue
201     \setbaselines
202 }
203
204 % Go to normal, doublespacing mode
205 \def\doublespace{%
206     \normalspacing
207     \singlespacingfalse \halfspacingfalse
208     \setbaselines
209 }
210
211 % Make sure we're doing the spacing we're supposed to be.
212 \def\setspacing{%
213   \normalspacing
214   \ifsinglespacing
215         \reducespacing
216         \ifhalfspacing \sethalfspacing \fi
217   \fi
218   \setbaselines
219 }
220
221
222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223 %  FOUR DIFFERENT POINT SIZES  %
224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
225
226 \def\twelvepoint{%
227   \def\big@@AmS{10.2\p@}%
228   \def\Big@@AmS{13.8\p@}%
229   \def\bigg@@AmS{17.4\p@}%
230   \def\Bigg@@AmS{21.0\p@}%
231   \let\smallertype=\tenpoint
232   \let\curtype=\twelvepoint
233   \def\biggertype{\errmessage{No larger point size available}}%
234   \def\normalspacing{%
235     \normalbaselineskip=22.8\p@
236     \normalabovedisplayskip=14.5\p@ plus 3\p@ minus 9\p@
237     \normalbelowdisplayskip=14.5\p@ plus 3\p@ minus 9\p@
238     \normalabovedisplayshortskip=\z@ plus 4\p@
239     \normalbelowdisplayshortskip=9\p@ plus 4\p@ minus 5\p@
240   }%
241   \def\rm{\font@no=0\fam\z@\twelverm}%
242   \def\it{\font@no=1\fam\itfam\twelveit}%
243   \def\sl{\font@no=2\fam\slfam\twelvesl}%
244   \def\bf{\font@no=3\fam\bffam\twelvebf}%
245   \def\tt{\font@no=4\fam\ttfam\twelvett \spaceskip.5em plus.25em
246         minus.15em }%
247   \def\csc{\font@no=5\twelvecsc}%
248   \def\bti{\font@no=6\twelvebti}%
249   \def\sf{\font@no=7\twelvesf}%
250   \let\sc=\csc
251   \ifolddigits
252         \let\cite@font=\tencscod
253   \else
254         \let\cite@font=\elevencsc
255   \fi
256   \textfont\z@=\twelverm \scriptfont\z@=\ninerm   \scriptscriptfont\z@=\sixrm
257   \textfont\@ne=\twelvei \scriptfont\@ne=\ninei   \scriptscriptfont\@ne=\sixi
258   \textfont\tw@=\twelvesy \scriptfont\tw@=\ninesy \scriptscriptfont\tw@=\sixsy
259   \textfont\thr@@=\twelveex \scriptfont\thr@@=\twelveex
260         \scriptscriptfont\thr@@=\twelveex
261   \textfont\itfam=\twelveit
262   \textfont\slfam=\twelvesl
263   \textfont\ttfam=\twelvett
264   \textfont\bffam=\twelvebf \scriptfont\bffam=\ninebf
265         \scriptscriptfont\bffam=\sixbf
266   \let\chap@font=\twelvechap@font
267   \let\sec@font=\twelvesec@font
268   \let\subsec@font=\twelvesubsec@font
269   \let\subsubsec@font=\twelvebf
270   \def\oldstyle{\fam1\twelvei}%
271   \setspacing
272   \curfont
273   \ifundefined{everypointsize}\else\everypointsize{twelve}{12}\fi
274 }
275
276 \def\tenpoint{%
277   \def\big@@AmS{8.5\p@}%
278   \def\Big@@AmS{11.5\p@}%
279   \def\bigg@@AmS{14.5\p@}%
280   \def\Bigg@@AmS{17.5\p@}%
281   \let\smallertype=\eightpoint
282   \let\curtype=\tenpoint
283   \let\biggertype=\twelvepoint
284   \def\normalspacing{%
285     \normalbaselineskip=18.9\p@
286     \normalabovedisplayskip=12\p@ plus 3\p@ minus 9\p@
287     \normalbelowdisplayskip=12\p@ plus 3\p@ minus 9\p@
288     \normalabovedisplayshortskip=\z@ plus 3\p@
289     \normalbelowdisplayshortskip=7\p@ plus 3\p@ minus 4\p@
290   }%
291   \def\rm{\font@no=0\fam\z@\tenrm}%
292   \def\it{\font@no=1\fam\itfam\tenit}%
293   \def\sl{\font@no=2\fam\slfam\tensl}%
294   \def\bf{\font@no=3\fam\bffam\tenbf}%
295   \def\tt{\font@no=4\fam\ttfam\tentt \spaceskip.5em plus.25em
296         minus.15em }%
297   \def\csc{\font@no=5\tencsc}
298   \def\bti{\font@no=6\tenbti}%
299   \def\sf{\font@no=7\tensf}%
300   \let\sc=\csc
301   \ifolddigits
302         \let\cite@font=\eightcscod
303   \else
304         \let\cite@font=\ninecsc
305   \fi
306   \textfont\z@=\tenrm \scriptfont\z@=\sevenrm \scriptscriptfont\z@=\fiverm
307   \textfont\@ne=\teni \scriptfont\@ne=\seveni \scriptscriptfont\@ne=\fivei
308   \textfont\tw@=\tensy \scriptfont\tw@=\sevensy \scriptscriptfont\tw@=\fivesy
309   \textfont\thr@@=\tenex \scriptfont\thr@@=\tenex
310         \scriptscriptfont\thr@@=\tenex
311   \textfont\itfam=\tenit
312   \textfont\slfam=\tensl
313   \textfont\ttfam=\tentt
314   \textfont\bffam=\tenbf \scriptfont\bffam=\sevenbf
315         \scriptscriptfont\bffam=\fivebf
316   \let\chap@font=\tenchap@font
317   \let\sec@font=\tensec@font
318   \let\subsec@font=\tensubsec@font
319   \let\subsubsec@font=\tenbf
320   \def\oldstyle{\fam1\teni}%
321   \setspacing
322   \curfont
323   \ifundefined{everypointsize}\else\everypointsize{ten}{10}\fi
324 }
325
326 \def\eightpoint{%
327   \def\big@@AmS{6.8\p@}%
328   \def\Big@@AmS{9.2\p@}%
329   \def\bigg@@AmS{11.6\p@}%
330   \def\Bigg@@AmS{14.0\p@}%
331   \def\smallertype{\errmessage{No smaller point size available}}%
332   \let\curtype=\eightpoint
333   \let\biggertype=\tenpoint
334   \def\normalspacing{%
335     \normalbaselineskip=15\p@
336     \normalabovedisplayskip=10\p@ plus 2.4\p@ minus 7.2\p@
337     \normalbelowdisplayskip=10\p@ plus 2.4\p@ minus 7.2\p@
338     \normalabovedisplayshortskip=\z@ plus 2.4\p@
339     \normalbelowdisplayshortskip=55.6\p@ plus 2.4\p@ minus 3.2\p@
340   }%
341   \def\rm{\font@no=0\fam\z@\eightrm}%
342   \def\it{\font@no=1\fam\itfam\eightit}%
343   \def\sl{\font@no=2\fam\slfam\eightsl}%
344   \def\bf{\font@no=3\fam\bffam\eightbf}%
345   \def\tt{\font@no=4\fam\ttfam\eighttt \spaceskip.5em plus.25em
346         minus.15em }%
347   \def\csc{\font@no=5\eightcsc}%
348   \def\bti{\font@no=6\eightbti}%
349   \def\sf{\font@no=7\eightsf}%
350   \let\sc=\csc
351   \def\cite@font{\errmessage{You may not do citations in 8 point}}
352   \textfont\z@=\eightrm \scriptfont\z@=\sixrm \scriptscriptfont\z@=\fiverm
353   \textfont\@ne=\eighti \scriptfont\@ne=\sixi \scriptscriptfont\@ne=\fivei
354   \textfont\tw@=\eightsy \scriptfont\tw@=\sixsy \scriptscriptfont\tw@=\fivesy
355   \textfont\thr@@=\eightex \scriptfont\thr@@=\eightex
356         \scriptscriptfont\thr@@=\eightex
357   \textfont\itfam=\eightit
358   \textfont\slfam=\eightsl
359   \textfont\ttfam=\eighttt
360   \textfont\bffam=\eightbf \scriptfont\bffam=\sixbf
361         \scriptscriptfont\bffam=\fivebf
362   \let\chap@font=\eightchap@font
363   \let\sec@font=\eightsec@font
364   \let\subsec@font=\eightsubsec@font
365   \let\subsubsec@font=\eightbf
366   \def\oldstyle{\fam1\eighti}%
367   \setspacing
368   \curfont
369   \ifundefined{everypointsize}\else\everypointsize{eight}{10}\fi
370 }
371
372
373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
374 %  TABLE of CONTENTS Macros  %
375 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
376
377 % This set of macros allows you to build a table of contents for a document
378 % automatically in TeX.  There are only three control sequences which you
379 % will need to use.  The first is \inicont, which initializes the macros.
380 % This package works by writing the appropriate lines into a file called
381 % \jobname.toc in your account.  This file is read by \printcontents or
382 % by \printcont in PRINT-PRELIM.TEX.
383 %
384 \newwrite\cont@file                     % Get a free channel to write to
385 \newif\ifcont@closed
386 \cont@closedtrue                        % Haven't opened contents file yet
387 \newwrite\fig@file
388 \newwrite\tab@file
389 \newif\iffig@closed
390 \fig@closedtrue                         % Or the list of figures file
391 \newif\iftab@closed
392 \tab@closedtrue                         % Or the tables file
393
394 \def\contitle{\jobname.toc}             % Default name of contents file
395 \def\figtitle{\jobname.lof}             %  ditto for figures file
396 \def\tabtitle{\jobname.lot}             %  ditto for tables file
397
398 % Make sure the contents file is open before writing to it
399 \def\opencontfile{%
400     \ifcont@closed
401         \immediate\openout\cont@file=\contitle
402         \cont@closedfalse
403     \fi
404 }
405
406 %
407 % This control sequence adds its argument to the table of contents.
408 %
409 \def\content#1{%
410     \opencontfile
411     \let\\=\space
412     \write\cont@file{\string\Z{#1}{\the\pageno}}%
413 }
414
415 %
416 % This control sequence is the same as \content except that the first
417 % box written will have two leading spaces to indent it.
418 %
419 \def\subcontent#1{%
420     \opencontfile
421     \let\\=\space
422     \write\cont@file{\string\Z{\string\hskip \parindent{}#1}{\the\pageno}}%
423 }
424
425 % And the same thing for sub-sections
426 \def\subsubcontent#1{%
427     \opencontfile
428     \let\\=\space
429     \write\cont@file{\string\Z{\string\hskip 2\parindent{}#1}{\the\pageno}}%
430 }
431
432 % And the same thing for sub-sub-sections
433 \def\subsubsubcontent#1{%
434     \opencontfile
435     \let\\=\space
436     \write\cont@file{\string\Z{\string\hskip 3\parindent{}#1}{\the\pageno}}%
437 }
438
439 % Simple table-of-contents printer for \articlestyle.
440 % For dissertations, use the one in print-prelim.tex.
441 % Use this macro as the last thing in your report, since it makes
442 % the page numbers be in romannumerals at the bottom of the page.
443 \def\printcontents{%
444     \closeout \cont@file
445     \null\vfill\supereject      % Close output, end last page
446     \twelvepoint\rm     % Make sure we're in normal mode
447     \pageno=\m@ne       % Contents get roman numerals.
448     \plain@page@numbers % Put page #s at bottom only
449     \oktell{Table of Contents}
450     \null \vskip .8in minus\baselineskip
451     \centerline{\chap@font Contents}
452     \vskip \tw@\baselineskip
453     \rightline{Page}
454     \begingroup  % Temporarily change \baselineskip to avoid
455                  % underfull \vbox's during output errors.
456         \baselineskip=\@ne\baselineskip plus .05\baselineskip
457         \def\Z##1##2{\line{\ignorespaces##1\leaders
458             \hbox to.7em{.\hfil}\hfil\hbox to2em{\hss##2}}}
459         \catcode`@=11
460         \let\\=\space
461         \input\contitle \relax
462     \endgroup   % Also undoes the \catcode change
463 }
464
465
466 %%%%%%%%%%%%%%%%%%%%%%%%
467 %  NUMBERED FOOTNOTES  %
468 %%%%%%%%%%%%%%%%%%%%%%%%
469
470 % First, modify \vfootnote from Plain to use smallertype and singlespace
471 \def\vfootnote#1{%
472     \insert\footins\bgroup\tenpoint\singlespace
473     \interlinepenalty\interfootnotelinepenalty
474     \splittopskip\ht\strutbox % top baseline for broken footnotes
475     \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
476     \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
477     \parindent=.13in
478     \textindent{#1}\footstrut\futurelet\next\fo@t
479 }
480
481 % Allocate a counter for the numbered footnotes
482 \newcount\note@count \note@count=\@ne
483
484 \def\nfootnote#1{%
485     \unskip\footnote{$^{\number\note@count}$}{#1}%
486     \global\advance\note@count by\@ne
487 }
488
489 % Same except that trailing period or comma is ``tucked'' under
490 % the note mark.  \ntucknote provides auto numbering.
491 \def\ntucknote#1#2{\nfootnote{#1}\llap{#2}}
492 \def\tucknote#1#2#3{\footnote{#1}{#2}\llap{#3}}
493
494
495 %%%%%%%%%%%%%%%%%%%%
496 %  UTILITY MACROS  %
497 %%%%%%%%%%%%%%%%%%%%
498
499 % Insert a discretionary hyphen.  For use in restricted
500 % horizontal mode, as in the bibliography.
501 \def\hyphenbreak{\discretionary{-}{}{-}}
502
503 % Check if a macro name is currently undefined (from The TeXbook)
504 \def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}
505
506 % Terminal input and output routines and auxilary stuff
507 \newwrite\undef@out@chan        % Allocate a channel for the tty
508 \def\tell#1{{\let\\=\space\immediate\write\undef@out@chan{#1}}}
509 \def\ask#1{\read-16 to #1}      % Read from tty w/o prompt
510
511 % Sanitize a string before \write'ing it.
512 % Call with \unexpanded{op}{msg}
513 % Modified from version in The TeXbook, originally by Todd Allen
514 \long\def\unexpanded#1#2{%
515     \def\finwrite{#1}%
516     {\aftergroup\finwrite\aftergroup{\sanitize@uci#2\endsanity@uci}}%
517 }
518 \def\sanitize@uci{\futurelet\next@uci\sanswitch@uci}
519 \def\sanswitch@uci{\ifx\next@uci\endsanity@uci
520      \else\ifx\next@uci\\\aftergroup\space\let\next@uci=\eat@uci
521      \else\ifcat\noexpand\next@uci\space\aftergroup\space\let\next@uci=\eat@uci
522      \else\ifcat\noexpand\next@uci\bgroup\aftergroup{\let\next@uci=\eat@uci
523      \else\ifcat\noexpand\next@uci\egroup\aftergroup}\let\next@uci=\eat@uci
524      \else\let\next@uci=\copytoken@uci\fi\fi\fi\fi\fi \next@uci
525 }
526 \def\eat@uci{\afterassignment\sanitize@uci \let\next@uci= }
527 \long\def\copytoken@uci#1{%
528     \ifcat\noexpand#1\relax\aftergroup\noexpand
529         \else\ifcat\noexpand#1\noexpand~\aftergroup\noexpand
530         \fi
531     \fi
532     \aftergroup#1\sanitize@uci
533 }
534 \def\endsanity@uci\endsanity@uci{}
535
536 % Now use the sanity stuff to make a sane tell command.  This macro
537 % actually takes one argument, but since it's the last for \unexpanded,
538 % we avoid scanning it twice by not picking it up here.
539 \def\sanetell{\unexpanded{\immediate\write\undef@out@chan}}
540
541 % Produce verbatim listings of various sorts
542
543 \def\uncatcodespecials{\def\do##1{\catcode`##1=12 } \dospecials}
544 \def\setupverbatim{%
545     \par \tt \spaceskip=\z@     % Want fixed tt spacing now
546     \obeylines \uncatcodespecials \obeyspaces \verbatimdefs
547 }
548
549 % This macro turns on verbatim mode until ?endverbatim is seen.
550 \def\verbatim{%
551     \begingroup \setupverbatim
552     \parskip=\z@ plus .05\baselineskip \parindent=\z@
553     \catcode`\ =13 \catcode`\^^M=13 \catcode`\?=\z@
554     \verbatimgobble
555 }
556 {\catcode`\^^M=13{\catcode`\ =13\gdef\verbatimdefs{\def^^M{\ \par}\let =\ }}
557   \gdef\verbatimgobble#1^^M{}%
558 }
559
560 % This defines ?endverbatim to end the group which begins with \verbatim
561 \let\endverbatim=\endgroup
562
563 % Input a file in verbatim mode.  Sometimes useful for including
564 % real-life examples into a paper.
565 \def\verbfile#1{%
566     \begingroup\setupverbatim
567     \parskip=\z@ plus .05\baselineskip \parindent=\z@
568     \input#1 \endgroup
569 }
570
571 % This is the same as the above, but it adds line numbers to each
572 % line of the file printed.  \lineno@uci has the obvious use.
573 \newcount\lineno@uci
574 \def\listing#1{%
575   \lineno@uci=\z@
576   \begingroup\setupverbatim
577     \parskip=\z@ plus .05\baselineskip \parindent=20\p@
578     \everypar{\advance\lineno@uci by\@ne \llap{\the\lineno@uci\ \ }}%
579     \input#1
580   \endgroup
581 }
582
583 % Draw a little qed symbol (black box)
584 \def\qed{\hbox{\hskip\p@ \vrule width4\p@ height6\p@ depth1.5\p@ \hskip\p@}}
585
586 % Conditions -- from AmSppt
587 \newif\ifrunin@AmS
588 \runin@AmSfalse
589 \let\runin=\runin@AmStrue
590 \newdimen\cond@dimen
591 \newdimen\condindent    % Amount each nested condition is indented
592 \condindent=.5in        % Default indentation amount
593
594 % This is used in \conditions
595 \def\firstcon@AmS#1:{%
596     \ifrunin@AmS
597         {\rm\ignorespaces#1\unskip}\ignorespaces
598         \runin@AmSfalse
599     \else
600         \par
601         \ifdim\lastskip<\smallskipamount
602             \removelastskip \penalty55 \smallskip
603         \fi
604         \\#1:%
605     \fi
606 }
607
608 % Do one item of the conditions.  This is really \\ in disguise.
609 \def\cond@item#1:{%
610     \par\noindent
611     \hbox to \cond@dimen{\hfil\rm\ignorespaces#1\unskip\quad}%
612     \hangafter1
613     \hangindent\cond@dimen\ignorespaces
614 }
615
616 \cond@dimen=\z@         % Value for outermost block
617 % Do the main stuff for \conditions.
618 \def\conditions{%
619     \par
620     \let\\=\cond@item
621     \begingroup
622     \advance\cond@dimen by\condindent
623     \firstcon@AmS
624 }
625
626 % Exit special stuff for \conditions.
627 \def\endconditions{%
628     \par\smallbreak\endgroup
629     \ifdim\cond@dimen>\z@ \cond@item \fi        % If ending an inner condition
630 }
631
632 % Automatically numbered items
633 \newcount\item@count
634 \newdimen\item@dimen  \item@dimen=\z@
635 \def\item@prefix{}
636 \def\beginitems{%
637     \begingroup
638         \advance \parindent by\item@dimen
639         \ifnum\item@dimen>\z@
640             \edef\item@prefix{\item@prefix\number\item@count.}
641         \else
642             \item@dimen=1cm
643         \fi
644         \item@count=\z@ \singlespace \interlinepenalty=200
645 }
646 \def\enditems{\par\endgroup}
647 \def\nitem{\advance\item@count by\@ne \item{\item@prefix\number\item@count.}}
648
649 % Turn back on the \+ construct of plain TeX.
650 \def\tabalign{\us@true\m@ketabbox}
651 \outer\def\+{\tabalign}
652
653 % Fix AmSTeX's definition used in its definition of ~ (tie).
654 \def\s@AmS{\penalty\@M\ifx\tok@AmS\Space@AmS\else\ \fi}
655
656 % And make \/ work the way it does in plain.tex
657 \let\/=\ic@AmS
658
659 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
660 %  PAGE CONTROL and OBJECT MANIPULATION  %
661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
662
663 % This definition doesn't blow up if you're in vertical mode already
664 \def\pagebreak{\ifhmode\vadjust{\break}\else\break\relax}
665
666 % This definition clears out all previous inserts etc to
667 % guarantee that the following stuff is at the top of a page.
668 \def\clearpage{\vfill\supereject}
669
670 % This macro keeps the stuff in the argument on the same page, leaving
671 % blank space on this page if necessary
672 \def\keep{\par\setbox\z@=\vbox\bgroup}
673 \def\endkeep{%
674     \egroup
675     \dimen@=\ht\z@
676     \advance\dimen@ by\dp\z@
677     \vskip\z@ plus\dimen@
678     \penalty\z@
679     \vskip\z@ plus-\dimen@
680     \vskip\parskip
681     \box\z@
682     \goodbreak
683 }
684 \def\filkeep{%
685     \egroup
686     \filbreak
687     \vskip\parskip
688     \box\z@
689     \goodbreak
690 }
691
692 % List macros from the TeXbook
693
694 \toksdef\ta=\z@ \toksdef\tb=\tw@
695 \newif\ifresult@uci
696
697 % usage: \newlist\list
698 \def\newlist#1{\let#1=\empty}
699
700 % usage: \append{item}\to\list
701 \def\append#1\to#2{\ta={\\{#1}}\tb=\expandafter{#2}\edef#2{\the\tb\the\ta}}
702 \def\gappend#1\to#2{\ta={\\{#1}}\tb=\expandafter{#2}\xdef#2{\the\tb\the\ta}}
703
704 % usage: \cardinality\list\to\counter
705 \def\cardinality#1\to#2{#2=\z@ \long\def\\##1{\advance#2 by\@ne }#1}
706
707 % usage: \ifismember{item}\of\list ... \else ... \fi
708 \def\ifismember#1\of#2{%
709     \def\given@uci{#1}%
710     \result@ucifalse
711     \def\\##1{%
712         \def\next@uci{##1}%
713         \ifx\next@uci\given@uci \result@ucitrue\fi
714     }%
715     #2%
716     \ifresult@uci
717 }
718
719 % usage: \ifwasmember{item}\of\list ... \else ... \fi
720 %    side effect: removes {item} from \list if present
721 \def\ifwasmember#1\of#2{%
722     \newlist\ref@mtr
723     \def\given@uci{#1}%
724     \result@ucifalse
725     \def\\##1{%
726         \def\next@uci{##1}%
727         \ifx\next@uci\given@uci
728             \result@ucitrue
729         \else
730             \append ##1\to\ref@mtr
731         \fi
732     }%
733     #2%
734     \let#2=\ref@mtr
735     \ifresult@uci
736 }
737
738 % Append #1 to list #2 if #1 is not already in #2
739 \def\addtolist#1\to#2{%
740     \ifismember#1\of#2%
741     \else
742         \append #1\to #2%
743     \fi
744 }
745 % Same thing, but do it \global'ly
746 \def\gaddtolist#1\to#2{%
747     \ifismember#1\of#2%
748     \else
749         \gappend#1\to#2%
750     \fi
751 }
752
753
754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
755 %  STUFF for BIBLIOGRAPHY and APPENDICES  %
756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757
758 % Bibliography Package:
759 %              Original version by Michal Spivak
760 %              Updated for JACM format and automated by Tim Morgan
761 %              Final cleanup, and much-improved automation, by Marshall Rose
762 %              Additional work and IEEE support by TM.
763
764 % Simple appendix entry builder
765 \def\appendix#1#2{%
766     \par
767     \clearpage
768     \ifoddpages
769         \ifodd\pageno \else \null\vfill\eject\fi
770     \fi
771     \pageno@foot
772     \begingroup
773         \setbox\z@=\hbox{#1}%
774         \ifdim\wd\z@>\z@
775             \content{Appendix #1: #2}%
776             \oktell{Appendix #1: #2}%
777             \def\title{Appendix #1\\#2}%
778         \else
779             \content{Appendix: #2}%
780             \oktell{Appendix: #2}%
781             \def\title{Appendix\\#2}%
782         \fi
783         \let\\=\cr \tabskip=\z@ \chap@font
784         \halign to\hsize{\centerline{\ignorespaces##\unskip}\cr\title\cr}%
785     \endgroup
786     \nobreak
787     \vskip 1.0in minus 0.15in
788 }
789
790
791 % Citations:
792 % We keep a running list, \ref@set, which is
793 % all the things which were \cite'd throughout the paper, with
794 % only one entry for each different key.
795 %
796 % There are three versions of each of the citation
797 % commands:
798 % 1. The \def'd version is the normal one used throughout the paper.
799 % 2. Within a figure, table, etc,'s caption, because of the use of
800 %    \def and \edef, a special version which just produces the
801 %    citation without the \gaddtolist command is used.  These
802 %    definitions are predefined, and are \let to be \cite etc with
803 %    \no@cites, for speed.
804 %
805 % When the user requests a citation with key, we first look it up
806 % in a translation table called \key@table, organized as a list of
807 % <key, printed-key> pairs, to see if it really should be
808 % printed differently.  The user can specify this translation table using
809 % the \printkey command.  If a key is not in the table, it is printed
810 % as-is.
811
812 % We keep the dimension \key@size as the largest printed key so far.
813 % This value can then be used to print the keys in the bibliography
814 % optimally, rather than just trying to guess.  Each time we print a
815 % (in \use@key), we see if it's longer than \key@size, and if so then
816 % we set \key@size = its width.
817 \newdimen\key@size
818 \key@size=\z@   % Init. value so \key@size is made as small as possible
819
820 % Invisible citation.  usage: \icite{key}
821 \def\icite#1{%
822     \gaddtolist#1\to\ref@set
823 }
824
825 % Management of \key@table stuff.  This table is formatted as
826 % \\{real-key}{printed-key}...
827 \newlist\key@table
828
829 % Add a pair of items to the list.  This should be done before any
830 % citations are made, for obvious reasons.
831 % #1=real key (the one you use in the paper and bibliography)
832 % #2=the key that gets printed in the output
833 \def\printkey#1#2{%
834         \ta={\\{#1}{#2}}%
835         \tb=\expandafter{\key@table}%
836         \xdef\key@table{\the\tb\the\ta}%
837 }
838
839 % Print a key, looking it up in the table.  #1 is \whatever which
840 % expands to the key used by the user.  The definition of \\ here
841 % makes use of the format of the \key@table, so that the table is
842 % actually EXECUTED, hence making lookup relatively fast.
843 \newif\if@not@printed@
844 \def\use@key#1{%
845     \@not@printed@true
846     \def\\##1##2{%
847         \if@not@printed@
848             \def\temp@uci{##1}%
849             \ifx\temp@uci#1%
850                 \@not@printed@false
851                 \setbox\z@=\hbox{[##2]\enspace}%
852                 \ifdim\wd\z@>\key@size \global\key@size=\wd\z@ \fi
853                 ##2%
854             \fi
855         \fi
856     }%
857     \key@table
858     \if@not@printed@
859         \setbox\z@=\hbox{\cite@font[\ignorespaces#1\unskip]\enspace}%
860         \ifdim\wd\z@>\key@size \global\key@size=\wd\z@ \fi
861         #1%
862     \fi
863 }
864
865 % This macro moves forward until it hits \end, skipping spaces.
866 % Each time it hits a comma, or when it hits and \end, it
867 % adds whatever has been collected so far (in \@total) to
868 % \ref@set and to the output list.  It is assumed that \@total
869 % has been set to \empty before this routine is called (this is done
870 % by \@@cite, below).
871 \def\@icite#1{%
872     \if#1\end
873         \expandafter\gaddtolist\@total\to\ref@set
874         \use@key\@total
875         \let\@next=\relax       % Exit loop after this time
876     \else
877         \if#1,%                 % We have a complete key now.
878             \expandafter\gaddtolist\@total\to\ref@set
879             \use@key\@total,\space
880             \global\let\@total=\empty
881         \else
882             \xdef\@total{\@total#1}%    Add new char to total
883         \fi
884         \let\@next=\@icite      % Continue looping until done
885     \fi
886     \@next
887 }
888
889 % Initialize and call \@icite.  Used in \cite, \citep, \citepp
890 \def\@@cite#1{\global\let\@total=\empty\@icite#1\end}
891
892 % usage: \cite{key [, key...]}
893 \def\cite#1{%
894     {\cite@font[\@@cite{#1}]}%
895 }
896
897 % usage: \citep{key}{page}
898 \def\citep#1#2{%
899     {\cite@font[\@@cite{#1}, \hbox{\rm p \ignorespaces#2\unskip}]}%
900 }
901
902 % usage: \citepp{key}{pages}
903 \def\citepp#1#2{%
904     {\cite@font[\@@cite{#1}, \hbox{\rm pp \ignorespaces#2\unskip}]}%
905 }
906
907 % These three definitions are used in \no@cites, below.  They
908 % don't handle extraneous spaces as well as the normal
909 % definition, but they should be sufficient for most people.
910 \def\i@cite#1{{\cite@font[\noexpand\noexpand\noexpand\@@cite{#1}]}}
911
912 \def\i@citep#1#2{{\cite@font[\noexpand\noexpand\noexpand\@@cite{#1},\space
913         \hbox{\noexpand\noexpand\noexpand\rm p \ignorespaces#2\unskip}]}%
914 }
915
916 \def\i@citepp#1#2{{\cite@font[\noexpand\noexpand\noexpand\@@cite{#1},\space
917         \hbox{\noexpand\noexpand\noexpand\rm pp \ignorespaces#2\unskip}]}%
918 }
919
920 % Turn off adding citations to \ref@set.  This is needed when
921 % using \cite etc inside a caption for tables, figures, etc.
922 % \no@cites is undone by exiting an enclosing group.
923 \def\no@cites{%
924     \let\citepp=\i@citepp
925     \let\citep=\i@citep
926     \let\cite=\i@cite
927 }
928
929 %%%%%%%%%%%%%%%%%%%%%%
930 % References Section %
931 %%%%%%%%%%%%%%%%%%%%%%
932
933 % The basic strategy is as follows.  We read the bib. file, which is
934 % assumed to be in sorted order of keys/author names.  Each
935 % entry is of the form \ref{key}.  We see if that key is in the table
936 % \ref@set, which is a table of all the keys we've \cite'd.  If the key
937 % isn't in the list, we print it in parens and go on to the next entry.
938 % Otherwise, we print the key in square brackets, and format the
939 % bibliography entry according to the format (JACM or IEEE).  We print a
940 % warning if the key is in the \ref@seen list.  We add the key to
941 % the \ref@seen list.  The key is removed from the \ref@set list if it
942 % was there.  At the end of the references (\endreferences), we check
943 % if there are any keys left in \ref@set.  If so, the bib. file was
944 % deficient, and we print a warning message (it should probably be a
945 % fatal error message).
946
947 % Annotation control
948 \newif\ifinclude@annos                  % Should annotations be printed?
949 \include@annosfalse                     % By default, no
950 \def\annotate{%                         % ``official'' command
951     \include@annostrue
952     \oktell{Annotating bibliography}%
953 }
954
955 \newif\ifin@anno                        % True while doing an annotation
956 \in@annofalse
957
958 \def\refi@AmS{F}                        % This starts as False
959
960 % Begin an annotation -- must be in vertical mode.  Just gather
961 % text into box0 for use by \endanno.  We do a couple of consistency
962 % checks at the beginning.
963 \def\anno{%
964     \ifhmode
965         \message{You forgot the \noexpand\endref command!}
966         \message{I've inserted one for you.}
967         \endanno
968     \fi
969     \if F\refi@AmS
970         \errmessage{No \noexpand\ref command before first \noexpand\anno}
971     \fi
972     \let\\=\newline
973     \in@annotrue
974     \setbox\z@=\vbox\bgroup
975 }
976
977 % End of an annotation.  Decide if it should be typeset or skipped.
978 \def\endanno{%
979     \egroup                             % End the group for box0
980     \in@annofalse                       % No longer doing an annotation
981     \if T\refed@uci                     % If previous reference was used,
982         \ifinclude@annos {%     And if we're producing an annotated bib.,
983             \vskip\parskip
984             \interlinepenalty=\defaultinterlinepenalty
985             \unvbox\z@  % Then include annotation as normal paragraph(s)
986             \par
987         }\fi
988     \fi
989 }
990
991 \global\newlist\ref@set                 % list of all references cited
992 \global\newlist\ref@seen                % list of all references defined
993
994 \def\reftitle{References}               % Default title for bibliography
995
996 % usage: \references (begin the References section)
997 \def\references{%
998     \vfill\supereject                   % Begin new page, clear out everything
999     \ifoddpages                         % Make sure start on even page.
1000         \ifodd\pageno \relax \else \null\vfill\eject \fi
1001     \fi
1002     \begingroup                         % Following changes are local to bib.
1003
1004     \twelvepoint                        % Get good appearance
1005     \singlespace
1006     \no@cites                           % \cite's just produce [key]
1007     \parskip=0.6\baselineskip plus5\p@ minus4\p@
1008     \tolerance=5000                     % Must be extremely tolerant!
1009     \pretolerance=300
1010     \interlinepenalty=400               % To discourage breaking a reference
1011                                         % across page boundaries
1012     \uchyph=\@ne                        % Needed to try hyphenating title words
1013     \sfcode`.=\@m                       % Like \frenchspacing, but only for
1014                                         % periods
1015
1016     % Now we output the title and so forth.
1017     \centerline{\csc \reftitle}%
1018     \nobreak
1019     \medskip
1020     \content\reftitle                   % Tell user and TOC.
1021     \oktell\reftitle
1022     \pageno@foot                        % Put page # in special place
1023
1024     % Special definitions within reference mode
1025     \let\year=\yr
1026     \let\month=\mon
1027 }
1028
1029 % usage: \endreferences (end the References section)
1030 \def\endreferences{%
1031     \par        % Make sure last printed reference is finished up.
1032     \cardinality\ref@set\to\count@
1033     \ifnum\count@>\z@
1034         \def\\##1{[##1] }
1035         \ifnum\count@>1
1036           \message{Warning: \number\count@\space undefined citations: \ref@set}
1037         \else
1038           \message{Warning: One undefined citation: \ref@set}
1039         \fi
1040     \fi
1041   \endgroup     % End of \references group
1042 }
1043
1044
1045 % References Database
1046
1047
1048 \newbox\bybox@AmS       \newbox\bysamebox@AmS
1049 \newbox\paperbox@AmS    \newbox\paperinfobox@AmS
1050 \newbox\jourbox@AmS     \newbox\jourinfobox@AmS
1051 \newbox\volbox@AmS      \newbox\issuebox@AmS
1052 \newbox\monbox@AmS      \newbox\yrbox@AmS
1053 \newbox\pagesbox@AmS    \newbox\editorbox@AmS
1054 \newbox\bookbox@AmS     \newbox\bookinfobox@AmS
1055 \newbox\publbox@AmS     \newbox\publaddrbox@AmS
1056 \newbox\finalinfobox@AmS\newbox\wastebox@uci
1057 \newbox\talkbox@AmS     \newbox\keybox@AmS
1058 \newbox\editorsbox@AmS
1059
1060 \def\using@IEEE{F}      % By default, not using IEEE format
1061
1062 % reset a \keyword to the ``not used'' condition
1063 \def\refset@AmS#1{%
1064     \expandafter\gdef\csname is\expandafter\eat@AmS
1065     \string#1@AmS\endcsname{F}\expandafter
1066     \setbox\csname\expandafter\eat@AmS\string#1box@AmS\endcsname=\null
1067 }
1068
1069 % reset \keyword's
1070 \def\ref@AmS{%
1071     \refset@AmS\key     \refset@AmS\finalinfo
1072     \refset@AmS\by      \gdef\isbysame@AmS{F}%
1073     \refset@AmS\paper   \refset@AmS\paperinfo
1074     \refset@AmS\jour    \refset@AmS\jourinfo
1075     \refset@AmS\vol     \refset@AmS\issue
1076     \refset@AmS\mon     \refset@AmS\yr
1077     \refset@AmS\pages   \gdef\ispage@AmS{F}%
1078     \refset@AmS\book    \refset@AmS\bookinfo
1079     \refset@AmS\publ    \refset@AmS\publaddr
1080     \refset@AmS\editor  \refset@AmS\talk
1081     \refset@AmS\editors
1082     \gdef\istoappear@AmS{F}%
1083     \gdef\isinbook@AmS{F}%
1084     \bgroup
1085     \ignorespaces
1086 }
1087
1088 % usage: \ref{citation} \keywords arguments ... \endref.  We make sure
1089 % we aren't still doing an \anno first.
1090 \def\ref#1{%
1091     \ifin@anno
1092         \message{You forgot an \noexpand\endanno command,}
1093         \message{but I forgive you this time.}
1094         \endanno
1095     \fi
1096     \def\refi@AmS{T}%
1097     \ifwasmember#1\of\ref@set
1098         \def\refed@uci{T}%
1099         \okmessage{[#1]}%
1100     \else
1101         \def\refed@uci{F}%
1102         \okmessage{(#1)}%
1103     \fi
1104     \ifismember#1\of\ref@seen
1105         \sanetell{multiply defined: [#1]}%
1106     \else
1107         \append#1\to\ref@seen
1108     \fi
1109     \def\refl@AmS{F}%
1110     \def\\{\egroup\endref@AmS\gdef\refi@AmS{F}\ref@AmS}%
1111     \ref@AmS
1112     \gdef\@total{#1}%
1113     \key \if T\refed@uci
1114         \use@key\@total
1115     \fi\egroup\setbox\wastebox@uci=\hbox\bgroup\ignorespaces
1116 }
1117
1118 % End of a reference.
1119 %
1120 % Note that \endref@AmS is \let to be whichever \endref@xxx command
1121 % is being used; default is \endref@JACM for JACM format.
1122 %
1123 % If we printed the reference, \endref@AmS will
1124 % have set \bysamebox@AmS to be a box containing a box
1125 % containing a rule and a period.  This is unboxed if a subsequent
1126 % reference which gets printed uses \bysame.  Otherwise, we here
1127 % save the \by field (if given) so that if a subsequent reference
1128 % using \bysame gets used, we'll know who the author was, even though
1129 % the reference which gave the author(s) wasn't printed.  Tricky, huh?
1130 \def\endref{%
1131     \egroup\gdef\refl@AmS{T}%
1132     \if T\refed@uci
1133         \endref@AmS
1134     \else
1135         \if T\isby@AmS
1136             \setbox\bysamebox@AmS=\box\bybox@AmS
1137         \fi
1138     \fi
1139     \par
1140 }
1141
1142 % define a \keyword.  #1=keyword, #2=font to use, or {}
1143 \def\refdef@AmS#1#2{%
1144     \def#1{%
1145         \egroup
1146         \expandafter\gdef
1147                 \csname is\expandafter\eat@AmS\string#1@AmS\endcsname{T}%
1148         \expandafter\setbox
1149                 \csname\expandafter\eat@AmS\string#1box@AmS\endcsname
1150                         =\hbox\bgroup#2\ignorespaces
1151     }%
1152 }
1153
1154 % define the keywords
1155
1156 \refdef@AmS\by\by@font          \refdef@AmS\paper{}
1157 \refdef@AmS\paperinfo{}         \refdef@AmS\jour\book@font
1158 \refdef@AmS\vol\book@font       \refdef@AmS\issue{}
1159 \refdef@AmS\mon{}               \refdef@AmS\yr{}
1160 \refdef@AmS\pages{}             \refdef@AmS\talk{}
1161 \refdef@AmS\book\book@font      \refdef@AmS\bookinfo{}
1162 \refdef@AmS\publ{}              \refdef@AmS\publaddr{}
1163 \refdef@AmS\finalinfo{}         \refdef@AmS\editor{}
1164 \refdef@AmS\jourinfo{}          \refdef@AmS\key\cite@font
1165 \refdef@AmS\editors{}
1166
1167 % These don't fit the normal pattern.
1168 \def\bysame{\egroup\gdef\isbysame@AmS{T}\bgroup}
1169 \def\page{\egroup\gdef\ispage@AmS{T}\setbox\pagesbox@AmS=\hbox\bgroup
1170         \ignorespaces}
1171 \def\toappear{\egroup\gdef\istoappear@AmS{T}\bgroup}
1172 \def\inbook{\egroup\gdef\isinbook@AmS{T}\setbox\bookbox@AmS=\hbox\bgroup
1173         \book@font\ignorespaces
1174 }
1175
1176 % This is the font we normally print book and journal titles in, but we
1177 % use \twelveit for IEEE format.
1178 \let\book@font=\twelvesl
1179
1180 % Similarly, this is the font to use for the author's name(s).
1181 % Optionally, the user can ask for the cite font instead (this is
1182 % not necessarily related to use of the IEEE format).
1183 \let\by@font=\twelverm
1184
1185 % As an option, the user can have the author's name(s) in caps-small-caps.
1186 \def\AuthorsInCSC{%
1187     \let\by@font=\elevencsc
1188     \oktell{Authors in CSC mode}%
1189 }
1190
1191 % Define some aliases for some of the above, for user convenience.
1192 \let\pp=\pages
1193 \let\pgs=\pages
1194 \let\pg=\page
1195 \let\p=\page
1196 \let\journal=\jour
1197 \let\volume=\vol
1198 \let\author=\by
1199 \let\authors=\by
1200 \let\ieee@editors=\editors      % Save it in case we use IEEE format
1201 \let\editors=\editor            % If using default JACM format
1202 \let\other=\talk
1203 \let\no=\issue
1204
1205 % Helpers to \endref@AmS, which speed things up a lot, and/or
1206 % make the code more compact.
1207 \def\a@comma{, }        % Used in next routine.  Predefined for speed of \let.
1208 \def\setpunct@AmS{\let\prepunct@AmS=\a@comma}
1209 \def\ppunbox@AmS#1{\prepunct@AmS\unhbox#1\unskip}
1210
1211
1212 % Actually do some typesetting (finally).  As mentioned above,
1213 % \endref@AmS is called to print a reference if we want it.  It
1214 % is \let to be either \endref@JACM or \endref@IEEE (or possibly
1215 % some other format in the future) depending on the desired
1216 % format.
1217 %
1218 % For some reason, the ~'s don't see to tie things, so some
1219 % \hbox's were introduced.
1220 %
1221 % There is unfortunately a lot of common code between the
1222 % different formats.  Here are some sections which were easy to
1223 % pull out:
1224 \def\endref@startup{%
1225     % Test to see if there is anything in the wastebox
1226     \setbox\wastebox@uci=\hbox{\unhbox\wastebox@uci\unskip}%
1227     \ifdim\wd\wastebox@uci>\z@
1228         \errmessage{Keyword omitted after \noexpand\ref}%
1229     \fi
1230     \let\prepunct@AmS=\empty
1231     \vskip\parskip
1232     \noindent \hangafter=\@ne
1233 }
1234
1235 % This is the text printed for the JACM format for papers
1236 % appearing in a book.
1237 \def\appearing@in{Appearing in }
1238
1239 % Common code at the end of \endref@JACM and \endref@IEEE.
1240 % The argument is the date routine to use.
1241 \def\endref@finishup#1{%
1242     \if T\istalk@AmS
1243         \dimen@=\wd\talkbox@AmS
1244         \ifdim\dimen@>\z@
1245             \ppunbox@AmS\talkbox@AmS\setpunct@AmS
1246         \fi
1247     \fi
1248     \if T\isbook@AmS
1249         \ppunbox@AmS\bookbox@AmS \setpunct@AmS
1250         \editor@ref
1251     \fi
1252     \if T\isinbook@AmS
1253         \prepunct@AmS\appearing@in\unhbox\bookbox@AmS\unskip \setpunct@AmS
1254         \editor@ref \gdef\isbook@AmS{T}%
1255     \fi
1256     \if T\isbookinfo@AmS
1257         \ppunbox@AmS\bookinfobox@AmS\setpunct@AmS
1258     \fi
1259     \if T\using@IEEE
1260         \if T\ispubladdr@AmS
1261             \ppunbox@AmS\publaddrbox@AmS
1262             \if T\ispubl@AmS \def\prepunct@AmS{: }\else\setpunct@AmS\fi
1263         \fi
1264         \if T\ispubl@AmS
1265             \ppunbox@AmS\publbox@AmS\setpunct@AmS
1266         \fi
1267     \else
1268         \if T\ispubl@AmS
1269             \ppunbox@AmS\publbox@AmS\setpunct@AmS
1270         \fi
1271         \if T\ispubladdr@AmS
1272             \ppunbox@AmS\publaddrbox@AmS\setpunct@AmS
1273         \fi
1274     \fi
1275     \if T\isbook@AmS
1276         \if T\isvol@AmS
1277             \prepunct@AmS Vol.~\unhbox\volbox@AmS\unskip\setpunct@AmS
1278         \fi
1279         \if T\isyr@AmS
1280             \ppunbox@AmS\yrbox@AmS\setpunct@AmS
1281         \fi
1282         \if T\istoappear@AmS
1283             \ (to appear)\setpunct@AmS
1284         \fi
1285         \if T\ispages@AmS
1286             \prepunct@AmS pp.~\unhbox\pagesbox@AmS\unskip\setpunct@AmS
1287         \fi
1288         \if T\ispage@AmS
1289             \prepunct@AmS p.~\unhbox\pagesbox@AmS\unskip\setpunct@AmS
1290         \fi
1291     \fi
1292     \if T\istalk@AmS
1293         #1%     This is the date routine to use.
1294     \fi
1295     \if T\isfinalinfo@AmS
1296         \period\unhbox\finalinfobox@AmS
1297     \else
1298         \if T\refl@AmS .
1299         \else ;
1300         \fi
1301     \fi
1302 }
1303
1304 % Print editor(s) if and as appropriate.
1305 \def\editor@ref{%
1306     \if T\using@IEEE
1307         \if T\iseditor@AmS
1308             \ppunbox@AmS\editorbox@AmS, Ed.\setpunct@AmS
1309         \fi
1310         \if T\iseditors@AmS
1311             \ppunbox@AmS\editorsbox@AmS, Eds.\setpunct@AmS
1312         \fi
1313     \else
1314         \if T\iseditor@AmS
1315             \ppunbox@AmS\editorbox@AmS\ (ed.)\setpunct@AmS
1316         \fi
1317     \fi
1318 }
1319
1320 % This routine prints the date in the JACM format
1321 \def\date@JACM{%
1322     \if T\isyr@AmS
1323         \/\ (%
1324         \if T\ismon@AmS
1325             \unhbox\monbox@AmS\unskip,
1326         \fi
1327         \unhbox\yrbox@AmS\unskip)\setpunct@AmS
1328     \else
1329         \if T\ismon@AmS
1330             \ppunbox@AmS\monbox@AmS\setpunct@AmS
1331         \fi
1332     \fi
1333 }
1334
1335 % This prints the date in the IEEE format.
1336 \def\date@IEEE{%
1337     \if T\isyr@AmS
1338         \prepunct@AmS
1339         \if T\ismon@AmS
1340             \unhbox\monbox@AmS\unskip\a@comma
1341         \fi
1342         \unhbox\yrbox@AmS\unskip\setpunct@AmS
1343     \else
1344         \if T\ismon@AmS
1345             \ppunbox@AmS\monbox@AmS\setpunct@AmS
1346         \fi
1347     \fi
1348 }
1349
1350
1351 % This version produces JACM format references.
1352 \def\endref@JACM{%
1353     \endref@startup
1354     \if T\refi@AmS
1355         \hbox to \key@size{\cite@font [\unhbox\keybox@AmS\unskip]\hfil}%
1356         \hangindent=\key@size
1357         \if T\isby@AmS
1358            \unhcopy\bybox@AmS\unskip
1359            \def\prepunct@AmS{\hskip7\p@ plus5\p@\relax}%
1360            \setbox\z@=\hbox{\unhbox\bybox@AmS\unskip}%
1361            \dimen@=\wd\z@       % We want \dimen0=max(\wd0, 2in)
1362            \ifdim\dimen@>2in \dimen@=2in \fi
1363            \setbox\bysamebox@AmS=\hbox{\hbox to\dimen@{\leaders\hrule\hfill.}}%
1364         \else
1365             \if T\isbysame@AmS
1366                 \unhcopy\bysamebox@AmS\unskip
1367                 \def\prepunct@AmS{\hskip7\p@ plus5\p@\relax}%
1368             \fi
1369         \fi
1370     \fi
1371     \if T\ispaper@AmS
1372         \ppunbox@AmS\paperbox@AmS\def\prepunct@AmS{. }%
1373     \fi
1374     \if T\ispaperinfo@AmS
1375         \ppunbox@AmS\paperinfobox@AmS\def\prepunct@AmS{. }%
1376     \fi
1377     \if T\isjour@AmS
1378         \ppunbox@AmS\jourbox@AmS\setpunct@AmS
1379         \editor@ref
1380         \if T\isjourinfo@AmS
1381             \ppunbox@AmS\jourinfobox@AmS\setpunct@AmS
1382         \fi
1383         \if T\isvol@AmS
1384             \ \unhbox\volbox@AmS\unskip
1385         \fi
1386         \if T\isissue@AmS
1387             \ppunbox@AmS\issuebox@AmS\setpunct@AmS
1388         \fi
1389         \date@JACM
1390         \if T\istoappear@AmS
1391             \ (to appear)\setpunct@AmS
1392         \fi
1393         \if T\ispages@AmS
1394             \ppunbox@AmS\pagesbox@AmS\setpunct@AmS
1395         \fi
1396         \if T\ispage@AmS
1397             \prepunct@AmS p.~\unhbox\pagesbox@AmS\unskip\setpunct@AmS
1398         \fi
1399     \fi
1400     \endref@finishup\date@JACM
1401 }
1402
1403
1404 % This version produces IEEE format references.
1405 \def\endref@IEEE{%
1406     \endref@startup
1407     \if T\refi@AmS
1408         \hbox to \key@size{\cite@font [\unhbox\keybox@AmS\unskip]\hfil}%
1409         \hangindent=\key@size
1410         \if T\isby@AmS \unhcopy\bybox@AmS\unskip\setpunct@AmS
1411            \setbox\z@=\hbox{\unhbox\bybox@AmS\unskip}%
1412            \dimen@=\wd\z@       % We want \dimen0=max(\wd0, 2in)
1413            \ifdim\dimen@>2in \dimen@=2in \fi
1414            \setbox\bysamebox@AmS=\hbox{\hbox to\dimen@{\leaders\hrule\hfill}}%
1415         \else
1416             \if T\isbysame@AmS
1417                 \unhcopy\bysamebox@AmS\unskip\setpunct@AmS
1418             \fi
1419         \fi
1420     \fi
1421     \if T\ispaper@AmS
1422         \prepunct@AmS``\unhbox\paperbox@AmS\unskip,''
1423         \let\prepunct@AmS=\empty
1424     \fi
1425     \if T\ispaperinfo@AmS
1426         \ppunbox@AmS\paperinfobox@AmS\def\prepunct@AmS{, }%
1427     \fi
1428     \if T\isjour@AmS
1429         \ppunbox@AmS\jourbox@AmS\setpunct@AmS
1430         \editor@ref
1431         \if T\isjourinfo@AmS
1432             \ppunbox@AmS\jourinfobox@AmS\setpunct@AmS
1433         \fi
1434         \if T\isvol@AmS
1435             \prepunct@AmS vol.~\unhbox\volbox@AmS\unskip\setpunct@AmS
1436         \fi
1437         \if T\isissue@AmS
1438             \prepunct@AmS no.~\unhbox\issuebox@AmS\unskip\setpunct@AmS
1439         \fi
1440         \if T\istoappear@AmS
1441             \ (to appear)\setpunct@AmS
1442         \fi
1443         \if T\ispages@AmS
1444             \prepunct@AmS pp.~\unhbox\pagesbox@AmS\unskip\setpunct@AmS
1445         \fi
1446         \if T\ispage@AmS
1447             \prepunct@AmS p.~\unhbox\pagesbox@AmS\unskip\setpunct@AmS
1448         \fi
1449         \if T\ispubladdr@AmS
1450             \ppunbox@AmS\publaddrbox@AmS
1451             \if T\ispubl@AmS \def\prepunct@AmS{: }\else\setpunct@AmS\fi
1452         \fi
1453         \if T\ispubl@AmS
1454             \ppunbox@AmS\publbox@AmS\setpunct@AmS
1455         \fi
1456         \let\ispubl@AmS=F\let\ispubladdr@AmS=F% For finishup routine
1457         \date@IEEE
1458     \fi
1459     \endref@finishup\date@IEEE
1460 }
1461
1462
1463 % By default, we use JACM format references
1464 \let\endref@AmS=\endref@JACM
1465
1466 % But it's possible to get the other format
1467 \def\IEEE{%
1468     \gdef\using@IEEE{T}%        Now we're using IEEE format.
1469     \let\editors=\ieee@editors
1470     \let\endref@AmS=\endref@IEEE
1471     \refdef@AmS\vol{}%          Vol not printed in slanted any more.
1472     \global\let\appearing@in=\empty     % Don't say that in IEEE format.
1473     \let\volume=\vol
1474     \let\book@font=\twelveit    % Book and journal titles in this font.
1475     \oktell{IEEE Bibliography Style}%
1476 }
1477
1478
1479 % References Dump
1480
1481 \newwrite\dump@file
1482
1483 \catcode`\{=12  \catcode`\}=12  \catcode`\%=12  \catcode`\[=1   \catcode`\]=2
1484 \def\ref@open[{]
1485 \def\ref@close[}]
1486 \def\ref@comment[%]
1487 \catcode`\{=1   \catcode`\}=2   \catcode`\%=14  \catcode`\[=12  \catcode`\]=12
1488
1489 \def\refdump{%
1490     \vfill\supereject
1491     \begingroup
1492         \content\reftitle
1493         \tell{Dumping \reftitle\space to refdump.tex}%
1494         \immediate\openout\dump@file=refdump
1495         \immediate\write\dump@file{%
1496             \noexpand\catcode`\noexpand\@=11 ^^J%
1497             \noexpand\let\noexpand\content=\noexpand\eat@AmS^^J%
1498             \noexpand\pageno=\the\pageno^^J%
1499             \noexpand\def\noexpand\ref@set\ref@open\ref@comment
1500         }%
1501         \def\\##1{\immediate\write\dump@file{ \noexpand\\{##1}\ref@comment}}%
1502         \ref@set
1503         \immediate\write\dump@file{%
1504             \ref@close^^J%
1505         }%
1506         \immediate\closeout\dump@file
1507     \endgroup
1508 }
1509
1510
1511 %%%%%%%%%%%%%%%%%%%%
1512 %  OUTPUT CONTROL  %
1513 %%%%%%%%%%%%%%%%%%%%
1514
1515 % Control for informational messages.  Default is \verbose mode.
1516 \newif\iftell@all
1517 \let\verbose=\tell@alltrue
1518 \let\quiet=\tell@allfalse
1519 \verbose
1520 \def\oktell#1{\iftell@all\tell{#1}\fi}
1521 \def\okmessage#1{\iftell@all\message{#1}\fi}
1522
1523 % Chapter macro parameters
1524 \newcount\chapterno
1525 \chapterno=\z@          % Number of current chapter
1526 \newif\ifnumber@chapters
1527 \number@chapterstrue      % By default, number the chapters
1528 \def\nochapternumbers{%
1529     \number@chaptersfalse
1530     \oktell{No Chapter Numbers mode}%
1531 }
1532
1533 % Same thing for sections, subsections, etc
1534 \newcount\sectno \sectno=\@ne
1535 \newcount\subsectno \subsectno=\@ne
1536 \newcount\subsubsectno \subsubsectno=\@ne
1537 \newif\ifnumber@sections
1538 \def\numbersections{%
1539     \number@sectionstrue
1540     \oktell{Section Numbers mode}%
1541 }
1542
1543
1544 %%%%%%%%%%%%%%%%%%%%%%%%%%%
1545 %  OUTPUT CONTROL MACROS  %
1546 %%%%%%%%%%%%%%%%%%%%%%%%%%%
1547
1548
1549 % Center, left justify, right justify -- avoid exceeding margins
1550 \def\centerline#1{\line{\hfill#1\hfill}}
1551 \def\leftline#1{\line{#1\hfill}}
1552 \def\rightline#1{\line{\hfill#1}}
1553 \def\threepart#1#2#3{\line{\hskip\leftskip\rlap{#1}\hfill#2\hfill
1554     \llap{#3}\hskip\rightskip}}
1555
1556 % End of the main body of the document
1557 \let\enddiss=\bye
1558
1559 % Summary Information
1560 \outer\def\showsummary{%
1561     \begingroup
1562         \def\note##1##2##3##4{%
1563             \count@=##1
1564             \advance\count@ by##3
1565             \ifcase\count@
1566                 \message{No ##2s##4}\or
1567                 \message{1 ##2##4}\else
1568                 \message{\the\count@\space ##2s##4}\fi
1569         }%
1570         \note\fignumber{figure}{-1}{,}%
1571         \note\tablenumber{table}{-1}{,}%
1572         \note\note@count{footnote}{-1}{,}%
1573         \cardinality\ref@set\to\count@
1574         \note\count@{citation}{0}{.}%
1575     \endgroup
1576 }
1577
1578
1579 % Real version of ragged right margins
1580 \def\raggedright{%
1581     \rightskip=\z@ plus 2em
1582     \oktell{Raggedright mode}%
1583 }
1584
1585 % Disallow hyphenation -- a very dangerous thing
1586 \def\nohyphens{%
1587     \hyphenpenalty=\@M\tolerance=500\pretolerance=\@M
1588     \oktell{Nohyphens mode}%
1589 }
1590
1591 % Allow capitalized words to be hyphenated
1592 \def\hyphenall{%
1593     \uchyph=\@ne
1594     \oktell{Hyphenating all words}%
1595 }
1596
1597 % Handle a long quotation in a standard way
1598 \def\bigquote#1\endbigquote{%
1599     \par
1600     \vskip \baselineskip  \vskip -\parskip
1601     {   \advance\rightskip by30\p@
1602         \advance\leftskip by30\p@
1603         \smallertype
1604         \singlespace
1605         \let\\=\newline
1606         \noindent\llap{``}\ignorespaces#1\unskip''\par
1607     }% End of singlespacing and special indentation
1608     \vskip \baselineskip  \vskip -\parskip
1609 }
1610
1611
1612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1613 %  CHAPTERS, SECTIONS, FIGURES, TABLES %
1614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1615
1616 % What to do at the beginning of a chapter
1617 \def\chapter#1\endchapter{
1618     \chapter@base #1\endchapter
1619     \oktell{Chapter \number\chapterno: #1}
1620     \content{Chapter \number\chapterno: #1}
1621 }
1622
1623
1624 % This boolean controls whether chapters are made to start only on
1625 % odd pages.
1626 \newif\ifoddpages
1627 \oddpagesfalse
1628 \def\twosided{%         This is the ``official'' command
1629     \oddpagestrue
1630     \oktell{Twosided mode}%
1631 }
1632
1633 % The guts of the \chapter command.  \chapter==\chapter@base when
1634 % in \articlestyle.
1635 \def\chapter@base#1\endchapter{
1636     \par
1637     \clearpage                          % Clean up from prev chapter
1638     \ifoddpages                         % Make sure start on even page.
1639         \ifodd\pageno \relax \else \null\vfill\eject \fi
1640     \fi
1641     \pageno@foot                        % Page #ing special for chap pages
1642     \advance\chapterno by\@ne
1643     \ifnumber@chapters
1644         \centerline{\chap@font CHAPTER \number\chapterno}% Do heading
1645     \fi
1646     \sectno=\z@
1647     \subsectno=\z@
1648     \subsubsectno=\z@
1649     {\let\\=\cr \tabskip=\z@ \chap@font % Center the chapter title
1650      \halign to\hsize{\centerline{\ignorespaces##\unskip}\cr#1\cr}
1651     }
1652     \nobreak                  % Shouldn't happen anyway
1653     \vskip 1.0in minus 0.15in
1654 }
1655
1656 % What to do at the beginning of a section
1657 \outer\def\section{\dosection}
1658 \def\dosection#1{%
1659     \skip@=\lastskip            % \par resets \lastskip, apparently
1660     \par
1661     % This junk trys to provide consistent spacing
1662     \dimen@=\baselineskip
1663     \ifdim\skip@<\dimen@
1664         \ifdim\skip@=\z@
1665             \penalty-200
1666         \fi
1667         \vskip \dimen@ plus .5\baselineskip
1668     \fi
1669     \ifnumber@sections
1670         \advance\sectno by\@ne
1671         \subsectno=\z@
1672         \subsubsectno=\z@
1673         \leftline{\sec@font\number\sectno. #1}
1674     \else
1675         \leftline{\sec@font#1}
1676     \fi
1677     \subcontent{#1}
1678     \sanetell{ Section: #1}
1679     \nobreak
1680     \vskip \z@ plus .15\baselineskip
1681     \vskip -\parskip
1682 }
1683
1684 % And for sub-sections
1685 \outer\def\subsection{\dosubsection}
1686 \def\dosubsection#1{%
1687     \skip@=\lastskip
1688     \par
1689     \dimen@=.6\baselineskip
1690     \ifdim\skip@<\dimen@
1691         \ifdim\skip@=\z@
1692             \penalty-100
1693         \fi
1694         \vskip \dimen@ plus .3\baselineskip
1695     \fi
1696     \ifnumber@sections
1697         \advance\subsectno by\@ne
1698         \subsubsectno=\z@
1699         \leftline{\subsec@font\number\sectno.\number\subsectno. #1}
1700     \else
1701         \leftline{\subsec@font#1}
1702     \fi
1703     \subsubcontent{#1}
1704     \sanetell{ \\Subsection: #1}
1705     \nobreak
1706     \vskip \z@ plus .1\baselineskip
1707     \vskip -\parskip
1708 }
1709
1710 % And for sub-sub-sections
1711 \outer\def\subsubsection{\dosubsubsection}
1712 \def\dosubsubsection#1{%
1713     \skip@=\lastskip
1714     \par
1715     \dimen@=.5\baselineskip
1716     \ifdim\skip@<\dimen@
1717         \ifdim\skip@=\z@
1718             \penalty-50
1719         \fi
1720         \vskip \dimen@ plus .3\baselineskip
1721     \fi
1722     \ifnumber@sections
1723         \advance\subsubsectno by\@ne
1724         \leftline{\subsubsec@font\number\sectno.\number\subsectno
1725                 .\number\subsubsectno. #1}
1726     \else
1727         \leftline{\subsubsec@font#1}
1728     \fi
1729     \subsubsubcontent{#1}
1730     \sanetell{ \\\\Subsubsection: #1}
1731     \nobreak
1732     \vskip -\parskip
1733 }
1734
1735 % This is an alternate definition for plain TeX's \@ins,
1736 % omitting the \par.  It is for use during \figure etc.  Reason:
1737 % If you use \figure right after \section, it would otherwise
1738 % become a legal place for a page break.
1739 \def\@ins@uci{\begingroup\setbox\z@\vbox\bgroup}
1740
1741 % This is \endinsert from plain.tex, but \midinsert's are not converted
1742 % to \topinsert's, since that can lead to figures getting out of order.
1743 % This can lead to excessive blank space at the bottom of the page, but
1744 % that's life.  Makes use of \keep...\endkeep type stuff.
1745 \def\endinsert{\egroup % finish the \vbox
1746   \if@mid \dimen@\ht\z@ \advance\dimen@\dp\z@
1747     \advance\dimen@12\p@
1748     \vskip\z@ plus\dimen@
1749     \penalty\z@
1750     \vskip\z@ plus-\dimen@
1751     \bigskip\box\z@\bigbreak
1752   \else\insert\topins{\penalty100 % floating insertion
1753     \splittopskip\z@skip
1754     \splitmaxdepth\maxdimen \floatingpenalty\z@
1755     \ifp@ge \dimen@\dp\z@
1756     \vbox to\vsize{\unvbox\z@\kern-\dimen@}% depth is zero
1757     \else \box\z@\nobreak\bigskip\fi}\fi\endgroup}
1758
1759
1760 % This macro provides rudamentary support for figures.  The
1761 % argument to \figure is the name of the file containing the tpic (or whatever)
1762 % output.  The second argument is the caption for the picture.
1763 % As usual, TeX's delayed paging and midinserting causes expansion-timing
1764 % problems which have to be kludged around.
1765 \newif\iftopfigs \topfigstrue
1766 \def\domidfigs{%
1767     \topfigsfalse
1768     \oktell{Midfigs mode}%
1769 }
1770
1771 % Counters for figures/diagrams/examples and tables
1772 \newcount\fignumber \fignumber=\@ne
1773 \newcount\tablenumber \tablenumber=\@ne
1774
1775 % Helper for \figure, \example, and \diagram.  Define \lastfigure and
1776 % \this@insert, increment the figure number for next time, and make sure
1777 % the figures list file is open for writing.
1778 % #1=the caption, to be written to the figures list file
1779 \def\advance@figno#1{%
1780     \xdef\lastfigure{\the\fignumber}% Remember the current figure number
1781     \begingroup\no@cites
1782         \let\\=\space
1783         \xdef\this@insert{\write\noexpand\fig@file{\noexpand\noexpand
1784                                 \noexpand\listfig{\lastfigure}{#1}%
1785                                 {\noexpand\number\noexpand\pageno}%
1786                       }%
1787         }%
1788     \endgroup
1789     \global\advance\fignumber by\@ne
1790     \iffig@closed               % Open figures file if not already
1791         \immediate\openout\fig@file=\figtitle
1792         \global\fig@closedfalse
1793     \fi
1794 }
1795
1796 % Bump the table number after defining \lasttable.  Prepare \this@insert.
1797 % Define \table@caption.
1798 \def\advance@tablenumber#1{%
1799     \xdef\lasttable{\the\tablenumber}% Remember the current figure number
1800     \begingroup \no@cites \let\\=\space
1801         \xdef\this@insert{\write\noexpand\tab@file{\noexpand\noexpand
1802                                 \noexpand\listfig{\lasttable}{#1}%
1803                                 {\noexpand\number\noexpand\pageno}%
1804                       }%
1805         }%
1806     \endgroup
1807     \global\advance\tablenumber by\@ne
1808     \gdef\table@caption{#1}%
1809 }
1810
1811 \newif\ifpage@figs \page@figsfalse
1812
1813 % Special mode to put figures/diagrams/examples on separate pages
1814 \def\pagefigs{%
1815     \oktell{Page Figures mode}%
1816     \page@figstrue
1817 }
1818
1819 % Usage: \figure{filename}{caption with \\'s}
1820 \def\figure#1#2{%
1821   \begingroup                   % Hide anything that crazy user does!
1822     \advance@figno{#2}%
1823     % Now do mid or top insert as appropriate
1824     \let\@ins=\@ins@uci
1825     \ifpage@figs
1826         \shipout\vbox to\vsize\bgroup
1827                 {\smallertype\rm\input #1\relax\centerline{\box\graph}}%
1828                 \vfill
1829                 \centerline{Figure \lastfigure}\this@insert
1830         \egroup
1831     \else \iftopfigs \topinsert \else \midinsert \fi
1832         \hrule
1833         \vskip .5\baselineskip
1834         {\smallertype\rm\input #1\relax\centerline{\box\graph}}%
1835         \vskip .5\baselineskip plus .5\baselineskip
1836         \centerline{\twelvebf Figure \lastfigure}%
1837         \this@insert
1838         \let\\=\cr \tabskip=\z@
1839         \halign to\hsize{\centerline{\ignorespaces##\unskip}\cr#2\cr}%
1840         \vskip2\p@
1841         \hrule
1842         \endinsert
1843     \fi
1844   \endgroup
1845 }
1846
1847
1848 % Allow user to specify arbitrary diagrams.  The arguments are:
1849 % #1=name of the file containing the commands to form the diagram,
1850 % #2=caption for the figure, possibly containing \\'s.
1851 \def\diagram#1#2{%
1852   \begingroup
1853     \advance@figno{#2}%
1854     % Do mid or top insert as appropriate
1855     \let\@ins=\@ins@uci
1856     \ifpage@figs
1857         \shipout\vbox to\vsize\bgroup
1858                 {\smallertype\rm\input #1\relax}%
1859                 \vfill
1860                 \centerline{\twelverm Figure \lastfigure}\this@insert
1861         \egroup
1862     \else \iftopfigs \topinsert \else \midinsert \fi
1863         \hrule
1864         \vskip .5\baselineskip
1865         {\smallertype\rm\input #1\relax}%
1866         \vskip .5\baselineskip plus .5\baselineskip
1867         \centerline{\twelvebf Figure \lastfigure}%
1868         \this@insert
1869         \let\\=\cr  \tabskip=\z@
1870         \halign to \hsize{\centerline{\ignorespaces##\unskip}\cr#2\cr}%
1871         \vskip2\p@
1872         \hrule
1873         \endinsert
1874     \fi
1875   \endgroup
1876 }
1877
1878
1879 % Allow user to include verbatim examples from files.  The arguments are:
1880 % #1=name of the file containing the text of the example,
1881 % #2=caption for the figure, possibly containing \\'s.
1882 \def\example#1#2{%
1883   \begingroup
1884     \advance@figno{#2}%
1885     % Do mid or top insert as appropriate
1886     \let\@ins=\@ins@uci
1887     \ifpage@figs
1888         \shipout\vbox to\vsize\bgroup
1889                 \vbox{\smallertype\singlespace\verbfile{#1}}%
1890                 \vfill
1891                 \centerline{\twelverm Figure \lastfigure}\this@insert
1892         \egroup
1893     \else \iftopfigs \topinsert \else \midinsert \fi
1894         \hrule
1895         \vskip .5\baselineskip
1896         \vbox{\smallertype\singlespace\verbfile{#1}}%
1897         \vskip .5\baselineskip plus .5\baselineskip
1898         \centerline{\twelvebf Figure \lastfigure}%
1899         \this@insert
1900         \let\\=\cr  \tabskip=\z@
1901         \halign to \hsize{\centerline{\ignorespaces##\unskip}\cr#2\cr}%
1902         \vskip2\p@
1903         \hrule
1904         \endinsert
1905     \fi
1906   \endgroup
1907 }
1908
1909
1910 % Similar thing for tables
1911 % usage: \table{caption} ...text... \endtable
1912 \def\table#1{%
1913   \begingroup                   % Hide user zingers
1914     \advance@tablenumber{#1}%
1915     \setbox\z@=\vbox\bgroup
1916 }
1917
1918
1919 % End of the table body specification.
1920 \def\endtable{%
1921     \egroup             % End the definition of \box0.
1922     % Now do top or mid insert
1923     \let\@ins=\@ins@uci
1924     \iftab@closed               % Open output file if necessary
1925         \immediate\openout\tab@file=\tabtitle
1926         \global\tab@closedfalse
1927     \fi
1928     \ifpage@figs
1929         \shipout\vbox to\vsize\bgroup
1930                 \box\z@
1931                 \vfill
1932                 \centerline{\twelverm Table \lasttable}\this@insert
1933         \egroup
1934     \else \iftopfigs \topinsert \else \midinsert \fi
1935         \hrule
1936         \vskip .5\baselineskip
1937         \box\z@         % Insert the material here.
1938         \vskip .5\baselineskip plus .5\baselineskip
1939         \centerline{\twelvebf Table \lasttable}%
1940         \this@insert
1941         \let\\=\cr \tabskip=\z@
1942         \halign to\hsize{\centerline{\ignorespaces##\unskip}\cr\table@caption
1943                          \cr}%
1944         \vskip2\p@
1945         \hrule
1946         \endinsert
1947     \fi
1948   \endgroup
1949 }
1950
1951
1952 % End of the table body specification for a full-page table.
1953 \def\endtablepage{%
1954     \egroup             % End the definition of \box0.
1955     % Now do top or mid insert
1956     \let\@ins=\@ins@uci
1957     \iftab@closed               % Open output file if necessary
1958         \immediate\openout\tab@file=\tabtitle
1959         \global\tab@closedfalse
1960     \fi
1961     \ifpage@figs
1962         \shipout\vbox to\vsize\bgroup
1963                 \box\z@
1964                 \vfill
1965                 \centerline{\twelverm Table \lasttable}\this@insert
1966         \egroup
1967     \else \pageinsert
1968         \hrule
1969         \vskip .5\baselineskip
1970         \box\z@         % Insert the material here.
1971         \vskip .5\baselineskip plus .5\baselineskip
1972         \centerline{\twelvebf Table \lasttable}%
1973         \this@insert
1974         \let\\=\cr \tabskip=\z@
1975         \halign to\hsize{\centerline{\ignorespaces##\unskip}\cr\table@caption
1976                          \cr}%
1977         \vskip2\p@
1978         \hrule
1979         \endinsert
1980     \fi
1981   \endgroup
1982 }
1983
1984 % Environment for report generation -- use only at the beginning!
1985 % Since sections are the biggest division, the table of contents
1986 % stuff is redefined, and chapter numbering is turned off so that
1987 % \chapter can be used for the first-page title.  The title page
1988 % gets no page number (page # 0).  The user can get to the
1989 % normal chapter font as \titlefont, and the section font as
1990 % \authorfont.
1991 \def\articlestyle{%
1992     \nochapternumbers
1993     \let\subsubsubcontent=\subsubcontent
1994     \let\subsubcontent=\subcontent
1995     \let\subcontent=\content
1996     \let\chapter=\chapter@base
1997     \pageno=\z@
1998     \let\titlefont=\chap@font
1999     \let\authorfont=\sec@font
2000     \oktell{Articlestyle mode}%
2001 }
2002
2003
2004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2005 %  PAGE NUMBERING and OUTPUT ROUTINES  %
2006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2007
2008 % This macro produces a blank, numbered page of output
2009 \def\blankpage{\pageinsert \null\vfill \endinsert}
2010
2011 % This defintion of \folio differs from Plain's in that (a) page
2012 % numbers are printed in 12pt, and (b) roman numeral ones are
2013 % printed in italics.  It makes use of a trick, that
2014 % \romannumeral0 produces no output, which we need for title
2015 % pages and things, so we make their page numbers be 0.
2016 \def\folio{\ifnum\pageno>\z@
2017     {\twelverm\number\pageno}\else
2018     {\twelveit\romannumeral-\pageno}\fi
2019 }
2020
2021 % Permanent definitions of macros which get switched in and out
2022 % with \let's.  Do not change any of these !!!
2023 \def\uci@headpage{\hfill\folio}
2024 \def\uci@footpage{\hfill\folio\hfill}
2025 \headline={\uci@headline}
2026 \footline={\uci@footline}
2027
2028 % If this is used as the footline, it causes a page number to be
2029 % printed, but with the side-effect of making the headline blank
2030 % and the footline a page number again.  This is used on pages
2031 % like the first of a chapter.
2032 \def\no@foot{%
2033     \uci@footpage
2034     \global\let\uci@footline=\hfil
2035     \global\let\uci@headline=\uci@headpage
2036 }
2037
2038 % This macro causes the page number to be at the bottom of the current
2039 % page, and after it has been used there once, it moves to the
2040 % top right of each page.  It also sets \dimen\topins=0pt so that
2041 % any material \topinsert'd on these pages will get carried over
2042 % to subsequent pages.
2043 \def\pageno@foot{%
2044     \dimen\topins=\z@
2045     \let\uci@headline=\hfil
2046     \let\uci@footline=\no@foot
2047 }
2048
2049 % Executing this causes page numbers to be at the bottom only, as
2050 % with the plain TeX format.
2051 \def\plain@page@numbers{%
2052     \let\uci@headline=\hfil     % Initial values similar to plain's
2053     \let\uci@footline=\uci@footpage
2054 }
2055
2056 % Change plain's \makeheadline and \makefootline to position page
2057 % numbers as required.
2058 \def\makeheadline{%
2059     \vbox to\z@{\vskip-22.65\p@
2060     \line{\vbox to8.5\p@{}\the\headline}\vss}\nointerlineskip
2061 }
2062 \def\makefootline{\baselineskip=1.6cm\line{\the\footline}}
2063
2064 % Define an output routine which will restore \dimen\topins
2065 % after \chapter, \references, etc, title pages, which have
2066 % \dimen\topins=0pt
2067 \def\dissoutput{\shipout\vbox{\makeheadline\pagebody\makefootline}%
2068     \advancepageno \global\dimen\topins=\vsize
2069     \ifnum\outputpenalty>-\@MM \else\dosupereject\fi
2070 }
2071 \let\output@AmS=\dissoutput
2072 \dimen\topins=\vsize    % Don't insert more than will fit on one page
2073
2074 % Output Routines: We adjust the \raggedbottom command of plain
2075 % TeX so that the extra space is no more than 1in, and so that
2076 % the space is put above footnotes instead of below.  NOTE: Since
2077 % we put a \vfil below the page contents, the topskip glue will
2078 % never actually be stretched.  Its stretchability is just to
2079 % let TeX know about the raggedness in computing when to make a
2080 % page break.  Since it's 1in, the \vfil will never be stretched to
2081 % more than that amount.
2082
2083 \def\raggedbottom{\topskip=\normal@topskip plus1in \r@ggedbottomtrue
2084     \oktell{Ragged bottom mode}}
2085 \def\normalbottom{\topskip=\normal@topskip\r@ggedbottomfalse
2086     \oktell{Normal bottom mode}}
2087
2088 \def\pagecontents{%
2089     \ifvoid\topins\else\unvbox\topins\fi
2090     \dimen@=\dp\@cclv \unvbox\@cclv     % open up \box255
2091     \ifr@ggedbottom \kern-\dimen@ \vfil\fi
2092     \ifvoid\footins \else               % footnote info is present
2093         \vskip\skip\footins
2094         \footnoterule
2095         \unvbox\footins
2096     \fi
2097 }
2098
2099
2100 %%%%%%%%%%%%%%%%%%%%
2101 %  INITIALIZATION  %
2102 %%%%%%%%%%%%%%%%%%%%
2103
2104 \font@no=0                      % Default font=\rm,
2105 \twelvepoint                    % point size,
2106 \doublespace                    % and spacing
2107 \plain@page@numbers             % Page nos like plain's
2108
2109 % Note that normally in AmSTeX, the @ character may not be used.
2110 % But in the dissertation style, @ may be used as a normal character,
2111 % As it can in plain TeX.
2112 \catcode`\@=12
2113
2114 % Eat any further \documentstyle commands
2115 \def\documentstyle#1{}
2116
2117 % This prints out our welcome message, and it computes the time
2118 % and date string once per run, which saves time if they're used
2119 % more than once.  Since \catcode`@=12 at the time this is
2120 % executed, it can't contain any @-type macros.
2121 \everyjob={%
2122     \begingroup
2123         \xdef\today{%
2124             \ifcase\month
2125                 \the\month\or
2126                 January\or
2127                 February\or
2128                 March\or
2129                 April\or
2130                 May\or
2131                 June\or
2132                 July\or
2133                 August\or
2134                 September\or
2135                 October\or
2136                 November\or
2137                 December\else
2138                 \the\month
2139             \fi\space\the\day, \the\year
2140         }%
2141         \count0=\time
2142         \count1=\count0
2143         \divide\count0by60
2144         \count2=\count0
2145         \multiply\count0by60
2146         \advance\count1by-\count0
2147         \ifnum\count2>11
2148             \ifnum\count2>12 \advance\count2by-12\fi
2149             \def\ampm{PM}%
2150         \else
2151             \ifnum\count2=0 \advance\count2by12\fi
2152             \def\ampm{AM}%
2153         \fi
2154         \xdef\daytime{%
2155             \ifnum\count2<10 0\fi \the\count2:%
2156             \ifnum\count1<10 0\fi \the\count1
2157             \ampm
2158         }%
2159     \endgroup
2160     \tell{AmSTeX Dissertation Style, version \version}%
2161 }
2162
2163 \edef\temp@uci{\the\everyjob}
2164 \temp@uci