Update.
[riece] / doc / texinfo.tex
1 % texinfo.tex -- TeX macros to handle Texinfo files.
2 %
3 % Load plain if necessary, i.e., if running under initex.
4 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5 %
6 \def\texinfoversion{2000-12-12.07}
7 %
8 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
9 % Free Software Foundation, Inc.
10 %
11 % This texinfo.tex file is free software; you can redistribute it and/or
12 % modify it under the terms of the GNU General Public License as
13 % published by the Free Software Foundation; either version 2, or (at
14 % your option) any later version.
15 %
16 % This texinfo.tex file is distributed in the hope that it will be
17 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
18 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 % General Public License for more details.
20 %
21 % You should have received a copy of the GNU General Public License
22 % along with this texinfo.tex file; see the file COPYING.  If not, write
23 % to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 % Boston, MA 02111-1307, USA.
25 %
26 % In other words, you are welcome to use, share and improve this program.
27 % You are forbidden to forbid anyone else to use, share and improve
28 % what you give them.   Help stamp out software-hoarding!
29 %
30 % Please try the latest version of texinfo.tex before submitting bug
31 % reports; you can get the latest version from:
32 %   ftp://ftp.gnu.org/gnu/texinfo.tex
33 %   (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
34 %   ftp://texinfo.org/tex/texinfo.tex
35 %   ftp://us.ctan.org/macros/texinfo/texinfo.tex
36 %   (and all CTAN mirrors, finger ctan@us.ctan.org for a list).
37 %   /home/gd/gnu/doc/texinfo.tex on the GNU machines.
38 % The texinfo.tex in any given Texinfo distribution could well be out
39 % of date, so if that's what you're using, please check.
40 % Texinfo has a small home page at http://texinfo.org/.
41 %
42 % Send bug reports to bug-texinfo@gnu.org.  Please include including a
43 % complete document in each bug report with which we can reproduce the
44 % problem.  Patches are, of course, greatly appreciated.
45 %
46 % To process a Texinfo manual with TeX, it's most reliable to use the
47 % texi2dvi shell script that comes with the distribution.  For a simple
48 % manual foo.texi, however, you can get away with this:
49 %   tex foo.texi
50 %   texindex foo.??
51 %   tex foo.texi
52 %   tex foo.texi
53 %   dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps.
54 % The extra runs of TeX get the cross-reference information correct.
55 % Sometimes one run after texindex suffices, and sometimes you need more
56 % than two; texi2dvi does it as many times as necessary.
57 %
58 % It is possible to adapt texinfo.tex for other languages.  You can get
59 % the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/.
60
61 \message{Loading texinfo [version \texinfoversion]:}
62
63 % If in a .fmt file, print the version number
64 % and turn on active characters that we couldn't do earlier because
65 % they might have appeared in the input file name.
66 \everyjob{\message{[Texinfo version \texinfoversion]}%
67   \catcode`+=\active \catcode`\_=\active}
68
69 % Save some parts of plain tex whose names we will redefine.
70 \let\ptexb=\b
71 \let\ptexbullet=\bullet
72 \let\ptexc=\c
73 \let\ptexcomma=\,
74 \let\ptexdot=\.
75 \let\ptexdots=\dots
76 \let\ptexend=\end
77 \let\ptexequiv=\equiv
78 \let\ptexexclam=\!
79 \let\ptexi=\i
80 \let\ptexlbrace=\{
81 \let\ptexrbrace=\}
82 \let\ptexstar=\*
83 \let\ptext=\t
84
85 % We never want plain's outer \+ definition in Texinfo.
86 % For @tex, we can use \tabalign.
87 \let\+ = \relax
88
89 \message{Basics,}
90 \chardef\other=12
91
92 % If this character appears in an error message or help string, it
93 % starts a new line in the output.
94 \newlinechar = `^^J
95
96 % Set up fixed words for English if not already set.
97 \ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
98 \ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
99 \ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
100 \ifx\putwordin\undefined        \gdef\putwordin{in}\fi
101 \ifx\putwordIndexIsEmpty\undefined     \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
102 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
103 \ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
104 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
105 \ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
106 \ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
107 \ifx\putwordof\undefined        \gdef\putwordof{of}\fi
108 \ifx\putwordon\undefined        \gdef\putwordon{on}\fi
109 \ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
110 \ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
111 \ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
112 \ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
113 \ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
114 \ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
115 \ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
116 %
117 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
118 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
119 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
120 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
121 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
122 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
123 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
124 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
125 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
126 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
127 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
128 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
129 %
130 \ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
131 \ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
132 \ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
133 \ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
134 \ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
135 \ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
136 \ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
137
138 % Ignore a token.
139 %
140 \def\gobble#1{}
141
142 \hyphenation{ap-pen-dix}
143 \hyphenation{mini-buf-fer mini-buf-fers}
144 \hyphenation{eshell}
145 \hyphenation{white-space}
146
147 % Margin to add to right of even pages, to left of odd pages.
148 \newdimen \bindingoffset
149 \newdimen \normaloffset
150 \newdimen\pagewidth \newdimen\pageheight
151
152 % Sometimes it is convenient to have everything in the transcript file
153 % and nothing on the terminal.  We don't just call \tracingall here,
154 % since that produces some useless output on the terminal.
155 %
156 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
157 \ifx\eTeXversion\undefined
158 \def\loggingall{\tracingcommands2 \tracingstats2
159    \tracingpages1 \tracingoutput1 \tracinglostchars1
160    \tracingmacros2 \tracingparagraphs1 \tracingrestores1
161    \showboxbreadth\maxdimen\showboxdepth\maxdimen
162 }%
163 \else
164 \def\loggingall{\tracingcommands3 \tracingstats2
165    \tracingpages1 \tracingoutput1 \tracinglostchars1
166    \tracingmacros2 \tracingparagraphs1 \tracingrestores1
167    \tracingscantokens1 \tracingassigns1 \tracingifs1
168    \tracinggroups1 \tracingnesting2
169    \showboxbreadth\maxdimen\showboxdepth\maxdimen
170 }%
171 \fi
172
173 % For @cropmarks command.
174 % Do @cropmarks to get crop marks.
175 %
176 \newif\ifcropmarks
177 \let\cropmarks = \cropmarkstrue
178 %
179 % Dimensions to add cropmarks at corners.
180 % Added by P. A. MacKay, 12 Nov. 1986
181 %
182 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
183 \newdimen\cornerlong  \cornerlong=1pc
184 \newdimen\cornerthick \cornerthick=.3pt
185 \newdimen\topandbottommargin \topandbottommargin=.75in
186
187 % Main output routine.
188 \chardef\PAGE = 255
189 \output = {\onepageout{\pagecontents\PAGE}}
190
191 \newbox\headlinebox
192 \newbox\footlinebox
193
194 % \onepageout takes a vbox as an argument.  Note that \pagecontents
195 % does insertions, but you have to call it yourself.
196 \def\onepageout#1{%
197   \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
198   %
199   \ifodd\pageno  \advance\hoffset by \bindingoffset
200   \else \advance\hoffset by -\bindingoffset\fi
201   %
202   % Do this outside of the \shipout so @code etc. will be expanded in
203   % the headline as they should be, not taken literally (outputting ''code).
204   \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
205   \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
206   %
207   {%
208     % Have to do this stuff outside the \shipout because we want it to
209     % take effect in \write's, yet the group defined by the \vbox ends
210     % before the \shipout runs.
211     %
212     \escapechar = `\\     % use backslash in output files.
213     \indexdummies         % don't expand commands in the output.
214     \normalturnoffactive  % \ in index entries must not stay \, e.g., if
215                    % the page break happens to be in the middle of an example.
216     \shipout\vbox{%
217       % Do this early so pdf references go to the beginning of the page.
218       \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
219       %
220       \ifcropmarks \vbox to \outervsize\bgroup
221         \hsize = \outerhsize
222         \vskip-\topandbottommargin
223         \vtop to0pt{%
224           \line{\ewtop\hfil\ewtop}%
225           \nointerlineskip
226           \line{%
227             \vbox{\moveleft\cornerthick\nstop}%
228             \hfill
229             \vbox{\moveright\cornerthick\nstop}%
230           }%
231           \vss}%
232         \vskip\topandbottommargin
233         \line\bgroup
234           \hfil % center the page within the outer (page) hsize.
235           \ifodd\pageno\hskip\bindingoffset\fi
236           \vbox\bgroup
237       \fi
238       %
239       \unvbox\headlinebox
240       \pagebody{#1}%
241       \ifdim\ht\footlinebox > 0pt
242         % Only leave this space if the footline is nonempty.
243         % (We lessened \vsize for it in \oddfootingxxx.)
244         % The \baselineskip=24pt in plain's \makefootline has no effect.
245         \vskip 2\baselineskip
246         \unvbox\footlinebox
247       \fi
248       %
249       \ifcropmarks
250           \egroup % end of \vbox\bgroup
251         \hfil\egroup % end of (centering) \line\bgroup
252         \vskip\topandbottommargin plus1fill minus1fill
253         \boxmaxdepth = \cornerthick
254         \vbox to0pt{\vss
255           \line{%
256             \vbox{\moveleft\cornerthick\nsbot}%
257             \hfill
258             \vbox{\moveright\cornerthick\nsbot}%
259           }%
260           \nointerlineskip
261           \line{\ewbot\hfil\ewbot}%
262         }%
263       \egroup % \vbox from first cropmarks clause
264       \fi
265     }% end of \shipout\vbox
266   }% end of group with \turnoffactive
267   \advancepageno
268   \ifnum\outputpenalty>-20000 \else\dosupereject\fi
269 }
270
271 \newinsert\margin \dimen\margin=\maxdimen
272
273 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
274 {\catcode`\@ =11
275 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
276 % marginal hacks, juha@viisa.uucp (Juha Takala)
277 \ifvoid\margin\else % marginal info is present
278   \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
279 \dimen@=\dp#1 \unvbox#1
280 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
281 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
282 }
283
284 % Here are the rules for the cropmarks.  Note that they are
285 % offset so that the space between them is truly \outerhsize or \outervsize
286 % (P. A. MacKay, 12 November, 1986)
287 %
288 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
289 \def\nstop{\vbox
290   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
291 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
292 \def\nsbot{\vbox
293   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
294
295 % Parse an argument, then pass it to #1.  The argument is the rest of
296 % the input line (except we remove a trailing comment).  #1 should be a
297 % macro which expects an ordinary undelimited TeX argument.
298 %
299 \def\parsearg#1{%
300   \let\next = #1%
301   \begingroup
302     \obeylines
303     \futurelet\temp\parseargx
304 }
305
306 % If the next token is an obeyed space (from an @example environment or
307 % the like), remove it and recurse.  Otherwise, we're done.
308 \def\parseargx{%
309   % \obeyedspace is defined far below, after the definition of \sepspaces.
310   \ifx\obeyedspace\temp
311     \expandafter\parseargdiscardspace
312   \else
313     \expandafter\parseargline
314   \fi
315 }
316
317 % Remove a single space (as the delimiter token to the macro call).
318 {\obeyspaces %
319  \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
320
321 {\obeylines %
322   \gdef\parseargline#1^^M{%
323     \endgroup % End of the group started in \parsearg.
324     %
325     % First remove any @c comment, then any @comment.
326     % Result of each macro is put in \toks0.
327     \argremovec #1\c\relax %
328     \expandafter\argremovecomment \the\toks0 \comment\relax %
329     %
330     % Call the caller's macro, saved as \next in \parsearg.
331     \expandafter\next\expandafter{\the\toks0}%
332   }%
333 }
334
335 % Since all \c{,omment} does is throw away the argument, we can let TeX
336 % do that for us.  The \relax here is matched by the \relax in the call
337 % in \parseargline; it could be more or less anything, its purpose is
338 % just to delimit the argument to the \c.
339 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
340 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
341
342 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
343 %    @end itemize  @c foo
344 % will have two active spaces as part of the argument with the
345 % `itemize'.  Here we remove all active spaces from #1, and assign the
346 % result to \toks0.
347 %
348 % This loses if there are any *other* active characters besides spaces
349 % in the argument -- _ ^ +, for example -- since they get expanded.
350 % Fortunately, Texinfo does not define any such commands.  (If it ever
351 % does, the catcode of the characters in questionwill have to be changed
352 % here.)  But this means we cannot call \removeactivespaces as part of
353 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
354 % that \parsearg gets might well have any character at all in it.
355 %
356 \def\removeactivespaces#1{%
357   \begingroup
358     \ignoreactivespaces
359     \edef\temp{#1}%
360     \global\toks0 = \expandafter{\temp}%
361   \endgroup
362 }
363
364 % Change the active space to expand to nothing.
365 %
366 \begingroup
367   \obeyspaces
368   \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
369 \endgroup
370
371
372 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
373
374 %% These are used to keep @begin/@end levels from running away
375 %% Call \inENV within environments (after a \begingroup)
376 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
377 \def\ENVcheck{%
378 \ifENV\errmessage{Still within an environment; press RETURN to continue}
379 \endgroup\fi} % This is not perfect, but it should reduce lossage
380
381 % @begin foo  is the same as @foo, for now.
382 \newhelp\EMsimple{Press RETURN to continue.}
383
384 \outer\def\begin{\parsearg\beginxxx}
385
386 \def\beginxxx #1{%
387 \expandafter\ifx\csname #1\endcsname\relax
388 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
389 \csname #1\endcsname\fi}
390
391 % @end foo executes the definition of \Efoo.
392 %
393 \def\end{\parsearg\endxxx}
394 \def\endxxx #1{%
395   \removeactivespaces{#1}%
396   \edef\endthing{\the\toks0}%
397   %
398   \expandafter\ifx\csname E\endthing\endcsname\relax
399     \expandafter\ifx\csname \endthing\endcsname\relax
400       % There's no \foo, i.e., no ``environment'' foo.
401       \errhelp = \EMsimple
402       \errmessage{Undefined command `@end \endthing'}%
403     \else
404       \unmatchedenderror\endthing
405     \fi
406   \else
407     % Everything's ok; the right environment has been started.
408     \csname E\endthing\endcsname
409   \fi
410 }
411
412 % There is an environment #1, but it hasn't been started.  Give an error.
413 %
414 \def\unmatchedenderror#1{%
415   \errhelp = \EMsimple
416   \errmessage{This `@end #1' doesn't have a matching `@#1'}%
417 }
418
419 % Define the control sequence \E#1 to give an unmatched @end error.
420 %
421 \def\defineunmatchedend#1{%
422   \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
423 }
424
425
426 % Single-spacing is done by various environments (specifically, in
427 % \nonfillstart and \quotations).
428 \newskip\singlespaceskip \singlespaceskip = 12.5pt
429 \def\singlespace{%
430   % Why was this kern here?  It messes up equalizing space above and below
431   % environments.  --karl, 6may93
432   %{\advance \baselineskip by -\singlespaceskip
433   %\kern \baselineskip}%
434   \setleading \singlespaceskip
435 }
436
437 %% Simple single-character @ commands
438
439 % @@ prints an @
440 % Kludge this until the fonts are right (grr).
441 \def\@{{\tt\char64}}
442
443 % This is turned off because it was never documented
444 % and you can use @w{...} around a quote to suppress ligatures.
445 %% Define @` and @' to be the same as ` and '
446 %% but suppressing ligatures.
447 %\def\`{{`}}
448 %\def\'{{'}}
449
450 % Used to generate quoted braces.
451 \def\mylbrace {{\tt\char123}}
452 \def\myrbrace {{\tt\char125}}
453 \let\{=\mylbrace
454 \let\}=\myrbrace
455 \begingroup
456   % Definitions to produce actual \{ & \} command in an index.
457   \catcode`\{ = 12 \catcode`\} = 12
458   \catcode`\[ = 1 \catcode`\] = 2
459   \catcode`\@ = 0 \catcode`\\ = 12
460   @gdef@lbracecmd[\{]%
461   @gdef@rbracecmd[\}]%
462 @endgroup
463
464 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
465 % Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
466 \let\, = \c
467 \let\dotaccent = \.
468 \def\ringaccent#1{{\accent23 #1}}
469 \let\tieaccent = \t
470 \let\ubaraccent = \b
471 \let\udotaccent = \d
472
473 % Other special characters: @questiondown @exclamdown
474 % Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
475 \def\questiondown{?`}
476 \def\exclamdown{!`}
477
478 % Dotless i and dotless j, used for accents.
479 \def\imacro{i}
480 \def\jmacro{j}
481 \def\dotless#1{%
482   \def\temp{#1}%
483   \ifx\temp\imacro \ptexi
484   \else\ifx\temp\jmacro \j
485   \else \errmessage{@dotless can be used only with i or j}%
486   \fi\fi
487 }
488
489 % Be sure we're in horizontal mode when doing a tie, since we make space
490 % equivalent to this in @example-like environments. Otherwise, a space
491 % at the beginning of a line will start with \penalty -- and
492 % since \penalty is valid in vertical mode, we'd end up putting the
493 % penalty on the vertical list instead of in the new paragraph.
494 {\catcode`@ = 11
495  % Avoid using \@M directly, because that causes trouble
496  % if the definition is written into an index file.
497  \global\let\tiepenalty = \@M
498  \gdef\tie{\leavevmode\penalty\tiepenalty\ }
499 }
500
501 % @: forces normal size whitespace following.
502 \def\:{\spacefactor=1000 }
503
504 % @* forces a line break.
505 \def\*{\hfil\break\hbox{}\ignorespaces}
506
507 % @. is an end-of-sentence period.
508 \def\.{.\spacefactor=3000 }
509
510 % @! is an end-of-sentence bang.
511 \def\!{!\spacefactor=3000 }
512
513 % @? is an end-of-sentence query.
514 \def\?{?\spacefactor=3000 }
515
516 % @w prevents a word break.  Without the \leavevmode, @w at the
517 % beginning of a paragraph, when TeX is still in vertical mode, would
518 % produce a whole line of output instead of starting the paragraph.
519 \def\w#1{\leavevmode\hbox{#1}}
520
521 % @group ... @end group forces ... to be all on one page, by enclosing
522 % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
523 % to keep its height that of a normal line.  According to the rules for
524 % \topskip (p.114 of the TeXbook), the glue inserted is
525 % max (\topskip - \ht (first item), 0).  If that height is large,
526 % therefore, no glue is inserted, and the space between the headline and
527 % the text is small, which looks bad.
528 %
529 \def\group{\begingroup
530   \ifnum\catcode13=\active \else
531     \errhelp = \groupinvalidhelp
532     \errmessage{@group invalid in context where filling is enabled}%
533   \fi
534   %
535   % The \vtop we start below produces a box with normal height and large
536   % depth; thus, TeX puts \baselineskip glue before it, and (when the
537   % next line of text is done) \lineskip glue after it.  (See p.82 of
538   % the TeXbook.)  Thus, space below is not quite equal to space
539   % above.  But it's pretty close.
540   \def\Egroup{%
541     \egroup           % End the \vtop.
542     \endgroup         % End the \group.
543   }%
544   %
545   \vtop\bgroup
546     % We have to put a strut on the last line in case the @group is in
547     % the midst of an example, rather than completely enclosing it.
548     % Otherwise, the interline space between the last line of the group
549     % and the first line afterwards is too small.  But we can't put the
550     % strut in \Egroup, since there it would be on a line by itself.
551     % Hence this just inserts a strut at the beginning of each line.
552     \everypar = {\strut}%
553     %
554     % Since we have a strut on every line, we don't need any of TeX's
555     % normal interline spacing.
556     \offinterlineskip
557     %
558     % OK, but now we have to do something about blank
559     % lines in the input in @example-like environments, which normally
560     % just turn into \lisppar, which will insert no space now that we've
561     % turned off the interline space.  Simplest is to make them be an
562     % empty paragraph.
563     \ifx\par\lisppar
564       \edef\par{\leavevmode \par}%
565       %
566       % Reset ^^M's definition to new definition of \par.
567       \obeylines
568     \fi
569     %
570     % Do @comment since we are called inside an environment such as
571     % @example, where each end-of-line in the input causes an
572     % end-of-line in the output.  We don't want the end-of-line after
573     % the `@group' to put extra space in the output.  Since @group
574     % should appear on a line by itself (according to the Texinfo
575     % manual), we don't worry about eating any user text.
576     \comment
577 }
578 %
579 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
580 % message, so this ends up printing `@group can only ...'.
581 %
582 \newhelp\groupinvalidhelp{%
583 group can only be used in environments such as @example,^^J%
584 where each line of input produces a line of output.}
585
586 % @need space-in-mils
587 % forces a page break if there is not space-in-mils remaining.
588
589 \newdimen\mil  \mil=0.001in
590
591 \def\need{\parsearg\needx}
592
593 % Old definition--didn't work.
594 %\def\needx #1{\par %
595 %% This method tries to make TeX break the page naturally
596 %% if the depth of the box does not fit.
597 %{\baselineskip=0pt%
598 %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
599 %\prevdepth=-1000pt
600 %}}
601
602 \def\needx#1{%
603   % Ensure vertical mode, so we don't make a big box in the middle of a
604   % paragraph.
605   \par
606   %
607   % If the @need value is less than one line space, it's useless.
608   \dimen0 = #1\mil
609   \dimen2 = \ht\strutbox
610   \advance\dimen2 by \dp\strutbox
611   \ifdim\dimen0 > \dimen2
612     %
613     % Do a \strut just to make the height of this box be normal, so the
614     % normal leading is inserted relative to the preceding line.
615     % And a page break here is fine.
616     \vtop to #1\mil{\strut\vfil}%
617     %
618     % TeX does not even consider page breaks if a penalty added to the
619     % main vertical list is 10000 or more.  But in order to see if the
620     % empty box we just added fits on the page, we must make it consider
621     % page breaks.  On the other hand, we don't want to actually break the
622     % page after the empty box.  So we use a penalty of 9999.
623     %
624     % There is an extremely small chance that TeX will actually break the
625     % page at this \penalty, if there are no other feasible breakpoints in
626     % sight.  (If the user is using lots of big @group commands, which
627     % almost-but-not-quite fill up a page, TeX will have a hard time doing
628     % good page breaking, for example.)  However, I could not construct an
629     % example where a page broke at this \penalty; if it happens in a real
630     % document, then we can reconsider our strategy.
631     \penalty9999
632     %
633     % Back up by the size of the box, whether we did a page break or not.
634     \kern -#1\mil
635     %
636     % Do not allow a page break right after this kern.
637     \nobreak
638   \fi
639 }
640
641 % @br   forces paragraph break
642
643 \let\br = \par
644
645 % @dots{} output an ellipsis using the current font.
646 % We do .5em per period so that it has the same spacing in a typewriter
647 % font as three actual period characters.
648 %
649 \def\dots{%
650   \leavevmode
651   \hbox to 1.5em{%
652     \hskip 0pt plus 0.25fil minus 0.25fil
653     .\hss.\hss.%
654     \hskip 0pt plus 0.5fil minus 0.5fil
655   }%
656 }
657
658 % @enddots{} is an end-of-sentence ellipsis.
659 %
660 \def\enddots{%
661   \leavevmode
662   \hbox to 2em{%
663     \hskip 0pt plus 0.25fil minus 0.25fil
664     .\hss.\hss.\hss.%
665     \hskip 0pt plus 0.5fil minus 0.5fil
666   }%
667   \spacefactor=3000
668 }
669
670
671 % @page    forces the start of a new page
672 %
673 \def\page{\par\vfill\supereject}
674
675 % @exdent text....
676 % outputs text on separate line in roman font, starting at standard page margin
677
678 % This records the amount of indent in the innermost environment.
679 % That's how much \exdent should take out.
680 \newskip\exdentamount
681
682 % This defn is used inside fill environments such as @defun.
683 \def\exdent{\parsearg\exdentyyy}
684 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
685
686 % This defn is used inside nofill environments such as @example.
687 \def\nofillexdent{\parsearg\nofillexdentyyy}
688 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
689 \leftline{\hskip\leftskip{\rm#1}}}}
690
691 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
692 % paragraph.  For more general purposes, use the \margin insertion
693 % class.  WHICH is `l' or `r'.
694 %
695 \newskip\inmarginspacing \inmarginspacing=1cm
696 \def\strutdepth{\dp\strutbox}
697 %
698 \def\doinmargin#1#2{\strut\vadjust{%
699   \nobreak
700   \kern-\strutdepth
701   \vtop to \strutdepth{%
702     \baselineskip=\strutdepth
703     \vss
704     % if you have multiple lines of stuff to put here, you'll need to
705     % make the vbox yourself of the appropriate size.
706     \ifx#1l%
707       \llap{\ignorespaces #2\hskip\inmarginspacing}%
708     \else
709       \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
710     \fi
711     \null
712   }%
713 }}
714 \def\inleftmargin{\doinmargin l}
715 \def\inrightmargin{\doinmargin r}
716 %
717 % @inmargin{TEXT [, RIGHT-TEXT]}
718 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
719 % else use TEXT for both).
720
721 \def\inmargin#1{\parseinmargin #1,,\finish}
722 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
723   \setbox0 = \hbox{\ignorespaces #2}% 
724   \ifdim\wd0 > 0pt
725     \def\lefttext{#1}%  have both texts
726     \def\righttext{#2}%
727   \else
728     \def\lefttext{#1}%  have only one text
729     \def\righttext{#1}%
730   \fi
731   %
732   \ifodd\pageno
733     \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
734   \else
735     \def\temp{\inleftmargin\lefttext}%
736   \fi
737   \temp
738 }
739
740 % @include file    insert text of that file as input.
741 % Allow normal characters that  we make active in the argument (a file name).
742 \def\include{\begingroup
743   \catcode`\\=12
744   \catcode`~=12
745   \catcode`^=12
746   \catcode`_=12
747   \catcode`|=12
748   \catcode`<=12
749   \catcode`>=12
750   \catcode`+=12
751   \parsearg\includezzz}
752 % Restore active chars for included file.
753 \def\includezzz#1{\endgroup\begingroup
754   % Read the included file in a group so nested @include's work.
755   \def\thisfile{#1}%
756   \input\thisfile
757 \endgroup}
758
759 \def\thisfile{}
760
761 % @center line   outputs that line, centered
762
763 \def\center{\parsearg\centerzzz}
764 \def\centerzzz #1{{\advance\hsize by -\leftskip
765 \advance\hsize by -\rightskip
766 \centerline{#1}}}
767
768 % @sp n   outputs n lines of vertical space
769
770 \def\sp{\parsearg\spxxx}
771 \def\spxxx #1{\vskip #1\baselineskip}
772
773 % @comment ...line which is ignored...
774 % @c is the same as @comment
775 % @ignore ... @end ignore  is another way to write a comment
776
777 \def\comment{\begingroup \catcode`\^^M=\other%
778 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
779 \commentxxx}
780 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
781
782 \let\c=\comment
783
784 % @paragraphindent NCHARS
785 % We'll use ems for NCHARS, close enough.
786 % We cannot implement @paragraphindent asis, though.
787
788 \def\asisword{asis} % no translation, these are keywords
789 \def\noneword{none}
790 %
791 \def\paragraphindent{\parsearg\doparagraphindent}
792 \def\doparagraphindent#1{%
793   \def\temp{#1}%
794   \ifx\temp\asisword
795   \else
796     \ifx\temp\noneword
797       \defaultparindent = 0pt
798     \else
799       \defaultparindent = #1em
800     \fi
801   \fi
802   \parindent = \defaultparindent
803 }
804
805 % @exampleindent NCHARS
806 % We'll use ems for NCHARS like @paragraphindent.
807 % It seems @exampleindent asis isn't necessary, but
808 % I preserve it to make it similar to @paragraphindent.
809 \def\exampleindent{\parsearg\doexampleindent}
810 \def\doexampleindent#1{%
811   \def\temp{#1}%
812   \ifx\temp\asisword
813   \else
814     \ifx\temp\noneword
815       \lispnarrowing = 0pt
816     \else
817       \lispnarrowing = #1em
818     \fi
819   \fi
820 }
821
822 % @asis just yields its argument.  Used with @table, for example.
823 %
824 \def\asis#1{#1}
825
826 % @math means output in math mode.
827 % We don't use $'s directly in the definition of \math because control
828 % sequences like \math are expanded when the toc file is written.  Then,
829 % we read the toc file back, the $'s will be normal characters (as they
830 % should be, according to the definition of Texinfo).  So we must use a
831 % control sequence to switch into and out of math mode.
832 %
833 % This isn't quite enough for @math to work properly in indices, but it
834 % seems unlikely it will ever be needed there.
835 %
836 \let\implicitmath = $
837 \def\math#1{\implicitmath #1\implicitmath}
838
839 % @bullet and @minus need the same treatment as @math, just above.
840 \def\bullet{\implicitmath\ptexbullet\implicitmath}
841 \def\minus{\implicitmath-\implicitmath}
842
843 % @refill is a no-op.
844 \let\refill=\relax
845
846 % If working on a large document in chapters, it is convenient to
847 % be able to disable indexing, cross-referencing, and contents, for test runs.
848 % This is done with @novalidate (before @setfilename).
849 %
850 \newif\iflinks \linkstrue % by default we want the aux files.
851 \let\novalidate = \linksfalse
852
853 % @setfilename is done at the beginning of every texinfo file.
854 % So open here the files we need to have open while reading the input.
855 % This makes it possible to make a .fmt file for texinfo.
856 \def\setfilename{%
857    \iflinks
858      \readauxfile
859    \fi % \openindices needs to do some work in any case.
860    \openindices
861    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
862    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
863    %
864    % If texinfo.cnf is present on the system, read it.
865    % Useful for site-wide @afourpaper, etc.
866    % Just to be on the safe side, close the input stream before the \input.
867    \openin 1 texinfo.cnf
868    \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
869    \closein1
870    \temp
871    %
872    \comment % Ignore the actual filename.
873 }
874
875 % Called from \setfilename.
876 %
877 \def\openindices{%
878   \newindex{cp}%
879   \newcodeindex{fn}%
880   \newcodeindex{vr}%
881   \newcodeindex{tp}%
882   \newcodeindex{ky}%
883   \newcodeindex{pg}%
884 }
885
886 % @bye.
887 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
888
889
890 \message{pdf,}
891 % adobe `portable' document format
892 \newcount\tempnum
893 \newcount\lnkcount
894 \newtoks\filename
895 \newcount\filenamelength
896 \newcount\pgn
897 \newtoks\toksA
898 \newtoks\toksB
899 \newtoks\toksC
900 \newtoks\toksD
901 \newbox\boxA
902 \newcount\countA
903 \newif\ifpdf
904 \newif\ifpdfmakepagedest
905
906 \ifx\pdfoutput\undefined
907   \pdffalse
908   \let\pdfmkdest = \gobble
909   \let\pdfurl = \gobble
910   \let\endlink = \relax
911   \let\linkcolor = \relax
912   \let\pdfmakeoutlines = \relax
913 \else
914   \pdftrue
915   \pdfoutput = 1
916   \input pdfcolor
917   \def\dopdfimage#1#2#3{%
918     \def\imagewidth{#2}%
919     \def\imageheight{#3}%
920     \ifnum\pdftexversion < 14
921       \pdfimage
922     \else
923       \pdfximage
924     \fi
925       \ifx\empty\imagewidth\else width \imagewidth \fi
926       \ifx\empty\imageheight\else height \imageheight \fi
927       {#1.pdf}%
928     \ifnum\pdftexversion < 14 \else
929       \pdfrefximage \pdflastximage
930     \fi}
931   \def\pdfmkdest#1{\pdfdest name{#1@} xyz}
932   \def\pdfmkpgn#1{#1@}
933   \let\linkcolor = \Blue  % was Cyan, but that seems light?
934   \def\endlink{\Black\pdfendlink}
935   % Adding outlines to PDF; macros for calculating structure of outlines
936   % come from Petr Olsak
937   \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
938     \else \csname#1\endcsname \fi}
939   \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
940     \advance\tempnum by1
941     \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
942   \def\pdfmakeoutlines{{%
943     \openin 1 \jobname.toc
944     \ifeof 1\else\bgroup
945       \closein 1 
946       \indexnofonts
947       \def\tt{}
948       \let\_ = \normalunderscore
949       % Thanh's hack / proper braces in bookmarks  
950       \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
951       \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
952       %
953       \def\chapentry ##1##2##3{}
954       \def\unnumbchapentry ##1##2{}
955       \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
956       \def\unnumbsecentry ##1##2{}
957       \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
958       \def\unnumbsubsecentry ##1##2{}
959       \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
960       \def\unnumbsubsubsecentry ##1##2{}
961       \input \jobname.toc
962       \def\chapentry ##1##2##3{%
963         \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
964       \def\unnumbchapentry ##1##2{%
965         \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
966       \def\secentry ##1##2##3##4{%
967         \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
968       \def\unnumbsecentry ##1##2{%
969         \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
970       \def\subsecentry ##1##2##3##4##5{%
971         \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
972       \def\unnumbsubsecentry ##1##2{%
973         \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
974       \def\subsubsecentry ##1##2##3##4##5##6{%
975         \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
976       \def\unnumbsubsubsecentry ##1##2{%
977         \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
978       \input \jobname.toc
979     \egroup\fi
980   }}
981   \def\makelinks #1,{%
982     \def\params{#1}\def\E{END}%
983     \ifx\params\E
984       \let\nextmakelinks=\relax
985     \else
986       \let\nextmakelinks=\makelinks
987       \ifnum\lnkcount>0,\fi
988       \picknum{#1}%
989       \startlink attr{/Border [0 0 0]} 
990         goto name{\pdfmkpgn{\the\pgn}}%
991       \linkcolor #1%
992       \advance\lnkcount by 1%
993       \endlink
994     \fi
995     \nextmakelinks
996   }
997   \def\picknum#1{\expandafter\pn#1}
998   \def\pn#1{%
999     \def\p{#1}%
1000     \ifx\p\lbrace
1001       \let\nextpn=\ppn
1002     \else
1003       \let\nextpn=\ppnn
1004       \def\first{#1}
1005     \fi
1006     \nextpn
1007   }
1008   \def\ppn#1{\pgn=#1\gobble}
1009   \def\ppnn{\pgn=\first}
1010   \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
1011   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1012   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1013     \ifx\PP\D\let\nextsp\relax
1014     \else\let\nextsp\skipspaces
1015       \ifx\p\space\else\addtokens{\filename}{\PP}%
1016         \advance\filenamelength by 1
1017       \fi
1018     \fi
1019     \nextsp}
1020   \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
1021   \ifnum\pdftexversion < 14
1022     \let \startlink \pdfannotlink
1023   \else
1024     \let \startlink \pdfstartlink
1025   \fi
1026   \def\pdfurl#1{%
1027     \begingroup
1028       \normalturnoffactive\def\@{@}%
1029       \leavevmode\Red
1030       \startlink attr{/Border [0 0 0]}%
1031         user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1032         % #1
1033     \endgroup}
1034   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1035   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1036   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1037   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1038   \def\maketoks{%
1039     \expandafter\poptoks\the\toksA|ENDTOKS|
1040     \ifx\first0\adn0
1041     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1042     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1043     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 
1044     \else
1045       \ifnum0=\countA\else\makelink\fi
1046       \ifx\first.\let\next=\done\else
1047         \let\next=\maketoks
1048         \addtokens{\toksB}{\the\toksD}
1049         \ifx\first,\addtokens{\toksB}{\space}\fi
1050       \fi
1051     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1052     \next}
1053   \def\makelink{\addtokens{\toksB}%
1054     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1055   \def\pdflink#1{%
1056     \startlink attr{/Border [0 0 0]} goto name{\mkpgn{#1}}
1057     \linkcolor #1\endlink}
1058   \def\mkpgn#1{#1@} 
1059   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1060 \fi % \ifx\pdfoutput
1061
1062
1063 \message{fonts,}
1064 % Font-change commands.
1065
1066 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1067 % So we set up a \sf analogous to plain's \rm, etc.
1068 \newfam\sffam
1069 \def\sf{\fam=\sffam \tensf}
1070 \let\li = \sf % Sometimes we call it \li, not \sf.
1071
1072 % We don't need math for this one.
1073 \def\ttsl{\tenttsl}
1074
1075 % Use Computer Modern fonts at \magstephalf (11pt).
1076 \newcount\mainmagstep
1077 \mainmagstep=\magstephalf
1078
1079 % Set the font macro #1 to the font named #2, adding on the
1080 % specified font prefix (normally `cm').
1081 % #3 is the font's design size, #4 is a scale factor
1082 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1083
1084 % Use cm as the default font prefix.
1085 % To specify the font prefix, you must define \fontprefix
1086 % before you read in texinfo.tex.
1087 \ifx\fontprefix\undefined
1088 \def\fontprefix{cm}
1089 \fi
1090 % Support font families that don't use the same naming scheme as CM.
1091 \def\rmshape{r}
1092 \def\rmbshape{bx}               %where the normal face is bold
1093 \def\bfshape{b}
1094 \def\bxshape{bx}
1095 \def\ttshape{tt}
1096 \def\ttbshape{tt}
1097 \def\ttslshape{sltt}
1098 \def\itshape{ti}
1099 \def\itbshape{bxti}
1100 \def\slshape{sl}
1101 \def\slbshape{bxsl}
1102 \def\sfshape{ss}
1103 \def\sfbshape{ss}
1104 \def\scshape{csc}
1105 \def\scbshape{csc}
1106
1107 \ifx\bigger\relax
1108 \let\mainmagstep=\magstep1
1109 \setfont\textrm\rmshape{12}{1000}
1110 \setfont\texttt\ttshape{12}{1000}
1111 \else
1112 \setfont\textrm\rmshape{10}{\mainmagstep}
1113 \setfont\texttt\ttshape{10}{\mainmagstep}
1114 \fi
1115 % Instead of cmb10, you many want to use cmbx10.
1116 % cmbx10 is a prettier font on its own, but cmb10
1117 % looks better when embedded in a line with cmr10.
1118 \setfont\textbf\bfshape{10}{\mainmagstep}
1119 \setfont\textit\itshape{10}{\mainmagstep}
1120 \setfont\textsl\slshape{10}{\mainmagstep}
1121 \setfont\textsf\sfshape{10}{\mainmagstep}
1122 \setfont\textsc\scshape{10}{\mainmagstep}
1123 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1124 \font\texti=cmmi10 scaled \mainmagstep
1125 \font\textsy=cmsy10 scaled \mainmagstep
1126
1127 % A few fonts for @defun, etc.
1128 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1129 \setfont\deftt\ttshape{10}{\magstep1}
1130 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1131
1132 % Fonts for indices, footnotes, small examples (9pt).
1133 \setfont\smallrm\rmshape{9}{1000}
1134 \setfont\smalltt\ttshape{9}{1000}
1135 \setfont\smallbf\bfshape{10}{900}
1136 \setfont\smallit\itshape{9}{1000}
1137 \setfont\smallsl\slshape{9}{1000}
1138 \setfont\smallsf\sfshape{9}{1000}
1139 \setfont\smallsc\scshape{10}{900}
1140 \setfont\smallttsl\ttslshape{10}{900}
1141 \font\smalli=cmmi9
1142 \font\smallsy=cmsy9
1143
1144 % Fonts for title page:
1145 \setfont\titlerm\rmbshape{12}{\magstep3}
1146 \setfont\titleit\itbshape{10}{\magstep4}
1147 \setfont\titlesl\slbshape{10}{\magstep4}
1148 \setfont\titlett\ttbshape{12}{\magstep3}
1149 \setfont\titlettsl\ttslshape{10}{\magstep4}
1150 \setfont\titlesf\sfbshape{17}{\magstep1}
1151 \let\titlebf=\titlerm
1152 \setfont\titlesc\scbshape{10}{\magstep4}
1153 \font\titlei=cmmi12 scaled \magstep3
1154 \font\titlesy=cmsy10 scaled \magstep4
1155 \def\authorrm{\secrm}
1156
1157 % Chapter (and unnumbered) fonts (17.28pt).
1158 \setfont\chaprm\rmbshape{12}{\magstep2}
1159 \setfont\chapit\itbshape{10}{\magstep3}
1160 \setfont\chapsl\slbshape{10}{\magstep3}
1161 \setfont\chaptt\ttbshape{12}{\magstep2}
1162 \setfont\chapttsl\ttslshape{10}{\magstep3}
1163 \setfont\chapsf\sfbshape{17}{1000}
1164 \let\chapbf=\chaprm
1165 \setfont\chapsc\scbshape{10}{\magstep3}
1166 \font\chapi=cmmi12 scaled \magstep2
1167 \font\chapsy=cmsy10 scaled \magstep3
1168
1169 % Section fonts (14.4pt).
1170 \setfont\secrm\rmbshape{12}{\magstep1}
1171 \setfont\secit\itbshape{10}{\magstep2}
1172 \setfont\secsl\slbshape{10}{\magstep2}
1173 \setfont\sectt\ttbshape{12}{\magstep1}
1174 \setfont\secttsl\ttslshape{10}{\magstep2}
1175 \setfont\secsf\sfbshape{12}{\magstep1}
1176 \let\secbf\secrm
1177 \setfont\secsc\scbshape{10}{\magstep2}
1178 \font\seci=cmmi12 scaled \magstep1
1179 \font\secsy=cmsy10 scaled \magstep2
1180
1181 % \setfont\ssecrm\bxshape{10}{\magstep1}    % This size an font looked bad.
1182 % \setfont\ssecit\itshape{10}{\magstep1}    % The letters were too crowded.
1183 % \setfont\ssecsl\slshape{10}{\magstep1}
1184 % \setfont\ssectt\ttshape{10}{\magstep1}
1185 % \setfont\ssecsf\sfshape{10}{\magstep1}
1186
1187 %\setfont\ssecrm\bfshape{10}{1315}      % Note the use of cmb rather than cmbx.
1188 %\setfont\ssecit\itshape{10}{1315}      % Also, the size is a little larger than
1189 %\setfont\ssecsl\slshape{10}{1315}      % being scaled magstep1.
1190 %\setfont\ssectt\ttshape{10}{1315}
1191 %\setfont\ssecsf\sfshape{10}{1315}
1192
1193 %\let\ssecbf=\ssecrm
1194
1195 % Subsection fonts (13.15pt).
1196 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1197 \setfont\ssecit\itbshape{10}{1315}
1198 \setfont\ssecsl\slbshape{10}{1315}
1199 \setfont\ssectt\ttbshape{12}{\magstephalf}
1200 \setfont\ssecttsl\ttslshape{10}{1315}
1201 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1202 \let\ssecbf\ssecrm
1203 \setfont\ssecsc\scbshape{10}{\magstep1}
1204 \font\sseci=cmmi12 scaled \magstephalf
1205 \font\ssecsy=cmsy10 scaled 1315
1206 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1207 % but that is not a standard magnification.
1208
1209 % In order for the font changes to affect most math symbols and letters,
1210 % we have to define the \textfont of the standard families.  Since
1211 % texinfo doesn't allow for producing subscripts and superscripts, we
1212 % don't bother to reset \scriptfont and \scriptscriptfont (which would
1213 % also require loading a lot more fonts).
1214 %
1215 \def\resetmathfonts{%
1216   \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1217   \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1218   \textfont\ttfam = \tentt \textfont\sffam = \tensf
1219 }
1220
1221
1222 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1223 % of just \STYLE.  We do this so that font changes will continue to work
1224 % in math mode, where it is the current \fam that is relevant in most
1225 % cases, not the current font.  Plain TeX does \def\bf{\fam=\bffam
1226 % \tenbf}, for example.  By redefining \tenbf, we obviate the need to
1227 % redefine \bf itself.
1228 \def\textfonts{%
1229   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1230   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1231   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1232   \resetmathfonts}
1233 \def\titlefonts{%
1234   \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
1235   \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
1236   \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
1237   \let\tenttsl=\titlettsl
1238   \resetmathfonts \setleading{25pt}}
1239 \def\titlefont#1{{\titlefonts\rm #1}}
1240 \def\chapfonts{%
1241   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1242   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1243   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1244   \resetmathfonts \setleading{19pt}}
1245 \def\secfonts{%
1246   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1247   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1248   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1249   \resetmathfonts \setleading{16pt}}
1250 \def\subsecfonts{%
1251   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1252   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1253   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1254   \resetmathfonts \setleading{15pt}}
1255 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1256 \def\smallfonts{%
1257   \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
1258   \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
1259   \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
1260   \let\tenttsl=\smallttsl
1261   \resetmathfonts \setleading{11pt}}
1262
1263 % Set up the default fonts, so we can use them for creating boxes.
1264 %
1265 \textfonts
1266
1267 % Define these so they can be easily changed for other fonts.
1268 \def\angleleft{$\langle$}
1269 \def\angleright{$\rangle$}
1270
1271 % Count depth in font-changes, for error checks
1272 \newcount\fontdepth \fontdepth=0
1273
1274 % Fonts for short table of contents.
1275 \setfont\shortcontrm\rmshape{12}{1000}
1276 \setfont\shortcontbf\bxshape{12}{1000}
1277 \setfont\shortcontsl\slshape{12}{1000}
1278
1279 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1280 %% serif) and @ii for TeX italic
1281
1282 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1283 % unless the following character is such as not to need one.
1284 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1285 \def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx}
1286 \def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx}
1287
1288 \let\i=\smartitalic
1289 \let\var=\smartslanted
1290 \let\dfn=\smartslanted
1291 \let\emph=\smartitalic
1292 \let\cite=\smartslanted
1293
1294 \def\b#1{{\bf #1}}
1295 \let\strong=\b
1296
1297 % We can't just use \exhyphenpenalty, because that only has effect at
1298 % the end of a paragraph.  Restore normal hyphenation at the end of the
1299 % group within which \nohyphenation is presumably called.
1300 %
1301 \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
1302 \def\restorehyphenation{\hyphenchar\font = `- }
1303
1304 \def\t#1{%
1305   {\tt \rawbackslash \frenchspacing #1}%
1306   \null
1307 }
1308 \let\ttfont=\t
1309 \def\samp#1{`\tclose{#1}'\null}
1310 \setfont\keyrm\rmshape{8}{1000}
1311 \font\keysy=cmsy9
1312 \def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
1313   \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
1314     \vbox{\hrule\kern-0.4pt
1315      \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
1316     \kern-0.4pt\hrule}%
1317   \kern-.06em\raise0.4pt\hbox{\angleright}}}}
1318 % The old definition, with no lozenge:
1319 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1320 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1321
1322 % @file, @option are the same as @samp.
1323 \let\file=\samp
1324 \let\option=\samp
1325
1326 % @code is a modification of @t,
1327 % which makes spaces the same size as normal in the surrounding text.
1328 \def\tclose#1{%
1329   {%
1330     % Change normal interword space to be same as for the current font.
1331     \spaceskip = \fontdimen2\font
1332     %
1333     % Switch to typewriter.
1334     \tt
1335     %
1336     % But `\ ' produces the large typewriter interword space.
1337     \def\ {{\spaceskip = 0pt{} }}%
1338     %
1339     % Turn off hyphenation.
1340     \nohyphenation
1341     %
1342     \rawbackslash
1343     \frenchspacing
1344     #1%
1345   }%
1346   \null
1347 }
1348
1349 % We *must* turn on hyphenation at `-' and `_' in \code.
1350 % Otherwise, it is too hard to avoid overfull hboxes
1351 % in the Emacs manual, the Library manual, etc.
1352
1353 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1354 % both hyphenation at - and hyphenation within words.
1355 % We must therefore turn them both off (\tclose does that)
1356 % and arrange explicitly to hyphenate at a dash.
1357 %  -- rms.
1358 {
1359   \catcode`\-=\active
1360   \catcode`\_=\active
1361   %
1362   \global\def\code{\begingroup
1363     \catcode`\-=\active \let-\codedash
1364     \catcode`\_=\active \let_\codeunder
1365     \codex
1366   }
1367   %
1368   % If we end up with any active - characters when handling the index,
1369   % just treat them as a normal -.
1370   \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
1371 }
1372
1373 \def\realdash{-}
1374 \def\codedash{-\discretionary{}{}{}}
1375 \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
1376 \def\codex #1{\tclose{#1}\endgroup}
1377
1378 %\let\exp=\tclose  %Was temporary
1379
1380 % @kbd is like @code, except that if the argument is just one @key command,
1381 % then @kbd has no effect.
1382
1383 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
1384 %   `example' (@kbd uses ttsl only inside of @example and friends),
1385 %   or `code' (@kbd uses normal tty font always).
1386 \def\kbdinputstyle{\parsearg\kbdinputstylexxx}
1387 \def\kbdinputstylexxx#1{%
1388   \def\arg{#1}%
1389   \ifx\arg\worddistinct
1390     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
1391   \else\ifx\arg\wordexample
1392     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
1393   \else\ifx\arg\wordcode
1394     \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
1395   \fi\fi\fi
1396 }
1397 \def\worddistinct{distinct}
1398 \def\wordexample{example}
1399 \def\wordcode{code}
1400
1401 % Default is kbdinputdistinct.  (Too much of a hassle to call the macro,
1402 % the catcodes are wrong for parsearg to work.)
1403 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
1404
1405 \def\xkey{\key}
1406 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1407 \ifx\one\xkey\ifx\threex\three \key{#2}%
1408 \else{\tclose{\kbdfont\look}}\fi
1409 \else{\tclose{\kbdfont\look}}\fi}
1410
1411 % For @url, @env, @command quotes seem unnecessary, so use \code.
1412 \let\url=\code
1413 \let\env=\code
1414 \let\command=\code
1415
1416 % @uref (abbreviation for `urlref') takes an optional (comma-separated)
1417 % second argument specifying the text to display and an optional third
1418 % arg as text to display instead of (rather than in addition to) the url
1419 % itself.  First (mandatory) arg is the url.  Perhaps eventually put in
1420 % a hypertex \special here.
1421 %
1422 \def\uref#1{\douref #1,,,\finish}
1423 \def\douref#1,#2,#3,#4\finish{\begingroup
1424   \unsepspaces
1425   \pdfurl{#1}%
1426   \setbox0 = \hbox{\ignorespaces #3}%
1427   \ifdim\wd0 > 0pt
1428     \unhbox0 % third arg given, show only that
1429   \else
1430     \setbox0 = \hbox{\ignorespaces #2}%
1431     \ifdim\wd0 > 0pt
1432       \ifpdf
1433         \unhbox0             % PDF: 2nd arg given, show only it
1434       \else
1435         \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
1436       \fi
1437     \else
1438       \code{#1}% only url given, so show it
1439     \fi
1440   \fi
1441   \endlink
1442 \endgroup}
1443
1444 % rms does not like angle brackets --karl, 17may97.
1445 % So now @email is just like @uref, unless we are pdf.
1446
1447 %\def\email#1{\angleleft{\tt #1}\angleright}
1448 \ifpdf
1449   \def\email#1{\doemail#1,,\finish}
1450   \def\doemail#1,#2,#3\finish{\begingroup
1451     \unsepspaces
1452     \pdfurl{mailto:#1}%
1453     \setbox0 = \hbox{\ignorespaces #2}%
1454     \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
1455     \endlink
1456   \endgroup}
1457 \else
1458   \let\email=\uref
1459 \fi
1460
1461 % Check if we are currently using a typewriter font.  Since all the
1462 % Computer Modern typewriter fonts have zero interword stretch (and
1463 % shrink), and it is reasonable to expect all typewriter fonts to have
1464 % this property, we can check that font parameter.
1465 %
1466 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1467
1468 % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
1469 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
1470 %
1471 \def\dmn#1{\thinspace #1}
1472
1473 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1474
1475 % @l was never documented to mean ``switch to the Lisp font'',
1476 % and it is not used as such in any manual I can find.  We need it for
1477 % Polish suppressed-l.  --karl, 22sep96.
1478 %\def\l#1{{\li #1}\null}
1479
1480 % Explicit font changes: @r, @sc, undocumented @ii.
1481 \def\r#1{{\rm #1}}              % roman font
1482 \def\sc#1{{\smallcaps#1}}       % smallcaps font
1483 \def\ii#1{{\it #1}}             % italic font
1484
1485 % @acronym downcases the argument and prints in smallcaps.
1486 \def\acronym#1{{\smallcaps \lowercase{#1}}}
1487
1488 % @pounds{} is a sterling sign.
1489 \def\pounds{{\it\$}}
1490
1491
1492 \message{page headings,}
1493
1494 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1495 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1496
1497 % First the title page.  Must do @settitle before @titlepage.
1498 \newif\ifseenauthor
1499 \newif\iffinishedtitlepage
1500
1501 % Do an implicit @contents or @shortcontents after @end titlepage if the
1502 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
1503 %
1504 \newif\ifsetcontentsaftertitlepage
1505  \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
1506 \newif\ifsetshortcontentsaftertitlepage
1507  \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
1508
1509 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1510 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1511         \endgroup\page\hbox{}\page}
1512
1513 \def\titlepage{\begingroup \parindent=0pt \textfonts
1514    \let\subtitlerm=\tenrm
1515    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1516    %
1517    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1518    %
1519    % Leave some space at the very top of the page.
1520    \vglue\titlepagetopglue
1521    %
1522    % Now you can print the title using @title.
1523    \def\title{\parsearg\titlezzz}%
1524    \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
1525                     % print a rule at the page bottom also.
1526                     \finishedtitlepagefalse
1527                     \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1528    % No rule at page bottom unless we print one at the top with @title.
1529    \finishedtitlepagetrue
1530    %
1531    % Now you can put text using @subtitle.
1532    \def\subtitle{\parsearg\subtitlezzz}%
1533    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1534    %
1535    % @author should come last, but may come many times.
1536    \def\author{\parsearg\authorzzz}%
1537    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1538       {\authorfont \leftline{##1}}}%
1539    %
1540    % Most title ``pages'' are actually two pages long, with space
1541    % at the top of the second.  We don't want the ragged left on the second.
1542    \let\oldpage = \page
1543    \def\page{%
1544       \iffinishedtitlepage\else
1545          \finishtitlepage
1546       \fi
1547       \oldpage
1548       \let\page = \oldpage
1549       \hbox{}}%
1550 %   \def\page{\oldpage \hbox{}}
1551 }
1552
1553 \def\Etitlepage{%
1554    \iffinishedtitlepage\else
1555       \finishtitlepage
1556    \fi
1557    % It is important to do the page break before ending the group,
1558    % because the headline and footline are only empty inside the group.
1559    % If we use the new definition of \page, we always get a blank page
1560    % after the title page, which we certainly don't want.
1561    \oldpage
1562    \endgroup
1563    %
1564    % If they want short, they certainly want long too.
1565    \ifsetshortcontentsaftertitlepage
1566      \shortcontents
1567      \contents
1568      \global\let\shortcontents = \relax
1569      \global\let\contents = \relax
1570    \fi
1571    %
1572    \ifsetcontentsaftertitlepage
1573      \contents
1574      \global\let\contents = \relax
1575      \global\let\shortcontents = \relax
1576    \fi
1577    %
1578    \ifpdf \pdfmakepagedesttrue \fi
1579    %
1580    \HEADINGSon
1581 }
1582
1583 \def\finishtitlepage{%
1584    \vskip4pt \hrule height 2pt width \hsize
1585    \vskip\titlepagebottomglue
1586    \finishedtitlepagetrue
1587 }
1588
1589 %%% Set up page headings and footings.
1590
1591 \let\thispage=\folio
1592
1593 \newtoks\evenheadline    % headline on even pages
1594 \newtoks\oddheadline     % headline on odd pages
1595 \newtoks\evenfootline    % footline on even pages
1596 \newtoks\oddfootline     % footline on odd pages
1597
1598 % Now make Tex use those variables
1599 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1600                             \else \the\evenheadline \fi}}
1601 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1602                             \else \the\evenfootline \fi}\HEADINGShook}
1603 \let\HEADINGShook=\relax
1604
1605 % Commands to set those variables.
1606 % For example, this is what  @headings on  does
1607 % @evenheading @thistitle|@thispage|@thischapter
1608 % @oddheading @thischapter|@thispage|@thistitle
1609 % @evenfooting @thisfile||
1610 % @oddfooting ||@thisfile
1611
1612 \def\evenheading{\parsearg\evenheadingxxx}
1613 \def\oddheading{\parsearg\oddheadingxxx}
1614 \def\everyheading{\parsearg\everyheadingxxx}
1615
1616 \def\evenfooting{\parsearg\evenfootingxxx}
1617 \def\oddfooting{\parsearg\oddfootingxxx}
1618 \def\everyfooting{\parsearg\everyfootingxxx}
1619
1620 {\catcode`\@=0 %
1621
1622 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1623 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1624 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1625
1626 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1627 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1628 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1629
1630 \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
1631
1632 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1633 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1634 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1635
1636 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1637 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1638   \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
1639   %
1640   % Leave some space for the footline.  Hopefully ok to assume
1641   % @evenfooting will not be used by itself.
1642   \global\advance\pageheight by -\baselineskip
1643   \global\advance\vsize by -\baselineskip
1644 }
1645
1646 \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
1647 %
1648 }% unbind the catcode of @.
1649
1650 % @headings double      turns headings on for double-sided printing.
1651 % @headings single      turns headings on for single-sided printing.
1652 % @headings off         turns them off.
1653 % @headings on          same as @headings double, retained for compatibility.
1654 % @headings after       turns on double-sided headings after this page.
1655 % @headings doubleafter turns on double-sided headings after this page.
1656 % @headings singleafter turns on single-sided headings after this page.
1657 % By default, they are off at the start of a document,
1658 % and turned `on' after @end titlepage.
1659
1660 \def\headings #1 {\csname HEADINGS#1\endcsname}
1661
1662 \def\HEADINGSoff{
1663 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1664 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1665 \HEADINGSoff
1666 % When we turn headings on, set the page number to 1.
1667 % For double-sided printing, put current file name in lower left corner,
1668 % chapter name on inside top of right hand pages, document
1669 % title on inside top of left hand pages, and page numbers on outside top
1670 % edge of all pages.
1671 \def\HEADINGSdouble{
1672 \global\pageno=1
1673 \global\evenfootline={\hfil}
1674 \global\oddfootline={\hfil}
1675 \global\evenheadline={\line{\folio\hfil\thistitle}}
1676 \global\oddheadline={\line{\thischapter\hfil\folio}}
1677 \global\let\contentsalignmacro = \chapoddpage
1678 }
1679 \let\contentsalignmacro = \chappager
1680
1681 % For single-sided printing, chapter title goes across top left of page,
1682 % page number on top right.
1683 \def\HEADINGSsingle{
1684 \global\pageno=1
1685 \global\evenfootline={\hfil}
1686 \global\oddfootline={\hfil}
1687 \global\evenheadline={\line{\thischapter\hfil\folio}}
1688 \global\oddheadline={\line{\thischapter\hfil\folio}}
1689 \global\let\contentsalignmacro = \chappager
1690 }
1691 \def\HEADINGSon{\HEADINGSdouble}
1692
1693 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1694 \let\HEADINGSdoubleafter=\HEADINGSafter
1695 \def\HEADINGSdoublex{%
1696 \global\evenfootline={\hfil}
1697 \global\oddfootline={\hfil}
1698 \global\evenheadline={\line{\folio\hfil\thistitle}}
1699 \global\oddheadline={\line{\thischapter\hfil\folio}}
1700 \global\let\contentsalignmacro = \chapoddpage
1701 }
1702
1703 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1704 \def\HEADINGSsinglex{%
1705 \global\evenfootline={\hfil}
1706 \global\oddfootline={\hfil}
1707 \global\evenheadline={\line{\thischapter\hfil\folio}}
1708 \global\oddheadline={\line{\thischapter\hfil\folio}}
1709 \global\let\contentsalignmacro = \chappager
1710 }
1711
1712 % Subroutines used in generating headings
1713 % This produces Day Month Year style of output.
1714 % Only define if not already defined, in case a txi-??.tex file has set
1715 % up a different format (e.g., txi-cs.tex does this).
1716 \ifx\today\undefined
1717 \def\today{%
1718   \number\day\space
1719   \ifcase\month
1720   \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
1721   \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
1722   \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
1723   \fi
1724   \space\number\year}
1725 \fi
1726
1727 % @settitle line...  specifies the title of the document, for headings.
1728 % It generates no output of its own.
1729 \def\thistitle{\putwordNoTitle}
1730 \def\settitle{\parsearg\settitlezzz}
1731 \def\settitlezzz #1{\gdef\thistitle{#1}}
1732
1733
1734 \message{tables,}
1735 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1736
1737 % default indentation of table text
1738 \newdimen\tableindent \tableindent=.8in
1739 % default indentation of @itemize and @enumerate text
1740 \newdimen\itemindent  \itemindent=.3in
1741 % margin between end of table item and start of table text.
1742 \newdimen\itemmargin  \itemmargin=.1in
1743
1744 % used internally for \itemindent minus \itemmargin
1745 \newdimen\itemmax
1746
1747 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1748 % these defs.
1749 % They also define \itemindex
1750 % to index the item name in whatever manner is desired (perhaps none).
1751
1752 \newif\ifitemxneedsnegativevskip
1753
1754 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1755
1756 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1757 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1758
1759 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1760 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1761
1762 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1763 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1764
1765 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1766                  \itemzzz {#1}}
1767
1768 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1769                  \itemzzz {#1}}
1770
1771 \def\itemzzz #1{\begingroup %
1772   \advance\hsize by -\rightskip
1773   \advance\hsize by -\tableindent
1774   \setbox0=\hbox{\itemfont{#1}}%
1775   \itemindex{#1}%
1776   \nobreak % This prevents a break before @itemx.
1777   %
1778   % If the item text does not fit in the space we have, put it on a line
1779   % by itself, and do not allow a page break either before or after that
1780   % line.  We do not start a paragraph here because then if the next
1781   % command is, e.g., @kindex, the whatsit would get put into the
1782   % horizontal list on a line by itself, resulting in extra blank space.
1783   \ifdim \wd0>\itemmax
1784     %
1785     % Make this a paragraph so we get the \parskip glue and wrapping,
1786     % but leave it ragged-right.
1787     \begingroup
1788       \advance\leftskip by-\tableindent
1789       \advance\hsize by\tableindent
1790       \advance\rightskip by0pt plus1fil
1791       \leavevmode\unhbox0\par
1792     \endgroup
1793     %
1794     % We're going to be starting a paragraph, but we don't want the
1795     % \parskip glue -- logically it's part of the @item we just started.
1796     \nobreak \vskip-\parskip
1797     %
1798     % Stop a page break at the \parskip glue coming up.  Unfortunately
1799     % we can't prevent a possible page break at the following
1800     % \baselineskip glue.
1801     \nobreak
1802     \endgroup
1803     \itemxneedsnegativevskipfalse
1804   \else
1805     % The item text fits into the space.  Start a paragraph, so that the
1806     % following text (if any) will end up on the same line.
1807     \noindent
1808     % Do this with kerns and \unhbox so that if there is a footnote in
1809     % the item text, it can migrate to the main vertical list and
1810     % eventually be printed.
1811     \nobreak\kern-\tableindent
1812     \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
1813     \unhbox0
1814     \nobreak\kern\dimen0
1815     \endgroup
1816     \itemxneedsnegativevskiptrue
1817   \fi
1818 }
1819
1820 \def\item{\errmessage{@item while not in a table}}
1821 \def\itemx{\errmessage{@itemx while not in a table}}
1822 \def\kitem{\errmessage{@kitem while not in a table}}
1823 \def\kitemx{\errmessage{@kitemx while not in a table}}
1824 \def\xitem{\errmessage{@xitem while not in a table}}
1825 \def\xitemx{\errmessage{@xitemx while not in a table}}
1826
1827 % Contains a kludge to get @end[description] to work.
1828 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1829
1830 % @table, @ftable, @vtable.
1831 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1832 {\obeylines\obeyspaces%
1833 \gdef\tablex #1^^M{%
1834 \tabley\dontindex#1        \endtabley}}
1835
1836 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1837 {\obeylines\obeyspaces%
1838 \gdef\ftablex #1^^M{%
1839 \tabley\fnitemindex#1        \endtabley
1840 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1841 \let\Etable=\relax}}
1842
1843 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1844 {\obeylines\obeyspaces%
1845 \gdef\vtablex #1^^M{%
1846 \tabley\vritemindex#1        \endtabley
1847 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1848 \let\Etable=\relax}}
1849
1850 \def\dontindex #1{}
1851 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1852 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1853
1854 {\obeyspaces %
1855 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1856 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1857
1858 \def\tablez #1#2#3#4#5#6{%
1859 \aboveenvbreak %
1860 \begingroup %
1861 \def\Edescription{\Etable}% Necessary kludge.
1862 \let\itemindex=#1%
1863 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1864 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1865 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1866 \def\itemfont{#2}%
1867 \itemmax=\tableindent %
1868 \advance \itemmax by -\itemmargin %
1869 \advance \leftskip by \tableindent %
1870 \exdentamount=\tableindent
1871 \parindent = 0pt
1872 \parskip = \smallskipamount
1873 \ifdim \parskip=0pt \parskip=2pt \fi%
1874 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1875 \let\item = \internalBitem %
1876 \let\itemx = \internalBitemx %
1877 \let\kitem = \internalBkitem %
1878 \let\kitemx = \internalBkitemx %
1879 \let\xitem = \internalBxitem %
1880 \let\xitemx = \internalBxitemx %
1881 }
1882
1883 % This is the counter used by @enumerate, which is really @itemize
1884
1885 \newcount \itemno
1886
1887 \def\itemize{\parsearg\itemizezzz}
1888
1889 \def\itemizezzz #1{%
1890   \begingroup % ended by the @end itemize
1891   \itemizey {#1}{\Eitemize}
1892 }
1893
1894 \def\itemizey #1#2{%
1895 \aboveenvbreak %
1896 \itemmax=\itemindent %
1897 \advance \itemmax by -\itemmargin %
1898 \advance \leftskip by \itemindent %
1899 \exdentamount=\itemindent
1900 \parindent = 0pt %
1901 \parskip = \smallskipamount %
1902 \ifdim \parskip=0pt \parskip=2pt \fi%
1903 \def#2{\endgraf\afterenvbreak\endgroup}%
1904 \def\itemcontents{#1}%
1905 \let\item=\itemizeitem}
1906
1907 % Set sfcode to normal for the chars that usually have another value.
1908 % These are `.?!:;,'
1909 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1910   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1911
1912 % \splitoff TOKENS\endmark defines \first to be the first token in
1913 % TOKENS, and \rest to be the remainder.
1914 %
1915 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1916
1917 % Allow an optional argument of an uppercase letter, lowercase letter,
1918 % or number, to specify the first label in the enumerated list.  No
1919 % argument is the same as `1'.
1920 %
1921 \def\enumerate{\parsearg\enumeratezzz}
1922 \def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
1923 \def\enumeratey #1 #2\endenumeratey{%
1924   \begingroup % ended by the @end enumerate
1925   %
1926   % If we were given no argument, pretend we were given `1'.
1927   \def\thearg{#1}%
1928   \ifx\thearg\empty \def\thearg{1}\fi
1929   %
1930   % Detect if the argument is a single token.  If so, it might be a
1931   % letter.  Otherwise, the only valid thing it can be is a number.
1932   % (We will always have one token, because of the test we just made.
1933   % This is a good thing, since \splitoff doesn't work given nothing at
1934   % all -- the first parameter is undelimited.)
1935   \expandafter\splitoff\thearg\endmark
1936   \ifx\rest\empty
1937     % Only one token in the argument.  It could still be anything.
1938     % A ``lowercase letter'' is one whose \lccode is nonzero.
1939     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1940     %   not equal to itself.
1941     % Otherwise, we assume it's a number.
1942     %
1943     % We need the \relax at the end of the \ifnum lines to stop TeX from
1944     % continuing to look for a <number>.
1945     %
1946     \ifnum\lccode\expandafter`\thearg=0\relax
1947       \numericenumerate % a number (we hope)
1948     \else
1949       % It's a letter.
1950       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1951         \lowercaseenumerate % lowercase letter
1952       \else
1953         \uppercaseenumerate % uppercase letter
1954       \fi
1955     \fi
1956   \else
1957     % Multiple tokens in the argument.  We hope it's a number.
1958     \numericenumerate
1959   \fi
1960 }
1961
1962 % An @enumerate whose labels are integers.  The starting integer is
1963 % given in \thearg.
1964 %
1965 \def\numericenumerate{%
1966   \itemno = \thearg
1967   \startenumeration{\the\itemno}%
1968 }
1969
1970 % The starting (lowercase) letter is in \thearg.
1971 \def\lowercaseenumerate{%
1972   \itemno = \expandafter`\thearg
1973   \startenumeration{%
1974     % Be sure we're not beyond the end of the alphabet.
1975     \ifnum\itemno=0
1976       \errmessage{No more lowercase letters in @enumerate; get a bigger
1977                   alphabet}%
1978     \fi
1979     \char\lccode\itemno
1980   }%
1981 }
1982
1983 % The starting (uppercase) letter is in \thearg.
1984 \def\uppercaseenumerate{%
1985   \itemno = \expandafter`\thearg
1986   \startenumeration{%
1987     % Be sure we're not beyond the end of the alphabet.
1988     \ifnum\itemno=0
1989       \errmessage{No more uppercase letters in @enumerate; get a bigger
1990                   alphabet}
1991     \fi
1992     \char\uccode\itemno
1993   }%
1994 }
1995
1996 % Call itemizey, adding a period to the first argument and supplying the
1997 % common last two arguments.  Also subtract one from the initial value in
1998 % \itemno, since @item increments \itemno.
1999 %
2000 \def\startenumeration#1{%
2001   \advance\itemno by -1
2002   \itemizey{#1.}\Eenumerate\flushcr
2003 }
2004
2005 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
2006 % to @enumerate.
2007 %
2008 \def\alphaenumerate{\enumerate{a}}
2009 \def\capsenumerate{\enumerate{A}}
2010 \def\Ealphaenumerate{\Eenumerate}
2011 \def\Ecapsenumerate{\Eenumerate}
2012
2013 % Definition of @item while inside @itemize.
2014
2015 \def\itemizeitem{%
2016 \advance\itemno by 1
2017 {\let\par=\endgraf \smallbreak}%
2018 \ifhmode \errmessage{In hmode at itemizeitem}\fi
2019 {\parskip=0in \hskip 0pt
2020 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
2021 \vadjust{\penalty 1200}}%
2022 \flushcr}
2023
2024 % @multitable macros
2025 % Amy Hendrickson, 8/18/94, 3/6/96
2026 %
2027 % @multitable ... @end multitable will make as many columns as desired.
2028 % Contents of each column will wrap at width given in preamble.  Width
2029 % can be specified either with sample text given in a template line,
2030 % or in percent of \hsize, the current width of text on page.
2031
2032 % Table can continue over pages but will only break between lines.
2033
2034 % To make preamble:
2035 %
2036 % Either define widths of columns in terms of percent of \hsize:
2037 %   @multitable @columnfractions .25 .3 .45
2038 %   @item ...
2039 %
2040 %   Numbers following @columnfractions are the percent of the total
2041 %   current hsize to be used for each column. You may use as many
2042 %   columns as desired.
2043
2044
2045 % Or use a template:
2046 %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2047 %   @item ...
2048 %   using the widest term desired in each column.
2049 %
2050 % For those who want to use more than one line's worth of words in
2051 % the preamble, break the line within one argument and it
2052 % will parse correctly, i.e.,
2053 %
2054 %     @multitable {Column 1 template} {Column 2 template} {Column 3
2055 %      template}
2056 % Not:
2057 %     @multitable {Column 1 template} {Column 2 template}
2058 %      {Column 3 template}
2059
2060 % Each new table line starts with @item, each subsequent new column
2061 % starts with @tab. Empty columns may be produced by supplying @tab's
2062 % with nothing between them for as many times as empty columns are needed,
2063 % ie, @tab@tab@tab will produce two empty columns.
2064
2065 % @item, @tab, @multitable or @end multitable do not need to be on their
2066 % own lines, but it will not hurt if they are.
2067
2068 % Sample multitable:
2069
2070 %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2071 %   @item first col stuff @tab second col stuff @tab third col
2072 %   @item
2073 %   first col stuff
2074 %   @tab
2075 %   second col stuff
2076 %   @tab
2077 %   third col
2078 %   @item first col stuff @tab second col stuff
2079 %   @tab Many paragraphs of text may be used in any column.
2080 %
2081 %         They will wrap at the width determined by the template.
2082 %   @item@tab@tab This will be in third column.
2083 %   @end multitable
2084
2085 % Default dimensions may be reset by user.
2086 % @multitableparskip is vertical space between paragraphs in table.
2087 % @multitableparindent is paragraph indent in table.
2088 % @multitablecolmargin is horizontal space to be left between columns.
2089 % @multitablelinespace is space to leave between table items, baseline
2090 %                                                            to baseline.
2091 %   0pt means it depends on current normal line spacing.
2092 %
2093 \newskip\multitableparskip
2094 \newskip\multitableparindent
2095 \newdimen\multitablecolspace
2096 \newskip\multitablelinespace
2097 \multitableparskip=0pt
2098 \multitableparindent=6pt
2099 \multitablecolspace=12pt
2100 \multitablelinespace=0pt
2101
2102 % Macros used to set up halign preamble:
2103 %
2104 \let\endsetuptable\relax
2105 \def\xendsetuptable{\endsetuptable}
2106 \let\columnfractions\relax
2107 \def\xcolumnfractions{\columnfractions}
2108 \newif\ifsetpercent
2109
2110 % #1 is the part of the @columnfraction before the decimal point, which
2111 % is presumably either 0 or the empty string (but we don't check, we
2112 % just throw it away).  #2 is the decimal part, which we use as the
2113 % percent of \hsize for this column.
2114 \def\pickupwholefraction#1.#2 {%
2115   \global\advance\colcount by 1
2116   \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
2117   \setuptable
2118 }
2119
2120 \newcount\colcount
2121 \def\setuptable#1{%
2122   \def\firstarg{#1}%
2123   \ifx\firstarg\xendsetuptable
2124     \let\go = \relax
2125   \else
2126     \ifx\firstarg\xcolumnfractions
2127       \global\setpercenttrue
2128     \else
2129       \ifsetpercent
2130          \let\go\pickupwholefraction
2131       \else
2132          \global\advance\colcount by 1
2133          \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator;
2134                             % typically that is always in the input, anyway.
2135          \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2136       \fi
2137     \fi
2138     \ifx\go\pickupwholefraction
2139       % Put the argument back for the \pickupwholefraction call, so
2140       % we'll always have a period there to be parsed.
2141       \def\go{\pickupwholefraction#1}%
2142     \else
2143       \let\go = \setuptable
2144     \fi%
2145   \fi
2146   \go
2147 }
2148
2149 % This used to have \hskip1sp.  But then the space in a template line is
2150 % not enough.  That is bad.  So let's go back to just & until we
2151 % encounter the problem it was intended to solve again.
2152 % --karl, nathan@acm.org, 20apr99.
2153 \def\tab{&}
2154
2155 % @multitable ... @end multitable definitions:
2156 %
2157 \def\multitable{\parsearg\dotable}
2158 \def\dotable#1{\bgroup
2159   \vskip\parskip
2160   \let\item\crcr
2161   \tolerance=9500
2162   \hbadness=9500
2163   \setmultitablespacing
2164   \parskip=\multitableparskip
2165   \parindent=\multitableparindent
2166   \overfullrule=0pt
2167   \global\colcount=0
2168   \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
2169   %
2170   % To parse everything between @multitable and @item:
2171   \setuptable#1 \endsetuptable
2172   %
2173   % \everycr will reset column counter, \colcount, at the end of
2174   % each line. Every column entry will cause \colcount to advance by one.
2175   % The table preamble
2176   % looks at the current \colcount to find the correct column width.
2177   \everycr{\noalign{%
2178   %
2179   % \filbreak%% keeps underfull box messages off when table breaks over pages.
2180   % Maybe so, but it also creates really weird page breaks when the table
2181   % breaks over pages. Wouldn't \vfil be better?  Wait until the problem
2182   % manifests itself, so it can be fixed for real --karl.
2183     \global\colcount=0\relax}}%
2184   %
2185   % This preamble sets up a generic column definition, which will
2186   % be used as many times as user calls for columns.
2187   % \vtop will set a single line and will also let text wrap and
2188   % continue for many paragraphs if desired.
2189   \halign\bgroup&\global\advance\colcount by 1\relax
2190     \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2191   %
2192   % In order to keep entries from bumping into each other
2193   % we will add a \leftskip of \multitablecolspace to all columns after
2194   % the first one.
2195   %
2196   % If a template has been used, we will add \multitablecolspace
2197   % to the width of each template entry.
2198   %
2199   % If the user has set preamble in terms of percent of \hsize we will
2200   % use that dimension as the width of the column, and the \leftskip
2201   % will keep entries from bumping into each other.  Table will start at
2202   % left margin and final column will justify at right margin.
2203   %
2204   % Make sure we don't inherit \rightskip from the outer environment.
2205   \rightskip=0pt
2206   \ifnum\colcount=1
2207     % The first column will be indented with the surrounding text.
2208     \advance\hsize by\leftskip
2209   \else
2210     \ifsetpercent \else
2211       % If user has not set preamble in terms of percent of \hsize
2212       % we will advance \hsize by \multitablecolspace.
2213       \advance\hsize by \multitablecolspace
2214     \fi
2215    % In either case we will make \leftskip=\multitablecolspace:
2216   \leftskip=\multitablecolspace
2217   \fi
2218   % Ignoring space at the beginning and end avoids an occasional spurious
2219   % blank line, when TeX decides to break the line at the space before the
2220   % box from the multistrut, so the strut ends up on a line by itself.
2221   % For example:
2222   % @multitable @columnfractions .11 .89
2223   % @item @code{#}
2224   % @tab Legal holiday which is valid in major parts of the whole country.
2225   % Is automatically provided with highlighting sequences respectively marking
2226   % characters.
2227   \noindent\ignorespaces##\unskip\multistrut}\cr
2228 }
2229
2230 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2231 % If so, do nothing. If not, give it an appropriate dimension based on
2232 % current baselineskip.
2233 \ifdim\multitablelinespace=0pt
2234 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
2235 \global\advance\multitablelinespace by-\ht0
2236 %% strut to put in table in case some entry doesn't have descenders,
2237 %% to keep lines equally spaced
2238 \let\multistrut = \strut
2239 \else
2240 %% FIXME: what is \box0 supposed to be?
2241 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2242 width0pt\relax} \fi
2243 %% Test to see if parskip is larger than space between lines of
2244 %% table. If not, do nothing.
2245 %%        If so, set to same dimension as multitablelinespace.
2246 \ifdim\multitableparskip>\multitablelinespace
2247 \global\multitableparskip=\multitablelinespace
2248 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2249                                       %% than skip between lines in the table.
2250 \fi%
2251 \ifdim\multitableparskip=0pt
2252 \global\multitableparskip=\multitablelinespace
2253 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2254                                       %% than skip between lines in the table.
2255 \fi}
2256
2257
2258 \message{conditionals,}
2259 % Prevent errors for section commands.
2260 % Used in @ignore and in failing conditionals.
2261 \def\ignoresections{%
2262   \let\chapter=\relax
2263   \let\unnumbered=\relax
2264   \let\top=\relax
2265   \let\unnumberedsec=\relax
2266   \let\unnumberedsection=\relax
2267   \let\unnumberedsubsec=\relax
2268   \let\unnumberedsubsection=\relax
2269   \let\unnumberedsubsubsec=\relax
2270   \let\unnumberedsubsubsection=\relax
2271   \let\section=\relax
2272   \let\subsec=\relax
2273   \let\subsubsec=\relax
2274   \let\subsection=\relax
2275   \let\subsubsection=\relax
2276   \let\appendix=\relax
2277   \let\appendixsec=\relax
2278   \let\appendixsection=\relax
2279   \let\appendixsubsec=\relax
2280   \let\appendixsubsection=\relax
2281   \let\appendixsubsubsec=\relax
2282   \let\appendixsubsubsection=\relax
2283   \let\contents=\relax
2284   \let\smallbook=\relax
2285   \let\titlepage=\relax
2286 }
2287
2288 % Used in nested conditionals, where we have to parse the Texinfo source
2289 % and so want to turn off most commands, in case they are used
2290 % incorrectly.
2291 %
2292 \def\ignoremorecommands{%
2293   \let\defcodeindex = \relax
2294   \let\defcv = \relax
2295   \let\deffn = \relax
2296   \let\deffnx = \relax
2297   \let\defindex = \relax
2298   \let\defivar = \relax
2299   \let\defmac = \relax
2300   \let\defmethod = \relax
2301   \let\defop = \relax
2302   \let\defopt = \relax
2303   \let\defspec = \relax
2304   \let\deftp = \relax
2305   \let\deftypefn = \relax
2306   \let\deftypefun = \relax
2307   \let\deftypeivar = \relax
2308   \let\deftypeop = \relax
2309   \let\deftypevar = \relax
2310   \let\deftypevr = \relax
2311   \let\defun = \relax
2312   \let\defvar = \relax
2313   \let\defvr = \relax
2314   \let\ref = \relax
2315   \let\xref = \relax
2316   \let\printindex = \relax
2317   \let\pxref = \relax
2318   \let\settitle = \relax
2319   \let\setchapternewpage = \relax
2320   \let\setchapterstyle = \relax
2321   \let\everyheading = \relax
2322   \let\evenheading = \relax
2323   \let\oddheading = \relax
2324   \let\everyfooting = \relax
2325   \let\evenfooting = \relax
2326   \let\oddfooting = \relax
2327   \let\headings = \relax
2328   \let\include = \relax
2329   \let\lowersections = \relax
2330   \let\down = \relax
2331   \let\raisesections = \relax
2332   \let\up = \relax
2333   \let\set = \relax
2334   \let\clear = \relax
2335   \let\item = \relax
2336 }
2337
2338 % Ignore @ignore ... @end ignore.
2339 %
2340 \def\ignore{\doignore{ignore}}
2341
2342 % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
2343 %
2344 \def\ifinfo{\doignore{ifinfo}}
2345 \def\ifhtml{\doignore{ifhtml}}
2346 \def\ifnottex{\doignore{ifnottex}}
2347 \def\html{\doignore{html}}
2348 \def\menu{\doignore{menu}}
2349 \def\direntry{\doignore{direntry}}
2350
2351 % @dircategory CATEGORY  -- specify a category of the dir file
2352 % which this file should belong to.  Ignore this in TeX.
2353 \let\dircategory = \comment
2354
2355 % Ignore text until a line `@end #1'.
2356 %
2357 \def\doignore#1{\begingroup
2358   % Don't complain about control sequences we have declared \outer.
2359   \ignoresections
2360   %
2361   % Define a command to swallow text until we reach `@end #1'.
2362   % This @ is a catcode 12 token (that is the normal catcode of @ in
2363   % this texinfo.tex file).  We change the catcode of @ below to match.
2364   \long\def\doignoretext##1@end #1{\enddoignore}%
2365   %
2366   % Make sure that spaces turn into tokens that match what \doignoretext wants.
2367   \catcode32 = 10
2368   %
2369   % Ignore braces, too, so mismatched braces don't cause trouble.
2370   \catcode`\{ = 9
2371   \catcode`\} = 9
2372   %
2373   % We must not have @c interpreted as a control sequence.
2374   \catcode`\@ = 12
2375   %
2376   % Make the letter c a comment character so that the rest of the line
2377   % will be ignored. This way, the document can have (for example)
2378   %   @c @end ifinfo
2379   % and the @end ifinfo will be properly ignored.
2380   % (We've just changed @ to catcode 12.)
2381   \catcode`\c = 14
2382   %
2383   % And now expand that command.
2384   \doignoretext
2385 }
2386
2387 % What we do to finish off ignored text.
2388 %
2389 \def\enddoignore{\endgroup\ignorespaces}%
2390
2391 \newif\ifwarnedobs\warnedobsfalse
2392 \def\obstexwarn{%
2393   \ifwarnedobs\relax\else
2394   % We need to warn folks that they may have trouble with TeX 3.0.
2395   % This uses \immediate\write16 rather than \message to get newlines.
2396     \immediate\write16{}
2397     \immediate\write16{WARNING: for users of Unix TeX 3.0!}
2398     \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
2399     \immediate\write16{If you are running another version of TeX, relax.}
2400     \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
2401     \immediate\write16{  Then upgrade your TeX installation if you can.}
2402     \immediate\write16{  (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
2403     \immediate\write16{If you are stuck with version 3.0, run the}
2404     \immediate\write16{  script ``tex3patch'' from the Texinfo distribution}
2405     \immediate\write16{  to use a workaround.}
2406     \immediate\write16{}
2407     \global\warnedobstrue
2408     \fi
2409 }
2410
2411 % **In TeX 3.0, setting text in \nullfont hangs tex.  For a
2412 % workaround (which requires the file ``dummy.tfm'' to be installed),
2413 % uncomment the following line:
2414 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
2415
2416 % Ignore text, except that we keep track of conditional commands for
2417 % purposes of nesting, up to an `@end #1' command.
2418 %
2419 \def\nestedignore#1{%
2420   \obstexwarn
2421   % We must actually expand the ignored text to look for the @end
2422   % command, so that nested ignore constructs work.  Thus, we put the
2423   % text into a \vbox and then do nothing with the result.  To minimize
2424   % the change of memory overflow, we follow the approach outlined on
2425   % page 401 of the TeXbook: make the current font be a dummy font.
2426   %
2427   \setbox0 = \vbox\bgroup
2428     % Don't complain about control sequences we have declared \outer.
2429     \ignoresections
2430     %
2431     % Define `@end #1' to end the box, which will in turn undefine the
2432     % @end command again.
2433     \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
2434     %
2435     % We are going to be parsing Texinfo commands.  Most cause no
2436     % trouble when they are used incorrectly, but some commands do
2437     % complicated argument parsing or otherwise get confused, so we
2438     % undefine them.
2439     %
2440     % We can't do anything about stray @-signs, unfortunately;
2441     % they'll produce `undefined control sequence' errors.
2442     \ignoremorecommands
2443     %
2444     % Set the current font to be \nullfont, a TeX primitive, and define
2445     % all the font commands to also use \nullfont.  We don't use
2446     % dummy.tfm, as suggested in the TeXbook, because not all sites
2447     % might have that installed.  Therefore, math mode will still
2448     % produce output, but that should be an extremely small amount of
2449     % stuff compared to the main input.
2450     %
2451     \nullfont
2452     \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont
2453     \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont
2454     \let\tensf=\nullfont
2455     % Similarly for index fonts (mostly for their use in smallexample).
2456     \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont
2457     \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont
2458     \let\smallsf=\nullfont
2459     %
2460     % Don't complain when characters are missing from the fonts.
2461     \tracinglostchars = 0
2462     %
2463     % Don't bother to do space factor calculations.
2464     \frenchspacing
2465     %
2466     % Don't report underfull hboxes.
2467     \hbadness = 10000
2468     %
2469     % Do minimal line-breaking.
2470     \pretolerance = 10000
2471     %
2472     % Do not execute instructions in @tex
2473     \def\tex{\doignore{tex}}%
2474     % Do not execute macro definitions.
2475     % `c' is a comment character, so the word `macro' will get cut off.
2476     \def\macro{\doignore{ma}}%
2477 }
2478
2479 % @set VAR sets the variable VAR to an empty value.
2480 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
2481 %
2482 % Since we want to separate VAR from REST-OF-LINE (which might be
2483 % empty), we can't just use \parsearg; we have to insert a space of our
2484 % own to delimit the rest of the line, and then take it out again if we
2485 % didn't need it.  Make sure the catcode of space is correct to avoid
2486 % losing inside @example, for instance.
2487 %
2488 \def\set{\begingroup\catcode` =10
2489   \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
2490   \parsearg\setxxx}
2491 \def\setxxx#1{\setyyy#1 \endsetyyy}
2492 \def\setyyy#1 #2\endsetyyy{%
2493   \def\temp{#2}%
2494   \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
2495   \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
2496   \fi
2497   \endgroup
2498 }
2499 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
2500 % \next or other control sequences that we've defined might get us into
2501 % an infinite loop. Consider `@set foo @cite{bar}'.
2502 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
2503
2504 % @clear VAR clears (i.e., unsets) the variable VAR.
2505 %
2506 \def\clear{\parsearg\clearxxx}
2507 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
2508
2509 % @value{foo} gets the text saved in variable foo.
2510 {
2511   \catcode`\_ = \active
2512   %
2513   % We might end up with active _ or - characters in the argument if
2514   % we're called from @code, as @code{@value{foo-bar_}}.  So \let any
2515   % such active characters to their normal equivalents.
2516   \gdef\value{\begingroup
2517     \catcode`\-=12 \catcode`\_=12
2518     \indexbreaks \let_\normalunderscore
2519     \valuexxx}
2520 }
2521 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
2522
2523 % We have this subroutine so that we can handle at least some @value's
2524 % properly in indexes (we \let\value to this in \indexdummies).  Ones
2525 % whose names contain - or _ still won't work, but we can't do anything
2526 % about that.  The command has to be fully expandable, since the result
2527 % winds up in the index file.  This means that if the variable's value
2528 % contains other Texinfo commands, it's almost certain it will fail
2529 % (although perhaps we could fix that with sufficient work to do a
2530 % one-level expansion on the result, instead of complete).
2531 %
2532 \def\expandablevalue#1{%
2533   \expandafter\ifx\csname SET#1\endcsname\relax
2534     {[No value for ``#1'']}%
2535   \else
2536     \csname SET#1\endcsname
2537   \fi
2538 }
2539
2540 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
2541 % with @set.
2542 %
2543 \def\ifset{\parsearg\ifsetxxx}
2544 \def\ifsetxxx #1{%
2545   \expandafter\ifx\csname SET#1\endcsname\relax
2546     \expandafter\ifsetfail
2547   \else
2548     \expandafter\ifsetsucceed
2549   \fi
2550 }
2551 \def\ifsetsucceed{\conditionalsucceed{ifset}}
2552 \def\ifsetfail{\nestedignore{ifset}}
2553 \defineunmatchedend{ifset}
2554
2555 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
2556 % defined with @set, or has been undefined with @clear.
2557 %
2558 \def\ifclear{\parsearg\ifclearxxx}
2559 \def\ifclearxxx #1{%
2560   \expandafter\ifx\csname SET#1\endcsname\relax
2561     \expandafter\ifclearsucceed
2562   \else
2563     \expandafter\ifclearfail
2564   \fi
2565 }
2566 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
2567 \def\ifclearfail{\nestedignore{ifclear}}
2568 \defineunmatchedend{ifclear}
2569
2570 % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
2571 % following, through the first @end iftex (etc.).  Make `@end iftex'
2572 % (etc.) valid only after an @iftex.
2573 %
2574 \def\iftex{\conditionalsucceed{iftex}}
2575 \def\ifnothtml{\conditionalsucceed{ifnothtml}}
2576 \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
2577 \defineunmatchedend{iftex}
2578 \defineunmatchedend{ifnothtml}
2579 \defineunmatchedend{ifnotinfo}
2580
2581 % We can't just want to start a group at @iftex (for example) and end it
2582 % at @end iftex, since then @set commands inside the conditional have no
2583 % effect (they'd get reverted at the end of the group).  So we must
2584 % define \Eiftex to redefine itself to be its previous value.  (We can't
2585 % just define it to fail again with an ``unmatched end'' error, since
2586 % the @ifset might be nested.)
2587 %
2588 \def\conditionalsucceed#1{%
2589   \edef\temp{%
2590     % Remember the current value of \E#1.
2591     \let\nece{prevE#1} = \nece{E#1}%
2592     %
2593     % At the `@end #1', redefine \E#1 to be its previous value.
2594     \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
2595   }%
2596   \temp
2597 }
2598
2599 % We need to expand lots of \csname's, but we don't want to expand the
2600 % control sequences after we've constructed them.
2601 %
2602 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
2603
2604 % @defininfoenclose.
2605 \let\definfoenclose=\comment
2606
2607
2608 \message{indexing,}
2609 % Index generation facilities
2610
2611 % Define \newwrite to be identical to plain tex's \newwrite
2612 % except not \outer, so it can be used within \newindex.
2613 {\catcode`\@=11
2614 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2615
2616 % \newindex {foo} defines an index named foo.
2617 % It automatically defines \fooindex such that
2618 % \fooindex ...rest of line... puts an entry in the index foo.
2619 % It also defines \fooindfile to be the number of the output channel for
2620 % the file that accumulates this index.  The file's extension is foo.
2621 % The name of an index should be no more than 2 characters long
2622 % for the sake of vms.
2623 %
2624 \def\newindex#1{%
2625   \iflinks
2626     \expandafter\newwrite \csname#1indfile\endcsname
2627     \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2628   \fi
2629   \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
2630     \noexpand\doindex{#1}}
2631 }
2632
2633 % @defindex foo  ==  \newindex{foo}
2634 %
2635 \def\defindex{\parsearg\newindex}
2636
2637 % Define @defcodeindex, like @defindex except put all entries in @code.
2638 %
2639 \def\defcodeindex{\parsearg\newcodeindex}
2640 %
2641 \def\newcodeindex#1{%
2642   \iflinks
2643     \expandafter\newwrite \csname#1indfile\endcsname
2644     \openout \csname#1indfile\endcsname \jobname.#1
2645   \fi
2646   \expandafter\xdef\csname#1index\endcsname{%
2647     \noexpand\docodeindex{#1}}%
2648 }
2649
2650
2651 % @synindex foo bar    makes index foo feed into index bar.
2652 % Do this instead of @defindex foo if you don't want it as a separate index.
2653
2654 % @syncodeindex foo bar   similar, but put all entries made for in