]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - readline/doc/texinfo.tex
Initial revision
[thirdparty/binutils-gdb.git] / readline / doc / texinfo.tex
1 %% TeX macros to handle texinfo files
2
3 % Copyright (C) 1985, 1986, 1988, 1990, 1991 Free Software Foundation, Inc.
4
5 %This texinfo.tex file is free software; you can redistribute it and/or
6 %modify it under the terms of the GNU General Public License as
7 %published by the Free Software Foundation; either version 2, or (at
8 %your option) any later version.
9
10 %This texinfo.tex file is distributed in the hope that it will be
11 %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 %General Public License for more details.
14
15 %You should have received a copy of the GNU General Public License
16 %along with this texinfo.tex file; see the file COPYING. If not, write
17 %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
18 %USA.
19
20
21 %In other words, you are welcome to use, share and improve this program.
22 %You are forbidden to forbid anyone else to use, share and improve
23 %what you give them. Help stamp out software-hoarding!
24
25 \def\texinfoversion{2.46}
26 \message{Loading texinfo package [Version \texinfoversion]:}
27 \message{}
28
29 % Print the version number if in a .fmt file.
30 \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
31
32 % Save some parts of plain tex whose names we will redefine.
33
34 \let\ptexlbrace=\{
35 \let\ptexrbrace=\}
36 \let\ptexdots=\dots
37 \let\ptexdot=\.
38 \let\ptexstar=\*
39 \let\ptexend=\end
40 \let\ptexbullet=\bullet
41 \let\ptexb=\b
42 \let\ptexc=\c
43 \let\ptexi=\i
44 \let\ptext=\t
45 \let\ptexl=\l
46 \let\ptexL=\L
47
48 \def\tie{\penalty 10000\ } % Save plain tex definition of ~.
49
50 \message{Basics,}
51 \chardef\other=12
52
53 \hyphenation{ap-pen-dix}
54 \hyphenation{mini-buf-fer mini-buf-fers}
55 \hyphenation{eshell}
56
57 % Margin to add to right of even pages, to left of odd pages.
58 \newdimen \bindingoffset \bindingoffset=0pt
59 \newdimen \normaloffset \normaloffset=\hoffset
60 \newdimen\pagewidth \newdimen\pageheight
61 \pagewidth=\hsize \pageheight=\vsize
62
63 %---------------------Begin change-----------------------
64 %
65 % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
66 %
67 \newdimen\cornerlong \newdimen\cornerthick
68 \newdimen \topandbottommargin
69 \newdimen \outerhsize \newdimen \outervsize
70 \cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks
71 \outerhsize=7in
72 \outervsize=9.5in
73 \topandbottommargin=.75in
74 %
75 %---------------------End change-----------------------
76
77 % \onepageout takes a vbox as an argument. Note that \pagecontents
78 % does insertions itself, but you have to call it yourself.
79 \chardef\PAGE=255 \output={\onepageout{\pagecontents\PAGE}}
80 \def\onepageout#1{\hoffset=\normaloffset
81 \ifodd\pageno \advance\hoffset by \bindingoffset
82 \else \advance\hoffset by -\bindingoffset\fi
83 {\escapechar=`\\\relax % makes sure backslash is used in output files.
84 \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
85 {\let\hsize=\pagewidth \makefootline}}}%
86 \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
87
88
89 % Here is a modification of the main output routine for Near East Publications
90 % This provides right-angle cropmarks at all four corners.
91 % The contents of the page are centerlined into the cropmarks,
92 % and any desired binding offset is added as an \hskip on either
93 % site of the centerlined box. (P. A. MacKay, 12 November, 1986)
94 %
95 \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
96 \shipout
97 \vbox to \outervsize{\hsize=\outerhsize
98 \vbox{\line{\ewtop\hfill\ewtop}}
99 \nointerlineskip
100 \line{\vbox{\moveleft\cornerthick\nstop}
101 \hfill
102 \vbox{\moveright\cornerthick\nstop}}
103 \vskip \topandbottommargin
104 \centerline{\ifodd\pageno\hskip\bindingoffset\fi
105 \vbox{
106 {\let\hsize=\pagewidth \makeheadline}
107 \pagebody{#1}
108 {\let\hsize=\pagewidth \makefootline}}
109 \ifodd\pageno\else\hskip\bindingoffset\fi}
110 \vskip \topandbottommargin plus1fill minus1fill
111 \boxmaxdepth\cornerthick
112 \line{\vbox{\moveleft\cornerthick\nsbot}
113 \hfill
114 \vbox{\moveright\cornerthick\nsbot}}
115 \nointerlineskip
116 \vbox{\line{\ewbot\hfill\ewbot}}
117 }
118 \advancepageno
119 \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
120 %
121 % Do @cropmarks to get crop marks
122 \def\cropmarks{\let\onepageout=\croppageout }
123
124 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
125 {\catcode`\@ =11
126 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
127 \dimen@=\dp#1 \unvbox#1
128 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
129 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
130 }
131
132 %
133 % Here are the rules for the cropmarks. Note that they are
134 % offset so that the space between them is truly \outerhsize or \outervsize
135 % (P. A. MacKay, 12 November, 1986)
136 %
137 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
138 \def\nstop{\vbox
139 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
140 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
141 \def\nsbot{\vbox
142 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
143
144 % Parse an argument, then pass it to #1.
145 % The argument can be delimited with [...] or with "..." or braces
146 % or it can be a whole line.
147 % #1 should be a macro which expects
148 % an ordinary undelimited TeX argument.
149
150 \def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx}
151
152 \def\parseargx{%
153 \ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else%
154 \aftergroup \parseargline %
155 \fi \endgroup}
156
157 {\obeyspaces %
158 \gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}}
159
160 \gdef\obeyedspace{\ }
161
162 \def\parseargline{\begingroup \obeylines \parsearglinex}
163 {\obeylines %
164 \gdef\parsearglinex #1^^M{\endgroup \next {#1}}}
165
166 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
167
168 %% These are used to keep @begin/@end levels from running away
169 %% Call \inENV within environments (after a \begingroup)
170 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
171 \def\ENVcheck{%
172 \ifENV\errmessage{Still within an environment. Type Return to continue.}
173 \endgroup\fi} % This is not perfect, but it should reduce lossage
174
175 % @begin foo is the same as @foo, for now.
176 \newhelp\EMsimple{Type <Return> to continue}
177
178 \outer\def\begin{\parsearg\beginxxx}
179
180 \def\beginxxx #1{%
181 \expandafter\ifx\csname #1\endcsname\relax
182 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
183 \csname #1\endcsname\fi}
184
185 %% @end foo executes the definition of \Efoo.
186 %% foo can be delimited by doublequotes or brackets.
187
188 \def\end{\parsearg\endxxx}
189
190 \def\endxxx #1{%
191 \expandafter\ifx\csname E#1\endcsname\relax
192 \expandafter\ifx\csname #1\endcsname\relax
193 \errmessage{Undefined command @end #1}\else
194 \errorE{#1}\fi\fi
195 \csname E#1\endcsname}
196 \def\errorE#1{
197 {\errhelp=\EMsimple \errmessage{@end #1 not within #1 environment}}}
198
199 % Single-spacing is done by various environments.
200
201 \newskip\singlespaceskip \singlespaceskip = \baselineskip
202 \def\singlespace{%
203 {\advance \baselineskip by -\singlespaceskip
204 \kern \baselineskip}%
205 \baselineskip=\singlespaceskip
206 }
207
208 %% Simple single-character @ commands
209
210 % @@ prints an @
211 % Kludge this until the fonts are right (grr).
212 \def\@{{\tt \char '100}}
213
214 % Define @` and @' to be the same as ` and '
215 % but suppressing ligatures.
216 \def\`{{`}}
217 \def\'{{'}}
218
219 % Used to generate quoted braces.
220
221 \def\mylbrace {{\tt \char '173}}
222 \def\myrbrace {{\tt \char '175}}
223 \let\{=\mylbrace
224 \let\}=\myrbrace
225
226 % @: forces normal size whitespace following.
227 \def\:{\spacefactor=1000 }
228
229 % @* forces a line break.
230 \def\*{\hfil\break\hbox{}\ignorespaces}
231
232 % @. is an end-of-sentence period.
233 \def\.{.\spacefactor=3000 }
234
235 % @w prevents a word break
236 \def\w #1{\hbox{#1}}
237
238 % @group ... @end group forces ... to be all on one page.
239
240 \def\group{\begingroup% \inENV ???
241 \def \Egroup{\egroup\endgroup}
242 \vbox\bgroup}
243
244 % @need space-in-mils
245 % forces a page break if there is not space-in-mils remaining.
246
247 \newdimen\mil \mil=0.001in
248
249 \def\need{\parsearg\needx}
250
251 \def\needx #1{\par %
252 % This method tries to make TeX break the page naturally
253 % if the depth of the box does not fit.
254 {\baselineskip=0pt%
255 \vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
256 \prevdepth=-1000pt
257 }}
258
259 % @br forces paragraph break
260
261 \let\br = \par
262
263 % @dots{} output some dots
264
265 \def\dots{$\ldots$}
266
267 % @page forces the start of a new page
268
269 \def\page{\par\vfill\supereject}
270
271 % @exdent text....
272 % outputs text on separate line in roman font, starting at standard page margin
273
274 \def\exdent{\errmessage{@exdent in filled text}}
275 % @lisp, etc, define \exdent locally from \internalexdent
276
277 {\obeyspaces
278 \gdef\internalexdent{\parsearg\exdentzzz}}
279
280 \def\exdentzzz #1{{\advance \leftskip by -\lispnarrowing
281 \advance \hsize by -\leftskip
282 \advance \hsize by -\rightskip
283 \leftline{{\rm#1}}}}
284
285 % @include file insert text of that file as input.
286
287 \def\include{\parsearg\includezzz}
288 \def\includezzz #1{{\def\thisfile{#1}\input #1
289 }}
290
291 \def\thisfile{}
292
293 % @center line outputs that line, centered
294
295 \def\center{\parsearg\centerzzz}
296 \def\centerzzz #1{{\advance\hsize by -\leftskip
297 \advance\hsize by -\rightskip
298 \centerline{#1}}}
299
300 % @sp n outputs n lines of vertical space
301
302 \def\sp{\parsearg\spxxx}
303 \def\spxxx #1{\par \vskip #1\baselineskip}
304
305 % @comment ...line which is ignored...
306 % @c is the same as @comment
307 % @ignore ... @end ignore is another way to write a comment
308
309 \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
310 \parsearg \commentxxx}
311
312 \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
313
314 \let\c=\comment
315
316 % Prevent errors for section commands.
317 % Used in @ignore and in failing conditionals.
318 \def\ignoresections{%
319 \let\chapter=\relax
320 \let\unnumbered=\relax
321 \let\top=\relax
322 \let\unnumberedsec=\relax
323 \let\unnumberedsection=\relax
324 \let\unnumberedsubsec=\relax
325 \let\unnumberedsubsection=\relax
326 \let\unnumberedsubsubsec=\relax
327 \let\unnumberedsubsubsection=\relax
328 \let\section=\relax
329 \let\subsec=\relax
330 \let\subsubsec=\relax
331 \let\subsection=\relax
332 \let\subsubsection=\relax
333 \let\appendix=\relax
334 \let\appendixsec=\relax
335 \let\appendixsection=\relax
336 \let\appendixsubsec=\relax
337 \let\appendixsubsection=\relax
338 \let\appendixsubsubsec=\relax
339 \let\appendixsubsubsection=\relax
340 \let\contents=\relax
341 \let\smallbook=\relax
342 \let\titlepage=\relax
343 }
344
345 \def\ignore{\begingroup\ignoresections
346 % Make sure that spaces turn into tokens that match what \ignorexxx wants.
347 \catcode32=10
348 \ignorexxx}
349 \long\def\ignorexxx #1\end ignore{\endgroup\ignorespaces}
350
351 \def\direntry{\begingroup\direntryxxx}
352 \long\def\direntryxxx #1\end direntry{\endgroup\ignorespaces}
353
354 % Conditionals to test whether a flag is set.
355
356 \outer\def\ifset{\begingroup\ignoresections\parsearg\ifsetxxx}
357
358 \def\ifsetxxx #1{\endgroup
359 \expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\ifsetfail
360 \else \let\temp=\relax \fi
361 \temp}
362 \def\Eifset{}
363 \def\ifsetfail{\begingroup\ignoresections\ifsetfailxxx}
364 \long\def\ifsetfailxxx #1\end ifset{\endgroup\ignorespaces}
365
366 \outer\def\ifclear{\begingroup\ignoresections\parsearg\ifclearxxx}
367
368 \def\ifclearxxx #1{\endgroup
369 \expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\relax
370 \else \let\temp=\ifclearfail \fi
371 \temp}
372 \def\Eifclear{}
373 \def\ifclearfail{\begingroup\ignoresections\ifclearfailxxx}
374 \long\def\ifclearfailxxx #1\end ifclear{\endgroup\ignorespaces}
375
376 % Some texinfo constructs that are trivial in tex
377
378 \def\iftex{}
379 \def\Eiftex{}
380 \def\ifinfo{\begingroup\ignoresections\ifinfoxxx}
381 \long\def\ifinfoxxx #1\end ifinfo{\endgroup\ignorespaces}
382
383 \long\def\menu #1\end menu{}
384 \def\asis#1{#1}
385
386 % @math means output in math mode.
387 % We don't use $'s directly in the definition of \math because control
388 % sequences like \math are expanded when the toc file is written. Then,
389 % we read the toc file back, the $'s will be normal characters (as they
390 % should be, according to the definition of Texinfo). So we must use a
391 % control sequence to switch into and out of math mode.
392 %
393 % This isn't quite enough for @math to work properly in indices, but it
394 % seems unlikely it will ever be needed there.
395 %
396 \let\implicitmath = $
397 \def\math#1{\implicitmath #1\implicitmath}
398
399 \def\node{\ENVcheck\parsearg\nodezzz}
400 \def\nodezzz#1{\nodexxx [#1,]}
401 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
402 \let\lastnode=\relax
403
404 \def\donoderef{\ifx\lastnode\relax\else
405 \expandafter\expandafter\expandafter\setref{\lastnode}\fi
406 \let\lastnode=\relax}
407
408 \def\unnumbnoderef{\ifx\lastnode\relax\else
409 \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
410 \let\lastnode=\relax}
411
412 \def\appendixnoderef{\ifx\lastnode\relax\else
413 \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
414 \let\lastnode=\relax}
415
416 \let\refill=\relax
417
418 % @setfilename is done at the beginning of every texinfo file.
419 % So open here the files we need to have open while reading the input.
420 % This makes it possible to make a .fmt file for texinfo.
421 \def\setfilename{%
422 \readauxfile
423 \opencontents
424 \openindices
425 \fixbackslash % Turn off hack to swallow `\input texinfo'.
426 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
427 \comment % Ignore the actual filename.
428 }
429
430 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
431
432 \def\inforef #1{\inforefzzz #1,,,,**}
433 \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}},
434 node \samp{\losespace#1{}}}
435 \def\losespace #1{#1}
436
437 \message{fonts,}
438
439 % Font-change commands.
440
441 % Texinfo supports the sans serif font style, which plain TeX does not.
442 % So we set up a \sf analogous to plain's \rm, etc.
443 \newfam\sffam
444 \def\sf{\fam=\sffam \tensf}
445 \let\li = \sf % Sometimes we call it \li, not \sf.
446
447 %% Try out Computer Modern fonts at \magstephalf
448 \font\textrm=cmr10 scaled \magstephalf
449 \font\texttt=cmtt10 scaled \magstephalf
450 % Instead of cmb10, you many want to use cmbx10.
451 % cmbx10 is a prettier font on its own, but cmb10
452 % looks better when embedded in a line with cmr10.
453 \font\textbf=cmb10 scaled \magstephalf
454 \font\textit=cmti10 scaled \magstephalf
455 \font\textsl=cmsl10 scaled \magstephalf
456 \font\textsf=cmss10 scaled \magstephalf
457 \font\textsc=cmcsc10 scaled \magstephalf
458 \font\texti=cmmi10 scaled \magstephalf
459 \font\textsy=cmsy10 scaled \magstephalf
460
461 % A few fonts for @defun, etc.
462 \font\defbf=cmbx10 scaled \magstep1 %was 1314
463 \font\deftt=cmtt10 scaled \magstep1
464 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
465
466 % Fonts for indices and small examples.
467 % We actually use the slanted font rather than the italic,
468 % because texinfo normally uses the slanted fonts for that.
469 % Do not make many font distinctions in general in the index, since they
470 % aren't very useful.
471 \font\ninett=cmtt9
472 \font\indrm=cmr9
473 \font\indit=cmsl9
474 \let\indsl=\indit
475 \let\indtt=\ninett
476 \let\indsf=\indrm
477 \let\indbf=\indrm
478 \let\indsc=\indrm
479 \font\indi=cmmi9
480 \font\indsy=cmsy9
481
482 % Fonts for headings
483 \font\chaprm=cmbx12 scaled \magstep2
484 \font\chapit=cmti12 scaled \magstep2
485 \font\chapsl=cmsl12 scaled \magstep2
486 \font\chaptt=cmtt12 scaled \magstep2
487 \font\chapsf=cmss12 scaled \magstep2
488 \let\chapbf=\chaprm
489 \font\chapsc=cmcsc10 scaled\magstep3
490 \font\chapi=cmmi12 scaled \magstep2
491 \font\chapsy=cmsy10 scaled \magstep3
492
493 \font\secrm=cmbx12 scaled \magstep1
494 \font\secit=cmti12 scaled \magstep1
495 \font\secsl=cmsl12 scaled \magstep1
496 \font\sectt=cmtt12 scaled \magstep1
497 \font\secsf=cmss12 scaled \magstep1
498 \font\secbf=cmbx12 scaled \magstep1
499 \font\secsc=cmcsc10 scaled\magstep2
500 \font\seci=cmmi12 scaled \magstep1
501 \font\secsy=cmsy10 scaled \magstep2
502
503 % \font\ssecrm=cmbx10 scaled \magstep1 % This size an font looked bad.
504 % \font\ssecit=cmti10 scaled \magstep1 % The letters were too crowded.
505 % \font\ssecsl=cmsl10 scaled \magstep1
506 % \font\ssectt=cmtt10 scaled \magstep1
507 % \font\ssecsf=cmss10 scaled \magstep1
508
509 %\font\ssecrm=cmb10 scaled 1315 % Note the use of cmb rather than cmbx.
510 %\font\ssecit=cmti10 scaled 1315 % Also, the size is a little larger than
511 %\font\ssecsl=cmsl10 scaled 1315 % being scaled magstep1.
512 %\font\ssectt=cmtt10 scaled 1315
513 %\font\ssecsf=cmss10 scaled 1315
514
515 %\let\ssecbf=\ssecrm
516
517 \font\ssecrm=cmbx12 scaled \magstephalf
518 \font\ssecit=cmti12 scaled \magstephalf
519 \font\ssecsl=cmsl12 scaled \magstephalf
520 \font\ssectt=cmtt12 scaled \magstephalf
521 \font\ssecsf=cmss12 scaled \magstephalf
522 \font\ssecbf=cmbx12 scaled \magstephalf
523 \font\ssecsc=cmcsc10 scaled \magstep1
524 \font\sseci=cmmi12 scaled \magstephalf
525 \font\ssecsy=cmsy10 scaled \magstep1
526 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
527 % but that is not a standard magnification.
528
529 % Fonts for title page:
530 \font\titlerm = cmbx12 scaled \magstep3
531 \let\authorrm = \secrm
532
533 % In order for the font changes to affect most math symbols and letters,
534 % we have to define the \textfont of the standard families. Since
535 % texinfo doesn't allow for producing subscripts and superscripts, we
536 % don't bother to reset \scriptfont and \scriptscriptfont (which would
537 % also require loading a lot more fonts).
538 %
539 \def\resetmathfonts{%
540 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
541 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
542 \textfont\ttfam = \tentt \textfont\sffam = \tensf
543 }
544
545
546 % The font-changing commands redefine the meanings of \tenSTYLE, instead
547 % of just \STYLE. We do this so that font changes will continue to work
548 % in math mode, where it is the current \fam that is relevant in most
549 % cases, not the current. Plain TeX does, for example,
550 % \def\bf{\fam=\bffam \tenbf} By redefining \tenbf, we obviate the need
551 % to redefine \bf itself.
552 \def\textfonts{%
553 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
554 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
555 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
556 \resetmathfonts}
557 \def\chapfonts{%
558 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
559 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
560 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
561 \resetmathfonts}
562 \def\secfonts{%
563 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
564 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\sectt
565 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
566 \resetmathfonts}
567 \def\subsecfonts{%
568 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
569 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
570 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
571 \resetmathfonts}
572 \def\indexfonts{%
573 \let\tenrm=\indrm \let\tenit=\tenit \let\tensl=\indsl
574 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
575 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
576 \resetmathfonts}
577
578 % Set up the default fonts, so we can use them for creating boxes.
579 %
580 \textfonts
581
582 % Count depth in font-changes, for error checks
583 \newcount\fontdepth \fontdepth=0
584
585 % Fonts for short table of contents.
586 \font\shortcontrm=cmr12
587 \font\shortcontbf=cmbx12
588 \font\shortcontsl=cmsl12
589
590 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
591 %% serif) and @ii for TeX italic
592
593 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
594 % unless the following character is such as not to need one.
595 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
596 \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
597
598 \let\i=\smartitalic
599 \let\var=\smartitalic
600 \let\dfn=\smartitalic
601 \let\emph=\smartitalic
602 \let\cite=\smartitalic
603
604 \def\b#1{{\bf #1}}
605 \let\strong=\b
606
607 \def\t#1{{\tt \exhyphenpenalty=10000\rawbackslash \frenchspacing #1}\null}
608 \let\ttfont = \t
609 %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
610 \def\samp #1{`\tclose{#1}'\null}
611 \def\key #1{{\tt \exhyphenpenalty=10000\uppercase{#1}}\null}
612 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
613
614 \let\file=\samp
615
616 % @code is a modification of @t,
617 % which makes spaces the same size as normal in the surrounding text.
618 \newdimen\tclosesave
619 \newdimen\tcloserm
620 \def\tclose#1{{\rm \tcloserm=\fontdimen2\font \tt \tclosesave=\fontdimen2\font
621 \fontdimen2\font=\tcloserm
622 % prevent breaking lines at hyphens.
623 \exhyphenpenalty=10000
624 \def\ {{\fontdimen2\font=\tclosesave{} }}%
625 \rawbackslash \frenchspacing #1\fontdimen2\font=\tclosesave}\null}
626 \let\code=\tclose
627 %\let\exp=\tclose %Was temporary
628
629 % @kbd is like @code, except that if the argument is just one @key command,
630 % then @kbd has no effect.
631
632 \def\xkey{\key}
633 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
634 \ifx\one\xkey\ifx\threex\three \key{#2}%
635 \else\tclose{\look}\fi
636 \else\tclose{\look}\fi}
637
638 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
639 % argument is to make the input look right: @dmn{pt} instead of
640 % @dmn{}pt.
641 %
642 \def\dmn#1{\thinspace #1}
643
644 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
645
646 \def\l#1{{\li #1}\null} %
647
648 \def\r#1{{\rm #1}} % roman font
649 % Use of \lowercase was suggested.
650 \def\sc#1{{\smallcaps#1}} % smallcaps font
651 \def\ii#1{{\it #1}} % italic font
652
653 \message{page headings,}
654
655 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
656 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
657
658 % First the title page. Must do @settitle before @titlepage.
659 \def\titlefont#1{{\titlerm #1}}
660
661 \newtoks\realeverypar
662 \newif\ifseenauthor
663 \newif\iffinishedtitlepage
664
665 \def\titlepage{\begingroup \parindent=0pt \textfonts
666 \let\subtitlerm=\tenrm
667 % I deinstalled the following change because \cmr12 is undefined.
668 % This change was not in the ChangeLog anyway. --rms.
669 % \let\subtitlerm=\cmr12
670 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
671 %
672 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
673 %
674 % Leave some space at the very top of the page.
675 \vglue\titlepagetopglue
676 %
677 % Now you can print the title using @title.
678 \def\title{\parsearg\titlezzz}%
679 \def\titlezzz##1{\leftline{\titlefont{##1}}
680 % print a rule at the page bottom also.
681 \finishedtitlepagefalse
682 \vskip4pt \hrule height 4pt \vskip4pt}%
683 % No rule at page bottom unless we print one at the top with @title.
684 \finishedtitlepagetrue
685 %
686 % Now you can put text using @subtitle.
687 \def\subtitle{\parsearg\subtitlezzz}%
688 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
689 %
690 % @author should come last, but may come many times.
691 \def\author{\parsearg\authorzzz}%
692 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
693 {\authorfont \leftline{##1}}}%
694 %
695 % Most title ``pages'' are actually two pages long, with space
696 % at the top of the second. We don't want the ragged left on the second.
697 \let\oldpage = \page
698 \def\page{%
699 \iffinishedtitlepage\else
700 \finishtitlepage
701 \fi
702 \oldpage
703 \let\page = \oldpage
704 \hbox{}}%
705 % \def\page{\oldpage \hbox{}}
706 }
707
708 \def\Etitlepage{%
709 \iffinishedtitlepage\else
710 \finishtitlepage
711 \fi
712 % It is important to do the page break before ending the group,
713 % because the headline and footline are only empty inside the group.
714 % If we use the new definition of \page, we always get a blank page
715 % after the title page, which we certainly don't want.
716 \oldpage
717 \endgroup
718 \HEADINGSon
719 }
720
721 \def\finishtitlepage{%
722 \vskip4pt \hrule height 2pt
723 \vskip\titlepagebottomglue
724 \finishedtitlepagetrue
725 }
726
727 %%% Set up page headings and footings.
728
729 \let\thispage=\folio
730
731 \newtoks \evenheadline % Token sequence for heading line of even pages
732 \newtoks \oddheadline % Token sequence for heading line of odd pages
733 \newtoks \evenfootline % Token sequence for footing line of even pages
734 \newtoks \oddfootline % Token sequence for footing line of odd pages
735
736 % Now make Tex use those variables
737 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
738 \else \the\evenheadline \fi}}
739 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
740 \else \the\evenfootline \fi}\HEADINGShook}
741 \let\HEADINGShook=\relax
742
743 % Commands to set those variables.
744 % For example, this is what @headings on does
745 % @evenheading @thistitle|@thispage|@thischapter
746 % @oddheading @thischapter|@thispage|@thistitle
747 % @evenfooting @thisfile||
748 % @oddfooting ||@thisfile
749
750 \def\evenheading{\parsearg\evenheadingxxx}
751 \def\oddheading{\parsearg\oddheadingxxx}
752 \def\everyheading{\parsearg\everyheadingxxx}
753
754 \def\evenfooting{\parsearg\evenfootingxxx}
755 \def\oddfooting{\parsearg\oddfootingxxx}
756 \def\everyfooting{\parsearg\everyfootingxxx}
757
758 {\catcode`\@=0 %
759
760 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
761 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
762 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
763
764 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
765 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
766 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
767
768 \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
769 \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
770 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
771 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
772
773 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
774 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
775 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
776
777 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
778 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
779 \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
780
781 \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
782 \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
783 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
784 \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
785 %
786 }% unbind the catcode of @.
787
788 % @headings double turns headings on for double-sided printing.
789 % @headings single turns headings on for single-sided printing.
790 % @headings off turns them off.
791 % @headings on same as @headings double, retained for compatibility.
792 % @headings after turns on double-sided headings after this page.
793 % @headings doubleafter turns on double-sided headings after this page.
794 % @headings singleafter turns on single-sided headings after this page.
795 % By default, they are off.
796
797 \def\headings #1 {\csname HEADINGS#1\endcsname}
798
799 \def\HEADINGSoff{
800 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
801 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
802 \HEADINGSoff
803 % When we turn headings on, set the page number to 1.
804 % For double-sided printing, put current file name in lower left corner,
805 % chapter name on inside top of right hand pages, document
806 % title on inside top of left hand pages, and page numbers on outside top
807 % edge of all pages.
808 \def\HEADINGSdouble{
809 %\pagealignmacro
810 \global\pageno=1
811 \global\evenfootline={\hfil}
812 \global\oddfootline={\hfil}
813 \global\evenheadline={\line{\folio\hfil\thistitle}}
814 \global\oddheadline={\line{\thischapter\hfil\folio}}
815 }
816 % For single-sided printing, chapter title goes across top left of page,
817 % page number on top right.
818 \def\HEADINGSsingle{
819 %\pagealignmacro
820 \global\pageno=1
821 \global\evenfootline={\hfil}
822 \global\oddfootline={\hfil}
823 \global\evenheadline={\line{\thischapter\hfil\folio}}
824 \global\oddheadline={\line{\thischapter\hfil\folio}}
825 }
826 \def\HEADINGSon{\HEADINGSdouble}
827
828 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
829 \let\HEADINGSdoubleafter=\HEADINGSafter
830 \def\HEADINGSdoublex{%
831 \global\evenfootline={\hfil}
832 \global\oddfootline={\hfil}
833 \global\evenheadline={\line{\folio\hfil\thistitle}}
834 \global\oddheadline={\line{\thischapter\hfil\folio}}
835 }
836
837 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
838 \def\HEADINGSsinglex{%
839 \global\evenfootline={\hfil}
840 \global\oddfootline={\hfil}
841 \global\evenheadline={\line{\thischapter\hfil\folio}}
842 \global\oddheadline={\line{\thischapter\hfil\folio}}
843 }
844
845 % Subroutines used in generating headings
846 % Produces Day Month Year style of output.
847 \def\today{\number\day\space
848 \ifcase\month\or
849 January\or February\or March\or April\or May\or June\or
850 July\or August\or September\or October\or November\or December\fi
851 \space\number\year}
852
853 % Use this if you want the Month Day, Year style of output.
854 %\def\today{\ifcase\month\or
855 %January\or February\or March\or April\or May\or June\or
856 %July\or August\or September\or October\or November\or December\fi
857 %\space\number\day, \number\year}
858
859 % @settitle line... specifies the title of the document, for headings
860 % It generates no output of its own
861
862 \def\thistitle{No Title}
863 \def\settitle{\parsearg\settitlezzz}
864 \def\settitlezzz #1{\gdef\thistitle{#1}}
865
866 \message{tables,}
867
868 % @tabs -- simple alignment
869
870 % These don't work. For one thing, \+ is defined as outer.
871 % So these macros cannot even be defined.
872
873 %\def\tabs{\parsearg\tabszzz}
874 %\def\tabszzz #1{\settabs\+#1\cr}
875 %\def\tabline{\parsearg\tablinezzz}
876 %\def\tablinezzz #1{\+#1\cr}
877 %\def\&{&}
878
879 % Tables -- @table, @ftable, @item(x), @kitem(x), @xitem(x).
880
881 % default indentation of table text
882 \newdimen\tableindent \tableindent=.8in
883 % default indentation of @itemize and @enumerate text
884 \newdimen\itemindent \itemindent=.3in
885 % margin between end of table item and start of table text.
886 \newdimen\itemmargin \itemmargin=.1in
887
888 % used internally for \itemindent minus \itemmargin
889 \newdimen\itemmax
890
891 % Note @table and @ftable define @item, @itemx, etc., with these defs.
892 % They also define \itemindex
893 % to index the item name in whatever manner is desired (perhaps none).
894
895 \def\internalBitem{\smallbreak \parsearg\itemzzz}
896 \def\internalBitemx{\par \parsearg\itemzzz}
897
898 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
899 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
900
901 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
902 \def\internalBkitemx{\par \parsearg\kitemzzz}
903
904 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
905 \itemzzz {#1}}
906
907 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
908 \itemzzz {#1}}
909
910 \def\itemzzz #1{\begingroup %
911 \advance \hsize by -\rightskip %
912 \advance \hsize by -\leftskip %
913 \setbox0=\hbox{\itemfont{#1}}%
914 \itemindex{#1}%
915 \parskip=0in %
916 \noindent %
917 \ifdim \wd0>\itemmax %
918 \vadjust{\penalty 10000}%
919 \hbox to \hsize{\hskip -\tableindent\box0\hss}\ %
920 \else %
921 \hbox to 0pt{\hskip -\tableindent\box0\hss}%
922 \fi %
923 \endgroup %
924 }
925
926 \def\item{\errmessage{@item while not in a table}}
927 \def\itemx{\errmessage{@itemx while not in a table}}
928 \def\kitem{\errmessage{@kitem while not in a table}}
929 \def\kitemx{\errmessage{@kitemx while not in a table}}
930 \def\xitem{\errmessage{@xitem while not in a table}}
931 \def\xitemx{\errmessage{@xitemx while not in a table}}
932
933 %% Contains a kludge to get @end[description] to work
934 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
935
936 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
937 {\obeylines\obeyspaces%
938 \gdef\tablex #1^^M{%
939 \tabley\dontindex#1 \endtabley}}
940
941 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
942 {\obeylines\obeyspaces%
943 \gdef\ftablex #1^^M{%
944 \tabley\fnitemindex#1 \endtabley
945 \def\Eftable{\endgraf\endgroup\afterenvbreak}%
946 \let\Etable=\relax}}
947
948 \def\dontindex #1{}
949 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
950
951 {\obeyspaces %
952 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
953 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
954
955 \def\tablez #1#2#3#4#5#6{%
956 \aboveenvbreak %
957 \begingroup %
958 \def\Edescription{\Etable}% Neccessary kludge.
959 \let\itemindex=#1%
960 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
961 \ifnum 0#4>0 \tableindent=#4\mil \fi %
962 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
963 \def\itemfont{#2}%
964 \itemmax=\tableindent %
965 \advance \itemmax by -\itemmargin %
966 \advance \leftskip by \tableindent %
967 \parindent = 0pt
968 \parskip = \smallskipamount
969 \ifdim \parskip=0pt \parskip=2pt \fi%
970 \def\Etable{\endgraf\endgroup\afterenvbreak}%
971 \let\item = \internalBitem %
972 \let\itemx = \internalBitemx %
973 \let\kitem = \internalBkitem %
974 \let\kitemx = \internalBkitemx %
975 \let\xitem = \internalBxitem %
976 \let\xitemx = \internalBxitemx %
977 }
978
979 % This is the counter used by @enumerate, which is really @itemize
980
981 \newcount \itemno
982
983 \def\itemize{\parsearg\itemizezzz}
984
985 \def\itemizezzz #1{\itemizey {#1}{\Eitemize}}
986
987 \def\itemizey #1#2{%
988 \aboveenvbreak %
989 \begingroup %
990 \itemno = 0 %
991 \itemmax=\itemindent %
992 \advance \itemmax by -\itemmargin %
993 \advance \leftskip by \itemindent %
994 \parindent = 0pt
995 \parskip = \smallskipamount
996 \ifdim \parskip=0pt \parskip=2pt \fi%
997 \def#2{\endgraf\endgroup\afterenvbreak}%
998 \def\itemcontents{#1}%
999 \let\item=\itemizeitem}
1000
1001 \def\bullet{$\ptexbullet$}
1002 \def\minus{$-$}
1003
1004 % Set sfcode to normal for the chars that usually have another value.
1005 % These are `.?!:;,'
1006 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1007 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1008
1009 \def\enumerate{\itemizey{\the\itemno.}\Eenumerate\flushcr}
1010
1011 \def\alphaenumerate{\itemizey{\ifcase\itemno\or
1012 a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m\or n\or o\or
1013 p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\else
1014 \errmessage{More than 26 items in @ecapitate; get a bigger alphabet.}\fi.}%
1015 \Ealphaenumerate\flushcr}
1016
1017 \def\capsenumerate{\itemizey{\ifcase\itemno\or
1018 A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or N\or O\or
1019 P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\else
1020 \errmessage{More than 26 items in @capsenumerate; get a bigger alphabet.}\fi.}%
1021 \Ecapsenumerate\flushcr}
1022
1023 % Definition of @item while inside @itemize.
1024
1025 \def\itemizeitem{%
1026 \advance\itemno by 1
1027 {\let\par=\endgraf \smallbreak}%
1028 \ifhmode \errmessage{\in hmode at itemizeitem}\fi
1029 {\parskip=0in \hskip 0pt
1030 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
1031 \vadjust{\penalty 300}}%
1032 \flushcr}
1033
1034 \message{indexing,}
1035 % Index generation facilities
1036
1037 % Define \newwrite to be identical to plain tex's \newwrite
1038 % except not \outer, so it can be used within \newindex.
1039 {\catcode`\@=11
1040 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
1041
1042 % \newindex {foo} defines an index named foo.
1043 % It automatically defines \fooindex such that
1044 % \fooindex ...rest of line... puts an entry in the index foo.
1045 % It also defines \fooindfile to be the number of the output channel for
1046 % the file that accumulates this index. The file's extension is foo.
1047 % The name of an index should be no more than 2 characters long
1048 % for the sake of vms.
1049
1050 \def\newindex #1{
1051 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
1052 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
1053 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1054 \noexpand\doindex {#1}}
1055 }
1056
1057 % @defindex foo == \newindex{foo}
1058
1059 \def\defindex{\parsearg\newindex}
1060
1061 % Define @defcodeindex, like @defindex except put all entries in @code.
1062
1063 \def\newcodeindex #1{
1064 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
1065 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
1066 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1067 \noexpand\docodeindex {#1}}
1068 }
1069
1070 \def\defcodeindex{\parsearg\newcodeindex}
1071
1072 % @synindex foo bar makes index foo feed into index bar.
1073 % Do this instead of @defindex foo if you don't want it as a separate index.
1074 \def\synindex #1 #2 {%
1075 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
1076 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
1077 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1078 \noexpand\doindex {#2}}%
1079 }
1080
1081 % @syncodeindex foo bar similar, but put all entries made for index foo
1082 % inside @code.
1083 \def\syncodeindex #1 #2 {%
1084 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
1085 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
1086 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1087 \noexpand\docodeindex {#2}}%
1088 }
1089
1090 % Define \doindex, the driver for all \fooindex macros.
1091 % Argument #1 is generated by the calling \fooindex macro,
1092 % and it is "foo", the name of the index.
1093
1094 % \doindex just uses \parsearg; it calls \doind for the actual work.
1095 % This is because \doind is more useful to call from other macros.
1096
1097 % There is also \dosubind {index}{topic}{subtopic}
1098 % which makes an entry in a two-level index such as the operation index.
1099
1100 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
1101 \def\singleindexer #1{\doind{\indexname}{#1}}
1102
1103 % like the previous two, but they put @code around the argument.
1104 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
1105 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
1106
1107 \def\indexdummies{%
1108 \def\_{{\realbackslash _}}%
1109 \def\w{\realbackslash w }%
1110 \def\bf{\realbackslash bf }%
1111 \def\rm{\realbackslash rm }%
1112 \def\sl{\realbackslash sl }%
1113 \def\sf{\realbackslash sf}%
1114 \def\tt{\realbackslash tt}%
1115 \def\gtr{\realbackslash gtr}%
1116 \def\less{\realbackslash less}%
1117 \def\hat{\realbackslash hat}%
1118 \def\char{\realbackslash char}%
1119 \def\TeX{\realbackslash TeX}%
1120 \def\dots{\realbackslash dots }%
1121 \def\copyright{\realbackslash copyright }%
1122 \def\tclose##1{\realbackslash tclose {##1}}%
1123 \def\code##1{\realbackslash code {##1}}%
1124 \def\samp##1{\realbackslash samp {##1}}%
1125 \def\t##1{\realbackslash r {##1}}%
1126 \def\r##1{\realbackslash r {##1}}%
1127 \def\i##1{\realbackslash i {##1}}%
1128 \def\b##1{\realbackslash b {##1}}%
1129 \def\cite##1{\realbackslash cite {##1}}%
1130 \def\key##1{\realbackslash key {##1}}%
1131 \def\file##1{\realbackslash file {##1}}%
1132 \def\var##1{\realbackslash var {##1}}%
1133 \def\kbd##1{\realbackslash kbd {##1}}%
1134 }
1135
1136 % \indexnofonts no-ops all font-change commands.
1137 % This is used when outputting the strings to sort the index by.
1138 \def\indexdummyfont#1{#1}
1139 \def\indexdummytex{TeX}
1140 \def\indexdummydots{...}
1141
1142 \def\indexnofonts{%
1143 \let\w=\indexdummyfont
1144 \let\t=\indexdummyfont
1145 \let\r=\indexdummyfont
1146 \let\i=\indexdummyfont
1147 \let\b=\indexdummyfont
1148 \let\emph=\indexdummyfont
1149 \let\strong=\indexdummyfont
1150 \let\cite=\indexdummyfont
1151 \let\sc=\indexdummyfont
1152 %Don't no-op \tt, since it isn't a user-level command
1153 % and is used in the definitions of the active chars like <, >, |...
1154 %\let\tt=\indexdummyfont
1155 \let\tclose=\indexdummyfont
1156 \let\code=\indexdummyfont
1157 \let\file=\indexdummyfont
1158 \let\samp=\indexdummyfont
1159 \let\kbd=\indexdummyfont
1160 \let\key=\indexdummyfont
1161 \let\var=\indexdummyfont
1162 \let\TeX=\indexdummytex
1163 \let\dots=\indexdummydots
1164 }
1165
1166 % To define \realbackslash, we must make \ not be an escape.
1167 % We must first make another character (@) an escape
1168 % so we do not become unable to do a definition.
1169
1170 {\catcode`\@=0 \catcode`\\=\other
1171 @gdef@realbackslash{\}}
1172
1173 \let\indexbackslash=0 %overridden during \printindex.
1174
1175 \def\doind #1#2{%
1176 {\count10=\lastpenalty %
1177 {\indexdummies % Must do this here, since \bf, etc expand at this stage
1178 \escapechar=`\\%
1179 {\let\folio=0% Expand all macros now EXCEPT \folio
1180 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
1181 % so it will be output as is; and it will print as backslash in the indx.
1182 %
1183 % Now process the index-string once, with all font commands turned off,
1184 % to get the string to sort the index by.
1185 {\indexnofonts
1186 \xdef\temp1{#2}%
1187 }%
1188 % Now produce the complete index entry. We process the index-string again,
1189 % this time with font commands expanded, to get what to print in the index.
1190 \edef\temp{%
1191 \write \csname#1indfile\endcsname{%
1192 \realbackslash entry {\temp1}{\folio}{#2}}}%
1193 \temp }%
1194 }\penalty\count10}}
1195
1196 \def\dosubind #1#2#3{%
1197 {\count10=\lastpenalty %
1198 {\indexdummies % Must do this here, since \bf, etc expand at this stage
1199 \escapechar=`\\%
1200 {\let\folio=0%
1201 \def\rawbackslashxx{\indexbackslash}%
1202 %
1203 % Now process the index-string once, with all font commands turned off,
1204 % to get the string to sort the index by.
1205 {\indexnofonts
1206 \xdef\temp1{#2 #3}%
1207 }%
1208 % Now produce the complete index entry. We process the index-string again,
1209 % this time with font commands expanded, to get what to print in the index.
1210 \edef\temp{%
1211 \write \csname#1indfile\endcsname{%
1212 \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
1213 \temp }%
1214 }\penalty\count10}}
1215
1216 % The index entry written in the file actually looks like
1217 % \entry {sortstring}{page}{topic}
1218 % or
1219 % \entry {sortstring}{page}{topic}{subtopic}
1220 % The texindex program reads in these files and writes files
1221 % containing these kinds of lines:
1222 % \initial {c}
1223 % before the first topic whose initial is c
1224 % \entry {topic}{pagelist}
1225 % for a topic that is used without subtopics
1226 % \primary {topic}
1227 % for the beginning of a topic that is used with subtopics
1228 % \secondary {subtopic}{pagelist}
1229 % for each subtopic.
1230
1231 % Define the user-accessible indexing commands
1232 % @findex, @vindex, @kindex, @cindex.
1233
1234 \def\findex {\fnindex}
1235 \def\kindex {\kyindex}
1236 \def\cindex {\cpindex}
1237 \def\vindex {\vrindex}
1238 \def\tindex {\tpindex}
1239 \def\pindex {\pgindex}
1240
1241 \def\cindexsub {\begingroup\obeylines\cindexsub}
1242 {\obeylines %
1243 \gdef\cindexsub "#1" #2^^M{\endgroup %
1244 \dosubind{cp}{#2}{#1}}}
1245
1246 % Define the macros used in formatting output of the sorted index material.
1247
1248 % This is what you call to cause a particular index to get printed.
1249 % Write
1250 % @unnumbered Function Index
1251 % @printindex fn
1252
1253 \def\printindex{\parsearg\doprintindex}
1254
1255 \def\doprintindex#1{\tex %
1256 \dobreak \chapheadingskip {10000}
1257 \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
1258 \catcode`\$=\other\catcode`\_=\other
1259 \catcode`\~=\other
1260 % The following don't help, since the chars were translated
1261 % when the raw index was written, and their fonts were discarded
1262 % due to \indexnofonts.
1263 %\catcode`\"=\active
1264 %\catcode`\^=\active
1265 %\catcode`\_=\active
1266 %\catcode`\|=\active
1267 %\catcode`\<=\active
1268 %\catcode`\>=\active
1269 \def\indexbackslash{\rawbackslashxx}
1270 \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
1271 \begindoublecolumns
1272 \openin 1 \jobname.#1s
1273 \ifeof 1
1274 % \enddoublecolumns gets confused if there is no text in the index,
1275 % and it loses the chapter title and the aux file entries for the index.
1276 % The easiest way to prevent this problem is to make sure there is some text.
1277 (Index is empty)
1278 \else \closein 1 \input \jobname.#1s
1279 \fi
1280 \enddoublecolumns
1281 \Etex}
1282
1283 % These macros are used by the sorted index file itself.
1284 % Change them to control the appearance of the index.
1285
1286 % Same as \bigskipamount except no shrink.
1287 % \balancecolumns gets confused if there is any shrink.
1288 \newskip\initialskipamount \initialskipamount 12pt plus4pt
1289
1290 \outer\def\initial #1{%
1291 {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
1292 \ifdim\lastskip<\initialskipamount
1293 \removelastskip \penalty-200 \vskip \initialskipamount\fi
1294 \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
1295
1296 \outer\def\entry #1#2{
1297 {\parfillskip=0in \parskip=0in \parindent=0in
1298 \hangindent=1in \hangafter=1%
1299 \noindent\hbox{#1}\indexdotfill #2\par
1300 }}
1301
1302 % Like \dotfill except takes at least 1 em.
1303 \def\indexdotfill{\cleaders
1304 \hbox{$\mathsurround=0pt \mkern1.5mu . \mkern1.5mu$}\hskip 1em plus 1fill}
1305
1306 \def\primary #1{\line{#1\hfil}}
1307
1308 \newskip\secondaryindent \secondaryindent=0.5cm
1309
1310 \def\secondary #1#2{
1311 {\parfillskip=0in \parskip=0in
1312 \hangindent =1in \hangafter=1
1313 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
1314 }}
1315
1316 %% Define two-column mode, which is used in indexes.
1317 %% Adapted from the TeXBook, page 416
1318 \catcode `\@=11
1319
1320 \newbox\partialpage
1321
1322 \newdimen\doublecolumnhsize \doublecolumnhsize = 3.11in
1323 \newdimen\doublecolumnvsize \doublecolumnvsize = 19.1in
1324 \newdimen\availdimen@
1325
1326 \def\begindoublecolumns{\begingroup
1327 \output={\global\setbox\partialpage=
1328 \vbox{\unvbox255\kern -\topskip \kern \baselineskip}}\eject
1329 \output={\doublecolumnout}%
1330 \hsize=\doublecolumnhsize \vsize=\doublecolumnvsize}
1331 \def\enddoublecolumns{\output={\balancecolumns}\eject
1332 \endgroup \pagegoal=\vsize}
1333
1334 \def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
1335 \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
1336 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
1337 \onepageout\pagesofar \unvbox255 \penalty\outputpenalty}
1338 \def\pagesofar{\unvbox\partialpage %
1339 \hsize=\doublecolumnhsize % have to restore this since output routine
1340 % changes it to set cropmarks (P. A. MacKay, 12 Nov. 1986)
1341 \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
1342 \def\balancecolumns{%
1343 % Unset the glue.
1344 \setbox255=\vbox{\unvbox255}
1345 \dimen@=\ht255
1346 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
1347 \divide\dimen@ by2
1348 \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpage
1349 % If the remaining data is too big for one page,
1350 % output one page normally, then work with what remains.
1351 \ifdim \dimen@>\availdimen@
1352 {
1353 \splittopskip=\topskip \splitmaxdepth=\maxdepth
1354 \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
1355 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
1356 \onepageout\pagesofar
1357 }
1358 % Recompute size of what remains, in case we just output some of it.
1359 \dimen@=\ht255
1360 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
1361 \divide\dimen@ by2
1362 \fi
1363 \setbox0=\vbox{\unvbox255}
1364 \splittopskip=\topskip
1365 {\vbadness=10000 \loop \global\setbox3=\copy0
1366 \global\setbox1=\vsplit3 to\dimen@
1367 \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
1368 \setbox0=\vbox to\dimen@{\unvbox1} \setbox2=\vbox to\dimen@{\unvbox3}
1369 \pagesofar}
1370
1371 \catcode `\@=\other
1372 \message{sectioning,}
1373 % Define chapters, sections, etc.
1374
1375 \newcount \chapno
1376 \newcount \secno
1377 \newcount \subsecno
1378 \newcount \subsubsecno
1379
1380 % This counter is funny since it counts through charcodes of letters A, B, ...
1381 \newcount \appendixno \appendixno = `\@
1382 \def\appendixletter{\char\the\appendixno}
1383
1384 \newwrite \contentsfile
1385 % This is called from \setfilename.
1386 \def\opencontents{\openout \contentsfile = \jobname.toc}
1387
1388 % Each @chapter defines this as the name of the chapter.
1389 % page headings and footings can use it. @section does likewise
1390
1391 \def\thischapter{} \def\thissection{}
1392 \def\seccheck#1{\if \pageno<0 %
1393 \errmessage{@#1 not allowed after generating table of contents}\fi
1394 %
1395 }
1396
1397 \def\chapternofonts{%
1398 \let\rawbackslash=\relax%
1399 \let\frenchspacing=\relax%
1400 \def\TeX{\realbackslash TeX}
1401 \def\dots{\realbackslash dots}
1402 \def\copyright{\realbackslash copyright}
1403 \def\tt{\realbackslash tt}
1404 \def\bf{\realbackslash bf }
1405 \def\w{\realbackslash w}
1406 \def\less{\realbackslash less}
1407 \def\gtr{\realbackslash gtr}
1408 \def\hat{\realbackslash hat}
1409 \def\char{\realbackslash char}
1410 \def\tclose##1{\realbackslash tclose {##1}}
1411 \def\code##1{\realbackslash code {##1}}
1412 \def\samp##1{\realbackslash samp {##1}}
1413 \def\r##1{\realbackslash r {##1}}
1414 \def\b##1{\realbackslash b {##1}}
1415 \def\key##1{\realbackslash key {##1}}
1416 \def\file##1{\realbackslash file {##1}}
1417 \def\kbd##1{\realbackslash kbd {##1}}
1418 % These are redefined because @smartitalic wouldn't work inside xdef.
1419 \def\i##1{\realbackslash i {##1}}
1420 \def\cite##1{\realbackslash cite {##1}}
1421 \def\var##1{\realbackslash var {##1}}
1422 \def\emph##1{\realbackslash emph {##1}}
1423 \def\dfn##1{\realbackslash dfn {##1}}
1424 }
1425
1426 \outer\def\chapter{\parsearg\chapterzzz}
1427 \def\chapterzzz #1{\seccheck{chapter}%
1428 \secno=0 \subsecno=0 \subsubsecno=0
1429 \global\advance \chapno by 1 \message{Chapter \the\chapno}%
1430 \chapmacro {#1}{\the\chapno}%
1431 \gdef\thissection{#1}%
1432 \gdef\thischaptername{#1}%
1433 % We don't substitute the actual chapter name into \thischapter
1434 % because we don't want its macros evaluated now.
1435 \xdef\thischapter{Chapter \the\chapno: \noexpand\thischaptername}%
1436 {\chapternofonts%
1437 \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
1438 \escapechar=`\\%
1439 \write \contentsfile \temp %
1440 \donoderef %
1441 \global\let\section = \numberedsection
1442 }}
1443
1444 \outer\def\appendix{\parsearg\appendixzzz}
1445 \def\appendixzzz #1{\seccheck{appendix}%
1446 \secno=0 \subsecno=0 \subsubsecno=0
1447 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
1448 \chapmacro {#1}{Appendix \appendixletter}%
1449 \gdef\thissection{#1}%
1450 \gdef\thischaptername{#1}%
1451 \xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}%
1452 {\chapternofonts%
1453 \edef\temp{{\realbackslash chapentry
1454 {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
1455 \escapechar=`\\%
1456 \write \contentsfile \temp %
1457 \appendixnoderef %
1458 \global\let\section = \appendixsec
1459 }}
1460
1461 \outer\def\top{\parsearg\unnumberedzzz}
1462 \outer\def\unnumbered{\parsearg\unnumberedzzz}
1463 \def\unnumberedzzz #1{\seccheck{unnumbered}%
1464 \secno=0 \subsecno=0 \subsubsecno=0 \message{(#1)}
1465 \unnumbchapmacro {#1}%
1466 \gdef\thischapter{#1}\gdef\thissection{#1}%
1467 {\chapternofonts%
1468 \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
1469 \escapechar=`\\%
1470 \write \contentsfile \temp %
1471 \unnumbnoderef %
1472 \global\let\section = \unnumberedsec
1473 }}
1474
1475 \outer\def\numberedsection{\parsearg\sectionzzz}
1476 \def\sectionzzz #1{\seccheck{section}%
1477 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
1478 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
1479 {\chapternofonts%
1480 \edef\temp{{\realbackslash secentry %
1481 {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
1482 \escapechar=`\\%
1483 \write \contentsfile \temp %
1484 \donoderef %
1485 \penalty 10000 %
1486 \global\let\subsection = \numberedsubsection
1487 }}
1488
1489 \outer\def\appendixsection{\parsearg\appendixsectionzzz}
1490 \outer\def\appendixsec{\parsearg\appendixsectionzzz}
1491 \def\appendixsectionzzz #1{\seccheck{appendixsection}%
1492 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
1493 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
1494 {\chapternofonts%
1495 \edef\temp{{\realbackslash secentry %
1496 {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
1497 \escapechar=`\\%
1498 \write \contentsfile \temp %
1499 \appendixnoderef %
1500 \penalty 10000 %
1501 \global\let\subsection = \appendixsubsec
1502 }}
1503
1504 \outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
1505 \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
1506 \plainsecheading {#1}\gdef\thissection{#1}%
1507 {\chapternofonts%
1508 \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
1509 \escapechar=`\\%
1510 \write \contentsfile \temp %
1511 \unnumbnoderef %
1512 \penalty 10000 %
1513 \global\let\subsection = \unnumberedsubsec
1514 }}
1515
1516 \outer\def\numberedsubsection{\parsearg\subsectionzzz}
1517 \def\subsectionzzz #1{\seccheck{subsection}%
1518 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
1519 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
1520 {\chapternofonts%
1521 \edef\temp{{\realbackslash subsecentry %
1522 {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
1523 \escapechar=`\\%
1524 \write \contentsfile \temp %
1525 \donoderef %
1526 \penalty 10000 %
1527 \global\let\subsubsection = \numberedsubsubsection
1528 }}
1529
1530 \outer\def\appendixsubsec{\parsearg\appendixsubseczzz}
1531 \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
1532 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
1533 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
1534 {\chapternofonts%
1535 \edef\temp{{\realbackslash subsecentry %
1536 {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
1537 \escapechar=`\\%
1538 \write \contentsfile \temp %
1539 \appendixnoderef %
1540 \penalty 10000 %
1541 \global\let\subsubsection = \appendixsubsubsec
1542 }}
1543
1544 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz}
1545 \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
1546 \plainsecheading {#1}\gdef\thissection{#1}%
1547 {\chapternofonts%
1548 \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
1549 \escapechar=`\\%
1550 \write \contentsfile \temp %
1551 \unnumbnoderef %
1552 \penalty 10000 %
1553 \global\let\subsubsection = \unnumberedsubsubsec
1554 }}
1555
1556 \outer\def\numberedsubsubsection{\parsearg\subsubsectionzzz}
1557 \def\subsubsectionzzz #1{\seccheck{subsubsection}%
1558 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
1559 \subsubsecheading {#1}
1560 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
1561 {\chapternofonts%
1562 \edef\temp{{\realbackslash subsubsecentry %
1563 {#1}
1564 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
1565 {\noexpand\folio}}}%
1566 \escapechar=`\\%
1567 \write \contentsfile \temp %
1568 \donoderef %
1569 \penalty 10000 %
1570 }}
1571
1572 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz}
1573 \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
1574 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
1575 \subsubsecheading {#1}
1576 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
1577 {\chapternofonts%
1578 \edef\temp{{\realbackslash subsubsecentry{#1}%
1579 {\appendixletter}
1580 {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
1581 \escapechar=`\\%
1582 \write \contentsfile \temp %
1583 \appendixnoderef %
1584 \penalty 10000 %
1585 }}
1586
1587 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
1588 \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
1589 \plainsecheading {#1}\gdef\thissection{#1}%
1590 {\chapternofonts%
1591 \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
1592 \escapechar=`\\%
1593 \write \contentsfile \temp %
1594 \unnumbnoderef %
1595 \penalty 10000 %
1596 }}
1597
1598 % These are variants which are not "outer", so they can appear in @ifinfo.
1599 \def\infotop{\parsearg\unnumberedzzz}
1600 \def\infounnumbered{\parsearg\unnumberedzzz}
1601 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
1602 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
1603 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
1604
1605 \def\infoappendix{\parsearg\appendixzzz}
1606 \def\infoappendixsec{\parsearg\appendixseczzz}
1607 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
1608 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
1609
1610 \def\infochapter{\parsearg\chapterzzz}
1611 \def\infosection{\parsearg\sectionzzz}
1612 \def\infosubsection{\parsearg\subsectionzzz}
1613 \def\infosubsubsection{\parsearg\subsubsectionzzz}
1614
1615 % Define @majorheading, @heading and @subheading
1616
1617 \def\majorheading{\parsearg\majorheadingzzz}
1618 \def\majorheadingzzz #1{%
1619 {\advance\chapheadingskip by 10pt \chapbreak }%
1620 {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 200}
1621
1622 \def\chapheading{\parsearg\chapheadingzzz}
1623 \def\chapheadingzzz #1{\chapbreak %
1624 {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 200}
1625
1626 \def\heading{\parsearg\secheadingi}
1627
1628 \def\subheading{\parsearg\subsecheadingi}
1629
1630 \def\subsubheading{\parsearg\subsubsecheadingi}
1631
1632 % These macros generate a chapter, section, etc. heading only
1633 % (including whitespace, linebreaking, etc. around it),
1634 % given all the information in convenient, parsed form.
1635
1636 %%% Args are the skip and penalty (usually negative)
1637 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
1638
1639 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
1640
1641 %%% Define plain chapter starts, and page on/off switching for it
1642 % Parameter controlling skip before chapter headings (if needed)
1643
1644 \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
1645
1646 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
1647 \def\chappager{\par\vfill\supereject}
1648 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
1649
1650 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
1651
1652 \def\CHAPPAGoff{
1653 \global\let\pchapsepmacro=\chapbreak
1654 \global\let\pagealignmacro=\chappager}
1655
1656 \def\CHAPPAGon{
1657 \global\let\pchapsepmacro=\chappager
1658 \global\let\pagealignmacro=\chappager
1659 \global\def\HEADINGSon{\HEADINGSsingle}}
1660
1661 \def\CHAPPAGodd{
1662 \global\let\pchapsepmacro=\chapoddpage
1663 \global\let\pagealignmacro=\chapoddpage
1664 \global\def\HEADINGSon{\HEADINGSdouble}}
1665
1666 \CHAPPAGon
1667
1668 \def\CHAPFplain{
1669 \global\let\chapmacro=\chfplain
1670 \global\let\unnumbchapmacro=\unnchfplain}
1671
1672 \def\chfplain #1#2{%
1673 \pchapsepmacro
1674 {%
1675 \chapfonts
1676 \leftline{\rm #2\enspace #1}%
1677 }%
1678 \bigskip
1679 \penalty5000
1680 }
1681
1682 \def\unnchfplain #1{%
1683 \pchapsepmacro %
1684 {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 10000 %
1685 }
1686 \CHAPFplain % The default
1687
1688 \def\unnchfopen #1{%
1689 \chapoddpage {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 10000 %
1690 }
1691
1692 \def\chfopen #1#2{\chapoddpage {\chapfonts
1693 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
1694 \par\penalty 5000 %
1695 }
1696
1697 \def\CHAPFopen{
1698 \global\let\chapmacro=\chfopen
1699 \global\let\unnumbchapmacro=\unnchfopen}
1700
1701 % Parameter controlling skip before section headings.
1702
1703 \newskip \subsecheadingskip \subsecheadingskip = 17pt plus 8pt minus 4pt
1704 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
1705
1706 \newskip \secheadingskip \secheadingskip = 21pt plus 8pt minus 4pt
1707 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
1708
1709
1710 % Section fonts are the base font at magstep2, which produces
1711 % a size a bit more than 14 points in the default situation.
1712
1713 \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
1714 \def\plainsecheading #1{\secheadingi {#1}}
1715 \def\secheadingi #1{{\advance \secheadingskip by \parskip %
1716 \secheadingbreak}%
1717 {\secfonts \line{\rm #1\hfill}}%
1718 \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
1719
1720
1721 % Subsection fonts are the base font at magstep1,
1722 % which produces a size of 12 points.
1723
1724 \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
1725 \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
1726 \subsecheadingbreak}%
1727 {\subsecfonts \line{\rm #1\hfill}}%
1728 \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
1729
1730 \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
1731 % Perhaps make sssec fonts scaled
1732 % magstep half
1733 \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
1734 \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
1735 \subsecheadingbreak}%
1736 {\subsubsecfonts \line{\rm #1\hfill}}%
1737 \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
1738
1739
1740 \message{toc printing,}
1741
1742 % Finish up the main text and prepare to read what we've written
1743 % to \contentsfile.
1744
1745 \def\startcontents#1{%
1746 \ifnum \pageno>0
1747 \pagealignmacro
1748 \immediate\closeout \contentsfile
1749 \pageno = -1 % Request roman numbered pages.
1750 \fi
1751 % Don't need to put `Contents' or `Short Contents' in the headline.
1752 % It is abundantly clear what they are.
1753 \unnumbchapmacro{#1}\def\thischapter{}%
1754 \begingroup % Set up to handle contents files properly.
1755 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
1756 \raggedbottom % Worry more about breakpoints than the bottom.
1757 \advance\hsize by -1in % Don't use the full line length.
1758 }
1759
1760
1761 % Normal (long) toc.
1762 \outer\def\contents{%
1763 \startcontents{Table of Contents}%
1764 \input \jobname.toc
1765 \endgroup
1766 \vfill \eject
1767 }
1768
1769 % And just the chapters.
1770 \outer\def\summarycontents{%
1771 \startcontents{Short Contents}%
1772 %
1773 \let\chapentry = \shortchapentry
1774 \let\unnumbchapentry = \shortunnumberedentry
1775 % We want a true roman here for the page numbers.
1776 \secfonts
1777 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
1778 \rm
1779 \advance\baselineskip by 1pt % Open it up a little.
1780 \def\secentry ##1##2##3##4{}
1781 \def\unnumbsecentry ##1##2{}
1782 \def\subsecentry ##1##2##3##4##5{}
1783 \def\unnumbsubsecentry ##1##2{}
1784 \def\subsubsecentry ##1##2##3##4##5##6{}
1785 \def\unnumbsubsubsecentry ##1##2{}
1786 \input \jobname.toc
1787 \endgroup
1788 \vfill \eject
1789 }
1790 \let\shortcontents = \summarycontents
1791
1792 % These macros generate individual entries in the table of contents.
1793 % The first argument is the chapter or section name.
1794 % The last argument is the page number.
1795 % The arguments in between are the chapter number, section number, ...
1796
1797 % Chapter-level things, for both the long and short contents.
1798 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
1799 \def\shortchapentry#1#2#3{%
1800 \line{{#2\labelspace #1}\dotfill\doshortpageno{#3}}%
1801 }
1802
1803 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
1804 \def\shortunnumberedentry#1#2{%
1805 \line{#1\dotfill\doshortpageno{#2}}%
1806 }
1807
1808 % Sections.
1809 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
1810 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
1811
1812 % Subsections.
1813 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
1814 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
1815
1816 % And subsubsections.
1817 \def\subsubsecentry#1#2#3#4#5#6{%
1818 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
1819 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
1820
1821
1822 % This parameter controls the indentation of the various levels.
1823 \newdimen\tocindent \tocindent = 3pc
1824
1825 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
1826 % page number.
1827 %
1828 % If the toc has to be broken over pages, we would want to be at chapters
1829 % if at all possible; hence the \penalty.
1830 \def\dochapentry#1#2{%
1831 \penalty-300 \vskip\baselineskip
1832 \line{\chapentryfonts #1\dotfill \dopageno{#2}}%
1833 \nobreak\vskip .25\baselineskip
1834 }
1835
1836 \def\dosecentry#1#2{%
1837 \line{\secentryfonts \hskip\tocindent #1\dotfill \dopageno{#2}}%
1838 }
1839
1840 \def\dosubsecentry#1#2{%
1841 \line{\subsecentryfonts \hskip2\tocindent #1\dotfill \dopageno{#2}}%
1842 }
1843
1844 \def\dosubsubsecentry#1#2{%
1845 \line{\subsubsecentryfonts \hskip3\tocindent #1\dotfill \dopageno{#2}}%
1846 }
1847
1848 % Space between chapter (or whatever) number and the title.
1849 \def\labelspace{\hskip1em \relax}
1850
1851 \def\dopageno#1{{\rm #1}}
1852 \def\doshortpageno#1{{\rm #1}}
1853
1854 \def\chapentryfonts{\secfonts \rm}
1855 \def\secentryfonts{\textfonts}
1856 \let\subsecentryfonts = \textfonts
1857 \let\subsubsecentryfonts = \textfonts
1858
1859
1860 \message{environments,}
1861
1862 % Since these characters are used in examples, it should be an even number of
1863 % \tt widths. Each \tt character is 1en, so two makes it 1em.
1864 % Furthermore, these definitions must come after we define our fonts.
1865 \newbox\dblarrowbox \newbox\longdblarrowbox
1866 \newbox\pushcharbox \newbox\bullbox
1867 \newbox\equivbox \newbox\errorbox
1868
1869 \let\ptexequiv = \equiv
1870
1871 {\tentt
1872 \global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
1873 \global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
1874 \global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
1875 \global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
1876 % Adapted from the manmac format (p.420 of TeXbook)
1877 \global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
1878 depth .1ex\hfil}
1879 }
1880
1881 \def\point{$\star$}
1882
1883 \def\result{\leavevmode\raise.15ex\copy\dblarrowbox}
1884 \def\expansion{\leavevmode\raise.1ex\copy\longdblarrowbox}
1885 \def\print{\leavevmode\lower.1ex\copy\pushcharbox}
1886
1887 \def\equiv{\leavevmode\lower.1ex\copy\equivbox}
1888
1889 % Does anyone really want this?
1890 % \def\bull{\leavevmode\copy\bullbox}
1891
1892 % Adapted from the TeXbook's \boxit.
1893 {\tentt \global\dimen0 = 3em}% Width of the box.
1894 \dimen2 = .55pt % Thickness of rules
1895 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
1896 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
1897
1898 \global\setbox\errorbox=\hbox to \dimen0{\hfil
1899 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
1900 \advance\hsize by -2\dimen2 % Rules.
1901 \vbox{
1902 \hrule height\dimen2
1903 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
1904 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
1905 \kern3pt\vrule width\dimen2}% Space to right.
1906 \hrule height\dimen2}
1907 \hfil}
1908
1909 % The @error{} command.
1910 \def\error{\leavevmode\lower.7ex\copy\errorbox}
1911
1912 % @tex ... @end tex escapes into raw Tex temporarily.
1913 % One exception: @ is still an escape character, so that @end tex works.
1914 % But \@ or @@ will get a plain tex @ character.
1915
1916 \def\tex{\begingroup
1917 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
1918 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
1919 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
1920 \catcode `\%=14
1921 \catcode 43=12
1922 \catcode`\"=12
1923 \catcode`\==12
1924 \catcode`\|=12
1925 \catcode`\<=12
1926 \catcode`\>=12
1927 \escapechar=`\\
1928 %
1929 \let\{=\ptexlbrace
1930 \let\}=\ptexrbrace
1931 \let\.=\ptexdot
1932 \let\*=\ptexstar
1933 \let\dots=\ptexdots
1934 \def\@{@}%
1935 \let\bullet=\ptexbullet
1936 \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
1937 \let\L=\ptexL
1938 %
1939 \let\Etex=\endgroup}
1940
1941 % Define @lisp ... @endlisp.
1942 % @lisp does a \begingroup so it can rebind things,
1943 % including the definition of @endlisp (which normally is erroneous).
1944
1945 % Amount to narrow the margins by for @lisp.
1946 \newskip\lispnarrowing \lispnarrowing=0.4in
1947
1948 % This is the definition that ^M gets inside @lisp
1949 % phr: changed space to \null, to avoid overfull hbox problems.
1950 {\obeyspaces%
1951 \gdef\lisppar{\null\endgraf}}
1952
1953 % Cause \obeyspaces to make each Space cause a word-separation
1954 % rather than the default which is that it acts punctuation.
1955 % This is because space in tt font looks funny.
1956 {\obeyspaces %
1957 \gdef\sepspaces{\def {\ }}}
1958
1959 \newskip\aboveenvskipamount \aboveenvskipamount= 0pt
1960 \def\aboveenvbreak{{\advance\aboveenvskipamount by \parskip
1961 \endgraf \ifdim\lastskip<\aboveenvskipamount
1962 \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}}
1963
1964 \def\afterenvbreak{\endgraf \ifdim\lastskip<\aboveenvskipamount
1965 \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}
1966
1967 \def\lisp{\aboveenvbreak
1968 \begingroup\inENV % This group ends at the end of the @lisp body
1969 \hfuzz=12truept % Don't be fussy
1970 % Make spaces be word-separators rather than space tokens.
1971 \sepspaces %
1972 % Single space lines
1973 \singlespace %
1974 % The following causes blank lines not to be ignored
1975 % by adding a space to the end of each line.
1976 \let\par=\lisppar
1977 \def\Elisp{\endgroup\afterenvbreak}%
1978 \parskip=0pt
1979 \advance \leftskip by \lispnarrowing
1980 \parindent=0pt
1981 \let\exdent=\internalexdent
1982 \obeyspaces \obeylines \tt \rawbackslash
1983 \def\next##1{}\next}
1984
1985
1986 \let\example=\lisp
1987 \def\Eexample{\Elisp}
1988
1989 \let\smallexample=\lisp
1990 \def\Esmallexample{\Elisp}
1991
1992 % Macro for 9 pt. examples, necessary to print with 5" lines.
1993 % From Pavel@xerox. This is not really used unless the
1994 % @smallbook command is given.
1995
1996 \def\smalllispx{\aboveenvbreak\begingroup\inENV
1997 % This group ends at the end of the @lisp body
1998 \hfuzz=12truept % Don't be fussy
1999 % Make spaces be word-separators rather than space tokens.
2000 \sepspaces %
2001 % Single space lines
2002 \singlespace %
2003 % The following causes blank lines not to be ignored
2004 % by adding a space to the end of each line.
2005 \let\par=\lisppar
2006 \def\Esmalllisp{\endgroup\afterenvbreak}%
2007 \parskip=0pt
2008 \advance \leftskip by \lispnarrowing
2009 \parindent=0pt
2010 \let\exdent=\internalexdent
2011 \obeyspaces \obeylines \ninett \indexfonts \rawbackslash
2012 \def\next##1{}\next}
2013
2014 % This is @display; same as @lisp except use roman font.
2015
2016 \def\display{\begingroup\inENV %This group ends at the end of the @display body
2017 \aboveenvbreak
2018 % Make spaces be word-separators rather than space tokens.
2019 \sepspaces %
2020 % Single space lines
2021 \singlespace %
2022 % The following causes blank lines not to be ignored
2023 % by adding a space to the end of each line.
2024 \let\par=\lisppar
2025 \def\Edisplay{\endgroup\afterenvbreak}%
2026 \parskip=0pt
2027 \advance \leftskip by \lispnarrowing
2028 \parindent=0pt
2029 \let\exdent=\internalexdent
2030 \obeyspaces \obeylines
2031 \def\next##1{}\next}
2032
2033 % This is @format; same as @lisp except use roman font and don't narrow margins
2034
2035 \def\format{\begingroup\inENV %This group ends at the end of the @format body
2036 \aboveenvbreak
2037 % Make spaces be word-separators rather than space tokens.
2038 \sepspaces %
2039 \singlespace %
2040 % The following causes blank lines not to be ignored
2041 % by adding a space to the end of each line.
2042 \let\par=\lisppar
2043 \def\Eformat{\endgroup\afterenvbreak}
2044 \parskip=0pt \parindent=0pt
2045 \obeyspaces \obeylines
2046 \def\next##1{}\next}
2047
2048 % @flushleft and @flushright
2049
2050 \def\flushleft{%
2051 \begingroup\inENV %This group ends at the end of the @format body
2052 \aboveenvbreak
2053 % Make spaces be word-separators rather than space tokens.
2054 \sepspaces %
2055 % The following causes blank lines not to be ignored
2056 % by adding a space to the end of each line.
2057 % This also causes @ to work when the directive name
2058 % is terminated by end of line.
2059 \let\par=\lisppar
2060 \def\Eflushleft{\endgroup\afterenvbreak}%
2061 \parskip=0pt \parindent=0pt
2062 \obeyspaces \obeylines
2063 \def\next##1{}\next}
2064
2065 \def\flushright{%
2066 \begingroup\inENV %This group ends at the end of the @format body
2067 \aboveenvbreak
2068 % Make spaces be word-separators rather than space tokens.
2069 \sepspaces %
2070 % The following causes blank lines not to be ignored
2071 % by adding a space to the end of each line.
2072 % This also causes @ to work when the directive name
2073 % is terminated by end of line.
2074 \let\par=\lisppar
2075 \def\Eflushright{\endgroup\afterenvbreak}%
2076 \parskip=0pt \parindent=0pt
2077 \advance \leftskip by 0pt plus 1fill
2078 \obeyspaces \obeylines
2079 \def\next##1{}\next}
2080
2081 % @quotation - narrow the margins.
2082
2083 \def\quotation{%
2084 \begingroup\inENV %This group ends at the end of the @quotation body
2085 {\parskip=0pt % because we will skip by \parskip too, later
2086 \aboveenvbreak}%
2087 \singlespace
2088 \parindent=0pt
2089 \def\Equotation{\par\endgroup\afterenvbreak}%
2090 \advance \rightskip by \lispnarrowing
2091 \advance \leftskip by \lispnarrowing}
2092
2093 \message{defuns,}
2094 % Define formatter for defuns
2095 % First, allow user to change definition object font (\df) internally
2096 \def\setdeffont #1 {\csname DEF#1\endcsname}
2097
2098 \newskip\defbodyindent \defbodyindent=.4in
2099 \newskip\defargsindent \defargsindent=50pt
2100 \newskip\deftypemargin \deftypemargin=12pt
2101 \newskip\deflastargmargin \deflastargmargin=18pt
2102
2103 \newcount\parencount
2104 % define \functionparens, which makes ( and ) and & do special things.
2105 % \functionparens affects the group it is contained in.
2106 \def\activeparens{%
2107 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
2108 \catcode`\[=\active \catcode`\]=\active}
2109 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
2110 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
2111 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
2112
2113 % Definitions of (, ) and & used in args for functions.
2114 % This is the definition of ( outside of all parentheses.
2115 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
2116 \global\advance\parencount by 1 }
2117 %
2118 % This is the definition of ( when already inside a level of parens.
2119 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
2120 %
2121 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
2122 % also in that case restore the outer-level definition of (.
2123 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
2124 \global\advance \parencount by -1 }
2125 % If we encounter &foo, then turn on ()-hacking afterwards
2126 \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
2127 %
2128 \gdef\normalparens{\boldbrax\let&=\ampnr}
2129 } % End of definition inside \activeparens
2130 %% These parens (in \boldbrax) actually are a little bolder than the
2131 %% contained text. This is especially needed for [ and ]
2132 \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
2133 \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
2134
2135 % First, defname, which formats the header line itself.
2136 % #1 should be the function name.
2137 % #2 should be the type of definition, such as "Function".
2138
2139 \def\defname #1#2{%
2140 % Get the values of \leftskip and \rightskip as they were
2141 % outside the @def...
2142 \dimen2=\leftskip
2143 \advance\dimen2 by -\defbodyindent
2144 \dimen3=\rightskip
2145 \advance\dimen3 by -\defbodyindent
2146 \noindent %
2147 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
2148 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
2149 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
2150 \parshape 2 0in \dimen0 \defargsindent \dimen1 %
2151 % Now output arg 2 ("Function" or some such)
2152 % ending at \deftypemargin from the right margin,
2153 % but stuck inside a box of width 0 so it does not interfere with linebreaking
2154 {% Adjust \hsize to exclude the ambient margins,
2155 % so that \rightline will obey them.
2156 \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
2157 \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
2158 % Make all lines underfull and no complaints:
2159 \tolerance=10000 \hbadness=10000
2160 {\df #1}\enskip % Generate function name
2161 }
2162
2163 % Actually process the body of a definition
2164 % #1 should be the terminating control sequence, such as \Edefun.
2165 % #2 should be the "another name" control sequence, such as \defunx.
2166 % #3 should be the control sequence that actually processes the header,
2167 % such as \defunheader.
2168
2169 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
2170 \medbreak %
2171 % Define the end token that this defining construct specifies
2172 % so that it will exit this group.
2173 \def#1{\endgraf\endgroup\medbreak}%
2174 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
2175 \parindent=0in
2176 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
2177 \begingroup %
2178 \catcode 61=\active %
2179 \obeylines\activeparens\spacesplit#3}
2180
2181 \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
2182 \medbreak %
2183 % Define the end token that this defining construct specifies
2184 % so that it will exit this group.
2185 \def#1{\endgraf\endgroup\medbreak}%
2186 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
2187 \parindent=0in
2188 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
2189 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
2190
2191 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
2192 \medbreak %
2193 % Define the end token that this defining construct specifies
2194 % so that it will exit this group.
2195 \def#1{\endgraf\endgroup\medbreak}%
2196 \def#2##1 ##2 {\def#4{##1}%
2197 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
2198 \parindent=0in
2199 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
2200 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
2201
2202 % Split up #2 at the first space token.
2203 % call #1 with two arguments:
2204 % the first is all of #2 before the space token,
2205 % the second is all of #2 after that space token.
2206 % If #2 contains no space token, all of it is passed as the first arg
2207 % and the second is passed as empty.
2208
2209 {\obeylines
2210 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
2211 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
2212 \ifx\relax #3%
2213 #1{#2}{}\else #1{#2}{#3#4}\fi}}
2214
2215 % So much for the things common to all kinds of definitions.
2216
2217 % Define @defun.
2218
2219 % First, define the processing that is wanted for arguments of \defun
2220 % Use this to expand the args and terminate the paragraph they make up
2221
2222 \def\defunargs #1{\functionparens \sl
2223 % Expand, preventing hyphenation at `-' chars.
2224 % Note that groups don't affect changes in \hyphenchar.
2225 \hyphenchar\tensl=0
2226 #1%
2227 \hyphenchar\tensl=45
2228 \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
2229 \interlinepenalty=10000
2230 \advance\rightskip by 0pt plus 1fil
2231 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
2232 }
2233
2234 \def\deftypefunargs #1{%
2235 % Expand, preventing hyphenation at `-' chars.
2236 % Note that groups don't affect changes in \hyphenchar.
2237 \functionparens
2238 \code{#1}%
2239 \interlinepenalty=10000
2240 \advance\rightskip by 0pt plus 1fil
2241 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
2242 }
2243
2244 % Do complete processing of one @defun or @defunx line already parsed.
2245
2246 % @deffn Command forward-char nchars
2247
2248 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
2249
2250 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
2251 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
2252 \catcode 61=\other % Turn off change made in \defparsebody
2253 }
2254
2255 % @defun == @deffn Function
2256
2257 \def\defun{\defparsebody\Edefun\defunx\defunheader}
2258
2259 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
2260 \begingroup\defname {#1}{Function}%
2261 \defunargs {#2}\endgroup %
2262 \catcode 61=\other % Turn off change made in \defparsebody
2263 }
2264
2265 % @deftypefun int foobar (int @var{foo}, float @var{bar})
2266
2267 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
2268
2269 % #1 is the data type. #2 is the name and args.
2270 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
2271 % #1 is the data type, #2 the name, #3 the args.
2272 \def\deftypefunheaderx #1#2 #3\relax{%
2273 \doind {fn}{\code{#2}}% Make entry in function index
2274 \begingroup\defname {\code{#1} #2}{Function}%
2275 \deftypefunargs {#3}\endgroup %
2276 \catcode 61=\other % Turn off change made in \defparsebody
2277 }
2278
2279 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
2280
2281 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
2282
2283 % #1 is the classification. #2 is the data type. #3 is the name and args.
2284 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
2285 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
2286 \def\deftypefnheaderx #1#2#3 #4\relax{%
2287 \doind {fn}{\code{#3}}% Make entry in function index
2288 \begingroup\defname {\code{#2} #3}{#1}%
2289 \deftypefunargs {#4}\endgroup %
2290 \catcode 61=\other % Turn off change made in \defparsebody
2291 }
2292
2293 % @defmac == @deffn Macro
2294
2295 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
2296
2297 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
2298 \begingroup\defname {#1}{Macro}%
2299 \defunargs {#2}\endgroup %
2300 \catcode 61=\other % Turn off change made in \defparsebody
2301 }
2302
2303 % @defspec == @deffn Special Form
2304
2305 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
2306
2307 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
2308 \begingroup\defname {#1}{Special Form}%
2309 \defunargs {#2}\endgroup %
2310 \catcode 61=\other % Turn off change made in \defparsebody
2311 }
2312
2313 % This definition is run if you use @defunx
2314 % anywhere other than immediately after a @defun or @defunx.
2315
2316 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
2317 \def\defunx #1 {\errmessage{@defunx in invalid context}}
2318 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
2319 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
2320 \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
2321 \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
2322
2323 % @defmethod, and so on
2324
2325 % @defop {Funny Method} foo-class frobnicate argument
2326
2327 \def\defop #1 {\def\defoptype{#1}%
2328 \defopparsebody\Edefop\defopx\defopheader\defoptype}
2329
2330 \def\defopheader #1#2#3{%
2331 \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
2332 \begingroup\defname {#2}{\defoptype{} on #1}%
2333 \defunargs {#3}\endgroup %
2334 }
2335
2336 % @defmethod == @defop Method
2337
2338 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
2339
2340 \def\defmethodheader #1#2#3{%
2341 \dosubind {fn}{\code{#2}}{on #1}% entry in function index
2342 \begingroup\defname {#2}{Method on #1}%
2343 \defunargs {#3}\endgroup %
2344 }
2345
2346 % @deftypemethod class type frobnicate argument
2347
2348 \def\deftypemethod{\defmethparsebody\Edeftypemethod\deftypemethodx%
2349 \deftypemethodheader}
2350
2351 % #1 is the class. #2 is the data type. #3 is the name and args.
2352 \def\deftypemethodheader #1#2#3{\deftypemethodheaderx{#1}{#2}#3 \relax}
2353 % #1 is the class, #2 the data type, #3 then name , #4 the args.
2354 \def\deftypemethodheaderx #1#2#3 #4\relax{\dosubind {fn}{\code{#3}}{on #1}%
2355 \begingroup\defname {\code{#2} #3}{Method on #1}%
2356 \deftypefunargs {#4}\endgroup
2357 }
2358
2359 % @defcv {Class Option} foo-class foo-flag
2360
2361 \def\defcv #1 {\def\defcvtype{#1}%
2362 \defopparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
2363
2364 \def\defcvarheader #1#2#3{%
2365 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
2366 \begingroup\defname {#2}{\defcvtype{} of #1}%
2367 \defvarargs {#3}\endgroup %
2368 }
2369
2370 % @defivar == @defcv {Instance Variable}
2371
2372 \def\defivar{\defmethparsebody\Edefivar\defivarx\defivarheader}
2373
2374 \def\defivarheader #1#2#3{%
2375 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
2376 \begingroup\defname {#2}{Instance Variable of #1}%
2377 \defvarargs {#3}\endgroup %
2378 }
2379
2380 % These definitions are run if you use @defmethodx, etc.,
2381 % anywhere other than immediately after a @defmethod, etc.
2382
2383 \def\defopx #1 {\errmessage{@defopx in invalid context}}
2384 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
2385 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
2386 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
2387
2388 % Now @defvar
2389
2390 % First, define the processing that is wanted for arguments of @defvar.
2391 % This is actually simple: just print them in roman.
2392 % This must expand the args and terminate the paragraph they make up
2393 \def\defvarargs #1{\normalparens #1%
2394 \interlinepenalty=10000
2395 \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
2396
2397 % @defvr Counter foo-count
2398
2399 \def\defvr{\defmethparsebody\Edefvr\defvrx\defvrheader}
2400
2401 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
2402 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
2403
2404 % @defvar == @defvr Variable
2405
2406 \def\defvar{\defparsebody\Edefvar\defvarx\defvarheader}
2407
2408 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
2409 \begingroup\defname {#1}{Variable}%
2410 \defvarargs {#2}\endgroup %
2411 }
2412
2413 % @defopt == @defvr {User Option}
2414
2415 \def\defopt{\defparsebody\Edefopt\defoptx\defoptheader}
2416
2417 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
2418 \begingroup\defname {#1}{User Option}%
2419 \defvarargs {#2}\endgroup %
2420 }
2421
2422 % @deftypevar int foobar
2423
2424 \def\deftypevar{\defparsebody\Edeftypevar\deftypevarx\deftypevarheader}
2425
2426 % #1 is the data type. #2 is the name.
2427 \def\deftypevarheader #1#2{%
2428 \doind {vr}{\code{#2}}% Make entry in variables index
2429 \begingroup\defname {\code{#1} #2}{Variable}%
2430 \interlinepenalty=10000
2431 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
2432 \endgroup}
2433
2434 % @deftypevr {Global Flag} int enable
2435
2436 \def\deftypevr{\defmethparsebody\Edeftypevr\deftypevrx\deftypevrheader}
2437
2438 \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
2439 \begingroup\defname {\code{#2} #3}{#1}
2440 \interlinepenalty=10000
2441 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
2442 \endgroup}
2443
2444 % This definition is run if you use @defvarx
2445 % anywhere other than immediately after a @defvar or @defvarx.
2446
2447 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
2448 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
2449 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
2450 \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
2451 \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
2452
2453 % Now define @deftp
2454 % Args are printed in bold, a slight difference from @defvar.
2455
2456 \def\deftpargs #1{\bf \defvarargs{#1}}
2457
2458 % @deftp Class window height width ...
2459
2460 \def\deftp{\defmethparsebody\Edeftp\deftpx\deftpheader}
2461
2462 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
2463 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
2464
2465 % This definition is run if you use @deftpx, etc
2466 % anywhere other than immediately after a @deftp, etc.
2467
2468 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
2469
2470 \message{cross reference,}
2471 % Define cross-reference macros
2472 \newwrite \auxfile
2473
2474 \newif\ifhavexrefs % True if xref values are known.
2475 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
2476
2477 % \setref{foo} defines a cross-reference point named foo.
2478
2479 \def\setref#1{%
2480 %\dosetq{#1-title}{Ytitle}%
2481 \dosetq{#1-pg}{Ypagenumber}%
2482 \dosetq{#1-snt}{Ysectionnumberandtype}}
2483
2484 \def\unnumbsetref#1{%
2485 %\dosetq{#1-title}{Ytitle}%
2486 \dosetq{#1-pg}{Ypagenumber}%
2487 \dosetq{#1-snt}{Ynothing}}
2488
2489 \def\appendixsetref#1{%
2490 %\dosetq{#1-title}{Ytitle}%
2491 \dosetq{#1-pg}{Ypagenumber}%
2492 \dosetq{#1-snt}{Yappendixletterandtype}}
2493
2494 % \xref, \pxref, and \ref generate cross-references to specified points.
2495 % For \xrefX, #1 is the node name, #2 the name of the Info
2496 % cross-reference, #3 the printed node name, #4 the name of the Info
2497 % file, #5 the name of the printed manual. All but the node name can be
2498 % omitted.
2499 %
2500 \def\pxref#1{see \xrefX[#1,,,,,,,]}
2501 \def\xref#1{See \xrefX[#1,,,,,,,]}
2502 \def\ref#1{\xrefX[#1,,,,,,,]}
2503 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup%
2504 \def\printedmanual{\ignorespaces #5}%
2505 \def\printednodename{\ignorespaces #3}%
2506 %
2507 \setbox1=\hbox{\printedmanual}%
2508 \setbox0=\hbox{\printednodename}%
2509 \ifdim \wd0=0pt%
2510 \def\printednodename{\ignorespaces #1}%
2511 %%% Uncommment the following line to make the actual chapter or section title
2512 %%% appear inside the square brackets.
2513 %\def\printednodename{#1-title}%
2514 \fi%
2515 %
2516 %
2517 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does
2518 % not insert empty discretionaries after hyphens, which means that it
2519 % will not find a line break at a hyphen in a node names. Since some
2520 % manuals are best written with fairly long node names, containing
2521 % hyphens, this is a loss. Therefore, we simply give the text of
2522 % the node name again, so it is as if TeX is seeing it for the first
2523 % time.
2524 \ifdim \wd1>0pt
2525 section ``\printednodename'' in \cite{\printedmanual}%
2526 \else%
2527 \turnoffactive%
2528 \refx{#1-snt}{} [\printednodename], page\tie\refx{#1-pg}{}%
2529 \fi
2530 \endgroup}
2531
2532 % \dosetq is the interface for calls from other macros
2533
2534 % Use \turnoffactive so that punctuation chars such as underscore
2535 % work in node names.
2536 \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
2537 \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
2538 \next}}
2539
2540 % \internalsetq {foo}{page} expands into
2541 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
2542 % When the aux file is read, ' is the escape character
2543
2544 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
2545
2546 % Things to be expanded by \internalsetq
2547
2548 \def\Ypagenumber{\folio}
2549
2550 \def\Ytitle{\thischapter}
2551
2552 \def\Ynothing{}
2553
2554 \def\Ysectionnumberandtype{%
2555 \ifnum\secno=0 Chapter\xreftie\the\chapno %
2556 \else \ifnum \subsecno=0 Section\xreftie\the\chapno.\the\secno %
2557 \else \ifnum \subsubsecno=0 %
2558 Section\xreftie\the\chapno.\the\secno.\the\subsecno %
2559 \else %
2560 Section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
2561 \fi \fi \fi }
2562
2563 \def\Yappendixletterandtype{%
2564 \ifnum\secno=0 Appendix\xreftie'char\the\appendixno{}%
2565 \else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %
2566 \else \ifnum \subsubsecno=0 %
2567 Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
2568 \else %
2569 Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
2570 \fi \fi \fi }
2571
2572 \gdef\xreftie{'tie}
2573
2574 % Use TeX 3.0's \inputlineno to get the line number, for better error
2575 % messages, but if we're using an old version of TeX, don't do anything.
2576 %
2577 \ifx\inputlineno\thisisundefined
2578 \let\linenumber = \empty % Non-3.0.
2579 \else
2580 \def\linenumber{\the\inputlineno:\space}
2581 \fi
2582
2583 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
2584 % If its value is nonempty, SUFFIX is output afterward.
2585
2586 \def\refx#1#2{%
2587 \expandafter\ifx\csname X#1\endcsname\relax
2588 % If not defined, say something at least.
2589 $\langle$un\-de\-fined$\rangle$%
2590 \ifhavexrefs
2591 \message{\linenumber Undefined cross reference `#1'.}%
2592 \else
2593 \ifwarnedxrefs\else
2594 \global\warnedxrefstrue
2595 \message{Cross reference values unknown; you must run TeX again.}%
2596 \fi
2597 \fi
2598 \else
2599 % It's defined, so just use it.
2600 \csname X#1\endcsname
2601 \fi
2602 #2% Output the suffix in any case.
2603 }
2604
2605 % Read the last existing aux file, if any. No error if none exists.
2606
2607 % This is the macro invoked by entries in the aux file.
2608 \def\xrdef #1#2{
2609 {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
2610
2611 \def\readauxfile{%
2612 \begingroup
2613 \catcode `\^^@=\other
2614 \catcode `\\ 1=\other
2615 \catcode `\\ 2=\other
2616 \catcode `\^^C=\other
2617 \catcode `\^^D=\other
2618 \catcode `\^^E=\other
2619 \catcode `\^^F=\other
2620 \catcode `\^^G=\other
2621 \catcode `\^^H=\other
2622 \catcode `\\v=\other
2623 \catcode `\^^L=\other
2624 \catcode `\\ e=\other
2625 \catcode `\\ f=\other
2626 \catcode `\\10=\other
2627 \catcode `\\11=\other
2628 \catcode `\\12=\other
2629 \catcode `\\13=\other
2630 \catcode `\\14=\other
2631 \catcode `\\15=\other
2632 \catcode `\\16=\other
2633 \catcode `\\17=\other
2634 \catcode `\\18=\other
2635 \catcode `\\19=\other
2636 \catcode `\\1a=\other
2637 \catcode `\^^[=\other
2638 \catcode `\^^\=\other
2639 \catcode `\^^]=\other
2640 \catcode `\^^^=\other
2641 \catcode `\^^_=\other
2642 \catcode `\@=\other
2643 \catcode `\^=\other
2644 \catcode `\~=\other
2645 \catcode `\[=\other
2646 \catcode `\]=\other
2647 \catcode`\"=\other
2648 \catcode`\_=\other
2649 \catcode`\|=\other
2650 \catcode`\<=\other
2651 \catcode`\>=\other
2652 \catcode `\$=\other
2653 \catcode `\#=\other
2654 \catcode `\&=\other
2655 % the aux file uses ' as the escape.
2656 % Turn off \ as an escape so we do not lose on
2657 % entries which were dumped with control sequences in their names.
2658 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
2659 % Reference to such entries still does not work the way one would wish,
2660 % but at least they do not bomb out when the aux file is read in.
2661 \catcode `\{=1 \catcode `\}=2
2662 \catcode `\%=\other
2663 \catcode `\'=0
2664 \catcode `\\=\other
2665 \openin 1 \jobname.aux
2666 \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
2667 \fi
2668 % Open the new aux file. Tex will close it automatically at exit.
2669 \openout \auxfile=\jobname.aux
2670 \endgroup}
2671
2672
2673 % Footnotes.
2674
2675 \newcount \footnoteno
2676
2677 \def\supereject{\par\penalty -20000\footnoteno =0 }
2678
2679 \let\ptexfootnote=\footnote
2680
2681 {\catcode `\@=11
2682 \long\gdef\footnote #1{\global\advance \footnoteno by \@ne
2683 \removelastskip
2684 \edef\thisfootno{$^{\the\footnoteno}$}%
2685 \let\@sf\empty
2686 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
2687 \thisfootno\@sf \footnotezzz{#1}}
2688 % \parsearg\footnotezzz}
2689
2690 \long\gdef\footnotezzz #1{\insert\footins{
2691 \interlinepenalty\interfootnotelinepenalty
2692 \splittopskip\ht\strutbox % top baseline for broken footnotes
2693 \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
2694 \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
2695 \footstrut\parindent=\defaultparindent\hang\textindent{\thisfootno}#1\strut}}
2696
2697 }%end \catcode `\@=11
2698
2699 % End of control word definitions.
2700
2701 \message{and turning on texinfo input format.}
2702
2703 \def\openindices{%
2704 \newindex{cp}%
2705 \newcodeindex{fn}%
2706 \newcodeindex{vr}%
2707 \newcodeindex{tp}%
2708 \newcodeindex{ky}%
2709 \newcodeindex{pg}%
2710 }
2711
2712 % Set some numeric style parameters, for 8.5 x 11 format.
2713
2714 %\hsize = 6.5in
2715 \newdimen\defaultparindent \defaultparindent = 15pt
2716 \parindent = \defaultparindent
2717 \parskip 18pt plus 1pt
2718 \baselineskip 15pt
2719 \advance\topskip by 1.2cm
2720
2721 % Prevent underfull vbox error messages.
2722 \vbadness=10000
2723
2724 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
2725 % using an old version of TeX, don't do anything. We want the amount of
2726 % stretch added to depend on the line length, hence the dependence on
2727 % \hsize. This makes it come to about 9pt for the 8.5x11 format.
2728 %
2729 \ifx\emergencystretch\thisisundefined \else
2730 \emergencystretch = \hsize
2731 \divide\emergencystretch by 45
2732 \fi
2733
2734 % Use @smallbook to reset parameters for 7x9.5 format
2735 \def\smallbook{
2736 \global\lispnarrowing = 0.3in
2737 \global\baselineskip 12pt
2738 \global\parskip 3pt plus 1pt
2739 \global\hsize = 5in
2740 \global\doublecolumnhsize=2.4in \global\doublecolumnvsize=15.0in
2741 \global\vsize=7.5in
2742 \global\tolerance=700
2743 \global\hfuzz=1pt
2744
2745 \global\pagewidth=\hsize
2746 \global\pageheight=\vsize
2747
2748 \global\let\smalllisp=\smalllispx
2749 \global\let\smallexample=\smalllispx
2750 \global\def\Esmallexample{\Esmalllisp}
2751 }
2752
2753 %% For a final copy, take out the rectangles
2754 %% that mark overfull boxes (in case you have decided
2755 %% that the text looks ok even though it passes the margin).
2756 \def\finalout{\hfuzz=\maxdimen}
2757
2758 % Define macros to output various characters with catcode for normal text.
2759 \catcode`\"=\other
2760 \catcode`\~=\other
2761 \catcode`\^=\other
2762 \catcode`\_=\other
2763 \catcode`\|=\other
2764 \catcode`\<=\other
2765 \catcode`\>=\other
2766 \catcode`\+=\other
2767 \def\normaldoublequote{"}
2768 \def\normaltilde{~}
2769 \def\normalcaret{^}
2770 \def\normalunderscore{_}
2771 \def\normalverticalbar{|}
2772 \def\normalless{<}
2773 \def\normalgreater{>}
2774 \def\normalplus{+}
2775
2776 % This macro is used to make a character print one way in ttfont
2777 % where it can probably just be output, and another way in other fonts,
2778 % where something hairier probably needs to be done.
2779 %
2780 % #1 is what to print if we are indeed using \tt; #2 is what to print
2781 % otherwise. Since all the Computer Modern typewriter fonts have zero
2782 % interword stretch (and shrink), and it is reasonable to expect all
2783 % typewriter fonts to have this, we can check that font parameter.
2784 %
2785 \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
2786
2787 % Turn off all special characters except @
2788 % (and those which the user can use as if they were ordinary).
2789 % Most of these we simply print from the \tt font, but for some, we can
2790 % use math or other variants that look better in normal text.
2791
2792 \catcode`\"=\active
2793 \def\activedoublequote{{\tt \char '042}}
2794 \let"=\activedoublequote
2795 \catcode`\~=\active
2796 \def~{{\tt \char '176}}
2797 \chardef\hat=`\^
2798 \catcode`\^=\active
2799 \def^{{\tt \hat}}
2800
2801 \catcode`\_=\active
2802 \def_{\ifusingtt\normalunderscore\_}
2803 % Subroutine for the previous macro.
2804 \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
2805
2806 % \lvvmode is equivalent in function to \leavevmode.
2807 % Using \leavevmode runs into trouble when written out to
2808 % an index file due to the expansion of \leavevmode into ``\unhbox
2809 % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
2810 % magic tricks with @.
2811 \def\lvvmode{\vbox to 0pt{}}
2812
2813 \catcode`\|=\active
2814 \def|{{\tt \char '174}}
2815 \chardef \less=`\<
2816 \catcode`\<=\active
2817 \def<{{\tt \less}}
2818 \chardef \gtr=`\>
2819 \catcode`\>=\active
2820 \def>{{\tt \gtr}}
2821 \catcode`\+=\active
2822 \def+{{\tt \char 43}}
2823 %\catcode 27=\active
2824 %\def^^[{$\diamondsuit$}
2825
2826 % Used sometimes to turn off (effectively) the active characters
2827 % even after parsing them.
2828 \def\turnoffactive{\let"=\normaldoublequote
2829 \let~=\normaltilde
2830 \let^=\normalcaret
2831 \let_=\normalunderscore
2832 \let|=\normalverticalbar
2833 \let<=\normalless
2834 \let>=\normalgreater
2835 \let+=\normalplus}
2836
2837 % Set up an active definition for =, but don't enable it most of the time.
2838 {\catcode`\==\active
2839 \global\def={{\tt \char 61}}}
2840
2841 \catcode`\@=0
2842
2843 % \rawbackslashxx output one backslash character in current font
2844 \global\chardef\rawbackslashxx=`\\
2845 %{\catcode`\\=\other
2846 %@gdef@rawbackslashxx{\}}
2847
2848 % \rawbackslash redefines \ as input to do \rawbackslashxx.
2849 {\catcode`\\=\active
2850 @gdef@rawbackslash{@let\=@rawbackslashxx }}
2851
2852 % \normalbackslash outputs one backslash in fixed width font.
2853 \def\normalbackslash{{\tt\rawbackslashxx}}
2854
2855 % Say @foo, not \foo, in error messages.
2856 \escapechar=`\@
2857
2858 % \catcode 17=0 % Define control-q
2859 \catcode`\\=\active
2860
2861 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
2862 % That is what \eatinput is for; after that, the `\' should revert to printing
2863 % a backslash.
2864 %
2865 @gdef@eatinput input texinfo{@fixbackslash}
2866 @global@let\ = @eatinput
2867
2868 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
2869 % the first `\{ in the file would cause an error. This macro tries to fix
2870 % that, assuming it is called before the first `\' could plausibly occur.
2871 %
2872 @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
2873
2874 %% These look ok in all fonts, so just make them not special. The @rm below
2875 %% makes sure that the current font starts out as the newly loaded cmr10
2876 @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
2877
2878 @textfonts
2879 @rm
2880
2881 @c Local variables:
2882 @c page-delimiter: "^\\\\message"
2883 @c End: