]> git.ipfire.org Git - thirdparty/glibc.git/blob - manual/texinfo.tex
(paragraphindent): Move to more reasonable place in the source file. (chapfonts,...
[thirdparty/glibc.git] / manual / texinfo.tex
1 %% TeX macros to handle texinfo files
2
3 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
4 % 94, 95, 1996 Free Software Foundation, Inc.
5
6 %This texinfo.tex file is free software; you can redistribute it and/or
7 %modify it under the terms of the GNU General Public License as
8 %published by the Free Software Foundation; either version 2, or (at
9 %your option) any later version.
10
11 %This texinfo.tex file is distributed in the hope that it will be
12 %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13 %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 %General Public License for more details.
15
16 %You should have received a copy of the GNU General Public License
17 %along with this texinfo.tex file; see the file COPYING. If not, write
18 %to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 %Boston, MA 02111-1307, USA.
20
21
22 %In other words, you are welcome to use, share and improve this program.
23 %You are forbidden to forbid anyone else to use, share and improve
24 %what you give them. Help stamp out software-hoarding!
25
26
27 % Send bug reports to bug-texinfo@prep.ai.mit.edu.
28 % Please include a *precise* test case in each bug report.
29
30
31 % Make it possible to create a .fmt file just by loading this file:
32 % if the underlying format is not loaded, start by loading it now.
33 % Added by gildea November 1993.
34 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
35
36 % This automatically updates the version number based on RCS.
37 \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
38 \deftexinfoversion$Revision: 1.2 $
39 \message{Loading texinfo package [Version \texinfoversion]:}
40
41 % If in a .fmt file, print the version number
42 % and turn on active characters that we couldn't do earlier because
43 % they might have appeared in the input file name.
44 \everyjob{\message{[Texinfo version \texinfoversion]}\message{}
45 \catcode`+=\active \catcode`\_=\active}
46
47 % Save some parts of plain tex whose names we will redefine.
48
49 \let\ptextilde=\~
50 \let\ptexlbrace=\{
51 \let\ptexrbrace=\}
52 \let\ptexdots=\dots
53 \let\ptexdot=\.
54 \let\ptexstar=\*
55 \let\ptexend=\end
56 \let\ptexbullet=\bullet
57 \let\ptexb=\b
58 \let\ptexc=\c
59 \let\ptexi=\i
60 \let\ptext=\t
61 \let\ptexl=\l
62 \let\ptexL=\L
63
64 % Be sure we're in horizontal mode when doing a tie, since we make space
65 % equivalent to this in @example-like environments. Otherwise, a space
66 % at the beginning of a line will start with \penalty -- and
67 % since \penalty is valid in vertical mode, we'd end up putting the
68 % penalty on the vertical list instead of in the new paragraph.
69 {\catcode`@ = 11
70 % Avoid using \@M directly, because that causes trouble
71 % if the definition is written into an index file.
72 \global\let\tiepenalty = \@M
73 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
74 }
75 \let\~ = \tie % And make it available as @~.
76
77 \message{Basics,}
78 \chardef\other=12
79
80 % If this character appears in an error message or help string, it
81 % starts a new line in the output.
82 \newlinechar = `^^J
83
84 % Set up fixed words for English.
85 \ifx\putwordChapter\undefined{\gdef\putwordChapter{Chapter}}\fi%
86 \def\putwordInfo{Info}%
87 \ifx\putwordSee\undefined{\gdef\putwordSee{See}}\fi%
88 \ifx\putwordsee\undefined{\gdef\putwordsee{see}}\fi%
89 \ifx\putwordfile\undefined{\gdef\putwordfile{file}}\fi%
90 \ifx\putwordpage\undefined{\gdef\putwordpage{page}}\fi%
91 \ifx\putwordsection\undefined{\gdef\putwordsection{section}}\fi%
92 \ifx\putwordSection\undefined{\gdef\putwordSection{Section}}\fi%
93 \ifx\putwordTableofContents\undefined{\gdef\putwordTableofContents{Table of Contents}}\fi%
94 \ifx\putwordShortContents\undefined{\gdef\putwordShortContents{Short Contents}}\fi%
95 \ifx\putwordAppendix\undefined{\gdef\putwordAppendix{Appendix}}\fi%
96
97 % Ignore a token.
98 %
99 \def\gobble#1{}
100
101 \hyphenation{ap-pen-dix}
102 \hyphenation{mini-buf-fer mini-buf-fers}
103 \hyphenation{eshell}
104
105 % Margin to add to right of even pages, to left of odd pages.
106 \newdimen \bindingoffset \bindingoffset=0pt
107 \newdimen \normaloffset \normaloffset=\hoffset
108 \newdimen\pagewidth \newdimen\pageheight
109 \pagewidth=\hsize \pageheight=\vsize
110
111 % Sometimes it is convenient to have everything in the transcript file
112 % and nothing on the terminal. We don't just call \tracingall here,
113 % since that produces some useless output on the terminal.
114 %
115 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
116 \def\loggingall{\tracingcommands2 \tracingstats2
117 \tracingpages1 \tracingoutput1 \tracinglostchars1
118 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
119 \showboxbreadth\maxdimen\showboxdepth\maxdimen
120 }%
121
122 %---------------------Begin change-----------------------
123 %
124 %%%% For @cropmarks command.
125 % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
126 %
127 \newdimen\cornerlong \newdimen\cornerthick
128 \newdimen \topandbottommargin
129 \newdimen \outerhsize \newdimen \outervsize
130 \cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks
131 \outerhsize=7in
132 %\outervsize=9.5in
133 % Alternative @smallbook page size is 9.25in
134 \outervsize=9.25in
135 \topandbottommargin=.75in
136 %
137 %---------------------End change-----------------------
138
139 % \onepageout takes a vbox as an argument. Note that \pagecontents
140 % does insertions itself, but you have to call it yourself.
141 \chardef\PAGE=255 \output={\onepageout{\pagecontents\PAGE}}
142 \def\onepageout#1{\hoffset=\normaloffset
143 \ifodd\pageno \advance\hoffset by \bindingoffset
144 \else \advance\hoffset by -\bindingoffset\fi
145 {\escapechar=`\\\relax % makes sure backslash is used in output files.
146 \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
147 {\let\hsize=\pagewidth \makefootline}}}%
148 \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
149
150 %%%% For @cropmarks command %%%%
151
152 % Here is a modification of the main output routine for Near East Publications
153 % This provides right-angle cropmarks at all four corners.
154 % The contents of the page are centerlined into the cropmarks,
155 % and any desired binding offset is added as an \hskip on either
156 % site of the centerlined box. (P. A. MacKay, 12 November, 1986)
157 %
158 \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
159 {\escapechar=`\\\relax % makes sure backslash is used in output files.
160 \shipout
161 \vbox to \outervsize{\hsize=\outerhsize
162 \vbox{\line{\ewtop\hfill\ewtop}}
163 \nointerlineskip
164 \line{\vbox{\moveleft\cornerthick\nstop}
165 \hfill
166 \vbox{\moveright\cornerthick\nstop}}
167 \vskip \topandbottommargin
168 \centerline{\ifodd\pageno\hskip\bindingoffset\fi
169 \vbox{
170 {\let\hsize=\pagewidth \makeheadline}
171 \pagebody{#1}
172 {\let\hsize=\pagewidth \makefootline}}
173 \ifodd\pageno\else\hskip\bindingoffset\fi}
174 \vskip \topandbottommargin plus1fill minus1fill
175 \boxmaxdepth\cornerthick
176 \line{\vbox{\moveleft\cornerthick\nsbot}
177 \hfill
178 \vbox{\moveright\cornerthick\nsbot}}
179 \nointerlineskip
180 \vbox{\line{\ewbot\hfill\ewbot}}
181 }}
182 \advancepageno
183 \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
184 %
185 % Do @cropmarks to get crop marks
186 \def\cropmarks{\let\onepageout=\croppageout }
187
188 \newinsert\margin \dimen\margin=\maxdimen
189
190 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
191 {\catcode`\@ =11
192 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
193 % marginal hacks, juha@viisa.uucp (Juha Takala)
194 \ifvoid\margin\else % marginal info is present
195 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
196 \dimen@=\dp#1 \unvbox#1
197 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
198 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
199 }
200
201 %
202 % Here are the rules for the cropmarks. Note that they are
203 % offset so that the space between them is truly \outerhsize or \outervsize
204 % (P. A. MacKay, 12 November, 1986)
205 %
206 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
207 \def\nstop{\vbox
208 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
209 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
210 \def\nsbot{\vbox
211 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
212
213 % Parse an argument, then pass it to #1. The argument is the rest of
214 % the input line (except we remove a trailing comment). #1 should be a
215 % macro which expects an ordinary undelimited TeX argument.
216 %
217 \def\parsearg#1{%
218 \let\next = #1%
219 \begingroup
220 \obeylines
221 \futurelet\temp\parseargx
222 }
223
224 % If the next token is an obeyed space (from an @example environment or
225 % the like), remove it and recurse. Otherwise, we're done.
226 \def\parseargx{%
227 % \obeyedspace is defined far below, after the definition of \sepspaces.
228 \ifx\obeyedspace\temp
229 \expandafter\parseargdiscardspace
230 \else
231 \expandafter\parseargline
232 \fi
233 }
234
235 % Remove a single space (as the delimiter token to the macro call).
236 {\obeyspaces %
237 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
238
239 {\obeylines %
240 \gdef\parseargline#1^^M{%
241 \endgroup % End of the group started in \parsearg.
242 %
243 % First remove any @c comment, then any @comment.
244 % Result of each macro is put in \toks0.
245 \argremovec #1\c\relax %
246 \expandafter\argremovecomment \the\toks0 \comment\relax %
247 %
248 % Call the caller's macro, saved as \next in \parsearg.
249 \expandafter\next\expandafter{\the\toks0}%
250 }%
251 }
252
253 % Since all \c{,omment} does is throw away the argument, we can let TeX
254 % do that for us. The \relax here is matched by the \relax in the call
255 % in \parseargline; it could be more or less anything, its purpose is
256 % just to delimit the argument to the \c.
257 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
258 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
259
260 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
261 % @end itemize @c foo
262 % will have two active spaces as part of the argument with the
263 % `itemize'. Here we remove all active spaces from #1, and assign the
264 % result to \toks0.
265 %
266 % This loses if there are any *other* active characters besides spaces
267 % in the argument -- _ ^ +, for example -- since they get expanded.
268 % Fortunately, Texinfo does not define any such commands. (If it ever
269 % does, the catcode of the characters in questionwill have to be changed
270 % here.) But this means we cannot call \removeactivespaces as part of
271 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
272 % that \parsearg gets might well have any character at all in it.
273 %
274 \def\removeactivespaces#1{%
275 \begingroup
276 \ignoreactivespaces
277 \edef\temp{#1}%
278 \global\toks0 = \expandafter{\temp}%
279 \endgroup
280 }
281
282 % Change the active space to expand to nothing.
283 %
284 \begingroup
285 \obeyspaces
286 \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
287 \endgroup
288
289
290 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
291
292 %% These are used to keep @begin/@end levels from running away
293 %% Call \inENV within environments (after a \begingroup)
294 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
295 \def\ENVcheck{%
296 \ifENV\errmessage{Still within an environment. Type Return to continue.}
297 \endgroup\fi} % This is not perfect, but it should reduce lossage
298
299 % @begin foo is the same as @foo, for now.
300 \newhelp\EMsimple{Type <Return> to continue.}
301
302 \outer\def\begin{\parsearg\beginxxx}
303
304 \def\beginxxx #1{%
305 \expandafter\ifx\csname #1\endcsname\relax
306 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
307 \csname #1\endcsname\fi}
308
309 % @end foo executes the definition of \Efoo.
310 %
311 \def\end{\parsearg\endxxx}
312 \def\endxxx #1{%
313 \removeactivespaces{#1}%
314 \edef\endthing{\the\toks0}%
315 %
316 \expandafter\ifx\csname E\endthing\endcsname\relax
317 \expandafter\ifx\csname \endthing\endcsname\relax
318 % There's no \foo, i.e., no ``environment'' foo.
319 \errhelp = \EMsimple
320 \errmessage{Undefined command `@end \endthing'}%
321 \else
322 \unmatchedenderror\endthing
323 \fi
324 \else
325 % Everything's ok; the right environment has been started.
326 \csname E\endthing\endcsname
327 \fi
328 }
329
330 % There is an environment #1, but it hasn't been started. Give an error.
331 %
332 \def\unmatchedenderror#1{%
333 \errhelp = \EMsimple
334 \errmessage{This `@end #1' doesn't have a matching `@#1'}%
335 }
336
337 % Define the control sequence \E#1 to give an unmatched @end error.
338 %
339 \def\defineunmatchedend#1{%
340 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
341 }
342
343
344 % Single-spacing is done by various environments (specifically, in
345 % \nonfillstart and \quotations).
346 \newskip\singlespaceskip \singlespaceskip = 12.5pt
347 \def\singlespace{%
348 % Why was this kern here? It messes up equalizing space above and below
349 % environments. --karl, 6may93
350 %{\advance \baselineskip by -\singlespaceskip
351 %\kern \baselineskip}%
352 \setleading \singlespaceskip
353 }
354
355 %% Simple single-character @ commands
356
357 % @@ prints an @
358 % Kludge this until the fonts are right (grr).
359 \def\@{{\tt \char '100}}
360
361 % This is turned off because it was never documented
362 % and you can use @w{...} around a quote to suppress ligatures.
363 %% Define @` and @' to be the same as ` and '
364 %% but suppressing ligatures.
365 %\def\`{{`}}
366 %\def\'{{'}}
367
368 % Used to generate quoted braces.
369
370 \def\mylbrace {{\tt \char '173}}
371 \def\myrbrace {{\tt \char '175}}
372 \let\{=\mylbrace
373 \let\}=\myrbrace
374
375 % @: forces normal size whitespace following.
376 \def\:{\spacefactor=1000 }
377
378 % @* forces a line break.
379 \def\*{\hfil\break\hbox{}\ignorespaces}
380
381 % @. is an end-of-sentence period.
382 \def\.{.\spacefactor=3000 }
383
384 % @enddots{} is an end-of-sentence ellipsis.
385 \gdef\enddots{$\mathinner{\ldotp\ldotp\ldotp\ldotp}$\spacefactor=3000}
386
387 % @! is an end-of-sentence bang.
388 \gdef\!{!\spacefactor=3000 }
389
390 % @? is an end-of-sentence query.
391 \gdef\?{?\spacefactor=3000 }
392
393 % @w prevents a word break. Without the \leavevmode, @w at the
394 % beginning of a paragraph, when TeX is still in vertical mode, would
395 % produce a whole line of output instead of starting the paragraph.
396 \def\w#1{\leavevmode\hbox{#1}}
397
398 % @group ... @end group forces ... to be all on one page, by enclosing
399 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
400 % to keep its height that of a normal line. According to the rules for
401 % \topskip (p.114 of the TeXbook), the glue inserted is
402 % max (\topskip - \ht (first item), 0). If that height is large,
403 % therefore, no glue is inserted, and the space between the headline and
404 % the text is small, which looks bad.
405 %
406 \def\group{\begingroup
407 \ifnum\catcode13=\active \else
408 \errhelp = \groupinvalidhelp
409 \errmessage{@group invalid in context where filling is enabled}%
410 \fi
411 %
412 % The \vtop we start below produces a box with normal height and large
413 % depth; thus, TeX puts \baselineskip glue before it, and (when the
414 % next line of text is done) \lineskip glue after it. (See p.82 of
415 % the TeXbook.) Thus, space below is not quite equal to space
416 % above. But it's pretty close.
417 \def\Egroup{%
418 \egroup % End the \vtop.
419 \endgroup % End the \group.
420 }%
421 %
422 \vtop\bgroup
423 % We have to put a strut on the last line in case the @group is in
424 % the midst of an example, rather than completely enclosing it.
425 % Otherwise, the interline space between the last line of the group
426 % and the first line afterwards is too small. But we can't put the
427 % strut in \Egroup, since there it would be on a line by itself.
428 % Hence this just inserts a strut at the beginning of each line.
429 \everypar = {\strut}%
430 %
431 % Since we have a strut on every line, we don't need any of TeX's
432 % normal interline spacing.
433 \offinterlineskip
434 %
435 % OK, but now we have to do something about blank
436 % lines in the input in @example-like environments, which normally
437 % just turn into \lisppar, which will insert no space now that we've
438 % turned off the interline space. Simplest is to make them be an
439 % empty paragraph.
440 \ifx\par\lisppar
441 \edef\par{\leavevmode \par}%
442 %
443 % Reset ^^M's definition to new definition of \par.
444 \obeylines
445 \fi
446 %
447 % Do @comment since we are called inside an environment such as
448 % @example, where each end-of-line in the input causes an
449 % end-of-line in the output. We don't want the end-of-line after
450 % the `@group' to put extra space in the output. Since @group
451 % should appear on a line by itself (according to the Texinfo
452 % manual), we don't worry about eating any user text.
453 \comment
454 }
455 %
456 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
457 % message, so this ends up printing `@group can only ...'.
458 %
459 \newhelp\groupinvalidhelp{%
460 group can only be used in environments such as @example,^^J%
461 where each line of input produces a line of output.}
462
463 % @need space-in-mils
464 % forces a page break if there is not space-in-mils remaining.
465
466 \newdimen\mil \mil=0.001in
467
468 \def\need{\parsearg\needx}
469
470 % Old definition--didn't work.
471 %\def\needx #1{\par %
472 %% This method tries to make TeX break the page naturally
473 %% if the depth of the box does not fit.
474 %{\baselineskip=0pt%
475 %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
476 %\prevdepth=-1000pt
477 %}}
478
479 \def\needx#1{%
480 % Go into vertical mode, so we don't make a big box in the middle of a
481 % paragraph.
482 \par
483 %
484 % Don't add any leading before our big empty box, but allow a page
485 % break, since the best break might be right here.
486 \allowbreak
487 \nointerlineskip
488 \vtop to #1\mil{\vfil}%
489 %
490 % TeX does not even consider page breaks if a penalty added to the
491 % main vertical list is 10000 or more. But in order to see if the
492 % empty box we just added fits on the page, we must make it consider
493 % page breaks. On the other hand, we don't want to actually break the
494 % page after the empty box. So we use a penalty of 9999.
495 %
496 % There is an extremely small chance that TeX will actually break the
497 % page at this \penalty, if there are no other feasible breakpoints in
498 % sight. (If the user is using lots of big @group commands, which
499 % almost-but-not-quite fill up a page, TeX will have a hard time doing
500 % good page breaking, for example.) However, I could not construct an
501 % example where a page broke at this \penalty; if it happens in a real
502 % document, then we can reconsider our strategy.
503 \penalty9999
504 %
505 % Back up by the size of the box, whether we did a page break or not.
506 \kern -#1\mil
507 %
508 % Do not allow a page break right after this kern.
509 \nobreak
510 }
511
512 % @br forces paragraph break
513
514 \let\br = \par
515
516 % @dots{} output some dots
517
518 \def\dots{$\ldots$}
519
520 % @page forces the start of a new page
521
522 \def\page{\par\vfill\supereject}
523
524 % @exdent text....
525 % outputs text on separate line in roman font, starting at standard page margin
526
527 % This records the amount of indent in the innermost environment.
528 % That's how much \exdent should take out.
529 \newskip\exdentamount
530
531 % This defn is used inside fill environments such as @defun.
532 \def\exdent{\parsearg\exdentyyy}
533 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
534
535 % This defn is used inside nofill environments such as @example.
536 \def\nofillexdent{\parsearg\nofillexdentyyy}
537 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
538 \leftline{\hskip\leftskip{\rm#1}}}}
539
540 % @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
541
542 \def\inmargin#1{%
543 \strut\vadjust{\nobreak\kern-\strutdepth
544 \vtop to \strutdepth{\baselineskip\strutdepth\vss
545 \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
546 \newskip\inmarginspacing \inmarginspacing=1cm
547 \def\strutdepth{\dp\strutbox}
548
549 %\hbox{{\rm#1}}\hfil\break}}
550
551 % @include file insert text of that file as input.
552 % Allow normal characters that we make active in the argument (a file name).
553 \def\include{\begingroup
554 \catcode`\\=12
555 \catcode`~=12
556 \catcode`^=12
557 \catcode`_=12
558 \catcode`|=12
559 \catcode`<=12
560 \catcode`>=12
561 \catcode`+=12
562 \parsearg\includezzz}
563 % Restore active chars for included file.
564 \def\includezzz#1{\endgroup\begingroup
565 % Read the included file in a group so nested @include's work.
566 \def\thisfile{#1}%
567 \input\thisfile
568 \endgroup}
569
570 \def\thisfile{}
571
572 % @center line outputs that line, centered
573
574 \def\center{\parsearg\centerzzz}
575 \def\centerzzz #1{{\advance\hsize by -\leftskip
576 \advance\hsize by -\rightskip
577 \centerline{#1}}}
578
579 % @sp n outputs n lines of vertical space
580
581 \def\sp{\parsearg\spxxx}
582 \def\spxxx #1{\par \vskip #1\baselineskip}
583
584 % @comment ...line which is ignored...
585 % @c is the same as @comment
586 % @ignore ... @end ignore is another way to write a comment
587
588 \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
589 \parsearg \commentxxx}
590
591 \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
592
593 \let\c=\comment
594
595 % @paragraphindent is defined for the Info formatting commands only.
596 \let\paragraphindent=\comment
597
598 % Prevent errors for section commands.
599 % Used in @ignore and in failing conditionals.
600 \def\ignoresections{%
601 \let\chapter=\relax
602 \let\unnumbered=\relax
603 \let\top=\relax
604 \let\unnumberedsec=\relax
605 \let\unnumberedsection=\relax
606 \let\unnumberedsubsec=\relax
607 \let\unnumberedsubsection=\relax
608 \let\unnumberedsubsubsec=\relax
609 \let\unnumberedsubsubsection=\relax
610 \let\section=\relax
611 \let\subsec=\relax
612 \let\subsubsec=\relax
613 \let\subsection=\relax
614 \let\subsubsection=\relax
615 \let\appendix=\relax
616 \let\appendixsec=\relax
617 \let\appendixsection=\relax
618 \let\appendixsubsec=\relax
619 \let\appendixsubsection=\relax
620 \let\appendixsubsubsec=\relax
621 \let\appendixsubsubsection=\relax
622 \let\contents=\relax
623 \let\smallbook=\relax
624 \let\titlepage=\relax
625 }
626
627 % Used in nested conditionals, where we have to parse the Texinfo source
628 % and so want to turn off most commands, in case they are used
629 % incorrectly.
630 %
631 \def\ignoremorecommands{%
632 \let\defcodeindex = \relax
633 \let\defcv = \relax
634 \let\deffn = \relax
635 \let\deffnx = \relax
636 \let\defindex = \relax
637 \let\defivar = \relax
638 \let\defmac = \relax
639 \let\defmethod = \relax
640 \let\defop = \relax
641 \let\defopt = \relax
642 \let\defspec = \relax
643 \let\deftp = \relax
644 \let\deftypefn = \relax
645 \let\deftypefun = \relax
646 \let\deftypevar = \relax
647 \let\deftypevr = \relax
648 \let\defun = \relax
649 \let\defvar = \relax
650 \let\defvr = \relax
651 \let\ref = \relax
652 \let\xref = \relax
653 \let\printindex = \relax
654 \let\pxref = \relax
655 \let\settitle = \relax
656 \let\setchapternewpage = \relax
657 \let\setchapterstyle = \relax
658 \let\everyheading = \relax
659 \let\evenheading = \relax
660 \let\oddheading = \relax
661 \let\everyfooting = \relax
662 \let\evenfooting = \relax
663 \let\oddfooting = \relax
664 \let\headings = \relax
665 \let\include = \relax
666 \let\lowersections = \relax
667 \let\down = \relax
668 \let\raisesections = \relax
669 \let\up = \relax
670 \let\set = \relax
671 \let\clear = \relax
672 \let\item = \relax
673 }
674
675 % Ignore @ignore ... @end ignore.
676 %
677 \def\ignore{\doignore{ignore}}
678
679 % Also ignore @ifinfo, @ifhtml, @html, @menu, and @direntry text.
680 %
681 \def\ifinfo{\doignore{ifinfo}}
682 \def\ifhtml{\doignore{ifhtml}}
683 \def\html{\doignore{html}}
684 \def\menu{\doignore{menu}}
685 \def\direntry{\doignore{direntry}}
686
687 % @dircategory CATEGORY -- specify a category of the dir file
688 % which this file should belong to. Ignore this in TeX.
689
690 \def\dircategory{\comment}
691
692 % Ignore text until a line `@end #1'.
693 %
694 \def\doignore#1{\begingroup
695 % Don't complain about control sequences we have declared \outer.
696 \ignoresections
697 %
698 % Define a command to swallow text until we reach `@end #1'.
699 \long\def\doignoretext##1\end #1{\enddoignore}%
700 %
701 % Make sure that spaces turn into tokens that match what \doignoretext wants.
702 \catcode32 = 10
703 %
704 % And now expand that command.
705 \doignoretext
706 }
707
708 % What we do to finish off ignored text.
709 %
710 \def\enddoignore{\endgroup\ignorespaces}%
711
712 \newif\ifwarnedobs\warnedobsfalse
713 \def\obstexwarn{%
714 \ifwarnedobs\relax\else
715 % We need to warn folks that they may have trouble with TeX 3.0.
716 % This uses \immediate\write16 rather than \message to get newlines.
717 \immediate\write16{}
718 \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
719 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
720 \immediate\write16{If you are running another version of TeX, relax.}
721 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
722 \immediate\write16{ Then upgrade your TeX installation if you can.}
723 \immediate\write16{If you are stuck with version 3.0, run the}
724 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
725 \immediate\write16{ to use a workaround.}
726 \immediate\write16{}
727 \global\warnedobstrue
728 \fi
729 }
730
731 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
732 % workaround (which requires the file ``dummy.tfm'' to be installed),
733 % uncomment the following line:
734 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
735
736 % Ignore text, except that we keep track of conditional commands for
737 % purposes of nesting, up to an `@end #1' command.
738 %
739 \def\nestedignore#1{%
740 \obstexwarn
741 % We must actually expand the ignored text to look for the @end
742 % command, so that nested ignore constructs work. Thus, we put the
743 % text into a \vbox and then do nothing with the result. To minimize
744 % the change of memory overflow, we follow the approach outlined on
745 % page 401 of the TeXbook: make the current font be a dummy font.
746 %
747 \setbox0 = \vbox\bgroup
748 % Don't complain about control sequences we have declared \outer.
749 \ignoresections
750 %
751 % Define `@end #1' to end the box, which will in turn undefine the
752 % @end command again.
753 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
754 %
755 % We are going to be parsing Texinfo commands. Most cause no
756 % trouble when they are used incorrectly, but some commands do
757 % complicated argument parsing or otherwise get confused, so we
758 % undefine them.
759 %
760 % We can't do anything about stray @-signs, unfortunately;
761 % they'll produce `undefined control sequence' errors.
762 \ignoremorecommands
763 %
764 % Set the current font to be \nullfont, a TeX primitive, and define
765 % all the font commands to also use \nullfont. We don't use
766 % dummy.tfm, as suggested in the TeXbook, because not all sites
767 % might have that installed. Therefore, math mode will still
768 % produce output, but that should be an extremely small amount of
769 % stuff compared to the main input.
770 %
771 \nullfont
772 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
773 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
774 \let\tensf = \nullfont
775 % Similarly for index fonts (mostly for their use in
776 % smallexample)
777 \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
778 \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
779 \let\indsf = \nullfont
780 %
781 % Don't complain when characters are missing from the fonts.
782 \tracinglostchars = 0
783 %
784 % Don't bother to do space factor calculations.
785 \frenchspacing
786 %
787 % Don't report underfull hboxes.
788 \hbadness = 10000
789 %
790 % Do minimal line-breaking.
791 \pretolerance = 10000
792 %
793 % Do not execute instructions in @tex
794 \def\tex{\doignore{tex}}
795 }
796
797 % @set VAR sets the variable VAR to an empty value.
798 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
799 %
800 % Since we want to separate VAR from REST-OF-LINE (which might be
801 % empty), we can't just use \parsearg; we have to insert a space of our
802 % own to delimit the rest of the line, and then take it out again if we
803 % didn't need it. Make sure the catcode of space is correct to avoid
804 % losing inside @example, for instance.
805 %
806 \def\set{\begingroup\catcode` =10 \parsearg\setxxx}
807 \def\setxxx#1{\setyyy#1 \endsetyyy}
808 \def\setyyy#1 #2\endsetyyy{%
809 \def\temp{#2}%
810 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
811 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
812 \fi
813 \endgroup
814 }
815 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
816 % \next or other control sequences that we've defined might get us into
817 % an infinite loop. Consider `@set foo @cite{bar}'.
818 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
819
820 % @clear VAR clears (i.e., unsets) the variable VAR.
821 %
822 \def\clear{\parsearg\clearxxx}
823 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
824
825 % @value{foo} gets the text saved in variable foo.
826 %
827 \def\value#1{\expandafter
828 \ifx\csname SET#1\endcsname\relax
829 {\{No value for ``#1''\}}
830 \else \csname SET#1\endcsname \fi}
831
832 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
833 % with @set.
834 %
835 \def\ifset{\parsearg\ifsetxxx}
836 \def\ifsetxxx #1{%
837 \expandafter\ifx\csname SET#1\endcsname\relax
838 \expandafter\ifsetfail
839 \else
840 \expandafter\ifsetsucceed
841 \fi
842 }
843 \def\ifsetsucceed{\conditionalsucceed{ifset}}
844 \def\ifsetfail{\nestedignore{ifset}}
845 \defineunmatchedend{ifset}
846
847 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
848 % defined with @set, or has been undefined with @clear.
849 %
850 \def\ifclear{\parsearg\ifclearxxx}
851 \def\ifclearxxx #1{%
852 \expandafter\ifx\csname SET#1\endcsname\relax
853 \expandafter\ifclearsucceed
854 \else
855 \expandafter\ifclearfail
856 \fi
857 }
858 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
859 \def\ifclearfail{\nestedignore{ifclear}}
860 \defineunmatchedend{ifclear}
861
862 % @iftex always succeeds; we read the text following, through @end
863 % iftex). But `@end iftex' should be valid only after an @iftex.
864 %
865 \def\iftex{\conditionalsucceed{iftex}}
866 \defineunmatchedend{iftex}
867
868 % We can't just want to start a group at @iftex (for example) and end it
869 % at @end iftex, since then @set commands inside the conditional have no
870 % effect (they'd get reverted at the end of the group). So we must
871 % define \Eiftex to redefine itself to be its previous value. (We can't
872 % just define it to fail again with an ``unmatched end'' error, since
873 % the @ifset might be nested.)
874 %
875 \def\conditionalsucceed#1{%
876 \edef\temp{%
877 % Remember the current value of \E#1.
878 \let\nece{prevE#1} = \nece{E#1}%
879 %
880 % At the `@end #1', redefine \E#1 to be its previous value.
881 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
882 }%
883 \temp
884 }
885
886 % We need to expand lots of \csname's, but we don't want to expand the
887 % control sequences after we've constructed them.
888 %
889 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
890
891 % @asis just yields its argument. Used with @table, for example.
892 %
893 \def\asis#1{#1}
894
895 % @math means output in math mode.
896 % We don't use $'s directly in the definition of \math because control
897 % sequences like \math are expanded when the toc file is written. Then,
898 % we read the toc file back, the $'s will be normal characters (as they
899 % should be, according to the definition of Texinfo). So we must use a
900 % control sequence to switch into and out of math mode.
901 %
902 % This isn't quite enough for @math to work properly in indices, but it
903 % seems unlikely it will ever be needed there.
904 %
905 \let\implicitmath = $
906 \def\math#1{\implicitmath #1\implicitmath}
907
908 % @bullet and @minus need the same treatment as @math, just above.
909 \def\bullet{\implicitmath\ptexbullet\implicitmath}
910 \def\minus{\implicitmath-\implicitmath}
911
912 \def\node{\ENVcheck\parsearg\nodezzz}
913 \def\nodezzz#1{\nodexxx [#1,]}
914 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
915 \let\nwnode=\node
916 \let\lastnode=\relax
917
918 \def\donoderef{\ifx\lastnode\relax\else
919 \expandafter\expandafter\expandafter\setref{\lastnode}\fi
920 \global\let\lastnode=\relax}
921
922 \def\unnumbnoderef{\ifx\lastnode\relax\else
923 \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
924 \global\let\lastnode=\relax}
925
926 \def\appendixnoderef{\ifx\lastnode\relax\else
927 \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
928 \global\let\lastnode=\relax}
929
930 \let\refill=\relax
931
932 % @setfilename is done at the beginning of every texinfo file.
933 % So open here the files we need to have open while reading the input.
934 % This makes it possible to make a .fmt file for texinfo.
935 \def\setfilename{%
936 \readauxfile
937 \opencontents
938 \openindices
939 \fixbackslash % Turn off hack to swallow `\input texinfo'.
940 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
941 \comment % Ignore the actual filename.
942 }
943
944 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
945
946 \def\inforef #1{\inforefzzz #1,,,,**}
947 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
948 node \samp{\ignorespaces#1{}}}
949
950 \def\macro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\macroxxx}
951 \def\macroxxx#1#2 \end macro{%
952 \expandafter\gdef\macrotemp#1{#2}%
953 \endgroup}
954
955 %\def\linemacro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\linemacroxxx}
956 %\def\linemacroxxx#1#2 \end linemacro{%
957 %\let\parsearg=\relax
958 %\edef\macrotempx{\csname M\butfirst\expandafter\string\macrotemp\endcsname}%
959 %\expandafter\xdef\macrotemp{\parsearg\macrotempx}%
960 %\expandafter\gdef\macrotempx#1{#2}%
961 %\endgroup}
962
963 %\def\butfirst#1{}
964
965 \message{fonts,}
966
967 % Font-change commands.
968
969 % Texinfo supports the sans serif font style, which plain TeX does not.
970 % So we set up a \sf analogous to plain's \rm, etc.
971 \newfam\sffam
972 \def\sf{\fam=\sffam \tensf}
973 \let\li = \sf % Sometimes we call it \li, not \sf.
974
975 % We don't need math for this one.
976 \def\ttsl{\tenttsl}
977
978 %% Try out Computer Modern fonts at \magstephalf
979 \let\mainmagstep=\magstephalf
980
981 % Set the font macro #1 to the font named #2, adding on the
982 % specified font prefix (normally `cm').
983 % #3 is the font's design size, #4 is a scale factor
984 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
985
986 % Use cm as the default font prefix.
987 % To specify the font prefix, you must define \fontprefix
988 % before you read in texinfo.tex.
989 \ifx\fontprefix\undefined
990 \def\fontprefix{cm}
991 \fi
992 % Support font families that don't use the same naming scheme as CM.
993 \def\rmshape{r}
994 \def\rmbshape{bx} %where the normal face is bold
995 \def\bfshape{b}
996 \def\bxshape{bx}
997 \def\ttshape{tt}
998 \def\ttbshape{tt}
999 \def\ttslshape{sltt}
1000 \def\itshape{ti}
1001 \def\itbshape{bxti}
1002 \def\slshape{sl}
1003 \def\slbshape{bxsl}
1004 \def\sfshape{ss}
1005 \def\sfbshape{ss}
1006 \def\scshape{csc}
1007 \def\scbshape{csc}
1008
1009 \ifx\bigger\relax
1010 \let\mainmagstep=\magstep1
1011 \setfont\textrm\rmshape{12}{1000}
1012 \setfont\texttt\ttshape{12}{1000}
1013 \else
1014 \setfont\textrm\rmshape{10}{\mainmagstep}
1015 \setfont\texttt\ttshape{10}{\mainmagstep}
1016 \fi
1017 % Instead of cmb10, you many want to use cmbx10.
1018 % cmbx10 is a prettier font on its own, but cmb10
1019 % looks better when embedded in a line with cmr10.
1020 \setfont\textbf\bfshape{10}{\mainmagstep}
1021 \setfont\textit\itshape{10}{\mainmagstep}
1022 \setfont\textsl\slshape{10}{\mainmagstep}
1023 \setfont\textsf\sfshape{10}{\mainmagstep}
1024 \setfont\textsc\scshape{10}{\mainmagstep}
1025 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1026 \font\texti=cmmi10 scaled \mainmagstep
1027 \font\textsy=cmsy10 scaled \mainmagstep
1028
1029 % A few fonts for @defun, etc.
1030 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1031 \setfont\deftt\ttshape{10}{\magstep1}
1032 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1033
1034 % Fonts for indices and small examples (9pt).
1035 % We actually use the slanted font rather than the italic,
1036 % because texinfo normally uses the slanted fonts for that.
1037 % Do not make many font distinctions in general in the index, since they
1038 % aren't very useful.
1039 \setfont\ninett\ttshape{9}{1000}
1040 \setfont\indrm\rmshape{9}{1000}
1041 \setfont\indit\slshape{9}{1000}
1042 \let\indsl=\indit
1043 \let\indtt=\ninett
1044 \let\indttsl=\ninett
1045 \let\indsf=\indrm
1046 \let\indbf=\indrm
1047 \setfont\indsc\scshape{10}{900}
1048 \font\indi=cmmi9
1049 \font\indsy=cmsy9
1050
1051 % Chapter (and unnumbered) fonts (17.28pt).
1052 \setfont\chaprm\rmbshape{12}{\magstep2}
1053 \setfont\chapit\itbshape{10}{\magstep3}
1054 \setfont\chapsl\slbshape{10}{\magstep3}
1055 \setfont\chaptt\ttbshape{12}{\magstep2}
1056 \setfont\chapttsl\ttslshape{10}{\magstep3}
1057 \setfont\chapsf\sfbshape{12}{\magstep2}
1058 \let\chapbf=\chaprm
1059 \setfont\chapsc\scbshape{10}{\magstep3}
1060 \font\chapi=cmmi12 scaled \magstep2
1061 \font\chapsy=cmsy10 scaled \magstep3
1062
1063 % Section fonts (14.4pt).
1064 \setfont\secrm\rmbshape{12}{\magstep1}
1065 \setfont\secit\itbshape{10}{\magstep2}
1066 \setfont\secsl\slbshape{10}{\magstep2}
1067 \setfont\sectt\ttbshape{12}{\magstep1}
1068 \setfont\secttsl\ttslshape{10}{\magstep2}
1069 \setfont\secsf\sfbshape{12}{\magstep1}
1070 \let\secbf\secrm
1071 \setfont\secsc\scbshape{10}{\magstep2}
1072 \font\seci=cmmi12 scaled \magstep1
1073 \font\secsy=cmsy10 scaled \magstep2
1074
1075 % \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
1076 % \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
1077 % \setfont\ssecsl\slshape{10}{\magstep1}
1078 % \setfont\ssectt\ttshape{10}{\magstep1}
1079 % \setfont\ssecsf\sfshape{10}{\magstep1}
1080
1081 %\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
1082 %\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
1083 %\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
1084 %\setfont\ssectt\ttshape{10}{1315}
1085 %\setfont\ssecsf\sfshape{10}{1315}
1086
1087 %\let\ssecbf=\ssecrm
1088
1089 % Subsection fonts (13.15pt).
1090 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1091 \setfont\ssecit\itbshape{10}{1315}
1092 \setfont\ssecsl\slbshape{10}{1315}
1093 \setfont\ssectt\ttbshape{12}{\magstephalf}
1094 \setfont\ssecttsl\ttslshape{10}{\magstep1}
1095 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1096 \let\ssecbf\ssecrm
1097 \setfont\ssecsc\scbshape{10}{\magstep1}
1098 \font\sseci=cmmi12 scaled \magstephalf
1099 \font\ssecsy=cmsy10 scaled \magstep1
1100 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1101 % but that is not a standard magnification.
1102
1103 % Fonts for title page:
1104 \setfont\titlerm\rmbshape{12}{\magstep3}
1105 \let\authorrm = \secrm
1106
1107 % In order for the font changes to affect most math symbols and letters,
1108 % we have to define the \textfont of the standard families. Since
1109 % texinfo doesn't allow for producing subscripts and superscripts, we
1110 % don't bother to reset \scriptfont and \scriptscriptfont (which would
1111 % also require loading a lot more fonts).
1112 %
1113 \def\resetmathfonts{%
1114 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1115 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1116 \textfont\ttfam = \tentt \textfont\sffam = \tensf
1117 }
1118
1119
1120 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1121 % of just \STYLE. We do this so that font changes will continue to work
1122 % in math mode, where it is the current \fam that is relevant in most
1123 % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
1124 % \tenbf}, for example. By redefining \tenbf, we obviate the need to
1125 % redefine \bf itself.
1126 \def\textfonts{%
1127 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1128 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1129 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1130 \resetmathfonts}
1131 \def\chapfonts{%
1132 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1133 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1134 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1135 \resetmathfonts \setleading{19pt}}
1136 \def\secfonts{%
1137 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1138 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1139 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1140 \resetmathfonts \setleading{16pt}}
1141 \def\subsecfonts{%
1142 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1143 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1144 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1145 \resetmathfonts \setleading{15pt}}
1146 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1147 \def\indexfonts{%
1148 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
1149 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
1150 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
1151 \resetmathfonts \setleading{10pt}}
1152
1153 % Set up the default fonts, so we can use them for creating boxes.
1154 %
1155 \textfonts
1156
1157 % Count depth in font-changes, for error checks
1158 \newcount\fontdepth \fontdepth=0
1159
1160 % Fonts for short table of contents.
1161 \setfont\shortcontrm\rmshape{12}{1000}
1162 \setfont\shortcontbf\bxshape{12}{1000}
1163 \setfont\shortcontsl\slshape{12}{1000}
1164
1165 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1166 %% serif) and @ii for TeX italic
1167
1168 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1169 % unless the following character is such as not to need one.
1170 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1171 \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
1172
1173 \let\i=\smartitalic
1174 \let\var=\smartitalic
1175 \let\dfn=\smartitalic
1176 \let\emph=\smartitalic
1177 \let\cite=\smartitalic
1178
1179 \def\b#1{{\bf #1}}
1180 \let\strong=\b
1181
1182 % We can't just use \exhyphenpenalty, because that only has effect at
1183 % the end of a paragraph. Restore normal hyphenation at the end of the
1184 % group within which \nohyphenation is presumably called.
1185 %
1186 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1187 \def\restorehyphenation{\hyphenchar\font = `- }
1188
1189 \def\t#1{%
1190 {\tt \rawbackslash \frenchspacing #1}%
1191 \null
1192 }
1193 \let\ttfont=\t
1194 \def\samp #1{`\tclose{#1}'\null}
1195 \def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1196 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1197
1198 \let\file=\samp
1199 \let\email=\samp
1200 \let\url=\samp % perhaps include a hypertex \special eventually
1201
1202 % @code is a modification of @t,
1203 % which makes spaces the same size as normal in the surrounding text.
1204 \def\tclose#1{%
1205 {%
1206 % Change normal interword space to be same as for the current font.
1207 \spaceskip = \fontdimen2\font
1208 %
1209 % Switch to typewriter.
1210 \tt
1211 %
1212 % But `\ ' produces the large typewriter interword space.
1213 \def\ {{\spaceskip = 0pt{} }}%
1214 %
1215 % Turn off hyphenation.
1216 \nohyphenation
1217 %
1218 \rawbackslash
1219 \frenchspacing
1220 #1%
1221 }%
1222 \null
1223 }
1224
1225 % We *must* turn on hyphenation at `-' and `_' in \code.
1226 % Otherwise, it is too hard to avoid overfull hboxes
1227 % in the Emacs manual, the Library manual, etc.
1228
1229 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1230 % both hyphenation at - and hyphenation within words.
1231 % We must therefore turn them both off (\tclose does that)
1232 % and arrange explicitly to hyphenate an a dash.
1233 % -- rms.
1234 {
1235 \catcode`\-=\active
1236 \catcode`\_=\active
1237 \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
1238 % The following is used by \doprintindex to insure that long function names
1239 % wrap around. It is necessary for - and _ to be active before the index is
1240 % read from the file, as \entry parses the arguments long before \code is
1241 % ever called. -- mycroft
1242 \global\def\indexbreaks{\catcode`\-=\active \let-\realdash \catcode`\_=\active \let_\realunder}
1243 }
1244
1245 \def\realdash{-}
1246 \def\realunder{_}
1247 \def\codedash{-\discretionary{}{}{}}
1248 \def\codeunder{\normalunderscore\discretionary{}{}{}}
1249 \def\codex #1{\tclose{#1}\endgroup}
1250
1251 %\let\exp=\tclose %Was temporary
1252
1253 % @kbd is like @code, except that if the argument is just one @key command,
1254 % then @kbd has no effect.
1255 %
1256 \def\xkey{\key}
1257 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1258 \ifx\one\xkey\ifx\threex\three \key{#2}%
1259 \else{\tclose{\ttsl\look}}\fi
1260 \else{\tclose{\ttsl\look}}\fi}
1261
1262 % Check if we are currently using a typewriter font. Since all the
1263 % Computer Modern typewriter fonts have zero interword stretch (and
1264 % shrink), and it is reasonable to expect all typewriter fonts to have
1265 % this property, we can check that font parameter.
1266 %
1267 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1268
1269 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1270 % argument is to make the input look right: @dmn{pt} instead of
1271 % @dmn{}pt.
1272 %
1273 \def\dmn#1{\thinspace #1}
1274
1275 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1276
1277 \def\l#1{{\li #1}\null} %
1278
1279 \def\r#1{{\rm #1}} % roman font
1280 % Use of \lowercase was suggested.
1281 \def\sc#1{{\smallcaps#1}} % smallcaps font
1282 \def\ii#1{{\it #1}} % italic font
1283
1284 \message{page headings,}
1285
1286 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1287 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1288
1289 % First the title page. Must do @settitle before @titlepage.
1290 \def\titlefont#1{{\titlerm #1}}
1291
1292 \newif\ifseenauthor
1293 \newif\iffinishedtitlepage
1294
1295 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1296 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1297 \endgroup\page\hbox{}\page}
1298
1299 \def\titlepage{\begingroup \parindent=0pt \textfonts
1300 \let\subtitlerm=\tenrm
1301 % I deinstalled the following change because \cmr12 is undefined.
1302 % This change was not in the ChangeLog anyway. --rms.
1303 % \let\subtitlerm=\cmr12
1304 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1305 %
1306 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1307 %
1308 % Leave some space at the very top of the page.
1309 \vglue\titlepagetopglue
1310 %
1311 % Now you can print the title using @title.
1312 \def\title{\parsearg\titlezzz}%
1313 \def\titlezzz##1{\leftline{\titlefont{##1}}
1314 % print a rule at the page bottom also.
1315 \finishedtitlepagefalse
1316 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1317 % No rule at page bottom unless we print one at the top with @title.
1318 \finishedtitlepagetrue
1319 %
1320 % Now you can put text using @subtitle.
1321 \def\subtitle{\parsearg\subtitlezzz}%
1322 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1323 %
1324 % @author should come last, but may come many times.
1325 \def\author{\parsearg\authorzzz}%
1326 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1327 {\authorfont \leftline{##1}}}%
1328 %
1329 % Most title ``pages'' are actually two pages long, with space
1330 % at the top of the second. We don't want the ragged left on the second.
1331 \let\oldpage = \page
1332 \def\page{%
1333 \iffinishedtitlepage\else
1334 \finishtitlepage
1335 \fi
1336 \oldpage
1337 \let\page = \oldpage
1338 \hbox{}}%
1339 % \def\page{\oldpage \hbox{}}
1340 }
1341
1342 \def\Etitlepage{%
1343 \iffinishedtitlepage\else
1344 \finishtitlepage
1345 \fi
1346 % It is important to do the page break before ending the group,
1347 % because the headline and footline are only empty inside the group.
1348 % If we use the new definition of \page, we always get a blank page
1349 % after the title page, which we certainly don't want.
1350 \oldpage
1351 \endgroup
1352 \HEADINGSon
1353 }
1354
1355 \def\finishtitlepage{%
1356 \vskip4pt \hrule height 2pt width \hsize
1357 \vskip\titlepagebottomglue
1358 \finishedtitlepagetrue
1359 }
1360
1361 %%% Set up page headings and footings.
1362
1363 \let\thispage=\folio
1364
1365 \newtoks \evenheadline % Token sequence for heading line of even pages
1366 \newtoks \oddheadline % Token sequence for heading line of odd pages
1367 \newtoks \evenfootline % Token sequence for footing line of even pages
1368 \newtoks \oddfootline % Token sequence for footing line of odd pages
1369
1370 % Now make Tex use those variables
1371 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1372 \else \the\evenheadline \fi}}
1373 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1374 \else \the\evenfootline \fi}\HEADINGShook}
1375 \let\HEADINGShook=\relax
1376
1377 % Commands to set those variables.
1378 % For example, this is what @headings on does
1379 % @evenheading @thistitle|@thispage|@thischapter
1380 % @oddheading @thischapter|@thispage|@thistitle
1381 % @evenfooting @thisfile||
1382 % @oddfooting ||@thisfile
1383
1384 \def\evenheading{\parsearg\evenheadingxxx}
1385 \def\oddheading{\parsearg\oddheadingxxx}
1386 \def\everyheading{\parsearg\everyheadingxxx}
1387
1388 \def\evenfooting{\parsearg\evenfootingxxx}
1389 \def\oddfooting{\parsearg\oddfootingxxx}
1390 \def\everyfooting{\parsearg\everyfootingxxx}
1391
1392 {\catcode`\@=0 %
1393
1394 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1395 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1396 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1397
1398 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1399 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1400 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1401
1402 \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
1403 \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
1404 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
1405 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1406
1407 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1408 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1409 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1410
1411 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1412 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1413 \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1414
1415 \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
1416 \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
1417 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
1418 \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1419 %
1420 }% unbind the catcode of @.
1421
1422 % @headings double turns headings on for double-sided printing.
1423 % @headings single turns headings on for single-sided printing.
1424 % @headings off turns them off.
1425 % @headings on same as @headings double, retained for compatibility.
1426 % @headings after turns on double-sided headings after this page.
1427 % @headings doubleafter turns on double-sided headings after this page.
1428 % @headings singleafter turns on single-sided headings after this page.
1429 % By default, they are off.
1430
1431 \def\headings #1 {\csname HEADINGS#1\endcsname}
1432
1433 \def\HEADINGSoff{
1434 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1435 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1436 \HEADINGSoff
1437 % When we turn headings on, set the page number to 1.
1438 % For double-sided printing, put current file name in lower left corner,
1439 % chapter name on inside top of right hand pages, document
1440 % title on inside top of left hand pages, and page numbers on outside top
1441 % edge of all pages.
1442 \def\HEADINGSdouble{
1443 %\pagealignmacro
1444 \global\pageno=1
1445 \global\evenfootline={\hfil}
1446 \global\oddfootline={\hfil}
1447 \global\evenheadline={\line{\folio\hfil\thistitle}}
1448 \global\oddheadline={\line{\thischapter\hfil\folio}}
1449 }
1450 % For single-sided printing, chapter title goes across top left of page,
1451 % page number on top right.
1452 \def\HEADINGSsingle{
1453 %\pagealignmacro
1454 \global\pageno=1
1455 \global\evenfootline={\hfil}
1456 \global\oddfootline={\hfil}
1457 \global\evenheadline={\line{\thischapter\hfil\folio}}
1458 \global\oddheadline={\line{\thischapter\hfil\folio}}
1459 }
1460 \def\HEADINGSon{\HEADINGSdouble}
1461
1462 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1463 \let\HEADINGSdoubleafter=\HEADINGSafter
1464 \def\HEADINGSdoublex{%
1465 \global\evenfootline={\hfil}
1466 \global\oddfootline={\hfil}
1467 \global\evenheadline={\line{\folio\hfil\thistitle}}
1468 \global\oddheadline={\line{\thischapter\hfil\folio}}
1469 }
1470
1471 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1472 \def\HEADINGSsinglex{%
1473 \global\evenfootline={\hfil}
1474 \global\oddfootline={\hfil}
1475 \global\evenheadline={\line{\thischapter\hfil\folio}}
1476 \global\oddheadline={\line{\thischapter\hfil\folio}}
1477 }
1478
1479 % Subroutines used in generating headings
1480 % Produces Day Month Year style of output.
1481 \def\today{\number\day\space
1482 \ifcase\month\or
1483 January\or February\or March\or April\or May\or June\or
1484 July\or August\or September\or October\or November\or December\fi
1485 \space\number\year}
1486
1487 % Use this if you want the Month Day, Year style of output.
1488 %\def\today{\ifcase\month\or
1489 %January\or February\or March\or April\or May\or June\or
1490 %July\or August\or September\or October\or November\or December\fi
1491 %\space\number\day, \number\year}
1492
1493 % @settitle line... specifies the title of the document, for headings
1494 % It generates no output of its own
1495
1496 \def\thistitle{No Title}
1497 \def\settitle{\parsearg\settitlezzz}
1498 \def\settitlezzz #1{\gdef\thistitle{#1}}
1499
1500 \message{tables,}
1501
1502 % @tabs -- simple alignment
1503
1504 % These don't work. For one thing, \+ is defined as outer.
1505 % So these macros cannot even be defined.
1506
1507 %\def\tabs{\parsearg\tabszzz}
1508 %\def\tabszzz #1{\settabs\+#1\cr}
1509 %\def\tabline{\parsearg\tablinezzz}
1510 %\def\tablinezzz #1{\+#1\cr}
1511 %\def\&{&}
1512
1513 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1514
1515 % default indentation of table text
1516 \newdimen\tableindent \tableindent=.8in
1517 % default indentation of @itemize and @enumerate text
1518 \newdimen\itemindent \itemindent=.3in
1519 % margin between end of table item and start of table text.
1520 \newdimen\itemmargin \itemmargin=.1in
1521
1522 % used internally for \itemindent minus \itemmargin
1523 \newdimen\itemmax
1524
1525 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1526 % these defs.
1527 % They also define \itemindex
1528 % to index the item name in whatever manner is desired (perhaps none).
1529
1530 \newif\ifitemxneedsnegativevskip
1531
1532 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1533
1534 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1535 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1536
1537 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1538 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1539
1540 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1541 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1542
1543 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1544 \itemzzz {#1}}
1545
1546 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1547 \itemzzz {#1}}
1548
1549 \def\itemzzz #1{\begingroup %
1550 \advance\hsize by -\rightskip
1551 \advance\hsize by -\tableindent
1552 \setbox0=\hbox{\itemfont{#1}}%
1553 \itemindex{#1}%
1554 \nobreak % This prevents a break before @itemx.
1555 %
1556 % Be sure we are not still in the middle of a paragraph.
1557 %{\parskip = 0in
1558 %\par
1559 %}%
1560 %
1561 % If the item text does not fit in the space we have, put it on a line
1562 % by itself, and do not allow a page break either before or after that
1563 % line. We do not start a paragraph here because then if the next
1564 % command is, e.g., @kindex, the whatsit would get put into the
1565 % horizontal list on a line by itself, resulting in extra blank space.
1566 \ifdim \wd0>\itemmax
1567 %
1568 % Make this a paragraph so we get the \parskip glue and wrapping,
1569 % but leave it ragged-right.
1570 \begingroup
1571 \advance\leftskip by-\tableindent
1572 \advance\hsize by\tableindent
1573 \advance\rightskip by0pt plus1fil
1574 \leavevmode\unhbox0\par
1575 \endgroup
1576 %
1577 % We're going to be starting a paragraph, but we don't want the
1578 % \parskip glue -- logically it's part of the @item we just started.
1579 \nobreak \vskip-\parskip
1580 %
1581 % Stop a page break at the \parskip glue coming up. Unfortunately
1582 % we can't prevent a possible page break at the following
1583 % \baselineskip glue.
1584 \nobreak
1585 \endgroup
1586 \itemxneedsnegativevskipfalse
1587 \else
1588 % The item text fits into the space. Start a paragraph, so that the
1589 % following text (if any) will end up on the same line. Since that
1590 % text will be indented by \tableindent, we make the item text be in
1591 % a zero-width box.
1592 \noindent
1593 \rlap{\hskip -\tableindent\box0}\ignorespaces%
1594 \endgroup%
1595 \itemxneedsnegativevskiptrue%
1596 \fi
1597 }
1598
1599 \def\item{\errmessage{@item while not in a table}}
1600 \def\itemx{\errmessage{@itemx while not in a table}}
1601 \def\kitem{\errmessage{@kitem while not in a table}}
1602 \def\kitemx{\errmessage{@kitemx while not in a table}}
1603 \def\xitem{\errmessage{@xitem while not in a table}}
1604 \def\xitemx{\errmessage{@xitemx while not in a table}}
1605
1606 %% Contains a kludge to get @end[description] to work
1607 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1608
1609 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1610 {\obeylines\obeyspaces%
1611 \gdef\tablex #1^^M{%
1612 \tabley\dontindex#1 \endtabley}}
1613
1614 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1615 {\obeylines\obeyspaces%
1616 \gdef\ftablex #1^^M{%
1617 \tabley\fnitemindex#1 \endtabley
1618 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1619 \let\Etable=\relax}}
1620
1621 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1622 {\obeylines\obeyspaces%
1623 \gdef\vtablex #1^^M{%
1624 \tabley\vritemindex#1 \endtabley
1625 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1626 \let\Etable=\relax}}
1627
1628 \def\dontindex #1{}
1629 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1630 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1631
1632 {\obeyspaces %
1633 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1634 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1635
1636 \def\tablez #1#2#3#4#5#6{%
1637 \aboveenvbreak %
1638 \begingroup %
1639 \def\Edescription{\Etable}% Necessary kludge.
1640 \let\itemindex=#1%
1641 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1642 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1643 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1644 \def\itemfont{#2}%
1645 \itemmax=\tableindent %
1646 \advance \itemmax by -\itemmargin %
1647 \advance \leftskip by \tableindent %
1648 \exdentamount=\tableindent
1649 \parindent = 0pt
1650 \parskip = \smallskipamount
1651 \ifdim \parskip=0pt \parskip=2pt \fi%
1652 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1653 \let\item = \internalBitem %
1654 \let\itemx = \internalBitemx %
1655 \let\kitem = \internalBkitem %
1656 \let\kitemx = \internalBkitemx %
1657 \let\xitem = \internalBxitem %
1658 \let\xitemx = \internalBxitemx %
1659 }
1660
1661 % This is the counter used by @enumerate, which is really @itemize
1662
1663 \newcount \itemno
1664
1665 \def\itemize{\parsearg\itemizezzz}
1666
1667 \def\itemizezzz #1{%
1668 \begingroup % ended by the @end itemsize
1669 \itemizey {#1}{\Eitemize}
1670 }
1671
1672 \def\itemizey #1#2{%
1673 \aboveenvbreak %
1674 \itemmax=\itemindent %
1675 \advance \itemmax by -\itemmargin %
1676 \advance \leftskip by \itemindent %
1677 \exdentamount=\itemindent
1678 \parindent = 0pt %
1679 \parskip = \smallskipamount %
1680 \ifdim \parskip=0pt \parskip=2pt \fi%
1681 \def#2{\endgraf\afterenvbreak\endgroup}%
1682 \def\itemcontents{#1}%
1683 \let\item=\itemizeitem}
1684
1685 % Set sfcode to normal for the chars that usually have another value.
1686 % These are `.?!:;,'
1687 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1688 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1689
1690 % \splitoff TOKENS\endmark defines \first to be the first token in
1691 % TOKENS, and \rest to be the remainder.
1692 %
1693 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1694
1695 % Allow an optional argument of an uppercase letter, lowercase letter,
1696 % or number, to specify the first label in the enumerated list. No
1697 % argument is the same as `1'.
1698 %
1699 \def\enumerate{\parsearg\enumeratezzz}
1700 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1701 \def\enumeratey #1 #2\endenumeratey{%
1702 \begingroup % ended by the @end enumerate
1703 %
1704 % If we were given no argument, pretend we were given `1'.
1705 \def\thearg{#1}%
1706 \ifx\thearg\empty \def\thearg{1}\fi
1707 %
1708 % Detect if the argument is a single token. If so, it might be a
1709 % letter. Otherwise, the only valid thing it can be is a number.
1710 % (We will always have one token, because of the test we just made.
1711 % This is a good thing, since \splitoff doesn't work given nothing at
1712 % all -- the first parameter is undelimited.)
1713 \expandafter\splitoff\thearg\endmark
1714 \ifx\rest\empty
1715 % Only one token in the argument. It could still be anything.
1716 % A ``lowercase letter'' is one whose \lccode is nonzero.
1717 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1718 % not equal to itself.
1719 % Otherwise, we assume it's a number.
1720 %
1721 % We need the \relax at the end of the \ifnum lines to stop TeX from
1722 % continuing to look for a <number>.
1723 %
1724 \ifnum\lccode\expandafter`\thearg=0\relax
1725 \numericenumerate % a number (we hope)
1726 \else
1727 % It's a letter.
1728 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1729 \lowercaseenumerate % lowercase letter
1730 \else
1731 \uppercaseenumerate % uppercase letter
1732 \fi
1733 \fi
1734 \else
1735 % Multiple tokens in the argument. We hope it's a number.
1736 \numericenumerate
1737 \fi
1738 }
1739
1740 % An @enumerate whose labels are integers. The starting integer is
1741 % given in \thearg.
1742 %
1743 \def\numericenumerate{%
1744 \itemno = \thearg
1745 \startenumeration{\the\itemno}%
1746 }
1747
1748 % The starting (lowercase) letter is in \thearg.
1749 \def\lowercaseenumerate{%
1750 \itemno = \expandafter`\thearg
1751 \startenumeration{%
1752 % Be sure we're not beyond the end of the alphabet.
1753 \ifnum\itemno=0
1754 \errmessage{No more lowercase letters in @enumerate; get a bigger
1755 alphabet}%
1756 \fi
1757 \char\lccode\itemno
1758 }%
1759 }
1760
1761 % The starting (uppercase) letter is in \thearg.
1762 \def\uppercaseenumerate{%
1763 \itemno = \expandafter`\thearg
1764 \startenumeration{%
1765 % Be sure we're not beyond the end of the alphabet.
1766 \ifnum\itemno=0
1767 \errmessage{No more uppercase letters in @enumerate; get a bigger
1768 alphabet}
1769 \fi
1770 \char\uccode\itemno
1771 }%
1772 }
1773
1774 % Call itemizey, adding a period to the first argument and supplying the
1775 % common last two arguments. Also subtract one from the initial value in
1776 % \itemno, since @item increments \itemno.
1777 %
1778 \def\startenumeration#1{%
1779 \advance\itemno by -1
1780 \itemizey{#1.}\Eenumerate\flushcr
1781 }
1782
1783 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
1784 % to @enumerate.
1785 %
1786 \def\alphaenumerate{\enumerate{a}}
1787 \def\capsenumerate{\enumerate{A}}
1788 \def\Ealphaenumerate{\Eenumerate}
1789 \def\Ecapsenumerate{\Eenumerate}
1790
1791 % Definition of @item while inside @itemize.
1792
1793 \def\itemizeitem{%
1794 \advance\itemno by 1
1795 {\let\par=\endgraf \smallbreak}%
1796 \ifhmode \errmessage{\in hmode at itemizeitem}\fi
1797 {\parskip=0in \hskip 0pt
1798 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
1799 \vadjust{\penalty 1200}}%
1800 \flushcr}
1801
1802 % @multitable macros
1803 % Amy Hendrickson, 8/18/94, 3/6/96
1804 %
1805 % @multitable ... @end multitable will make as many columns as desired.
1806 % Contents of each column will wrap at width given in preamble. Width
1807 % can be specified either with sample text given in a template line,
1808 % or in percent of \hsize, the current width of text on page.
1809
1810 % Table can continue over pages but will only break between lines.
1811
1812 % To make preamble:
1813 %
1814 % Either define widths of columns in terms of percent of \hsize:
1815 % @multitable @columnfractions .25 .3 .45
1816 % @item ...
1817 %
1818 % Numbers following @columnfractions are the percent of the total
1819 % current hsize to be used for each column. You may use as many
1820 % columns as desired.
1821
1822 % Or use a template:
1823 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
1824 % @item ...
1825 % using the widest term desired in each column.
1826 %
1827 % For those who want to use more than one line's worth of words in
1828 % the preamble, break the line within one argument and it
1829 % will parse correctly, i.e.,
1830 %
1831 % @multitable {Column 1 template} {Column 2 template} {Column 3
1832 % template}
1833 % Not:
1834 % @multitable {Column 1 template} {Column 2 template}
1835 % {Column 3 template}
1836
1837 % Each new table line starts with @item, each subsequent new column
1838 % starts with @tab. Empty columns may be produced by supplying @tab's
1839 % with nothing between them for as many times as empty columns are needed,
1840 % ie, @tab@tab@tab will produce two empty columns.
1841
1842 % @item, @tab, @multicolumn or @endmulticolumn do not need to be on their
1843 % own lines, but it will not hurt if they are.
1844
1845 % Sample multitable:
1846
1847 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
1848 % @item first col stuff @tab second col stuff @tab third col
1849 % @item
1850 % first col stuff
1851 % @tab
1852 % second col stuff
1853 % @tab
1854 % third col
1855 % @item first col stuff @tab second col stuff
1856 % @tab Many paragraphs of text may be used in any column.
1857 %
1858 % They will wrap at the width determined by the template.
1859 % @item@tab@tab This will be in third column.
1860 % @end multitable
1861
1862 % Default dimensions may be reset by user.
1863 % @multitableparskip is vertical space between paragraphs in table.
1864 % @multitableparindent is paragraph indent in table.
1865 % @multitablecolmargin is horizontal space to be left between columns.
1866 % @multitablelinespace is space to leave between table items, baseline
1867 % to baseline.
1868 % 0pt means it depends on current normal line spacing.
1869
1870 %%%%
1871 % Dimensions
1872
1873 \newskip\multitableparskip
1874 \newskip\multitableparindent
1875 \newdimen\multitablecolspace
1876 \newskip\multitablelinespace
1877 \multitableparskip=0pt
1878 \multitableparindent=6pt
1879 \multitablecolspace=12pt
1880 \multitablelinespace=0pt
1881
1882 %%%%
1883 % Macros used to set up halign preamble:
1884 \let\endsetuptable\relax
1885 \def\xendsetuptable{\endsetuptable}
1886 \let\columnfractions\relax
1887 \def\xcolumnfractions{\columnfractions}
1888 \newif\ifsetpercent
1889
1890 %% 2/1/96, to allow fractions to be given with more than one digit.
1891 \def\pickupwholefraction#1 {\global\advance\colcount by1 %
1892 \expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
1893 \setuptable}
1894
1895 \newcount\colcount
1896 \def\setuptable#1{\def\firstarg{#1}%
1897 \ifx\firstarg\xendsetuptable\let\go\relax%
1898 \else
1899 \ifx\firstarg\xcolumnfractions\global\setpercenttrue%
1900 \else
1901 \ifsetpercent
1902 \let\go\pickupwholefraction % In this case arg of setuptable
1903 % is the decimal point before the
1904 % number given in percent of hsize.
1905 % We don't need this so we don't use it.
1906 \else
1907 \global\advance\colcount by1
1908 \setbox0=\hbox{#1}%
1909 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
1910 \fi%
1911 \fi%
1912 \ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
1913 \fi\go}
1914
1915 %%%%
1916 % multitable syntax
1917 \def\tab{&\hskip1sp\relax} % 2/2/96
1918 % tiny skip here makes sure this column space is
1919 % maintained, even if it is never used.
1920
1921
1922 %%%%
1923 % @multitable ... @end multitable definitions:
1924
1925 \def\multitable{\parsearg\dotable}
1926
1927 \def\dotable#1{\bgroup
1928 \let\item\cr
1929 \tolerance=9500
1930 \hbadness=9500
1931 \setmultitablespacing
1932 \parskip=\multitableparskip
1933 \parindent=\multitableparindent
1934 \overfullrule=0pt
1935 \global\colcount=0\relax%
1936 \def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}%
1937 % To parse everything between @multitable and @item :
1938 \setuptable#1 \endsetuptable
1939 % Need to reset this to 0 after \setuptable.
1940 \global\colcount=0\relax%
1941 %
1942 % This preamble sets up a generic column definition, which will
1943 % be used as many times as user calls for columns.
1944 % \vtop will set a single line and will also let text wrap and
1945 % continue for many paragraphs if desired.
1946 \halign\bgroup&\global\advance\colcount by 1\relax%
1947 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
1948 % In order to keep entries from bumping into each other
1949 % we will add a \leftskip of \multitablecolspace to all columns after
1950 % the first one.
1951 % If a template has been used, we will add \multitablecolspace
1952 % to the width of each template entry.
1953 % If user has set preamble in terms of percent of \hsize
1954 % we will use that dimension as the width of the column, and
1955 % the \leftskip will keep entries from bumping into each other.
1956 % Table will start at left margin and final column will justify at
1957 % right margin.
1958 \ifnum\colcount=1
1959 \else
1960 \ifsetpercent
1961 \else
1962 % If user has <not> set preamble in terms of percent of \hsize
1963 % we will advance \hsize by \multitablecolspace
1964 \advance\hsize by \multitablecolspace
1965 \fi
1966 % In either case we will make \leftskip=\multitablecolspace:
1967 \leftskip=\multitablecolspace
1968 \fi
1969 \noindent##}\cr%
1970 % \everycr will reset column counter, \colcount, at the end of
1971 % each line. Every column entry will cause \colcount to advance by one.
1972 % The table preamble
1973 % looks at the current \colcount to find the correct column width.
1974 \global\everycr{\noalign{%
1975 \filbreak%% keeps underfull box messages off when table breaks over pages.
1976 \global\colcount=0\relax}}
1977 }
1978
1979 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
1980 % If so, do nothing. If not, give it an appropriate dimension based on
1981 % current baselineskip.
1982 \setbox0=\vbox{Xy}
1983 \ifdim\multitablelinespace=0pt
1984 %% strut to put in table in case some entry doesn't have descenders,
1985 %% to keep lines equally spaced
1986 \gdef\multistrut{\vrule height\ht0 depth\dp0 width0pt\relax}
1987 %% Test to see if parskip is larger than space between lines of
1988 %% table. If not, do nothing.
1989 %% If so, set to same dimension as multitablelinespace.
1990 \else
1991 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
1992 width0pt\relax} \fi
1993 \ifdim\multitableparskip>\multitablelinespace
1994 \global\multitableparskip=\multitablelinespace
1995 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
1996 %% than skip between lines in the table.
1997 \fi%
1998 \ifdim\multitableparskip=0pt
1999 \global\multitableparskip=\multitablelinespace
2000 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2001 %% than skip between lines in the table.
2002 \fi}
2003 \message{indexing,}
2004 % Index generation facilities
2005
2006 % Define \newwrite to be identical to plain tex's \newwrite
2007 % except not \outer, so it can be used within \newindex.
2008 {\catcode`\@=11
2009 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2010
2011 % \newindex {foo} defines an index named foo.
2012 % It automatically defines \fooindex such that
2013 % \fooindex ...rest of line... puts an entry in the index foo.
2014 % It also defines \fooindfile to be the number of the output channel for
2015 % the file that accumulates this index. The file's extension is foo.
2016 % The name of an index should be no more than 2 characters long
2017 % for the sake of vms.
2018
2019 \def\newindex #1{
2020 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
2021 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2022 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2023 \noexpand\doindex {#1}}
2024 }
2025
2026 % @defindex foo == \newindex{foo}
2027
2028 \def\defindex{\parsearg\newindex}
2029
2030 % Define @defcodeindex, like @defindex except put all entries in @code.
2031
2032 \def\newcodeindex #1{
2033 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
2034 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2035 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2036 \noexpand\docodeindex {#1}}
2037 }
2038
2039 \def\defcodeindex{\parsearg\newcodeindex}
2040
2041 % @synindex foo bar makes index foo feed into index bar.
2042 % Do this instead of @defindex foo if you don't want it as a separate index.
2043 \def\synindex #1 #2 {%
2044 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2045 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2046 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2047 \noexpand\doindex {#2}}%
2048 }
2049
2050 % @syncodeindex foo bar similar, but put all entries made for index foo
2051 % inside @code.
2052 \def\syncodeindex #1 #2 {%
2053 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2054 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2055 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2056 \noexpand\docodeindex {#2}}%
2057 }
2058
2059 % Define \doindex, the driver for all \fooindex macros.
2060 % Argument #1 is generated by the calling \fooindex macro,
2061 % and it is "foo", the name of the index.
2062
2063 % \doindex just uses \parsearg; it calls \doind for the actual work.
2064 % This is because \doind is more useful to call from other macros.
2065
2066 % There is also \dosubind {index}{topic}{subtopic}
2067 % which makes an entry in a two-level index such as the operation index.
2068
2069 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
2070 \def\singleindexer #1{\doind{\indexname}{#1}}
2071
2072 % like the previous two, but they put @code around the argument.
2073 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2074 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2075
2076 \def\indexdummies{%
2077 % Take care of the plain tex accent commands.
2078 \def\"{\realbackslash "}%
2079 \def\`{\realbackslash `}%
2080 \def\'{\realbackslash '}%
2081 \def\^{\realbackslash ^}%
2082 \def\~{\realbackslash ~}%
2083 \def\={\realbackslash =}%
2084 \def\b{\realbackslash b}%
2085 \def\c{\realbackslash c}%
2086 \def\d{\realbackslash d}%
2087 \def\u{\realbackslash u}%
2088 \def\v{\realbackslash v}%
2089 \def\H{\realbackslash H}%
2090 % Take care of the plain tex special European modified letters.
2091 \def\oe{\realbackslash oe}%
2092 \def\ae{\realbackslash ae}%
2093 \def\aa{\realbackslash aa}%
2094 \def\OE{\realbackslash OE}%
2095 \def\AE{\realbackslash AE}%
2096 \def\AA{\realbackslash AA}%
2097 \def\o{\realbackslash o}%
2098 \def\O{\realbackslash O}%
2099 \def\l{\realbackslash l}%
2100 \def\L{\realbackslash L}%
2101 \def\ss{\realbackslash ss}%
2102 % Take care of texinfo commands likely to appear in an index entry.
2103 \def\_{{\realbackslash _}}%
2104 \def\w{\realbackslash w }%
2105 \def\bf{\realbackslash bf }%
2106 \def\rm{\realbackslash rm }%
2107 \def\sl{\realbackslash sl }%
2108 \def\sf{\realbackslash sf}%
2109 \def\tt{\realbackslash tt}%
2110 \def\gtr{\realbackslash gtr}%
2111 \def\less{\realbackslash less}%
2112 \def\hat{\realbackslash hat}%
2113 \def\char{\realbackslash char}%
2114 \def\TeX{\realbackslash TeX}%
2115 \def\dots{\realbackslash dots }%
2116 \def\copyright{\realbackslash copyright }%
2117 \def\tclose##1{\realbackslash tclose {##1}}%
2118 \def\code##1{\realbackslash code {##1}}%
2119 \def\samp##1{\realbackslash samp {##1}}%
2120 \def\t##1{\realbackslash r {##1}}%
2121 \def\r##1{\realbackslash r {##1}}%
2122 \def\i##1{\realbackslash i {##1}}%
2123 \def\b##1{\realbackslash b {##1}}%
2124 \def\cite##1{\realbackslash cite {##1}}%
2125 \def\key##1{\realbackslash key {##1}}%
2126 \def\file##1{\realbackslash file {##1}}%
2127 \def\var##1{\realbackslash var {##1}}%
2128 \def\kbd##1{\realbackslash kbd {##1}}%
2129 \def\dfn##1{\realbackslash dfn {##1}}%
2130 \def\emph##1{\realbackslash emph {##1}}%
2131 \unsepspaces
2132 }
2133
2134 % If an index command is used in an @example environment, any spaces
2135 % therein should become regular spaces in the raw index file, not the
2136 % expansion of \tie (\\leavevmode \penalty \@M \ ).
2137 {\obeyspaces
2138 \gdef\unsepspaces{\obeyspaces\let =\space}}
2139
2140 % \indexnofonts no-ops all font-change commands.
2141 % This is used when outputting the strings to sort the index by.
2142 \def\indexdummyfont#1{#1}
2143 \def\indexdummytex{TeX}
2144 \def\indexdummydots{...}
2145
2146 \def\indexnofonts{%
2147 % Just ignore accents.
2148 \let\"=\indexdummyfont
2149 \let\`=\indexdummyfont
2150 \let\'=\indexdummyfont
2151 \let\^=\indexdummyfont
2152 \let\~=\indexdummyfont
2153 \let\==\indexdummyfont
2154 \let\b=\indexdummyfont
2155 \let\c=\indexdummyfont
2156 \let\d=\indexdummyfont
2157 \let\u=\indexdummyfont
2158 \let\v=\indexdummyfont
2159 \let\H=\indexdummyfont
2160 % Take care of the plain tex special European modified letters.
2161 \def\oe{oe}%
2162 \def\ae{ae}%
2163 \def\aa{aa}%
2164 \def\OE{OE}%
2165 \def\AE{AE}%
2166 \def\AA{AA}%
2167 \def\o{o}%
2168 \def\O{O}%
2169 \def\l{l}%
2170 \def\L{L}%
2171 \def\ss{ss}%
2172 \let\w=\indexdummyfont
2173 \let\t=\indexdummyfont
2174 \let\r=\indexdummyfont
2175 \let\i=\indexdummyfont
2176 \let\b=\indexdummyfont
2177 \let\emph=\indexdummyfont
2178 \let\strong=\indexdummyfont
2179 \let\cite=\indexdummyfont
2180 \let\sc=\indexdummyfont
2181 %Don't no-op \tt, since it isn't a user-level command
2182 % and is used in the definitions of the active chars like <, >, |...
2183 %\let\tt=\indexdummyfont
2184 \let\tclose=\indexdummyfont
2185 \let\code=\indexdummyfont
2186 \let\file=\indexdummyfont
2187 \let\samp=\indexdummyfont
2188 \let\kbd=\indexdummyfont
2189 \let\key=\indexdummyfont
2190 \let\var=\indexdummyfont
2191 \let\TeX=\indexdummytex
2192 \let\dots=\indexdummydots
2193 }
2194
2195 % To define \realbackslash, we must make \ not be an escape.
2196 % We must first make another character (@) an escape
2197 % so we do not become unable to do a definition.
2198
2199 {\catcode`\@=0 \catcode`\\=\other
2200 @gdef@realbackslash{\}}
2201
2202 \let\indexbackslash=0 %overridden during \printindex.
2203
2204 \let\SETmarginindex=\relax %initialize!
2205 % workhorse for all \fooindexes
2206 % #1 is name of index, #2 is stuff to put there
2207 \def\doind #1#2{%
2208 % Put the index entry in the margin if desired.
2209 \ifx\SETmarginindex\relax\else%
2210 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2211 \fi%
2212 {\count10=\lastpenalty %
2213 {\indexdummies % Must do this here, since \bf, etc expand at this stage
2214 \escapechar=`\\%
2215 {\let\folio=0% Expand all macros now EXCEPT \folio
2216 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2217 % so it will be output as is; and it will print as backslash in the indx.
2218 %
2219 % Now process the index-string once, with all font commands turned off,
2220 % to get the string to sort the index by.
2221 {\indexnofonts
2222 \xdef\temp1{#2}%
2223 }%
2224 % Now produce the complete index entry. We process the index-string again,
2225 % this time with font commands expanded, to get what to print in the index.
2226 \edef\temp{%
2227 \write \csname#1indfile\endcsname{%
2228 \realbackslash entry {\temp1}{\folio}{#2}}}%
2229 \temp }%
2230 }\penalty\count10}}
2231
2232 \def\dosubind #1#2#3{%
2233 {\count10=\lastpenalty %
2234 {\indexdummies % Must do this here, since \bf, etc expand at this stage
2235 \escapechar=`\\%
2236 {\let\folio=0%
2237 \def\rawbackslashxx{\indexbackslash}%
2238 %
2239 % Now process the index-string once, with all font commands turned off,
2240 % to get the string to sort the index by.
2241 {\indexnofonts
2242 \xdef\temp1{#2 #3}%
2243 }%
2244 % Now produce the complete index entry. We process the index-string again,
2245 % this time with font commands expanded, to get what to print in the index.
2246 \edef\temp{%
2247 \write \csname#1indfile\endcsname{%
2248 \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
2249 \temp }%
2250 }\penalty\count10}}
2251
2252 % The index entry written in the file actually looks like
2253 % \entry {sortstring}{page}{topic}
2254 % or
2255 % \entry {sortstring}{page}{topic}{subtopic}
2256 % The texindex program reads in these files and writes files
2257 % containing these kinds of lines:
2258 % \initial {c}
2259 % before the first topic whose initial is c
2260 % \entry {topic}{pagelist}
2261 % for a topic that is used without subtopics
2262 % \primary {topic}
2263 % for the beginning of a topic that is used with subtopics
2264 % \secondary {subtopic}{pagelist}
2265 % for each subtopic.
2266
2267 % Define the user-accessible indexing commands
2268 % @findex, @vindex, @kindex, @cindex.
2269
2270 \def\findex {\fnindex}
2271 \def\kindex {\kyindex}
2272 \def\cindex {\cpindex}
2273 \def\vindex {\vrindex}
2274 \def\tindex {\tpindex}
2275 \def\pindex {\pgindex}
2276
2277 \def\cindexsub {\begingroup\obeylines\cindexsub}
2278 {\obeylines %
2279 \gdef\cindexsub "#1" #2^^M{\endgroup %
2280 \dosubind{cp}{#2}{#1}}}
2281
2282 % Define the macros used in formatting output of the sorted index material.
2283
2284 % This is what you call to cause a particular index to get printed.
2285 % Write
2286 % @unnumbered Function Index
2287 % @printindex fn
2288
2289 \def\printindex{\parsearg\doprintindex}
2290
2291 \def\doprintindex#1{%
2292 \tex
2293 \dobreak \chapheadingskip {10000}
2294 \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
2295 \catcode`\$=\other
2296 \catcode`\~=\other
2297 \indexbreaks
2298 %
2299 % The following don't help, since the chars were translated
2300 % when the raw index was written, and their fonts were discarded
2301 % due to \indexnofonts.
2302 %\catcode`\"=\active
2303 %\catcode`\^=\active
2304 %\catcode`\_=\active
2305 %\catcode`\|=\active
2306 %\catcode`\<=\active
2307 %\catcode`\>=\active
2308 % %
2309 \def\indexbackslash{\rawbackslashxx}
2310 \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
2311 \begindoublecolumns
2312 %
2313 % See if the index file exists and is nonempty.
2314 \openin 1 \jobname.#1s
2315 \ifeof 1
2316 % \enddoublecolumns gets confused if there is no text in the index,
2317 % and it loses the chapter title and the aux file entries for the
2318 % index. The easiest way to prevent this problem is to make sure
2319 % there is some text.
2320 (Index is nonexistent)
2321 \else
2322 %
2323 % If the index file exists but is empty, then \openin leaves \ifeof
2324 % false. We have to make TeX try to read something from the file, so
2325 % it can discover if there is anything in it.
2326 \read 1 to \temp
2327 \ifeof 1
2328 (Index is empty)
2329 \else
2330 \input \jobname.#1s
2331 \fi
2332 \fi
2333 \closein 1
2334 \enddoublecolumns
2335 \Etex
2336 }
2337
2338 % These macros are used by the sorted index file itself.
2339 % Change them to control the appearance of the index.
2340
2341 % Same as \bigskipamount except no shrink.
2342 % \balancecolumns gets confused if there is any shrink.
2343 \newskip\initialskipamount \initialskipamount 12pt plus4pt
2344
2345 \def\initial #1{%
2346 {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2347 \ifdim\lastskip<\initialskipamount
2348 \removelastskip \penalty-200 \vskip \initialskipamount\fi
2349 \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
2350
2351 % This typesets a paragraph consisting of #1, dot leaders, and then #2
2352 % flush to the right margin. It is used for index and table of contents
2353 % entries. The paragraph is indented by \leftskip.
2354 %
2355 \def\entry #1#2{\begingroup
2356 %
2357 % Start a new paragraph if necessary, so our assignments below can't
2358 % affect previous text.
2359 \par
2360 %
2361 % Do not fill out the last line with white space.
2362 \parfillskip = 0in
2363 %
2364 % No extra space above this paragraph.
2365 \parskip = 0in
2366 %
2367 % Do not prefer a separate line ending with a hyphen to fewer lines.
2368 \finalhyphendemerits = 0
2369 %
2370 % \hangindent is only relevant when the entry text and page number
2371 % don't both fit on one line. In that case, bob suggests starting the
2372 % dots pretty far over on the line. Unfortunately, a large
2373 % indentation looks wrong when the entry text itself is broken across
2374 % lines. So we use a small indentation and put up with long leaders.
2375 %
2376 % \hangafter is reset to 1 (which is the value we want) at the start
2377 % of each paragraph, so we need not do anything with that.
2378 \hangindent=2em
2379 %
2380 % When the entry text needs to be broken, just fill out the first line
2381 % with blank space.
2382 \rightskip = 0pt plus1fil
2383 %
2384 % Start a ``paragraph'' for the index entry so the line breaking
2385 % parameters we've set above will have an effect.
2386 \noindent
2387 %
2388 % Insert the text of the index entry. TeX will do line-breaking on it.
2389 #1%
2390 % The following is kludged to not output a line of dots in the index if
2391 % there are no page numbers. The next person who breaks this will be
2392 % cursed by a Unix daemon.
2393 \def\tempa{{\rm }}%
2394 \def\tempb{#2}%
2395 \edef\tempc{\tempa}%
2396 \edef\tempd{\tempb}%
2397 \ifx\tempc\tempd\ \else%
2398 %
2399 % If we must, put the page number on a line of its own, and fill out
2400 % this line with blank space. (The \hfil is overwhelmed with the
2401 % fill leaders glue in \indexdotfill if the page number does fit.)
2402 \hfil\penalty50
2403 \null\nobreak\indexdotfill % Have leaders before the page number.
2404 %
2405 % The `\ ' here is removed by the implicit \unskip that TeX does as
2406 % part of (the primitive) \par. Without it, a spurious underfull
2407 % \hbox ensues.
2408 \ #2% The page number ends the paragraph.
2409 \fi%
2410 \par
2411 \endgroup}
2412
2413 % Like \dotfill except takes at least 1 em.
2414 \def\indexdotfill{\cleaders
2415 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
2416
2417 \def\primary #1{\line{#1\hfil}}
2418
2419 \newskip\secondaryindent \secondaryindent=0.5cm
2420
2421 \def\secondary #1#2{
2422 {\parfillskip=0in \parskip=0in
2423 \hangindent =1in \hangafter=1
2424 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
2425 }}
2426
2427 %% Define two-column mode, which is used in indexes.
2428 %% Adapted from the TeXbook, page 416.
2429 \catcode `\@=11
2430
2431 \newbox\partialpage
2432
2433 \newdimen\doublecolumnhsize
2434
2435 \def\begindoublecolumns{\begingroup
2436 % Grab any single-column material above us.
2437 \output = {\global\setbox\partialpage
2438 =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
2439 \eject
2440 %
2441 % Now switch to the double-column output routine.
2442 \output={\doublecolumnout}%
2443 %
2444 % Change the page size parameters. We could do this once outside this
2445 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
2446 % format, but then we repeat the same computation. Repeating a couple
2447 % of assignments once per index is clearly meaningless for the
2448 % execution time, so we may as well do it once.
2449 %
2450 % First we halve the line length, less a little for the gutter between
2451 % the columns. We compute the gutter based on the line length, so it
2452 % changes automatically with the paper format. The magic constant
2453 % below is chosen so that the gutter has the same value (well, +- <
2454 % 1pt) as it did when we hard-coded it.
2455 %
2456 % We put the result in a separate register, \doublecolumhsize, so we
2457 % can restore it in \pagesofar, after \hsize itself has (potentially)
2458 % been clobbered.
2459 %
2460 \doublecolumnhsize = \hsize
2461 \advance\doublecolumnhsize by -.04154\hsize
2462 \divide\doublecolumnhsize by 2
2463 \hsize = \doublecolumnhsize
2464 %
2465 % Double the \vsize as well. (We don't need a separate register here,
2466 % since nobody clobbers \vsize.)
2467 \vsize = 2\vsize
2468 \doublecolumnpagegoal
2469 }
2470
2471 \def\enddoublecolumns{\eject \endgroup \pagegoal=\vsize \unvbox\partialpage}
2472
2473 \def\doublecolumnsplit{\splittopskip=\topskip \splitmaxdepth=\maxdepth
2474 \global\dimen@=\pageheight \global\advance\dimen@ by-\ht\partialpage
2475 \global\setbox1=\vsplit255 to\dimen@ \global\setbox0=\vbox{\unvbox1}
2476 \global\setbox3=\vsplit255 to\dimen@ \global\setbox2=\vbox{\unvbox3}
2477 \ifdim\ht0>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
2478 \ifdim\ht2>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
2479 }
2480 \def\doublecolumnpagegoal{%
2481 \dimen@=\vsize \advance\dimen@ by-2\ht\partialpage \global\pagegoal=\dimen@
2482 }
2483 \def\pagesofar{\unvbox\partialpage %
2484 \hsize=\doublecolumnhsize % have to restore this since output routine
2485 \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
2486 \def\doublecolumnout{%
2487 \setbox5=\copy255
2488 {\vbadness=10000 \doublecolumnsplit}
2489 \ifvbox255
2490 \setbox0=\vtop to\dimen@{\unvbox0}
2491 \setbox2=\vtop to\dimen@{\unvbox2}
2492 \onepageout\pagesofar \unvbox255 \penalty\outputpenalty
2493 \else
2494 \setbox0=\vbox{\unvbox5}
2495 \ifvbox0
2496 \dimen@=\ht0 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
2497 \divide\dimen@ by2 \splittopskip=\topskip \splitmaxdepth=\maxdepth
2498 {\vbadness=10000
2499 \loop \global\setbox5=\copy0
2500 \setbox1=\vsplit5 to\dimen@
2501 \setbox3=\vsplit5 to\dimen@
2502 \ifvbox5 \global\advance\dimen@ by1pt \repeat
2503 \setbox0=\vbox to\dimen@{\unvbox1}
2504 \setbox2=\vbox to\dimen@{\unvbox3}
2505 \global\setbox\partialpage=\vbox{\pagesofar}
2506 \doublecolumnpagegoal
2507 }
2508 \fi
2509 \fi
2510 }
2511
2512 \catcode `\@=\other
2513 \message{sectioning,}
2514 % Define chapters, sections, etc.
2515
2516 \newcount \chapno
2517 \newcount \secno \secno=0
2518 \newcount \subsecno \subsecno=0
2519 \newcount \subsubsecno \subsubsecno=0
2520
2521 % This counter is funny since it counts through charcodes of letters A, B, ...
2522 \newcount \appendixno \appendixno = `\@
2523 \def\appendixletter{\char\the\appendixno}
2524
2525 \newwrite \contentsfile
2526 % This is called from \setfilename.
2527 \def\opencontents{\openout \contentsfile = \jobname.toc}
2528
2529 % Each @chapter defines this as the name of the chapter.
2530 % page headings and footings can use it. @section does likewise
2531
2532 \def\thischapter{} \def\thissection{}
2533 \def\seccheck#1{\if \pageno<0 %
2534 \errmessage{@#1 not allowed after generating table of contents}\fi
2535 %
2536 }
2537
2538 \def\chapternofonts{%
2539 \let\rawbackslash=\relax%
2540 \let\frenchspacing=\relax%
2541 \def\result{\realbackslash result}
2542 \def\equiv{\realbackslash equiv}
2543 \def\expansion{\realbackslash expansion}
2544 \def\print{\realbackslash print}
2545 \def\TeX{\realbackslash TeX}
2546 \def\dots{\realbackslash dots}
2547 \def\copyright{\realbackslash copyright}
2548 \def\tt{\realbackslash tt}
2549 \def\bf{\realbackslash bf }
2550 \def\w{\realbackslash w}
2551 \def\less{\realbackslash less}
2552 \def\gtr{\realbackslash gtr}
2553 \def\hat{\realbackslash hat}
2554 \def\char{\realbackslash char}
2555 \def\tclose##1{\realbackslash tclose {##1}}
2556 \def\code##1{\realbackslash code {##1}}
2557 \def\samp##1{\realbackslash samp {##1}}
2558 \def\r##1{\realbackslash r {##1}}
2559 \def\b##1{\realbackslash b {##1}}
2560 \def\key##1{\realbackslash key {##1}}
2561 \def\file##1{\realbackslash file {##1}}
2562 \def\kbd##1{\realbackslash kbd {##1}}
2563 % These are redefined because @smartitalic wouldn't work inside xdef.
2564 \def\i##1{\realbackslash i {##1}}
2565 \def\cite##1{\realbackslash cite {##1}}
2566 \def\var##1{\realbackslash var {##1}}
2567 \def\emph##1{\realbackslash emph {##1}}
2568 \def\dfn##1{\realbackslash dfn {##1}}
2569 }
2570
2571 \newcount\absseclevel % used to calculate proper heading level
2572 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
2573
2574 % @raisesections: treat @section as chapter, @subsection as section, etc.
2575 \def\raisesections{\global\advance\secbase by -1}
2576 \let\up=\raisesections % original BFox name
2577
2578 % @lowersections: treat @chapter as section, @section as subsection, etc.
2579 \def\lowersections{\global\advance\secbase by 1}
2580 \let\down=\lowersections % original BFox name
2581
2582 % Choose a numbered-heading macro
2583 % #1 is heading level if unmodified by @raisesections or @lowersections
2584 % #2 is text for heading
2585 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2586 \ifcase\absseclevel
2587 \chapterzzz{#2}
2588 \or
2589 \seczzz{#2}
2590 \or
2591 \numberedsubseczzz{#2}
2592 \or
2593 \numberedsubsubseczzz{#2}
2594 \else
2595 \ifnum \absseclevel<0
2596 \chapterzzz{#2}
2597 \else
2598 \numberedsubsubseczzz{#2}
2599 \fi
2600 \fi
2601 }
2602
2603 % like \numhead, but chooses appendix heading levels
2604 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2605 \ifcase\absseclevel
2606 \appendixzzz{#2}
2607 \or
2608 \appendixsectionzzz{#2}
2609 \or
2610 \appendixsubseczzz{#2}
2611 \or
2612 \appendixsubsubseczzz{#2}
2613 \else
2614 \ifnum \absseclevel<0
2615 \appendixzzz{#2}
2616 \else
2617 \appendixsubsubseczzz{#2}
2618 \fi
2619 \fi
2620 }
2621
2622 % like \numhead, but chooses numberless heading levels
2623 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2624 \ifcase\absseclevel
2625 \unnumberedzzz{#2}
2626 \or
2627 \unnumberedseczzz{#2}
2628 \or
2629 \unnumberedsubseczzz{#2}
2630 \or
2631 \unnumberedsubsubseczzz{#2}
2632 \else
2633 \ifnum \absseclevel<0
2634 \unnumberedzzz{#2}
2635 \else
2636 \unnumberedsubsubseczzz{#2}
2637 \fi
2638 \fi
2639 }
2640
2641
2642 \def\thischaptername{No Chapter Title}
2643 \outer\def\chapter{\parsearg\chapteryyy}
2644 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
2645 \def\chapterzzz #1{\seccheck{chapter}%
2646 \secno=0 \subsecno=0 \subsubsecno=0
2647 \global\advance \chapno by 1 \message{\putwordChapter \the\chapno}%
2648 \chapmacro {#1}{\the\chapno}%
2649 \gdef\thissection{#1}%
2650 \gdef\thischaptername{#1}%
2651 % We don't substitute the actual chapter name into \thischapter
2652 % because we don't want its macros evaluated now.
2653 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
2654 {\chapternofonts%
2655 \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
2656 \escapechar=`\\%
2657 \write \contentsfile \temp %
2658 \donoderef %
2659 \global\let\section = \numberedsec
2660 \global\let\subsection = \numberedsubsec
2661 \global\let\subsubsection = \numberedsubsubsec
2662 }}
2663
2664 \outer\def\appendix{\parsearg\appendixyyy}
2665 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
2666 \def\appendixzzz #1{\seccheck{appendix}%
2667 \secno=0 \subsecno=0 \subsubsecno=0
2668 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
2669 \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
2670 \gdef\thissection{#1}%
2671 \gdef\thischaptername{#1}%
2672 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
2673 {\chapternofonts%
2674 \edef\temp{{\realbackslash chapentry
2675 {#1}{\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
2676 \escapechar=`\\%
2677 \write \contentsfile \temp %
2678 \appendixnoderef %
2679 \global\let\section = \appendixsec
2680 \global\let\subsection = \appendixsubsec
2681 \global\let\subsubsection = \appendixsubsubsec
2682 }}
2683
2684 % @centerchap is like @unnumbered, but the heading is centered.
2685 \outer\def\centerchap{\parsearg\centerchapyyy}
2686 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
2687
2688 \outer\def\top{\parsearg\unnumberedyyy}
2689 \outer\def\unnumbered{\parsearg\unnumberedyyy}
2690 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
2691 \def\unnumberedzzz #1{\seccheck{unnumbered}%
2692 \secno=0 \subsecno=0 \subsubsecno=0
2693 %
2694 % This used to be simply \message{#1}, but TeX fully expands the
2695 % argument to \message. Therefore, if #1 contained @-commands, TeX
2696 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
2697 % expanded @cite (which turns out to cause errors because \cite is meant
2698 % to be executed, not expanded).
2699 %
2700 % Anyway, we don't want the fully-expanded definition of @cite to appear
2701 % as a result of the \message, we just want `@cite' itself. We use
2702 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
2703 % simply yielding the contents of the <toks register>.
2704 \toks0 = {#1}\message{(\the\toks0)}%
2705 %
2706 \unnumbchapmacro {#1}%
2707 \gdef\thischapter{#1}\gdef\thissection{#1}%
2708 {\chapternofonts%
2709 \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
2710 \escapechar=`\\%
2711 \write \contentsfile \temp %
2712 \unnumbnoderef %
2713 \global\let\section = \unnumberedsec
2714 \global\let\subsection = \unnumberedsubsec
2715 \global\let\subsubsection = \unnumberedsubsubsec
2716 }}
2717
2718 \outer\def\numberedsec{\parsearg\secyyy}
2719 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
2720 \def\seczzz #1{\seccheck{section}%
2721 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
2722 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
2723 {\chapternofonts%
2724 \edef\temp{{\realbackslash secentry %
2725 {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
2726 \escapechar=`\\%
2727 \write \contentsfile \temp %
2728 \donoderef %
2729 \penalty 10000 %
2730 }}
2731
2732 \outer\def\appendixsection{\parsearg\appendixsecyyy}
2733 \outer\def\appendixsec{\parsearg\appendixsecyyy}
2734 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
2735 \def\appendixsectionzzz #1{\seccheck{appendixsection}%
2736 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
2737 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
2738 {\chapternofonts%
2739 \edef\temp{{\realbackslash secentry %
2740 {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
2741 \escapechar=`\\%
2742 \write \contentsfile \temp %
2743 \appendixnoderef %
2744 \penalty 10000 %
2745 }}
2746
2747 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
2748 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
2749 \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
2750 \plainsecheading {#1}\gdef\thissection{#1}%
2751 {\chapternofonts%
2752 \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
2753 \escapechar=`\\%
2754 \write \contentsfile \temp %
2755 \unnumbnoderef %
2756 \penalty 10000 %
2757 }}
2758
2759 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
2760 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
2761 \def\numberedsubseczzz #1{\seccheck{subsection}%
2762 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
2763 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
2764 {\chapternofonts%
2765 \edef\temp{{\realbackslash subsecentry %
2766 {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
2767 \escapechar=`\\%
2768 \write \contentsfile \temp %
2769 \donoderef %
2770 \penalty 10000 %
2771 }}
2772
2773 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
2774 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
2775 \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
2776 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
2777 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
2778 {\chapternofonts%
2779 \edef\temp{{\realbackslash subsecentry %
2780 {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
2781 \escapechar=`\\%
2782 \write \contentsfile \temp %
2783 \appendixnoderef %
2784 \penalty 10000 %
2785 }}
2786
2787 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
2788 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
2789 \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
2790 \plainsecheading {#1}\gdef\thissection{#1}%
2791 {\chapternofonts%
2792 \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
2793 \escapechar=`\\%
2794 \write \contentsfile \temp %
2795 \unnumbnoderef %
2796 \penalty 10000 %
2797 }}
2798
2799 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
2800 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
2801 \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
2802 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
2803 \subsubsecheading {#1}
2804 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
2805 {\chapternofonts%
2806 \edef\temp{{\realbackslash subsubsecentry %
2807 {#1}
2808 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
2809 {\noexpand\folio}}}%
2810 \escapechar=`\\%
2811 \write \contentsfile \temp %
2812 \donoderef %
2813 \penalty 10000 %
2814 }}
2815
2816 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
2817 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
2818 \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
2819 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
2820 \subsubsecheading {#1}
2821 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
2822 {\chapternofonts%
2823 \edef\temp{{\realbackslash subsubsecentry{#1}%
2824 {\appendixletter}
2825 {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
2826 \escapechar=`\\%
2827 \write \contentsfile \temp %
2828 \appendixnoderef %
2829 \penalty 10000 %
2830 }}
2831
2832 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
2833 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
2834 \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
2835 \plainsecheading {#1}\gdef\thissection{#1}%
2836 {\chapternofonts%
2837 \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
2838 \escapechar=`\\%
2839 \write \contentsfile \temp %
2840 \unnumbnoderef %
2841 \penalty 10000 %
2842 }}
2843
2844 % These are variants which are not "outer", so they can appear in @ifinfo.
2845 % Actually, they should now be obsolete; ordinary section commands should work.
2846 \def\infotop{\parsearg\unnumberedzzz}
2847 \def\infounnumbered{\parsearg\unnumberedzzz}
2848 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
2849 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
2850 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
2851
2852 \def\infoappendix{\parsearg\appendixzzz}
2853 \def\infoappendixsec{\parsearg\appendixseczzz}
2854 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
2855 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
2856
2857 \def\infochapter{\parsearg\chapterzzz}
2858 \def\infosection{\parsearg\sectionzzz}
2859 \def\infosubsection{\parsearg\subsectionzzz}
2860 \def\infosubsubsection{\parsearg\subsubsectionzzz}
2861
2862 % These macros control what the section commands do, according
2863 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
2864 % Define them by default for a numbered chapter.
2865 \global\let\section = \numberedsec
2866 \global\let\subsection = \numberedsubsec
2867 \global\let\subsubsection = \numberedsubsubsec
2868
2869 % Define @majorheading, @heading and @subheading
2870
2871 % NOTE on use of \vbox for chapter headings, section headings, and
2872 % such:
2873 % 1) We use \vbox rather than the earlier \line to permit
2874 % overlong headings to fold.
2875 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
2876 % heading is obnoxious; this forbids it.
2877 % 3) Likewise, headings look best if no \parindent is used, and
2878 % if justification is not attempted. Hence \raggedright.
2879
2880
2881 \def\majorheading{\parsearg\majorheadingzzz}
2882 \def\majorheadingzzz #1{%
2883 {\advance\chapheadingskip by 10pt \chapbreak }%
2884 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2885 \parindent=0pt\raggedright
2886 \rm #1\hfill}}\bigskip \par\penalty 200}
2887
2888 \def\chapheading{\parsearg\chapheadingzzz}
2889 \def\chapheadingzzz #1{\chapbreak %
2890 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2891 \parindent=0pt\raggedright
2892 \rm #1\hfill}}\bigskip \par\penalty 200}
2893
2894 \def\heading{\parsearg\secheadingi}
2895
2896 \def\subheading{\parsearg\subsecheadingi}
2897
2898 \def\subsubheading{\parsearg\subsubsecheadingi}
2899
2900 % These macros generate a chapter, section, etc. heading only
2901 % (including whitespace, linebreaking, etc. around it),
2902 % given all the information in convenient, parsed form.
2903
2904 %%% Args are the skip and penalty (usually negative)
2905 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
2906
2907 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
2908
2909 %%% Define plain chapter starts, and page on/off switching for it
2910 % Parameter controlling skip before chapter headings (if needed)
2911
2912 \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
2913
2914 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
2915 \def\chappager{\par\vfill\supereject}
2916 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
2917
2918 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
2919
2920 \def\CHAPPAGoff{
2921 \global\let\pchapsepmacro=\chapbreak
2922 \global\let\pagealignmacro=\chappager}
2923
2924 \def\CHAPPAGon{
2925 \global\let\pchapsepmacro=\chappager
2926 \global\let\pagealignmacro=\chappager
2927 \global\def\HEADINGSon{\HEADINGSsingle}}
2928
2929 \def\CHAPPAGodd{
2930 \global\let\pchapsepmacro=\chapoddpage
2931 \global\let\pagealignmacro=\chapoddpage
2932 \global\def\HEADINGSon{\HEADINGSdouble}}
2933
2934 \CHAPPAGon
2935
2936 \def\CHAPFplain{
2937 \global\let\chapmacro=\chfplain
2938 \global\let\unnumbchapmacro=\unnchfplain
2939 \global\let\centerchapmacro=\centerchfplain}
2940
2941 % #1 is the text, #2 the chapter number.
2942 \def\chfplain #1#2{%
2943 \pchapsepmacro
2944 {%
2945 \chapfonts \rm
2946 \setbox0 = \hbox{#2\enspace}%
2947 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
2948 \hangindent = \wd0
2949 \unhbox0 #1}%
2950 }%
2951 \nobreak\bigskip % no page break after a chapter title
2952 \nobreak
2953 }
2954
2955 \def\unnchfplain #1{%
2956 \pchapsepmacro %
2957 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2958 \parindent=0pt\raggedright
2959 \rm #1\hfill}}\bigskip \par\penalty 10000 %
2960 }
2961
2962 \def\centerchfplain #1{%
2963 \pchapsepmacro %
2964 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2965 \parindent=0pt
2966 {\rm #1}\hfill}}\bigskip \par\penalty 10000 %
2967 }
2968
2969 \CHAPFplain % The default
2970
2971 \def\unnchfopen #1{%
2972 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2973 \parindent=0pt\raggedright
2974 \rm #1\hfill}}\bigskip \par\penalty 10000 %
2975 }
2976
2977 \def\chfopen #1#2{\chapoddpage {\chapfonts
2978 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
2979 \par\penalty 5000 %
2980 }
2981
2982 \def\centerchfopen #1{%
2983 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2984 \parindent=0pt
2985 \hfill {\rm #1}\hfill}}\bigskip \par\penalty 10000 %
2986 }
2987
2988 \def\CHAPFopen{
2989 \global\let\chapmacro=\chfopen
2990 \global\let\unnumbchapmacro=\unnchfopen
2991 \global\let\centerchapmacro=\centerchfopen}
2992
2993
2994 % Section titles.
2995 \newskip \secheadingskip \secheadingskip = 21pt plus 8pt minus 4pt
2996 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
2997 \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
2998 \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
2999
3000 % Subsection titles.
3001 \newskip \subsecheadingskip \subsecheadingskip = 17pt plus 8pt minus 4pt
3002 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
3003 \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
3004
3005 % Subsubsection titles.
3006 \let\subsubsecheadingskip = \subsecheadingskip
3007 \let\subsubsecheadingbreak = \subsecheadingbreak
3008 \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
3009
3010
3011 % Print any size section title.
3012 %
3013 % #1 is the section type (sec/subsec/subsubsec), #2 is the section
3014 % number (maybe empty), #3 the text.
3015 \def\sectionheading#1#2#3{%
3016 {%
3017 \expandafter\advance\csname #1headingskip\endcsname by \parskip
3018 \csname #1headingbreak\endcsname
3019 }%
3020 {%
3021 \csname #1fonts\endcsname \rm
3022 \def\secnum{#2}%
3023 % Only insert the separating space if we have a section number.
3024 \setbox0 = \hbox{#2\ifx\secnum\empty\else \enspace \fi}%
3025 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3026 \hangindent = \wd0 % zero if no section number
3027 \unhbox0 #3}%
3028 }%
3029 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
3030 }
3031
3032
3033 \message{toc printing,}
3034
3035 % Finish up the main text and prepare to read what we've written
3036 % to \contentsfile.
3037
3038 \newskip\contentsrightmargin \contentsrightmargin=1in
3039 \def\startcontents#1{%
3040 \pagealignmacro
3041 \immediate\closeout \contentsfile
3042 \ifnum \pageno>0
3043 \pageno = -1 % Request roman numbered pages.
3044 \fi
3045 % Don't need to put `Contents' or `Short Contents' in the headline.
3046 % It is abundantly clear what they are.
3047 \unnumbchapmacro{#1}\def\thischapter{}%
3048 \begingroup % Set up to handle contents files properly.
3049 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
3050 \catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3051 \raggedbottom % Worry more about breakpoints than the bottom.
3052 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3053 }
3054
3055
3056 % Normal (long) toc.
3057 \outer\def\contents{%
3058 \startcontents{\putwordTableofContents}%
3059 \input \jobname.toc
3060 \endgroup
3061 \vfill \eject
3062 }
3063
3064 % And just the chapters.
3065 \outer\def\summarycontents{%
3066 \startcontents{\putwordShortContents}%
3067 %
3068 \let\chapentry = \shortchapentry
3069 \let\unnumbchapentry = \shortunnumberedentry
3070 % We want a true roman here for the page numbers.
3071 \secfonts
3072 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
3073 \rm
3074 \advance\baselineskip by 1pt % Open it up a little.
3075 \def\secentry ##1##2##3##4{}
3076 \def\unnumbsecentry ##1##2{}
3077 \def\subsecentry ##1##2##3##4##5{}
3078 \def\unnumbsubsecentry ##1##2{}
3079 \def\subsubsecentry ##1##2##3##4##5##6{}
3080 \def\unnumbsubsubsecentry ##1##2{}
3081 \input \jobname.toc
3082 \endgroup
3083 \vfill \eject
3084 }
3085 \let\shortcontents = \summarycontents
3086
3087 % These macros generate individual entries in the table of contents.
3088 % The first argument is the chapter or section name.
3089 % The last argument is the page number.
3090 % The arguments in between are the chapter number, section number, ...
3091
3092 % Chapter-level things, for both the long and short contents.
3093 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3094
3095 % See comments in \dochapentry re vbox and related settings
3096 \def\shortchapentry#1#2#3{%
3097 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
3098 }
3099
3100 % Typeset the label for a chapter or appendix for the short contents.
3101 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
3102 % We could simplify the code here by writing out an \appendixentry
3103 % command in the toc file for appendices, instead of using \chapentry
3104 % for both, but it doesn't seem worth it.
3105 \setbox0 = \hbox{\shortcontrm \putwordAppendix }
3106 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
3107
3108 \def\shortchaplabel#1{%
3109 % We typeset #1 in a box of constant width, regardless of the text of
3110 % #1, so the chapter titles will come out aligned.
3111 \setbox0 = \hbox{#1}%
3112 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3113 %
3114 % This space should be plenty, since a single number is .5em, and the
3115 % widest letter (M) is 1em, at least in the Computer Modern fonts.
3116 % (This space doesn't include the extra space that gets added after
3117 % the label; that gets put in in \shortchapentry above.)
3118 \advance\dimen0 by 1.1em
3119 \hbox to \dimen0{#1\hfil}%
3120 }
3121
3122 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3123 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
3124
3125 % Sections.
3126 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3127 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
3128
3129 % Subsections.
3130 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
3131 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
3132
3133 % And subsubsections.
3134 \def\subsubsecentry#1#2#3#4#5#6{%
3135 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
3136 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
3137
3138
3139 % This parameter controls the indentation of the various levels.
3140 \newdimen\tocindent \tocindent = 3pc
3141
3142 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
3143 % page number.
3144 %
3145 % If the toc has to be broken over pages, we would want to be at chapters
3146 % if at all possible; hence the \penalty.
3147 \def\dochapentry#1#2{%
3148 \penalty-300 \vskip\baselineskip
3149 \begingroup
3150 \chapentryfonts
3151 \tocentry{#1}{\dopageno{#2}}%
3152 \endgroup
3153 \nobreak\vskip .25\baselineskip
3154 }
3155
3156 \def\dosecentry#1#2{\begingroup
3157 \secentryfonts \leftskip=\tocindent
3158 \tocentry{#1}{\dopageno{#2}}%
3159 \endgroup}
3160
3161 \def\dosubsecentry#1#2{\begingroup
3162 \subsecentryfonts \leftskip=2\tocindent
3163 \tocentry{#1}{\dopageno{#2}}%
3164 \endgroup}
3165
3166 \def\dosubsubsecentry#1#2{\begingroup
3167 \subsubsecentryfonts \leftskip=3\tocindent
3168 \tocentry{#1}{\dopageno{#2}}%
3169 \endgroup}
3170
3171 % Final typesetting of a toc entry; we use the same \entry macro as for
3172 % the index entries, but we want to suppress hyphenation here. (We
3173 % can't do that in the \entry macro, since index entries might consist
3174 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
3175 %
3176 % \turnoffactive is for the sake of @" used for umlauts.
3177 \def\tocentry#1#2{\begingroup
3178 \hyphenpenalty = 10000
3179 \entry{\turnoffactive #1}{\turnoffactive #2}%
3180 \endgroup}
3181
3182 % Space between chapter (or whatever) number and the title.
3183 \def\labelspace{\hskip1em \relax}
3184
3185 \def\dopageno#1{{\rm #1}}
3186 \def\doshortpageno#1{{\rm #1}}
3187
3188 \def\chapentryfonts{\secfonts \rm}
3189 \def\secentryfonts{\textfonts}
3190 \let\subsecentryfonts = \textfonts
3191 \let\subsubsecentryfonts = \textfonts
3192
3193
3194 \message{environments,}
3195
3196 % Since these characters are used in examples, it should be an even number of
3197 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3198 % Furthermore, these definitions must come after we define our fonts.
3199 \newbox\dblarrowbox \newbox\longdblarrowbox
3200 \newbox\pushcharbox \newbox\bullbox
3201 \newbox\equivbox \newbox\errorbox
3202
3203 \let\ptexequiv = \equiv
3204
3205 %{\tentt
3206 %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
3207 %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
3208 %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
3209 %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
3210 % Adapted from the manmac format (p.420 of TeXbook)
3211 %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
3212 % depth .1ex\hfil}
3213 %}
3214
3215 \def\point{$\star$}
3216
3217 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3218 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
3219 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3220
3221 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3222
3223 % Adapted from the TeXbook's \boxit.
3224 {\tentt \global\dimen0 = 3em}% Width of the box.
3225 \dimen2 = .55pt % Thickness of rules
3226 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3227 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
3228
3229 \global\setbox\errorbox=\hbox to \dimen0{\hfil
3230 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3231 \advance\hsize by -2\dimen2 % Rules.
3232 \vbox{
3233 \hrule height\dimen2
3234 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3235 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3236 \kern3pt\vrule width\dimen2}% Space to right.
3237 \hrule height\dimen2}
3238 \hfil}
3239
3240 % The @error{} command.
3241 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3242
3243 % @tex ... @end tex escapes into raw Tex temporarily.
3244 % One exception: @ is still an escape character, so that @end tex works.
3245 % But \@ or @@ will get a plain tex @ character.
3246
3247 \def\tex{\begingroup
3248 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
3249 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
3250 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
3251 \catcode `\%=14
3252 \catcode 43=12
3253 \catcode`\"=12
3254 \catcode`\==12
3255 \catcode`\|=12
3256 \catcode`\<=12
3257 \catcode`\>=12
3258 \escapechar=`\\
3259 %
3260 \let\~=\ptextilde
3261 \let\{=\ptexlbrace
3262 \let\}=\ptexrbrace
3263 \let\.=\ptexdot
3264 \let\*=\ptexstar
3265 \let\dots=\ptexdots
3266 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}
3267 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}
3268 \def\@{@}%
3269 \let\bullet=\ptexbullet
3270 \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
3271 \let\L=\ptexL
3272 %
3273 \let\Etex=\endgroup}
3274
3275 % Define @lisp ... @endlisp.
3276 % @lisp does a \begingroup so it can rebind things,
3277 % including the definition of @endlisp (which normally is erroneous).
3278
3279 % Amount to narrow the margins by for @lisp.
3280 \newskip\lispnarrowing \lispnarrowing=0.4in
3281
3282 % This is the definition that ^^M gets inside @lisp, @example, and other
3283 % such environments. \null is better than a space, since it doesn't
3284 % have any width.
3285 \def\lisppar{\null\endgraf}
3286
3287 % Make each space character in the input produce a normal interword
3288 % space in the output. Don't allow a line break at this space, as this
3289 % is used only in environments like @example, where each line of input
3290 % should produce a line of output anyway.
3291 %
3292 {\obeyspaces %
3293 \gdef\sepspaces{\obeyspaces\let =\tie}}
3294
3295 % Define \obeyedspace to be our active space, whatever it is. This is
3296 % for use in \parsearg.
3297 {\sepspaces%
3298 \global\let\obeyedspace= }
3299
3300 % This space is always present above and below environments.
3301 \newskip\envskipamount \envskipamount = 0pt
3302
3303 % Make spacing and below environment symmetrical. We use \parskip here
3304 % to help in doing that, since in @example-like environments \parskip
3305 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
3306 % start of the next paragraph will insert \parskip
3307 %
3308 \def\aboveenvbreak{{\advance\envskipamount by \parskip
3309 \endgraf \ifdim\lastskip<\envskipamount
3310 \removelastskip \penalty-50 \vskip\envskipamount \fi}}
3311
3312 \let\afterenvbreak = \aboveenvbreak
3313
3314 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
3315 \let\nonarrowing=\relax
3316
3317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3318 % \cartouche: draw rectangle w/rounded corners around argument
3319 \font\circle=lcircle10
3320 \newdimen\circthick
3321 \newdimen\cartouter\newdimen\cartinner
3322 \newskip\normbskip\newskip\normpskip\newskip\normlskip
3323 \circthick=\fontdimen8\circle
3324 %
3325 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
3326 \def\ctr{{\hskip 6pt\circle\char'010}}
3327 \def\cbl{{\circle\char'012\hskip -6pt}}
3328 \def\cbr{{\hskip 6pt\circle\char'011}}
3329 \def\carttop{\hbox to \cartouter{\hskip\lskip
3330 \ctl\leaders\hrule height\circthick\hfil\ctr
3331 \hskip\rskip}}
3332 \def\cartbot{\hbox to \cartouter{\hskip\lskip
3333 \cbl\leaders\hrule height\circthick\hfil\cbr
3334 \hskip\rskip}}
3335 %
3336 \newskip\lskip\newskip\rskip
3337
3338 \long\def\cartouche{%
3339 \begingroup
3340 \lskip=\leftskip \rskip=\rightskip
3341 \leftskip=0pt\rightskip=0pt %we want these *outside*.
3342 \cartinner=\hsize \advance\cartinner by-\lskip
3343 \advance\cartinner by-\rskip
3344 \cartouter=\hsize
3345 \advance\cartouter by 18pt % allow for 3pt kerns on either
3346 % side, and for 6pt waste from
3347 % each corner char
3348 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
3349 % Flag to tell @lisp, etc., not to narrow margin.
3350 \let\nonarrowing=\comment
3351 \vbox\bgroup
3352 \baselineskip=0pt\parskip=0pt\lineskip=0pt
3353 \carttop
3354 \hbox\bgroup
3355 \hskip\lskip
3356 \vrule\kern3pt
3357 \vbox\bgroup
3358 \hsize=\cartinner
3359 \kern3pt
3360 \begingroup
3361 \baselineskip=\normbskip
3362 \lineskip=\normlskip
3363 \parskip=\normpskip
3364 \vskip -\parskip
3365 \def\Ecartouche{%
3366 \endgroup
3367 \kern3pt
3368 \egroup
3369 \kern3pt\vrule
3370 \hskip\rskip
3371 \egroup
3372 \cartbot
3373 \egroup
3374 \endgroup
3375 }}
3376
3377
3378 % This macro is called at the beginning of all the @example variants,
3379 % inside a group.
3380 \def\nonfillstart{%
3381 \aboveenvbreak
3382 \inENV % This group ends at the end of the body
3383 \hfuzz = 12pt % Don't be fussy
3384 \sepspaces % Make spaces be word-separators rather than space tokens.
3385 \singlespace
3386 \let\par = \lisppar % don't ignore blank lines
3387 \obeylines % each line of input is a line of output
3388 \parskip = 0pt
3389 \parindent = 0pt
3390 \emergencystretch = 0pt % don't try to avoid overfull boxes
3391 % @cartouche defines \nonarrowing to inhibit narrowing
3392 % at next level down.
3393 \ifx\nonarrowing\relax
3394 \advance \leftskip by \lispnarrowing
3395 \exdentamount=\lispnarrowing
3396 \let\exdent=\nofillexdent
3397 \let\nonarrowing=\relax
3398 \fi
3399 }
3400
3401 % To ending an @example-like environment, we first end the paragraph
3402 % (via \afterenvbreak's vertical glue), and then the group. That way we
3403 % keep the zero \parskip that the environments set -- \parskip glue
3404 % will be inserted at the beginning of the next paragraph in the
3405 % document, after the environment.
3406 %
3407 \def\nonfillfinish{\afterenvbreak\endgroup}%
3408
3409 % This macro is
3410 \def\lisp{\begingroup
3411 \nonfillstart
3412 \let\Elisp = \nonfillfinish
3413 \tt
3414 \rawbackslash % have \ input char produce \ char from current font
3415 \gobble
3416 }
3417
3418 % Define the \E... control sequence only if we are inside the
3419 % environment, so the error checking in \end will work.
3420 %
3421 % We must call \lisp last in the definition, since it reads the
3422 % return following the @example (or whatever) command.
3423 %
3424 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
3425 \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
3426 \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
3427
3428 % @smallexample and @smalllisp. This is not used unless the @smallbook
3429 % command is given. Originally contributed by Pavel@xerox.
3430 %
3431 \def\smalllispx{\begingroup
3432 \nonfillstart
3433 \let\Esmalllisp = \nonfillfinish
3434 \let\Esmallexample = \nonfillfinish
3435 %
3436 % Smaller interline space and fonts for small examples.
3437 \setleading{10pt}%
3438 \indexfonts \tt
3439 \rawbackslash % make \ output the \ character from the current font (tt)
3440 \gobble
3441 }
3442
3443 % This is @display; same as @lisp except use roman font.
3444 %
3445 \def\display{\begingroup
3446 \nonfillstart
3447 \let\Edisplay = \nonfillfinish
3448 \gobble
3449 }
3450
3451 % This is @format; same as @display except don't narrow margins.
3452 %
3453 \def\format{\begingroup
3454 \let\nonarrowing = t
3455 \nonfillstart
3456 \let\Eformat = \nonfillfinish
3457 \gobble
3458 }
3459
3460 % @flushleft (same as @format) and @flushright.
3461 %
3462 \def\flushleft{\begingroup
3463 \let\nonarrowing = t
3464 \nonfillstart
3465 \let\Eflushleft = \nonfillfinish
3466 \gobble
3467 }
3468 \def\flushright{\begingroup
3469 \let\nonarrowing = t
3470 \nonfillstart
3471 \let\Eflushright = \nonfillfinish
3472 \advance\leftskip by 0pt plus 1fill
3473 \gobble}
3474
3475 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
3476 % and narrows the margins.
3477 %
3478 \def\quotation{%
3479 \begingroup\inENV %This group ends at the end of the @quotation body
3480 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
3481 \singlespace
3482 \parindent=0pt
3483 % We have retained a nonzero parskip for the environment, since we're
3484 % doing normal filling. So to avoid extra space below the environment...
3485 \def\Equotation{\parskip = 0pt \nonfillfinish}%
3486 %
3487 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
3488 \ifx\nonarrowing\relax
3489 \advance\leftskip by \lispnarrowing
3490 \advance\rightskip by \lispnarrowing
3491 \exdentamount = \lispnarrowing
3492 \let\nonarrowing = \relax
3493 \fi
3494 }
3495
3496 \message{defuns,}
3497 % Define formatter for defuns
3498 % First, allow user to change definition object font (\df) internally
3499 \def\setdeffont #1 {\csname DEF#1\endcsname}
3500
3501 \newskip\defbodyindent \defbodyindent=.4in
3502 \newskip\defargsindent \defargsindent=50pt
3503 \newskip\deftypemargin \deftypemargin=12pt
3504 \newskip\deflastargmargin \deflastargmargin=18pt
3505
3506 \newcount\parencount
3507 % define \functionparens, which makes ( and ) and & do special things.
3508 % \functionparens affects the group it is contained in.
3509 \def\activeparens{%
3510 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
3511 \catcode`\[=\active \catcode`\]=\active}
3512
3513 % Make control sequences which act like normal parenthesis chars.
3514 \let\lparen = ( \let\rparen = )
3515
3516 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
3517
3518 % Be sure that we always have a definition for `(', etc. For example,
3519 % if the fn name has parens in it, \boldbrax will not be in effect yet,
3520 % so TeX would otherwise complain about undefined control sequence.
3521 \global\let(=\lparen \global\let)=\rparen
3522 \global\let[=\lbrack \global\let]=\rbrack
3523
3524 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
3525 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
3526 % This is used to turn on special parens
3527 % but make & act ordinary (given that it's active).
3528 \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
3529
3530 % Definitions of (, ) and & used in args for functions.
3531 % This is the definition of ( outside of all parentheses.
3532 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
3533 \global\advance\parencount by 1 }
3534 %
3535 % This is the definition of ( when already inside a level of parens.
3536 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
3537 %
3538 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
3539 % also in that case restore the outer-level definition of (.
3540 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
3541 \global\advance \parencount by -1 }
3542 % If we encounter &foo, then turn on ()-hacking afterwards
3543 \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
3544 %
3545 \gdef\normalparens{\boldbrax\let&=\ampnr}
3546 } % End of definition inside \activeparens
3547 %% These parens (in \boldbrax) actually are a little bolder than the
3548 %% contained text. This is especially needed for [ and ]
3549 \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
3550 \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
3551
3552 % First, defname, which formats the header line itself.
3553 % #1 should be the function name.
3554 % #2 should be the type of definition, such as "Function".
3555
3556 \def\defname #1#2{%
3557 % Get the values of \leftskip and \rightskip as they were
3558 % outside the @def...
3559 \dimen2=\leftskip
3560 \advance\dimen2 by -\defbodyindent
3561 \dimen3=\rightskip
3562 \advance\dimen3 by -\defbodyindent
3563 \noindent %
3564 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
3565 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
3566 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
3567 \parshape 2 0in \dimen0 \defargsindent \dimen1 %
3568 % Now output arg 2 ("Function" or some such)
3569 % ending at \deftypemargin from the right margin,
3570 % but stuck inside a box of width 0 so it does not interfere with linebreaking
3571 {% Adjust \hsize to exclude the ambient margins,
3572 % so that \rightline will obey them.
3573 \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
3574 \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
3575 % Make all lines underfull and no complaints:
3576 \tolerance=10000 \hbadness=10000
3577 \advance\leftskip by -\defbodyindent
3578 \exdentamount=\defbodyindent
3579 {\df #1}\enskip % Generate function name
3580 }
3581
3582 % Actually process the body of a definition
3583 % #1 should be the terminating control sequence, such as \Edefun.
3584 % #2 should be the "another name" control sequence, such as \defunx.
3585 % #3 should be the control sequence that actually processes the header,
3586 % such as \defunheader.
3587
3588 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3589 \medbreak %
3590 % Define the end token that this defining construct specifies
3591 % so that it will exit this group.
3592 \def#1{\endgraf\endgroup\medbreak}%
3593 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
3594 \parindent=0in
3595 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3596 \exdentamount=\defbodyindent
3597 \begingroup %
3598 \catcode 61=\active % 61 is `='
3599 \obeylines\activeparens\spacesplit#3}
3600
3601 \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
3602 \medbreak %
3603 % Define the end token that this defining construct specifies
3604 % so that it will exit this group.
3605 \def#1{\endgraf\endgroup\medbreak}%
3606 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
3607 \parindent=0in
3608 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3609 \exdentamount=\defbodyindent
3610 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
3611
3612 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
3613 \medbreak %
3614 % Define the end token that this defining construct specifies
3615 % so that it will exit this group.
3616 \def#1{\endgraf\endgroup\medbreak}%
3617 \def#2##1 ##2 {\def#4{##1}%
3618 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
3619 \parindent=0in
3620 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3621 \exdentamount=\defbodyindent
3622 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
3623
3624 % These parsing functions are similar to the preceding ones
3625 % except that they do not make parens into active characters.
3626 % These are used for "variables" since they have no arguments.
3627
3628 \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3629 \medbreak %
3630 % Define the end token that this defining construct specifies
3631 % so that it will exit this group.
3632 \def#1{\endgraf\endgroup\medbreak}%
3633 \def#2{\begingroup\obeylines\spacesplit#3}%
3634 \parindent=0in
3635 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3636 \exdentamount=\defbodyindent
3637 \begingroup %
3638 \catcode 61=\active %
3639 \obeylines\spacesplit#3}
3640
3641 % This is used for \def{tp,vr}parsebody. It could probably be used for
3642 % some of the others, too, with some judicious conditionals.
3643 %
3644 \def\parsebodycommon#1#2#3{%
3645 \begingroup\inENV %
3646 \medbreak %
3647 % Define the end token that this defining construct specifies
3648 % so that it will exit this group.
3649 \def#1{\endgraf\endgroup\medbreak}%
3650 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
3651 \parindent=0in
3652 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3653 \exdentamount=\defbodyindent
3654 \begingroup\obeylines
3655 }
3656
3657 \def\defvrparsebody#1#2#3#4 {%
3658 \parsebodycommon{#1}{#2}{#3}%
3659 \spacesplit{#3{#4}}%
3660 }
3661
3662 % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
3663 % type is just `struct', because we lose the braces in `{struct
3664 % termios}' when \spacesplit reads its undelimited argument. Sigh.
3665 % \let\deftpparsebody=\defvrparsebody
3666 %
3667 % So, to get around this, we put \empty in with the type name. That
3668 % way, TeX won't find exactly `{...}' as an undelimited argument, and
3669 % won't strip off the braces.
3670 %
3671 \def\deftpparsebody #1#2#3#4 {%
3672 \parsebodycommon{#1}{#2}{#3}%
3673 \spacesplit{\parsetpheaderline{#3{#4}}}\empty
3674 }
3675
3676 % Fine, but then we have to eventually remove the \empty *and* the
3677 % braces (if any). That's what this does, putting the result in \tptemp.
3678 %
3679 \def\removeemptybraces\empty#1\relax{\def\tptemp{#1}}%
3680
3681 % After \spacesplit has done its work, this is called -- #1 is the final
3682 % thing to call, #2 the type name (which starts with \empty), and #3
3683 % (which might be empty) the arguments.
3684 %
3685 \def\parsetpheaderline#1#2#3{%
3686 \removeemptybraces#2\relax
3687 #1{\tptemp}{#3}%
3688 }%
3689
3690 \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
3691 \medbreak %
3692 % Define the end token that this defining construct specifies
3693 % so that it will exit this group.
3694 \def#1{\endgraf\endgroup\medbreak}%
3695 \def#2##1 ##2 {\def#4{##1}%
3696 \begingroup\obeylines\spacesplit{#3{##2}}}%
3697 \parindent=0in
3698 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3699 \exdentamount=\defbodyindent
3700 \begingroup\obeylines\spacesplit{#3{#5}}}
3701
3702 % Split up #2 at the first space token.
3703 % call #1 with two arguments:
3704 % the first is all of #2 before the space token,
3705 % the second is all of #2 after that space token.
3706 % If #2 contains no space token, all of it is passed as the first arg
3707 % and the second is passed as empty.
3708
3709 {\obeylines
3710 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
3711 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
3712 \ifx\relax #3%
3713 #1{#2}{}\else #1{#2}{#3#4}\fi}}
3714
3715 % So much for the things common to all kinds of definitions.
3716
3717 % Define @defun.
3718
3719 % First, define the processing that is wanted for arguments of \defun
3720 % Use this to expand the args and terminate the paragraph they make up
3721
3722 \def\defunargs #1{\functionparens \sl
3723 % Expand, preventing hyphenation at `-' chars.
3724 % Note that groups don't affect changes in \hyphenchar.
3725 \hyphenchar\tensl=0
3726 #1%
3727 \hyphenchar\tensl=45
3728 \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
3729 \interlinepenalty=10000
3730 \advance\rightskip by 0pt plus 1fil
3731 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
3732 }
3733
3734 \def\deftypefunargs #1{%
3735 % Expand, preventing hyphenation at `-' chars.
3736 % Note that groups don't affect changes in \hyphenchar.
3737 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
3738 \boldbraxnoamp
3739 \tclose{#1}% avoid \code because of side effects on active chars
3740 \interlinepenalty=10000
3741 \advance\rightskip by 0pt plus 1fil
3742 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
3743 }
3744
3745 % Do complete processing of one @defun or @defunx line already parsed.
3746
3747 % @deffn Command forward-char nchars
3748
3749 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
3750
3751 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
3752 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
3753 \catcode 61=\other % Turn off change made in \defparsebody
3754 }
3755
3756 % @defun == @deffn Function
3757
3758 \def\defun{\defparsebody\Edefun\defunx\defunheader}
3759
3760 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3761 \begingroup\defname {#1}{Function}%
3762 \defunargs {#2}\endgroup %
3763 \catcode 61=\other % Turn off change made in \defparsebody
3764 }
3765
3766 % @deftypefun int foobar (int @var{foo}, float @var{bar})
3767
3768 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
3769
3770 % #1 is the data type. #2 is the name and args.
3771 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
3772 % #1 is the data type, #2 the name, #3 the args.
3773 \def\deftypefunheaderx #1#2 #3\relax{%
3774 \doind {fn}{\code{#2}}% Make entry in function index
3775 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
3776 \deftypefunargs {#3}\endgroup %
3777 \catcode 61=\other % Turn off change made in \defparsebody
3778 }
3779
3780 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
3781
3782 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
3783
3784 % \defheaderxcond#1\relax$$$
3785 % puts #1 in @code, followed by a space, but does nothing if #1 is null.
3786 \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
3787
3788 % #1 is the classification. #2 is the data type. #3 is the name and args.
3789 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
3790 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
3791 \def\deftypefnheaderx #1#2#3 #4\relax{%
3792 \doind {fn}{\code{#3}}% Make entry in function index
3793 \begingroup
3794 \normalparens % notably, turn off `&' magic, which prevents
3795 % at least some C++ text from working
3796 \defname {\defheaderxcond#2\relax$$$#3}{#1}%
3797 \deftypefunargs {#4}\endgroup %
3798 \catcode 61=\other % Turn off change made in \defparsebody
3799 }
3800
3801 % @defmac == @deffn Macro
3802
3803 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
3804
3805 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3806 \begingroup\defname {#1}{Macro}%
3807 \defunargs {#2}\endgroup %
3808 \catcode 61=\other % Turn off change made in \defparsebody
3809 }
3810
3811 % @defspec == @deffn Special Form
3812
3813 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
3814
3815 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3816 \begingroup\defname {#1}{Special Form}%
3817 \defunargs {#2}\endgroup %
3818 \catcode 61=\other % Turn off change made in \defparsebody
3819 }
3820
3821 % This definition is run if you use @defunx
3822 % anywhere other than immediately after a @defun or @defunx.
3823
3824 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
3825 \def\defunx #1 {\errmessage{@defunx in invalid context}}
3826 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
3827 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
3828 \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
3829 \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
3830
3831 % @defmethod, and so on
3832
3833 % @defop {Funny Method} foo-class frobnicate argument
3834
3835 \def\defop #1 {\def\defoptype{#1}%
3836 \defopparsebody\Edefop\defopx\defopheader\defoptype}
3837
3838 \def\defopheader #1#2#3{%
3839 \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
3840 \begingroup\defname {#2}{\defoptype{} on #1}%
3841 \defunargs {#3}\endgroup %
3842 }
3843
3844 % @defmethod == @defop Method
3845
3846 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
3847
3848 \def\defmethodheader #1#2#3{%
3849 \dosubind {fn}{\code{#2}}{on #1}% entry in function index
3850 \begingroup\defname {#2}{Method on #1}%
3851 \defunargs {#3}\endgroup %
3852 }
3853
3854 % @defcv {Class Option} foo-class foo-flag
3855
3856 \def\defcv #1 {\def\defcvtype{#1}%
3857 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
3858
3859 \def\defcvarheader #1#2#3{%
3860 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
3861 \begingroup\defname {#2}{\defcvtype{} of #1}%
3862 \defvarargs {#3}\endgroup %
3863 }
3864
3865 % @defivar == @defcv {Instance Variable}
3866
3867 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
3868
3869 \def\defivarheader #1#2#3{%
3870 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
3871 \begingroup\defname {#2}{Instance Variable of #1}%
3872 \defvarargs {#3}\endgroup %
3873 }
3874
3875 % These definitions are run if you use @defmethodx, etc.,
3876 % anywhere other than immediately after a @defmethod, etc.
3877
3878 \def\defopx #1 {\errmessage{@defopx in invalid context}}
3879 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
3880 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
3881 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
3882
3883 % Now @defvar
3884
3885 % First, define the processing that is wanted for arguments of @defvar.
3886 % This is actually simple: just print them in roman.
3887 % This must expand the args and terminate the paragraph they make up
3888 \def\defvarargs #1{\normalparens #1%
3889 \interlinepenalty=10000
3890 \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
3891
3892 % @defvr Counter foo-count
3893
3894 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
3895
3896 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
3897 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
3898
3899 % @defvar == @defvr Variable
3900
3901 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
3902
3903 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
3904 \begingroup\defname {#1}{Variable}%
3905 \defvarargs {#2}\endgroup %
3906 }
3907
3908 % @defopt == @defvr {User Option}
3909
3910 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
3911
3912 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
3913 \begingroup\defname {#1}{User Option}%
3914 \defvarargs {#2}\endgroup %
3915 }
3916
3917 % @deftypevar int foobar
3918
3919 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
3920
3921 % #1 is the data type. #2 is the name.
3922 \def\deftypevarheader #1#2{%
3923 \doind {vr}{\code{#2}}% Make entry in variables index
3924 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
3925 \interlinepenalty=10000
3926 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
3927 \endgroup}
3928
3929 % @deftypevr {Global Flag} int enable
3930
3931 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
3932
3933 \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
3934 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
3935 \interlinepenalty=10000
3936 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
3937 \endgroup}
3938
3939 % This definition is run if you use @defvarx
3940 % anywhere other than immediately after a @defvar or @defvarx.
3941
3942 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
3943 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
3944 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
3945 \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
3946 \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
3947
3948 % Now define @deftp
3949 % Args are printed in bold, a slight difference from @defvar.
3950
3951 \def\deftpargs #1{\bf \defvarargs{#1}}
3952
3953 % @deftp Class window height width ...
3954
3955 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
3956
3957 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
3958 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
3959
3960 % This definition is run if you use @deftpx, etc
3961 % anywhere other than immediately after a @deftp, etc.
3962
3963 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
3964
3965 \message{cross reference,}
3966 % Define cross-reference macros
3967 \newwrite \auxfile
3968
3969 \newif\ifhavexrefs % True if xref values are known.
3970 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
3971
3972 % \setref{foo} defines a cross-reference point named foo.
3973
3974 \def\setref#1{%
3975 \dosetq{#1-title}{Ytitle}%
3976 \dosetq{#1-pg}{Ypagenumber}%
3977 \dosetq{#1-snt}{Ysectionnumberandtype}}
3978
3979 \def\unnumbsetref#1{%
3980 \dosetq{#1-title}{Ytitle}%
3981 \dosetq{#1-pg}{Ypagenumber}%
3982 \dosetq{#1-snt}{Ynothing}}
3983
3984 \def\appendixsetref#1{%
3985 \dosetq{#1-title}{Ytitle}%
3986 \dosetq{#1-pg}{Ypagenumber}%
3987 \dosetq{#1-snt}{Yappendixletterandtype}}
3988
3989 % \xref, \pxref, and \ref generate cross-references to specified points.
3990 % For \xrefX, #1 is the node name, #2 the name of the Info
3991 % cross-reference, #3 the printed node name, #4 the name of the Info
3992 % file, #5 the name of the printed manual. All but the node name can be
3993 % omitted.
3994 %
3995 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
3996 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
3997 \def\ref#1{\xrefX[#1,,,,,,,]}
3998 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
3999 \def\printedmanual{\ignorespaces #5}%
4000 \def\printednodename{\ignorespaces #3}%
4001 \setbox1=\hbox{\printedmanual}%
4002 \setbox0=\hbox{\printednodename}%
4003 \ifdim \wd0 = 0pt
4004 % No printed node name was explicitly given.
4005 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
4006 % Use the node name inside the square brackets.
4007 \def\printednodename{\ignorespaces #1}%
4008 \else
4009 % Use the actual chapter/section title appear inside
4010 % the square brackets. Use the real section title if we have it.
4011 \ifdim \wd1>0pt%
4012 % It is in another manual, so we don't have it.
4013 \def\printednodename{\ignorespaces #1}%
4014 \else
4015 \ifhavexrefs
4016 % We know the real title if we have the xref values.
4017 \def\printednodename{\refx{#1-title}{}}%
4018 \else
4019 % Otherwise just copy the Info node name.
4020 \def\printednodename{\ignorespaces #1}%
4021 \fi%
4022 \fi
4023 \fi
4024 \fi
4025 %
4026 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
4027 % insert empty discretionaries after hyphens, which means that it will
4028 % not find a line break at a hyphen in a node names. Since some manuals
4029 % are best written with fairly long node names, containing hyphens, this
4030 % is a loss. Therefore, we give the text of the node name again, so it
4031 % is as if TeX is seeing it for the first time.
4032 \ifdim \wd1 > 0pt
4033 \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
4034 \else
4035 % _ (for example) has to be the character _ for the purposes of the
4036 % control sequence corresponding to the node, but it has to expand
4037 % into the usual \leavevmode...\vrule stuff for purposes of
4038 % printing. So we \turnoffactive for the \refx-snt, back on for the
4039 % printing, back off for the \refx-pg.
4040 {\turnoffactive \refx{#1-snt}{}}%
4041 \space [\printednodename],\space
4042 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
4043 \fi
4044 \endgroup}
4045
4046 % \dosetq is the interface for calls from other macros
4047
4048 % Use \turnoffactive so that punctuation chars such as underscore
4049 % work in node names.
4050 \def\dosetq #1#2{{\let\folio=0 \turnoffactive \auxhat%
4051 \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
4052 \next}}
4053
4054 % \internalsetq {foo}{page} expands into
4055 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
4056 % When the aux file is read, ' is the escape character
4057
4058 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
4059
4060 % Things to be expanded by \internalsetq
4061
4062 \def\Ypagenumber{\folio}
4063
4064 \def\Ytitle{\thissection}
4065
4066 \def\Ynothing{}
4067
4068 \def\Ysectionnumberandtype{%
4069 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
4070 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
4071 \else \ifnum \subsubsecno=0 %
4072 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
4073 \else %
4074 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
4075 \fi \fi \fi }
4076
4077 \def\Yappendixletterandtype{%
4078 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
4079 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
4080 \else \ifnum \subsubsecno=0 %
4081 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
4082 \else %
4083 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
4084 \fi \fi \fi }
4085
4086 \gdef\xreftie{'tie}
4087
4088 % Use TeX 3.0's \inputlineno to get the line number, for better error
4089 % messages, but if we're using an old version of TeX, don't do anything.
4090 %
4091 \ifx\inputlineno\thisisundefined
4092 \let\linenumber = \empty % Non-3.0.
4093 \else
4094 \def\linenumber{\the\inputlineno:\space}
4095 \fi
4096
4097 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
4098 % If its value is nonempty, SUFFIX is output afterward.
4099
4100 \def\refx#1#2{%
4101 \expandafter\ifx\csname X#1\endcsname\relax
4102 % If not defined, say something at least.
4103 $\langle$un\-de\-fined$\rangle$%
4104 \ifhavexrefs
4105 \message{\linenumber Undefined cross reference `#1'.}%
4106 \else
4107 \ifwarnedxrefs\else
4108 \global\warnedxrefstrue
4109 \message{Cross reference values unknown; you must run TeX again.}%
4110 \fi
4111 \fi
4112 \else
4113 % It's defined, so just use it.
4114 \csname X#1\endcsname
4115 \fi
4116 #2% Output the suffix in any case.
4117 }
4118
4119 % Read the last existing aux file, if any. No error if none exists.
4120
4121 % This is the macro invoked by entries in the aux file.
4122 \def\xrdef #1#2{
4123 {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
4124
4125 \def\readauxfile{%
4126 \begingroup
4127 \catcode `\^^@=\other
4128 \catcode `\\ 1=\other
4129 \catcode `\\ 2=\other
4130 \catcode `\^^C=\other
4131 \catcode `\^^D=\other
4132 \catcode `\^^E=\other
4133 \catcode `\^^F=\other
4134 \catcode `\^^G=\other
4135 \catcode `\^^H=\other
4136 \catcode `\\v=\other
4137 \catcode `\^^L=\other
4138 \catcode `\\ e=\other
4139 \catcode `\\ f=\other
4140 \catcode `\\10=\other
4141 \catcode `\\11=\other
4142 \catcode `\\12=\other
4143 \catcode `\\13=\other
4144 \catcode `\\14=\other
4145 \catcode `\\15=\other
4146 \catcode `\\16=\other
4147 \catcode `\\17=\other
4148 \catcode `\\18=\other
4149 \catcode `\\19=\other
4150 \catcode 26=\other
4151 \catcode `\^^[=\other
4152 \catcode `\^^\=\other
4153 \catcode `\^^]=\other
4154 \catcode `\^^^=\other
4155 \catcode `\^^_=\other
4156 \catcode `\@=\other
4157 \catcode `\^=\other
4158 \catcode `\~=\other
4159 \catcode `\[=\other
4160 \catcode `\]=\other
4161 \catcode`\"=\other
4162 \catcode`\_=\other
4163 \catcode`\|=\other
4164 \catcode`\<=\other
4165 \catcode`\>=\other
4166 \catcode `\$=\other
4167 \catcode `\#=\other
4168 \catcode `\&=\other
4169 % `\+ does not work, so use 43.
4170 \catcode 43=\other
4171 % Make the characters 128-255 be printing characters
4172 {%
4173 \count 1=128
4174 \def\loop{%
4175 \catcode\count 1=\other
4176 \advance\count 1 by 1
4177 \ifnum \count 1<256 \loop \fi
4178 }%
4179 }%
4180 % the aux file uses ' as the escape.
4181 % Turn off \ as an escape so we do not lose on
4182 % entries which were dumped with control sequences in their names.
4183 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
4184 % Reference to such entries still does not work the way one would wish,
4185 % but at least they do not bomb out when the aux file is read in.
4186 \catcode `\{=1 \catcode `\}=2
4187 \catcode `\%=\other
4188 \catcode `\'=0
4189 \catcode`\^=7 % to make ^^e4 etc usable in xref tags
4190 \catcode `\\=\other
4191 \openin 1 \jobname.aux
4192 \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
4193 \global\warnedobstrue
4194 \fi
4195 % Open the new aux file. Tex will close it automatically at exit.
4196 \openout \auxfile=\jobname.aux
4197 \endgroup}
4198
4199
4200 % Footnotes.
4201
4202 \newcount \footnoteno
4203
4204 % The trailing space in the following definition for supereject is
4205 % vital for proper filling; pages come out unaligned when you do a
4206 % pagealignmacro call if that space before the closing brace is
4207 % removed.
4208 \def\supereject{\par\penalty -20000\footnoteno =0 }
4209
4210 % @footnotestyle is meaningful for info output only..
4211 \let\footnotestyle=\comment
4212
4213 \let\ptexfootnote=\footnote
4214
4215 {\catcode `\@=11
4216 %
4217 % Auto-number footnotes. Otherwise like plain.
4218 \gdef\footnote{%
4219 \global\advance\footnoteno by \@ne
4220 \edef\thisfootno{$^{\the\footnoteno}$}%
4221 %
4222 % In case the footnote comes at the end of a sentence, preserve the
4223 % extra spacing after we do the footnote number.
4224 \let\@sf\empty
4225 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
4226 %
4227 % Remove inadvertent blank space before typesetting the footnote number.
4228 \unskip
4229 \thisfootno\@sf
4230 \footnotezzz
4231 }%
4232
4233 % Don't bother with the trickery in plain.tex to not require the
4234 % footnote text as a parameter. Our footnotes don't need to be so general.
4235 %
4236 \long\gdef\footnotezzz#1{\insert\footins{%
4237 % We want to typeset this text as a normal paragraph, even if the
4238 % footnote reference occurs in (for example) a display environment.
4239 % So reset some parameters.
4240 \interlinepenalty\interfootnotelinepenalty
4241 \splittopskip\ht\strutbox % top baseline for broken footnotes
4242 \splitmaxdepth\dp\strutbox
4243 \floatingpenalty\@MM
4244 \leftskip\z@skip
4245 \rightskip\z@skip
4246 \spaceskip\z@skip
4247 \xspaceskip\z@skip
4248 \parindent\defaultparindent
4249 %
4250 % Hang the footnote text off the number.
4251 \hang
4252 \textindent{\thisfootno}%
4253 %
4254 % Don't crash into the line above the footnote text. Since this
4255 % expands into a box, it must come within the paragraph, lest it
4256 % provide a place where TeX can split the footnote.
4257 \footstrut
4258 #1\strut}%
4259 }
4260
4261 }%end \catcode `\@=11
4262
4263 % Set the baselineskip to #1, and the lineskip and strut size
4264 % correspondingly. There is no deep meaning behind these magic numbers
4265 % used as factors; they just match (closely enough) what Knuth defined.
4266 %
4267 \def\lineskipfactor{.08333}
4268 \def\strutheightpercent{.70833}
4269 \def\strutdepthpercent {.29167}
4270 %
4271 \def\setleading#1{%
4272 \normalbaselineskip = #1\relax
4273 \normallineskip = \lineskipfactor\normalbaselineskip
4274 \normalbaselines
4275 \setbox\strutbox =\hbox{%
4276 \vrule width0pt height\strutheightpercent\baselineskip
4277 depth \strutdepthpercent \baselineskip
4278 }%
4279 }
4280
4281 % @| inserts a changebar to the left of the current line. It should
4282 % surround any changed text. This approach does *not* work if the
4283 % change spans more than two lines of output. To handle that, we would
4284 % have adopt a much more difficult approach (putting marks into the main
4285 % vertical list for the beginning and end of each change).
4286 %
4287 \def\|{%
4288 % \vadjust can only be used in horizontal mode.
4289 \leavevmode
4290 %
4291 % Append this vertical mode material after the current line in the output.
4292 \vadjust{%
4293 % We want to insert a rule with the height and depth of the current
4294 % leading; that is exactly what \strutbox is supposed to record.
4295 \vskip-\baselineskip
4296 %
4297 % \vadjust-items are inserted at the left edge of the type. So
4298 % the \llap here moves out into the left-hand margin.
4299 \llap{%
4300 %
4301 % For a thicker or thinner bar, change the `1pt'.
4302 \vrule height\baselineskip width1pt
4303 %
4304 % This is the space between the bar and the text.
4305 \hskip 12pt
4306 }%
4307 }%
4308 }
4309
4310 % For a final copy, take out the rectangles
4311 % that mark overfull boxes (in case you have decided
4312 % that the text looks ok even though it passes the margin).
4313 %
4314 \def\finalout{\overfullrule=0pt}
4315
4316
4317 % End of control word definitions.
4318
4319 \message{and turning on texinfo input format.}
4320
4321 \def\openindices{%
4322 \newindex{cp}%
4323 \newcodeindex{fn}%
4324 \newcodeindex{vr}%
4325 \newcodeindex{tp}%
4326 \newcodeindex{ky}%
4327 \newcodeindex{pg}%
4328 }
4329
4330 % Set some numeric style parameters, for 8.5 x 11 format.
4331
4332 %\hsize = 6.5in
4333 \newdimen\defaultparindent \defaultparindent = 15pt
4334 \parindent = \defaultparindent
4335 \parskip 18pt plus 1pt
4336 \setleading{15pt}
4337 \advance\topskip by 1.2cm
4338
4339 % Prevent underfull vbox error messages.
4340 \vbadness=10000
4341
4342 % Following George Bush, just get rid of widows and orphans.
4343 \widowpenalty=10000
4344 \clubpenalty=10000
4345
4346 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
4347 % using an old version of TeX, don't do anything. We want the amount of
4348 % stretch added to depend on the line length, hence the dependence on
4349 % \hsize. This makes it come to about 9pt for the 8.5x11 format.
4350 %
4351 \ifx\emergencystretch\thisisundefined
4352 % Allow us to assign to \emergencystretch anyway.
4353 \def\emergencystretch{\dimen0}%
4354 \else
4355 \emergencystretch = \hsize
4356 \divide\emergencystretch by 45
4357 \fi
4358
4359 % Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25)
4360 \def\smallbook{
4361
4362 % These values for secheadingskip and subsecheadingskip are
4363 % experiments. RJC 7 Aug 1992
4364 \global\secheadingskip = 17pt plus 6pt minus 3pt
4365 \global\subsecheadingskip = 14pt plus 6pt minus 3pt
4366
4367 \global\lispnarrowing = 0.3in
4368 \setleading{12pt}
4369 \advance\topskip by -1cm
4370 \global\parskip 3pt plus 1pt
4371 \global\hsize = 5in
4372 \global\vsize=7.5in
4373 \global\tolerance=700
4374 \global\hfuzz=1pt
4375 \global\contentsrightmargin=0pt
4376 \global\deftypemargin=0pt
4377 \global\defbodyindent=.5cm
4378
4379 \global\pagewidth=\hsize
4380 \global\pageheight=\vsize
4381
4382 \global\let\smalllisp=\smalllispx
4383 \global\let\smallexample=\smalllispx
4384 \global\def\Esmallexample{\Esmalllisp}
4385 }
4386
4387 % Use @afourpaper to print on European A4 paper.
4388 \def\afourpaper{
4389 \global\tolerance=700
4390 \global\hfuzz=1pt
4391 \setleading{12pt}
4392 \global\parskip 15pt plus 1pt
4393
4394 \global\vsize= 53\baselineskip
4395 \advance\vsize by \topskip
4396 %\global\hsize= 5.85in % A4 wide 10pt
4397 \global\hsize= 6.5in
4398 \global\outerhsize=\hsize
4399 \global\advance\outerhsize by 0.5in
4400 \global\outervsize=\vsize
4401 \global\advance\outervsize by 0.6in
4402
4403 \global\pagewidth=\hsize
4404 \global\pageheight=\vsize
4405 }
4406
4407 % Allow control of the text dimensions. Parameters in order: textheight;
4408 % textwidth; voffset; hoffset; binding offset; topskip.
4409 % All require a dimension;
4410 % header is additional; added length extends the bottom of the page.
4411
4412 \def\changepagesizes#1#2#3#4#5#6{
4413 \global\vsize= #1
4414 \global\topskip= #6
4415 \advance\vsize by \topskip
4416 \global\voffset= #3
4417 \global\hsize= #2
4418 \global\outerhsize=\hsize
4419 \global\advance\outerhsize by 0.5in
4420 \global\outervsize=\vsize
4421 \global\advance\outervsize by 0.6in
4422 \global\pagewidth=\hsize
4423 \global\pageheight=\vsize
4424 \global\normaloffset= #4
4425 \global\bindingoffset= #5}
4426
4427 % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
4428 % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
4429 \def\afourlatex
4430 {\global\tolerance=700
4431 \global\hfuzz=1pt
4432 \setleading{12pt}
4433 \global\parskip 15pt plus 1pt
4434 \advance\baselineskip by 1.6pt
4435 \changepagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}
4436 }
4437
4438 % Use @afourwide to print on European A4 paper in wide format.
4439 \def\afourwide{\afourpaper
4440 \changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}}
4441
4442 % Define macros to output various characters with catcode for normal text.
4443 \catcode`\"=\other
4444 \catcode`\~=\other
4445 \catcode`\^=\other
4446 \catcode`\_=\other
4447 \catcode`\|=\other
4448 \catcode`\<=\other
4449 \catcode`\>=\other
4450 \catcode`\+=\other
4451 \def\normaldoublequote{"}
4452 \def\normaltilde{~}
4453 \def\normalcaret{^}
4454 \def\normalunderscore{_}
4455 \def\normalverticalbar{|}
4456 \def\normalless{<}
4457 \def\normalgreater{>}
4458 \def\normalplus{+}
4459
4460 % This macro is used to make a character print one way in ttfont
4461 % where it can probably just be output, and another way in other fonts,
4462 % where something hairier probably needs to be done.
4463 %
4464 % #1 is what to print if we are indeed using \tt; #2 is what to print
4465 % otherwise. Since all the Computer Modern typewriter fonts have zero
4466 % interword stretch (and shrink), and it is reasonable to expect all
4467 % typewriter fonts to have this, we can check that font parameter.
4468 %
4469 \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
4470
4471 % Turn off all special characters except @
4472 % (and those which the user can use as if they were ordinary).
4473 % Most of these we simply print from the \tt font, but for some, we can
4474 % use math or other variants that look better in normal text.
4475
4476 \catcode`\"=\active
4477 \def\activedoublequote{{\tt \char '042}}
4478 \let"=\activedoublequote
4479 \catcode`\~=\active
4480 \def~{{\tt \char '176}}
4481 \chardef\hat=`\^
4482 \catcode`\^=\active
4483 \def\auxhat{\def^{'hat}}
4484 \def^{{\tt \hat}}
4485
4486 \catcode`\_=\active
4487 \def_{\ifusingtt\normalunderscore\_}
4488 % Subroutine for the previous macro.
4489 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
4490
4491 \catcode`\|=\active
4492 \def|{{\tt \char '174}}
4493 \chardef \less=`\<
4494 \catcode`\<=\active
4495 \def<{{\tt \less}}
4496 \chardef \gtr=`\>
4497 \catcode`\>=\active
4498 \def>{{\tt \gtr}}
4499 \catcode`\+=\active
4500 \def+{{\tt \char 43}}
4501 %\catcode 27=\active
4502 %\def^^[{$\diamondsuit$}
4503
4504 % Set up an active definition for =, but don't enable it most of the time.
4505 {\catcode`\==\active
4506 \global\def={{\tt \char 61}}}
4507
4508 \catcode`+=\active
4509 \catcode`\_=\active
4510
4511 % If a .fmt file is being used, characters that might appear in a file
4512 % name cannot be active until we have parsed the command line.
4513 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
4514 % \otherifyactive is called near the end of this file.
4515 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
4516
4517 \catcode`\@=0
4518
4519 % \rawbackslashxx output one backslash character in current font
4520 \global\chardef\rawbackslashxx=`\\
4521 %{\catcode`\\=\other
4522 %@gdef@rawbackslashxx{\}}
4523
4524 % \rawbackslash redefines \ as input to do \rawbackslashxx.
4525 {\catcode`\\=\active
4526 @gdef@rawbackslash{@let\=@rawbackslashxx }}
4527
4528 % \normalbackslash outputs one backslash in fixed width font.
4529 \def\normalbackslash{{\tt\rawbackslashxx}}
4530
4531 % Say @foo, not \foo, in error messages.
4532 \escapechar=`\@
4533
4534 % \catcode 17=0 % Define control-q
4535 \catcode`\\=\active
4536
4537 % Used sometimes to turn off (effectively) the active characters
4538 % even after parsing them.
4539 @def@turnoffactive{@let"=@normaldoublequote
4540 @let\=@realbackslash
4541 @let~=@normaltilde
4542 @let^=@normalcaret
4543 @let_=@normalunderscore
4544 @let|=@normalverticalbar
4545 @let<=@normalless
4546 @let>=@normalgreater
4547 @let+=@normalplus}
4548
4549 @def@normalturnoffactive{@let"=@normaldoublequote
4550 @let\=@normalbackslash
4551 @let~=@normaltilde
4552 @let^=@normalcaret
4553 @let_=@normalunderscore
4554 @let|=@normalverticalbar
4555 @let<=@normalless
4556 @let>=@normalgreater
4557 @let+=@normalplus}
4558
4559 % Make _ and + \other characters, temporarily.
4560 % This is canceled by @fixbackslash.
4561 @otherifyactive
4562
4563 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
4564 % That is what \eatinput is for; after that, the `\' should revert to printing
4565 % a backslash.
4566 %
4567 @gdef@eatinput input texinfo{@fixbackslash}
4568 @global@let\ = @eatinput
4569
4570 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
4571 % the first `\{ in the file would cause an error. This macro tries to fix
4572 % that, assuming it is called before the first `\' could plausibly occur.
4573 % Also back turn on active characters that might appear in the input
4574 % file name, in case not using a pre-dumped format.
4575 %
4576 @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
4577 @catcode`+=@active @catcode`@_=@active}
4578
4579 %% These look ok in all fonts, so just make them not special. The @rm below
4580 %% makes sure that the current font starts out as the newly loaded cmr10
4581 @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
4582
4583 @textfonts
4584 @rm
4585
4586 @c Local variables:
4587 @c page-delimiter: "^\\\\message"
4588 @c End: