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