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