summaryrefslogtreecommitdiff
path: root/macros/lamstex/inputs/lamstex.stb
blob: 522d48bde7f7f9e8f429edc7da020dfaf7eb0b9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
% LAMSTEX.STB  VERSION 2.0
% COPYRIGHT (C) 1989, 1990, 1991 BY THE TEXPLORATORS CORPORATION
% ALL RIGHTS RESERVED

% THIS FILE SHOULD NOT BE CHANGED IN ANY WAY. 

\catcode`\@=11
\let\alloc@\alloc@@
\def\adjustpunct@#1{\count@\lastkern
 \ifnum\count@=\z@#1\else
 \ifnum\count@>\tw@#1\else
 \ifnum\count@<-\tw@#1\else
  \unkern\unkern\setboxzl@
  \skip@\lastskip\unskip
  \count@@\lastpenalty\unpenalty
  \ifnum\count@=\tw@\unskip\setboxzl@\fi
  \ifdim\skip@=\z@\else\hskip\skip@\fi
  #1%
  \ifnum\count@=\tw@\null\hfill\fi
  \penalty\count@@
 \fi\fi\fi}
\def\ignorepars@{\FNSS@\ignorepars@@}
\def\ignorepars@@{\ifx\next\par\DN@\par{\FN@\ignorepars@@}\else
 \let\next@\relax\fi\next@}
\newcount\ctype@
\newcount\Ctype@
\newif\ifleftcolbreak@
\def\cbreak@#1#2{\ifcase\ctype@#1\or\nobreak#2\else
 \global\leftcolbreak@true
 \ifdim\pagetotal>\pageheight@\global\leftcolbreak@false\fi
 \global\Ctype@\ctype@\break\fi\ctype@\z@}
\newif\ifshortlastcolumn@
\newif\ifletter@
\newtoks\marktoks@i
\newtoks\marktoks@ii
\newtoks\marktoks@iii
\newtoks\marktoks@iv
\newtoks\marktoks@v
\newif\ifentry@
\newcount\dii@
\def\Topage@#1#2{\DN@{#2}\ifx\next@\frompage@\pagecs@{\frompage@}%
 \else\pagecs@{\frompage@\hbox{--}#2}\fi\egroup\ignorepars@}
\newdimen\pageheight@
\pageheight@\vsize
\newdimen\doublepageheight@
\doublepageheight@2\pageheight@
\advance\doublepageheight@1pc
\newdimen\pagewidth@
\pagewidth@\hsize
\def\makeheadline{\vbox to\z@{\vskip-22.5pt\hbox to\pagewidth@
 {\vbox to8.5\p@{}\the\headline}\vss}\nointerlineskip}%
\def\makefootline{\baselineskip24\p@\hbox to\pagewidth@{\the\footline}}%
\newif\iffirstindexpage@
\def\makeindex{\checkmainfile@\par\vfill\break
 \begingroup
 \let\asterisk*%
 \def\lkerns@{\null\kern\m@ne sp\kern\@ne sp}%
 \def\nkerns@{\null\kern-\tw@ sp\kern\tw@ sp}%
 \def\nocolumnbreak{\ctype@\@ne}%
 \def\columnbreak{\ctype@\tw@}%
 \def\newcolumn{\ctype@\thr@@}%
 \def\shortlastcolumn{\shortlastcolumn@true}%
 \def\LETTER##1{\par
  \mark{}%
  \cbreak@{\penalty-200 \bigskip}\bigskip
  \letter@true\centerline{\bf##1}\nobreak\medskip}%
 \def\Entry##1##2##3##4##5##6##7{\par\entry@true
  \marktoks@i{##3}\marktoks@ii{##4}\marktoks@iii{##5}%
   \marktoks@iv{##6}\marktoks@v{##7}%
  \ifcase##1%
  \or
   \ifletter@\else\mark{}\fi
    \cbreak@\relax\relax
    \noindent@
    \mark{10{\the\marktoks@i}}%
    \hangafter\@ne\hangindent.5em{##3}%
  \or
   \ifcase##2%
    \ifletter@\else\mark{}\fi
    \cbreak@\relax\relax
    \noindent@
    \mark{20{\the\marktoks@i}{\the\marktoks@ii}}%
    \hangafter\@ne\hangindent.5em{##3}\par\nobreak
    \noindent@\hangafter\@ne\hangindent1.5em\quad{##4}%
   \or
    \mark{10{\the\marktoks@i}}%
    \cbreak@\relax\relax
    \noindent@
    \mark{21{\the\marktoks@i}{\the\marktoks@ii}}%
    \hangafter\@ne\hangindent1.5em\quad{##4}%
   \fi
  \or
   \ifcase##2%
    \ifletter@\else\mark{}\fi
    \cbreak@\relax\relax
    \noindent@
    \mark{30{\the\marktoks@i}{\the\marktoks@ii}{\the\marktoks@iii}}%
    \hangafter\@ne\hangindent.5em{##3}\par\nobreak
    \noindent@\hangafter\@ne\hangindent1.5em\quad{##4}\par\nobreak
    \noindent@\hangafter\@ne\hangindent2.5em\qquad{##5}%
   \or
    \mark{10{\the\marktoks@i}}%
    \cbreak@\relax\relax
    \noindent@
    \mark{31{\the\marktoks@i}{\the\marktoks@ii}{\the\marktoks@iii}}%
    \hangafter\@ne\hangindent1.5em\quad{##4}\par\nobreak
    \noindent@\hangafter\@ne\hangindent2.5em\qquad{##5}%
   \or
    \mark{2\number\dii@{\the\marktoks@i}{\the\marktoks@ii}}%
    \cbreak@\relax\relax
    \noindent@
    \mark{32{\the\marktoks@i}{\the\marktoks@ii}{\the\marktoks@iii}}%
    \hangafter\@ne\hangindent2.5em\qquad{##5}%
   \fi
  \or
   \ifcase##2%
    \ifletter@\else\mark{}\fi
    \cbreak@\relax\relax
    \noindent@
    \mark{40{\the\marktoks@i}{\the\marktoks@ii}{\the\marktoks@iii}%
     {\the\marktoks@iv}}%
    \hangafter\@ne\hangindent.5em{##3}\par\nobreak
    \noindent@\hangafter\@ne\hangindent1.5em\quad{##4}\par\nobreak
    \noindent@\hangafter\@ne\hangindent2.5em\qquad{##5}\par\nobreak
    \noindent@\hangafter\@ne\hangindent3.5em\qquad\quad{##6}%
   \or
    \mark{10{\the\marktoks@i}}%
    \cbreak@\relax\relax
    \noindent@
    \mark{41{\the\marktoks@i}{\the\marktoks@ii}{\the\marktoks@iii}%
     {\the\marktoks@iv}}%
    \noindent@\hangafter\@ne\hangindent1.5em\quad{##4}\par\nobreak
    \noindent@\hangafter\@ne\hangindent2.5em\qquad{##5}\par\nobreak
    \noindent@\hangafter\@ne\hangindent3.5em\qquad\quad{##6}%
   \or
    \mark{2\number\dii@{\the\marktoks@i}{\the\marktoks@ii}}%
    \cbreak@\relax\relax
    \noindent@
    \mark{42{\the\marktoks@i}{\the\marktoks@ii}{\the\marktoks@iii}%
     {\the\marktoks@iv}}%
    \noindent@\hangafter\@ne\hangindent2.5em\qquad{##5}\par\nobreak
    \noindent@\hangafter\@ne\hangindent3.5em\qquad\quad{##6}%
   \or
    \mark{3\number\dii@{\the\marktoks@i}{\the\marktoks@ii}%
     {\the\marktoks@iii}}%
    \cbreak@\relax\relax
    \noindent@
    \mark{43{\the\marktoks@i}{\the\marktoks@ii}{\the\marktoks@iii}%
     {\the\marktoks@iv}}%
    \hangafter\@ne\hangindent3.5em\qquad\quad{##6}%
   \fi
  \or
   \ifcase##2%
    \ifletter@\else\mark{}\fi
    \cbreak@\relax\relax
    \noindent@
    \mark{50{\the\marktoks@i}{\the\marktoks@ii}{\the\marktoks@iii}%
     {\the\marktoks@iv}{\the\marktoks@v}}%
    \hangafter\@ne\hangindent.5em{##3}\par\nobreak
    \noindent@\hangafter\@ne\hangindent1.5em\quad{##4}\par\nobreak
    \noindent@\hangafter\@ne\hangindent2.5em\qquad{##5}\par\nobreak
    \noindent@\hangafter\@ne\hangindent3.5em\qquad\quad{##6}\par\nobreak
    \noindent@\hangafter\@ne\hangindent4.5em\qquad\qquad{##7}%
   \or
    \mark{10{\the\marktoks@i}}%
    \cbreak@\relax\relax
    \noindent@
    \mark{51{\the\marktoks@i}{\the\marktoks@ii}{\the\marktoks@iii}%
     {\the\marktoks@iv}{\the\marktoks@v}}%
    \hangafter\@ne\hangindent1.5em\quad{##4}\par\nobreak
    \noindent@\hangafter\@ne\hangindent2.5em\qquad{##5}\par\nobreak
    \noindent@\hangafter\@ne\hangindent3.5em\qquad\quad{##6}\par\nobreak
    \noindent@\hangafter\@ne\hangindent4.5em\qquad\qquad{##7}%
   \or
    \mark{2\number\dii@{\the\marktoks@i}{\the\marktoks@ii}}%
    \cbreak@\relax\relax
    \noindent@
    \mark{52{\the\marktoks@i}{\the\marktoks@ii}{\the\marktoks@iii}%
     {\the\marktoks@iv}{\the\marktoks@v}}%
    \hangafter\@ne\hangindent2.5em\qquad{##5}\par\nobreak
    \noindent@\hangafter\@ne\hangindent3.5em\qquad\quad{##6}\par\nobreak
    \noindent@\hangafter\@ne\hangindent4.5em\qquad\qquad{##7}%
   \or
    \mark{3\number\dii@{\the\marktoks@i}{\the\marktoks@ii}%
     {\the\marktoks@iii}}%
    \cbreak@\relax\relax
    \noindent@
    \mark{53{\the\marktoks@i}{\the\marktoks@ii}{\the\marktoks@iii}%
     {\the\marktoks@iv}{\the\marktoks@v}}%
    \hangafter\@ne\hangindent3.5em\qquad\quad{##6}\par\nobreak
    \noindent@\hangafter\@ne\hangindent4.5em\qquad\qquad{##7}%
   \or
    \mark{4\number\dii@{\the\marktoks@i}{\the\marktoks@ii}%
     {\the\marktoks@iii}{\the\marktoks@iv}}%
    \cbreak@\relax\relax
    \noindent@
    \mark{54{\the\marktoks@i}{\the\marktoks@ii}{\the\marktoks@iii}%
     {\the\marktoks@iv}{\the\marktoks@v}}%
    \hangafter\@ne\hangindent4.5em\qquad\qquad{##7}%
   \fi
  \fi
  \dii@##2\relax
  \letter@false
  \ignorepars@}%
 \def\Page##1{\ifentry@\adjustpunct@,\enspace\else\adjustpunct@, \fi
  \entry@false{##1}\ignorepars@}%
 \def\Pagespan##1{\ifentry@\adjustpunct@,\enspace\else\adjustpunct@, \fi
  \entry@false\def\frompage@{##1}{##1}\ignorepars@}%
 \def\Topage##1{\DN@{##1}\ifx\next@\frompage@
  \else\hbox{--}{##1}\fi\ignorepars@}%
 \def\PageSpan##1##2{\ifentry@\adjustpunct@,\enspace\else\adjustpunct@, \fi
  \entry@false\def\pagecs@{##1}\def\frompage@{##2}%
  \bgroup\let\Topage\Topage@\ignorepars@}%
 \def\Xref##1{\ifentry@\else
  \def\See####1{\adjustpunct@\semicolon@\space
  {\it see~also\/}~####1}{##1}\fi\ignorepars@}%
 \def\Morexref##1{\ifentry@\else
  \def\See####1{\adjustpunct@, ####1}{##1}\fi\ignorepars@}%
 \def\Entryxref##1##2##3##4##5##6##7##8{%
  \Entry{##1}{##2}{##3}{##4}{##5}{##6}{##7}%
 \def\See####1{\adjustpunct@, {\it see\/}~####1}{##8}\ignorepars@}%
 \hsize3in
 \global\vsize\doublepageheight@
 \maxdepth\maxdimen
 \global\firstindexpage@true
 \global\advance\vsize-60\p@
 \everypar{}\parindent\z@
 \rightskip\z@ plus3em \spaceskip.3333em \xspaceskip.5em
 \output{\doublecolumns@}%
 \input\mainfile@.xdx
 \mark{}%
 \output{\balancecolumns@}\vfil\break\endgroup
 \global\vsize\pageheight@}
\def\makeindex@W{Index}
\def\combinecolumns@{%
 \setbox\outbox@\vbox{\makeheadline
  \vbox to\pageheight@{\boxmaxdepth\maxdepth
   \iffirstindexpage@
    \vbox to30\p@{\vskip10\p@
     \hbox to\pagewidth@{\hfil\bf\uppercase\expandafter{\makeindex@W}\hfil}%
     \vfil}%
    \nointerlineskip
   \fi
   \wd\z@\hsize\wd\tw@\hsize
   \setboxz@h to\pagewidth@{\box\z@\kern.5in\box\tw@}%
   \dimen@\dp\z@\box\z@\kern-\dimen@\vfill}%
   \makefootline}%
 {\noexpands@\let\style=\relax
  \shipout@\box\outbox@
 }%
 \global\vsize\doublepageheight@
 \global\firstindexpage@false
 \advancepageno}
\newdimen\prevcoldepth@
\def\doublecolumns@{%
 \dimen@\pageheight@\iffirstindexpage@\advance\dimen@-30\p@\fi
 \ifleftcolbreak@
  \global\leftcolbreak@false
  \vbox to\dimen@{\dimen@\dp\@cclv\unvbox\@cclv
   \ifnum\Ctype@=\thr@@\kern-\dimen@\vfill\fi}%
  \allowbreak
 \else
  \splittopskip\topskip\splitmaxdepth\maxdepth
  \setbox\z@\vsplit\@cclv to\dimen@
  \ifnum\Ctype@=\z@\global\Ctype@\@ne\fi
  \ifcase\Ctype@\or
   \setbox\tw@\vsplit\@cclv to\dimen@\global\prevcoldepth@\dp\tw@
  \else
   \global\prevcoldepth@\dp\@cclv
   \setbox\tw@\vbox to\dimen@{\unvbox\@cclv
    \ifnum\Ctype@=\thr@@\kern-\prevcoldepth@\vfill\fi}%
  \fi
  \combinecolumns@
  \ifcase\Ctype@\or
  \expandafter\continue@\splitbotmark{}\relax\relax\relax\relax
   \relax\relax\continue@
  \else\expandafter\continue@\botmark{}\relax\relax\relax\relax
   \relax\relax\continue@
  \fi
  \ifvoid\@cclv\else\unvbox\@cclv\penalty\outputpenalty\fi
 \fi
 \global\Ctype@\z@}
\def\continue@#1#2#3#4#5#6#7#8\continue@{\def\next@{#1}\ifx\next@\empty
 \else
  \noindent@#3 ({\it continued\/})\par
  \ifnum#1>\@ne\noindent@\enspace(#4 {\it continued\/})\par\fi
  \ifnum#1>\tw@\noindent@\enspace(#5 {\it continued\/})\par\fi
  \ifnum#1>\thr@@\noindent@\enspace(#6 {\it continued\/})\par\fi
  \ifnum#1>4 \noindent@\enspace(#7 {\it continued\/})\par\fi
  \ifvoid\@cclv
   \global\advance\prevcoldepth@-\prevdepth\kern\prevcoldepth@
  \else
   \skip@\baselineskip\advance\skip@\parskip
   \advance\skip@-\topskip\advance\skip@-\prevdepth
   \vskip\skip@
  \fi
 \fi}
\def\balancecolumns@{\setbox\z@\vbox{\unvbox\@cclv\unskip}%
 \dimen@\ht\z@\advance\dimen@\topskip\advance\dimen@-\baselineskip
 \divide\dimen@\tw@
 \splittopskip\topskip
 \global\dimen@i\dimen@
 {\vbadness\@M
  \loop
   \global\setbox\thr@@\copy\z@
   \global\setbox\@ne\vsplit\thr@@ to\dimen@i
   \ifdim\ht\thr@@>\dimen@i\global\advance\dimen@i\p@
  \repeat}%
 \setbox\z@\vbox to\dimen@i{\unvbox\@ne}%
 \setbox\tw@\vbox to\dimen@i{\dimen@\dp\thr@@\unvbox\thr@@
  \ifshortlastcolumn@\kern-\dimen@\vfill\fi}%
 \combinecolumns@}
\def\alloc@#1#2#3#4#5{\global\advance\count1#1by\@ne
 \ch@ck#1#4#2\allocationnumber\count1#1
 \global#3#5\allocationnumber
 \wlog{\string#5\string#2\the\allocationnumber}}
\catcode`\@=\active