* Various changes.
[make.git] / texinfo.tex
blob3cf1757b1b4d8c0fc9c499c584132ed4f7f0ba9a
1 % texinfo.tex -- TeX macros to handle Texinfo files.
3 % Load plain if necessary, i.e., if running under initex.
4 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
6 \def\texinfoversion{1999-07-16.19}%
8 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
9 % Free Software Foundation, Inc.
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.
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.
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.
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!
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/pub/gnu/texinfo.tex
33 % (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
34 % ftp://tug.org/tex/texinfo.tex
35 % ftp://ctan.org/macros/texinfo/texinfo.tex
36 % (and all CTAN mirrors, finger ctan@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 % There is a small home page for Texinfo at http://texinfo.org/.
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.
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.
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/.
61 \message{Loading texinfo [version \texinfoversion]:}
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}
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
85 % We never want plain's outer \+ definition in Texinfo.
86 % For @tex, we can use \tabalign.
87 \let\+ = \relax
89 % Get ready for pdf.
90 \newif\ifpdf
91 \ifx\pdfoutput\undefined\else
92 \input pdfcolor
93 \pdfoutput=1
94 \pdftrue
95 \fi
97 \message{Basics,}
98 \chardef\other=12
100 % If this character appears in an error message or help string, it
101 % starts a new line in the output.
102 \newlinechar = `^^J
104 % Set up fixed words for English if not already set.
105 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
106 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
107 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
108 \ifx\putwordin\undefined \gdef\putwordin{in}\fi
109 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
110 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
111 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
112 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
113 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
114 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
115 \ifx\putwordof\undefined \gdef\putwordof{of}\fi
116 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
117 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
118 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
119 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
120 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
121 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
122 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
123 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
125 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
126 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
127 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
128 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
129 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
130 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
131 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
132 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
133 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
134 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
135 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
136 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
138 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
139 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
140 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
141 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
142 \ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
143 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
144 \ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
146 % Ignore a token.
148 \def\gobble#1{}
150 \hyphenation{ap-pen-dix}
151 \hyphenation{mini-buf-fer mini-buf-fers}
152 \hyphenation{eshell}
153 \hyphenation{white-space}
155 % Margin to add to right of even pages, to left of odd pages.
156 \newdimen \bindingoffset
157 \newdimen \normaloffset
158 \newdimen\pagewidth \newdimen\pageheight
160 % Sometimes it is convenient to have everything in the transcript file
161 % and nothing on the terminal. We don't just call \tracingall here,
162 % since that produces some useless output on the terminal.
164 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
165 \ifx\eTeXversion\undefined
166 \def\loggingall{\tracingcommands2 \tracingstats2
167 \tracingpages1 \tracingoutput1 \tracinglostchars1
168 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
169 \showboxbreadth\maxdimen\showboxdepth\maxdimen
171 \else
172 \def\loggingall{\tracingcommands3 \tracingstats2
173 \tracingpages1 \tracingoutput1 \tracinglostchars1
174 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
175 \tracingscantokens1 \tracingassigns1 \tracingifs1
176 \tracinggroups1 \tracingnesting2
177 \showboxbreadth\maxdimen\showboxdepth\maxdimen
181 % For @cropmarks command.
182 % Do @cropmarks to get crop marks.
184 \newif\ifcropmarks
185 \let\cropmarks = \cropmarkstrue
187 % Dimensions to add cropmarks at corners.
188 % Added by P. A. MacKay, 12 Nov. 1986
190 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
191 \newdimen\cornerlong \cornerlong=1pc
192 \newdimen\cornerthick \cornerthick=.3pt
193 \newdimen\topandbottommargin \topandbottommargin=.75in
195 % Main output routine.
196 \chardef\PAGE = 255
197 \output = {\onepageout{\pagecontents\PAGE}}
199 \newbox\headlinebox
200 \newbox\footlinebox
202 % \onepageout takes a vbox as an argument. Note that \pagecontents
203 % does insertions, but you have to call it yourself.
204 \def\onepageout#1{%
205 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
207 \ifodd\pageno \advance\hoffset by \bindingoffset
208 \else \advance\hoffset by -\bindingoffset\fi
210 % Do this outside of the \shipout so @code etc. will be expanded in
211 % the headline as they should be, not taken literally (outputting ''code).
212 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
213 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
216 % Have to do this stuff outside the \shipout because we want it to
217 % take effect in \write's, yet the group defined by the \vbox ends
218 % before the \shipout runs.
220 \escapechar = `\\ % use backslash in output files.
221 \indexdummies % don't expand commands in the output.
222 \normalturnoffactive % \ in index entries must not stay \, e.g., if
223 % the page break happens to be in the middle of an example.
224 \shipout\vbox{%
225 \ifcropmarks \vbox to \outervsize\bgroup
226 \hsize = \outerhsize
227 \vskip-\topandbottommargin
228 \vtop to0pt{%
229 \line{\ewtop\hfil\ewtop}%
230 \nointerlineskip
231 \line{%
232 \vbox{\moveleft\cornerthick\nstop}%
233 \hfill
234 \vbox{\moveright\cornerthick\nstop}%
236 \vss}%
237 \vskip\topandbottommargin
238 \line\bgroup
239 \hfil % center the page within the outer (page) hsize.
240 \ifodd\pageno\hskip\bindingoffset\fi
241 \vbox\bgroup
244 \unvbox\headlinebox
245 \pagebody{#1}%
246 \ifdim\ht\footlinebox > 0pt
247 % Only leave this space if the footline is nonempty.
248 % (We lessened \vsize for it in \oddfootingxxx.)
249 % The \baselineskip=24pt in plain's \makefootline has no effect.
250 \vskip 2\baselineskip
251 \unvbox\footlinebox
254 \ifpdf\pdfmkdest{\the\pageno}\fi
256 \ifcropmarks
257 \egroup % end of \vbox\bgroup
258 \hfil\egroup % end of (centering) \line\bgroup
259 \vskip\topandbottommargin plus1fill minus1fill
260 \boxmaxdepth = \cornerthick
261 \vbox to0pt{\vss
262 \line{%
263 \vbox{\moveleft\cornerthick\nsbot}%
264 \hfill
265 \vbox{\moveright\cornerthick\nsbot}%
267 \nointerlineskip
268 \line{\ewbot\hfil\ewbot}%
270 \egroup % \vbox from first cropmarks clause
272 }% end of \shipout\vbox
273 }% end of group with \turnoffactive
274 \advancepageno
275 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
278 \newinsert\margin \dimen\margin=\maxdimen
280 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
281 {\catcode`\@ =11
282 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
283 % marginal hacks, juha@viisa.uucp (Juha Takala)
284 \ifvoid\margin\else % marginal info is present
285 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
286 \dimen@=\dp#1 \unvbox#1
287 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
288 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
291 % Here are the rules for the cropmarks. Note that they are
292 % offset so that the space between them is truly \outerhsize or \outervsize
293 % (P. A. MacKay, 12 November, 1986)
295 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
296 \def\nstop{\vbox
297 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
298 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
299 \def\nsbot{\vbox
300 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
302 % Parse an argument, then pass it to #1. The argument is the rest of
303 % the input line (except we remove a trailing comment). #1 should be a
304 % macro which expects an ordinary undelimited TeX argument.
306 \def\parsearg#1{%
307 \let\next = #1%
308 \begingroup
309 \obeylines
310 \futurelet\temp\parseargx
313 % If the next token is an obeyed space (from an @example environment or
314 % the like), remove it and recurse. Otherwise, we're done.
315 \def\parseargx{%
316 % \obeyedspace is defined far below, after the definition of \sepspaces.
317 \ifx\obeyedspace\temp
318 \expandafter\parseargdiscardspace
319 \else
320 \expandafter\parseargline
324 % Remove a single space (as the delimiter token to the macro call).
325 {\obeyspaces %
326 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
328 {\obeylines %
329 \gdef\parseargline#1^^M{%
330 \endgroup % End of the group started in \parsearg.
332 % First remove any @c comment, then any @comment.
333 % Result of each macro is put in \toks0.
334 \argremovec #1\c\relax %
335 \expandafter\argremovecomment \the\toks0 \comment\relax %
337 % Call the caller's macro, saved as \next in \parsearg.
338 \expandafter\next\expandafter{\the\toks0}%
342 % Since all \c{,omment} does is throw away the argument, we can let TeX
343 % do that for us. The \relax here is matched by the \relax in the call
344 % in \parseargline; it could be more or less anything, its purpose is
345 % just to delimit the argument to the \c.
346 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
347 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
349 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
350 % @end itemize @c foo
351 % will have two active spaces as part of the argument with the
352 % `itemize'. Here we remove all active spaces from #1, and assign the
353 % result to \toks0.
355 % This loses if there are any *other* active characters besides spaces
356 % in the argument -- _ ^ +, for example -- since they get expanded.
357 % Fortunately, Texinfo does not define any such commands. (If it ever
358 % does, the catcode of the characters in questionwill have to be changed
359 % here.) But this means we cannot call \removeactivespaces as part of
360 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
361 % that \parsearg gets might well have any character at all in it.
363 \def\removeactivespaces#1{%
364 \begingroup
365 \ignoreactivespaces
366 \edef\temp{#1}%
367 \global\toks0 = \expandafter{\temp}%
368 \endgroup
371 % Change the active space to expand to nothing.
373 \begingroup
374 \obeyspaces
375 \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
376 \endgroup
379 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
381 %% These are used to keep @begin/@end levels from running away
382 %% Call \inENV within environments (after a \begingroup)
383 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
384 \def\ENVcheck{%
385 \ifENV\errmessage{Still within an environment; press RETURN to continue}
386 \endgroup\fi} % This is not perfect, but it should reduce lossage
388 % @begin foo is the same as @foo, for now.
389 \newhelp\EMsimple{Press RETURN to continue.}
391 \outer\def\begin{\parsearg\beginxxx}
393 \def\beginxxx #1{%
394 \expandafter\ifx\csname #1\endcsname\relax
395 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
396 \csname #1\endcsname\fi}
398 % @end foo executes the definition of \Efoo.
400 \def\end{\parsearg\endxxx}
401 \def\endxxx #1{%
402 \removeactivespaces{#1}%
403 \edef\endthing{\the\toks0}%
405 \expandafter\ifx\csname E\endthing\endcsname\relax
406 \expandafter\ifx\csname \endthing\endcsname\relax
407 % There's no \foo, i.e., no ``environment'' foo.
408 \errhelp = \EMsimple
409 \errmessage{Undefined command `@end \endthing'}%
410 \else
411 \unmatchedenderror\endthing
413 \else
414 % Everything's ok; the right environment has been started.
415 \csname E\endthing\endcsname
419 % There is an environment #1, but it hasn't been started. Give an error.
421 \def\unmatchedenderror#1{%
422 \errhelp = \EMsimple
423 \errmessage{This `@end #1' doesn't have a matching `@#1'}%
426 % Define the control sequence \E#1 to give an unmatched @end error.
428 \def\defineunmatchedend#1{%
429 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
433 % Single-spacing is done by various environments (specifically, in
434 % \nonfillstart and \quotations).
435 \newskip\singlespaceskip \singlespaceskip = 12.5pt
436 \def\singlespace{%
437 % Why was this kern here? It messes up equalizing space above and below
438 % environments. --karl, 6may93
439 %{\advance \baselineskip by -\singlespaceskip
440 %\kern \baselineskip}%
441 \setleading \singlespaceskip
444 %% Simple single-character @ commands
446 % @@ prints an @
447 % Kludge this until the fonts are right (grr).
448 \def\@{{\tt\char64}}
450 % This is turned off because it was never documented
451 % and you can use @w{...} around a quote to suppress ligatures.
452 %% Define @` and @' to be the same as ` and '
453 %% but suppressing ligatures.
454 %\def\`{{`}}
455 %\def\'{{'}}
457 % Used to generate quoted braces.
458 \def\mylbrace {{\tt\char123}}
459 \def\myrbrace {{\tt\char125}}
460 \let\{=\mylbrace
461 \let\}=\myrbrace
462 \begingroup
463 % Definitions to produce actual \{ & \} command in an index.
464 \catcode`\{ = 12 \catcode`\} = 12
465 \catcode`\[ = 1 \catcode`\] = 2
466 \catcode`\@ = 0 \catcode`\\ = 12
467 @gdef@lbracecmd[\{]%
468 @gdef@rbracecmd[\}]%
469 @endgroup
471 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
472 % Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
473 \let\, = \c
474 \let\dotaccent = \.
475 \def\ringaccent#1{{\accent23 #1}}
476 \let\tieaccent = \t
477 \let\ubaraccent = \b
478 \let\udotaccent = \d
480 % Other special characters: @questiondown @exclamdown
481 % Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
482 \def\questiondown{?`}
483 \def\exclamdown{!`}
485 % Dotless i and dotless j, used for accents.
486 \def\imacro{i}
487 \def\jmacro{j}
488 \def\dotless#1{%
489 \def\temp{#1}%
490 \ifx\temp\imacro \ptexi
491 \else\ifx\temp\jmacro \j
492 \else \errmessage{@dotless can be used only with i or j}%
493 \fi\fi
496 % Be sure we're in horizontal mode when doing a tie, since we make space
497 % equivalent to this in @example-like environments. Otherwise, a space
498 % at the beginning of a line will start with \penalty -- and
499 % since \penalty is valid in vertical mode, we'd end up putting the
500 % penalty on the vertical list instead of in the new paragraph.
501 {\catcode`@ = 11
502 % Avoid using \@M directly, because that causes trouble
503 % if the definition is written into an index file.
504 \global\let\tiepenalty = \@M
505 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
508 % @: forces normal size whitespace following.
509 \def\:{\spacefactor=1000 }
511 % @* forces a line break.
512 \def\*{\hfil\break\hbox{}\ignorespaces}
514 % @. is an end-of-sentence period.
515 \def\.{.\spacefactor=3000 }
517 % @! is an end-of-sentence bang.
518 \def\!{!\spacefactor=3000 }
520 % @? is an end-of-sentence query.
521 \def\?{?\spacefactor=3000 }
523 % @w prevents a word break. Without the \leavevmode, @w at the
524 % beginning of a paragraph, when TeX is still in vertical mode, would
525 % produce a whole line of output instead of starting the paragraph.
526 \def\w#1{\leavevmode\hbox{#1}}
528 % @group ... @end group forces ... to be all on one page, by enclosing
529 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
530 % to keep its height that of a normal line. According to the rules for
531 % \topskip (p.114 of the TeXbook), the glue inserted is
532 % max (\topskip - \ht (first item), 0). If that height is large,
533 % therefore, no glue is inserted, and the space between the headline and
534 % the text is small, which looks bad.
536 \def\group{\begingroup
537 \ifnum\catcode13=\active \else
538 \errhelp = \groupinvalidhelp
539 \errmessage{@group invalid in context where filling is enabled}%
542 % The \vtop we start below produces a box with normal height and large
543 % depth; thus, TeX puts \baselineskip glue before it, and (when the
544 % next line of text is done) \lineskip glue after it. (See p.82 of
545 % the TeXbook.) Thus, space below is not quite equal to space
546 % above. But it's pretty close.
547 \def\Egroup{%
548 \egroup % End the \vtop.
549 \endgroup % End the \group.
552 \vtop\bgroup
553 % We have to put a strut on the last line in case the @group is in
554 % the midst of an example, rather than completely enclosing it.
555 % Otherwise, the interline space between the last line of the group
556 % and the first line afterwards is too small. But we can't put the
557 % strut in \Egroup, since there it would be on a line by itself.
558 % Hence this just inserts a strut at the beginning of each line.
559 \everypar = {\strut}%
561 % Since we have a strut on every line, we don't need any of TeX's
562 % normal interline spacing.
563 \offinterlineskip
565 % OK, but now we have to do something about blank
566 % lines in the input in @example-like environments, which normally
567 % just turn into \lisppar, which will insert no space now that we've
568 % turned off the interline space. Simplest is to make them be an
569 % empty paragraph.
570 \ifx\par\lisppar
571 \edef\par{\leavevmode \par}%
573 % Reset ^^M's definition to new definition of \par.
574 \obeylines
577 % Do @comment since we are called inside an environment such as
578 % @example, where each end-of-line in the input causes an
579 % end-of-line in the output. We don't want the end-of-line after
580 % the `@group' to put extra space in the output. Since @group
581 % should appear on a line by itself (according to the Texinfo
582 % manual), we don't worry about eating any user text.
583 \comment
586 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
587 % message, so this ends up printing `@group can only ...'.
589 \newhelp\groupinvalidhelp{%
590 group can only be used in environments such as @example,^^J%
591 where each line of input produces a line of output.}
593 % @need space-in-mils
594 % forces a page break if there is not space-in-mils remaining.
596 \newdimen\mil \mil=0.001in
598 \def\need{\parsearg\needx}
600 % Old definition--didn't work.
601 %\def\needx #1{\par %
602 %% This method tries to make TeX break the page naturally
603 %% if the depth of the box does not fit.
604 %{\baselineskip=0pt%
605 %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
606 %\prevdepth=-1000pt
609 \def\needx#1{%
610 % Go into vertical mode, so we don't make a big box in the middle of a
611 % paragraph.
612 \par
614 % Don't add any leading before our big empty box, but allow a page
615 % break, since the best break might be right here.
616 \allowbreak
617 \nointerlineskip
618 \vtop to #1\mil{\vfil}%
620 % TeX does not even consider page breaks if a penalty added to the
621 % main vertical list is 10000 or more. But in order to see if the
622 % empty box we just added fits on the page, we must make it consider
623 % page breaks. On the other hand, we don't want to actually break the
624 % page after the empty box. So we use a penalty of 9999.
626 % There is an extremely small chance that TeX will actually break the
627 % page at this \penalty, if there are no other feasible breakpoints in
628 % sight. (If the user is using lots of big @group commands, which
629 % almost-but-not-quite fill up a page, TeX will have a hard time doing
630 % good page breaking, for example.) However, I could not construct an
631 % example where a page broke at this \penalty; if it happens in a real
632 % document, then we can reconsider our strategy.
633 \penalty9999
635 % Back up by the size of the box, whether we did a page break or not.
636 \kern -#1\mil
638 % Do not allow a page break right after this kern.
639 \nobreak
642 % @br forces paragraph break
644 \let\br = \par
646 % @dots{} output an ellipsis using the current font.
647 % We do .5em per period so that it has the same spacing in a typewriter
648 % font as three actual period characters.
650 \def\dots{%
651 \leavevmode
652 \hbox to 1.5em{%
653 \hskip 0pt plus 0.25fil minus 0.25fil
654 .\hss.\hss.%
655 \hskip 0pt plus 0.5fil minus 0.5fil
659 % @enddots{} is an end-of-sentence ellipsis.
661 \def\enddots{%
662 \leavevmode
663 \hbox to 2em{%
664 \hskip 0pt plus 0.25fil minus 0.25fil
665 .\hss.\hss.\hss.%
666 \hskip 0pt plus 0.5fil minus 0.5fil
668 \spacefactor=3000
672 % @page forces the start of a new page
674 \def\page{\par\vfill\supereject}
676 % @exdent text....
677 % outputs text on separate line in roman font, starting at standard page margin
679 % This records the amount of indent in the innermost environment.
680 % That's how much \exdent should take out.
681 \newskip\exdentamount
683 % This defn is used inside fill environments such as @defun.
684 \def\exdent{\parsearg\exdentyyy}
685 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
687 % This defn is used inside nofill environments such as @example.
688 \def\nofillexdent{\parsearg\nofillexdentyyy}
689 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
690 \leftline{\hskip\leftskip{\rm#1}}}}
692 % @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
694 \def\inmargin#1{%
695 \strut\vadjust{\nobreak\kern-\strutdepth
696 \vtop to \strutdepth{\baselineskip\strutdepth\vss
697 \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
698 \newskip\inmarginspacing \inmarginspacing=1cm
699 \def\strutdepth{\dp\strutbox}
701 %\hbox{{\rm#1}}\hfil\break}}
703 % @include file insert text of that file as input.
704 % Allow normal characters that we make active in the argument (a file name).
705 \def\include{\begingroup
706 \catcode`\\=12
707 \catcode`~=12
708 \catcode`^=12
709 \catcode`_=12
710 \catcode`|=12
711 \catcode`<=12
712 \catcode`>=12
713 \catcode`+=12
714 \parsearg\includezzz}
715 % Restore active chars for included file.
716 \def\includezzz#1{\endgroup\begingroup
717 % Read the included file in a group so nested @include's work.
718 \def\thisfile{#1}%
719 \input\thisfile
720 \endgroup}
722 \def\thisfile{}
724 % @center line outputs that line, centered
726 \def\center{\parsearg\centerzzz}
727 \def\centerzzz #1{{\advance\hsize by -\leftskip
728 \advance\hsize by -\rightskip
729 \centerline{#1}}}
731 % @sp n outputs n lines of vertical space
733 \def\sp{\parsearg\spxxx}
734 \def\spxxx #1{\vskip #1\baselineskip}
736 % @comment ...line which is ignored...
737 % @c is the same as @comment
738 % @ignore ... @end ignore is another way to write a comment
740 \def\comment{\begingroup \catcode`\^^M=\other%
741 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
742 \commentxxx}
743 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
745 \let\c=\comment
747 % @paragraphindent NCHARS
748 % We'll use ems for NCHARS, close enough.
749 % We cannot implement @paragraphindent asis, though.
751 \def\asisword{asis} % no translation, these are keywords
752 \def\noneword{none}
754 \def\paragraphindent{\parsearg\doparagraphindent}
755 \def\doparagraphindent#1{%
756 \def\temp{#1}%
757 \ifx\temp\asisword
758 \else
759 \ifx\temp\noneword
760 \defaultparindent = 0pt
761 \else
762 \defaultparindent = #1em
765 \parindent = \defaultparindent
768 % @exampleindent NCHARS
769 % We'll use ems for NCHARS like @paragraphindent.
770 % It seems @exampleindent asis isn't necessary, but
771 % I preserve it to make it similar to @paragraphindent.
772 \def\exampleindent{\parsearg\doexampleindent}
773 \def\doexampleindent#1{%
774 \def\temp{#1}%
775 \ifx\temp\asisword
776 \else
777 \ifx\temp\noneword
778 \lispnarrowing = 0pt
779 \else
780 \lispnarrowing = #1em
785 % @asis just yields its argument. Used with @table, for example.
787 \def\asis#1{#1}
789 % @math means output in math mode.
790 % We don't use $'s directly in the definition of \math because control
791 % sequences like \math are expanded when the toc file is written. Then,
792 % we read the toc file back, the $'s will be normal characters (as they
793 % should be, according to the definition of Texinfo). So we must use a
794 % control sequence to switch into and out of math mode.
796 % This isn't quite enough for @math to work properly in indices, but it
797 % seems unlikely it will ever be needed there.
799 \let\implicitmath = $
800 \def\math#1{\implicitmath #1\implicitmath}
802 % @bullet and @minus need the same treatment as @math, just above.
803 \def\bullet{\implicitmath\ptexbullet\implicitmath}
804 \def\minus{\implicitmath-\implicitmath}
806 % @refill is a no-op.
807 \let\refill=\relax
809 % If working on a large document in chapters, it is convenient to
810 % be able to disable indexing, cross-referencing, and contents, for test runs.
811 % This is done with @novalidate (before @setfilename).
813 \newif\iflinks \linkstrue % by default we want the aux files.
814 \let\novalidate = \linksfalse
816 % @setfilename is done at the beginning of every texinfo file.
817 % So open here the files we need to have open while reading the input.
818 % This makes it possible to make a .fmt file for texinfo.
819 \def\setfilename{%
820 \iflinks
821 \readauxfile
822 \fi % \openindices needs to do some work in any case.
823 \openindices
824 \fixbackslash % Turn off hack to swallow `\input texinfo'.
825 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
827 % If texinfo.cnf is present on the system, read it.
828 % Useful for site-wide @afourpaper, etc.
829 % Just to be on the safe side, close the input stream before the \input.
830 \openin 1 texinfo.cnf
831 \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
832 \closein1
833 \temp
835 \comment % Ignore the actual filename.
838 % Called from \setfilename.
840 \def\openindices{%
841 \newindex{cp}%
842 \newcodeindex{fn}%
843 \newcodeindex{vr}%
844 \newcodeindex{tp}%
845 \newcodeindex{ky}%
846 \newcodeindex{pg}%
849 % @bye.
850 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
853 \message{pdf,}
854 % adobe `portable' document format
856 \newcount\tempnum
857 \newcount\lnkcount
858 \newtoks\filename
859 \newcount\filenamelength
860 \newcount\pgn
862 \ifpdf
863 \def\pdfmkdest#1{\pdfdest name{#1@} xyz}
864 \def\pdfmkpgn#1{#1@}
866 % Adding outlines to PDF; macros for calculating structure of outlines
867 % come from Petr Olsak
868 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
869 \else \csname#1\endcsname \fi}
870 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
871 \advance\tempnum by1
872 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
873 \def\pdfmakeoutlines{{%
874 \openin 1 \jobname.toc
875 \ifeof 1\else\bgroup
876 \closein 1
877 \indexnofonts
878 \def\char{char}% because \expnumber uses the section title in a \csname
879 \def\chapentry ##1##2##3{}
880 \def\unnumbchapentry ##1##2{}
881 \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
882 \def\unnumbsecentry ##1##2{}
883 \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
884 \def\unnumbsubsecentry ##1##2{}
885 \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
886 \def\unnumbsubsubsecentry ##1##2{}
887 \input \jobname.toc
888 \def\chapentry ##1##2##3{%
889 \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
890 \def\unnumbchapentry ##1##2{%
891 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
892 \def\secentry ##1##2##3##4{%
893 \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
894 \def\unnumbsecentry ##1##2{%
895 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
896 \def\subsecentry ##1##2##3##4##5{%
897 \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
898 \def\unnumbsubsecentry ##1##2{%
899 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
900 \def\subsubsecentry ##1##2##3##4##5##6{%
901 \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
902 \def\unnumbsubsubsecentry ##1##2{%
903 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
904 \input \jobname.toc
905 \egroup\fi
908 \def\makelinks #1,{%
909 \def\params{#1}\def\E{END}%
910 \ifx\params\E
911 \let\nextmakelinks=\relax
912 \else
913 \let\nextmakelinks=\makelinks
914 \ifnum\lnkcount>0,\fi
915 \picknum{#1}%
916 \Blue\pdfannotlink attr{/Border [0 0 0]}
917 goto name{\pdfmkpgn{\the\pgn}}%
919 \advance\lnkcount by 1%
920 \Black\pdfendlink
922 \nextmakelinks
925 \def\picknum#1{\expandafter\pn#1}
926 \def\pn#1{%
927 \def\p{#1}%
928 \ifx\p\lbrace
929 \let\nextpn=\ppn
930 \else
931 \let\nextpn=\ppnn
932 \def\first{#1}
934 \nextpn
936 \def\ppn#1{\pgn=#1\gobble}
937 \def\ppnn{\pgn=\first}
938 \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
940 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
941 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
942 \ifx\PP\D\let\nextsp\relax
943 \else\let\nextsp\skipspaces
944 \ifx\p\space\else\addtokens{\filename}{\PP}%
945 \advance\filenamelength by 1
948 \nextsp}
949 \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
951 \def\pdflink#1{%
952 \leavevmode\Red
953 \begingroup
954 \normalturnoffactive\def\@{@}%
955 \pdfannotlink
956 attr{/Border [0 0 0]}%
957 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
958 \endgroup
961 \else
962 \let\pdflink = \gobble
963 \let\pdfmakeoutlines = \relax
964 \fi % end \ifpdf
966 \message{fonts,}
967 % Font-change commands.
969 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
970 % So we set up a \sf analogous to plain's \rm, etc.
971 \newfam\sffam
972 \def\sf{\fam=\sffam \tensf}
973 \let\li = \sf % Sometimes we call it \li, not \sf.
975 % We don't need math for this one.
976 \def\ttsl{\tenttsl}
978 % Use Computer Modern fonts at \magstephalf (11pt).
979 \newcount\mainmagstep
980 \mainmagstep=\magstephalf
982 % Set the font macro #1 to the font named #2, adding on the
983 % specified font prefix (normally `cm').
984 % #3 is the font's design size, #4 is a scale factor
985 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
987 % Use cm as the default font prefix.
988 % To specify the font prefix, you must define \fontprefix
989 % before you read in texinfo.tex.
990 \ifx\fontprefix\undefined
991 \def\fontprefix{cm}
993 % Support font families that don't use the same naming scheme as CM.
994 \def\rmshape{r}
995 \def\rmbshape{bx} %where the normal face is bold
996 \def\bfshape{b}
997 \def\bxshape{bx}
998 \def\ttshape{tt}
999 \def\ttbshape{tt}
1000 \def\ttslshape{sltt}
1001 \def\itshape{ti}
1002 \def\itbshape{bxti}
1003 \def\slshape{sl}
1004 \def\slbshape{bxsl}
1005 \def\sfshape{ss}
1006 \def\sfbshape{ss}
1007 \def\scshape{csc}
1008 \def\scbshape{csc}
1010 \ifx\bigger\relax
1011 \let\mainmagstep=\magstep1
1012 \setfont\textrm\rmshape{12}{1000}
1013 \setfont\texttt\ttshape{12}{1000}
1014 \else
1015 \setfont\textrm\rmshape{10}{\mainmagstep}
1016 \setfont\texttt\ttshape{10}{\mainmagstep}
1018 % Instead of cmb10, you many want to use cmbx10.
1019 % cmbx10 is a prettier font on its own, but cmb10
1020 % looks better when embedded in a line with cmr10.
1021 \setfont\textbf\bfshape{10}{\mainmagstep}
1022 \setfont\textit\itshape{10}{\mainmagstep}
1023 \setfont\textsl\slshape{10}{\mainmagstep}
1024 \setfont\textsf\sfshape{10}{\mainmagstep}
1025 \setfont\textsc\scshape{10}{\mainmagstep}
1026 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1027 \font\texti=cmmi10 scaled \mainmagstep
1028 \font\textsy=cmsy10 scaled \mainmagstep
1030 % A few fonts for @defun, etc.
1031 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1032 \setfont\deftt\ttshape{10}{\magstep1}
1033 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1035 % Fonts for indices and small examples (9pt).
1036 % We actually use the slanted font rather than the italic,
1037 % because texinfo normally uses the slanted fonts for that.
1038 % Do not make many font distinctions in general in the index, since they
1039 % aren't very useful.
1040 \setfont\ninett\ttshape{9}{1000}
1041 \setfont\ninettsl\ttslshape{10}{900}
1042 \setfont\indrm\rmshape{9}{1000}
1043 \setfont\indit\itshape{9}{1000}
1044 \setfont\indsl\slshape{9}{1000}
1045 \let\indtt=\ninett
1046 \let\indttsl=\ninettsl
1047 \let\indsf=\indrm
1048 \let\indbf=\indrm
1049 \setfont\indsc\scshape{10}{900}
1050 \font\indi=cmmi9
1051 \font\indsy=cmsy9
1053 % Fonts for title page:
1054 \setfont\titlerm\rmbshape{12}{\magstep3}
1055 \setfont\titleit\itbshape{10}{\magstep4}
1056 \setfont\titlesl\slbshape{10}{\magstep4}
1057 \setfont\titlett\ttbshape{12}{\magstep3}
1058 \setfont\titlettsl\ttslshape{10}{\magstep4}
1059 \setfont\titlesf\sfbshape{17}{\magstep1}
1060 \let\titlebf=\titlerm
1061 \setfont\titlesc\scbshape{10}{\magstep4}
1062 \font\titlei=cmmi12 scaled \magstep3
1063 \font\titlesy=cmsy10 scaled \magstep4
1064 \def\authorrm{\secrm}
1066 % Chapter (and unnumbered) fonts (17.28pt).
1067 \setfont\chaprm\rmbshape{12}{\magstep2}
1068 \setfont\chapit\itbshape{10}{\magstep3}
1069 \setfont\chapsl\slbshape{10}{\magstep3}
1070 \setfont\chaptt\ttbshape{12}{\magstep2}
1071 \setfont\chapttsl\ttslshape{10}{\magstep3}
1072 \setfont\chapsf\sfbshape{17}{1000}
1073 \let\chapbf=\chaprm
1074 \setfont\chapsc\scbshape{10}{\magstep3}
1075 \font\chapi=cmmi12 scaled \magstep2
1076 \font\chapsy=cmsy10 scaled \magstep3
1078 % Section fonts (14.4pt).
1079 \setfont\secrm\rmbshape{12}{\magstep1}
1080 \setfont\secit\itbshape{10}{\magstep2}
1081 \setfont\secsl\slbshape{10}{\magstep2}
1082 \setfont\sectt\ttbshape{12}{\magstep1}
1083 \setfont\secttsl\ttslshape{10}{\magstep2}
1084 \setfont\secsf\sfbshape{12}{\magstep1}
1085 \let\secbf\secrm
1086 \setfont\secsc\scbshape{10}{\magstep2}
1087 \font\seci=cmmi12 scaled \magstep1
1088 \font\secsy=cmsy10 scaled \magstep2
1090 % \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
1091 % \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
1092 % \setfont\ssecsl\slshape{10}{\magstep1}
1093 % \setfont\ssectt\ttshape{10}{\magstep1}
1094 % \setfont\ssecsf\sfshape{10}{\magstep1}
1096 %\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
1097 %\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
1098 %\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
1099 %\setfont\ssectt\ttshape{10}{1315}
1100 %\setfont\ssecsf\sfshape{10}{1315}
1102 %\let\ssecbf=\ssecrm
1104 % Subsection fonts (13.15pt).
1105 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1106 \setfont\ssecit\itbshape{10}{1315}
1107 \setfont\ssecsl\slbshape{10}{1315}
1108 \setfont\ssectt\ttbshape{12}{\magstephalf}
1109 \setfont\ssecttsl\ttslshape{10}{1315}
1110 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1111 \let\ssecbf\ssecrm
1112 \setfont\ssecsc\scbshape{10}{\magstep1}
1113 \font\sseci=cmmi12 scaled \magstephalf
1114 \font\ssecsy=cmsy10 scaled 1315
1115 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1116 % but that is not a standard magnification.
1118 % In order for the font changes to affect most math symbols and letters,
1119 % we have to define the \textfont of the standard families. Since
1120 % texinfo doesn't allow for producing subscripts and superscripts, we
1121 % don't bother to reset \scriptfont and \scriptscriptfont (which would
1122 % also require loading a lot more fonts).
1124 \def\resetmathfonts{%
1125 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1126 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1127 \textfont\ttfam = \tentt \textfont\sffam = \tensf
1131 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1132 % of just \STYLE. We do this so that font changes will continue to work
1133 % in math mode, where it is the current \fam that is relevant in most
1134 % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
1135 % \tenbf}, for example. By redefining \tenbf, we obviate the need to
1136 % redefine \bf itself.
1137 \def\textfonts{%
1138 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1139 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1140 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1141 \resetmathfonts}
1142 \def\titlefonts{%
1143 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
1144 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
1145 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
1146 \let\tenttsl=\titlettsl
1147 \resetmathfonts \setleading{25pt}}
1148 \def\titlefont#1{{\titlefonts\rm #1}}
1149 \def\chapfonts{%
1150 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1151 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1152 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1153 \resetmathfonts \setleading{19pt}}
1154 \def\secfonts{%
1155 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1156 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1157 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1158 \resetmathfonts \setleading{16pt}}
1159 \def\subsecfonts{%
1160 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1161 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1162 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1163 \resetmathfonts \setleading{15pt}}
1164 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1165 \def\indexfonts{%
1166 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
1167 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
1168 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
1169 \resetmathfonts \setleading{12pt}}
1171 % Set up the default fonts, so we can use them for creating boxes.
1173 \textfonts
1175 % Define these so they can be easily changed for other fonts.
1176 \def\angleleft{$\langle$}
1177 \def\angleright{$\rangle$}
1179 % Count depth in font-changes, for error checks
1180 \newcount\fontdepth \fontdepth=0
1182 % Fonts for short table of contents.
1183 \setfont\shortcontrm\rmshape{12}{1000}
1184 \setfont\shortcontbf\bxshape{12}{1000}
1185 \setfont\shortcontsl\slshape{12}{1000}
1187 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1188 %% serif) and @ii for TeX italic
1190 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1191 % unless the following character is such as not to need one.
1192 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1193 \def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx}
1194 \def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx}
1196 \let\i=\smartitalic
1197 \let\var=\smartslanted
1198 \let\dfn=\smartslanted
1199 \let\emph=\smartitalic
1200 \let\cite=\smartslanted
1202 \def\b#1{{\bf #1}}
1203 \let\strong=\b
1205 % We can't just use \exhyphenpenalty, because that only has effect at
1206 % the end of a paragraph. Restore normal hyphenation at the end of the
1207 % group within which \nohyphenation is presumably called.
1209 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1210 \def\restorehyphenation{\hyphenchar\font = `- }
1212 \def\t#1{%
1213 {\tt \rawbackslash \frenchspacing #1}%
1214 \null
1216 \let\ttfont=\t
1217 \def\samp#1{`\tclose{#1}'\null}
1218 \setfont\smallrm\rmshape{8}{1000}
1219 \font\smallsy=cmsy9
1220 \def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
1221 \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
1222 \vbox{\hrule\kern-0.4pt
1223 \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
1224 \kern-0.4pt\hrule}%
1225 \kern-.06em\raise0.4pt\hbox{\angleright}}}}
1226 % The old definition, with no lozenge:
1227 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1228 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1230 % @file, @option are the same as @samp.
1231 \let\file=\samp
1232 \let\option=\samp
1234 % @code is a modification of @t,
1235 % which makes spaces the same size as normal in the surrounding text.
1236 \def\tclose#1{%
1238 % Change normal interword space to be same as for the current font.
1239 \spaceskip = \fontdimen2\font
1241 % Switch to typewriter.
1244 % But `\ ' produces the large typewriter interword space.
1245 \def\ {{\spaceskip = 0pt{} }}%
1247 % Turn off hyphenation.
1248 \nohyphenation
1250 \rawbackslash
1251 \frenchspacing
1254 \null
1257 % We *must* turn on hyphenation at `-' and `_' in \code.
1258 % Otherwise, it is too hard to avoid overfull hboxes
1259 % in the Emacs manual, the Library manual, etc.
1261 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1262 % both hyphenation at - and hyphenation within words.
1263 % We must therefore turn them both off (\tclose does that)
1264 % and arrange explicitly to hyphenate at a dash.
1265 % -- rms.
1267 \catcode`\-=\active
1268 \catcode`\_=\active
1270 \global\def\code{\begingroup
1271 \catcode`\-=\active \let-\codedash
1272 \catcode`\_=\active \let_\codeunder
1273 \codex
1276 % If we end up with any active - characters when handling the index,
1277 % just treat them as a normal -.
1278 \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
1281 \def\realdash{-}
1282 \def\codedash{-\discretionary{}{}{}}
1283 \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
1284 \def\codex #1{\tclose{#1}\endgroup}
1286 %\let\exp=\tclose %Was temporary
1288 % @kbd is like @code, except that if the argument is just one @key command,
1289 % then @kbd has no effect.
1291 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
1292 % `example' (@kbd uses ttsl only inside of @example and friends),
1293 % or `code' (@kbd uses normal tty font always).
1294 \def\kbdinputstyle{\parsearg\kbdinputstylexxx}
1295 \def\kbdinputstylexxx#1{%
1296 \def\arg{#1}%
1297 \ifx\arg\worddistinct
1298 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
1299 \else\ifx\arg\wordexample
1300 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
1301 \else\ifx\arg\wordcode
1302 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
1303 \fi\fi\fi
1305 \def\worddistinct{distinct}
1306 \def\wordexample{example}
1307 \def\wordcode{code}
1309 % Default is kbdinputdistinct. (Too much of a hassle to call the macro,
1310 % the catcodes are wrong for parsearg to work.)
1311 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
1313 \def\xkey{\key}
1314 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1315 \ifx\one\xkey\ifx\threex\three \key{#2}%
1316 \else{\tclose{\kbdfont\look}}\fi
1317 \else{\tclose{\kbdfont\look}}\fi}
1319 % For @url, @env, @command quotes seem unnecessary, so use \code.
1320 \let\url=\code
1321 \let\env=\code
1322 \let\command=\code
1324 % @uref (abbreviation for `urlref') takes an optional (comma-separated)
1325 % second argument specifying the text to display and an optional third
1326 % arg as text to display instead of (rather than in addition to) the url
1327 % itself. First (mandatory) arg is the url. Perhaps eventually put in
1328 % a hypertex \special here.
1330 \def\uref#1{\douref #1,,,\finish}
1331 \def\douref#1,#2,#3,#4\finish{%
1332 \pdflink{#1}%
1333 \setbox0 = \hbox{\ignorespaces #3}%
1334 \ifdim\wd0 > 0pt
1335 \unhbox0 % third arg given, show only that
1336 \else
1337 \setbox0 = \hbox{\ignorespaces #2}%
1338 \ifdim\wd0 > 0pt
1339 \ifpdf
1340 \unhbox0 % PDF: 2nd arg given, show only it
1341 \else
1342 \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
1344 \else
1345 \code{#1}% only url given, so show it
1349 \ifpdf
1350 \Black\pdfendlink
1354 % rms does not like angle brackets --karl, 17may97.
1355 % So now @email is just like @uref, unless we are pdf.
1357 %\def\email#1{\angleleft{\tt #1}\angleright}
1358 \ifpdf
1359 \def\email#1{\doemail#1,,\finish}
1360 \def\doemail#1,#2,#3\finish{%
1361 \pdflink{mailto:#1}%
1362 \setbox0 = \hbox{\ignorespaces #2}%
1363 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
1364 \Black\pdfendlink
1366 \else
1367 \let\email=\uref
1370 % Check if we are currently using a typewriter font. Since all the
1371 % Computer Modern typewriter fonts have zero interword stretch (and
1372 % shrink), and it is reasonable to expect all typewriter fonts to have
1373 % this property, we can check that font parameter.
1375 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1377 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1378 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
1380 \def\dmn#1{\thinspace #1}
1382 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1384 % @l was never documented to mean ``switch to the Lisp font'',
1385 % and it is not used as such in any manual I can find. We need it for
1386 % Polish suppressed-l. --karl, 22sep96.
1387 %\def\l#1{{\li #1}\null}
1389 % Explicit font changes: @r, @sc, undocumented @ii.
1390 \def\r#1{{\rm #1}} % roman font
1391 \def\sc#1{{\smallcaps#1}} % smallcaps font
1392 \def\ii#1{{\it #1}} % italic font
1394 % @acronym downcases the argument and prints in smallcaps.
1395 \def\acronym#1{{\smallcaps \lowercase{#1}}}
1397 % @pounds{} is a sterling sign.
1398 \def\pounds{{\it\$}}
1401 \message{page headings,}
1403 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1404 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1406 % First the title page. Must do @settitle before @titlepage.
1407 \newif\ifseenauthor
1408 \newif\iffinishedtitlepage
1410 % Do an implicit @contents or @shortcontents after @end titlepage if the
1411 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
1413 \newif\ifsetcontentsaftertitlepage
1414 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
1415 \newif\ifsetshortcontentsaftertitlepage
1416 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
1418 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1419 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1420 \endgroup\page\hbox{}\page}
1422 \def\titlepage{\begingroup \parindent=0pt \textfonts
1423 \let\subtitlerm=\tenrm
1424 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1426 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1428 % Leave some space at the very top of the page.
1429 \vglue\titlepagetopglue
1431 % Now you can print the title using @title.
1432 \def\title{\parsearg\titlezzz}%
1433 \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
1434 % print a rule at the page bottom also.
1435 \finishedtitlepagefalse
1436 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1437 % No rule at page bottom unless we print one at the top with @title.
1438 \finishedtitlepagetrue
1440 % Now you can put text using @subtitle.
1441 \def\subtitle{\parsearg\subtitlezzz}%
1442 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1444 % @author should come last, but may come many times.
1445 \def\author{\parsearg\authorzzz}%
1446 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1447 {\authorfont \leftline{##1}}}%
1449 % Most title ``pages'' are actually two pages long, with space
1450 % at the top of the second. We don't want the ragged left on the second.
1451 \let\oldpage = \page
1452 \def\page{%
1453 \iffinishedtitlepage\else
1454 \finishtitlepage
1456 \oldpage
1457 \let\page = \oldpage
1458 \hbox{}}%
1459 % \def\page{\oldpage \hbox{}}
1462 \def\Etitlepage{%
1463 \iffinishedtitlepage\else
1464 \finishtitlepage
1466 % It is important to do the page break before ending the group,
1467 % because the headline and footline are only empty inside the group.
1468 % If we use the new definition of \page, we always get a blank page
1469 % after the title page, which we certainly don't want.
1470 \oldpage
1471 \endgroup
1473 % If they want short, they certainly want long too.
1474 \ifsetshortcontentsaftertitlepage
1475 \shortcontents
1476 \contents
1477 \global\let\shortcontents = \relax
1478 \global\let\contents = \relax
1481 \ifsetcontentsaftertitlepage
1482 \contents
1483 \global\let\contents = \relax
1484 \global\let\shortcontents = \relax
1487 \HEADINGSon
1490 \def\finishtitlepage{%
1491 \vskip4pt \hrule height 2pt width \hsize
1492 \vskip\titlepagebottomglue
1493 \finishedtitlepagetrue
1496 %%% Set up page headings and footings.
1498 \let\thispage=\folio
1500 \newtoks\evenheadline % headline on even pages
1501 \newtoks\oddheadline % headline on odd pages
1502 \newtoks\evenfootline % footline on even pages
1503 \newtoks\oddfootline % footline on odd pages
1505 % Now make Tex use those variables
1506 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1507 \else \the\evenheadline \fi}}
1508 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1509 \else \the\evenfootline \fi}\HEADINGShook}
1510 \let\HEADINGShook=\relax
1512 % Commands to set those variables.
1513 % For example, this is what @headings on does
1514 % @evenheading @thistitle|@thispage|@thischapter
1515 % @oddheading @thischapter|@thispage|@thistitle
1516 % @evenfooting @thisfile||
1517 % @oddfooting ||@thisfile
1519 \def\evenheading{\parsearg\evenheadingxxx}
1520 \def\oddheading{\parsearg\oddheadingxxx}
1521 \def\everyheading{\parsearg\everyheadingxxx}
1523 \def\evenfooting{\parsearg\evenfootingxxx}
1524 \def\oddfooting{\parsearg\oddfootingxxx}
1525 \def\everyfooting{\parsearg\everyfootingxxx}
1527 {\catcode`\@=0 %
1529 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1530 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1531 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1533 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1534 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1535 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1537 \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
1539 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1540 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1541 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1543 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1544 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1545 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
1547 % Leave some space for the footline. Hopefully ok to assume
1548 % @evenfooting will not be used by itself.
1549 \global\advance\pageheight by -\baselineskip
1550 \global\advance\vsize by -\baselineskip
1553 \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
1555 }% unbind the catcode of @.
1557 % @headings double turns headings on for double-sided printing.
1558 % @headings single turns headings on for single-sided printing.
1559 % @headings off turns them off.
1560 % @headings on same as @headings double, retained for compatibility.
1561 % @headings after turns on double-sided headings after this page.
1562 % @headings doubleafter turns on double-sided headings after this page.
1563 % @headings singleafter turns on single-sided headings after this page.
1564 % By default, they are off at the start of a document,
1565 % and turned `on' after @end titlepage.
1567 \def\headings #1 {\csname HEADINGS#1\endcsname}
1569 \def\HEADINGSoff{
1570 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1571 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1572 \HEADINGSoff
1573 % When we turn headings on, set the page number to 1.
1574 % For double-sided printing, put current file name in lower left corner,
1575 % chapter name on inside top of right hand pages, document
1576 % title on inside top of left hand pages, and page numbers on outside top
1577 % edge of all pages.
1578 \def\HEADINGSdouble{
1579 \global\pageno=1
1580 \global\evenfootline={\hfil}
1581 \global\oddfootline={\hfil}
1582 \global\evenheadline={\line{\folio\hfil\thistitle}}
1583 \global\oddheadline={\line{\thischapter\hfil\folio}}
1584 \global\let\contentsalignmacro = \chapoddpage
1586 \let\contentsalignmacro = \chappager
1588 % For single-sided printing, chapter title goes across top left of page,
1589 % page number on top right.
1590 \def\HEADINGSsingle{
1591 \global\pageno=1
1592 \global\evenfootline={\hfil}
1593 \global\oddfootline={\hfil}
1594 \global\evenheadline={\line{\thischapter\hfil\folio}}
1595 \global\oddheadline={\line{\thischapter\hfil\folio}}
1596 \global\let\contentsalignmacro = \chappager
1598 \def\HEADINGSon{\HEADINGSdouble}
1600 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1601 \let\HEADINGSdoubleafter=\HEADINGSafter
1602 \def\HEADINGSdoublex{%
1603 \global\evenfootline={\hfil}
1604 \global\oddfootline={\hfil}
1605 \global\evenheadline={\line{\folio\hfil\thistitle}}
1606 \global\oddheadline={\line{\thischapter\hfil\folio}}
1607 \global\let\contentsalignmacro = \chapoddpage
1610 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1611 \def\HEADINGSsinglex{%
1612 \global\evenfootline={\hfil}
1613 \global\oddfootline={\hfil}
1614 \global\evenheadline={\line{\thischapter\hfil\folio}}
1615 \global\oddheadline={\line{\thischapter\hfil\folio}}
1616 \global\let\contentsalignmacro = \chappager
1619 % Subroutines used in generating headings
1620 % Produces Day Month Year style of output.
1621 \def\today{%
1622 \number\day\space
1623 \ifcase\month
1624 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
1625 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
1626 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
1628 \space\number\year}
1630 % @settitle line... specifies the title of the document, for headings.
1631 % It generates no output of its own.
1632 \def\thistitle{\putwordNoTitle}
1633 \def\settitle{\parsearg\settitlezzz}
1634 \def\settitlezzz #1{\gdef\thistitle{#1}}
1637 \message{tables,}
1638 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1640 % default indentation of table text
1641 \newdimen\tableindent \tableindent=.8in
1642 % default indentation of @itemize and @enumerate text
1643 \newdimen\itemindent \itemindent=.3in
1644 % margin between end of table item and start of table text.
1645 \newdimen\itemmargin \itemmargin=.1in
1647 % used internally for \itemindent minus \itemmargin
1648 \newdimen\itemmax
1650 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1651 % these defs.
1652 % They also define \itemindex
1653 % to index the item name in whatever manner is desired (perhaps none).
1655 \newif\ifitemxneedsnegativevskip
1657 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1659 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1660 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1662 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1663 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1665 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1666 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1668 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1669 \itemzzz {#1}}
1671 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1672 \itemzzz {#1}}
1674 \def\itemzzz #1{\begingroup %
1675 \advance\hsize by -\rightskip
1676 \advance\hsize by -\tableindent
1677 \setbox0=\hbox{\itemfont{#1}}%
1678 \itemindex{#1}%
1679 \nobreak % This prevents a break before @itemx.
1681 % If the item text does not fit in the space we have, put it on a line
1682 % by itself, and do not allow a page break either before or after that
1683 % line. We do not start a paragraph here because then if the next
1684 % command is, e.g., @kindex, the whatsit would get put into the
1685 % horizontal list on a line by itself, resulting in extra blank space.
1686 \ifdim \wd0>\itemmax
1688 % Make this a paragraph so we get the \parskip glue and wrapping,
1689 % but leave it ragged-right.
1690 \begingroup
1691 \advance\leftskip by-\tableindent
1692 \advance\hsize by\tableindent
1693 \advance\rightskip by0pt plus1fil
1694 \leavevmode\unhbox0\par
1695 \endgroup
1697 % We're going to be starting a paragraph, but we don't want the
1698 % \parskip glue -- logically it's part of the @item we just started.
1699 \nobreak \vskip-\parskip
1701 % Stop a page break at the \parskip glue coming up. Unfortunately
1702 % we can't prevent a possible page break at the following
1703 % \baselineskip glue.
1704 \nobreak
1705 \endgroup
1706 \itemxneedsnegativevskipfalse
1707 \else
1708 % The item text fits into the space. Start a paragraph, so that the
1709 % following text (if any) will end up on the same line.
1710 \noindent
1711 % Do this with kerns and \unhbox so that if there is a footnote in
1712 % the item text, it can migrate to the main vertical list and
1713 % eventually be printed.
1714 \nobreak\kern-\tableindent
1715 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
1716 \unhbox0
1717 \nobreak\kern\dimen0
1718 \endgroup
1719 \itemxneedsnegativevskiptrue
1723 \def\item{\errmessage{@item while not in a table}}
1724 \def\itemx{\errmessage{@itemx while not in a table}}
1725 \def\kitem{\errmessage{@kitem while not in a table}}
1726 \def\kitemx{\errmessage{@kitemx while not in a table}}
1727 \def\xitem{\errmessage{@xitem while not in a table}}
1728 \def\xitemx{\errmessage{@xitemx while not in a table}}
1730 % Contains a kludge to get @end[description] to work.
1731 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1733 % @table, @ftable, @vtable.
1734 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1735 {\obeylines\obeyspaces%
1736 \gdef\tablex #1^^M{%
1737 \tabley\dontindex#1 \endtabley}}
1739 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1740 {\obeylines\obeyspaces%
1741 \gdef\ftablex #1^^M{%
1742 \tabley\fnitemindex#1 \endtabley
1743 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1744 \let\Etable=\relax}}
1746 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1747 {\obeylines\obeyspaces%
1748 \gdef\vtablex #1^^M{%
1749 \tabley\vritemindex#1 \endtabley
1750 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1751 \let\Etable=\relax}}
1753 \def\dontindex #1{}
1754 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1755 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1757 {\obeyspaces %
1758 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1759 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1761 \def\tablez #1#2#3#4#5#6{%
1762 \aboveenvbreak %
1763 \begingroup %
1764 \def\Edescription{\Etable}% Necessary kludge.
1765 \let\itemindex=#1%
1766 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1767 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1768 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1769 \def\itemfont{#2}%
1770 \itemmax=\tableindent %
1771 \advance \itemmax by -\itemmargin %
1772 \advance \leftskip by \tableindent %
1773 \exdentamount=\tableindent
1774 \parindent = 0pt
1775 \parskip = \smallskipamount
1776 \ifdim \parskip=0pt \parskip=2pt \fi%
1777 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1778 \let\item = \internalBitem %
1779 \let\itemx = \internalBitemx %
1780 \let\kitem = \internalBkitem %
1781 \let\kitemx = \internalBkitemx %
1782 \let\xitem = \internalBxitem %
1783 \let\xitemx = \internalBxitemx %
1786 % This is the counter used by @enumerate, which is really @itemize
1788 \newcount \itemno
1790 \def\itemize{\parsearg\itemizezzz}
1792 \def\itemizezzz #1{%
1793 \begingroup % ended by the @end itemize
1794 \itemizey {#1}{\Eitemize}
1797 \def\itemizey #1#2{%
1798 \aboveenvbreak %
1799 \itemmax=\itemindent %
1800 \advance \itemmax by -\itemmargin %
1801 \advance \leftskip by \itemindent %
1802 \exdentamount=\itemindent
1803 \parindent = 0pt %
1804 \parskip = \smallskipamount %
1805 \ifdim \parskip=0pt \parskip=2pt \fi%
1806 \def#2{\endgraf\afterenvbreak\endgroup}%
1807 \def\itemcontents{#1}%
1808 \let\item=\itemizeitem}
1810 % Set sfcode to normal for the chars that usually have another value.
1811 % These are `.?!:;,'
1812 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1813 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1815 % \splitoff TOKENS\endmark defines \first to be the first token in
1816 % TOKENS, and \rest to be the remainder.
1818 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1820 % Allow an optional argument of an uppercase letter, lowercase letter,
1821 % or number, to specify the first label in the enumerated list. No
1822 % argument is the same as `1'.
1824 \def\enumerate{\parsearg\enumeratezzz}
1825 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1826 \def\enumeratey #1 #2\endenumeratey{%
1827 \begingroup % ended by the @end enumerate
1829 % If we were given no argument, pretend we were given `1'.
1830 \def\thearg{#1}%
1831 \ifx\thearg\empty \def\thearg{1}\fi
1833 % Detect if the argument is a single token. If so, it might be a
1834 % letter. Otherwise, the only valid thing it can be is a number.
1835 % (We will always have one token, because of the test we just made.
1836 % This is a good thing, since \splitoff doesn't work given nothing at
1837 % all -- the first parameter is undelimited.)
1838 \expandafter\splitoff\thearg\endmark
1839 \ifx\rest\empty
1840 % Only one token in the argument. It could still be anything.
1841 % A ``lowercase letter'' is one whose \lccode is nonzero.
1842 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1843 % not equal to itself.
1844 % Otherwise, we assume it's a number.
1846 % We need the \relax at the end of the \ifnum lines to stop TeX from
1847 % continuing to look for a <number>.
1849 \ifnum\lccode\expandafter`\thearg=0\relax
1850 \numericenumerate % a number (we hope)
1851 \else
1852 % It's a letter.
1853 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1854 \lowercaseenumerate % lowercase letter
1855 \else
1856 \uppercaseenumerate % uppercase letter
1859 \else
1860 % Multiple tokens in the argument. We hope it's a number.
1861 \numericenumerate
1865 % An @enumerate whose labels are integers. The starting integer is
1866 % given in \thearg.
1868 \def\numericenumerate{%
1869 \itemno = \thearg
1870 \startenumeration{\the\itemno}%
1873 % The starting (lowercase) letter is in \thearg.
1874 \def\lowercaseenumerate{%
1875 \itemno = \expandafter`\thearg
1876 \startenumeration{%
1877 % Be sure we're not beyond the end of the alphabet.
1878 \ifnum\itemno=0
1879 \errmessage{No more lowercase letters in @enumerate; get a bigger
1880 alphabet}%
1882 \char\lccode\itemno
1886 % The starting (uppercase) letter is in \thearg.
1887 \def\uppercaseenumerate{%
1888 \itemno = \expandafter`\thearg
1889 \startenumeration{%
1890 % Be sure we're not beyond the end of the alphabet.
1891 \ifnum\itemno=0
1892 \errmessage{No more uppercase letters in @enumerate; get a bigger
1893 alphabet}
1895 \char\uccode\itemno
1899 % Call itemizey, adding a period to the first argument and supplying the
1900 % common last two arguments. Also subtract one from the initial value in
1901 % \itemno, since @item increments \itemno.
1903 \def\startenumeration#1{%
1904 \advance\itemno by -1
1905 \itemizey{#1.}\Eenumerate\flushcr
1908 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
1909 % to @enumerate.
1911 \def\alphaenumerate{\enumerate{a}}
1912 \def\capsenumerate{\enumerate{A}}
1913 \def\Ealphaenumerate{\Eenumerate}
1914 \def\Ecapsenumerate{\Eenumerate}
1916 % Definition of @item while inside @itemize.
1918 \def\itemizeitem{%
1919 \advance\itemno by 1
1920 {\let\par=\endgraf \smallbreak}%
1921 \ifhmode \errmessage{In hmode at itemizeitem}\fi
1922 {\parskip=0in \hskip 0pt
1923 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
1924 \vadjust{\penalty 1200}}%
1925 \flushcr}
1927 % @multitable macros
1928 % Amy Hendrickson, 8/18/94, 3/6/96
1930 % @multitable ... @end multitable will make as many columns as desired.
1931 % Contents of each column will wrap at width given in preamble. Width
1932 % can be specified either with sample text given in a template line,
1933 % or in percent of \hsize, the current width of text on page.
1935 % Table can continue over pages but will only break between lines.
1937 % To make preamble:
1939 % Either define widths of columns in terms of percent of \hsize:
1940 % @multitable @columnfractions .25 .3 .45
1941 % @item ...
1943 % Numbers following @columnfractions are the percent of the total
1944 % current hsize to be used for each column. You may use as many
1945 % columns as desired.
1948 % Or use a template:
1949 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
1950 % @item ...
1951 % using the widest term desired in each column.
1953 % For those who want to use more than one line's worth of words in
1954 % the preamble, break the line within one argument and it
1955 % will parse correctly, i.e.,
1957 % @multitable {Column 1 template} {Column 2 template} {Column 3
1958 % template}
1959 % Not:
1960 % @multitable {Column 1 template} {Column 2 template}
1961 % {Column 3 template}
1963 % Each new table line starts with @item, each subsequent new column
1964 % starts with @tab. Empty columns may be produced by supplying @tab's
1965 % with nothing between them for as many times as empty columns are needed,
1966 % ie, @tab@tab@tab will produce two empty columns.
1968 % @item, @tab, @multitable or @end multitable do not need to be on their
1969 % own lines, but it will not hurt if they are.
1971 % Sample multitable:
1973 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
1974 % @item first col stuff @tab second col stuff @tab third col
1975 % @item
1976 % first col stuff
1977 % @tab
1978 % second col stuff
1979 % @tab
1980 % third col
1981 % @item first col stuff @tab second col stuff
1982 % @tab Many paragraphs of text may be used in any column.
1984 % They will wrap at the width determined by the template.
1985 % @item@tab@tab This will be in third column.
1986 % @end multitable
1988 % Default dimensions may be reset by user.
1989 % @multitableparskip is vertical space between paragraphs in table.
1990 % @multitableparindent is paragraph indent in table.
1991 % @multitablecolmargin is horizontal space to be left between columns.
1992 % @multitablelinespace is space to leave between table items, baseline
1993 % to baseline.
1994 % 0pt means it depends on current normal line spacing.
1996 \newskip\multitableparskip
1997 \newskip\multitableparindent
1998 \newdimen\multitablecolspace
1999 \newskip\multitablelinespace
2000 \multitableparskip=0pt
2001 \multitableparindent=6pt
2002 \multitablecolspace=12pt
2003 \multitablelinespace=0pt
2005 % Macros used to set up halign preamble:
2007 \let\endsetuptable\relax
2008 \def\xendsetuptable{\endsetuptable}
2009 \let\columnfractions\relax
2010 \def\xcolumnfractions{\columnfractions}
2011 \newif\ifsetpercent
2013 % #1 is the part of the @columnfraction before the decimal point, which
2014 % is presumably either 0 or the empty string (but we don't check, we
2015 % just throw it away). #2 is the decimal part, which we use as the
2016 % percent of \hsize for this column.
2017 \def\pickupwholefraction#1.#2 {%
2018 \global\advance\colcount by 1
2019 \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
2020 \setuptable
2023 \newcount\colcount
2024 \def\setuptable#1{%
2025 \def\firstarg{#1}%
2026 \ifx\firstarg\xendsetuptable
2027 \let\go = \relax
2028 \else
2029 \ifx\firstarg\xcolumnfractions
2030 \global\setpercenttrue
2031 \else
2032 \ifsetpercent
2033 \let\go\pickupwholefraction
2034 \else
2035 \global\advance\colcount by 1
2036 \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator;
2037 % typically that is always in the input, anyway.
2038 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2041 \ifx\go\pickupwholefraction
2042 % Put the argument back for the \pickupwholefraction call, so
2043 % we'll always have a period there to be parsed.
2044 \def\go{\pickupwholefraction#1}%
2045 \else
2046 \let\go = \setuptable
2047 \fi%
2052 % This used to have \hskip1sp. But then the space in a template line is
2053 % not enough. That is bad. So let's go back to just & until we
2054 % encounter the problem it was intended to solve again.
2055 % --karl, nathan@acm.org, 20apr99.
2056 \def\tab{&}
2058 % @multitable ... @end multitable definitions:
2060 \def\multitable{\parsearg\dotable}
2061 \def\dotable#1{\bgroup
2062 \vskip\parskip
2063 \let\item\crcr
2064 \tolerance=9500
2065 \hbadness=9500
2066 \setmultitablespacing
2067 \parskip=\multitableparskip
2068 \parindent=\multitableparindent
2069 \overfullrule=0pt
2070 \global\colcount=0
2071 \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
2073 % To parse everything between @multitable and @item:
2074 \setuptable#1 \endsetuptable
2076 % \everycr will reset column counter, \colcount, at the end of
2077 % each line. Every column entry will cause \colcount to advance by one.
2078 % The table preamble
2079 % looks at the current \colcount to find the correct column width.
2080 \everycr{\noalign{%
2082 % \filbreak%% keeps underfull box messages off when table breaks over pages.
2083 % Maybe so, but it also creates really weird page breaks when the table
2084 % breaks over pages. Wouldn't \vfil be better? Wait until the problem
2085 % manifests itself, so it can be fixed for real --karl.
2086 \global\colcount=0\relax}}%
2088 % This preamble sets up a generic column definition, which will
2089 % be used as many times as user calls for columns.
2090 % \vtop will set a single line and will also let text wrap and
2091 % continue for many paragraphs if desired.
2092 \halign\bgroup&\global\advance\colcount by 1\relax
2093 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2095 % In order to keep entries from bumping into each other
2096 % we will add a \leftskip of \multitablecolspace to all columns after
2097 % the first one.
2099 % If a template has been used, we will add \multitablecolspace
2100 % to the width of each template entry.
2102 % If the user has set preamble in terms of percent of \hsize we will
2103 % use that dimension as the width of the column, and the \leftskip
2104 % will keep entries from bumping into each other. Table will start at
2105 % left margin and final column will justify at right margin.
2107 % Make sure we don't inherit \rightskip from the outer environment.
2108 \rightskip=0pt
2109 \ifnum\colcount=1
2110 % The first column will be indented with the surrounding text.
2111 \advance\hsize by\leftskip
2112 \else
2113 \ifsetpercent \else
2114 % If user has not set preamble in terms of percent of \hsize
2115 % we will advance \hsize by \multitablecolspace.
2116 \advance\hsize by \multitablecolspace
2118 % In either case we will make \leftskip=\multitablecolspace:
2119 \leftskip=\multitablecolspace
2121 % Ignoring space at the beginning and end avoids an occasional spurious
2122 % blank line, when TeX decides to break the line at the space before the
2123 % box from the multistrut, so the strut ends up on a line by itself.
2124 % For example:
2125 % @multitable @columnfractions .11 .89
2126 % @item @code{#}
2127 % @tab Legal holiday which is valid in major parts of the whole country.
2128 % Is automatically provided with highlighting sequences respectively marking
2129 % characters.
2130 \noindent\ignorespaces##\unskip\multistrut}\cr
2133 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2134 % If so, do nothing. If not, give it an appropriate dimension based on
2135 % current baselineskip.
2136 \ifdim\multitablelinespace=0pt
2137 %% strut to put in table in case some entry doesn't have descenders,
2138 %% to keep lines equally spaced
2139 \let\multistrut = \strut
2140 %% Test to see if parskip is larger than space between lines of
2141 %% table. If not, do nothing.
2142 %% If so, set to same dimension as multitablelinespace.
2143 \else
2144 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2145 width0pt\relax} \fi
2146 \ifdim\multitableparskip>\multitablelinespace
2147 \global\multitableparskip=\multitablelinespace
2148 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2149 %% than skip between lines in the table.
2150 \fi%
2151 \ifdim\multitableparskip=0pt
2152 \global\multitableparskip=\multitablelinespace
2153 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2154 %% than skip between lines in the table.
2155 \fi}
2158 \message{conditionals,}
2159 % Prevent errors for section commands.
2160 % Used in @ignore and in failing conditionals.
2161 \def\ignoresections{%
2162 \let\chapter=\relax
2163 \let\unnumbered=\relax
2164 \let\top=\relax
2165 \let\unnumberedsec=\relax
2166 \let\unnumberedsection=\relax
2167 \let\unnumberedsubsec=\relax
2168 \let\unnumberedsubsection=\relax
2169 \let\unnumberedsubsubsec=\relax
2170 \let\unnumberedsubsubsection=\relax
2171 \let\section=\relax
2172 \let\subsec=\relax
2173 \let\subsubsec=\relax
2174 \let\subsection=\relax
2175 \let\subsubsection=\relax
2176 \let\appendix=\relax
2177 \let\appendixsec=\relax
2178 \let\appendixsection=\relax
2179 \let\appendixsubsec=\relax
2180 \let\appendixsubsection=\relax
2181 \let\appendixsubsubsec=\relax
2182 \let\appendixsubsubsection=\relax
2183 \let\contents=\relax
2184 \let\smallbook=\relax
2185 \let\titlepage=\relax
2188 % Used in nested conditionals, where we have to parse the Texinfo source
2189 % and so want to turn off most commands, in case they are used
2190 % incorrectly.
2192 \def\ignoremorecommands{%
2193 \let\defcodeindex = \relax
2194 \let\defcv = \relax
2195 \let\deffn = \relax
2196 \let\deffnx = \relax
2197 \let\defindex = \relax
2198 \let\defivar = \relax
2199 \let\defmac = \relax
2200 \let\defmethod = \relax
2201 \let\defop = \relax
2202 \let\defopt = \relax
2203 \let\defspec = \relax
2204 \let\deftp = \relax
2205 \let\deftypefn = \relax
2206 \let\deftypefun = \relax
2207 \let\deftypeivar = \relax
2208 \let\deftypeop = \relax
2209 \let\deftypevar = \relax
2210 \let\deftypevr = \relax
2211 \let\defun = \relax
2212 \let\defvar = \relax
2213 \let\defvr = \relax
2214 \let\ref = \relax
2215 \let\xref = \relax
2216 \let\printindex = \relax
2217 \let\pxref = \relax
2218 \let\settitle = \relax
2219 \let\setchapternewpage = \relax
2220 \let\setchapterstyle = \relax
2221 \let\everyheading = \relax
2222 \let\evenheading = \relax
2223 \let\oddheading = \relax
2224 \let\everyfooting = \relax
2225 \let\evenfooting = \relax
2226 \let\oddfooting = \relax
2227 \let\headings = \relax
2228 \let\include = \relax
2229 \let\lowersections = \relax
2230 \let\down = \relax
2231 \let\raisesections = \relax
2232 \let\up = \relax
2233 \let\set = \relax
2234 \let\clear = \relax
2235 \let\item = \relax
2238 % Ignore @ignore ... @end ignore.
2240 \def\ignore{\doignore{ignore}}
2242 % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
2244 \def\ifinfo{\doignore{ifinfo}}
2245 \def\ifhtml{\doignore{ifhtml}}
2246 \def\ifnottex{\doignore{ifnottex}}
2247 \def\html{\doignore{html}}
2248 \def\menu{\doignore{menu}}
2249 \def\direntry{\doignore{direntry}}
2251 % @dircategory CATEGORY -- specify a category of the dir file
2252 % which this file should belong to. Ignore this in TeX.
2253 \let\dircategory = \comment
2255 % Ignore text until a line `@end #1'.
2257 \def\doignore#1{\begingroup
2258 % Don't complain about control sequences we have declared \outer.
2259 \ignoresections
2261 % Define a command to swallow text until we reach `@end #1'.
2262 % This @ is a catcode 12 token (that is the normal catcode of @ in
2263 % this texinfo.tex file). We change the catcode of @ below to match.
2264 \long\def\doignoretext##1@end #1{\enddoignore}%
2266 % Make sure that spaces turn into tokens that match what \doignoretext wants.
2267 \catcode32 = 10
2269 % Ignore braces, too, so mismatched braces don't cause trouble.
2270 \catcode`\{ = 9
2271 \catcode`\} = 9
2273 % We must not have @c interpreted as a control sequence.
2274 \catcode`\@ = 12
2276 % Make the letter c a comment character so that the rest of the line
2277 % will be ignored. This way, the document can have (for example)
2278 % @c @end ifinfo
2279 % and the @end ifinfo will be properly ignored.
2280 % (We've just changed @ to catcode 12.)
2281 \catcode`\c = 14
2283 % And now expand that command.
2284 \doignoretext
2287 % What we do to finish off ignored text.
2289 \def\enddoignore{\endgroup\ignorespaces}%
2291 \newif\ifwarnedobs\warnedobsfalse
2292 \def\obstexwarn{%
2293 \ifwarnedobs\relax\else
2294 % We need to warn folks that they may have trouble with TeX 3.0.
2295 % This uses \immediate\write16 rather than \message to get newlines.
2296 \immediate\write16{}
2297 \immediate\write16{WARNING: for users of Unix TeX 3.0!}
2298 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
2299 \immediate\write16{If you are running another version of TeX, relax.}
2300 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
2301 \immediate\write16{ Then upgrade your TeX installation if you can.}
2302 \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
2303 \immediate\write16{If you are stuck with version 3.0, run the}
2304 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
2305 \immediate\write16{ to use a workaround.}
2306 \immediate\write16{}
2307 \global\warnedobstrue
2311 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
2312 % workaround (which requires the file ``dummy.tfm'' to be installed),
2313 % uncomment the following line:
2314 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
2316 % Ignore text, except that we keep track of conditional commands for
2317 % purposes of nesting, up to an `@end #1' command.
2319 \def\nestedignore#1{%
2320 \obstexwarn
2321 % We must actually expand the ignored text to look for the @end
2322 % command, so that nested ignore constructs work. Thus, we put the
2323 % text into a \vbox and then do nothing with the result. To minimize
2324 % the change of memory overflow, we follow the approach outlined on
2325 % page 401 of the TeXbook: make the current font be a dummy font.
2327 \setbox0 = \vbox\bgroup
2328 % Don't complain about control sequences we have declared \outer.
2329 \ignoresections
2331 % Define `@end #1' to end the box, which will in turn undefine the
2332 % @end command again.
2333 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
2335 % We are going to be parsing Texinfo commands. Most cause no
2336 % trouble when they are used incorrectly, but some commands do
2337 % complicated argument parsing or otherwise get confused, so we
2338 % undefine them.
2340 % We can't do anything about stray @-signs, unfortunately;
2341 % they'll produce `undefined control sequence' errors.
2342 \ignoremorecommands
2344 % Set the current font to be \nullfont, a TeX primitive, and define
2345 % all the font commands to also use \nullfont. We don't use
2346 % dummy.tfm, as suggested in the TeXbook, because not all sites
2347 % might have that installed. Therefore, math mode will still
2348 % produce output, but that should be an extremely small amount of
2349 % stuff compared to the main input.
2351 \nullfont
2352 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
2353 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
2354 \let\tensf = \nullfont
2355 % Similarly for index fonts (mostly for their use in
2356 % smallexample)
2357 \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
2358 \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
2359 \let\indsf = \nullfont
2361 % Don't complain when characters are missing from the fonts.
2362 \tracinglostchars = 0
2364 % Don't bother to do space factor calculations.
2365 \frenchspacing
2367 % Don't report underfull hboxes.
2368 \hbadness = 10000
2370 % Do minimal line-breaking.
2371 \pretolerance = 10000
2373 % Do not execute instructions in @tex
2374 \def\tex{\doignore{tex}}%
2375 % Do not execute macro definitions.
2376 % `c' is a comment character, so the word `macro' will get cut off.
2377 \def\macro{\doignore{ma}}%
2380 % @set VAR sets the variable VAR to an empty value.
2381 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
2383 % Since we want to separate VAR from REST-OF-LINE (which might be
2384 % empty), we can't just use \parsearg; we have to insert a space of our
2385 % own to delimit the rest of the line, and then take it out again if we
2386 % didn't need it. Make sure the catcode of space is correct to avoid
2387 % losing inside @example, for instance.
2389 \def\set{\begingroup\catcode` =10
2390 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
2391 \parsearg\setxxx}
2392 \def\setxxx#1{\setyyy#1 \endsetyyy}
2393 \def\setyyy#1 #2\endsetyyy{%
2394 \def\temp{#2}%
2395 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
2396 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
2398 \endgroup
2400 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
2401 % \next or other control sequences that we've defined might get us into
2402 % an infinite loop. Consider `@set foo @cite{bar}'.
2403 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
2405 % @clear VAR clears (i.e., unsets) the variable VAR.
2407 \def\clear{\parsearg\clearxxx}
2408 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
2410 % @value{foo} gets the text saved in variable foo.
2412 \catcode`\_ = \active
2414 % We might end up with active _ or - characters in the argument if
2415 % we're called from @code, as @code{@value{foo-bar_}}. So \let any
2416 % such active characters to their normal equivalents.
2417 \gdef\value{\begingroup
2418 \catcode`\-=12 \catcode`\_=12
2419 \indexbreaks \let_\normalunderscore
2420 \valuexxx}
2422 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
2424 % We have this subroutine so that we can handle at least some @value's
2425 % properly in indexes (we \let\value to this in \indexdummies). Ones
2426 % whose names contain - or _ still won't work, but we can't do anything
2427 % about that. The command has to be fully expandable, since the result
2428 % winds up in the index file. This means that if the variable's value
2429 % contains other Texinfo commands, it's almost certain it will fail
2430 % (although perhaps we could fix that with sufficient work to do a
2431 % one-level expansion on the result, instead of complete).
2433 \def\expandablevalue#1{%
2434 \expandafter\ifx\csname SET#1\endcsname\relax
2435 {[No value for ``#1'']}%
2436 \else
2437 \csname SET#1\endcsname
2441 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
2442 % with @set.
2444 \def\ifset{\parsearg\ifsetxxx}
2445 \def\ifsetxxx #1{%
2446 \expandafter\ifx\csname SET#1\endcsname\relax
2447 \expandafter\ifsetfail
2448 \else
2449 \expandafter\ifsetsucceed
2452 \def\ifsetsucceed{\conditionalsucceed{ifset}}
2453 \def\ifsetfail{\nestedignore{ifset}}
2454 \defineunmatchedend{ifset}
2456 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
2457 % defined with @set, or has been undefined with @clear.
2459 \def\ifclear{\parsearg\ifclearxxx}
2460 \def\ifclearxxx #1{%
2461 \expandafter\ifx\csname SET#1\endcsname\relax
2462 \expandafter\ifclearsucceed
2463 \else
2464 \expandafter\ifclearfail
2467 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
2468 \def\ifclearfail{\nestedignore{ifclear}}
2469 \defineunmatchedend{ifclear}
2471 % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
2472 % following, through the first @end iftex (etc.). Make `@end iftex'
2473 % (etc.) valid only after an @iftex.
2475 \def\iftex{\conditionalsucceed{iftex}}
2476 \def\ifnothtml{\conditionalsucceed{ifnothtml}}
2477 \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
2478 \defineunmatchedend{iftex}
2479 \defineunmatchedend{ifnothtml}
2480 \defineunmatchedend{ifnotinfo}
2482 % We can't just want to start a group at @iftex (for example) and end it
2483 % at @end iftex, since then @set commands inside the conditional have no
2484 % effect (they'd get reverted at the end of the group). So we must
2485 % define \Eiftex to redefine itself to be its previous value. (We can't
2486 % just define it to fail again with an ``unmatched end'' error, since
2487 % the @ifset might be nested.)
2489 \def\conditionalsucceed#1{%
2490 \edef\temp{%
2491 % Remember the current value of \E#1.
2492 \let\nece{prevE#1} = \nece{E#1}%
2494 % At the `@end #1', redefine \E#1 to be its previous value.
2495 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
2497 \temp
2500 % We need to expand lots of \csname's, but we don't want to expand the
2501 % control sequences after we've constructed them.
2503 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
2505 % @defininfoenclose.
2506 \let\definfoenclose=\comment
2509 \message{indexing,}
2510 % Index generation facilities
2512 % Define \newwrite to be identical to plain tex's \newwrite
2513 % except not \outer, so it can be used within \newindex.
2514 {\catcode`\@=11
2515 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2517 % \newindex {foo} defines an index named foo.
2518 % It automatically defines \fooindex such that
2519 % \fooindex ...rest of line... puts an entry in the index foo.
2520 % It also defines \fooindfile to be the number of the output channel for
2521 % the file that accumulates this index. The file's extension is foo.
2522 % The name of an index should be no more than 2 characters long
2523 % for the sake of vms.
2525 \def\newindex#1{%
2526 \iflinks
2527 \expandafter\newwrite \csname#1indfile\endcsname
2528 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2530 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
2531 \noexpand\doindex{#1}}
2534 % @defindex foo == \newindex{foo}
2536 \def\defindex{\parsearg\newindex}
2538 % Define @defcodeindex, like @defindex except put all entries in @code.
2540 \def\newcodeindex#1{%
2541 \iflinks
2542 \expandafter\newwrite \csname#1indfile\endcsname
2543 \openout \csname#1indfile\endcsname \jobname.#1
2545 \expandafter\xdef\csname#1index\endcsname{%
2546 \noexpand\docodeindex{#1}}
2549 \def\defcodeindex{\parsearg\newcodeindex}
2551 % @synindex foo bar makes index foo feed into index bar.
2552 % Do this instead of @defindex foo if you don't want it as a separate index.
2553 % The \closeout helps reduce unnecessary open files; the limit on the
2554 % Acorn RISC OS is a mere 16 files.
2555 \def\synindex#1 #2 {%
2556 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2557 \expandafter\closeout\csname#1indfile\endcsname
2558 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2559 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2560 \noexpand\doindex{#2}}%
2563 % @syncodeindex foo bar similar, but put all entries made for index foo
2564 % inside @code.
2565 \def\syncodeindex#1 #2 {%
2566 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2567 \expandafter\closeout\csname#1indfile\endcsname
2568 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2569 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2570 \noexpand\docodeindex{#2}}%
2573 % Define \doindex, the driver for all \fooindex macros.
2574 % Argument #1 is generated by the calling \fooindex macro,
2575 % and it is "foo", the name of the index.
2577 % \doindex just uses \parsearg; it calls \doind for the actual work.
2578 % This is because \doind is more useful to call from other macros.
2580 % There is also \dosubind {index}{topic}{subtopic}
2581 % which makes an entry in a two-level index such as the operation index.
2583 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
2584 \def\singleindexer #1{\doind{\indexname}{#1}}
2586 % like the previous two, but they put @code around the argument.
2587 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2588 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2590 \def\indexdummies{%
2591 \def\ { }%
2592 % Take care of the plain tex accent commands.
2593 \def\"{\realbackslash "}%
2594 \def\`{\realbackslash `}%
2595 \def\'{\realbackslash '}%
2596 \def\^{\realbackslash ^}%
2597 \def\~{\realbackslash ~}%
2598 \def\={\realbackslash =}%
2599 \def\b{\realbackslash b}%
2600 \def\c{\realbackslash c}%
2601 \def\d{\realbackslash d}%
2602 \def\u{\realbackslash u}%
2603 \def\v{\realbackslash v}%
2604 \def\H{\realbackslash H}%
2605 % Take care of the plain tex special European modified letters.
2606 \def\oe{\realbackslash oe}%
2607 \def\ae{\realbackslash ae}%
2608 \def\aa{\realbackslash aa}%
2609 \def\OE{\realbackslash OE}%
2610 \def\AE{\realbackslash AE}%
2611 \def\AA{\realbackslash AA}%
2612 \def\o{\realbackslash o}%
2613 \def\O{\realbackslash O}%
2614 \def\l{\realbackslash l}%
2615 \def\L{\realbackslash L}%
2616 \def\ss{\realbackslash ss}%
2617 % Take care of texinfo commands likely to appear in an index entry.
2618 % (Must be a way to avoid doing expansion at all, and thus not have to
2619 % laboriously list every single command here.)
2620 \def\@{@}% will be @@ when we switch to @ as escape char.
2621 % Need these in case \tex is in effect and \{ is a \delimiter again.
2622 % But can't use \lbracecmd and \rbracecmd because texindex assumes
2623 % braces and backslashes are used only as delimiters.
2624 \let\{ = \mylbrace
2625 \let\} = \myrbrace
2626 \def\_{{\realbackslash _}}%
2627 \def\w{\realbackslash w }%
2628 \def\bf{\realbackslash bf }%
2629 %\def\rm{\realbackslash rm }%
2630 \def\sl{\realbackslash sl }%
2631 \def\sf{\realbackslash sf}%
2632 \def\tt{\realbackslash tt}%
2633 \def\gtr{\realbackslash gtr}%
2634 \def\less{\realbackslash less}%
2635 \def\hat{\realbackslash hat}%
2636 \def\TeX{\realbackslash TeX}%
2637 \def\dots{\realbackslash dots }%
2638 \def\result{\realbackslash result}%
2639 \def\equiv{\realbackslash equiv}%
2640 \def\expansion{\realbackslash expansion}%
2641 \def\print{\realbackslash print}%
2642 \def\error{\realbackslash error}%
2643 \def\point{\realbackslash point}%
2644 \def\copyright{\realbackslash copyright}%
2645 \def\tclose##1{\realbackslash tclose {##1}}%
2646 \def\code##1{\realbackslash code {##1}}%
2647 \def\uref##1{\realbackslash uref {##1}}%
2648 \def\url##1{\realbackslash url {##1}}%
2649 \def\env##1{\realbackslash env {##1}}%
2650 \def\command##1{\realbackslash command {##1}}%
2651 \def\option##1{\realbackslash option {##1}}%
2652 \def\dotless##1{\realbackslash dotless {##1}}%
2653 \def\samp##1{\realbackslash samp {##1}}%
2654 \def\,##1{\realbackslash ,{##1}}%
2655 \def\t##1{\realbackslash t {##1}}%
2656 \def\r##1{\realbackslash r {##1}}%
2657 \def\i##1{\realbackslash i {##1}}%
2658 \def\b##1{\realbackslash b {##1}}%
2659 \def\sc##1{\realbackslash sc {##1}}%
2660 \def\cite##1{\realbackslash cite {##1}}%
2661 \def\key##1{\realbackslash key {##1}}%
2662 \def\file##1{\realbackslash file {##1}}%
2663 \def\var##1{\realbackslash var {##1}}%
2664 \def\kbd##1{\realbackslash kbd {##1}}%
2665 \def\dfn##1{\realbackslash dfn {##1}}%
2666 \def\emph##1{\realbackslash emph {##1}}%
2667 \def\acronym##1{\realbackslash acronym {##1}}%
2669 % Handle some cases of @value -- where the variable name does not
2670 % contain - or _, and the value does not contain any
2671 % (non-fully-expandable) commands.
2672 \let\value = \expandablevalue
2674 \unsepspaces
2675 % Turn off macro expansion
2676 \turnoffmacros
2679 % If an index command is used in an @example environment, any spaces
2680 % therein should become regular spaces in the raw index file, not the
2681 % expansion of \tie (\\leavevmode \penalty \@M \ ).
2682 {\obeyspaces
2683 \gdef\unsepspaces{\obeyspaces\let =\space}}
2685 % \indexnofonts no-ops all font-change commands.
2686 % This is used when outputting the strings to sort the index by.
2687 \def\indexdummyfont#1{#1}
2688 \def\indexdummytex{TeX}
2689 \def\indexdummydots{...}
2691 \def\indexnofonts{%
2692 % Just ignore accents.
2693 \let\,=\indexdummyfont
2694 \let\"=\indexdummyfont
2695 \let\`=\indexdummyfont
2696 \let\'=\indexdummyfont
2697 \let\^=\indexdummyfont
2698 \let\~=\indexdummyfont
2699 \let\==\indexdummyfont
2700 \let\b=\indexdummyfont
2701 \let\c=\indexdummyfont
2702 \let\d=\indexdummyfont
2703 \let\u=\indexdummyfont
2704 \let\v=\indexdummyfont
2705 \let\H=\indexdummyfont
2706 \let\dotless=\indexdummyfont
2707 % Take care of the plain tex special European modified letters.
2708 \def\oe{oe}%
2709 \def\ae{ae}%
2710 \def\aa{aa}%
2711 \def\OE{OE}%
2712 \def\AE{AE}%
2713 \def\AA{AA}%
2714 \def\o{o}%
2715 \def\O{O}%
2716 \def\l{l}%
2717 \def\L{L}%
2718 \def\ss{ss}%
2719 \let\w=\indexdummyfont
2720 \let\t=\indexdummyfont
2721 \let\r=\indexdummyfont
2722 \let\i=\indexdummyfont
2723 \let\b=\indexdummyfont
2724 \let\emph=\indexdummyfont
2725 \let\strong=\indexdummyfont
2726 \let\cite=\indexdummyfont
2727 \let\sc=\indexdummyfont
2728 %Don't no-op \tt, since it isn't a user-level command
2729 % and is used in the definitions of the active chars like <, >, |...
2730 %\let\tt=\indexdummyfont
2731 \let\tclose=\indexdummyfont
2732 \let\code=\indexdummyfont
2733 \let\url=\indexdummyfont
2734 \let\uref=\indexdummyfont
2735 \let\env=\indexdummyfont
2736 \let\command=\indexdummyfont
2737 \let\option=\indexdummyfont
2738 \let\file=\indexdummyfont
2739 \let\samp=\indexdummyfont
2740 \let\kbd=\indexdummyfont
2741 \let\key=\indexdummyfont
2742 \let\var=\indexdummyfont
2743 \let\TeX=\indexdummytex
2744 \let\dots=\indexdummydots
2745 \def\@{@}%
2748 % To define \realbackslash, we must make \ not be an escape.
2749 % We must first make another character (@) an escape
2750 % so we do not become unable to do a definition.
2752 {\catcode`\@=0 \catcode`\\=\other
2753 @gdef@realbackslash{\}}
2755 \let\indexbackslash=0 %overridden during \printindex.
2756 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
2758 % For \ifx comparisons.
2759 \def\emptymacro{\empty}
2761 % Most index entries go through here, but \dosubind is the general case.
2763 \def\doind#1#2{\dosubind{#1}{#2}\empty}
2765 % Workhorse for all \fooindexes.
2766 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
2767 % \empty if called from \doind, as we usually are. The main exception
2768 % is with defuns, which call us directly.
2770 \def\dosubind#1#2#3{%
2771 % Put the index entry in the margin if desired.
2772 \ifx\SETmarginindex\relax\else
2773 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2776 \count255=\lastpenalty
2778 \indexdummies % Must do this here, since \bf, etc expand at this stage
2779 \escapechar=`\\
2781 \let\folio = 0% We will expand all macros now EXCEPT \folio.
2782 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2783 % so it will be output as is; and it will print as backslash.
2785 \def\thirdarg{#3}%
2787 % If third arg is present, precede it with space in sort key.
2788 \ifx\thirdarg\emptymacro
2789 \let\subentry = \empty
2790 \else
2791 \def\subentry{ #3}%
2794 % First process the index entry with all font commands turned
2795 % off to get the string to sort by.
2796 {\indexnofonts \xdef\indexsorttmp{#2\subentry}}%
2798 % Now the real index entry with the fonts.
2799 \toks0 = {#2}%
2801 % If third (subentry) arg is present, add it to the index
2802 % string. And include a space.
2803 \ifx\thirdarg\emptymacro \else
2804 \toks0 = \expandafter{\the\toks0 \space #3}%
2807 % Set up the complete index entry, with both the sort key
2808 % and the original text, including any font commands. We write
2809 % three arguments to \entry to the .?? file, texindex reduces to
2810 % two when writing the .??s sorted result.
2811 \edef\temp{%
2812 \write\csname#1indfile\endcsname{%
2813 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
2816 % If a skip is the last thing on the list now, preserve it
2817 % by backing up by \lastskip, doing the \write, then inserting
2818 % the skip again. Otherwise, the whatsit generated by the
2819 % \write will make \lastskip zero. The result is that sequences
2820 % like this:
2821 % @end defun
2822 % @tindex whatever
2823 % @defun ...
2824 % will have extra space inserted, because the \medbreak in the
2825 % start of the @defun won't see the skip inserted by the @end of
2826 % the previous defun.
2828 % But don't do any of this if we're not in vertical mode. We
2829 % don't want to do a \vskip and prematurely end a paragraph.
2831 % Avoid page breaks due to these extra skips, too.
2833 \iflinks
2834 \ifvmode
2835 \skip0 = \lastskip
2836 \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi
2839 \temp % do the write
2842 \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
2846 \penalty\count255
2850 % The index entry written in the file actually looks like
2851 % \entry {sortstring}{page}{topic}
2852 % or
2853 % \entry {sortstring}{page}{topic}{subtopic}
2854 % The texindex program reads in these files and writes files
2855 % containing these kinds of lines:
2856 % \initial {c}
2857 % before the first topic whose initial is c
2858 % \entry {topic}{pagelist}
2859 % for a topic that is used without subtopics
2860 % \primary {topic}
2861 % for the beginning of a topic that is used with subtopics
2862 % \secondary {subtopic}{pagelist}
2863 % for each subtopic.
2865 % Define the user-accessible indexing commands
2866 % @findex, @vindex, @kindex, @cindex.
2868 \def\findex {\fnindex}
2869 \def\kindex {\kyindex}
2870 \def\cindex {\cpindex}
2871 \def\vindex {\vrindex}
2872 \def\tindex {\tpindex}
2873 \def\pindex {\pgindex}
2875 \def\cindexsub {\begingroup\obeylines\cindexsub}
2876 {\obeylines %
2877 \gdef\cindexsub "#1" #2^^M{\endgroup %
2878 \dosubind{cp}{#2}{#1}}}
2880 % Define the macros used in formatting output of the sorted index material.
2882 % @printindex causes a particular index (the ??s file) to get printed.
2883 % It does not print any chapter heading (usually an @unnumbered).
2885 \def\printindex{\parsearg\doprintindex}
2886 \def\doprintindex#1{\begingroup
2887 \dobreak \chapheadingskip{10000}%
2889 \indexfonts \rm
2890 \tolerance = 9500
2891 \indexbreaks
2893 % See if the index file exists and is nonempty.
2894 % Change catcode of @ here so that if the index file contains
2895 % \initial {@}
2896 % as its first line, TeX doesn't complain about mismatched braces
2897 % (because it thinks @} is a control sequence).
2898 \catcode`\@ = 11
2899 \openin 1 \jobname.#1s
2900 \ifeof 1
2901 % \enddoublecolumns gets confused if there is no text in the index,
2902 % and it loses the chapter title and the aux file entries for the
2903 % index. The easiest way to prevent this problem is to make sure
2904 % there is some text.
2905 \putwordIndexNonexistent
2906 \else
2908 % If the index file exists but is empty, then \openin leaves \ifeof
2909 % false. We have to make TeX try to read something from the file, so
2910 % it can discover if there is anything in it.
2911 \read 1 to \temp
2912 \ifeof 1
2913 \putwordIndexIsEmpty
2914 \else
2915 % Index files are almost Texinfo source, but we use \ as the escape
2916 % character. It would be better to use @, but that's too big a change
2917 % to make right now.
2918 \def\indexbackslash{\rawbackslashxx}%
2919 \catcode`\\ = 0
2920 \escapechar = `\\
2921 \begindoublecolumns
2922 \input \jobname.#1s
2923 \enddoublecolumns
2926 \closein 1
2927 \endgroup}
2929 % These macros are used by the sorted index file itself.
2930 % Change them to control the appearance of the index.
2932 \def\initial#1{{%
2933 % Some minor font changes for the special characters.
2934 \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2936 % Remove any glue we may have, we'll be inserting our own.
2937 \removelastskip
2939 % We like breaks before the index initials, so insert a bonus.
2940 \penalty -300
2942 % Typeset the initial. Making this add up to a whole number of
2943 % baselineskips increases the chance of the dots lining up from column
2944 % to column. It still won't often be perfect, because of the stretch
2945 % we need before each entry, but it's better.
2947 % No shrink because it confuses \balancecolumns.
2948 \vskip 1.67\baselineskip plus .5\baselineskip
2949 \leftline{\secbf #1}%
2950 \vskip .33\baselineskip plus .1\baselineskip
2952 % Do our best not to break after the initial.
2953 \nobreak
2956 % This typesets a paragraph consisting of #1, dot leaders, and then #2
2957 % flush to the right margin. It is used for index and table of contents
2958 % entries. The paragraph is indented by \leftskip.
2960 \def\entry#1#2{\begingroup
2962 % Start a new paragraph if necessary, so our assignments below can't
2963 % affect previous text.
2964 \par
2966 % Do not fill out the last line with white space.
2967 \parfillskip = 0in
2969 % No extra space above this paragraph.
2970 \parskip = 0in
2972 % Do not prefer a separate line ending with a hyphen to fewer lines.
2973 \finalhyphendemerits = 0
2975 % \hangindent is only relevant when the entry text and page number
2976 % don't both fit on one line. In that case, bob suggests starting the
2977 % dots pretty far over on the line. Unfortunately, a large
2978 % indentation looks wrong when the entry text itself is broken across
2979 % lines. So we use a small indentation and put up with long leaders.
2981 % \hangafter is reset to 1 (which is the value we want) at the start
2982 % of each paragraph, so we need not do anything with that.
2983 \hangindent = 2em
2985 % When the entry text needs to be broken, just fill out the first line
2986 % with blank space.
2987 \rightskip = 0pt plus1fil
2989 % A bit of stretch before each entry for the benefit of balancing columns.
2990 \vskip 0pt plus1pt
2992 % Start a ``paragraph'' for the index entry so the line breaking
2993 % parameters we've set above will have an effect.
2994 \noindent
2996 % Insert the text of the index entry. TeX will do line-breaking on it.
2998 % The following is kludged to not output a line of dots in the index if
2999 % there are no page numbers. The next person who breaks this will be
3000 % cursed by a Unix daemon.
3001 \def\tempa{{\rm }}%
3002 \def\tempb{#2}%
3003 \edef\tempc{\tempa}%
3004 \edef\tempd{\tempb}%
3005 \ifx\tempc\tempd\ \else%
3007 % If we must, put the page number on a line of its own, and fill out
3008 % this line with blank space. (The \hfil is overwhelmed with the
3009 % fill leaders glue in \indexdotfill if the page number does fit.)
3010 \hfil\penalty50
3011 \null\nobreak\indexdotfill % Have leaders before the page number.
3013 % The `\ ' here is removed by the implicit \unskip that TeX does as
3014 % part of (the primitive) \par. Without it, a spurious underfull
3015 % \hbox ensues.
3016 \ #2% The page number ends the paragraph.
3017 \fi%
3018 \par
3019 \endgroup}
3021 % Like \dotfill except takes at least 1 em.
3022 \def\indexdotfill{\cleaders
3023 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
3025 \def\primary #1{\line{#1\hfil}}
3027 \newskip\secondaryindent \secondaryindent=0.5cm
3029 \def\secondary #1#2{
3030 {\parfillskip=0in \parskip=0in
3031 \hangindent =1in \hangafter=1
3032 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
3035 % Define two-column mode, which we use to typeset indexes.
3036 % Adapted from the TeXbook, page 416, which is to say,
3037 % the manmac.tex format used to print the TeXbook itself.
3038 \catcode`\@=11
3040 \newbox\partialpage
3041 \newdimen\doublecolumnhsize
3043 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
3044 % Grab any single-column material above us.
3045 \output = {%
3047 % Here is a possibility not foreseen in manmac: if we accumulate a
3048 % whole lot of material, we might end up calling this \output
3049 % routine twice in a row (see the doublecol-lose test, which is
3050 % essentially a couple of indexes with @setchapternewpage off). In
3051 % that case we just ship out what is in \partialpage with the normal
3052 % output routine. Generally, \partialpage will be empty when this
3053 % runs and this will be a no-op. See the indexspread.tex test case.
3054 \ifvoid\partialpage \else
3055 \onepageout{\pagecontents\partialpage}%
3058 \global\setbox\partialpage = \vbox{%
3059 % Unvbox the main output page.
3060 \unvbox\PAGE
3061 \kern-\topskip \kern\baselineskip
3064 \eject % run that output routine to set \partialpage
3066 % Use the double-column output routine for subsequent pages.
3067 \output = {\doublecolumnout}%
3069 % Change the page size parameters. We could do this once outside this
3070 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
3071 % format, but then we repeat the same computation. Repeating a couple
3072 % of assignments once per index is clearly meaningless for the
3073 % execution time, so we may as well do it in one place.
3075 % First we halve the line length, less a little for the gutter between
3076 % the columns. We compute the gutter based on the line length, so it
3077 % changes automatically with the paper format. The magic constant
3078 % below is chosen so that the gutter has the same value (well, +-<1pt)
3079 % as it did when we hard-coded it.
3081 % We put the result in a separate register, \doublecolumhsize, so we
3082 % can restore it in \pagesofar, after \hsize itself has (potentially)
3083 % been clobbered.
3085 \doublecolumnhsize = \hsize
3086 \advance\doublecolumnhsize by -.04154\hsize
3087 \divide\doublecolumnhsize by 2
3088 \hsize = \doublecolumnhsize
3090 % Double the \vsize as well. (We don't need a separate register here,
3091 % since nobody clobbers \vsize.)
3092 \advance\vsize by -\ht\partialpage
3093 \vsize = 2\vsize
3096 % The double-column output routine for all double-column pages except
3097 % the last.
3099 \def\doublecolumnout{%
3100 \splittopskip=\topskip \splitmaxdepth=\maxdepth
3101 % Get the available space for the double columns -- the normal
3102 % (undoubled) page height minus any material left over from the
3103 % previous page.
3104 \dimen@ = \vsize
3105 \divide\dimen@ by 2
3107 % box0 will be the left-hand column, box2 the right.
3108 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
3109 \onepageout\pagesofar
3110 \unvbox255
3111 \penalty\outputpenalty
3113 \def\pagesofar{%
3114 % Re-output the contents of the output page -- any previous material,
3115 % followed by the two boxes we just split, in box0 and box2.
3116 \unvbox\partialpage
3118 \hsize = \doublecolumnhsize
3119 \wd0=\hsize \wd2=\hsize
3120 \hbox to\pagewidth{\box0\hfil\box2}%
3122 \def\enddoublecolumns{%
3123 \output = {%
3124 % Split the last of the double-column material. Leave it on the
3125 % current page, no automatic page break.
3126 \balancecolumns
3128 % If we end up splitting too much material for the current page,
3129 % though, there will be another page break right after this \output
3130 % invocation ends. Having called \balancecolumns once, we do not
3131 % want to call it again. Therefore, reset \output to its normal
3132 % definition right away. (We hope \balancecolumns will never be
3133 % called on to balance too much material, but if it is, this makes
3134 % the output somewhat more palatable.)
3135 \global\output = {\onepageout{\pagecontents\PAGE}}%
3137 \eject
3138 \endgroup % started in \begindoublecolumns
3140 % \pagegoal was set to the doubled \vsize above, since we restarted
3141 % the current page. We're now back to normal single-column
3142 % typesetting, so reset \pagegoal to the normal \vsize (after the
3143 % \endgroup where \vsize got restored).
3144 \pagegoal = \vsize
3146 \def\balancecolumns{%
3147 % Called at the end of the double column material.
3148 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
3149 \dimen@ = \ht0
3150 \advance\dimen@ by \topskip
3151 \advance\dimen@ by-\baselineskip
3152 \divide\dimen@ by 2 % target to split to
3153 %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
3154 \splittopskip = \topskip
3155 % Loop until we get a decent breakpoint.
3157 \vbadness = 10000
3158 \loop
3159 \global\setbox3 = \copy0
3160 \global\setbox1 = \vsplit3 to \dimen@
3161 \ifdim\ht3>\dimen@
3162 \global\advance\dimen@ by 1pt
3163 \repeat
3165 %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
3166 \setbox0=\vbox to\dimen@{\unvbox1}%
3167 \setbox2=\vbox to\dimen@{\unvbox3}%
3169 \pagesofar
3171 \catcode`\@ = \other
3174 \message{sectioning,}
3175 % Chapters, sections, etc.
3177 \newcount\chapno
3178 \newcount\secno \secno=0
3179 \newcount\subsecno \subsecno=0
3180 \newcount\subsubsecno \subsubsecno=0
3182 % This counter is funny since it counts through charcodes of letters A, B, ...
3183 % The \the is necessary, despite appearances, because \appendixletter is
3184 % expanded while writing the .toc file. \char\appendixno is not
3185 % expandable, thus it is written literally, thus all appendixes come out
3186 % with the same letter (or @) in the toc without it.
3187 \newcount\appendixno \appendixno = `\@
3188 \def\appendixletter{\char\the\appendixno}
3190 % Each @chapter defines this as the name of the chapter.
3191 % page headings and footings can use it. @section does likewise.
3192 \def\thischapter{}
3193 \def\thissection{}
3195 \newcount\absseclevel % used to calculate proper heading level
3196 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
3198 % @raisesections: treat @section as chapter, @subsection as section, etc.
3199 \def\raisesections{\global\advance\secbase by -1}
3200 \let\up=\raisesections % original BFox name
3202 % @lowersections: treat @chapter as section, @section as subsection, etc.
3203 \def\lowersections{\global\advance\secbase by 1}
3204 \let\down=\lowersections % original BFox name
3206 % Choose a numbered-heading macro
3207 % #1 is heading level if unmodified by @raisesections or @lowersections
3208 % #2 is text for heading
3209 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3210 \ifcase\absseclevel
3211 \chapterzzz{#2}
3213 \seczzz{#2}
3215 \numberedsubseczzz{#2}
3217 \numberedsubsubseczzz{#2}
3218 \else
3219 \ifnum \absseclevel<0
3220 \chapterzzz{#2}
3221 \else
3222 \numberedsubsubseczzz{#2}
3227 % like \numhead, but chooses appendix heading levels
3228 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3229 \ifcase\absseclevel
3230 \appendixzzz{#2}
3232 \appendixsectionzzz{#2}
3234 \appendixsubseczzz{#2}
3236 \appendixsubsubseczzz{#2}
3237 \else
3238 \ifnum \absseclevel<0
3239 \appendixzzz{#2}
3240 \else
3241 \appendixsubsubseczzz{#2}
3246 % like \numhead, but chooses numberless heading levels
3247 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3248 \ifcase\absseclevel
3249 \unnumberedzzz{#2}
3251 \unnumberedseczzz{#2}
3253 \unnumberedsubseczzz{#2}
3255 \unnumberedsubsubseczzz{#2}
3256 \else
3257 \ifnum \absseclevel<0
3258 \unnumberedzzz{#2}
3259 \else
3260 \unnumberedsubsubseczzz{#2}
3265 % @chapter, @appendix, @unnumbered.
3266 \def\thischaptername{No Chapter Title}
3267 \outer\def\chapter{\parsearg\chapteryyy}
3268 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
3269 \def\chapterzzz #1{%
3270 \secno=0 \subsecno=0 \subsubsecno=0
3271 \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
3272 \chapmacro {#1}{\the\chapno}%
3273 \gdef\thissection{#1}%
3274 \gdef\thischaptername{#1}%
3275 % We don't substitute the actual chapter name into \thischapter
3276 % because we don't want its macros evaluated now.
3277 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
3278 \toks0 = {#1}%
3279 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
3280 {\the\chapno}}}%
3281 \temp
3282 \donoderef
3283 \global\let\section = \numberedsec
3284 \global\let\subsection = \numberedsubsec
3285 \global\let\subsubsection = \numberedsubsubsec
3288 \outer\def\appendix{\parsearg\appendixyyy}
3289 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
3290 \def\appendixzzz #1{%
3291 \secno=0 \subsecno=0 \subsubsecno=0
3292 \global\advance \appendixno by 1
3293 \message{\putwordAppendix\space \appendixletter}%
3294 \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
3295 \gdef\thissection{#1}%
3296 \gdef\thischaptername{#1}%
3297 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
3298 \toks0 = {#1}%
3299 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
3300 {\putwordAppendix{} \appendixletter}}}%
3301 \temp
3302 \appendixnoderef
3303 \global\let\section = \appendixsec
3304 \global\let\subsection = \appendixsubsec
3305 \global\let\subsubsection = \appendixsubsubsec
3308 % @centerchap is like @unnumbered, but the heading is centered.
3309 \outer\def\centerchap{\parsearg\centerchapyyy}
3310 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
3312 % @top is like @unnumbered.
3313 \outer\def\top{\parsearg\unnumberedyyy}
3315 \outer\def\unnumbered{\parsearg\unnumberedyyy}
3316 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
3317 \def\unnumberedzzz #1{%
3318 \secno=0 \subsecno=0 \subsubsecno=0
3320 % This used to be simply \message{#1}, but TeX fully expands the
3321 % argument to \message. Therefore, if #1 contained @-commands, TeX
3322 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
3323 % expanded @cite (which turns out to cause errors because \cite is meant
3324 % to be executed, not expanded).
3326 % Anyway, we don't want the fully-expanded definition of @cite to appear
3327 % as a result of the \message, we just want `@cite' itself. We use
3328 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
3329 % simply yielding the contents of <toks register>. (We also do this for
3330 % the toc entries.)
3331 \toks0 = {#1}\message{(\the\toks0)}%
3333 \unnumbchapmacro {#1}%
3334 \gdef\thischapter{#1}\gdef\thissection{#1}%
3335 \toks0 = {#1}%
3336 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}%
3337 \temp
3338 \unnumbnoderef
3339 \global\let\section = \unnumberedsec
3340 \global\let\subsection = \unnumberedsubsec
3341 \global\let\subsubsection = \unnumberedsubsubsec
3344 % Sections.
3345 \outer\def\numberedsec{\parsearg\secyyy}
3346 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
3347 \def\seczzz #1{%
3348 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3349 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
3350 \toks0 = {#1}%
3351 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3352 {\the\chapno}{\the\secno}}}%
3353 \temp
3354 \donoderef
3355 \nobreak
3358 \outer\def\appendixsection{\parsearg\appendixsecyyy}
3359 \outer\def\appendixsec{\parsearg\appendixsecyyy}
3360 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
3361 \def\appendixsectionzzz #1{%
3362 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3363 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
3364 \toks0 = {#1}%
3365 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3366 {\appendixletter}{\the\secno}}}%
3367 \temp
3368 \appendixnoderef
3369 \nobreak
3372 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
3373 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
3374 \def\unnumberedseczzz #1{%
3375 \plainsecheading {#1}\gdef\thissection{#1}%
3376 \toks0 = {#1}%
3377 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}%
3378 \temp
3379 \unnumbnoderef
3380 \nobreak
3383 % Subsections.
3384 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
3385 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
3386 \def\numberedsubseczzz #1{%
3387 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3388 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
3389 \toks0 = {#1}%
3390 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3391 {\the\chapno}{\the\secno}{\the\subsecno}}}%
3392 \temp
3393 \donoderef
3394 \nobreak
3397 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
3398 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
3399 \def\appendixsubseczzz #1{%
3400 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3401 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
3402 \toks0 = {#1}%
3403 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3404 {\appendixletter}{\the\secno}{\the\subsecno}}}%
3405 \temp
3406 \appendixnoderef
3407 \nobreak
3410 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
3411 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
3412 \def\unnumberedsubseczzz #1{%
3413 \plainsubsecheading {#1}\gdef\thissection{#1}%
3414 \toks0 = {#1}%
3415 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry%
3416 {\the\toks0}}}%
3417 \temp
3418 \unnumbnoderef
3419 \nobreak
3422 % Subsubsections.
3423 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
3424 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
3425 \def\numberedsubsubseczzz #1{%
3426 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3427 \subsubsecheading {#1}
3428 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3429 \toks0 = {#1}%
3430 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3431 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3432 \temp
3433 \donoderef
3434 \nobreak
3437 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
3438 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
3439 \def\appendixsubsubseczzz #1{%
3440 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3441 \subsubsecheading {#1}
3442 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3443 \toks0 = {#1}%
3444 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3445 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3446 \temp
3447 \appendixnoderef
3448 \nobreak
3451 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
3452 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
3453 \def\unnumberedsubsubseczzz #1{%
3454 \plainsubsubsecheading {#1}\gdef\thissection{#1}%
3455 \toks0 = {#1}%
3456 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry%
3457 {\the\toks0}}}%
3458 \temp
3459 \unnumbnoderef
3460 \nobreak
3463 % These are variants which are not "outer", so they can appear in @ifinfo.
3464 % Actually, they should now be obsolete; ordinary section commands should work.
3465 \def\infotop{\parsearg\unnumberedzzz}
3466 \def\infounnumbered{\parsearg\unnumberedzzz}
3467 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
3468 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
3469 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
3471 \def\infoappendix{\parsearg\appendixzzz}
3472 \def\infoappendixsec{\parsearg\appendixseczzz}
3473 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
3474 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
3476 \def\infochapter{\parsearg\chapterzzz}
3477 \def\infosection{\parsearg\sectionzzz}
3478 \def\infosubsection{\parsearg\subsectionzzz}
3479 \def\infosubsubsection{\parsearg\subsubsectionzzz}
3481 % These macros control what the section commands do, according
3482 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
3483 % Define them by default for a numbered chapter.
3484 \global\let\section = \numberedsec
3485 \global\let\subsection = \numberedsubsec
3486 \global\let\subsubsection = \numberedsubsubsec
3488 % Define @majorheading, @heading and @subheading
3490 % NOTE on use of \vbox for chapter headings, section headings, and such:
3491 % 1) We use \vbox rather than the earlier \line to permit
3492 % overlong headings to fold.
3493 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
3494 % heading is obnoxious; this forbids it.
3495 % 3) Likewise, headings look best if no \parindent is used, and
3496 % if justification is not attempted. Hence \raggedright.
3499 \def\majorheading{\parsearg\majorheadingzzz}
3500 \def\majorheadingzzz #1{%
3501 {\advance\chapheadingskip by 10pt \chapbreak }%
3502 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3503 \parindent=0pt\raggedright
3504 \rm #1\hfill}}\bigskip \par\penalty 200}
3506 \def\chapheading{\parsearg\chapheadingzzz}
3507 \def\chapheadingzzz #1{\chapbreak %
3508 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3509 \parindent=0pt\raggedright
3510 \rm #1\hfill}}\bigskip \par\penalty 200}
3512 % @heading, @subheading, @subsubheading.
3513 \def\heading{\parsearg\plainsecheading}
3514 \def\subheading{\parsearg\plainsubsecheading}
3515 \def\subsubheading{\parsearg\plainsubsubsecheading}
3517 % These macros generate a chapter, section, etc. heading only
3518 % (including whitespace, linebreaking, etc. around it),
3519 % given all the information in convenient, parsed form.
3521 %%% Args are the skip and penalty (usually negative)
3522 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
3524 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
3526 %%% Define plain chapter starts, and page on/off switching for it
3527 % Parameter controlling skip before chapter headings (if needed)
3529 \newskip\chapheadingskip
3531 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
3532 \def\chappager{\par\vfill\supereject}
3533 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
3535 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
3537 \def\CHAPPAGoff{%
3538 \global\let\contentsalignmacro = \chappager
3539 \global\let\pchapsepmacro=\chapbreak
3540 \global\let\pagealignmacro=\chappager}
3542 \def\CHAPPAGon{%
3543 \global\let\contentsalignmacro = \chappager
3544 \global\let\pchapsepmacro=\chappager
3545 \global\let\pagealignmacro=\chappager
3546 \global\def\HEADINGSon{\HEADINGSsingle}}
3548 \def\CHAPPAGodd{
3549 \global\let\contentsalignmacro = \chapoddpage
3550 \global\let\pchapsepmacro=\chapoddpage
3551 \global\let\pagealignmacro=\chapoddpage
3552 \global\def\HEADINGSon{\HEADINGSdouble}}
3554 \CHAPPAGon
3556 \def\CHAPFplain{
3557 \global\let\chapmacro=\chfplain
3558 \global\let\unnumbchapmacro=\unnchfplain
3559 \global\let\centerchapmacro=\centerchfplain}
3561 % Plain chapter opening.
3562 % #1 is the text, #2 the chapter number or empty if unnumbered.
3563 \def\chfplain#1#2{%
3564 \pchapsepmacro
3566 \chapfonts \rm
3567 \def\chapnum{#2}%
3568 \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
3569 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3570 \hangindent = \wd0 \centerparametersmaybe
3571 \unhbox0 #1\par}%
3573 \nobreak\bigskip % no page break after a chapter title
3574 \nobreak
3577 % Plain opening for unnumbered.
3578 \def\unnchfplain#1{\chfplain{#1}{}}
3580 % @centerchap -- centered and unnumbered.
3581 \let\centerparametersmaybe = \relax
3582 \def\centerchfplain#1{{%
3583 \def\centerparametersmaybe{%
3584 \advance\rightskip by 3\rightskip
3585 \leftskip = \rightskip
3586 \parfillskip = 0pt
3588 \chfplain{#1}{}%
3591 \CHAPFplain % The default
3593 \def\unnchfopen #1{%
3594 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3595 \parindent=0pt\raggedright
3596 \rm #1\hfill}}\bigskip \par\nobreak
3599 \def\chfopen #1#2{\chapoddpage {\chapfonts
3600 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
3601 \par\penalty 5000 %
3604 \def\centerchfopen #1{%
3605 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3606 \parindent=0pt
3607 \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
3610 \def\CHAPFopen{
3611 \global\let\chapmacro=\chfopen
3612 \global\let\unnumbchapmacro=\unnchfopen
3613 \global\let\centerchapmacro=\centerchfopen}
3616 % Section titles.
3617 \newskip\secheadingskip
3618 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
3619 \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
3620 \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
3622 % Subsection titles.
3623 \newskip \subsecheadingskip
3624 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
3625 \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
3626 \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
3628 % Subsubsection titles.
3629 \let\subsubsecheadingskip = \subsecheadingskip
3630 \let\subsubsecheadingbreak = \subsecheadingbreak
3631 \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
3632 \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
3635 % Print any size section title.
3637 % #1 is the section type (sec/subsec/subsubsec), #2 is the section
3638 % number (maybe empty), #3 the text.
3639 \def\sectionheading#1#2#3{%
3641 \expandafter\advance\csname #1headingskip\endcsname by \parskip
3642 \csname #1headingbreak\endcsname
3645 % Switch to the right set of fonts.
3646 \csname #1fonts\endcsname \rm
3648 % Only insert the separating space if we have a section number.
3649 \def\secnum{#2}%
3650 \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
3652 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3653 \hangindent = \wd0 % zero if no section number
3654 \unhbox0 #3}%
3656 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
3660 \message{toc,}
3661 % Table of contents.
3662 \newwrite\tocfile
3664 % Write an entry to the toc file, opening it if necessary.
3665 % Called from @chapter, etc. We supply {\folio} at the end of the
3666 % argument, which will end up as the last argument to the \...entry macro.
3668 % We open the .toc file here instead of at @setfilename or any other
3669 % given time so that @contents can be put in the document anywhere.
3671 \newif\iftocfileopened
3672 \def\writetocentry#1{%
3673 \iftocfileopened\else
3674 \immediate\openout\tocfile = \jobname.toc
3675 \global\tocfileopenedtrue
3677 \iflinks \write\tocfile{#1{\folio}}\fi
3680 \newskip\contentsrightmargin \contentsrightmargin=1in
3681 \newcount\savepageno
3682 \newcount\lastnegativepageno \lastnegativepageno = -1
3684 % Finish up the main text and prepare to read what we've written
3685 % to \tocfile.
3687 \def\startcontents#1{%
3688 % If @setchapternewpage on, and @headings double, the contents should
3689 % start on an odd page, unlike chapters. Thus, we maintain
3690 % \contentsalignmacro in parallel with \pagealignmacro.
3691 % From: Torbjorn Granlund <tege@matematik.su.se>
3692 \contentsalignmacro
3693 \immediate\closeout\tocfile
3695 % Don't need to put `Contents' or `Short Contents' in the headline.
3696 % It is abundantly clear what they are.
3697 \unnumbchapmacro{#1}\def\thischapter{}%
3698 \savepageno = \pageno
3699 \begingroup % Set up to handle contents files properly.
3700 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
3701 % We can't do this, because then an actual ^ in a section
3702 % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
3703 %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3704 \raggedbottom % Worry more about breakpoints than the bottom.
3705 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3707 % Roman numerals for page numbers.
3708 \ifnum \pageno>0 \pageno = \lastnegativepageno \fi
3712 % Normal (long) toc.
3713 \def\contents{%
3714 \startcontents{\putwordTOC}%
3715 \openin 1 \jobname.toc
3716 \ifeof 1 \else
3717 \closein 1
3718 \input \jobname.toc
3720 \vfill \eject
3721 \contentsalignmacro % in case @setchapternewpage odd is in effect
3722 \pdfmakeoutlines
3723 \endgroup
3724 \lastnegativepageno = \pageno
3725 \pageno = \savepageno
3728 % And just the chapters.
3729 \def\summarycontents{%
3730 \startcontents{\putwordShortTOC}%
3732 \let\chapentry = \shortchapentry
3733 \let\unnumbchapentry = \shortunnumberedentry
3734 % We want a true roman here for the page numbers.
3735 \secfonts
3736 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
3738 \hyphenpenalty = 10000
3739 \advance\baselineskip by 1pt % Open it up a little.
3740 \def\secentry ##1##2##3##4{}
3741 \def\unnumbsecentry ##1##2{}
3742 \def\subsecentry ##1##2##3##4##5{}
3743 \def\unnumbsubsecentry ##1##2{}
3744 \def\subsubsecentry ##1##2##3##4##5##6{}
3745 \def\unnumbsubsubsecentry ##1##2{}
3746 \openin 1 \jobname.toc
3747 \ifeof 1 \else
3748 \closein 1
3749 \input \jobname.toc
3751 \vfill \eject
3752 \contentsalignmacro % in case @setchapternewpage odd is in effect
3753 \endgroup
3754 \lastnegativepageno = \pageno
3755 \pageno = \savepageno
3757 \let\shortcontents = \summarycontents
3759 \ifpdf
3760 \pdfcatalog{/PageMode /UseOutlines}%
3763 % These macros generate individual entries in the table of contents.
3764 % The first argument is the chapter or section name.
3765 % The last argument is the page number.
3766 % The arguments in between are the chapter number, section number, ...
3768 % Chapter-level things, for both the long and short contents.
3769 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3771 % See comments in \dochapentry re vbox and related settings
3772 \def\shortchapentry#1#2#3{%
3773 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
3776 % Typeset the label for a chapter or appendix for the short contents.
3777 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
3778 % We could simplify the code here by writing out an \appendixentry
3779 % command in the toc file for appendices, instead of using \chapentry
3780 % for both, but it doesn't seem worth it.
3781 \setbox0 = \hbox{\shortcontrm \putwordAppendix }
3782 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
3784 \def\shortchaplabel#1{%
3785 % We typeset #1 in a box of constant width, regardless of the text of
3786 % #1, so the chapter titles will come out aligned.
3787 \setbox0 = \hbox{#1}%
3788 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3790 % This space should be plenty, since a single number is .5em, and the
3791 % widest letter (M) is 1em, at least in the Computer Modern fonts.
3792 % (This space doesn't include the extra space that gets added after
3793 % the label; that gets put in by \shortchapentry above.)
3794 \advance\dimen0 by 1.1em
3795 \hbox to \dimen0{#1\hfil}%
3798 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3799 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
3801 % Sections.
3802 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3803 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
3805 % Subsections.
3806 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
3807 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
3809 % And subsubsections.
3810 \def\subsubsecentry#1#2#3#4#5#6{%
3811 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
3812 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
3814 % This parameter controls the indentation of the various levels.
3815 \newdimen\tocindent \tocindent = 3pc
3817 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
3818 % page number.
3820 % If the toc has to be broken over pages, we want it to be at chapters
3821 % if at all possible; hence the \penalty.
3822 \def\dochapentry#1#2{%
3823 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
3824 \begingroup
3825 \chapentryfonts
3826 \tocentry{#1}{\dopageno{#2}}%
3827 \endgroup
3828 \nobreak\vskip .25\baselineskip plus.1\baselineskip
3831 \def\dosecentry#1#2{\begingroup
3832 \secentryfonts \leftskip=\tocindent
3833 \tocentry{#1}{\dopageno{#2}}%
3834 \endgroup}
3836 \def\dosubsecentry#1#2{\begingroup
3837 \subsecentryfonts \leftskip=2\tocindent
3838 \tocentry{#1}{\dopageno{#2}}%
3839 \endgroup}
3841 \def\dosubsubsecentry#1#2{\begingroup
3842 \subsubsecentryfonts \leftskip=3\tocindent
3843 \tocentry{#1}{\dopageno{#2}}%
3844 \endgroup}
3846 % Final typesetting of a toc entry; we use the same \entry macro as for
3847 % the index entries, but we want to suppress hyphenation here. (We
3848 % can't do that in the \entry macro, since index entries might consist
3849 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
3850 \def\tocentry#1#2{\begingroup
3851 \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
3852 % Do not use \turnoffactive in these arguments. Since the toc is
3853 % typeset in cmr, so characters such as _ would come out wrong; we
3854 % have to do the usual translation tricks.
3855 \entry{#1}{#2}%
3856 \endgroup}
3858 % Space between chapter (or whatever) number and the title.
3859 \def\labelspace{\hskip1em \relax}
3861 \def\dopageno#1{{\rm #1}}
3862 \def\doshortpageno#1{{\rm #1}}
3864 \def\chapentryfonts{\secfonts \rm}
3865 \def\secentryfonts{\textfonts}
3866 \let\subsecentryfonts = \textfonts
3867 \let\subsubsecentryfonts = \textfonts
3870 \message{environments,}
3871 % @foo ... @end foo.
3873 % Since these characters are used in examples, it should be an even number of
3874 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3875 % Furthermore, these definitions must come after we define our fonts.
3876 \newbox\dblarrowbox \newbox\longdblarrowbox
3877 \newbox\pushcharbox \newbox\bullbox
3878 \newbox\equivbox \newbox\errorbox
3880 %{\tentt
3881 %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
3882 %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
3883 %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
3884 %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
3885 % Adapted from the manmac format (p.420 of TeXbook)
3886 %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
3887 % depth .1ex\hfil}
3890 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3891 \def\point{$\star$}
3892 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3893 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
3894 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3895 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3897 % Adapted from the TeXbook's \boxit.
3898 {\tentt \global\dimen0 = 3em}% Width of the box.
3899 \dimen2 = .55pt % Thickness of rules
3900 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3901 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
3903 \global\setbox\errorbox=\hbox to \dimen0{\hfil
3904 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3905 \advance\hsize by -2\dimen2 % Rules.
3906 \vbox{
3907 \hrule height\dimen2
3908 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3909 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3910 \kern3pt\vrule width\dimen2}% Space to right.
3911 \hrule height\dimen2}
3912 \hfil}
3914 % The @error{} command.
3915 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3917 % @tex ... @end tex escapes into raw Tex temporarily.
3918 % One exception: @ is still an escape character, so that @end tex works.
3919 % But \@ or @@ will get a plain tex @ character.
3921 \def\tex{\begingroup
3922 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
3923 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
3924 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
3925 \catcode `\%=14
3926 \catcode 43=12 % plus
3927 \catcode`\"=12
3928 \catcode`\==12
3929 \catcode`\|=12
3930 \catcode`\<=12
3931 \catcode`\>=12
3932 \escapechar=`\\
3934 \let\b=\ptexb
3935 \let\bullet=\ptexbullet
3936 \let\c=\ptexc
3937 \let\,=\ptexcomma
3938 \let\.=\ptexdot
3939 \let\dots=\ptexdots
3940 \let\equiv=\ptexequiv
3941 \let\!=\ptexexclam
3942 \let\i=\ptexi
3943 \let\{=\ptexlbrace
3944 \let\+=\tabalign
3945 \let\}=\ptexrbrace
3946 \let\*=\ptexstar
3947 \let\t=\ptext
3949 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
3950 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
3951 \def\@{@}%
3952 \let\Etex=\endgroup}
3954 % Define @lisp ... @endlisp.
3955 % @lisp does a \begingroup so it can rebind things,
3956 % including the definition of @endlisp (which normally is erroneous).
3958 % Amount to narrow the margins by for @lisp.
3959 \newskip\lispnarrowing \lispnarrowing=0.4in
3961 % This is the definition that ^^M gets inside @lisp, @example, and other
3962 % such environments. \null is better than a space, since it doesn't
3963 % have any width.
3964 \def\lisppar{\null\endgraf}
3966 % Make each space character in the input produce a normal interword
3967 % space in the output. Don't allow a line break at this space, as this
3968 % is used only in environments like @example, where each line of input
3969 % should produce a line of output anyway.
3971 {\obeyspaces %
3972 \gdef\sepspaces{\obeyspaces\let =\tie}}
3974 % Define \obeyedspace to be our active space, whatever it is. This is
3975 % for use in \parsearg.
3976 {\sepspaces%
3977 \global\let\obeyedspace= }
3979 % This space is always present above and below environments.
3980 \newskip\envskipamount \envskipamount = 0pt
3982 % Make spacing and below environment symmetrical. We use \parskip here
3983 % to help in doing that, since in @example-like environments \parskip
3984 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
3985 % start of the next paragraph will insert \parskip
3987 \def\aboveenvbreak{{\advance\envskipamount by \parskip
3988 \endgraf \ifdim\lastskip<\envskipamount
3989 \removelastskip \penalty-50 \vskip\envskipamount \fi}}
3991 \let\afterenvbreak = \aboveenvbreak
3993 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
3994 \let\nonarrowing=\relax
3996 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
3997 % environment contents.
3998 \font\circle=lcircle10
3999 \newdimen\circthick
4000 \newdimen\cartouter\newdimen\cartinner
4001 \newskip\normbskip\newskip\normpskip\newskip\normlskip
4002 \circthick=\fontdimen8\circle
4004 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
4005 \def\ctr{{\hskip 6pt\circle\char'010}}
4006 \def\cbl{{\circle\char'012\hskip -6pt}}
4007 \def\cbr{{\hskip 6pt\circle\char'011}}
4008 \def\carttop{\hbox to \cartouter{\hskip\lskip
4009 \ctl\leaders\hrule height\circthick\hfil\ctr
4010 \hskip\rskip}}
4011 \def\cartbot{\hbox to \cartouter{\hskip\lskip
4012 \cbl\leaders\hrule height\circthick\hfil\cbr
4013 \hskip\rskip}}
4015 \newskip\lskip\newskip\rskip
4017 \long\def\cartouche{%
4018 \begingroup
4019 \lskip=\leftskip \rskip=\rightskip
4020 \leftskip=0pt\rightskip=0pt %we want these *outside*.
4021 \cartinner=\hsize \advance\cartinner by-\lskip
4022 \advance\cartinner by-\rskip
4023 \cartouter=\hsize
4024 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
4025 % side, and for 6pt waste from
4026 % each corner char, and rule thickness
4027 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
4028 % Flag to tell @lisp, etc., not to narrow margin.
4029 \let\nonarrowing=\comment
4030 \vbox\bgroup
4031 \baselineskip=0pt\parskip=0pt\lineskip=0pt
4032 \carttop
4033 \hbox\bgroup
4034 \hskip\lskip
4035 \vrule\kern3pt
4036 \vbox\bgroup
4037 \hsize=\cartinner
4038 \kern3pt
4039 \begingroup
4040 \baselineskip=\normbskip
4041 \lineskip=\normlskip
4042 \parskip=\normpskip
4043 \vskip -\parskip
4044 \def\Ecartouche{%
4045 \endgroup
4046 \kern3pt
4047 \egroup
4048 \kern3pt\vrule
4049 \hskip\rskip
4050 \egroup
4051 \cartbot
4052 \egroup
4053 \endgroup
4057 % This macro is called at the beginning of all the @example variants,
4058 % inside a group.
4059 \def\nonfillstart{%
4060 \aboveenvbreak
4061 \inENV % This group ends at the end of the body
4062 \hfuzz = 12pt % Don't be fussy
4063 \sepspaces % Make spaces be word-separators rather than space tokens.
4064 \singlespace
4065 \let\par = \lisppar % don't ignore blank lines
4066 \obeylines % each line of input is a line of output
4067 \parskip = 0pt
4068 \parindent = 0pt
4069 \emergencystretch = 0pt % don't try to avoid overfull boxes
4070 % @cartouche defines \nonarrowing to inhibit narrowing
4071 % at next level down.
4072 \ifx\nonarrowing\relax
4073 \advance \leftskip by \lispnarrowing
4074 \exdentamount=\lispnarrowing
4075 \let\exdent=\nofillexdent
4076 \let\nonarrowing=\relax
4080 % Define the \E... control sequence only if we are inside the particular
4081 % environment, so the error checking in \end will work.
4083 % To end an @example-like environment, we first end the paragraph (via
4084 % \afterenvbreak's vertical glue), and then the group. That way we keep
4085 % the zero \parskip that the environments set -- \parskip glue will be
4086 % inserted at the beginning of the next paragraph in the document, after
4087 % the environment.
4089 \def\nonfillfinish{\afterenvbreak\endgroup}
4091 % @lisp: indented, narrowed, typewriter font.
4092 \def\lisp{\begingroup
4093 \nonfillstart
4094 \let\Elisp = \nonfillfinish
4096 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
4097 \gobble % eat return
4100 % @example: Same as @lisp.
4101 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
4103 % @small... is usually equivalent to the non-small (@smallbook
4104 % redefines). We must call \example (or whatever) last in the
4105 % definition, since it reads the return following the @example (or
4106 % whatever) command.
4108 % This actually allows (for example) @end display inside an
4109 % @smalldisplay. Too bad, but makeinfo will catch the error anyway.
4111 \def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display}
4112 \def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp}
4113 \def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format}
4114 \def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
4116 % Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
4117 % Originally contributed by Pavel@xerox.
4118 \def\smalllispx{\begingroup
4119 \def\Esmalllisp{\nonfillfinish\endgroup}%
4120 \def\Esmallexample{\nonfillfinish\endgroup}%
4121 \indexfonts
4122 \lisp
4125 % @display: same as @lisp except keep current font.
4127 \def\display{\begingroup
4128 \nonfillstart
4129 \let\Edisplay = \nonfillfinish
4130 \gobble
4133 % @smalldisplay (when @smallbook): @display plus smaller fonts.
4135 \def\smalldisplayx{\begingroup
4136 \def\Esmalldisplay{\nonfillfinish\endgroup}%
4137 \indexfonts \rm
4138 \display
4141 % @format: same as @display except don't narrow margins.
4143 \def\format{\begingroup
4144 \let\nonarrowing = t
4145 \nonfillstart
4146 \let\Eformat = \nonfillfinish
4147 \gobble
4150 % @smallformat (when @smallbook): @format plus smaller fonts.
4152 \def\smallformatx{\begingroup
4153 \def\Esmallformat{\nonfillfinish\endgroup}%
4154 \indexfonts \rm
4155 \format
4158 % @flushleft (same as @format).
4160 \def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
4162 % @flushright.
4164 \def\flushright{\begingroup
4165 \let\nonarrowing = t
4166 \nonfillstart
4167 \let\Eflushright = \nonfillfinish
4168 \advance\leftskip by 0pt plus 1fill
4169 \gobble
4172 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
4173 % and narrows the margins.
4175 \def\quotation{%
4176 \begingroup\inENV %This group ends at the end of the @quotation body
4177 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
4178 \singlespace
4179 \parindent=0pt
4180 % We have retained a nonzero parskip for the environment, since we're
4181 % doing normal filling. So to avoid extra space below the environment...
4182 \def\Equotation{\parskip = 0pt \nonfillfinish}%
4184 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
4185 \ifx\nonarrowing\relax
4186 \advance\leftskip by \lispnarrowing
4187 \advance\rightskip by \lispnarrowing
4188 \exdentamount = \lispnarrowing
4189 \let\nonarrowing = \relax
4194 \message{defuns,}
4195 % @defun etc.
4197 % Allow user to change definition object font (\df) internally
4198 \def\setdeffont #1 {\csname DEF#1\endcsname}
4200 \newskip\defbodyindent \defbodyindent=.4in
4201 \newskip\defargsindent \defargsindent=50pt
4202 \newskip\deftypemargin \deftypemargin=12pt
4203 \newskip\deflastargmargin \deflastargmargin=18pt
4205 \newcount\parencount
4206 % define \functionparens, which makes ( and ) and & do special things.
4207 % \functionparens affects the group it is contained in.
4208 \def\activeparens{%
4209 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
4210 \catcode`\[=\active \catcode`\]=\active}
4212 % Make control sequences which act like normal parenthesis chars.
4213 \let\lparen = ( \let\rparen = )
4215 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
4217 % Be sure that we always have a definition for `(', etc. For example,
4218 % if the fn name has parens in it, \boldbrax will not be in effect yet,
4219 % so TeX would otherwise complain about undefined control sequence.
4220 \global\let(=\lparen \global\let)=\rparen
4221 \global\let[=\lbrack \global\let]=\rbrack
4223 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
4224 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
4225 % This is used to turn on special parens
4226 % but make & act ordinary (given that it's active).
4227 \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
4229 % Definitions of (, ) and & used in args for functions.
4230 % This is the definition of ( outside of all parentheses.
4231 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
4232 \global\advance\parencount by 1
4235 % This is the definition of ( when already inside a level of parens.
4236 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
4238 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
4239 % also in that case restore the outer-level definition of (.
4240 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
4241 \global\advance \parencount by -1 }
4242 % If we encounter &foo, then turn on ()-hacking afterwards
4243 \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
4245 \gdef\normalparens{\boldbrax\let&=\ampnr}
4246 } % End of definition inside \activeparens
4247 %% These parens (in \boldbrax) actually are a little bolder than the
4248 %% contained text. This is especially needed for [ and ]
4249 \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
4250 \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
4251 \let\ampnr = \&
4252 \def\lbrb{{\bf\char`\[}}
4253 \def\rbrb{{\bf\char`\]}}
4255 % Active &'s sneak into the index arguments, so make sure it's defined.
4257 \catcode`& = 13
4258 \global\let& = \ampnr
4261 % First, defname, which formats the header line itself.
4262 % #1 should be the function name.
4263 % #2 should be the type of definition, such as "Function".
4265 \def\defname #1#2{%
4266 % Get the values of \leftskip and \rightskip as they were
4267 % outside the @def...
4268 \dimen2=\leftskip
4269 \advance\dimen2 by -\defbodyindent
4270 \noindent
4271 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
4272 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
4273 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
4274 \parshape 2 0in \dimen0 \defargsindent \dimen1
4275 % Now output arg 2 ("Function" or some such)
4276 % ending at \deftypemargin from the right margin,
4277 % but stuck inside a box of width 0 so it does not interfere with linebreaking
4278 {% Adjust \hsize to exclude the ambient margins,
4279 % so that \rightline will obey them.
4280 \advance \hsize by -\dimen2
4281 \rlap{\rightline{{\rm #2}\hskip -1.25pc }}}%
4282 % Make all lines underfull and no complaints:
4283 \tolerance=10000 \hbadness=10000
4284 \advance\leftskip by -\defbodyindent
4285 \exdentamount=\defbodyindent
4286 {\df #1}\enskip % Generate function name
4289 % Actually process the body of a definition
4290 % #1 should be the terminating control sequence, such as \Edefun.
4291 % #2 should be the "another name" control sequence, such as \defunx.
4292 % #3 should be the control sequence that actually processes the header,
4293 % such as \defunheader.
4295 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4296 \medbreak %
4297 % Define the end token that this defining construct specifies
4298 % so that it will exit this group.
4299 \def#1{\endgraf\endgroup\medbreak}%
4300 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
4301 \parindent=0in
4302 \advance\leftskip by \defbodyindent
4303 \exdentamount=\defbodyindent
4304 \begingroup %
4305 \catcode 61=\active % 61 is `='
4306 \obeylines\activeparens\spacesplit#3}
4308 % #1 is the \E... control sequence to end the definition (which we define).
4309 % #2 is the \...x control sequence for consecutive fns (which we define).
4310 % #3 is the control sequence to call to resume processing.
4311 % #4, delimited by the space, is the class name.
4313 \def\defmethparsebody#1#2#3#4 {\begingroup\inENV %
4314 \medbreak %
4315 % Define the end token that this defining construct specifies
4316 % so that it will exit this group.
4317 \def#1{\endgraf\endgroup\medbreak}%
4318 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
4319 \parindent=0in
4320 \advance\leftskip by \defbodyindent
4321 \exdentamount=\defbodyindent
4322 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
4324 % Used for @deftypemethod and @deftypeivar.
4325 % #1 is the \E... control sequence to end the definition (which we define).
4326 % #2 is the \...x control sequence for consecutive fns (which we define).
4327 % #3 is the control sequence to call to resume processing.
4328 % #4, delimited by a space, is the class name.
4329 % #5 is the method's return type.
4331 \def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV
4332 \medbreak
4333 \def#1{\endgraf\endgroup\medbreak}%
4334 \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}%
4335 \parindent=0in
4336 \advance\leftskip by \defbodyindent
4337 \exdentamount=\defbodyindent
4338 \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}}
4340 % Used for @deftypeop. The change from \deftypemethparsebody is an
4341 % extra argument at the beginning which is the `category', instead of it
4342 % being the hardwired string `Method' or `Instance Variable'. We have
4343 % to account for this both in the \...x definition and in parsing the
4344 % input at hand. Thus also need a control sequence (passed as #5) for
4345 % the \E... definition to assign the category name to.
4347 \def\deftypeopparsebody#1#2#3#4#5 #6 {\begingroup\inENV
4348 \medbreak
4349 \def#1{\endgraf\endgroup\medbreak}%
4350 \def#2##1 ##2 ##3 {%
4351 \def#4{##1}%
4352 \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}%
4353 \parindent=0in
4354 \advance\leftskip by \defbodyindent
4355 \exdentamount=\defbodyindent
4356 \begingroup\obeylines\activeparens\spacesplit{#3{#5}{#6}}}
4358 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
4359 \medbreak %
4360 % Define the end token that this defining construct specifies
4361 % so that it will exit this group.
4362 \def#1{\endgraf\endgroup\medbreak}%
4363 \def#2##1 ##2 {\def#4{##1}%
4364 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
4365 \parindent=0in
4366 \advance\leftskip by \defbodyindent
4367 \exdentamount=\defbodyindent
4368 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
4370 % These parsing functions are similar to the preceding ones
4371 % except that they do not make parens into active characters.
4372 % These are used for "variables" since they have no arguments.
4374 \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4375 \medbreak %
4376 % Define the end token that this defining construct specifies
4377 % so that it will exit this group.
4378 \def#1{\endgraf\endgroup\medbreak}%
4379 \def#2{\begingroup\obeylines\spacesplit#3}%
4380 \parindent=0in
4381 \advance\leftskip by \defbodyindent
4382 \exdentamount=\defbodyindent
4383 \begingroup %
4384 \catcode 61=\active %
4385 \obeylines\spacesplit#3}
4387 % This is used for \def{tp,vr}parsebody. It could probably be used for
4388 % some of the others, too, with some judicious conditionals.
4390 \def\parsebodycommon#1#2#3{%
4391 \begingroup\inENV %
4392 \medbreak %
4393 % Define the end token that this defining construct specifies
4394 % so that it will exit this group.
4395 \def#1{\endgraf\endgroup\medbreak}%
4396 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
4397 \parindent=0in
4398 \advance\leftskip by \defbodyindent
4399 \exdentamount=\defbodyindent
4400 \begingroup\obeylines
4403 \def\defvrparsebody#1#2#3#4 {%
4404 \parsebodycommon{#1}{#2}{#3}%
4405 \spacesplit{#3{#4}}%
4408 % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
4409 % type is just `struct', because we lose the braces in `{struct
4410 % termios}' when \spacesplit reads its undelimited argument. Sigh.
4411 % \let\deftpparsebody=\defvrparsebody
4413 % So, to get around this, we put \empty in with the type name. That
4414 % way, TeX won't find exactly `{...}' as an undelimited argument, and
4415 % won't strip off the braces.
4417 \def\deftpparsebody #1#2#3#4 {%
4418 \parsebodycommon{#1}{#2}{#3}%
4419 \spacesplit{\parsetpheaderline{#3{#4}}}\empty
4422 % Fine, but then we have to eventually remove the \empty *and* the
4423 % braces (if any). That's what this does.
4425 \def\removeemptybraces\empty#1\relax{#1}
4427 % After \spacesplit has done its work, this is called -- #1 is the final
4428 % thing to call, #2 the type name (which starts with \empty), and #3
4429 % (which might be empty) the arguments.
4431 \def\parsetpheaderline#1#2#3{%
4432 #1{\removeemptybraces#2\relax}{#3}%
4435 \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
4436 \medbreak %
4437 % Define the end token that this defining construct specifies
4438 % so that it will exit this group.
4439 \def#1{\endgraf\endgroup\medbreak}%
4440 \def#2##1 ##2 {\def#4{##1}%
4441 \begingroup\obeylines\spacesplit{#3{##2}}}%
4442 \parindent=0in
4443 \advance\leftskip by \defbodyindent
4444 \exdentamount=\defbodyindent
4445 \begingroup\obeylines\spacesplit{#3{#5}}}
4447 % Split up #2 at the first space token.
4448 % call #1 with two arguments:
4449 % the first is all of #2 before the space token,
4450 % the second is all of #2 after that space token.
4451 % If #2 contains no space token, all of it is passed as the first arg
4452 % and the second is passed as empty.
4454 {\obeylines
4455 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
4456 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
4457 \ifx\relax #3%
4458 #1{#2}{}\else #1{#2}{#3#4}\fi}}
4460 % So much for the things common to all kinds of definitions.
4462 % Define @defun.
4464 % First, define the processing that is wanted for arguments of \defun
4465 % Use this to expand the args and terminate the paragraph they make up
4467 \def\defunargs#1{\functionparens \sl
4468 % Expand, preventing hyphenation at `-' chars.
4469 % Note that groups don't affect changes in \hyphenchar.
4470 % Set the font temporarily and use \font in case \setfont made \tensl a macro.
4471 {\tensl\hyphenchar\font=0}%
4473 {\tensl\hyphenchar\font=45}%
4474 \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
4475 \interlinepenalty=10000
4476 \advance\rightskip by 0pt plus 1fil
4477 \endgraf\nobreak\vskip -\parskip\nobreak
4480 \def\deftypefunargs #1{%
4481 % Expand, preventing hyphenation at `-' chars.
4482 % Note that groups don't affect changes in \hyphenchar.
4483 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
4484 \boldbraxnoamp
4485 \tclose{#1}% avoid \code because of side effects on active chars
4486 \interlinepenalty=10000
4487 \advance\rightskip by 0pt plus 1fil
4488 \endgraf\nobreak\vskip -\parskip\nobreak
4491 % Do complete processing of one @defun or @defunx line already parsed.
4493 % @deffn Command forward-char nchars
4495 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
4497 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
4498 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
4499 \catcode 61=\other % Turn off change made in \defparsebody
4502 % @defun == @deffn Function
4504 \def\defun{\defparsebody\Edefun\defunx\defunheader}
4506 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4507 \begingroup\defname {#1}{\putwordDeffunc}%
4508 \defunargs {#2}\endgroup %
4509 \catcode 61=\other % Turn off change made in \defparsebody
4512 % @deftypefun int foobar (int @var{foo}, float @var{bar})
4514 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
4516 % #1 is the data type. #2 is the name and args.
4517 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
4518 % #1 is the data type, #2 the name, #3 the args.
4519 \def\deftypefunheaderx #1#2 #3\relax{%
4520 \doind {fn}{\code{#2}}% Make entry in function index
4521 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}%
4522 \deftypefunargs {#3}\endgroup %
4523 \catcode 61=\other % Turn off change made in \defparsebody
4526 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
4528 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
4530 % \defheaderxcond#1\relax$$$
4531 % puts #1 in @code, followed by a space, but does nothing if #1 is null.
4532 \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
4534 % #1 is the classification. #2 is the data type. #3 is the name and args.
4535 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
4536 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
4537 \def\deftypefnheaderx #1#2#3 #4\relax{%
4538 \doind {fn}{\code{#3}}% Make entry in function index
4539 \begingroup
4540 \normalparens % notably, turn off `&' magic, which prevents
4541 % at least some C++ text from working
4542 \defname {\defheaderxcond#2\relax$$$#3}{#1}%
4543 \deftypefunargs {#4}\endgroup %
4544 \catcode 61=\other % Turn off change made in \defparsebody
4547 % @defmac == @deffn Macro
4549 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
4551 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4552 \begingroup\defname {#1}{\putwordDefmac}%
4553 \defunargs {#2}\endgroup %
4554 \catcode 61=\other % Turn off change made in \defparsebody
4557 % @defspec == @deffn Special Form
4559 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
4561 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4562 \begingroup\defname {#1}{\putwordDefspec}%
4563 \defunargs {#2}\endgroup %
4564 \catcode 61=\other % Turn off change made in \defparsebody
4567 % @defop CATEGORY CLASS OPERATION ARG...
4569 \def\defop #1 {\def\defoptype{#1}%
4570 \defopparsebody\Edefop\defopx\defopheader\defoptype}
4572 \def\defopheader#1#2#3{%
4573 \dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index
4574 \begingroup\defname {#2}{\defoptype\ \putwordon\ #1}%
4575 \defunargs {#3}\endgroup %
4578 % @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
4580 \def\deftypeop #1 {\def\deftypeopcategory{#1}%
4581 \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
4582 \deftypeopcategory}
4584 % #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
4585 \def\deftypeopheader#1#2#3#4{%
4586 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
4587 \begingroup
4588 \defname{\defheaderxcond#2\relax$$$#3}
4589 {\deftypeopcategory\ \putwordon\ \code{#1}}%
4590 \deftypefunargs{#4}%
4591 \endgroup
4594 % @deftypemethod CLASS TYPE METHOD ARG...
4596 \def\deftypemethod{%
4597 \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
4599 % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
4600 \def\deftypemethodheader#1#2#3#4{%
4601 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
4602 \begingroup
4603 \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}%
4604 \deftypefunargs{#4}%
4605 \endgroup
4608 % @deftypeivar CLASS TYPE VARNAME
4610 \def\deftypeivar{%
4611 \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
4613 % #1 is the class name, #2 the data type, #3 the variable name.
4614 \def\deftypeivarheader#1#2#3{%
4615 \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
4616 \begingroup
4617 \defname{#3}{\putwordInstanceVariableof\ \code{#1}}%
4618 \defvarargs{#3}%
4619 \endgroup
4622 % @defmethod == @defop Method
4624 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
4626 % #1 is the class name, #2 the method name, #3 the args.
4627 \def\defmethodheader#1#2#3{%
4628 \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
4629 \begingroup
4630 \defname{#2}{\putwordMethodon\ \code{#1}}%
4631 \defunargs{#3}%
4632 \endgroup
4635 % @defcv {Class Option} foo-class foo-flag
4637 \def\defcv #1 {\def\defcvtype{#1}%
4638 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
4640 \def\defcvarheader #1#2#3{%
4641 \dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index
4642 \begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}%
4643 \defvarargs {#3}\endgroup %
4646 % @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
4648 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
4650 \def\defivarheader#1#2#3{%
4651 \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index
4652 \begingroup
4653 \defname{#2}{\putwordInstanceVariableof\ #1}%
4654 \defvarargs{#3}%
4655 \endgroup
4658 % @defvar
4659 % First, define the processing that is wanted for arguments of @defvar.
4660 % This is actually simple: just print them in roman.
4661 % This must expand the args and terminate the paragraph they make up
4662 \def\defvarargs #1{\normalparens #1%
4663 \interlinepenalty=10000
4664 \endgraf\nobreak\vskip -\parskip\nobreak}
4666 % @defvr Counter foo-count
4668 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
4670 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
4671 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
4673 % @defvar == @defvr Variable
4675 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
4677 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4678 \begingroup\defname {#1}{\putwordDefvar}%
4679 \defvarargs {#2}\endgroup %
4682 % @defopt == @defvr {User Option}
4684 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
4686 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4687 \begingroup\defname {#1}{\putwordDefopt}%
4688 \defvarargs {#2}\endgroup %
4691 % @deftypevar int foobar
4693 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
4695 % #1 is the data type. #2 is the name, perhaps followed by text that
4696 % is actually part of the data type, which should not be put into the index.
4697 \def\deftypevarheader #1#2{%
4698 \dovarind#2 \relax% Make entry in variables index
4699 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}%
4700 \interlinepenalty=10000
4701 \endgraf\nobreak\vskip -\parskip\nobreak
4702 \endgroup}
4703 \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
4705 % @deftypevr {Global Flag} int enable
4707 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
4709 \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
4710 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
4711 \interlinepenalty=10000
4712 \endgraf\nobreak\vskip -\parskip\nobreak
4713 \endgroup}
4715 % Now define @deftp
4716 % Args are printed in bold, a slight difference from @defvar.
4718 \def\deftpargs #1{\bf \defvarargs{#1}}
4720 % @deftp Class window height width ...
4722 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
4724 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4725 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4727 % These definitions are used if you use @defunx (etc.)
4728 % anywhere other than immediately after a @defun or @defunx.
4730 \def\defcvx#1 {\errmessage{@defcvx in invalid context}}
4731 \def\deffnx#1 {\errmessage{@deffnx in invalid context}}
4732 \def\defivarx#1 {\errmessage{@defivarx in invalid context}}
4733 \def\defmacx#1 {\errmessage{@defmacx in invalid context}}
4734 \def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
4735 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
4736 \def\defopx#1 {\errmessage{@defopx in invalid context}}
4737 \def\defspecx#1 {\errmessage{@defspecx in invalid context}}
4738 \def\deftpx#1 {\errmessage{@deftpx in invalid context}}
4739 \def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
4740 \def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
4741 \def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
4742 \def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
4743 \def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
4744 \def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
4745 \def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
4746 \def\defunx#1 {\errmessage{@defunx in invalid context}}
4747 \def\defvarx#1 {\errmessage{@defvarx in invalid context}}
4748 \def\defvrx#1 {\errmessage{@defvrx in invalid context}}
4751 \message{macros,}
4752 % @macro.
4754 % To do this right we need a feature of e-TeX, \scantokens,
4755 % which we arrange to emulate with a temporary file in ordinary TeX.
4756 \ifx\eTeXversion\undefined
4757 \newwrite\macscribble
4758 \def\scanmacro#1{%
4759 \begingroup \newlinechar`\^^M
4760 % Undo catcode changes of \startcontents and \doprintindex
4761 \catcode`\@=0 \catcode`\\=12 \escapechar=`\@
4762 % Append \endinput to make sure that TeX does not see the ending newline.
4763 \toks0={#1\endinput}%
4764 \immediate\openout\macscribble=\jobname.tmp
4765 \immediate\write\macscribble{\the\toks0}%
4766 \immediate\closeout\macscribble
4767 \let\xeatspaces\eatspaces
4768 \input \jobname.tmp
4769 \endgroup
4771 \else
4772 \def\scanmacro#1{%
4773 \begingroup \newlinechar`\^^M
4774 % Undo catcode changes of \startcontents and \doprintindex
4775 \catcode`\@=0 \catcode`\\=12 \escapechar=`\@
4776 \let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
4779 \newcount\paramno % Count of parameters
4780 \newtoks\macname % Macro name
4781 \newif\ifrecursive % Is it recursive?
4782 \def\macrolist{} % List of all defined macros in the form
4783 % \do\macro1\do\macro2...
4785 % Utility routines.
4786 % Thisdoes \let #1 = #2, except with \csnames.
4787 \def\cslet#1#2{%
4788 \expandafter\expandafter
4789 \expandafter\let
4790 \expandafter\expandafter
4791 \csname#1\endcsname
4792 \csname#2\endcsname}
4794 % Trim leading and trailing spaces off a string.
4795 % Concepts from aro-bend problem 15 (see CTAN).
4796 {\catcode`\@=11
4797 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
4798 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
4799 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
4800 \def\unbrace#1{#1}
4801 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
4804 % Trim a single trailing ^^M off a string.
4805 {\catcode`\^^M=12\catcode`\Q=3%
4806 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
4807 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
4808 \gdef\eatcrb#1Q#2Q{#1}%
4811 % Macro bodies are absorbed as an argument in a context where
4812 % all characters are catcode 10, 11 or 12, except \ which is active
4813 % (as in normal texinfo). It is necessary to change the definition of \.
4815 % It's necessary to have hard CRs when the macro is executed. This is
4816 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
4817 % body, and then making it the \newlinechar in \scanmacro.
4819 \def\macrobodyctxt{%
4820 \catcode`\~=12
4821 \catcode`\^=12
4822 \catcode`\_=12
4823 \catcode`\|=12
4824 \catcode`\<=12
4825 \catcode`\>=12
4826 \catcode`\+=12
4827 \catcode`\{=12
4828 \catcode`\}=12
4829 \catcode`\@=12
4830 \catcode`\^^M=12
4831 \usembodybackslash}
4833 \def\macroargctxt{%
4834 \catcode`\~=12
4835 \catcode`\^=12
4836 \catcode`\_=12
4837 \catcode`\|=12
4838 \catcode`\<=12
4839 \catcode`\>=12
4840 \catcode`\+=12
4841 \catcode`\@=12
4842 \catcode`\\=12}
4844 % \mbodybackslash is the definition of \ in @macro bodies.
4845 % It maps \foo\ => \csname macarg.foo\endcsname => #N
4846 % where N is the macro parameter number.
4847 % We define \csname macarg.\endcsname to be \realbackslash, so
4848 % \\ in macro replacement text gets you a backslash.
4850 {\catcode`@=0 @catcode`@\=@active
4851 @gdef@usembodybackslash{@let\=@mbodybackslash}
4852 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
4854 \expandafter\def\csname macarg.\endcsname{\realbackslash}
4856 \def\macro{\recursivefalse\parsearg\macroxxx}
4857 \def\rmacro{\recursivetrue\parsearg\macroxxx}
4859 \def\macroxxx#1{%
4860 \getargs{#1}% now \macname is the macname and \argl the arglist
4861 \ifx\argl\empty % no arguments
4862 \paramno=0%
4863 \else
4864 \expandafter\parsemargdef \argl;%
4866 \if1\csname ismacro.\the\macname\endcsname
4867 \message{Warning: redefining \the\macname}%
4868 \else
4869 \expandafter\ifx\csname \the\macname\endcsname \relax
4870 \else \errmessage{The name \the\macname\space is reserved}\fi
4871 \global\cslet{macsave.\the\macname}{\the\macname}%
4872 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
4873 % Add the macroname to \macrolist
4874 \toks0 = \expandafter{\macrolist\do}%
4875 \xdef\macrolist{\the\toks0
4876 \expandafter\noexpand\csname\the\macname\endcsname}%
4878 \begingroup \macrobodyctxt
4879 \ifrecursive \expandafter\parsermacbody
4880 \else \expandafter\parsemacbody
4881 \fi}
4883 \def\unmacro{\parsearg\unmacroxxx}
4884 \def\unmacroxxx#1{%
4885 \if1\csname ismacro.#1\endcsname
4886 \global\cslet{#1}{macsave.#1}%
4887 \global\expandafter\let \csname ismacro.#1\endcsname=0%
4888 % Remove the macro name from \macrolist
4889 \begingroup
4890 \edef\tempa{\expandafter\noexpand\csname#1\endcsname}%
4891 \def\do##1{%
4892 \def\tempb{##1}%
4893 \ifx\tempa\tempb
4894 % remove this
4895 \else
4896 \toks0 = \expandafter{\newmacrolist\do}%
4897 \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}%
4898 \fi}%
4899 \def\newmacrolist{}%
4900 % Execute macro list to define \newmacrolist
4901 \macrolist
4902 \global\let\macrolist\newmacrolist
4903 \endgroup
4904 \else
4905 \errmessage{Macro #1 not defined}%
4909 % This makes use of the obscure feature that if the last token of a
4910 % <parameter list> is #, then the preceding argument is delimited by
4911 % an opening brace, and that opening brace is not consumed.
4912 \def\getargs#1{\getargsxxx#1{}}
4913 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
4914 \def\getmacname #1 #2\relax{\macname={#1}}
4915 \def\getmacargs#1{\def\argl{#1}}
4917 % Parse the optional {params} list. Set up \paramno and \paramlist
4918 % so \defmacro knows what to do. Define \macarg.blah for each blah
4919 % in the params list, to be ##N where N is the position in that list.
4920 % That gets used by \mbodybackslash (above).
4922 % We need to get `macro parameter char #' into several definitions.
4923 % The technique used is stolen from LaTeX: let \hash be something
4924 % unexpandable, insert that wherever you need a #, and then redefine
4925 % it to # just before using the token list produced.
4927 % The same technique is used to protect \eatspaces till just before
4928 % the macro is used.
4930 \def\parsemargdef#1;{\paramno=0\def\paramlist{}%
4931 \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
4932 \def\parsemargdefxxx#1,{%
4933 \if#1;\let\next=\relax
4934 \else \let\next=\parsemargdefxxx
4935 \advance\paramno by 1%
4936 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
4937 {\xeatspaces{\hash\the\paramno}}%
4938 \edef\paramlist{\paramlist\hash\the\paramno,}%
4939 \fi\next}
4941 % These two commands read recursive and nonrecursive macro bodies.
4942 % (They're different since rec and nonrec macros end differently.)
4944 \long\def\parsemacbody#1@end macro%
4945 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
4946 \long\def\parsermacbody#1@end rmacro%
4947 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
4949 % This defines the macro itself. There are six cases: recursive and
4950 % nonrecursive macros of zero, one, and many arguments.
4951 % Much magic with \expandafter here.
4952 % \xdef is used so that macro definitions will survive the file
4953 % they're defined in; @include reads the file inside a group.
4954 \def\defmacro{%
4955 \let\hash=##% convert placeholders to macro parameter chars
4956 \ifrecursive
4957 \ifcase\paramno
4959 \expandafter\xdef\csname\the\macname\endcsname{%
4960 \noexpand\scanmacro{\temp}}%
4961 \or % 1
4962 \expandafter\xdef\csname\the\macname\endcsname{%
4963 \bgroup\noexpand\macroargctxt
4964 \noexpand\braceorline
4965 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
4966 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
4967 \egroup\noexpand\scanmacro{\temp}}%
4968 \else % many
4969 \expandafter\xdef\csname\the\macname\endcsname{%
4970 \bgroup\noexpand\macroargctxt
4971 \noexpand\csname\the\macname xx\endcsname}%
4972 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
4973 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
4974 \expandafter\expandafter
4975 \expandafter\xdef
4976 \expandafter\expandafter
4977 \csname\the\macname xxx\endcsname
4978 \paramlist{\egroup\noexpand\scanmacro{\temp}}%
4980 \else
4981 \ifcase\paramno
4983 \expandafter\xdef\csname\the\macname\endcsname{%
4984 \noexpand\norecurse{\the\macname}%
4985 \noexpand\scanmacro{\temp}\egroup}%
4986 \or % 1
4987 \expandafter\xdef\csname\the\macname\endcsname{%
4988 \bgroup\noexpand\macroargctxt
4989 \noexpand\braceorline
4990 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
4991 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
4992 \egroup
4993 \noexpand\norecurse{\the\macname}%
4994 \noexpand\scanmacro{\temp}\egroup}%
4995 \else % many
4996 \expandafter\xdef\csname\the\macname\endcsname{%
4997 \bgroup\noexpand\macroargctxt
4998 \expandafter\noexpand\csname\the\macname xx\endcsname}%
4999 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
5000 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
5001 \expandafter\expandafter
5002 \expandafter\xdef
5003 \expandafter\expandafter
5004 \csname\the\macname xxx\endcsname
5005 \paramlist{%
5006 \egroup
5007 \noexpand\norecurse{\the\macname}%
5008 \noexpand\scanmacro{\temp}\egroup}%
5010 \fi}
5012 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
5014 % \braceorline decides whether the next nonwhitespace character is a
5015 % {. If so it reads up to the closing }, if not, it reads the whole
5016 % line. Whatever was read is then fed to the next control sequence
5017 % as an argument (by \parsebrace or \parsearg)
5018 \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
5019 \def\braceorlinexxx{%
5020 \ifx\nchar\bgroup\else
5021 \expandafter\parsearg
5022 \fi \next}
5024 % We mant to disable all macros during \shipout so that they are not
5025 % expanded by \write.
5026 \def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
5027 \edef\next{\macrolist}\expandafter\endgroup\next}
5030 % @alias.
5031 \def\alias#1=#2{\gdef#1{#2}}
5034 \message{cross references,}
5035 % @xref etc.
5037 \newwrite\auxfile
5039 \newif\ifhavexrefs % True if xref values are known.
5040 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
5042 % @inforef is relatively simple.
5043 \def\inforef #1{\inforefzzz #1,,,,**}
5044 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
5045 node \samp{\ignorespaces#1{}}}
5047 % @node's job is to define \lastnode.
5048 \def\node{\ENVcheck\parsearg\nodezzz}
5049 \def\nodezzz#1{\nodexxx [#1,]}
5050 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
5051 \let\nwnode=\node
5052 \let\lastnode=\relax
5054 % The sectioning commands (@chapter, etc.) call these.
5055 \def\donoderef{%
5056 \ifx\lastnode\relax\else
5057 \expandafter\expandafter\expandafter\setref{\lastnode}%
5058 {Ysectionnumberandtype}%
5059 \global\let\lastnode=\relax
5062 \def\unnumbnoderef{%
5063 \ifx\lastnode\relax\else
5064 \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
5065 \global\let\lastnode=\relax
5068 \def\appendixnoderef{%
5069 \ifx\lastnode\relax\else
5070 \expandafter\expandafter\expandafter\setref{\lastnode}%
5071 {Yappendixletterandtype}%
5072 \global\let\lastnode=\relax
5077 % @anchor{NAME} -- define xref target at arbitrary point.
5079 { \catcode`\@ = 11
5080 % From latex.ltx, to make @anchor truely invisible.
5081 \newdimen\@savsk
5082 \newcount\@savsf
5083 \gdef\@bsphack{\relax
5084 \ifhmode \@savsk\lastskip \@savsf\spacefactor \fi
5086 \gdef\@esphack{\relax
5087 \ifhmode \spacefactor\@savsf
5088 \ifdim\@savsk>\z@ \ignorespaces \fi
5091 \gdef\anchor#1{\@bsphack \setref{#1}{Ynothing}\@esphack}
5094 % \setref{NAME}{SNT} defines a cross-reference point NAME, namely
5095 % NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have
5096 % to set \indexdummies so commands such as @code in a section title
5097 % aren't expanded. It would be nicer not to expand the titles in the
5098 % first place, but there's so many layers that that is hard to do.
5100 \def\setref#1#2{{%
5101 \indexdummies
5102 \ifpdf \pdfmkdest{#1}\fi
5103 \dosetq{#1-title}{Ytitle}%
5104 \dosetq{#1-pg}{Ypagenumber}%
5105 \dosetq{#1-snt}{#2}%
5108 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
5109 % the node name, #2 the name of the Info cross-reference, #3 the printed
5110 % node name, #4 the name of the Info file, #5 the name of the printed
5111 % manual. All but the node name can be omitted.
5113 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
5114 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
5115 \def\ref#1{\xrefX[#1,,,,,,,]}
5116 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
5117 \def\printedmanual{\ignorespaces #5}%
5118 \def\printednodename{\ignorespaces #3}%
5119 \setbox1=\hbox{\printedmanual}%
5120 \setbox0=\hbox{\printednodename}%
5121 \ifdim \wd0 = 0pt
5122 % No printed node name was explicitly given.
5123 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
5124 % Use the node name inside the square brackets.
5125 \def\printednodename{\ignorespaces #1}%
5126 \else
5127 % Use the actual chapter/section title appear inside
5128 % the square brackets. Use the real section title if we have it.
5129 \ifdim \wd1 > 0pt
5130 % It is in another manual, so we don't have it.
5131 \def\printednodename{\ignorespaces #1}%
5132 \else
5133 \ifhavexrefs
5134 % We know the real title if we have the xref values.
5135 \def\printednodename{\refx{#1-title}{}}%
5136 \else
5137 % Otherwise just copy the Info node name.
5138 \def\printednodename{\ignorespaces #1}%
5139 \fi%
5144 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
5145 % insert empty discretionaries after hyphens, which means that it will
5146 % not find a line break at a hyphen in a node names. Since some manuals
5147 % are best written with fairly long node names, containing hyphens, this
5148 % is a loss. Therefore, we give the text of the node name again, so it
5149 % is as if TeX is seeing it for the first time.
5150 \ifpdf
5151 \leavevmode
5152 \getfilename{#4}%
5153 \ifnum\filenamelength>0
5154 \pdfannotlink attr{/Border [0 0 0]}%
5155 goto file{\the\filename.pdf} name{#1@}%
5156 \else
5157 \pdfannotlink attr{/Border [0 0 0]}%
5158 goto name{#1@}%
5160 \BlueGreen
5163 \ifdim \wd1 > 0pt
5164 \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
5165 \else
5166 % _ (for example) has to be the character _ for the purposes of the
5167 % control sequence corresponding to the node, but it has to expand
5168 % into the usual \leavevmode...\vrule stuff for purposes of
5169 % printing. So we \turnoffactive for the \refx-snt, back on for the
5170 % printing, back off for the \refx-pg.
5171 {\normalturnoffactive
5172 % Only output a following space if the -snt ref is nonempty; for
5173 % @unnumbered and @anchor, it won't be.
5174 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
5175 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
5177 % [mynode],
5178 [\printednodename],\space
5179 % page 3
5180 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
5182 \ifpdf \Black\pdfendlink \fi
5183 \endgroup}
5185 % \dosetq is the interface for calls from other macros
5187 % Use \normalturnoffactive so that punctuation chars such as underscore
5188 % and backslash work in node names. (\turnoffactive doesn't do \.)
5189 \def\dosetq#1#2{%
5190 {\let\folio=0%
5191 \normalturnoffactive
5192 \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
5193 \iflinks
5194 \next
5199 % \internalsetq {foo}{page} expands into
5200 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
5201 % When the aux file is read, ' is the escape character
5203 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
5205 % Things to be expanded by \internalsetq
5207 \def\Ypagenumber{\folio}
5209 \def\Ytitle{\thissection}
5211 \def\Ynothing{}
5213 \def\Ysectionnumberandtype{%
5214 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
5215 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
5216 \else \ifnum \subsubsecno=0 %
5217 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
5218 \else %
5219 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
5220 \fi \fi \fi }
5222 \def\Yappendixletterandtype{%
5223 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
5224 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
5225 \else \ifnum \subsubsecno=0 %
5226 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
5227 \else %
5228 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
5229 \fi \fi \fi }
5231 \gdef\xreftie{'tie}
5233 % Use TeX 3.0's \inputlineno to get the line number, for better error
5234 % messages, but if we're using an old version of TeX, don't do anything.
5236 \ifx\inputlineno\thisisundefined
5237 \let\linenumber = \empty % Non-3.0.
5238 \else
5239 \def\linenumber{\the\inputlineno:\space}
5242 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
5243 % If its value is nonempty, SUFFIX is output afterward.
5245 \def\refx#1#2{%
5246 \expandafter\ifx\csname X#1\endcsname\relax
5247 % If not defined, say something at least.
5248 \angleleft un\-de\-fined\angleright
5249 \iflinks
5250 \ifhavexrefs
5251 \message{\linenumber Undefined cross reference `#1'.}%
5252 \else
5253 \ifwarnedxrefs\else
5254 \global\warnedxrefstrue
5255 \message{Cross reference values unknown; you must run TeX again.}%
5259 \else
5260 % It's defined, so just use it.
5261 \csname X#1\endcsname
5263 #2% Output the suffix in any case.
5266 % This is the macro invoked by entries in the aux file.
5268 \def\xrdef#1{\begingroup
5269 % Reenable \ as an escape while reading the second argument.
5270 \catcode`\\ = 0
5271 \afterassignment\endgroup
5272 \expandafter\gdef\csname X#1\endcsname
5275 % Read the last existing aux file, if any. No error if none exists.
5276 \def\readauxfile{\begingroup
5277 \catcode`\^^@=\other
5278 \catcode`\^^A=\other
5279 \catcode`\^^B=\other
5280 \catcode`\^^C=\other
5281 \catcode`\^^D=\other
5282 \catcode`\^^E=\other
5283 \catcode`\^^F=\other
5284 \catcode`\^^G=\other
5285 \catcode`\^^H=\other
5286 \catcode`\^^K=\other
5287 \catcode`\^^L=\other
5288 \catcode`\^^N=\other
5289 \catcode`\^^P=\other
5290 \catcode`\^^Q=\other
5291 \catcode`\^^R=\other
5292 \catcode`\^^S=\other
5293 \catcode`\^^T=\other
5294 \catcode`\^^U=\other
5295 \catcode`\^^V=\other
5296 \catcode`\^^W=\other
5297 \catcode`\^^X=\other
5298 \catcode`\^^Z=\other
5299 \catcode`\^^[=\other
5300 \catcode`\^^\=\other
5301 \catcode`\^^]=\other
5302 \catcode`\^^^=\other
5303 \catcode`\^^_=\other
5304 \catcode`\@=\other
5305 \catcode`\^=\other
5306 % It was suggested to define this as 7, which would allow ^^e4 etc.
5307 % in xref tags, i.e., node names. But since ^^e4 notation isn't
5308 % supported in the main text, it doesn't seem desirable. Furthermore,
5309 % that is not enough: for node names that actually contain a ^
5310 % character, we would end up writing a line like this: 'xrdef {'hat
5311 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
5312 % argument, and \hat is not an expandable control sequence. It could
5313 % all be worked out, but why? Either we support ^^ or we don't.
5315 % The other change necessary for this was to define \auxhat:
5316 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
5317 % and then to call \auxhat in \setq.
5319 \catcode`\~=\other
5320 \catcode`\[=\other
5321 \catcode`\]=\other
5322 \catcode`\"=\other
5323 \catcode`\_=\other
5324 \catcode`\|=\other
5325 \catcode`\<=\other
5326 \catcode`\>=\other
5327 \catcode`\$=\other
5328 \catcode`\#=\other
5329 \catcode`\&=\other
5330 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
5331 % Make the characters 128-255 be printing characters
5333 \count 1=128
5334 \def\loop{%
5335 \catcode\count 1=\other
5336 \advance\count 1 by 1
5337 \ifnum \count 1<256 \loop \fi
5340 % The aux file uses ' as the escape (for now).
5341 % Turn off \ as an escape so we do not lose on
5342 % entries which were dumped with control sequences in their names.
5343 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
5344 % Reference to such entries still does not work the way one would wish,
5345 % but at least they do not bomb out when the aux file is read in.
5346 \catcode`\{=1
5347 \catcode`\}=2
5348 \catcode`\%=\other
5349 \catcode`\'=0
5350 \catcode`\\=\other
5352 \openin 1 \jobname.aux
5353 \ifeof 1 \else
5354 \closein 1
5355 \input \jobname.aux
5356 \global\havexrefstrue
5357 \global\warnedobstrue
5359 % Open the new aux file. TeX will close it automatically at exit.
5360 \openout\auxfile=\jobname.aux
5361 \endgroup}
5364 % Footnotes.
5366 \newcount \footnoteno
5368 % The trailing space in the following definition for supereject is
5369 % vital for proper filling; pages come out unaligned when you do a
5370 % pagealignmacro call if that space before the closing brace is
5371 % removed. (Generally, numeric constants should always be followed by a
5372 % space to prevent strange expansion errors.)
5373 \def\supereject{\par\penalty -20000\footnoteno =0 }
5375 % @footnotestyle is meaningful for info output only.
5376 \let\footnotestyle=\comment
5378 \let\ptexfootnote=\footnote
5380 {\catcode `\@=11
5382 % Auto-number footnotes. Otherwise like plain.
5383 \gdef\footnote{%
5384 \global\advance\footnoteno by \@ne
5385 \edef\thisfootno{$^{\the\footnoteno}$}%
5387 % In case the footnote comes at the end of a sentence, preserve the
5388 % extra spacing after we do the footnote number.
5389 \let\@sf\empty
5390 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
5392 % Remove inadvertent blank space before typesetting the footnote number.
5393 \unskip
5394 \thisfootno\@sf
5395 \footnotezzz
5398 % Don't bother with the trickery in plain.tex to not require the
5399 % footnote text as a parameter. Our footnotes don't need to be so general.
5401 % Oh yes, they do; otherwise, @ifset and anything else that uses
5402 % \parseargline fail inside footnotes because the tokens are fixed when
5403 % the footnote is read. --karl, 16nov96.
5405 \long\gdef\footnotezzz{\insert\footins\bgroup
5406 % We want to typeset this text as a normal paragraph, even if the
5407 % footnote reference occurs in (for example) a display environment.
5408 % So reset some parameters.
5409 \interlinepenalty\interfootnotelinepenalty
5410 \splittopskip\ht\strutbox % top baseline for broken footnotes
5411 \splitmaxdepth\dp\strutbox
5412 \floatingpenalty\@MM
5413 \leftskip\z@skip
5414 \rightskip\z@skip
5415 \spaceskip\z@skip
5416 \xspaceskip\z@skip
5417 \parindent\defaultparindent
5419 % Hang the footnote text off the number.
5420 \hang
5421 \textindent{\thisfootno}%
5423 % Don't crash into the line above the footnote text. Since this
5424 % expands into a box, it must come within the paragraph, lest it
5425 % provide a place where TeX can split the footnote.
5426 \footstrut
5427 \futurelet\next\fo@t
5429 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
5430 \else\let\next\f@t\fi \next}
5431 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
5432 \def\f@t#1{#1\@foot}
5433 \def\@foot{\strut\egroup}
5435 }%end \catcode `\@=11
5437 % Set the baselineskip to #1, and the lineskip and strut size
5438 % correspondingly. There is no deep meaning behind these magic numbers
5439 % used as factors; they just match (closely enough) what Knuth defined.
5441 \def\lineskipfactor{.08333}
5442 \def\strutheightpercent{.70833}
5443 \def\strutdepthpercent {.29167}
5445 \def\setleading#1{%
5446 \normalbaselineskip = #1\relax
5447 \normallineskip = \lineskipfactor\normalbaselineskip
5448 \normalbaselines
5449 \setbox\strutbox =\hbox{%
5450 \vrule width0pt height\strutheightpercent\baselineskip
5451 depth \strutdepthpercent \baselineskip
5455 % @| inserts a changebar to the left of the current line. It should
5456 % surround any changed text. This approach does *not* work if the
5457 % change spans more than two lines of output. To handle that, we would
5458 % have adopt a much more difficult approach (putting marks into the main
5459 % vertical list for the beginning and end of each change).
5461 \def\|{%
5462 % \vadjust can only be used in horizontal mode.
5463 \leavevmode
5465 % Append this vertical mode material after the current line in the output.
5466 \vadjust{%
5467 % We want to insert a rule with the height and depth of the current
5468 % leading; that is exactly what \strutbox is supposed to record.
5469 \vskip-\baselineskip
5471 % \vadjust-items are inserted at the left edge of the type. So
5472 % the \llap here moves out into the left-hand margin.
5473 \llap{%
5475 % For a thicker or thinner bar, change the `1pt'.
5476 \vrule height\baselineskip width1pt
5478 % This is the space between the bar and the text.
5479 \hskip 12pt
5484 % For a final copy, take out the rectangles
5485 % that mark overfull boxes (in case you have decided
5486 % that the text looks ok even though it passes the margin).
5488 \def\finalout{\overfullrule=0pt}
5490 % @image. We use the macros from epsf.tex to support this.
5491 % If epsf.tex is not installed and @image is used, we complain.
5493 % Check for and read epsf.tex up front. If we read it only at @image
5494 % time, we might be inside a group, and then its definitions would get
5495 % undone and the next image would fail.
5496 \openin 1 = epsf.tex
5497 \ifeof 1 \else
5498 \closein 1
5499 % Do not bother showing banner with post-v2.7 epsf.tex (available in
5500 % doc/epsf.tex until it shows up on ctan).
5501 \def\epsfannounce{\toks0 = }%
5502 \input epsf.tex
5505 % We will only complain once about lack of epsf.tex.
5506 \newif\ifwarnednoepsf
5507 \newhelp\noepsfhelp{epsf.tex must be installed for images to
5508 work. It is also included in the Texinfo distribution, or you can get
5509 it from ftp://tug.org/tex/epsf.tex.}
5511 \def\image#1{%
5512 \ifx\epsfbox\undefined
5513 \ifwarnednoepsf \else
5514 \errhelp = \noepsfhelp
5515 \errmessage{epsf.tex not found, images will be ignored}%
5516 \global\warnednoepsftrue
5518 \else
5519 \imagexxx #1,,,\finish
5523 % Arguments to @image:
5524 % #1 is (mandatory) image filename; we tack on .eps extension.
5525 % #2 is (optional) width, #3 is (optional) height.
5526 % #4 is just the usual extra ignored arg for parsing this stuff.
5527 \def\imagexxx#1,#2,#3,#4\finish{%
5528 \ifx\pdfoutput\undefined
5529 % \epsfbox itself resets \epsf?size at each figure.
5530 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
5531 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
5532 \begingroup
5533 \catcode`\^^M = 5 % in case we're inside an example
5534 % If the image is by itself, center it.
5535 \ifvmode
5536 \nobreak\bigskip
5537 % Usually we'll have text after the image which will insert
5538 % \parskip glue, so insert it here too to equalize the space
5539 % above and below.
5540 \nobreak\vskip\parskip
5541 \nobreak
5542 \centerline{\epsfbox{#1.eps}}%
5543 \bigbreak
5544 \else
5545 % In the middle of a paragraph, no extra space.
5546 \epsfbox{#1.eps}%
5548 \endgroup
5549 \else
5550 \centerline{\pdfimage{#1.pdf}}%
5555 \message{localization,}
5556 % and i18n.
5558 % @documentlanguage is usually given very early, just after
5559 % @setfilename. If done too late, it may not override everything
5560 % properly. Single argument is the language abbreviation.
5561 % It would be nice if we could set up a hyphenation file here.
5563 \def\documentlanguage{\parsearg\dodocumentlanguage}
5564 \def\dodocumentlanguage#1{%
5565 \tex % read txi-??.tex file in plain TeX.
5566 % Read the file if it exists.
5567 \openin 1 txi-#1.tex
5568 \ifeof1
5569 \errhelp = \nolanghelp
5570 \errmessage{Cannot read language file txi-#1.tex}%
5571 \let\temp = \relax
5572 \else
5573 \def\temp{\input txi-#1.tex }%
5575 \temp
5576 \endgroup
5578 \newhelp\nolanghelp{The given language definition file cannot be found or
5579 is empty. Maybe you need to install it? In the current directory
5580 should work if nowhere else does.}
5583 % @documentencoding should change something in TeX eventually, most
5584 % likely, but for now just recognize it.
5585 \let\documentencoding = \comment
5588 % Page size parameters.
5590 \newdimen\defaultparindent \defaultparindent = 15pt
5592 \chapheadingskip = 15pt plus 4pt minus 2pt
5593 \secheadingskip = 12pt plus 3pt minus 2pt
5594 \subsecheadingskip = 9pt plus 2pt minus 2pt
5596 % Prevent underfull vbox error messages.
5597 \vbadness = 10000
5599 % Don't be so finicky about underfull hboxes, either.
5600 \hbadness = 2000
5602 % Following George Bush, just get rid of widows and orphans.
5603 \widowpenalty=10000
5604 \clubpenalty=10000
5606 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
5607 % using an old version of TeX, don't do anything. We want the amount of
5608 % stretch added to depend on the line length, hence the dependence on
5609 % \hsize. We call this whenever the paper size is set.
5611 \def\setemergencystretch{%
5612 \ifx\emergencystretch\thisisundefined
5613 % Allow us to assign to \emergencystretch anyway.
5614 \def\emergencystretch{\dimen0}%
5615 \else
5616 \emergencystretch = .15\hsize
5620 % Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
5621 % 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can
5622 % set \parskip and call \setleading for \baselineskip.
5624 \def\internalpagesizes#1#2#3#4#5#6{%
5625 \voffset = #3\relax
5626 \topskip = #6\relax
5627 \splittopskip = \topskip
5629 \vsize = #1\relax
5630 \advance\vsize by \topskip
5631 \outervsize = \vsize
5632 \advance\outervsize by 2\topandbottommargin
5633 \pageheight = \vsize
5635 \hsize = #2\relax
5636 \outerhsize = \hsize
5637 \advance\outerhsize by 0.5in
5638 \pagewidth = \hsize
5640 \normaloffset = #4\relax
5641 \bindingoffset = #5\relax
5643 \parindent = \defaultparindent
5644 \setemergencystretch
5647 % @letterpaper (the default).
5648 \def\letterpaper{{\globaldefs = 1
5649 \parskip = 3pt plus 2pt minus 1pt
5650 \setleading{13.2pt}%
5652 % If page is nothing but text, make it come out even.
5653 \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}%
5656 % Use @smallbook to reset parameters for 7x9.5 (or so) format.
5657 \def\smallbook{{\globaldefs = 1
5658 \parskip = 2pt plus 1pt
5659 \setleading{12pt}%
5661 \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}%
5663 \lispnarrowing = 0.3in
5664 \tolerance = 700
5665 \hfuzz = 1pt
5666 \contentsrightmargin = 0pt
5667 \deftypemargin = 0pt
5668 \defbodyindent = .5cm
5670 \let\smalldisplay = \smalldisplayx
5671 \let\smallexample = \smalllispx
5672 \let\smallformat = \smallformatx
5673 \let\smalllisp = \smalllispx
5676 % Use @afourpaper to print on European A4 paper.
5677 \def\afourpaper{{\globaldefs = 1
5678 \setleading{12pt}%
5679 \parskip = 3pt plus 2pt minus 1pt
5681 \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}%
5683 \tolerance = 700
5684 \hfuzz = 1pt
5687 % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
5688 % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
5689 \def\afourlatex{{\globaldefs = 1
5690 \setleading{13.6pt}%
5692 \afourpaper
5693 \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}%
5695 \globaldefs = 0
5698 % Use @afourwide to print on European A4 paper in wide format.
5699 \def\afourwide{%
5700 \afourpaper
5701 \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
5703 \globaldefs = 0
5706 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
5707 % Perhaps we should allow setting the margins, \topskip, \parskip,
5708 % and/or leading, also. Or perhaps we should compute them somehow.
5710 \def\pagesizes{\parsearg\pagesizesxxx}
5711 \def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
5712 \def\pagesizesyyy#1,#2,#3\finish{{%
5713 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
5714 \globaldefs = 1
5716 \parskip = 3pt plus 2pt minus 1pt
5717 \setleading{13.2pt}%
5719 \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}%
5722 % Set default to letter.
5724 \letterpaper
5727 \message{and turning on texinfo input format.}
5729 % Define macros to output various characters with catcode for normal text.
5730 \catcode`\"=\other
5731 \catcode`\~=\other
5732 \catcode`\^=\other
5733 \catcode`\_=\other
5734 \catcode`\|=\other
5735 \catcode`\<=\other
5736 \catcode`\>=\other
5737 \catcode`\+=\other
5738 \catcode`\$=\other
5739 \def\normaldoublequote{"}
5740 \def\normaltilde{~}
5741 \def\normalcaret{^}
5742 \def\normalunderscore{_}
5743 \def\normalverticalbar{|}
5744 \def\normalless{<}
5745 \def\normalgreater{>}
5746 \def\normalplus{+}
5747 \def\normaldollar{$}
5749 % This macro is used to make a character print one way in ttfont
5750 % where it can probably just be output, and another way in other fonts,
5751 % where something hairier probably needs to be done.
5753 % #1 is what to print if we are indeed using \tt; #2 is what to print
5754 % otherwise. Since all the Computer Modern typewriter fonts have zero
5755 % interword stretch (and shrink), and it is reasonable to expect all
5756 % typewriter fonts to have this, we can check that font parameter.
5758 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
5760 % Same as above, but check for italic font. Actually this also catches
5761 % non-italic slanted fonts since it is impossible to distinguish them from
5762 % italic fonts. But since this is only used by $ and it uses \sl anyway
5763 % this is not a problem.
5764 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
5766 % Turn off all special characters except @
5767 % (and those which the user can use as if they were ordinary).
5768 % Most of these we simply print from the \tt font, but for some, we can
5769 % use math or other variants that look better in normal text.
5771 \catcode`\"=\active
5772 \def\activedoublequote{{\tt\char34}}
5773 \let"=\activedoublequote
5774 \catcode`\~=\active
5775 \def~{{\tt\char126}}
5776 \chardef\hat=`\^
5777 \catcode`\^=\active
5778 \def^{{\tt \hat}}
5780 \catcode`\_=\active
5781 \def_{\ifusingtt\normalunderscore\_}
5782 % Subroutine for the previous macro.
5783 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
5785 \catcode`\|=\active
5786 \def|{{\tt\char124}}
5787 \chardef \less=`\<
5788 \catcode`\<=\active
5789 \def<{{\tt \less}}
5790 \chardef \gtr=`\>
5791 \catcode`\>=\active
5792 \def>{{\tt \gtr}}
5793 \catcode`\+=\active
5794 \def+{{\tt \char 43}}
5795 \catcode`\$=\active
5796 \def${\ifusingit{{\sl\$}}\normaldollar}
5797 %\catcode 27=\active
5798 %\def^^[{$\diamondsuit$}
5800 % Set up an active definition for =, but don't enable it most of the time.
5801 {\catcode`\==\active
5802 \global\def={{\tt \char 61}}}
5804 \catcode`+=\active
5805 \catcode`\_=\active
5807 % If a .fmt file is being used, characters that might appear in a file
5808 % name cannot be active until we have parsed the command line.
5809 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
5810 % \otherifyactive is called near the end of this file.
5811 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
5813 \catcode`\@=0
5815 % \rawbackslashxx output one backslash character in current font
5816 \global\chardef\rawbackslashxx=`\\
5817 %{\catcode`\\=\other
5818 %@gdef@rawbackslashxx{\}}
5820 % \rawbackslash redefines \ as input to do \rawbackslashxx.
5821 {\catcode`\\=\active
5822 @gdef@rawbackslash{@let\=@rawbackslashxx }}
5824 % \normalbackslash outputs one backslash in fixed width font.
5825 \def\normalbackslash{{\tt\rawbackslashxx}}
5827 % \catcode 17=0 % Define control-q
5828 \catcode`\\=\active
5830 % Used sometimes to turn off (effectively) the active characters
5831 % even after parsing them.
5832 @def@turnoffactive{@let"=@normaldoublequote
5833 @let\=@realbackslash
5834 @let~=@normaltilde
5835 @let^=@normalcaret
5836 @let_=@normalunderscore
5837 @let|=@normalverticalbar
5838 @let<=@normalless
5839 @let>=@normalgreater
5840 @let+=@normalplus
5841 @let$=@normaldollar}
5843 @def@normalturnoffactive{@let"=@normaldoublequote
5844 @let\=@normalbackslash
5845 @let~=@normaltilde
5846 @let^=@normalcaret
5847 @let_=@normalunderscore
5848 @let|=@normalverticalbar
5849 @let<=@normalless
5850 @let>=@normalgreater
5851 @let+=@normalplus
5852 @let$=@normaldollar}
5854 % Make _ and + \other characters, temporarily.
5855 % This is canceled by @fixbackslash.
5856 @otherifyactive
5858 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
5859 % That is what \eatinput is for; after that, the `\' should revert to printing
5860 % a backslash.
5862 @gdef@eatinput input texinfo{@fixbackslash}
5863 @global@let\ = @eatinput
5865 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
5866 % the first `\{ in the file would cause an error. This macro tries to fix
5867 % that, assuming it is called before the first `\' could plausibly occur.
5868 % Also back turn on active characters that might appear in the input
5869 % file name, in case not using a pre-dumped format.
5871 @gdef@fixbackslash{%
5872 @ifx\@eatinput @let\ = @normalbackslash @fi
5873 @catcode`+=@active
5874 @catcode`@_=@active
5877 % Say @foo, not \foo, in error messages.
5878 @escapechar = `@@
5880 % These look ok in all fonts, so just make them not special.
5881 @catcode`@& = @other
5882 @catcode`@# = @other
5883 @catcode`@% = @other
5885 @c Set initial fonts.
5886 @textfonts
5890 @c Local variables:
5891 @c eval: (add-hook 'write-file-hooks 'time-stamp)
5892 @c page-delimiter: "^\\\\message"
5893 @c time-stamp-start: "def\\\\texinfoversion{"
5894 @c time-stamp-format: "%:y-%02m-%02d.%02H"
5895 @c time-stamp-end: "}"
5896 @c End: