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