OSDN Git Service

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