Update.
[glibc.git] / manual / texinfo.tex
blob29b151f085db0eaeabaabf916dda5fb9a271a202
1 % texinfo.tex -- TeX macros to handle Texinfo files.
2 % $Id: texinfo.tex,v 2.217 1998/06/30 13:22:33 drepper Exp $
4 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98
5 % Free Software Foundation, Inc.
7 % This texinfo.tex file is free software; you can redistribute it and/or
8 % modify it under the terms of the GNU General Public License as
9 % published by the Free Software Foundation; either version 2, or (at
10 % your option) any later version.
12 % This texinfo.tex file is distributed in the hope that it will be
13 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 % General Public License for more details.
17 % You should have received a copy of the GNU General Public License
18 % along with this texinfo.tex file; see the file COPYING. If not, write
19 % to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 % Boston, MA 02111-1307, USA.
22 % In other words, you are welcome to use, share and improve this program.
23 % You are forbidden to forbid anyone else to use, share and improve
24 % what you give them. Help stamp out software-hoarding!
26 % Please try the latest version of texinfo.tex before submitting bug
27 % reports; you can get the latest version from:
28 % ftp://ftp.gnu.org/pub/gnu/texinfo.tex
29 % /home/gd/gnu/doc/texinfo.tex on the GNU machines.
30 % (and all GNU mirrors, see ftp://ftp.gnu.org/pub/gnu/README.mirrors)
31 % ftp://tug.org/tex/texinfo.tex
32 % ftp://ctan.org/macros/texinfo/texinfo.tex
33 % (and all CTAN mirrors, finger ctan@tug.org for a list).
34 % The texinfo.tex in the texinfo distribution itself could well be out
35 % of date, so if that's what you're using, please check.
37 % Send bug reports to bug-texinfo@gnu.org.
38 % Please include a precise test case in each bug report,
39 % including a complete document with which we can reproduce the problem.
41 % To process a Texinfo manual with TeX, it's most reliable to use the
42 % texi2dvi shell script that comes with the distribution. For simple
43 % manuals, you can get away with:
44 % tex foo.texi
45 % texindex foo.??
46 % tex foo.texi
47 % tex foo.texi
48 % dvips foo.dvi -o # or whatever, to process the dvi file.
49 % The extra runs of TeX get the cross-reference information correct.
50 % Sometimes one run after texindex suffices, and sometimes you need more
51 % than two; texi2dvi does it as many times as necessary.
54 % Make it possible to create a .fmt file just by loading this file:
55 % if the underlying format is not loaded, start by loading it now.
56 % Added by gildea November 1993.
57 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
59 % This automatically updates the version number based on RCS.
60 \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
61 \deftexinfoversion$Revision: 2.217 $
62 \message{Loading texinfo package [Version \texinfoversion]:}
64 % If in a .fmt file, print the version number
65 % and turn on active characters that we couldn't do earlier because
66 % they might have appeared in the input file name.
67 \everyjob{\message{[Texinfo version \texinfoversion]}\message{}
68 \catcode`+=\active \catcode`\_=\active}
70 % Save some parts of plain tex whose names we will redefine.
72 \let\ptexb=\b
73 \let\ptexbullet=\bullet
74 \let\ptexc=\c
75 \let\ptexcomma=\,
76 \let\ptexdot=\.
77 \let\ptexdots=\dots
78 \let\ptexend=\end
79 \let\ptexequiv=\equiv
80 \let\ptexexclam=\!
81 \let\ptexi=\i
82 \let\ptexlbrace=\{
83 \let\ptexrbrace=\}
84 \let\ptexstar=\*
85 \let\ptext=\t
87 % We never want plain's outer \+ definition in Texinfo.
88 % For @tex, we can use \tabalign.
89 \let\+ = \relax
92 \message{Basics,}
93 \chardef\other=12
95 % If this character appears in an error message or help string, it
96 % starts a new line in the output.
97 \newlinechar = `^^J
99 % Set up fixed words for English if not already set.
100 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
101 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
102 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
103 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
104 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
105 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
106 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
107 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
108 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
109 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
110 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
111 \ifx\putwordShortContents\undefined \gdef\putwordShortContents{Short Contents}\fi
112 \ifx\putwordTableofContents\undefined\gdef\putwordTableofContents{Table of Contents}\fi
114 % Ignore a token.
116 \def\gobble#1{}
118 \hyphenation{ap-pen-dix}
119 \hyphenation{mini-buf-fer mini-buf-fers}
120 \hyphenation{eshell}
121 \hyphenation{white-space}
123 % Margin to add to right of even pages, to left of odd pages.
124 \newdimen \bindingoffset
125 \newdimen \normaloffset
126 \newdimen\pagewidth \newdimen\pageheight
128 % Sometimes it is convenient to have everything in the transcript file
129 % and nothing on the terminal. We don't just call \tracingall here,
130 % since that produces some useless output on the terminal.
132 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
133 \def\loggingall{\tracingcommands2 \tracingstats2
134 \tracingpages1 \tracingoutput1 \tracinglostchars1
135 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
136 \showboxbreadth\maxdimen\showboxdepth\maxdimen
139 % For @cropmarks command.
140 % Do @cropmarks to get crop marks.
142 \newif\ifcropmarks
143 \let\cropmarks = \cropmarkstrue
145 % Dimensions to add cropmarks at corners.
146 % Added by P. A. MacKay, 12 Nov. 1986
148 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
149 \newdimen\cornerlong \cornerlong=1pc
150 \newdimen\cornerthick \cornerthick=.3pt
151 \newdimen\topandbottommargin \topandbottommargin=.75in
153 % Main output routine.
154 \chardef\PAGE = 255
155 \output = {\onepageout{\pagecontents\PAGE}}
157 \newbox\headlinebox
158 \newbox\footlinebox
160 % \onepageout takes a vbox as an argument. Note that \pagecontents
161 % does insertions, but you have to call it yourself.
162 \def\onepageout#1{%
163 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
165 \ifodd\pageno \advance\hoffset by \bindingoffset
166 \else \advance\hoffset by -\bindingoffset\fi
168 % Do this outside of the \shipout so @code etc. will be expanded in
169 % the headline as they should be, not taken literally (outputting ''code).
170 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
171 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
174 % Have to do this stuff outside the \shipout because we want it to
175 % take effect in \write's, yet the group defined by the \vbox ends
176 % before the \shipout runs.
178 \escapechar = `\\ % use backslash in output files.
179 \indexdummies % don't expand commands in the output.
180 \normalturnoffactive % \ in index entries must not stay \, e.g., if
181 % the page break happens to be in the middle of an example.
182 \shipout\vbox{%
183 \ifcropmarks \vbox to \outervsize\bgroup
184 \hsize = \outerhsize
185 \line{\ewtop\hfil\ewtop}%
186 \nointerlineskip
187 \line{%
188 \vbox{\moveleft\cornerthick\nstop}%
189 \hfill
190 \vbox{\moveright\cornerthick\nstop}%
192 \vskip\topandbottommargin
193 \line\bgroup
194 \hfil % center the page within the outer (page) hsize.
195 \ifodd\pageno\hskip\bindingoffset\fi
196 \vbox\bgroup
199 \unvbox\headlinebox
200 \pagebody{#1}%
201 \ifdim\ht\footlinebox > 0pt
202 % Only leave this space if the footline is nonempty.
203 % (We lessened \vsize for it in \oddfootingxxx.)
204 % The \baselineskip=24pt in plain's \makefootline has no effect.
205 \vskip 2\baselineskip
206 \unvbox\footlinebox
209 \ifcropmarks
210 \egroup % end of \vbox\bgroup
211 \hfil\egroup % end of (centering) \line\bgroup
212 \vskip\topandbottommargin plus1fill minus1fill
213 \boxmaxdepth = \cornerthick
214 \line{%
215 \vbox{\moveleft\cornerthick\nsbot}%
216 \hfill
217 \vbox{\moveright\cornerthick\nsbot}%
219 \nointerlineskip
220 \line{\ewbot\hfil\ewbot}%
221 \egroup % \vbox from first cropmarks clause
223 }% end of \shipout\vbox
224 }% end of group with \turnoffactive
225 \advancepageno
226 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
229 \newinsert\margin \dimen\margin=\maxdimen
231 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
232 {\catcode`\@ =11
233 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
234 % marginal hacks, juha@viisa.uucp (Juha Takala)
235 \ifvoid\margin\else % marginal info is present
236 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
237 \dimen@=\dp#1 \unvbox#1
238 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
239 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
242 % Here are the rules for the cropmarks. Note that they are
243 % offset so that the space between them is truly \outerhsize or \outervsize
244 % (P. A. MacKay, 12 November, 1986)
246 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
247 \def\nstop{\vbox
248 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
249 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
250 \def\nsbot{\vbox
251 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
253 % Parse an argument, then pass it to #1. The argument is the rest of
254 % the input line (except we remove a trailing comment). #1 should be a
255 % macro which expects an ordinary undelimited TeX argument.
257 \def\parsearg#1{%
258 \let\next = #1%
259 \begingroup
260 \obeylines
261 \futurelet\temp\parseargx
264 % If the next token is an obeyed space (from an @example environment or
265 % the like), remove it and recurse. Otherwise, we're done.
266 \def\parseargx{%
267 % \obeyedspace is defined far below, after the definition of \sepspaces.
268 \ifx\obeyedspace\temp
269 \expandafter\parseargdiscardspace
270 \else
271 \expandafter\parseargline
275 % Remove a single space (as the delimiter token to the macro call).
276 {\obeyspaces %
277 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
279 {\obeylines %
280 \gdef\parseargline#1^^M{%
281 \endgroup % End of the group started in \parsearg.
283 % First remove any @c comment, then any @comment.
284 % Result of each macro is put in \toks0.
285 \argremovec #1\c\relax %
286 \expandafter\argremovecomment \the\toks0 \comment\relax %
288 % Call the caller's macro, saved as \next in \parsearg.
289 \expandafter\next\expandafter{\the\toks0}%
293 % Since all \c{,omment} does is throw away the argument, we can let TeX
294 % do that for us. The \relax here is matched by the \relax in the call
295 % in \parseargline; it could be more or less anything, its purpose is
296 % just to delimit the argument to the \c.
297 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
298 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
300 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
301 % @end itemize @c foo
302 % will have two active spaces as part of the argument with the
303 % `itemize'. Here we remove all active spaces from #1, and assign the
304 % result to \toks0.
306 % This loses if there are any *other* active characters besides spaces
307 % in the argument -- _ ^ +, for example -- since they get expanded.
308 % Fortunately, Texinfo does not define any such commands. (If it ever
309 % does, the catcode of the characters in questionwill have to be changed
310 % here.) But this means we cannot call \removeactivespaces as part of
311 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
312 % that \parsearg gets might well have any character at all in it.
314 \def\removeactivespaces#1{%
315 \begingroup
316 \ignoreactivespaces
317 \edef\temp{#1}%
318 \global\toks0 = \expandafter{\temp}%
319 \endgroup
322 % Change the active space to expand to nothing.
324 \begingroup
325 \obeyspaces
326 \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
327 \endgroup
330 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
332 %% These are used to keep @begin/@end levels from running away
333 %% Call \inENV within environments (after a \begingroup)
334 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
335 \def\ENVcheck{%
336 \ifENV\errmessage{Still within an environment. Type Return to continue.}
337 \endgroup\fi} % This is not perfect, but it should reduce lossage
339 % @begin foo is the same as @foo, for now.
340 \newhelp\EMsimple{Type <Return> to continue.}
342 \outer\def\begin{\parsearg\beginxxx}
344 \def\beginxxx #1{%
345 \expandafter\ifx\csname #1\endcsname\relax
346 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
347 \csname #1\endcsname\fi}
349 % @end foo executes the definition of \Efoo.
351 \def\end{\parsearg\endxxx}
352 \def\endxxx #1{%
353 \removeactivespaces{#1}%
354 \edef\endthing{\the\toks0}%
356 \expandafter\ifx\csname E\endthing\endcsname\relax
357 \expandafter\ifx\csname \endthing\endcsname\relax
358 % There's no \foo, i.e., no ``environment'' foo.
359 \errhelp = \EMsimple
360 \errmessage{Undefined command `@end \endthing'}%
361 \else
362 \unmatchedenderror\endthing
364 \else
365 % Everything's ok; the right environment has been started.
366 \csname E\endthing\endcsname
370 % There is an environment #1, but it hasn't been started. Give an error.
372 \def\unmatchedenderror#1{%
373 \errhelp = \EMsimple
374 \errmessage{This `@end #1' doesn't have a matching `@#1'}%
377 % Define the control sequence \E#1 to give an unmatched @end error.
379 \def\defineunmatchedend#1{%
380 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
384 % Single-spacing is done by various environments (specifically, in
385 % \nonfillstart and \quotations).
386 \newskip\singlespaceskip \singlespaceskip = 12.5pt
387 \def\singlespace{%
388 % Why was this kern here? It messes up equalizing space above and below
389 % environments. --karl, 6may93
390 %{\advance \baselineskip by -\singlespaceskip
391 %\kern \baselineskip}%
392 \setleading \singlespaceskip
395 %% Simple single-character @ commands
397 % @@ prints an @
398 % Kludge this until the fonts are right (grr).
399 \def\@{{\tt\char64}}
401 % This is turned off because it was never documented
402 % and you can use @w{...} around a quote to suppress ligatures.
403 %% Define @` and @' to be the same as ` and '
404 %% but suppressing ligatures.
405 %\def\`{{`}}
406 %\def\'{{'}}
408 % Used to generate quoted braces.
409 \def\mylbrace {{\tt\char123}}
410 \def\myrbrace {{\tt\char125}}
411 \let\{=\mylbrace
412 \let\}=\myrbrace
413 \begingroup
414 % Definitions to produce actual \{ & \} command in an index.
415 \catcode`\{ = 12 \catcode`\} = 12
416 \catcode`\[ = 1 \catcode`\] = 2
417 \catcode`\@ = 0 \catcode`\\ = 12
418 @gdef@lbracecmd[\{]%
419 @gdef@rbracecmd[\}]%
420 @endgroup
422 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
423 % Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
424 \let\, = \c
425 \let\dotaccent = \.
426 \def\ringaccent#1{{\accent23 #1}}
427 \let\tieaccent = \t
428 \let\ubaraccent = \b
429 \let\udotaccent = \d
431 % Other special characters: @questiondown @exclamdown
432 % Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
433 \def\questiondown{?`}
434 \def\exclamdown{!`}
436 % Dotless i and dotless j, used for accents.
437 \def\imacro{i}
438 \def\jmacro{j}
439 \def\dotless#1{%
440 \def\temp{#1}%
441 \ifx\temp\imacro \ptexi
442 \else\ifx\temp\jmacro \j
443 \else \errmessage{@dotless can be used only with i or j}%
444 \fi\fi
447 % Be sure we're in horizontal mode when doing a tie, since we make space
448 % equivalent to this in @example-like environments. Otherwise, a space
449 % at the beginning of a line will start with \penalty -- and
450 % since \penalty is valid in vertical mode, we'd end up putting the
451 % penalty on the vertical list instead of in the new paragraph.
452 {\catcode`@ = 11
453 % Avoid using \@M directly, because that causes trouble
454 % if the definition is written into an index file.
455 \global\let\tiepenalty = \@M
456 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
459 % @: forces normal size whitespace following.
460 \def\:{\spacefactor=1000 }
462 % @* forces a line break.
463 \def\*{\hfil\break\hbox{}\ignorespaces}
465 % @. is an end-of-sentence period.
466 \def\.{.\spacefactor=3000 }
468 % @! is an end-of-sentence bang.
469 \def\!{!\spacefactor=3000 }
471 % @? is an end-of-sentence query.
472 \def\?{?\spacefactor=3000 }
474 % @w prevents a word break. Without the \leavevmode, @w at the
475 % beginning of a paragraph, when TeX is still in vertical mode, would
476 % produce a whole line of output instead of starting the paragraph.
477 \def\w#1{\leavevmode\hbox{#1}}
479 % @group ... @end group forces ... to be all on one page, by enclosing
480 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
481 % to keep its height that of a normal line. According to the rules for
482 % \topskip (p.114 of the TeXbook), the glue inserted is
483 % max (\topskip - \ht (first item), 0). If that height is large,
484 % therefore, no glue is inserted, and the space between the headline and
485 % the text is small, which looks bad.
487 \def\group{\begingroup
488 \ifnum\catcode13=\active \else
489 \errhelp = \groupinvalidhelp
490 \errmessage{@group invalid in context where filling is enabled}%
493 % The \vtop we start below produces a box with normal height and large
494 % depth; thus, TeX puts \baselineskip glue before it, and (when the
495 % next line of text is done) \lineskip glue after it. (See p.82 of
496 % the TeXbook.) Thus, space below is not quite equal to space
497 % above. But it's pretty close.
498 \def\Egroup{%
499 \egroup % End the \vtop.
500 \endgroup % End the \group.
503 \vtop\bgroup
504 % We have to put a strut on the last line in case the @group is in
505 % the midst of an example, rather than completely enclosing it.
506 % Otherwise, the interline space between the last line of the group
507 % and the first line afterwards is too small. But we can't put the
508 % strut in \Egroup, since there it would be on a line by itself.
509 % Hence this just inserts a strut at the beginning of each line.
510 \everypar = {\strut}%
512 % Since we have a strut on every line, we don't need any of TeX's
513 % normal interline spacing.
514 \offinterlineskip
516 % OK, but now we have to do something about blank
517 % lines in the input in @example-like environments, which normally
518 % just turn into \lisppar, which will insert no space now that we've
519 % turned off the interline space. Simplest is to make them be an
520 % empty paragraph.
521 \ifx\par\lisppar
522 \edef\par{\leavevmode \par}%
524 % Reset ^^M's definition to new definition of \par.
525 \obeylines
528 % Do @comment since we are called inside an environment such as
529 % @example, where each end-of-line in the input causes an
530 % end-of-line in the output. We don't want the end-of-line after
531 % the `@group' to put extra space in the output. Since @group
532 % should appear on a line by itself (according to the Texinfo
533 % manual), we don't worry about eating any user text.
534 \comment
537 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
538 % message, so this ends up printing `@group can only ...'.
540 \newhelp\groupinvalidhelp{%
541 group can only be used in environments such as @example,^^J%
542 where each line of input produces a line of output.}
544 % @need space-in-mils
545 % forces a page break if there is not space-in-mils remaining.
547 \newdimen\mil \mil=0.001in
549 \def\need{\parsearg\needx}
551 % Old definition--didn't work.
552 %\def\needx #1{\par %
553 %% This method tries to make TeX break the page naturally
554 %% if the depth of the box does not fit.
555 %{\baselineskip=0pt%
556 %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
557 %\prevdepth=-1000pt
560 \def\needx#1{%
561 % Go into vertical mode, so we don't make a big box in the middle of a
562 % paragraph.
563 \par
565 % Don't add any leading before our big empty box, but allow a page
566 % break, since the best break might be right here.
567 \allowbreak
568 \nointerlineskip
569 \vtop to #1\mil{\vfil}%
571 % TeX does not even consider page breaks if a penalty added to the
572 % main vertical list is 10000 or more. But in order to see if the
573 % empty box we just added fits on the page, we must make it consider
574 % page breaks. On the other hand, we don't want to actually break the
575 % page after the empty box. So we use a penalty of 9999.
577 % There is an extremely small chance that TeX will actually break the
578 % page at this \penalty, if there are no other feasible breakpoints in
579 % sight. (If the user is using lots of big @group commands, which
580 % almost-but-not-quite fill up a page, TeX will have a hard time doing
581 % good page breaking, for example.) However, I could not construct an
582 % example where a page broke at this \penalty; if it happens in a real
583 % document, then we can reconsider our strategy.
584 \penalty9999
586 % Back up by the size of the box, whether we did a page break or not.
587 \kern -#1\mil
589 % Do not allow a page break right after this kern.
590 \nobreak
593 % @br forces paragraph break
595 \let\br = \par
597 % @dots{} output an ellipsis using the current font.
598 % We do .5em per period so that it has the same spacing in a typewriter
599 % font as three actual period characters.
601 \def\dots{%
602 \leavevmode
603 \hbox to 1.5em{%
604 \hskip 0pt plus 0.25fil minus 0.25fil
605 .\hss.\hss.%
606 \hskip 0pt plus 0.5fil minus 0.5fil
610 % @enddots{} is an end-of-sentence ellipsis.
612 \def\enddots{%
613 \leavevmode
614 \hbox to 2em{%
615 \hskip 0pt plus 0.25fil minus 0.25fil
616 .\hss.\hss.\hss.%
617 \hskip 0pt plus 0.5fil minus 0.5fil
619 \spacefactor=3000
623 % @page forces the start of a new page
625 \def\page{\par\vfill\supereject}
627 % @exdent text....
628 % outputs text on separate line in roman font, starting at standard page margin
630 % This records the amount of indent in the innermost environment.
631 % That's how much \exdent should take out.
632 \newskip\exdentamount
634 % This defn is used inside fill environments such as @defun.
635 \def\exdent{\parsearg\exdentyyy}
636 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
638 % This defn is used inside nofill environments such as @example.
639 \def\nofillexdent{\parsearg\nofillexdentyyy}
640 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
641 \leftline{\hskip\leftskip{\rm#1}}}}
643 % @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
645 \def\inmargin#1{%
646 \strut\vadjust{\nobreak\kern-\strutdepth
647 \vtop to \strutdepth{\baselineskip\strutdepth\vss
648 \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
649 \newskip\inmarginspacing \inmarginspacing=1cm
650 \def\strutdepth{\dp\strutbox}
652 %\hbox{{\rm#1}}\hfil\break}}
654 % @include file insert text of that file as input.
655 % Allow normal characters that we make active in the argument (a file name).
656 \def\include{\begingroup
657 \catcode`\\=12
658 \catcode`~=12
659 \catcode`^=12
660 \catcode`_=12
661 \catcode`|=12
662 \catcode`<=12
663 \catcode`>=12
664 \catcode`+=12
665 \parsearg\includezzz}
666 % Restore active chars for included file.
667 \def\includezzz#1{\endgroup\begingroup
668 % Read the included file in a group so nested @include's work.
669 \def\thisfile{#1}%
670 \input\thisfile
671 \endgroup}
673 \def\thisfile{}
675 % @center line outputs that line, centered
677 \def\center{\parsearg\centerzzz}
678 \def\centerzzz #1{{\advance\hsize by -\leftskip
679 \advance\hsize by -\rightskip
680 \centerline{#1}}}
682 % @sp n outputs n lines of vertical space
684 \def\sp{\parsearg\spxxx}
685 \def\spxxx #1{\vskip #1\baselineskip}
687 % @comment ...line which is ignored...
688 % @c is the same as @comment
689 % @ignore ... @end ignore is another way to write a comment
691 \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
692 \parsearg \commentxxx}
694 \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
696 \let\c=\comment
698 % @paragraphindent is defined for the Info formatting commands only.
699 \let\paragraphindent=\comment
701 % Prevent errors for section commands.
702 % Used in @ignore and in failing conditionals.
703 \def\ignoresections{%
704 \let\chapter=\relax
705 \let\unnumbered=\relax
706 \let\top=\relax
707 \let\unnumberedsec=\relax
708 \let\unnumberedsection=\relax
709 \let\unnumberedsubsec=\relax
710 \let\unnumberedsubsection=\relax
711 \let\unnumberedsubsubsec=\relax
712 \let\unnumberedsubsubsection=\relax
713 \let\section=\relax
714 \let\subsec=\relax
715 \let\subsubsec=\relax
716 \let\subsection=\relax
717 \let\subsubsection=\relax
718 \let\appendix=\relax
719 \let\appendixsec=\relax
720 \let\appendixsection=\relax
721 \let\appendixsubsec=\relax
722 \let\appendixsubsection=\relax
723 \let\appendixsubsubsec=\relax
724 \let\appendixsubsubsection=\relax
725 \let\contents=\relax
726 \let\smallbook=\relax
727 \let\titlepage=\relax
730 % Used in nested conditionals, where we have to parse the Texinfo source
731 % and so want to turn off most commands, in case they are used
732 % incorrectly.
734 \def\ignoremorecommands{%
735 \let\defcodeindex = \relax
736 \let\defcv = \relax
737 \let\deffn = \relax
738 \let\deffnx = \relax
739 \let\defindex = \relax
740 \let\defivar = \relax
741 \let\defmac = \relax
742 \let\defmethod = \relax
743 \let\defop = \relax
744 \let\defopt = \relax
745 \let\defspec = \relax
746 \let\deftp = \relax
747 \let\deftypefn = \relax
748 \let\deftypefun = \relax
749 \let\deftypevar = \relax
750 \let\deftypevr = \relax
751 \let\defun = \relax
752 \let\defvar = \relax
753 \let\defvr = \relax
754 \let\ref = \relax
755 \let\xref = \relax
756 \let\printindex = \relax
757 \let\pxref = \relax
758 \let\settitle = \relax
759 \let\setchapternewpage = \relax
760 \let\setchapterstyle = \relax
761 \let\everyheading = \relax
762 \let\evenheading = \relax
763 \let\oddheading = \relax
764 \let\everyfooting = \relax
765 \let\evenfooting = \relax
766 \let\oddfooting = \relax
767 \let\headings = \relax
768 \let\include = \relax
769 \let\lowersections = \relax
770 \let\down = \relax
771 \let\raisesections = \relax
772 \let\up = \relax
773 \let\set = \relax
774 \let\clear = \relax
775 \let\item = \relax
778 % Ignore @ignore ... @end ignore.
780 \def\ignore{\doignore{ignore}}
782 % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
784 \def\ifinfo{\doignore{ifinfo}}
785 \def\ifhtml{\doignore{ifhtml}}
786 \def\ifnottex{\doignore{ifnottex}}
787 \def\html{\doignore{html}}
788 \def\menu{\doignore{menu}}
789 \def\direntry{\doignore{direntry}}
791 % @dircategory CATEGORY -- specify a category of the dir file
792 % which this file should belong to. Ignore this in TeX.
793 \let\dircategory = \comment
795 % Ignore text until a line `@end #1'.
797 \def\doignore#1{\begingroup
798 % Don't complain about control sequences we have declared \outer.
799 \ignoresections
801 % Define a command to swallow text until we reach `@end #1'.
802 % This @ is a catcode 12 token (that is the normal catcode of @ in
803 % this texinfo.tex file). We change the catcode of @ below to match.
804 \long\def\doignoretext##1@end #1{\enddoignore}%
806 % Make sure that spaces turn into tokens that match what \doignoretext wants.
807 \catcode32 = 10
809 % Ignore braces, too, so mismatched braces don't cause trouble.
810 \catcode`\{ = 9
811 \catcode`\} = 9
813 % We must not have @c interpreted as a control sequence.
814 \catcode`\@ = 12
816 % Make the letter c a comment character so that the rest of the line
817 % will be ignored. This way, the document can have (for example)
818 % @c @end ifinfo
819 % and the @end ifinfo will be properly ignored.
820 % (We've just changed @ to catcode 12.)
821 \catcode`\c = 14
823 % And now expand that command.
824 \doignoretext
827 % What we do to finish off ignored text.
829 \def\enddoignore{\endgroup\ignorespaces}%
831 \newif\ifwarnedobs\warnedobsfalse
832 \def\obstexwarn{%
833 \ifwarnedobs\relax\else
834 % We need to warn folks that they may have trouble with TeX 3.0.
835 % This uses \immediate\write16 rather than \message to get newlines.
836 \immediate\write16{}
837 \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
838 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
839 \immediate\write16{If you are running another version of TeX, relax.}
840 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
841 \immediate\write16{ Then upgrade your TeX installation if you can.}
842 \immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
843 \immediate\write16{If you are stuck with version 3.0, run the}
844 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
845 \immediate\write16{ to use a workaround.}
846 \immediate\write16{}
847 \global\warnedobstrue
851 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
852 % workaround (which requires the file ``dummy.tfm'' to be installed),
853 % uncomment the following line:
854 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
856 % Ignore text, except that we keep track of conditional commands for
857 % purposes of nesting, up to an `@end #1' command.
859 \def\nestedignore#1{%
860 \obstexwarn
861 % We must actually expand the ignored text to look for the @end
862 % command, so that nested ignore constructs work. Thus, we put the
863 % text into a \vbox and then do nothing with the result. To minimize
864 % the change of memory overflow, we follow the approach outlined on
865 % page 401 of the TeXbook: make the current font be a dummy font.
867 \setbox0 = \vbox\bgroup
868 % Don't complain about control sequences we have declared \outer.
869 \ignoresections
871 % Define `@end #1' to end the box, which will in turn undefine the
872 % @end command again.
873 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
875 % We are going to be parsing Texinfo commands. Most cause no
876 % trouble when they are used incorrectly, but some commands do
877 % complicated argument parsing or otherwise get confused, so we
878 % undefine them.
880 % We can't do anything about stray @-signs, unfortunately;
881 % they'll produce `undefined control sequence' errors.
882 \ignoremorecommands
884 % Set the current font to be \nullfont, a TeX primitive, and define
885 % all the font commands to also use \nullfont. We don't use
886 % dummy.tfm, as suggested in the TeXbook, because not all sites
887 % might have that installed. Therefore, math mode will still
888 % produce output, but that should be an extremely small amount of
889 % stuff compared to the main input.
891 \nullfont
892 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
893 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
894 \let\tensf = \nullfont
895 % Similarly for index fonts (mostly for their use in
896 % smallexample)
897 \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
898 \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
899 \let\indsf = \nullfont
901 % Don't complain when characters are missing from the fonts.
902 \tracinglostchars = 0
904 % Don't bother to do space factor calculations.
905 \frenchspacing
907 % Don't report underfull hboxes.
908 \hbadness = 10000
910 % Do minimal line-breaking.
911 \pretolerance = 10000
913 % Do not execute instructions in @tex
914 \def\tex{\doignore{tex}}%
917 % @set VAR sets the variable VAR to an empty value.
918 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
920 % Since we want to separate VAR from REST-OF-LINE (which might be
921 % empty), we can't just use \parsearg; we have to insert a space of our
922 % own to delimit the rest of the line, and then take it out again if we
923 % didn't need it. Make sure the catcode of space is correct to avoid
924 % losing inside @example, for instance.
926 \def\set{\begingroup\catcode` =10
927 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
928 \parsearg\setxxx}
929 \def\setxxx#1{\setyyy#1 \endsetyyy}
930 \def\setyyy#1 #2\endsetyyy{%
931 \def\temp{#2}%
932 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
933 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
935 \endgroup
937 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
938 % \next or other control sequences that we've defined might get us into
939 % an infinite loop. Consider `@set foo @cite{bar}'.
940 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
942 % @clear VAR clears (i.e., unsets) the variable VAR.
944 \def\clear{\parsearg\clearxxx}
945 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
947 % @value{foo} gets the text saved in variable foo.
949 \def\value{\begingroup
950 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
951 \valuexxx}
952 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
954 % We have this subroutine so that we can handle at least some @value's
955 % properly in indexes (we \let\value to this in \indexdummies). Ones
956 % whose names contain - or _ still won't work, but we can't do anything
957 % about that. The command has to be fully expandable, since the result
958 % winds up in the index file. This means that if the variable's value
959 % contains other Texinfo commands, it's almost certain it will fail
960 % (although perhaps we could fix that with sufficient work to do a
961 % one-level expansion on the result, instead of complete).
963 \def\expandablevalue#1{%
964 \expandafter\ifx\csname SET#1\endcsname\relax
965 {[No value for ``#1'']v}%
966 \else
967 \csname SET#1\endcsname
971 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
972 % with @set.
974 \def\ifset{\parsearg\ifsetxxx}
975 \def\ifsetxxx #1{%
976 \expandafter\ifx\csname SET#1\endcsname\relax
977 \expandafter\ifsetfail
978 \else
979 \expandafter\ifsetsucceed
982 \def\ifsetsucceed{\conditionalsucceed{ifset}}
983 \def\ifsetfail{\nestedignore{ifset}}
984 \defineunmatchedend{ifset}
986 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
987 % defined with @set, or has been undefined with @clear.
989 \def\ifclear{\parsearg\ifclearxxx}
990 \def\ifclearxxx #1{%
991 \expandafter\ifx\csname SET#1\endcsname\relax
992 \expandafter\ifclearsucceed
993 \else
994 \expandafter\ifclearfail
997 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
998 \def\ifclearfail{\nestedignore{ifclear}}
999 \defineunmatchedend{ifclear}
1001 % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
1002 % following, through the first @end iftex (etc.). Make `@end iftex'
1003 % (etc.) valid only after an @iftex.
1005 \def\iftex{\conditionalsucceed{iftex}}
1006 \def\ifnothtml{\conditionalsucceed{ifnothtml}}
1007 \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
1008 \defineunmatchedend{iftex}
1009 \defineunmatchedend{ifnothtml}
1010 \defineunmatchedend{ifnotinfo}
1012 % We can't just want to start a group at @iftex (for example) and end it
1013 % at @end iftex, since then @set commands inside the conditional have no
1014 % effect (they'd get reverted at the end of the group). So we must
1015 % define \Eiftex to redefine itself to be its previous value. (We can't
1016 % just define it to fail again with an ``unmatched end'' error, since
1017 % the @ifset might be nested.)
1019 \def\conditionalsucceed#1{%
1020 \edef\temp{%
1021 % Remember the current value of \E#1.
1022 \let\nece{prevE#1} = \nece{E#1}%
1024 % At the `@end #1', redefine \E#1 to be its previous value.
1025 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
1027 \temp
1030 % We need to expand lots of \csname's, but we don't want to expand the
1031 % control sequences after we've constructed them.
1033 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
1035 % @asis just yields its argument. Used with @table, for example.
1037 \def\asis#1{#1}
1039 % @math means output in math mode.
1040 % We don't use $'s directly in the definition of \math because control
1041 % sequences like \math are expanded when the toc file is written. Then,
1042 % we read the toc file back, the $'s will be normal characters (as they
1043 % should be, according to the definition of Texinfo). So we must use a
1044 % control sequence to switch into and out of math mode.
1046 % This isn't quite enough for @math to work properly in indices, but it
1047 % seems unlikely it will ever be needed there.
1049 \let\implicitmath = $
1050 \def\math#1{\implicitmath #1\implicitmath}
1052 % @bullet and @minus need the same treatment as @math, just above.
1053 \def\bullet{\implicitmath\ptexbullet\implicitmath}
1054 \def\minus{\implicitmath-\implicitmath}
1056 % @refill is a no-op.
1057 \let\refill=\relax
1059 % If working on a large document in chapters, it is convenient to
1060 % be able to disable indexing, cross-referencing, and contents, for test runs.
1061 % This is done with @novalidate (before @setfilename).
1063 \newif\iflinks \linkstrue % by default we want the aux files.
1064 \let\novalidate = \linksfalse
1066 % @setfilename is done at the beginning of every texinfo file.
1067 % So open here the files we need to have open while reading the input.
1068 % This makes it possible to make a .fmt file for texinfo.
1069 \def\setfilename{%
1070 \iflinks
1071 \readauxfile
1072 \fi % \openindices needs to do some work in any case.
1073 \openindices
1074 \fixbackslash % Turn off hack to swallow `\input texinfo'.
1075 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
1077 % If texinfo.cnf is present on the system, read it.
1078 % Useful for site-wide @afourpaper, etc.
1079 % Just to be on the safe side, close the input stream before the \input.
1080 \openin 1 texinfo.cnf
1081 \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
1082 \closein1
1083 \temp
1085 \comment % Ignore the actual filename.
1088 % Called from \setfilename.
1090 \def\openindices{%
1091 \newindex{cp}%
1092 \newcodeindex{fn}%
1093 \newcodeindex{vr}%
1094 \newcodeindex{tp}%
1095 \newcodeindex{ky}%
1096 \newcodeindex{pg}%
1099 % @bye.
1100 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1103 \message{fonts,}
1104 % Font-change commands.
1106 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1107 % So we set up a \sf analogous to plain's \rm, etc.
1108 \newfam\sffam
1109 \def\sf{\fam=\sffam \tensf}
1110 \let\li = \sf % Sometimes we call it \li, not \sf.
1112 % We don't need math for this one.
1113 \def\ttsl{\tenttsl}
1115 % Use Computer Modern fonts at \magstephalf (11pt).
1116 \newcount\mainmagstep
1117 \mainmagstep=\magstephalf
1119 % Set the font macro #1 to the font named #2, adding on the
1120 % specified font prefix (normally `cm').
1121 % #3 is the font's design size, #4 is a scale factor
1122 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1124 % Use cm as the default font prefix.
1125 % To specify the font prefix, you must define \fontprefix
1126 % before you read in texinfo.tex.
1127 \ifx\fontprefix\undefined
1128 \def\fontprefix{cm}
1130 % Support font families that don't use the same naming scheme as CM.
1131 \def\rmshape{r}
1132 \def\rmbshape{bx} %where the normal face is bold
1133 \def\bfshape{b}
1134 \def\bxshape{bx}
1135 \def\ttshape{tt}
1136 \def\ttbshape{tt}
1137 \def\ttslshape{sltt}
1138 \def\itshape{ti}
1139 \def\itbshape{bxti}
1140 \def\slshape{sl}
1141 \def\slbshape{bxsl}
1142 \def\sfshape{ss}
1143 \def\sfbshape{ss}
1144 \def\scshape{csc}
1145 \def\scbshape{csc}
1147 \ifx\bigger\relax
1148 \let\mainmagstep=\magstep1
1149 \setfont\textrm\rmshape{12}{1000}
1150 \setfont\texttt\ttshape{12}{1000}
1151 \else
1152 \setfont\textrm\rmshape{10}{\mainmagstep}
1153 \setfont\texttt\ttshape{10}{\mainmagstep}
1155 % Instead of cmb10, you many want to use cmbx10.
1156 % cmbx10 is a prettier font on its own, but cmb10
1157 % looks better when embedded in a line with cmr10.
1158 \setfont\textbf\bfshape{10}{\mainmagstep}
1159 \setfont\textit\itshape{10}{\mainmagstep}
1160 \setfont\textsl\slshape{10}{\mainmagstep}
1161 \setfont\textsf\sfshape{10}{\mainmagstep}
1162 \setfont\textsc\scshape{10}{\mainmagstep}
1163 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1164 \font\texti=cmmi10 scaled \mainmagstep
1165 \font\textsy=cmsy10 scaled \mainmagstep
1167 % A few fonts for @defun, etc.
1168 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1169 \setfont\deftt\ttshape{10}{\magstep1}
1170 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1172 % Fonts for indices and small examples (9pt).
1173 % We actually use the slanted font rather than the italic,
1174 % because texinfo normally uses the slanted fonts for that.
1175 % Do not make many font distinctions in general in the index, since they
1176 % aren't very useful.
1177 \setfont\ninett\ttshape{9}{1000}
1178 \setfont\ninettsl\ttslshape{10}{900}
1179 \setfont\indrm\rmshape{9}{1000}
1180 \setfont\indit\slshape{9}{1000}
1181 \let\indsl=\indit
1182 \let\indtt=\ninett
1183 \let\indttsl=\ninettsl
1184 \let\indsf=\indrm
1185 \let\indbf=\indrm
1186 \setfont\indsc\scshape{10}{900}
1187 \font\indi=cmmi9
1188 \font\indsy=cmsy9
1190 % Fonts for title page:
1191 \setfont\titlerm\rmbshape{12}{\magstep3}
1192 \setfont\titleit\itbshape{10}{\magstep4}
1193 \setfont\titlesl\slbshape{10}{\magstep4}
1194 \setfont\titlett\ttbshape{12}{\magstep3}
1195 \setfont\titlettsl\ttslshape{10}{\magstep4}
1196 \setfont\titlesf\sfbshape{17}{\magstep1}
1197 \let\titlebf=\titlerm
1198 \setfont\titlesc\scbshape{10}{\magstep4}
1199 \font\titlei=cmmi12 scaled \magstep3
1200 \font\titlesy=cmsy10 scaled \magstep4
1201 \def\authorrm{\secrm}
1203 % Chapter (and unnumbered) fonts (17.28pt).
1204 \setfont\chaprm\rmbshape{12}{\magstep2}
1205 \setfont\chapit\itbshape{10}{\magstep3}
1206 \setfont\chapsl\slbshape{10}{\magstep3}
1207 \setfont\chaptt\ttbshape{12}{\magstep2}
1208 \setfont\chapttsl\ttslshape{10}{\magstep3}
1209 \setfont\chapsf\sfbshape{17}{1000}
1210 \let\chapbf=\chaprm
1211 \setfont\chapsc\scbshape{10}{\magstep3}
1212 \font\chapi=cmmi12 scaled \magstep2
1213 \font\chapsy=cmsy10 scaled \magstep3
1215 % Section fonts (14.4pt).
1216 \setfont\secrm\rmbshape{12}{\magstep1}
1217 \setfont\secit\itbshape{10}{\magstep2}
1218 \setfont\secsl\slbshape{10}{\magstep2}
1219 \setfont\sectt\ttbshape{12}{\magstep1}
1220 \setfont\secttsl\ttslshape{10}{\magstep2}
1221 \setfont\secsf\sfbshape{12}{\magstep1}
1222 \let\secbf\secrm
1223 \setfont\secsc\scbshape{10}{\magstep2}
1224 \font\seci=cmmi12 scaled \magstep1
1225 \font\secsy=cmsy10 scaled \magstep2
1227 % \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
1228 % \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
1229 % \setfont\ssecsl\slshape{10}{\magstep1}
1230 % \setfont\ssectt\ttshape{10}{\magstep1}
1231 % \setfont\ssecsf\sfshape{10}{\magstep1}
1233 %\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
1234 %\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
1235 %\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
1236 %\setfont\ssectt\ttshape{10}{1315}
1237 %\setfont\ssecsf\sfshape{10}{1315}
1239 %\let\ssecbf=\ssecrm
1241 % Subsection fonts (13.15pt).
1242 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1243 \setfont\ssecit\itbshape{10}{1315}
1244 \setfont\ssecsl\slbshape{10}{1315}
1245 \setfont\ssectt\ttbshape{12}{\magstephalf}
1246 \setfont\ssecttsl\ttslshape{10}{1315}
1247 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1248 \let\ssecbf\ssecrm
1249 \setfont\ssecsc\scbshape{10}{\magstep1}
1250 \font\sseci=cmmi12 scaled \magstephalf
1251 \font\ssecsy=cmsy10 scaled 1315
1252 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1253 % but that is not a standard magnification.
1255 % In order for the font changes to affect most math symbols and letters,
1256 % we have to define the \textfont of the standard families. Since
1257 % texinfo doesn't allow for producing subscripts and superscripts, we
1258 % don't bother to reset \scriptfont and \scriptscriptfont (which would
1259 % also require loading a lot more fonts).
1261 \def\resetmathfonts{%
1262 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1263 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1264 \textfont\ttfam = \tentt \textfont\sffam = \tensf
1268 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1269 % of just \STYLE. We do this so that font changes will continue to work
1270 % in math mode, where it is the current \fam that is relevant in most
1271 % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
1272 % \tenbf}, for example. By redefining \tenbf, we obviate the need to
1273 % redefine \bf itself.
1274 \def\textfonts{%
1275 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1276 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1277 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1278 \resetmathfonts}
1279 \def\titlefonts{%
1280 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
1281 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
1282 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
1283 \let\tenttsl=\titlettsl
1284 \resetmathfonts \setleading{25pt}}
1285 \def\titlefont#1{{\titlefonts\rm #1}}
1286 \def\chapfonts{%
1287 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1288 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1289 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1290 \resetmathfonts \setleading{19pt}}
1291 \def\secfonts{%
1292 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1293 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1294 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1295 \resetmathfonts \setleading{16pt}}
1296 \def\subsecfonts{%
1297 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1298 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1299 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1300 \resetmathfonts \setleading{15pt}}
1301 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1302 \def\indexfonts{%
1303 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
1304 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
1305 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
1306 \resetmathfonts \setleading{12pt}}
1308 % Set up the default fonts, so we can use them for creating boxes.
1310 \textfonts
1312 % Define these so they can be easily changed for other fonts.
1313 \def\angleleft{$\langle$}
1314 \def\angleright{$\rangle$}
1316 % Count depth in font-changes, for error checks
1317 \newcount\fontdepth \fontdepth=0
1319 % Fonts for short table of contents.
1320 \setfont\shortcontrm\rmshape{12}{1000}
1321 \setfont\shortcontbf\bxshape{12}{1000}
1322 \setfont\shortcontsl\slshape{12}{1000}
1324 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1325 %% serif) and @ii for TeX italic
1327 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1328 % unless the following character is such as not to need one.
1329 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1330 \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
1332 \let\i=\smartitalic
1333 \let\var=\smartitalic
1334 \let\dfn=\smartitalic
1335 \let\emph=\smartitalic
1336 \let\cite=\smartitalic
1338 \def\b#1{{\bf #1}}
1339 \let\strong=\b
1341 % We can't just use \exhyphenpenalty, because that only has effect at
1342 % the end of a paragraph. Restore normal hyphenation at the end of the
1343 % group within which \nohyphenation is presumably called.
1345 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1346 \def\restorehyphenation{\hyphenchar\font = `- }
1348 \def\t#1{%
1349 {\tt \rawbackslash \frenchspacing #1}%
1350 \null
1352 \let\ttfont=\t
1353 \def\samp#1{`\tclose{#1}'\null}
1354 \setfont\smallrm\rmshape{8}{1000}
1355 \font\smallsy=cmsy9
1356 \def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
1357 \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
1358 \vbox{\hrule\kern-0.4pt
1359 \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
1360 \kern-0.4pt\hrule}%
1361 \kern-.06em\raise0.4pt\hbox{\angleright}}}}
1362 % The old definition, with no lozenge:
1363 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1364 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1366 % @file, @option are the same as @samp.
1367 \let\file=\samp
1368 \let\option=\samp
1370 % @code is a modification of @t,
1371 % which makes spaces the same size as normal in the surrounding text.
1372 \def\tclose#1{%
1374 % Change normal interword space to be same as for the current font.
1375 \spaceskip = \fontdimen2\font
1377 % Switch to typewriter.
1380 % But `\ ' produces the large typewriter interword space.
1381 \def\ {{\spaceskip = 0pt{} }}%
1383 % Turn off hyphenation.
1384 \nohyphenation
1386 \rawbackslash
1387 \frenchspacing
1390 \null
1393 % We *must* turn on hyphenation at `-' and `_' in \code.
1394 % Otherwise, it is too hard to avoid overfull hboxes
1395 % in the Emacs manual, the Library manual, etc.
1397 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1398 % both hyphenation at - and hyphenation within words.
1399 % We must therefore turn them both off (\tclose does that)
1400 % and arrange explicitly to hyphenate at a dash.
1401 % -- rms.
1403 \catcode`\-=\active
1404 \catcode`\_=\active
1405 \catcode`\|=\active
1406 \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
1407 % The following is used by \doprintindex to insure that long function names
1408 % wrap around. It is necessary for - and _ to be active before the index is
1409 % read from the file, as \entry parses the arguments long before \code is
1410 % ever called. -- mycroft
1411 % _ is always active; and it shouldn't be \let = to an _ that is a
1412 % subscript character anyway. Then, @cindex @samp{_} (for example)
1413 % fails. --karl
1414 \global\def\indexbreaks{%
1415 \catcode`\-=\active \let-\realdash
1419 \def\realdash{-}
1420 \def\codedash{-\discretionary{}{}{}}
1421 \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
1422 \def\codex #1{\tclose{#1}\endgroup}
1424 %\let\exp=\tclose %Was temporary
1426 % @kbd is like @code, except that if the argument is just one @key command,
1427 % then @kbd has no effect.
1429 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
1430 % `example' (@kbd uses ttsl only inside of @example and friends),
1431 % or `code' (@kbd uses normal tty font always).
1432 \def\kbdinputstyle{\parsearg\kbdinputstylexxx}
1433 \def\kbdinputstylexxx#1{%
1434 \def\arg{#1}%
1435 \ifx\arg\worddistinct
1436 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
1437 \else\ifx\arg\wordexample
1438 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
1439 \else\ifx\arg\wordcode
1440 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
1441 \fi\fi\fi
1443 \def\worddistinct{distinct}
1444 \def\wordexample{example}
1445 \def\wordcode{code}
1447 % Default is kbdinputdistinct. (Too much of a hassle to call the macro,
1448 % the catcodes are wrong for parsearg to work.)
1449 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
1451 \def\xkey{\key}
1452 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1453 \ifx\one\xkey\ifx\threex\three \key{#2}%
1454 \else{\tclose{\kbdfont\look}}\fi
1455 \else{\tclose{\kbdfont\look}}\fi}
1457 % For @url, @env, @command quotes seem unnecessary, so use \code.
1458 \let\url=\code
1459 \let\env=\code
1460 \let\command=\code
1462 % @uref (abbreviation for `urlref') takes an optional second argument
1463 % specifying the text to display. First (mandatory) arg is the url.
1464 % Perhaps eventually put in a hypertex \special here.
1466 \def\uref#1{\urefxxx #1,,\finish}
1467 \def\urefxxx#1,#2,#3\finish{%
1468 \setbox0 = \hbox{\ignorespaces #2}%
1469 \ifdim\wd0 > 0pt
1470 \unhbox0\ (\code{#1})%
1471 \else
1472 \code{#1}%
1476 % rms does not like the angle brackets --karl, 17may97.
1477 % So now @email is just like @uref.
1478 %\def\email#1{\angleleft{\tt #1}\angleright}
1479 \let\email=\uref
1481 % Check if we are currently using a typewriter font. Since all the
1482 % Computer Modern typewriter fonts have zero interword stretch (and
1483 % shrink), and it is reasonable to expect all typewriter fonts to have
1484 % this property, we can check that font parameter.
1486 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1488 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1489 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
1491 \def\dmn#1{\thinspace #1}
1493 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1495 % @l was never documented to mean ``switch to the Lisp font'',
1496 % and it is not used as such in any manual I can find. We need it for
1497 % Polish suppressed-l. --karl, 22sep96.
1498 %\def\l#1{{\li #1}\null}
1500 % Explicit font changes: @r, @sc, undocumented @ii.
1501 \def\r#1{{\rm #1}} % roman font
1502 \def\sc#1{{\smallcaps#1}} % smallcaps font
1503 \def\ii#1{{\it #1}} % italic font
1505 % @acronym downcases the argument and prints in smallcaps.
1506 \def\acronym#1{{\smallcaps \lowercase{#1}}}
1508 % @pounds{} is a sterling sign.
1509 \def\pounds{{\it\$}}
1512 \message{page headings,}
1514 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1515 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1517 % First the title page. Must do @settitle before @titlepage.
1518 \newif\ifseenauthor
1519 \newif\iffinishedtitlepage
1521 % Do an implicit @contents or @shortcontents after @end titlepage if the
1522 % user says @contentsaftertitlepage or @shortcontentsaftertitlepage.
1524 \newif\ifsetcontentsaftertitlepage
1525 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
1526 \newif\ifsetshortcontentsaftertitlepage
1527 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
1529 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1530 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1531 \endgroup\page\hbox{}\page}
1533 \def\titlepage{\begingroup \parindent=0pt \textfonts
1534 \let\subtitlerm=\tenrm
1535 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1537 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1539 % Leave some space at the very top of the page.
1540 \vglue\titlepagetopglue
1542 % Now you can print the title using @title.
1543 \def\title{\parsearg\titlezzz}%
1544 \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
1545 % print a rule at the page bottom also.
1546 \finishedtitlepagefalse
1547 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1548 % No rule at page bottom unless we print one at the top with @title.
1549 \finishedtitlepagetrue
1551 % Now you can put text using @subtitle.
1552 \def\subtitle{\parsearg\subtitlezzz}%
1553 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1555 % @author should come last, but may come many times.
1556 \def\author{\parsearg\authorzzz}%
1557 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1558 {\authorfont \leftline{##1}}}%
1560 % Most title ``pages'' are actually two pages long, with space
1561 % at the top of the second. We don't want the ragged left on the second.
1562 \let\oldpage = \page
1563 \def\page{%
1564 \iffinishedtitlepage\else
1565 \finishtitlepage
1567 \oldpage
1568 \let\page = \oldpage
1569 \hbox{}}%
1570 % \def\page{\oldpage \hbox{}}
1573 \def\Etitlepage{%
1574 \iffinishedtitlepage\else
1575 \finishtitlepage
1577 % It is important to do the page break before ending the group,
1578 % because the headline and footline are only empty inside the group.
1579 % If we use the new definition of \page, we always get a blank page
1580 % after the title page, which we certainly don't want.
1581 \oldpage
1582 \endgroup
1584 % If they want short, they certainly want long too.
1585 \ifsetshortcontentsaftertitlepage
1586 \shortcontents
1587 \contents
1588 \global\let\shortcontents = \relax
1589 \global\let\contents = \relax
1592 \ifsetcontentsaftertitlepage
1593 \contents
1594 \global\let\contents = \relax
1595 \global\let\shortcontents = \relax
1598 \HEADINGSon
1601 \def\finishtitlepage{%
1602 \vskip4pt \hrule height 2pt width \hsize
1603 \vskip\titlepagebottomglue
1604 \finishedtitlepagetrue
1607 %%% Set up page headings and footings.
1609 \let\thispage=\folio
1611 \newtoks\evenheadline % headline on even pages
1612 \newtoks\oddheadline % headline on odd pages
1613 \newtoks\evenfootline % footline on even pages
1614 \newtoks\oddfootline % footline on odd pages
1616 % Now make Tex use those variables
1617 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1618 \else \the\evenheadline \fi}}
1619 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1620 \else \the\evenfootline \fi}\HEADINGShook}
1621 \let\HEADINGShook=\relax
1623 % Commands to set those variables.
1624 % For example, this is what @headings on does
1625 % @evenheading @thistitle|@thispage|@thischapter
1626 % @oddheading @thischapter|@thispage|@thistitle
1627 % @evenfooting @thisfile||
1628 % @oddfooting ||@thisfile
1630 \def\evenheading{\parsearg\evenheadingxxx}
1631 \def\oddheading{\parsearg\oddheadingxxx}
1632 \def\everyheading{\parsearg\everyheadingxxx}
1634 \def\evenfooting{\parsearg\evenfootingxxx}
1635 \def\oddfooting{\parsearg\oddfootingxxx}
1636 \def\everyfooting{\parsearg\everyfootingxxx}
1638 {\catcode`\@=0 %
1640 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1641 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1642 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1644 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1645 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1646 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1648 \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
1650 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1651 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1652 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1654 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1655 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1656 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
1658 % Leave some space for the footline. Hopefully ok to assume
1659 % @evenfooting will not be used by itself.
1660 \global\advance\pageheight by -\baselineskip
1661 \global\advance\vsize by -\baselineskip
1664 \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
1666 }% unbind the catcode of @.
1668 % @headings double turns headings on for double-sided printing.
1669 % @headings single turns headings on for single-sided printing.
1670 % @headings off turns them off.
1671 % @headings on same as @headings double, retained for compatibility.
1672 % @headings after turns on double-sided headings after this page.
1673 % @headings doubleafter turns on double-sided headings after this page.
1674 % @headings singleafter turns on single-sided headings after this page.
1675 % By default, they are off at the start of a document,
1676 % and turned `on' after @end titlepage.
1678 \def\headings #1 {\csname HEADINGS#1\endcsname}
1680 \def\HEADINGSoff{
1681 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1682 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1683 \HEADINGSoff
1684 % When we turn headings on, set the page number to 1.
1685 % For double-sided printing, put current file name in lower left corner,
1686 % chapter name on inside top of right hand pages, document
1687 % title on inside top of left hand pages, and page numbers on outside top
1688 % edge of all pages.
1689 \def\HEADINGSdouble{
1690 \global\pageno=1
1691 \global\evenfootline={\hfil}
1692 \global\oddfootline={\hfil}
1693 \global\evenheadline={\line{\folio\hfil\thistitle}}
1694 \global\oddheadline={\line{\thischapter\hfil\folio}}
1695 \global\let\contentsalignmacro = \chapoddpage
1697 \let\contentsalignmacro = \chappager
1699 % For single-sided printing, chapter title goes across top left of page,
1700 % page number on top right.
1701 \def\HEADINGSsingle{
1702 \global\pageno=1
1703 \global\evenfootline={\hfil}
1704 \global\oddfootline={\hfil}
1705 \global\evenheadline={\line{\thischapter\hfil\folio}}
1706 \global\oddheadline={\line{\thischapter\hfil\folio}}
1707 \global\let\contentsalignmacro = \chappager
1709 \def\HEADINGSon{\HEADINGSdouble}
1711 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1712 \let\HEADINGSdoubleafter=\HEADINGSafter
1713 \def\HEADINGSdoublex{%
1714 \global\evenfootline={\hfil}
1715 \global\oddfootline={\hfil}
1716 \global\evenheadline={\line{\folio\hfil\thistitle}}
1717 \global\oddheadline={\line{\thischapter\hfil\folio}}
1718 \global\let\contentsalignmacro = \chapoddpage
1721 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1722 \def\HEADINGSsinglex{%
1723 \global\evenfootline={\hfil}
1724 \global\oddfootline={\hfil}
1725 \global\evenheadline={\line{\thischapter\hfil\folio}}
1726 \global\oddheadline={\line{\thischapter\hfil\folio}}
1727 \global\let\contentsalignmacro = \chappager
1730 % Subroutines used in generating headings
1731 % Produces Day Month Year style of output.
1732 \def\today{\number\day\space
1733 \ifcase\month\or
1734 January\or February\or March\or April\or May\or June\or
1735 July\or August\or September\or October\or November\or December\fi
1736 \space\number\year}
1738 % Use this if you want the Month Day, Year style of output.
1739 %\def\today{\ifcase\month\or
1740 %January\or February\or March\or April\or May\or June\or
1741 %July\or August\or September\or October\or November\or December\fi
1742 %\space\number\day, \number\year}
1744 % @settitle line... specifies the title of the document, for headings
1745 % It generates no output of its own
1747 \def\thistitle{No Title}
1748 \def\settitle{\parsearg\settitlezzz}
1749 \def\settitlezzz #1{\gdef\thistitle{#1}}
1752 \message{tables,}
1753 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1755 % default indentation of table text
1756 \newdimen\tableindent \tableindent=.8in
1757 % default indentation of @itemize and @enumerate text
1758 \newdimen\itemindent \itemindent=.3in
1759 % margin between end of table item and start of table text.
1760 \newdimen\itemmargin \itemmargin=.1in
1762 % used internally for \itemindent minus \itemmargin
1763 \newdimen\itemmax
1765 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1766 % these defs.
1767 % They also define \itemindex
1768 % to index the item name in whatever manner is desired (perhaps none).
1770 \newif\ifitemxneedsnegativevskip
1772 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1774 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1775 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1777 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1778 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1780 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1781 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1783 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1784 \itemzzz {#1}}
1786 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1787 \itemzzz {#1}}
1789 \def\itemzzz #1{\begingroup %
1790 \advance\hsize by -\rightskip
1791 \advance\hsize by -\tableindent
1792 \setbox0=\hbox{\itemfont{#1}}%
1793 \itemindex{#1}%
1794 \nobreak % This prevents a break before @itemx.
1796 % Be sure we are not still in the middle of a paragraph.
1797 %{\parskip = 0in
1798 %\par
1801 % If the item text does not fit in the space we have, put it on a line
1802 % by itself, and do not allow a page break either before or after that
1803 % line. We do not start a paragraph here because then if the next
1804 % command is, e.g., @kindex, the whatsit would get put into the
1805 % horizontal list on a line by itself, resulting in extra blank space.
1806 \ifdim \wd0>\itemmax
1808 % Make this a paragraph so we get the \parskip glue and wrapping,
1809 % but leave it ragged-right.
1810 \begingroup
1811 \advance\leftskip by-\tableindent
1812 \advance\hsize by\tableindent
1813 \advance\rightskip by0pt plus1fil
1814 \leavevmode\unhbox0\par
1815 \endgroup
1817 % We're going to be starting a paragraph, but we don't want the
1818 % \parskip glue -- logically it's part of the @item we just started.
1819 \nobreak \vskip-\parskip
1821 % Stop a page break at the \parskip glue coming up. Unfortunately
1822 % we can't prevent a possible page break at the following
1823 % \baselineskip glue.
1824 \nobreak
1825 \endgroup
1826 \itemxneedsnegativevskipfalse
1827 \else
1828 % The item text fits into the space. Start a paragraph, so that the
1829 % following text (if any) will end up on the same line. Since that
1830 % text will be indented by \tableindent, we make the item text be in
1831 % a zero-width box.
1832 \noindent
1833 \rlap{\hskip -\tableindent\box0}\ignorespaces%
1834 \endgroup%
1835 \itemxneedsnegativevskiptrue%
1839 \def\item{\errmessage{@item while not in a table}}
1840 \def\itemx{\errmessage{@itemx while not in a table}}
1841 \def\kitem{\errmessage{@kitem while not in a table}}
1842 \def\kitemx{\errmessage{@kitemx while not in a table}}
1843 \def\xitem{\errmessage{@xitem while not in a table}}
1844 \def\xitemx{\errmessage{@xitemx while not in a table}}
1846 %% Contains a kludge to get @end[description] to work
1847 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1849 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1850 {\obeylines\obeyspaces%
1851 \gdef\tablex #1^^M{%
1852 \tabley\dontindex#1 \endtabley}}
1854 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1855 {\obeylines\obeyspaces%
1856 \gdef\ftablex #1^^M{%
1857 \tabley\fnitemindex#1 \endtabley
1858 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1859 \let\Etable=\relax}}
1861 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1862 {\obeylines\obeyspaces%
1863 \gdef\vtablex #1^^M{%
1864 \tabley\vritemindex#1 \endtabley
1865 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1866 \let\Etable=\relax}}
1868 \def\dontindex #1{}
1869 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1870 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1872 {\obeyspaces %
1873 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1874 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1876 \def\tablez #1#2#3#4#5#6{%
1877 \aboveenvbreak %
1878 \begingroup %
1879 \def\Edescription{\Etable}% Necessary kludge.
1880 \let\itemindex=#1%
1881 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1882 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1883 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1884 \def\itemfont{#2}%
1885 \itemmax=\tableindent %
1886 \advance \itemmax by -\itemmargin %
1887 \advance \leftskip by \tableindent %
1888 \exdentamount=\tableindent
1889 \parindent = 0pt
1890 \parskip = \smallskipamount
1891 \ifdim \parskip=0pt \parskip=2pt \fi%
1892 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1893 \let\item = \internalBitem %
1894 \let\itemx = \internalBitemx %
1895 \let\kitem = \internalBkitem %
1896 \let\kitemx = \internalBkitemx %
1897 \let\xitem = \internalBxitem %
1898 \let\xitemx = \internalBxitemx %
1901 % This is the counter used by @enumerate, which is really @itemize
1903 \newcount \itemno
1905 \def\itemize{\parsearg\itemizezzz}
1907 \def\itemizezzz #1{%
1908 \begingroup % ended by the @end itemize
1909 \itemizey {#1}{\Eitemize}
1912 \def\itemizey #1#2{%
1913 \aboveenvbreak %
1914 \itemmax=\itemindent %
1915 \advance \itemmax by -\itemmargin %
1916 \advance \leftskip by \itemindent %
1917 \exdentamount=\itemindent
1918 \parindent = 0pt %
1919 \parskip = \smallskipamount %
1920 \ifdim \parskip=0pt \parskip=2pt \fi%
1921 \def#2{\endgraf\afterenvbreak\endgroup}%
1922 \def\itemcontents{#1}%
1923 \let\item=\itemizeitem}
1925 % Set sfcode to normal for the chars that usually have another value.
1926 % These are `.?!:;,'
1927 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1928 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1930 % \splitoff TOKENS\endmark defines \first to be the first token in
1931 % TOKENS, and \rest to be the remainder.
1933 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1935 % Allow an optional argument of an uppercase letter, lowercase letter,
1936 % or number, to specify the first label in the enumerated list. No
1937 % argument is the same as `1'.
1939 \def\enumerate{\parsearg\enumeratezzz}
1940 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1941 \def\enumeratey #1 #2\endenumeratey{%
1942 \begingroup % ended by the @end enumerate
1944 % If we were given no argument, pretend we were given `1'.
1945 \def\thearg{#1}%
1946 \ifx\thearg\empty \def\thearg{1}\fi
1948 % Detect if the argument is a single token. If so, it might be a
1949 % letter. Otherwise, the only valid thing it can be is a number.
1950 % (We will always have one token, because of the test we just made.
1951 % This is a good thing, since \splitoff doesn't work given nothing at
1952 % all -- the first parameter is undelimited.)
1953 \expandafter\splitoff\thearg\endmark
1954 \ifx\rest\empty
1955 % Only one token in the argument. It could still be anything.
1956 % A ``lowercase letter'' is one whose \lccode is nonzero.
1957 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1958 % not equal to itself.
1959 % Otherwise, we assume it's a number.
1961 % We need the \relax at the end of the \ifnum lines to stop TeX from
1962 % continuing to look for a <number>.
1964 \ifnum\lccode\expandafter`\thearg=0\relax
1965 \numericenumerate % a number (we hope)
1966 \else
1967 % It's a letter.
1968 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1969 \lowercaseenumerate % lowercase letter
1970 \else
1971 \uppercaseenumerate % uppercase letter
1974 \else
1975 % Multiple tokens in the argument. We hope it's a number.
1976 \numericenumerate
1980 % An @enumerate whose labels are integers. The starting integer is
1981 % given in \thearg.
1983 \def\numericenumerate{%
1984 \itemno = \thearg
1985 \startenumeration{\the\itemno}%
1988 % The starting (lowercase) letter is in \thearg.
1989 \def\lowercaseenumerate{%
1990 \itemno = \expandafter`\thearg
1991 \startenumeration{%
1992 % Be sure we're not beyond the end of the alphabet.
1993 \ifnum\itemno=0
1994 \errmessage{No more lowercase letters in @enumerate; get a bigger
1995 alphabet}%
1997 \char\lccode\itemno
2001 % The starting (uppercase) letter is in \thearg.
2002 \def\uppercaseenumerate{%
2003 \itemno = \expandafter`\thearg
2004 \startenumeration{%
2005 % Be sure we're not beyond the end of the alphabet.
2006 \ifnum\itemno=0
2007 \errmessage{No more uppercase letters in @enumerate; get a bigger
2008 alphabet}
2010 \char\uccode\itemno
2014 % Call itemizey, adding a period to the first argument and supplying the
2015 % common last two arguments. Also subtract one from the initial value in
2016 % \itemno, since @item increments \itemno.
2018 \def\startenumeration#1{%
2019 \advance\itemno by -1
2020 \itemizey{#1.}\Eenumerate\flushcr
2023 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
2024 % to @enumerate.
2026 \def\alphaenumerate{\enumerate{a}}
2027 \def\capsenumerate{\enumerate{A}}
2028 \def\Ealphaenumerate{\Eenumerate}
2029 \def\Ecapsenumerate{\Eenumerate}
2031 % Definition of @item while inside @itemize.
2033 \def\itemizeitem{%
2034 \advance\itemno by 1
2035 {\let\par=\endgraf \smallbreak}%
2036 \ifhmode \errmessage{In hmode at itemizeitem}\fi
2037 {\parskip=0in \hskip 0pt
2038 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
2039 \vadjust{\penalty 1200}}%
2040 \flushcr}
2042 % @multitable macros
2043 % Amy Hendrickson, 8/18/94, 3/6/96
2045 % @multitable ... @end multitable will make as many columns as desired.
2046 % Contents of each column will wrap at width given in preamble. Width
2047 % can be specified either with sample text given in a template line,
2048 % or in percent of \hsize, the current width of text on page.
2050 % Table can continue over pages but will only break between lines.
2052 % To make preamble:
2054 % Either define widths of columns in terms of percent of \hsize:
2055 % @multitable @columnfractions .25 .3 .45
2056 % @item ...
2058 % Numbers following @columnfractions are the percent of the total
2059 % current hsize to be used for each column. You may use as many
2060 % columns as desired.
2063 % Or use a template:
2064 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2065 % @item ...
2066 % using the widest term desired in each column.
2068 % For those who want to use more than one line's worth of words in
2069 % the preamble, break the line within one argument and it
2070 % will parse correctly, i.e.,
2072 % @multitable {Column 1 template} {Column 2 template} {Column 3
2073 % template}
2074 % Not:
2075 % @multitable {Column 1 template} {Column 2 template}
2076 % {Column 3 template}
2078 % Each new table line starts with @item, each subsequent new column
2079 % starts with @tab. Empty columns may be produced by supplying @tab's
2080 % with nothing between them for as many times as empty columns are needed,
2081 % ie, @tab@tab@tab will produce two empty columns.
2083 % @item, @tab, @multitable or @end multitable do not need to be on their
2084 % own lines, but it will not hurt if they are.
2086 % Sample multitable:
2088 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2089 % @item first col stuff @tab second col stuff @tab third col
2090 % @item
2091 % first col stuff
2092 % @tab
2093 % second col stuff
2094 % @tab
2095 % third col
2096 % @item first col stuff @tab second col stuff
2097 % @tab Many paragraphs of text may be used in any column.
2099 % They will wrap at the width determined by the template.
2100 % @item@tab@tab This will be in third column.
2101 % @end multitable
2103 % Default dimensions may be reset by user.
2104 % @multitableparskip is vertical space between paragraphs in table.
2105 % @multitableparindent is paragraph indent in table.
2106 % @multitablecolmargin is horizontal space to be left between columns.
2107 % @multitablelinespace is space to leave between table items, baseline
2108 % to baseline.
2109 % 0pt means it depends on current normal line spacing.
2111 \newskip\multitableparskip
2112 \newskip\multitableparindent
2113 \newdimen\multitablecolspace
2114 \newskip\multitablelinespace
2115 \multitableparskip=0pt
2116 \multitableparindent=6pt
2117 \multitablecolspace=12pt
2118 \multitablelinespace=0pt
2120 % Macros used to set up halign preamble:
2122 \let\endsetuptable\relax
2123 \def\xendsetuptable{\endsetuptable}
2124 \let\columnfractions\relax
2125 \def\xcolumnfractions{\columnfractions}
2126 \newif\ifsetpercent
2128 % 2/1/96, to allow fractions to be given with more than one digit.
2129 \def\pickupwholefraction#1 {\global\advance\colcount by1 %
2130 \expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
2131 \setuptable}
2133 \newcount\colcount
2134 \def\setuptable#1{\def\firstarg{#1}%
2135 \ifx\firstarg\xendsetuptable\let\go\relax%
2136 \else
2137 \ifx\firstarg\xcolumnfractions\global\setpercenttrue%
2138 \else
2139 \ifsetpercent
2140 \let\go\pickupwholefraction % In this case arg of setuptable
2141 % is the decimal point before the
2142 % number given in percent of hsize.
2143 % We don't need this so we don't use it.
2144 \else
2145 \global\advance\colcount by1
2146 \setbox0=\hbox{#1 }% Add a normal word space as a separator;
2147 % typically that is always in the input, anyway.
2148 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2149 \fi%
2150 \fi%
2151 \ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
2152 \fi\go}
2154 % multitable syntax
2155 \def\tab{&\hskip1sp\relax} % 2/2/96
2156 % tiny skip here makes sure this column space is
2157 % maintained, even if it is never used.
2159 % @multitable ... @end multitable definitions:
2161 \def\multitable{\parsearg\dotable}
2162 \def\dotable#1{\bgroup
2163 \vskip\parskip
2164 \let\item\crcr
2165 \tolerance=9500
2166 \hbadness=9500
2167 \setmultitablespacing
2168 \parskip=\multitableparskip
2169 \parindent=\multitableparindent
2170 \overfullrule=0pt
2171 \global\colcount=0
2172 \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
2174 % To parse everything between @multitable and @item:
2175 \setuptable#1 \endsetuptable
2177 % \everycr will reset column counter, \colcount, at the end of
2178 % each line. Every column entry will cause \colcount to advance by one.
2179 % The table preamble
2180 % looks at the current \colcount to find the correct column width.
2181 \everycr{\noalign{%
2183 % \filbreak%% keeps underfull box messages off when table breaks over pages.
2184 % Maybe so, but it also creates really weird page breaks when the table
2185 % breaks over pages. Wouldn't \vfil be better? Wait until the problem
2186 % manifests itself, so it can be fixed for real --karl.
2187 \global\colcount=0\relax}}%
2189 % This preamble sets up a generic column definition, which will
2190 % be used as many times as user calls for columns.
2191 % \vtop will set a single line and will also let text wrap and
2192 % continue for many paragraphs if desired.
2193 \halign\bgroup&\global\advance\colcount by 1\relax
2194 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2196 % In order to keep entries from bumping into each other
2197 % we will add a \leftskip of \multitablecolspace to all columns after
2198 % the first one.
2200 % If a template has been used, we will add \multitablecolspace
2201 % to the width of each template entry.
2203 % If the user has set preamble in terms of percent of \hsize we will
2204 % use that dimension as the width of the column, and the \leftskip
2205 % will keep entries from bumping into each other. Table will start at
2206 % left margin and final column will justify at right margin.
2208 % Make sure we don't inherit \rightskip from the outer environment.
2209 \rightskip=0pt
2210 \ifnum\colcount=1
2211 % The first column will be indented with the surrounding text.
2212 \advance\hsize by\leftskip
2213 \else
2214 \ifsetpercent \else
2215 % If user has not set preamble in terms of percent of \hsize
2216 % we will advance \hsize by \multitablecolspace.
2217 \advance\hsize by \multitablecolspace
2219 % In either case we will make \leftskip=\multitablecolspace:
2220 \leftskip=\multitablecolspace
2222 % Ignoring space at the beginning and end avoids an occasional spurious
2223 % blank line, when TeX decides to break the line at the space before the
2224 % box from the multistrut, so the strut ends up on a line by itself.
2225 % For example:
2226 % @multitable @columnfractions .11 .89
2227 % @item @code{#}
2228 % @tab Legal holiday which is valid in major parts of the whole country.
2229 % Is automatically provided with highlighting sequences respectively marking
2230 % characters.
2231 \noindent\ignorespaces##\unskip\multistrut}\cr
2234 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2235 % If so, do nothing. If not, give it an appropriate dimension based on
2236 % current baselineskip.
2237 \ifdim\multitablelinespace=0pt
2238 %% strut to put in table in case some entry doesn't have descenders,
2239 %% to keep lines equally spaced
2240 \let\multistrut = \strut
2241 %% Test to see if parskip is larger than space between lines of
2242 %% table. If not, do nothing.
2243 %% If so, set to same dimension as multitablelinespace.
2244 \else
2245 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2246 width0pt\relax} \fi
2247 \ifdim\multitableparskip>\multitablelinespace
2248 \global\multitableparskip=\multitablelinespace
2249 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2250 %% than skip between lines in the table.
2251 \fi%
2252 \ifdim\multitableparskip=0pt
2253 \global\multitableparskip=\multitablelinespace
2254 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2255 %% than skip between lines in the table.
2256 \fi}
2259 \message{indexing,}
2260 % Index generation facilities
2262 % Define \newwrite to be identical to plain tex's \newwrite
2263 % except not \outer, so it can be used within \newindex.
2264 {\catcode`\@=11
2265 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2267 % \newindex {foo} defines an index named foo.
2268 % It automatically defines \fooindex such that
2269 % \fooindex ...rest of line... puts an entry in the index foo.
2270 % It also defines \fooindfile to be the number of the output channel for
2271 % the file that accumulates this index. The file's extension is foo.
2272 % The name of an index should be no more than 2 characters long
2273 % for the sake of vms.
2275 \def\newindex#1{%
2276 \iflinks
2277 \expandafter\newwrite \csname#1indfile\endcsname
2278 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2280 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
2281 \noexpand\doindex{#1}}
2284 % @defindex foo == \newindex{foo}
2286 \def\defindex{\parsearg\newindex}
2288 % Define @defcodeindex, like @defindex except put all entries in @code.
2290 \def\newcodeindex#1{%
2291 \iflinks
2292 \expandafter\newwrite \csname#1indfile\endcsname
2293 \openout \csname#1indfile\endcsname \jobname.#1
2295 \expandafter\xdef\csname#1index\endcsname{%
2296 \noexpand\docodeindex{#1}}
2299 \def\defcodeindex{\parsearg\newcodeindex}
2301 % @synindex foo bar makes index foo feed into index bar.
2302 % Do this instead of @defindex foo if you don't want it as a separate index.
2303 % The \closeout helps reduce unnecessary open files; the limit on the
2304 % Acorn RISC OS is a mere 16 files.
2305 \def\synindex#1 #2 {%
2306 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2307 \expandafter\closeout\csname#1indfile\endcsname
2308 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2309 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2310 \noexpand\doindex{#2}}%
2313 % @syncodeindex foo bar similar, but put all entries made for index foo
2314 % inside @code.
2315 \def\syncodeindex#1 #2 {%
2316 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2317 \expandafter\closeout\csname#1indfile\endcsname
2318 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2319 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2320 \noexpand\docodeindex{#2}}%
2323 % Define \doindex, the driver for all \fooindex macros.
2324 % Argument #1 is generated by the calling \fooindex macro,
2325 % and it is "foo", the name of the index.
2327 % \doindex just uses \parsearg; it calls \doind for the actual work.
2328 % This is because \doind is more useful to call from other macros.
2330 % There is also \dosubind {index}{topic}{subtopic}
2331 % which makes an entry in a two-level index such as the operation index.
2333 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
2334 \def\singleindexer #1{\doind{\indexname}{#1}}
2336 % like the previous two, but they put @code around the argument.
2337 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2338 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2340 \def\indexdummies{%
2341 \def\ { }%
2342 % Take care of the plain tex accent commands.
2343 \def\"{\realbackslash "}%
2344 \def\`{\realbackslash `}%
2345 \def\'{\realbackslash '}%
2346 \def\^{\realbackslash ^}%
2347 \def\~{\realbackslash ~}%
2348 \def\={\realbackslash =}%
2349 \def\b{\realbackslash b}%
2350 \def\c{\realbackslash c}%
2351 \def\d{\realbackslash d}%
2352 \def\u{\realbackslash u}%
2353 \def\v{\realbackslash v}%
2354 \def\H{\realbackslash H}%
2355 % Take care of the plain tex special European modified letters.
2356 \def\oe{\realbackslash oe}%
2357 \def\ae{\realbackslash ae}%
2358 \def\aa{\realbackslash aa}%
2359 \def\OE{\realbackslash OE}%
2360 \def\AE{\realbackslash AE}%
2361 \def\AA{\realbackslash AA}%
2362 \def\o{\realbackslash o}%
2363 \def\O{\realbackslash O}%
2364 \def\l{\realbackslash l}%
2365 \def\L{\realbackslash L}%
2366 \def\ss{\realbackslash ss}%
2367 % Take care of texinfo commands likely to appear in an index entry.
2368 % (Must be a way to avoid doing expansion at all, and thus not have to
2369 % laboriously list every single command here.)
2370 \def\@{@}% will be @@ when we switch to @ as escape char.
2371 %\let\{ = \lbracecmd
2372 %\let\} = \rbracecmd
2373 \def\_{{\realbackslash _}}%
2374 \def\w{\realbackslash w }%
2375 \def\bf{\realbackslash bf }%
2376 %\def\rm{\realbackslash rm }%
2377 \def\sl{\realbackslash sl }%
2378 \def\sf{\realbackslash sf}%
2379 \def\tt{\realbackslash tt}%
2380 \def\gtr{\realbackslash gtr}%
2381 \def\less{\realbackslash less}%
2382 \def\hat{\realbackslash hat}%
2383 \def\TeX{\realbackslash TeX}%
2384 \def\dots{\realbackslash dots }%
2385 \def\result{\realbackslash result}%
2386 \def\equiv{\realbackslash equiv}%
2387 \def\expansion{\realbackslash expansion}%
2388 \def\print{\realbackslash print}%
2389 \def\error{\realbackslash error}%
2390 \def\point{\realbackslash point}%
2391 \def\copyright{\realbackslash copyright}%
2392 \def\tclose##1{\realbackslash tclose {##1}}%
2393 \def\code##1{\realbackslash code {##1}}%
2394 \def\dotless##1{\realbackslash dotless {##1}}%
2395 \def\samp##1{\realbackslash samp {##1}}%
2396 \def\,##1{\realbackslash ,{##1}}%
2397 \def\t##1{\realbackslash t {##1}}%
2398 \def\r##1{\realbackslash r {##1}}%
2399 \def\i##1{\realbackslash i {##1}}%
2400 \def\b##1{\realbackslash b {##1}}%
2401 \def\sc##1{\realbackslash sc {##1}}%
2402 \def\cite##1{\realbackslash cite {##1}}%
2403 \def\key##1{\realbackslash key {##1}}%
2404 \def\file##1{\realbackslash file {##1}}%
2405 \def\var##1{\realbackslash var {##1}}%
2406 \def\kbd##1{\realbackslash kbd {##1}}%
2407 \def\dfn##1{\realbackslash dfn {##1}}%
2408 \def\emph##1{\realbackslash emph {##1}}%
2410 % Handle some cases of @value -- where the variable name does not
2411 % contain - or _, and the value does not contain any
2412 % (non-fully-expandable) commands.
2413 \let\value = \expandablevalue
2415 \unsepspaces
2418 % If an index command is used in an @example environment, any spaces
2419 % therein should become regular spaces in the raw index file, not the
2420 % expansion of \tie (\\leavevmode \penalty \@M \ ).
2421 {\obeyspaces
2422 \gdef\unsepspaces{\obeyspaces\let =\space}}
2424 % \indexnofonts no-ops all font-change commands.
2425 % This is used when outputting the strings to sort the index by.
2426 \def\indexdummyfont#1{#1}
2427 \def\indexdummytex{TeX}
2428 \def\indexdummydots{...}
2430 \def\indexnofonts{%
2431 % Just ignore accents.
2432 \let\,=\indexdummyfont
2433 \let\"=\indexdummyfont
2434 \let\`=\indexdummyfont
2435 \let\'=\indexdummyfont
2436 \let\^=\indexdummyfont
2437 \let\~=\indexdummyfont
2438 \let\==\indexdummyfont
2439 \let\b=\indexdummyfont
2440 \let\c=\indexdummyfont
2441 \let\d=\indexdummyfont
2442 \let\u=\indexdummyfont
2443 \let\v=\indexdummyfont
2444 \let\H=\indexdummyfont
2445 \let\dotless=\indexdummyfont
2446 % Take care of the plain tex special European modified letters.
2447 \def\oe{oe}%
2448 \def\ae{ae}%
2449 \def\aa{aa}%
2450 \def\OE{OE}%
2451 \def\AE{AE}%
2452 \def\AA{AA}%
2453 \def\o{o}%
2454 \def\O{O}%
2455 \def\l{l}%
2456 \def\L{L}%
2457 \def\ss{ss}%
2458 \let\w=\indexdummyfont
2459 \let\t=\indexdummyfont
2460 \let\r=\indexdummyfont
2461 \let\i=\indexdummyfont
2462 \let\b=\indexdummyfont
2463 \let\emph=\indexdummyfont
2464 \let\strong=\indexdummyfont
2465 \let\cite=\indexdummyfont
2466 \let\sc=\indexdummyfont
2467 %Don't no-op \tt, since it isn't a user-level command
2468 % and is used in the definitions of the active chars like <, >, |...
2469 %\let\tt=\indexdummyfont
2470 \let\tclose=\indexdummyfont
2471 \let\code=\indexdummyfont
2472 \let\file=\indexdummyfont
2473 \let\samp=\indexdummyfont
2474 \let\kbd=\indexdummyfont
2475 \let\key=\indexdummyfont
2476 \let\var=\indexdummyfont
2477 \let\TeX=\indexdummytex
2478 \let\dots=\indexdummydots
2479 \def\@{@}%
2482 % To define \realbackslash, we must make \ not be an escape.
2483 % We must first make another character (@) an escape
2484 % so we do not become unable to do a definition.
2486 {\catcode`\@=0 \catcode`\\=\other
2487 @gdef@realbackslash{\}}
2489 \let\indexbackslash=0 %overridden during \printindex.
2490 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
2492 % For \ifx comparisons.
2493 \def\emptymacro{\empty}
2495 % Most index entries go through here, but \dosubind is the general case.
2497 \def\doind#1#2{\dosubind{#1}{#2}\empty}
2499 % Workhorse for all \fooindexes.
2500 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
2501 % \empty if called from \doind, as we usually are. The main exception
2502 % is with defuns, which call us directly.
2504 \def\dosubind#1#2#3{%
2505 % Put the index entry in the margin if desired.
2506 \ifx\SETmarginindex\relax\else
2507 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2510 \count255=\lastpenalty
2512 \indexdummies % Must do this here, since \bf, etc expand at this stage
2513 \escapechar=`\\
2515 \let\folio = 0% We will expand all macros now EXCEPT \folio.
2516 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2517 % so it will be output as is; and it will print as backslash.
2519 \def\thirdarg{#3}%
2521 % If third arg is present, precede it with space in sort key.
2522 \ifx\thirdarg\emptymacro
2523 \let\subentry = \empty
2524 \else
2525 \def\subentry{ #3}%
2528 % First process the index-string with all font commands turned off
2529 % to get the string to sort by.
2530 {\indexnofonts \xdef\indexsorttmp{#2\subentry}}%
2532 % Now produce the complete index entry, with both the sort key and the
2533 % original text, including any font commands.
2534 \toks0 = {#2}%
2535 \edef\temp{%
2536 \write\csname#1indfile\endcsname{%
2537 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
2540 % If third (subentry) arg is present, add it to the index string.
2541 \ifx\thirdarg\emptymacro \else
2542 \toks0 = {#3}%
2543 \edef\temp{\temp{\the\toks0}}%
2546 % If a skip is the last thing on the list now, preserve it
2547 % by backing up by \lastskip, doing the \write, then inserting
2548 % the skip again. Otherwise, the whatsit generated by the
2549 % \write will make \lastskip zero. The result is that sequences
2550 % like this:
2551 % @end defun
2552 % @tindex whatever
2553 % @defun ...
2554 % will have extra space inserted, because the \medbreak in the
2555 % start of the @defun won't see the skip inserted by the @end of
2556 % the previous defun.
2557 \iflinks
2558 \skip0 = \lastskip \ifdim\lastskip = 0pt \else \vskip-\lastskip \fi
2559 \temp
2560 \ifdim\skip0 = 0pt \else \vskip\skip0 \fi
2564 \penalty\count255
2568 % The index entry written in the file actually looks like
2569 % \entry {sortstring}{page}{topic}
2570 % or
2571 % \entry {sortstring}{page}{topic}{subtopic}
2572 % The texindex program reads in these files and writes files
2573 % containing these kinds of lines:
2574 % \initial {c}
2575 % before the first topic whose initial is c
2576 % \entry {topic}{pagelist}
2577 % for a topic that is used without subtopics
2578 % \primary {topic}
2579 % for the beginning of a topic that is used with subtopics
2580 % \secondary {subtopic}{pagelist}
2581 % for each subtopic.
2583 % Define the user-accessible indexing commands
2584 % @findex, @vindex, @kindex, @cindex.
2586 \def\findex {\fnindex}
2587 \def\kindex {\kyindex}
2588 \def\cindex {\cpindex}
2589 \def\vindex {\vrindex}
2590 \def\tindex {\tpindex}
2591 \def\pindex {\pgindex}
2593 \def\cindexsub {\begingroup\obeylines\cindexsub}
2594 {\obeylines %
2595 \gdef\cindexsub "#1" #2^^M{\endgroup %
2596 \dosubind{cp}{#2}{#1}}}
2598 % Define the macros used in formatting output of the sorted index material.
2600 % @printindex causes a particular index (the ??s file) to get printed.
2601 % It does not print any chapter heading (usually an @unnumbered).
2603 \def\printindex{\parsearg\doprintindex}
2604 \def\doprintindex#1{\begingroup
2605 \dobreak \chapheadingskip{10000}%
2607 \indexfonts \rm
2608 \tolerance = 9500
2609 \indexbreaks
2611 % See if the index file exists and is nonempty.
2612 % Change catcode of @ here so that if the index file contains
2613 % \initial {@}
2614 % as its first line, TeX doesn't complain about mismatched braces
2615 % (because it thinks @} is a control sequence).
2616 \catcode`\@ = 11
2617 \openin 1 \jobname.#1s
2618 \ifeof 1
2619 % \enddoublecolumns gets confused if there is no text in the index,
2620 % and it loses the chapter title and the aux file entries for the
2621 % index. The easiest way to prevent this problem is to make sure
2622 % there is some text.
2623 (Index is nonexistent)
2624 \else
2626 % If the index file exists but is empty, then \openin leaves \ifeof
2627 % false. We have to make TeX try to read something from the file, so
2628 % it can discover if there is anything in it.
2629 \read 1 to \temp
2630 \ifeof 1
2631 (Index is empty)
2632 \else
2633 % Index files are almost Texinfo source, but we use \ as the escape
2634 % character. It would be better to use @, but that's too big a change
2635 % to make right now.
2636 \def\indexbackslash{\rawbackslashxx}%
2637 \catcode`\\ = 0
2638 \escapechar = `\\
2639 \begindoublecolumns
2640 \input \jobname.#1s
2641 \enddoublecolumns
2644 \closein 1
2645 \endgroup}
2647 % These macros are used by the sorted index file itself.
2648 % Change them to control the appearance of the index.
2650 \def\initial#1{{%
2651 % Some minor font changes for the special characters.
2652 \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2654 % Remove any glue we may have, we'll be inserting our own.
2655 \removelastskip
2657 % We like breaks before the index initials, so insert a bonus.
2658 \penalty -300
2660 % Typeset the initial. Making this add up to a whole number of
2661 % baselineskips increases the chance of the dots lining up from column
2662 % to column. It still won't often be perfect, because of the stretch
2663 % we need before each entry, but it's better.
2665 % No shrink because it confuses \balancecolumns.
2666 \vskip 1.67\baselineskip plus .5\baselineskip
2667 \leftline{\secbf #1}%
2668 \vskip .33\baselineskip plus .1\baselineskip
2670 % Do our best not to break after the initial.
2671 \nobreak
2674 % This typesets a paragraph consisting of #1, dot leaders, and then #2
2675 % flush to the right margin. It is used for index and table of contents
2676 % entries. The paragraph is indented by \leftskip.
2678 \def\entry#1#2{\begingroup
2680 % Start a new paragraph if necessary, so our assignments below can't
2681 % affect previous text.
2682 \par
2684 % Do not fill out the last line with white space.
2685 \parfillskip = 0in
2687 % No extra space above this paragraph.
2688 \parskip = 0in
2690 % Do not prefer a separate line ending with a hyphen to fewer lines.
2691 \finalhyphendemerits = 0
2693 % \hangindent is only relevant when the entry text and page number
2694 % don't both fit on one line. In that case, bob suggests starting the
2695 % dots pretty far over on the line. Unfortunately, a large
2696 % indentation looks wrong when the entry text itself is broken across
2697 % lines. So we use a small indentation and put up with long leaders.
2699 % \hangafter is reset to 1 (which is the value we want) at the start
2700 % of each paragraph, so we need not do anything with that.
2701 \hangindent = 2em
2703 % When the entry text needs to be broken, just fill out the first line
2704 % with blank space.
2705 \rightskip = 0pt plus1fil
2707 % A bit of stretch before each entry for the benefit of balancing columns.
2708 \vskip 0pt plus1pt
2710 % Start a ``paragraph'' for the index entry so the line breaking
2711 % parameters we've set above will have an effect.
2712 \noindent
2714 % Insert the text of the index entry. TeX will do line-breaking on it.
2716 % The following is kludged to not output a line of dots in the index if
2717 % there are no page numbers. The next person who breaks this will be
2718 % cursed by a Unix daemon.
2719 \def\tempa{{\rm }}%
2720 \def\tempb{#2}%
2721 \edef\tempc{\tempa}%
2722 \edef\tempd{\tempb}%
2723 \ifx\tempc\tempd\ \else%
2725 % If we must, put the page number on a line of its own, and fill out
2726 % this line with blank space. (The \hfil is overwhelmed with the
2727 % fill leaders glue in \indexdotfill if the page number does fit.)
2728 \hfil\penalty50
2729 \null\nobreak\indexdotfill % Have leaders before the page number.
2731 % The `\ ' here is removed by the implicit \unskip that TeX does as
2732 % part of (the primitive) \par. Without it, a spurious underfull
2733 % \hbox ensues.
2734 \ #2% The page number ends the paragraph.
2735 \fi%
2736 \par
2737 \endgroup}
2739 % Like \dotfill except takes at least 1 em.
2740 \def\indexdotfill{\cleaders
2741 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
2743 \def\primary #1{\line{#1\hfil}}
2745 \newskip\secondaryindent \secondaryindent=0.5cm
2747 \def\secondary #1#2{
2748 {\parfillskip=0in \parskip=0in
2749 \hangindent =1in \hangafter=1
2750 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
2753 % Define two-column mode, which we use to typeset indexes.
2754 % Adapted from the TeXbook, page 416, which is to say,
2755 % the manmac.tex format used to print the TeXbook itself.
2756 \catcode`\@=11
2758 \newbox\partialpage
2759 \newdimen\doublecolumnhsize
2761 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
2762 % Grab any single-column material above us.
2763 \output = {\global\setbox\partialpage = \vbox{%
2765 % Here is a possibility not foreseen in manmac: if we accumulate a
2766 % whole lot of material, we might end up calling this \output
2767 % routine twice in a row (see the doublecol-lose test, which is
2768 % essentially a couple of indexes with @setchapternewpage off). In
2769 % that case, we must prevent the second \partialpage from
2770 % simply overwriting the first, causing us to lose the page.
2771 % This will preserve it until a real output routine can ship it
2772 % out. Generally, \partialpage will be empty when this runs and
2773 % this will be a no-op.
2774 \unvbox\partialpage
2776 % Unvbox the main output page.
2777 \unvbox255
2778 \kern-\topskip \kern\baselineskip
2780 \eject
2782 % Use the double-column output routine for subsequent pages.
2783 \output = {\doublecolumnout}%
2785 % Change the page size parameters. We could do this once outside this
2786 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
2787 % format, but then we repeat the same computation. Repeating a couple
2788 % of assignments once per index is clearly meaningless for the
2789 % execution time, so we may as well do it in one place.
2791 % First we halve the line length, less a little for the gutter between
2792 % the columns. We compute the gutter based on the line length, so it
2793 % changes automatically with the paper format. The magic constant
2794 % below is chosen so that the gutter has the same value (well, +-<1pt)
2795 % as it did when we hard-coded it.
2797 % We put the result in a separate register, \doublecolumhsize, so we
2798 % can restore it in \pagesofar, after \hsize itself has (potentially)
2799 % been clobbered.
2801 \doublecolumnhsize = \hsize
2802 \advance\doublecolumnhsize by -.04154\hsize
2803 \divide\doublecolumnhsize by 2
2804 \hsize = \doublecolumnhsize
2806 % Double the \vsize as well. (We don't need a separate register here,
2807 % since nobody clobbers \vsize.)
2808 \advance\vsize by -\ht\partialpage
2809 \vsize = 2\vsize
2812 % The double-column output routine for all double-column pages except
2813 % the last.
2815 \def\doublecolumnout{%
2816 \splittopskip=\topskip \splitmaxdepth=\maxdepth
2817 % Get the available space for the double columns -- the normal
2818 % (undoubled) page height minus any material left over from the
2819 % previous page.
2820 \dimen@ = \vsize
2821 \divide\dimen@ by 2
2823 % box0 will be the left-hand column, box2 the right.
2824 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
2825 \onepageout\pagesofar
2826 \unvbox255
2827 \penalty\outputpenalty
2829 \def\pagesofar{%
2830 % Re-output the contents of the output page -- any previous material,
2831 % followed by the two boxes we just split, in box0 and box2.
2832 \advance\vsize by \ht\partialpage
2833 \unvbox\partialpage
2835 \hsize = \doublecolumnhsize
2836 \wd0=\hsize \wd2=\hsize
2837 \hbox to\pagewidth{\box0\hfil\box2}%
2839 \def\enddoublecolumns{%
2840 \output = {%
2841 % Split the last of the double-column material. Leave on the
2842 % current page, no automatic page break.
2843 \balancecolumns
2845 % If we end up splitting too much material for the current page,
2846 % though, there will be another page break right after this \output
2847 % invocation ends. Having called \balancecolumns once, we do not
2848 % want to call it again. Therefore, reset \output to its normal
2849 % definition right away. (We hope \balancecolumns will never be
2850 % called on to balance too much material, but if it is, this makes
2851 % the output somewhat more palatable.)
2852 \global\output = {\onepageout{\pagecontents\PAGE}}%
2854 % \pagegoal was set to the doubled \vsize above, since we restarted
2855 % the current page. We're now back to normal single-column
2856 % typesetting, so reset \pagegoal to the normal \vsize.
2857 \pagegoal = \vsize
2859 \eject
2860 \endgroup % started in \begindoublecolumns
2862 \def\balancecolumns{%
2863 % Called at the end of the double column material.
2864 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
2865 \dimen@ = \ht0
2866 \advance\dimen@ by \topskip
2867 \advance\dimen@ by-\baselineskip
2868 \divide\dimen@ by 2 % target to split to
2869 %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
2870 \splittopskip = \topskip
2871 % Loop until we get a decent breakpoint.
2873 \vbadness = 10000
2874 \loop
2875 \global\setbox3 = \copy0
2876 \global\setbox1 = \vsplit3 to \dimen@
2877 \ifdim\ht3>\dimen@
2878 \global\advance\dimen@ by 1pt
2879 \repeat
2881 %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
2882 \setbox0=\vbox to\dimen@{\unvbox1}%
2883 \setbox2=\vbox to\dimen@{\unvbox3}%
2885 \pagesofar
2887 \catcode`\@ = \other
2890 \message{sectioning,}
2891 % Define chapters, sections, etc.
2893 \newcount\chapno
2894 \newcount\secno \secno=0
2895 \newcount\subsecno \subsecno=0
2896 \newcount\subsubsecno \subsubsecno=0
2898 % This counter is funny since it counts through charcodes of letters A, B, ...
2899 \newcount\appendixno \appendixno = `\@
2900 \def\appendixletter{\char\the\appendixno}
2902 % Each @chapter defines this as the name of the chapter.
2903 % page headings and footings can use it. @section does likewise.
2904 \def\thischapter{}
2905 \def\thissection{}
2907 \newcount\absseclevel % used to calculate proper heading level
2908 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
2910 % @raisesections: treat @section as chapter, @subsection as section, etc.
2911 \def\raisesections{\global\advance\secbase by -1}
2912 \let\up=\raisesections % original BFox name
2914 % @lowersections: treat @chapter as section, @section as subsection, etc.
2915 \def\lowersections{\global\advance\secbase by 1}
2916 \let\down=\lowersections % original BFox name
2918 % Choose a numbered-heading macro
2919 % #1 is heading level if unmodified by @raisesections or @lowersections
2920 % #2 is text for heading
2921 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2922 \ifcase\absseclevel
2923 \chapterzzz{#2}
2925 \seczzz{#2}
2927 \numberedsubseczzz{#2}
2929 \numberedsubsubseczzz{#2}
2930 \else
2931 \ifnum \absseclevel<0
2932 \chapterzzz{#2}
2933 \else
2934 \numberedsubsubseczzz{#2}
2939 % like \numhead, but chooses appendix heading levels
2940 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2941 \ifcase\absseclevel
2942 \appendixzzz{#2}
2944 \appendixsectionzzz{#2}
2946 \appendixsubseczzz{#2}
2948 \appendixsubsubseczzz{#2}
2949 \else
2950 \ifnum \absseclevel<0
2951 \appendixzzz{#2}
2952 \else
2953 \appendixsubsubseczzz{#2}
2958 % like \numhead, but chooses numberless heading levels
2959 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2960 \ifcase\absseclevel
2961 \unnumberedzzz{#2}
2963 \unnumberedseczzz{#2}
2965 \unnumberedsubseczzz{#2}
2967 \unnumberedsubsubseczzz{#2}
2968 \else
2969 \ifnum \absseclevel<0
2970 \unnumberedzzz{#2}
2971 \else
2972 \unnumberedsubsubseczzz{#2}
2977 % @chapter, @appendix, @unnumbered.
2978 \def\thischaptername{No Chapter Title}
2979 \outer\def\chapter{\parsearg\chapteryyy}
2980 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
2981 \def\chapterzzz #1{%
2982 \secno=0 \subsecno=0 \subsubsecno=0
2983 \global\advance \chapno by 1 \message{\putwordChapter \the\chapno}%
2984 \chapmacro {#1}{\the\chapno}%
2985 \gdef\thissection{#1}%
2986 \gdef\thischaptername{#1}%
2987 % We don't substitute the actual chapter name into \thischapter
2988 % because we don't want its macros evaluated now.
2989 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
2990 \toks0 = {#1}%
2991 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
2992 {\the\chapno}}}%
2993 \temp
2994 \donoderef
2995 \global\let\section = \numberedsec
2996 \global\let\subsection = \numberedsubsec
2997 \global\let\subsubsection = \numberedsubsubsec
3000 \outer\def\appendix{\parsearg\appendixyyy}
3001 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
3002 \def\appendixzzz #1{%
3003 \secno=0 \subsecno=0 \subsubsecno=0
3004 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
3005 \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
3006 \gdef\thissection{#1}%
3007 \gdef\thischaptername{#1}%
3008 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
3009 \toks0 = {#1}%
3010 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
3011 {\putwordAppendix{} \appendixletter}}}%
3012 \temp
3013 \appendixnoderef
3014 \global\let\section = \appendixsec
3015 \global\let\subsection = \appendixsubsec
3016 \global\let\subsubsection = \appendixsubsubsec
3019 % @centerchap is like @unnumbered, but the heading is centered.
3020 \outer\def\centerchap{\parsearg\centerchapyyy}
3021 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
3023 % @top is like @unnumbered.
3024 \outer\def\top{\parsearg\unnumberedyyy}
3026 \outer\def\unnumbered{\parsearg\unnumberedyyy}
3027 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
3028 \def\unnumberedzzz #1{%
3029 \secno=0 \subsecno=0 \subsubsecno=0
3031 % This used to be simply \message{#1}, but TeX fully expands the
3032 % argument to \message. Therefore, if #1 contained @-commands, TeX
3033 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
3034 % expanded @cite (which turns out to cause errors because \cite is meant
3035 % to be executed, not expanded).
3037 % Anyway, we don't want the fully-expanded definition of @cite to appear
3038 % as a result of the \message, we just want `@cite' itself. We use
3039 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
3040 % simply yielding the contents of <toks register>. (We also do this for
3041 % the toc entries.)
3042 \toks0 = {#1}\message{(\the\toks0)}%
3044 \unnumbchapmacro {#1}%
3045 \gdef\thischapter{#1}\gdef\thissection{#1}%
3046 \toks0 = {#1}%
3047 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}%
3048 \temp
3049 \unnumbnoderef
3050 \global\let\section = \unnumberedsec
3051 \global\let\subsection = \unnumberedsubsec
3052 \global\let\subsubsection = \unnumberedsubsubsec
3055 % Sections.
3056 \outer\def\numberedsec{\parsearg\secyyy}
3057 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
3058 \def\seczzz #1{%
3059 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3060 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
3061 \toks0 = {#1}%
3062 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3063 {\the\chapno}{\the\secno}}}%
3064 \temp
3065 \donoderef
3066 \nobreak
3069 \outer\def\appendixsection{\parsearg\appendixsecyyy}
3070 \outer\def\appendixsec{\parsearg\appendixsecyyy}
3071 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
3072 \def\appendixsectionzzz #1{%
3073 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3074 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
3075 \toks0 = {#1}%
3076 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3077 {\appendixletter}{\the\secno}}}%
3078 \temp
3079 \appendixnoderef
3080 \nobreak
3083 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
3084 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
3085 \def\unnumberedseczzz #1{%
3086 \plainsecheading {#1}\gdef\thissection{#1}%
3087 \toks0 = {#1}%
3088 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}%
3089 \temp
3090 \unnumbnoderef
3091 \nobreak
3094 % Subsections.
3095 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
3096 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
3097 \def\numberedsubseczzz #1{%
3098 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3099 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
3100 \toks0 = {#1}%
3101 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3102 {\the\chapno}{\the\secno}{\the\subsecno}}}%
3103 \temp
3104 \donoderef
3105 \nobreak
3108 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
3109 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
3110 \def\appendixsubseczzz #1{%
3111 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3112 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
3113 \toks0 = {#1}%
3114 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3115 {\appendixletter}{\the\secno}{\the\subsecno}}}%
3116 \temp
3117 \appendixnoderef
3118 \nobreak
3121 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
3122 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
3123 \def\unnumberedsubseczzz #1{%
3124 \plainsubsecheading {#1}\gdef\thissection{#1}%
3125 \toks0 = {#1}%
3126 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry%
3127 {\the\toks0}}}%
3128 \temp
3129 \unnumbnoderef
3130 \nobreak
3133 % Subsubsections.
3134 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
3135 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
3136 \def\numberedsubsubseczzz #1{%
3137 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3138 \subsubsecheading {#1}
3139 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3140 \toks0 = {#1}%
3141 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3142 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3143 \temp
3144 \donoderef
3145 \nobreak
3148 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
3149 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
3150 \def\appendixsubsubseczzz #1{%
3151 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3152 \subsubsecheading {#1}
3153 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3154 \toks0 = {#1}%
3155 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3156 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3157 \temp
3158 \appendixnoderef
3159 \nobreak
3162 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
3163 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
3164 \def\unnumberedsubsubseczzz #1{%
3165 \plainsubsubsecheading {#1}\gdef\thissection{#1}%
3166 \toks0 = {#1}%
3167 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry%
3168 {\the\toks0}}}%
3169 \temp
3170 \unnumbnoderef
3171 \nobreak
3174 % These are variants which are not "outer", so they can appear in @ifinfo.
3175 % Actually, they should now be obsolete; ordinary section commands should work.
3176 \def\infotop{\parsearg\unnumberedzzz}
3177 \def\infounnumbered{\parsearg\unnumberedzzz}
3178 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
3179 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
3180 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
3182 \def\infoappendix{\parsearg\appendixzzz}
3183 \def\infoappendixsec{\parsearg\appendixseczzz}
3184 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
3185 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
3187 \def\infochapter{\parsearg\chapterzzz}
3188 \def\infosection{\parsearg\sectionzzz}
3189 \def\infosubsection{\parsearg\subsectionzzz}
3190 \def\infosubsubsection{\parsearg\subsubsectionzzz}
3192 % These macros control what the section commands do, according
3193 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
3194 % Define them by default for a numbered chapter.
3195 \global\let\section = \numberedsec
3196 \global\let\subsection = \numberedsubsec
3197 \global\let\subsubsection = \numberedsubsubsec
3199 % Define @majorheading, @heading and @subheading
3201 % NOTE on use of \vbox for chapter headings, section headings, and such:
3202 % 1) We use \vbox rather than the earlier \line to permit
3203 % overlong headings to fold.
3204 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
3205 % heading is obnoxious; this forbids it.
3206 % 3) Likewise, headings look best if no \parindent is used, and
3207 % if justification is not attempted. Hence \raggedright.
3210 \def\majorheading{\parsearg\majorheadingzzz}
3211 \def\majorheadingzzz #1{%
3212 {\advance\chapheadingskip by 10pt \chapbreak }%
3213 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3214 \parindent=0pt\raggedright
3215 \rm #1\hfill}}\bigskip \par\penalty 200}
3217 \def\chapheading{\parsearg\chapheadingzzz}
3218 \def\chapheadingzzz #1{\chapbreak %
3219 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3220 \parindent=0pt\raggedright
3221 \rm #1\hfill}}\bigskip \par\penalty 200}
3223 % @heading, @subheading, @subsubheading.
3224 \def\heading{\parsearg\plainsecheading}
3225 \def\subheading{\parsearg\plainsubsecheading}
3226 \def\subsubheading{\parsearg\plainsubsubsecheading}
3228 % These macros generate a chapter, section, etc. heading only
3229 % (including whitespace, linebreaking, etc. around it),
3230 % given all the information in convenient, parsed form.
3232 %%% Args are the skip and penalty (usually negative)
3233 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
3235 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
3237 %%% Define plain chapter starts, and page on/off switching for it
3238 % Parameter controlling skip before chapter headings (if needed)
3240 \newskip\chapheadingskip
3242 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
3243 \def\chappager{\par\vfill\supereject}
3244 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
3246 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
3248 \def\CHAPPAGoff{%
3249 \global\let\contentsalignmacro = \chappager
3250 \global\let\pchapsepmacro=\chapbreak
3251 \global\let\pagealignmacro=\chappager}
3253 \def\CHAPPAGon{%
3254 \global\let\contentsalignmacro = \chappager
3255 \global\let\pchapsepmacro=\chappager
3256 \global\let\pagealignmacro=\chappager
3257 \global\def\HEADINGSon{\HEADINGSsingle}}
3259 \def\CHAPPAGodd{
3260 \global\let\contentsalignmacro = \chapoddpage
3261 \global\let\pchapsepmacro=\chapoddpage
3262 \global\let\pagealignmacro=\chapoddpage
3263 \global\def\HEADINGSon{\HEADINGSdouble}}
3265 \CHAPPAGon
3267 \def\CHAPFplain{
3268 \global\let\chapmacro=\chfplain
3269 \global\let\unnumbchapmacro=\unnchfplain
3270 \global\let\centerchapmacro=\centerchfplain}
3272 % Plain chapter opening.
3273 % #1 is the text, #2 the chapter number or empty if unnumbered.
3274 \def\chfplain#1#2{%
3275 \pchapsepmacro
3277 \chapfonts \rm
3278 \def\chapnum{#2}%
3279 \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
3280 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3281 \hangindent = \wd0 \centerparametersmaybe
3282 \unhbox0 #1\par}%
3284 \nobreak\bigskip % no page break after a chapter title
3285 \nobreak
3288 % Plain opening for unnumbered.
3289 \def\unnchfplain#1{\chfplain{#1}{}}
3291 % @centerchap -- centered and unnumbered.
3292 \let\centerparametersmaybe = \relax
3293 \def\centerchfplain#1{{%
3294 \def\centerparametersmaybe{%
3295 \advance\rightskip by 3\rightskip
3296 \leftskip = \rightskip
3297 \parfillskip = 0pt
3299 \chfplain{#1}{}%
3302 \CHAPFplain % The default
3304 \def\unnchfopen #1{%
3305 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3306 \parindent=0pt\raggedright
3307 \rm #1\hfill}}\bigskip \par\nobreak
3310 \def\chfopen #1#2{\chapoddpage {\chapfonts
3311 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
3312 \par\penalty 5000 %
3315 \def\centerchfopen #1{%
3316 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3317 \parindent=0pt
3318 \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
3321 \def\CHAPFopen{
3322 \global\let\chapmacro=\chfopen
3323 \global\let\unnumbchapmacro=\unnchfopen
3324 \global\let\centerchapmacro=\centerchfopen}
3327 % Section titles.
3328 \newskip\secheadingskip
3329 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
3330 \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
3331 \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
3333 % Subsection titles.
3334 \newskip \subsecheadingskip
3335 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
3336 \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
3337 \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
3339 % Subsubsection titles.
3340 \let\subsubsecheadingskip = \subsecheadingskip
3341 \let\subsubsecheadingbreak = \subsecheadingbreak
3342 \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
3343 \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
3346 % Print any size section title.
3348 % #1 is the section type (sec/subsec/subsubsec), #2 is the section
3349 % number (maybe empty), #3 the text.
3350 \def\sectionheading#1#2#3{%
3352 \expandafter\advance\csname #1headingskip\endcsname by \parskip
3353 \csname #1headingbreak\endcsname
3356 % Switch to the right set of fonts.
3357 \csname #1fonts\endcsname \rm
3359 % Only insert the separating space if we have a section number.
3360 \def\secnum{#2}%
3361 \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
3363 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3364 \hangindent = \wd0 % zero if no section number
3365 \unhbox0 #3}%
3367 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
3371 \message{toc,}
3372 \newwrite\tocfile
3374 % Write an entry to the toc file, opening it if necessary.
3375 % Called from @chapter, etc. We supply {\folio} at the end of the
3376 % argument, which will end up as the last argument to the \...entry macro.
3378 % We open the .toc file here instead of at @setfilename or any other
3379 % given time so that @contents can be put in the document anywhere.
3381 \newif\iftocfileopened
3382 \def\writetocentry#1{%
3383 \iftocfileopened\else
3384 \immediate\openout\tocfile = \jobname.toc
3385 \global\tocfileopenedtrue
3387 \iflinks \write\tocfile{#1{\folio}}\fi
3390 % Finish up the main text and prepare to read what we've written
3391 % to \tocfile.
3393 \newskip\contentsrightmargin \contentsrightmargin=1in
3394 \def\startcontents#1{%
3395 % If @setchapternewpage on, and @headings double, the contents should
3396 % start on an odd page, unlike chapters. Thus, we maintain
3397 % \contentsalignmacro in parallel with \pagealignmacro.
3398 % From: Torbjorn Granlund <tege@matematik.su.se>
3399 \contentsalignmacro
3400 \immediate\closeout\tocfile
3401 \ifnum \pageno>0
3402 \pageno = -1 % Request roman numbered pages.
3404 % Don't need to put `Contents' or `Short Contents' in the headline.
3405 % It is abundantly clear what they are.
3406 \unnumbchapmacro{#1}\def\thischapter{}%
3407 \begingroup % Set up to handle contents files properly.
3408 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
3409 % We can't do this, because then an actual ^ in a section
3410 % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
3411 %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3412 \raggedbottom % Worry more about breakpoints than the bottom.
3413 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3417 % Normal (long) toc.
3418 \def\contents{%
3419 \startcontents{\putwordTableofContents}%
3420 \input \jobname.toc
3421 \endgroup
3422 \vfill \eject
3425 % And just the chapters.
3426 \def\summarycontents{%
3427 \startcontents{\putwordShortContents}%
3429 \let\chapentry = \shortchapentry
3430 \let\unnumbchapentry = \shortunnumberedentry
3431 % We want a true roman here for the page numbers.
3432 \secfonts
3433 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
3435 \hyphenpenalty = 10000
3436 \advance\baselineskip by 1pt % Open it up a little.
3437 \def\secentry ##1##2##3##4{}
3438 \def\unnumbsecentry ##1##2{}
3439 \def\subsecentry ##1##2##3##4##5{}
3440 \def\unnumbsubsecentry ##1##2{}
3441 \def\subsubsecentry ##1##2##3##4##5##6{}
3442 \def\unnumbsubsubsecentry ##1##2{}
3443 \input \jobname.toc
3444 \endgroup
3445 \vfill \eject
3447 \let\shortcontents = \summarycontents
3449 % These macros generate individual entries in the table of contents.
3450 % The first argument is the chapter or section name.
3451 % The last argument is the page number.
3452 % The arguments in between are the chapter number, section number, ...
3454 % Chapter-level things, for both the long and short contents.
3455 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3457 % See comments in \dochapentry re vbox and related settings
3458 \def\shortchapentry#1#2#3{%
3459 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
3462 % Typeset the label for a chapter or appendix for the short contents.
3463 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
3464 % We could simplify the code here by writing out an \appendixentry
3465 % command in the toc file for appendices, instead of using \chapentry
3466 % for both, but it doesn't seem worth it.
3467 \setbox0 = \hbox{\shortcontrm \putwordAppendix }
3468 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
3470 \def\shortchaplabel#1{%
3471 % We typeset #1 in a box of constant width, regardless of the text of
3472 % #1, so the chapter titles will come out aligned.
3473 \setbox0 = \hbox{#1}%
3474 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3476 % This space should be plenty, since a single number is .5em, and the
3477 % widest letter (M) is 1em, at least in the Computer Modern fonts.
3478 % (This space doesn't include the extra space that gets added after
3479 % the label; that gets put in by \shortchapentry above.)
3480 \advance\dimen0 by 1.1em
3481 \hbox to \dimen0{#1\hfil}%
3484 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3485 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
3487 % Sections.
3488 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3489 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
3491 % Subsections.
3492 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
3493 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
3495 % And subsubsections.
3496 \def\subsubsecentry#1#2#3#4#5#6{%
3497 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
3498 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
3500 % This parameter controls the indentation of the various levels.
3501 \newdimen\tocindent \tocindent = 3pc
3503 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
3504 % page number.
3506 % If the toc has to be broken over pages, we want it to be at chapters
3507 % if at all possible; hence the \penalty.
3508 \def\dochapentry#1#2{%
3509 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
3510 \begingroup
3511 \chapentryfonts
3512 \tocentry{#1}{\dopageno{#2}}%
3513 \endgroup
3514 \nobreak\vskip .25\baselineskip plus.1\baselineskip
3517 \def\dosecentry#1#2{\begingroup
3518 \secentryfonts \leftskip=\tocindent
3519 \tocentry{#1}{\dopageno{#2}}%
3520 \endgroup}
3522 \def\dosubsecentry#1#2{\begingroup
3523 \subsecentryfonts \leftskip=2\tocindent
3524 \tocentry{#1}{\dopageno{#2}}%
3525 \endgroup}
3527 \def\dosubsubsecentry#1#2{\begingroup
3528 \subsubsecentryfonts \leftskip=3\tocindent
3529 \tocentry{#1}{\dopageno{#2}}%
3530 \endgroup}
3532 % Final typesetting of a toc entry; we use the same \entry macro as for
3533 % the index entries, but we want to suppress hyphenation here. (We
3534 % can't do that in the \entry macro, since index entries might consist
3535 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
3536 \def\tocentry#1#2{\begingroup
3537 \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
3538 % Do not use \turnoffactive in these arguments. Since the toc is
3539 % typeset in cmr, so characters such as _ would come out wrong; we
3540 % have to do the usual translation tricks.
3541 \entry{#1}{#2}%
3542 \endgroup}
3544 % Space between chapter (or whatever) number and the title.
3545 \def\labelspace{\hskip1em \relax}
3547 \def\dopageno#1{{\rm #1}}
3548 \def\doshortpageno#1{{\rm #1}}
3550 \def\chapentryfonts{\secfonts \rm}
3551 \def\secentryfonts{\textfonts}
3552 \let\subsecentryfonts = \textfonts
3553 \let\subsubsecentryfonts = \textfonts
3556 \message{environments,}
3558 % Since these characters are used in examples, it should be an even number of
3559 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3560 % Furthermore, these definitions must come after we define our fonts.
3561 \newbox\dblarrowbox \newbox\longdblarrowbox
3562 \newbox\pushcharbox \newbox\bullbox
3563 \newbox\equivbox \newbox\errorbox
3565 %{\tentt
3566 %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
3567 %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
3568 %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
3569 %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
3570 % Adapted from the manmac format (p.420 of TeXbook)
3571 %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
3572 % depth .1ex\hfil}
3575 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3576 \def\point{$\star$}
3577 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3578 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
3579 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3580 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3582 % Adapted from the TeXbook's \boxit.
3583 {\tentt \global\dimen0 = 3em}% Width of the box.
3584 \dimen2 = .55pt % Thickness of rules
3585 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3586 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
3588 \global\setbox\errorbox=\hbox to \dimen0{\hfil
3589 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3590 \advance\hsize by -2\dimen2 % Rules.
3591 \vbox{
3592 \hrule height\dimen2
3593 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3594 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3595 \kern3pt\vrule width\dimen2}% Space to right.
3596 \hrule height\dimen2}
3597 \hfil}
3599 % The @error{} command.
3600 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3602 % @tex ... @end tex escapes into raw Tex temporarily.
3603 % One exception: @ is still an escape character, so that @end tex works.
3604 % But \@ or @@ will get a plain tex @ character.
3606 \def\tex{\begingroup
3607 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
3608 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
3609 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
3610 \catcode `\%=14
3611 \catcode 43=12 % plus
3612 \catcode`\"=12
3613 \catcode`\==12
3614 \catcode`\|=12
3615 \catcode`\<=12
3616 \catcode`\>=12
3617 \escapechar=`\\
3619 \let\b=\ptexb
3620 \let\bullet=\ptexbullet
3621 \let\c=\ptexc
3622 \let\,=\ptexcomma
3623 \let\.=\ptexdot
3624 \let\dots=\ptexdots
3625 \let\equiv=\ptexequiv
3626 \let\!=\ptexexclam
3627 \let\i=\ptexi
3628 \let\{=\ptexlbrace
3629 \let\+=\tabalign
3630 \let\}=\ptexrbrace
3631 \let\*=\ptexstar
3632 \let\t=\ptext
3634 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
3635 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
3636 \def\@{@}%
3637 \let\Etex=\endgroup}
3639 % Define @lisp ... @endlisp.
3640 % @lisp does a \begingroup so it can rebind things,
3641 % including the definition of @endlisp (which normally is erroneous).
3643 % Amount to narrow the margins by for @lisp.
3644 \newskip\lispnarrowing \lispnarrowing=0.4in
3646 % This is the definition that ^^M gets inside @lisp, @example, and other
3647 % such environments. \null is better than a space, since it doesn't
3648 % have any width.
3649 \def\lisppar{\null\endgraf}
3651 % Make each space character in the input produce a normal interword
3652 % space in the output. Don't allow a line break at this space, as this
3653 % is used only in environments like @example, where each line of input
3654 % should produce a line of output anyway.
3656 {\obeyspaces %
3657 \gdef\sepspaces{\obeyspaces\let =\tie}}
3659 % Define \obeyedspace to be our active space, whatever it is. This is
3660 % for use in \parsearg.
3661 {\sepspaces%
3662 \global\let\obeyedspace= }
3664 % This space is always present above and below environments.
3665 \newskip\envskipamount \envskipamount = 0pt
3667 % Make spacing and below environment symmetrical. We use \parskip here
3668 % to help in doing that, since in @example-like environments \parskip
3669 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
3670 % start of the next paragraph will insert \parskip
3672 \def\aboveenvbreak{{\advance\envskipamount by \parskip
3673 \endgraf \ifdim\lastskip<\envskipamount
3674 \removelastskip \penalty-50 \vskip\envskipamount \fi}}
3676 \let\afterenvbreak = \aboveenvbreak
3678 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
3679 \let\nonarrowing=\relax
3681 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
3682 % environment contents.
3683 \font\circle=lcircle10
3684 \newdimen\circthick
3685 \newdimen\cartouter\newdimen\cartinner
3686 \newskip\normbskip\newskip\normpskip\newskip\normlskip
3687 \circthick=\fontdimen8\circle
3689 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
3690 \def\ctr{{\hskip 6pt\circle\char'010}}
3691 \def\cbl{{\circle\char'012\hskip -6pt}}
3692 \def\cbr{{\hskip 6pt\circle\char'011}}
3693 \def\carttop{\hbox to \cartouter{\hskip\lskip
3694 \ctl\leaders\hrule height\circthick\hfil\ctr
3695 \hskip\rskip}}
3696 \def\cartbot{\hbox to \cartouter{\hskip\lskip
3697 \cbl\leaders\hrule height\circthick\hfil\cbr
3698 \hskip\rskip}}
3700 \newskip\lskip\newskip\rskip
3702 \long\def\cartouche{%
3703 \begingroup
3704 \lskip=\leftskip \rskip=\rightskip
3705 \leftskip=0pt\rightskip=0pt %we want these *outside*.
3706 \cartinner=\hsize \advance\cartinner by-\lskip
3707 \advance\cartinner by-\rskip
3708 \cartouter=\hsize
3709 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
3710 % side, and for 6pt waste from
3711 % each corner char, and rule thickness
3712 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
3713 % Flag to tell @lisp, etc., not to narrow margin.
3714 \let\nonarrowing=\comment
3715 \vbox\bgroup
3716 \baselineskip=0pt\parskip=0pt\lineskip=0pt
3717 \carttop
3718 \hbox\bgroup
3719 \hskip\lskip
3720 \vrule\kern3pt
3721 \vbox\bgroup
3722 \hsize=\cartinner
3723 \kern3pt
3724 \begingroup
3725 \baselineskip=\normbskip
3726 \lineskip=\normlskip
3727 \parskip=\normpskip
3728 \vskip -\parskip
3729 \def\Ecartouche{%
3730 \endgroup
3731 \kern3pt
3732 \egroup
3733 \kern3pt\vrule
3734 \hskip\rskip
3735 \egroup
3736 \cartbot
3737 \egroup
3738 \endgroup
3742 % This macro is called at the beginning of all the @example variants,
3743 % inside a group.
3744 \def\nonfillstart{%
3745 \aboveenvbreak
3746 \inENV % This group ends at the end of the body
3747 \hfuzz = 12pt % Don't be fussy
3748 \sepspaces % Make spaces be word-separators rather than space tokens.
3749 \singlespace
3750 \let\par = \lisppar % don't ignore blank lines
3751 \obeylines % each line of input is a line of output
3752 \parskip = 0pt
3753 \parindent = 0pt
3754 \emergencystretch = 0pt % don't try to avoid overfull boxes
3755 % @cartouche defines \nonarrowing to inhibit narrowing
3756 % at next level down.
3757 \ifx\nonarrowing\relax
3758 \advance \leftskip by \lispnarrowing
3759 \exdentamount=\lispnarrowing
3760 \let\exdent=\nofillexdent
3761 \let\nonarrowing=\relax
3765 % Define the \E... control sequence only if we are inside the particular
3766 % environment, so the error checking in \end will work.
3768 % To end an @example-like environment, we first end the paragraph (via
3769 % \afterenvbreak's vertical glue), and then the group. That way we keep
3770 % the zero \parskip that the environments set -- \parskip glue will be
3771 % inserted at the beginning of the next paragraph in the document, after
3772 % the environment.
3774 \def\nonfillfinish{\afterenvbreak\endgroup}
3776 % @lisp: indented, narrowed, typewriter font.
3777 \def\lisp{\begingroup
3778 \nonfillstart
3779 \let\Elisp = \nonfillfinish
3781 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
3782 \gobble % eat return
3785 % @example: Same as @lisp.
3786 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
3788 % @small... is usually equivalent to the non-small (@smallbook
3789 % redefines). We must call \example (or whatever) last in the
3790 % definition, since it reads the return following the @example (or
3791 % whatever) command.
3793 % This actually allows (for example) @end display inside an
3794 % @smalldisplay. Too bad, but makeinfo will catch the error anyway.
3796 \def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display}
3797 \def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp}
3798 \def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format}
3799 \def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
3801 % Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
3802 % Originally contributed by Pavel@xerox.
3803 \def\smalllispx{\begingroup
3804 \def\Esmalllisp{\nonfillfinish\endgroup}%
3805 \def\Esmallexample{\nonfillfinish\endgroup}%
3806 \indexfonts
3807 \lisp
3810 % @display: same as @lisp except keep current font.
3812 \def\display{\begingroup
3813 \nonfillstart
3814 \let\Edisplay = \nonfillfinish
3815 \gobble
3818 % @smalldisplay (when @smallbook): @display plus smaller fonts.
3820 \def\smalldisplayx{\begingroup
3821 \def\Esmalldisplay{\nonfillfinish\endgroup}%
3822 \indexfonts \rm
3823 \display
3826 % @format: same as @display except don't narrow margins.
3828 \def\format{\begingroup
3829 \let\nonarrowing = t
3830 \nonfillstart
3831 \let\Eformat = \nonfillfinish
3832 \gobble
3835 % @smallformat (when @smallbook): @format plus smaller fonts.
3837 \def\smallformatx{\begingroup
3838 \def\Esmallformat{\nonfillfinish\endgroup}%
3839 \indexfonts \rm
3840 \format
3843 % @flushleft (same as @format).
3845 \def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
3847 % @flushright.
3849 \def\flushright{\begingroup
3850 \let\nonarrowing = t
3851 \nonfillstart
3852 \let\Eflushright = \nonfillfinish
3853 \advance\leftskip by 0pt plus 1fill
3854 \gobble
3857 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
3858 % and narrows the margins.
3860 \def\quotation{%
3861 \begingroup\inENV %This group ends at the end of the @quotation body
3862 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
3863 \singlespace
3864 \parindent=0pt
3865 % We have retained a nonzero parskip for the environment, since we're
3866 % doing normal filling. So to avoid extra space below the environment...
3867 \def\Equotation{\parskip = 0pt \nonfillfinish}%
3869 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
3870 \ifx\nonarrowing\relax
3871 \advance\leftskip by \lispnarrowing
3872 \advance\rightskip by \lispnarrowing
3873 \exdentamount = \lispnarrowing
3874 \let\nonarrowing = \relax
3879 \message{defuns,}
3880 % Define formatter for defuns
3881 % First, allow user to change definition object font (\df) internally
3882 \def\setdeffont #1 {\csname DEF#1\endcsname}
3884 \newskip\defbodyindent \defbodyindent=.4in
3885 \newskip\defargsindent \defargsindent=50pt
3886 \newskip\deftypemargin \deftypemargin=12pt
3887 \newskip\deflastargmargin \deflastargmargin=18pt
3889 \newcount\parencount
3890 % define \functionparens, which makes ( and ) and & do special things.
3891 % \functionparens affects the group it is contained in.
3892 \def\activeparens{%
3893 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
3894 \catcode`\[=\active \catcode`\]=\active}
3896 % Make control sequences which act like normal parenthesis chars.
3897 \let\lparen = ( \let\rparen = )
3899 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
3901 % Be sure that we always have a definition for `(', etc. For example,
3902 % if the fn name has parens in it, \boldbrax will not be in effect yet,
3903 % so TeX would otherwise complain about undefined control sequence.
3904 \global\let(=\lparen \global\let)=\rparen
3905 \global\let[=\lbrack \global\let]=\rbrack
3907 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
3908 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
3909 % This is used to turn on special parens
3910 % but make & act ordinary (given that it's active).
3911 \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
3913 % Definitions of (, ) and & used in args for functions.
3914 % This is the definition of ( outside of all parentheses.
3915 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
3916 \global\advance\parencount by 1
3919 % This is the definition of ( when already inside a level of parens.
3920 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
3922 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
3923 % also in that case restore the outer-level definition of (.
3924 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
3925 \global\advance \parencount by -1 }
3926 % If we encounter &foo, then turn on ()-hacking afterwards
3927 \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
3929 \gdef\normalparens{\boldbrax\let&=\ampnr}
3930 } % End of definition inside \activeparens
3931 %% These parens (in \boldbrax) actually are a little bolder than the
3932 %% contained text. This is especially needed for [ and ]
3933 \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
3934 \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
3935 \def\ampnr{\&}
3936 \def\lbrb{{\bf\char`\[}}
3937 \def\rbrb{{\bf\char`\]}}
3939 % First, defname, which formats the header line itself.
3940 % #1 should be the function name.
3941 % #2 should be the type of definition, such as "Function".
3943 \def\defname #1#2{%
3944 % Get the values of \leftskip and \rightskip as they were
3945 % outside the @def...
3946 \dimen2=\leftskip
3947 \advance\dimen2 by -\defbodyindent
3948 \dimen3=\rightskip
3949 \advance\dimen3 by -\defbodyindent
3950 \noindent %
3951 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
3952 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
3953 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
3954 \parshape 2 0in \dimen0 \defargsindent \dimen1 %
3955 % Now output arg 2 ("Function" or some such)
3956 % ending at \deftypemargin from the right margin,
3957 % but stuck inside a box of width 0 so it does not interfere with linebreaking
3958 {% Adjust \hsize to exclude the ambient margins,
3959 % so that \rightline will obey them.
3960 \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
3961 \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
3962 % Make all lines underfull and no complaints:
3963 \tolerance=10000 \hbadness=10000
3964 \advance\leftskip by -\defbodyindent
3965 \exdentamount=\defbodyindent
3966 {\df #1}\enskip % Generate function name
3969 % Actually process the body of a definition
3970 % #1 should be the terminating control sequence, such as \Edefun.
3971 % #2 should be the "another name" control sequence, such as \defunx.
3972 % #3 should be the control sequence that actually processes the header,
3973 % such as \defunheader.
3975 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3976 \medbreak %
3977 % Define the end token that this defining construct specifies
3978 % so that it will exit this group.
3979 \def#1{\endgraf\endgroup\medbreak}%
3980 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
3981 \parindent=0in
3982 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3983 \exdentamount=\defbodyindent
3984 \begingroup %
3985 \catcode 61=\active % 61 is `='
3986 \obeylines\activeparens\spacesplit#3}
3988 % #1 is the \E... control sequence to end the definition (which we define).
3989 % #2 is the \...x control sequence for consecutive fns (which we define).
3990 % #3 is the control sequence to call to resume processing.
3991 % #4, delimited by the space, is the class name.
3993 \def\defmethparsebody#1#2#3#4 {\begingroup\inENV %
3994 \medbreak %
3995 % Define the end token that this defining construct specifies
3996 % so that it will exit this group.
3997 \def#1{\endgraf\endgroup\medbreak}%
3998 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
3999 \parindent=0in
4000 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4001 \exdentamount=\defbodyindent
4002 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
4004 % @deftypemethod has an extra argument that nothing else does. Sigh.
4005 % #1 is the \E... control sequence to end the definition (which we define).
4006 % #2 is the \...x control sequence for consecutive fns (which we define).
4007 % #3 is the control sequence to call to resume processing.
4008 % #4, delimited by the space, is the class name.
4009 % #5 is the method's return type.
4011 \def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV %
4012 \medbreak %
4013 % Define the end token that this defining construct specifies
4014 % so that it will exit this group.
4015 \def#1{\endgraf\endgroup\medbreak}%
4016 \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}%
4017 \parindent=0in
4018 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4019 \exdentamount=\defbodyindent
4020 \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}}
4022 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
4023 \medbreak %
4024 % Define the end token that this defining construct specifies
4025 % so that it will exit this group.
4026 \def#1{\endgraf\endgroup\medbreak}%
4027 \def#2##1 ##2 {\def#4{##1}%
4028 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
4029 \parindent=0in
4030 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4031 \exdentamount=\defbodyindent
4032 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
4034 % These parsing functions are similar to the preceding ones
4035 % except that they do not make parens into active characters.
4036 % These are used for "variables" since they have no arguments.
4038 \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4039 \medbreak %
4040 % Define the end token that this defining construct specifies
4041 % so that it will exit this group.
4042 \def#1{\endgraf\endgroup\medbreak}%
4043 \def#2{\begingroup\obeylines\spacesplit#3}%
4044 \parindent=0in
4045 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4046 \exdentamount=\defbodyindent
4047 \begingroup %
4048 \catcode 61=\active %
4049 \obeylines\spacesplit#3}
4051 % This is used for \def{tp,vr}parsebody. It could probably be used for
4052 % some of the others, too, with some judicious conditionals.
4054 \def\parsebodycommon#1#2#3{%
4055 \begingroup\inENV %
4056 \medbreak %
4057 % Define the end token that this defining construct specifies
4058 % so that it will exit this group.
4059 \def#1{\endgraf\endgroup\medbreak}%
4060 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
4061 \parindent=0in
4062 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4063 \exdentamount=\defbodyindent
4064 \begingroup\obeylines
4067 \def\defvrparsebody#1#2#3#4 {%
4068 \parsebodycommon{#1}{#2}{#3}%
4069 \spacesplit{#3{#4}}%
4072 % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
4073 % type is just `struct', because we lose the braces in `{struct
4074 % termios}' when \spacesplit reads its undelimited argument. Sigh.
4075 % \let\deftpparsebody=\defvrparsebody
4077 % So, to get around this, we put \empty in with the type name. That
4078 % way, TeX won't find exactly `{...}' as an undelimited argument, and
4079 % won't strip off the braces.
4081 \def\deftpparsebody #1#2#3#4 {%
4082 \parsebodycommon{#1}{#2}{#3}%
4083 \spacesplit{\parsetpheaderline{#3{#4}}}\empty
4086 % Fine, but then we have to eventually remove the \empty *and* the
4087 % braces (if any). That's what this does.
4089 \def\removeemptybraces\empty#1\relax{#1}
4091 % After \spacesplit has done its work, this is called -- #1 is the final
4092 % thing to call, #2 the type name (which starts with \empty), and #3
4093 % (which might be empty) the arguments.
4095 \def\parsetpheaderline#1#2#3{%
4096 #1{\removeemptybraces#2\relax}{#3}%
4099 \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
4100 \medbreak %
4101 % Define the end token that this defining construct specifies
4102 % so that it will exit this group.
4103 \def#1{\endgraf\endgroup\medbreak}%
4104 \def#2##1 ##2 {\def#4{##1}%
4105 \begingroup\obeylines\spacesplit{#3{##2}}}%
4106 \parindent=0in
4107 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4108 \exdentamount=\defbodyindent
4109 \begingroup\obeylines\spacesplit{#3{#5}}}
4111 % Split up #2 at the first space token.
4112 % call #1 with two arguments:
4113 % the first is all of #2 before the space token,
4114 % the second is all of #2 after that space token.
4115 % If #2 contains no space token, all of it is passed as the first arg
4116 % and the second is passed as empty.
4118 {\obeylines
4119 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
4120 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
4121 \ifx\relax #3%
4122 #1{#2}{}\else #1{#2}{#3#4}\fi}}
4124 % So much for the things common to all kinds of definitions.
4126 % Define @defun.
4128 % First, define the processing that is wanted for arguments of \defun
4129 % Use this to expand the args and terminate the paragraph they make up
4131 \def\defunargs #1{\functionparens \sl
4132 % Expand, preventing hyphenation at `-' chars.
4133 % Note that groups don't affect changes in \hyphenchar.
4134 \hyphenchar\tensl=0
4136 \hyphenchar\tensl=45
4137 \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
4138 \interlinepenalty=10000
4139 \advance\rightskip by 0pt plus 1fil
4140 \endgraf\nobreak\vskip -\parskip\nobreak
4143 \def\deftypefunargs #1{%
4144 % Expand, preventing hyphenation at `-' chars.
4145 % Note that groups don't affect changes in \hyphenchar.
4146 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
4147 \boldbraxnoamp
4148 \tclose{#1}% avoid \code because of side effects on active chars
4149 \interlinepenalty=10000
4150 \advance\rightskip by 0pt plus 1fil
4151 \endgraf\nobreak\vskip -\parskip\nobreak
4154 % Do complete processing of one @defun or @defunx line already parsed.
4156 % @deffn Command forward-char nchars
4158 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
4160 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
4161 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
4162 \catcode 61=\other % Turn off change made in \defparsebody
4165 % @defun == @deffn Function
4167 \def\defun{\defparsebody\Edefun\defunx\defunheader}
4169 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4170 \begingroup\defname {#1}{Function}%
4171 \defunargs {#2}\endgroup %
4172 \catcode 61=\other % Turn off change made in \defparsebody
4175 % @deftypefun int foobar (int @var{foo}, float @var{bar})
4177 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
4179 % #1 is the data type. #2 is the name and args.
4180 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
4181 % #1 is the data type, #2 the name, #3 the args.
4182 \def\deftypefunheaderx #1#2 #3\relax{%
4183 \doind {fn}{\code{#2}}% Make entry in function index
4184 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
4185 \deftypefunargs {#3}\endgroup %
4186 \catcode 61=\other % Turn off change made in \defparsebody
4189 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
4191 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
4193 % \defheaderxcond#1\relax$$$
4194 % puts #1 in @code, followed by a space, but does nothing if #1 is null.
4195 \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
4197 % #1 is the classification. #2 is the data type. #3 is the name and args.
4198 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
4199 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
4200 \def\deftypefnheaderx #1#2#3 #4\relax{%
4201 \doind {fn}{\code{#3}}% Make entry in function index
4202 \begingroup
4203 \normalparens % notably, turn off `&' magic, which prevents
4204 % at least some C++ text from working
4205 \defname {\defheaderxcond#2\relax$$$#3}{#1}%
4206 \deftypefunargs {#4}\endgroup %
4207 \catcode 61=\other % Turn off change made in \defparsebody
4210 % @defmac == @deffn Macro
4212 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
4214 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4215 \begingroup\defname {#1}{Macro}%
4216 \defunargs {#2}\endgroup %
4217 \catcode 61=\other % Turn off change made in \defparsebody
4220 % @defspec == @deffn Special Form
4222 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
4224 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4225 \begingroup\defname {#1}{Special Form}%
4226 \defunargs {#2}\endgroup %
4227 \catcode 61=\other % Turn off change made in \defparsebody
4230 % This definition is run if you use @defunx
4231 % anywhere other than immediately after a @defun or @defunx.
4233 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
4234 \def\defunx #1 {\errmessage{@defunx in invalid context}}
4235 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
4236 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
4237 \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
4238 \def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}}
4239 \def\deftypefunx #1 {\errmessage{@deftypefunx in invalid context}}
4241 % @defmethod, and so on
4243 % @defop CATEGORY CLASS OPERATION ARG...
4245 \def\defop #1 {\def\defoptype{#1}%
4246 \defopparsebody\Edefop\defopx\defopheader\defoptype}
4248 \def\defopheader #1#2#3{%
4249 \dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index
4250 \begingroup\defname {#2}{\defoptype{} on #1}%
4251 \defunargs {#3}\endgroup %
4254 % @deftypemethod CLASS RETURN-TYPE METHOD ARG...
4256 \def\deftypemethod{%
4257 \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
4259 % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
4260 \def\deftypemethodheader#1#2#3#4{%
4261 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
4262 \begingroup
4263 \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}%
4264 \deftypefunargs{#4}%
4265 \endgroup
4268 % @defmethod == @defop Method
4270 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
4272 % #1 is the class name, #2 the method name, #3 the args.
4273 \def\defmethodheader#1#2#3{%
4274 \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
4275 \begingroup
4276 \defname{#2}{\putwordMethodon\ \code{#1}}%
4277 \defunargs{#3}%
4278 \endgroup
4281 % @defcv {Class Option} foo-class foo-flag
4283 \def\defcv #1 {\def\defcvtype{#1}%
4284 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
4286 \def\defcvarheader #1#2#3{%
4287 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4288 \begingroup\defname {#2}{\defcvtype{} of #1}%
4289 \defvarargs {#3}\endgroup %
4292 % @defivar == @defcv {Instance Variable}
4294 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
4296 \def\defivarheader #1#2#3{%
4297 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4298 \begingroup\defname {#2}{Instance Variable of #1}%
4299 \defvarargs {#3}\endgroup %
4302 % These definitions are run if you use @defmethodx, etc.,
4303 % anywhere other than immediately after a @defmethod, etc.
4305 \def\defopx #1 {\errmessage{@defopx in invalid context}}
4306 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
4307 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
4308 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
4310 % Now @defvar
4312 % First, define the processing that is wanted for arguments of @defvar.
4313 % This is actually simple: just print them in roman.
4314 % This must expand the args and terminate the paragraph they make up
4315 \def\defvarargs #1{\normalparens #1%
4316 \interlinepenalty=10000
4317 \endgraf\nobreak\vskip -\parskip\nobreak}
4319 % @defvr Counter foo-count
4321 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
4323 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
4324 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
4326 % @defvar == @defvr Variable
4328 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
4330 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4331 \begingroup\defname {#1}{Variable}%
4332 \defvarargs {#2}\endgroup %
4335 % @defopt == @defvr {User Option}
4337 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
4339 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4340 \begingroup\defname {#1}{User Option}%
4341 \defvarargs {#2}\endgroup %
4344 % @deftypevar int foobar
4346 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
4348 % #1 is the data type. #2 is the name, perhaps followed by text that
4349 % is actually part of the data type, which should not be put into the index.
4350 \def\deftypevarheader #1#2{%
4351 \dovarind#2 \relax% Make entry in variables index
4352 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
4353 \interlinepenalty=10000
4354 \endgraf\nobreak\vskip -\parskip\nobreak
4355 \endgroup}
4356 \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
4358 % @deftypevr {Global Flag} int enable
4360 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
4362 \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
4363 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
4364 \interlinepenalty=10000
4365 \endgraf\nobreak\vskip -\parskip\nobreak
4366 \endgroup}
4368 % This definition is run if you use @defvarx
4369 % anywhere other than immediately after a @defvar or @defvarx.
4371 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
4372 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
4373 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
4374 \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
4375 \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
4377 % Now define @deftp
4378 % Args are printed in bold, a slight difference from @defvar.
4380 \def\deftpargs #1{\bf \defvarargs{#1}}
4382 % @deftp Class window height width ...
4384 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
4386 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4387 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4389 % This definition is run if you use @deftpx, etc
4390 % anywhere other than immediately after a @deftp, etc.
4392 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
4395 \message{macros,}
4396 % @macro.
4398 % To do this right we need a feature of e-TeX, \scantokens,
4399 % which we arrange to emulate with a temporary file in ordinary TeX.
4400 \ifx\eTeXversion\undefined
4401 \newwrite\macscribble
4402 \def\scantokens#1{%
4403 \immediate\openout\macscribble=\jobname.tmp
4404 \immediate\write\macscribble{#1}%
4405 \immediate\closeout\macscribble
4406 \input \jobname.tmp
4410 \newcount\paramno % Count of parameters
4411 \newtoks\macname % Macro name
4412 \newif\ifrecursive % Is it recursive?
4414 % Utility: does \let #1 = #2, except with \csnames.
4415 \def\cslet#1#2{%
4416 \expandafter\expandafter
4417 \expandafter\let
4418 \expandafter\expandafter
4419 \csname#1\endcsname
4420 \csname#2\endcsname}
4422 % Macro bodies are absorbed as an argument in a context where
4423 % all characters are catcode 10, 11 or 12, except \ which is active
4424 % (as in normal texinfo). It is necessary to change the definition of \.
4426 % It's necessary to get hard CRs in the scribble file when using Knuth
4427 % TeX, and it can't hurt with e-TeX. Texinfo sets \newlinechar=`^^J,
4428 % so we redefine the \endlinechar to ^^J when reading the macro body.
4430 \def\macrobodyctxt{%
4431 \catcode`\~=12
4432 \catcode`\^=12
4433 \catcode`\_=12
4434 \catcode`\|=12
4435 \catcode`\<=12
4436 \catcode`\>=12
4437 \catcode`\+=12
4438 \catcode`\{=12
4439 \catcode`\}=12
4440 \catcode`\@=12
4441 \endlinechar`^^J%
4442 \usembodybackslash}
4444 % \mbodybackslash is the definition of \ in @macro bodies.
4445 % It maps \foo\ => \csname macarg.foo\endcsname => #N
4446 % where N is the macro parameter number.
4447 % We define \csname macarg.\endcsname to be \realbackslash, so
4448 % \\ in macro replacement text gets you a backslash.
4450 {\catcode`@=0 @catcode`@\=@active
4451 @gdef@usembodybackslash{@let\=@mbodybackslash}
4452 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
4454 \expandafter\def\csname macarg.\endcsname{\realbackslash}
4456 \def\macro{\recursivefalse\parsearg\macroxxx}
4457 \def\rmacro{\recursivetrue\parsearg\macroxxx}
4459 \def\macroxxx#1{%
4460 \getargs{#1}% now \macname is the macname and \argl the arglist
4461 \ifx\argl\empty % no arguments
4462 \paramno=0%
4463 \else
4464 \expandafter\parsemargdef \argl;%
4466 \expandafter\ifx \csname macsave.\the\macname\endcsname \relax
4467 \cslet{macsave.\the\macname}{\the\macname}%
4468 \else
4469 \message{Warning: redefining \the\macname}%
4471 \begingroup \macrobodyctxt
4472 \ifrecursive \expandafter\parsermacbody
4473 \else \expandafter\parsemacbody
4474 \fi}
4476 \def\unmacro{\parsearg\unmacroxxx}
4477 \def\unmacroxxx#1{%
4478 \expandafter\ifx \csname macsave.\the\macname\endcsname \relax
4479 \errmessage{Macro \the\macname\ not defined.}%
4480 \else
4481 \cslet{#1}{macsave.#1}%
4482 \expandafter\let \csname macsave.\the\macname\endcsname \undefined
4486 % This makes use of the obscure feature that if the last token of a
4487 % <parameter list> is #, then the preceding argument is delimited by
4488 % an opening brace, and that opening brace is not consumed.
4489 \def\getargs#1{\getargsxxx#1{}}
4490 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
4491 \def\getmacname #1 #2\relax{\macname={#1}}
4492 \def\getmacargs#1{\def\argl{#1}}
4494 % Parse the optional {params} list. Set up \paramno and \paramlist
4495 % so \defmacro knows what to do. Define \macarg.blah for each blah
4496 % in the params list, to be ##N where N is the position in that list.
4497 % That gets used by \mbodybackslash (above).
4499 % We need to get `macro parameter char #' into several definitions.
4500 % The technique used is stolen from LaTeX: let \hash be something
4501 % unexpandable, insert that wherever you need a #, and then redefine
4502 % it to # just before using the token list produced.
4504 \def\parsemargdef#1;{\paramno=0\def\paramlist{}%
4505 \let\hash\relax\parsemargdefxxx#1,;,}
4506 \def\parsemargdefxxx#1,{%
4507 \if#1;\let\next=\relax
4508 \else \let\next=\parsemargdefxxx
4509 \advance\paramno by 1%
4510 \eatspaces#1 \relax% output to \toks0
4511 \expandafter\edef\csname macarg.\the\toks0\endcsname
4512 {\ignorespaces \hash\the\paramno}%
4513 \edef\paramlist{\paramlist\hash\the\paramno,}%
4514 \fi\next}
4515 \def\eatspaces#1 #2\relax{\def\temp{#1}%
4516 \ifx\temp\empty \let\nexteat\eatspaces
4517 \else \toks0={#1}\let\nexteat\eatspacesx \fi
4518 \nexteat#2 \relax}
4519 \def\eatspacesx#1 \relax{}
4521 % These two commands read recursive and nonrecursive macro bodies.
4522 % (They're different since rec and nonrec macros end differently.)
4524 \long\def\parsemacbody#1^^J@end macro^^J%
4525 {\xdef\temp{#1}\endgroup\defmacro}%
4526 \long\def\parsermacbody#1^^J@end rmacro^^J%
4527 {\xdef\temp{#1}\endgroup\defmacro}%
4529 % This defines the macro itself. There are six cases: recursive and
4530 % nonrecursive macros of zero, one, and many arguments.
4531 % Much magic with \expandafter here.
4532 \def\defmacro{%
4533 \let\hash=##% convert placeholders to macro parameter chars
4534 \ifrecursive
4535 \ifcase\paramno
4537 \expandafter\edef\csname\the\macname\endcsname{%
4538 \noexpand\scantokens{\temp}}%
4539 \or % 1
4540 \expandafter\edef\csname\the\macname\endcsname{%
4541 \noexpand\braceorline\csname\the\macname xxx\endcsname}%
4542 \expandafter\edef\csname\the\macname xxx\endcsname##1{%
4543 \noexpand\scantokens{\temp}}%
4544 \else % many
4545 \expandafter\edef\csname\the\macname\endcsname##1{%
4546 \csname\the\macname xxx\endcsname ##1,}%
4547 \expandafter\expandafter
4548 \expandafter\edef
4549 \expandafter\expandafter
4550 \csname\the\macname xxx\endcsname
4551 \paramlist{\noexpand\scantokens{\temp}}%
4553 \else
4554 \ifcase\paramno
4556 \expandafter\edef\csname\the\macname\endcsname{%
4557 \noexpand\norecurse{\the\macname}%
4558 \noexpand\scantokens{\temp}\egroup}%
4559 \or % 1
4560 \expandafter\edef\csname\the\macname\endcsname{%
4561 \noexpand\braceorline\csname\the\macname xxx\endcsname}%
4562 \expandafter\edef\csname\the\macname xxx\endcsname##1{%
4563 \noexpand\norecurse{\the\macname}%
4564 \noexpand\scantokens{\temp}\egroup}%
4565 \else % many
4566 \expandafter\edef\csname\the\macname\endcsname##1{%
4567 \csname\the\macname xxx\endcsname ##1,}%
4568 \expandafter\expandafter
4569 \expandafter\edef
4570 \expandafter\expandafter
4571 \csname\the\macname xxx\endcsname
4572 \paramlist{%
4573 \noexpand\norecurse{\the\macname}%
4574 \noexpand\scantokens{\temp}\egroup}%
4576 \fi}
4578 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
4580 % \braceorline decides whether the next nonwhitespace character is a
4581 % {. If so it reads up to the closing }, if not, it reads the whole
4582 % line. Whatever was read is then fed to the next control sequence
4583 % as an argument (by \parsebrace or \parsearg)
4584 \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
4585 \def\braceorlinexxx{%
4586 \ifx\nchar\bgroup\else
4587 \expandafter\parsearg
4588 \fi \next}
4591 \message{cross references,}
4592 \newwrite\auxfile
4594 \newif\ifhavexrefs % True if xref values are known.
4595 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
4597 % @inforef is relatively simple.
4598 \def\inforef #1{\inforefzzz #1,,,,**}
4599 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
4600 node \samp{\ignorespaces#1{}}}
4602 % @node's job is to define \lastnode.
4603 \def\node{\ENVcheck\parsearg\nodezzz}
4604 \def\nodezzz#1{\nodexxx [#1,]}
4605 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
4606 \let\nwnode=\node
4607 \let\lastnode=\relax
4609 % The sectioning commands (@chapter, etc.) call these.
4610 \def\donoderef{%
4611 \ifx\lastnode\relax\else
4612 \expandafter\expandafter\expandafter\setref{\lastnode}%
4613 {Ysectionnumberandtype}%
4614 \global\let\lastnode=\relax
4617 \def\unnumbnoderef{%
4618 \ifx\lastnode\relax\else
4619 \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
4620 \global\let\lastnode=\relax
4623 \def\appendixnoderef{%
4624 \ifx\lastnode\relax\else
4625 \expandafter\expandafter\expandafter\setref{\lastnode}%
4626 {Yappendixletterandtype}
4627 \global\let\lastnode=\relax
4631 % \setref{NAME}{SNT} defines a cross-reference point NAME, namely
4632 % NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have
4633 % to set \indexdummies so commands such as @code in a section title
4634 % aren't expanded. It would be nicer not to expand the titles in the
4635 % first place, but there's so many layers that that is hard to do.
4637 \def\setref#1#2{{%
4638 \indexdummies
4639 \dosetq{#1-title}{Ytitle}%
4640 \dosetq{#1-pg}{Ypagenumber}%
4641 \dosetq{#1-snt}{#2}
4644 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
4645 % the node name, #2 the name of the Info cross-reference, #3 the printed
4646 % node name, #4 the name of the Info file, #5 the name of the printed
4647 % manual. All but the node name can be omitted.
4649 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
4650 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
4651 \def\ref#1{\xrefX[#1,,,,,,,]}
4652 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
4653 \def\printedmanual{\ignorespaces #5}%
4654 \def\printednodename{\ignorespaces #3}%
4655 \setbox1=\hbox{\printedmanual}%
4656 \setbox0=\hbox{\printednodename}%
4657 \ifdim \wd0 = 0pt
4658 % No printed node name was explicitly given.
4659 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
4660 % Use the node name inside the square brackets.
4661 \def\printednodename{\ignorespaces #1}%
4662 \else
4663 % Use the actual chapter/section title appear inside
4664 % the square brackets. Use the real section title if we have it.
4665 \ifdim \wd1>0pt%
4666 % It is in another manual, so we don't have it.
4667 \def\printednodename{\ignorespaces #1}%
4668 \else
4669 \ifhavexrefs
4670 % We know the real title if we have the xref values.
4671 \def\printednodename{\refx{#1-title}{}}%
4672 \else
4673 % Otherwise just copy the Info node name.
4674 \def\printednodename{\ignorespaces #1}%
4675 \fi%
4680 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
4681 % insert empty discretionaries after hyphens, which means that it will
4682 % not find a line break at a hyphen in a node names. Since some manuals
4683 % are best written with fairly long node names, containing hyphens, this
4684 % is a loss. Therefore, we give the text of the node name again, so it
4685 % is as if TeX is seeing it for the first time.
4686 \ifdim \wd1 > 0pt
4687 \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
4688 \else
4689 % _ (for example) has to be the character _ for the purposes of the
4690 % control sequence corresponding to the node, but it has to expand
4691 % into the usual \leavevmode...\vrule stuff for purposes of
4692 % printing. So we \turnoffactive for the \refx-snt, back on for the
4693 % printing, back off for the \refx-pg.
4694 {\normalturnoffactive \refx{#1-snt}{}}%
4695 \space [\printednodename],\space
4696 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
4698 \endgroup}
4700 % \dosetq is the interface for calls from other macros
4702 % Use \normalturnoffactive so that punctuation chars such as underscore
4703 % and backslash work in node names. (\turnoffactive doesn't do \.)
4704 \def\dosetq#1#2{%
4705 {\let\folio=0
4706 \normalturnoffactive
4707 \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
4708 \iflinks
4709 \next
4714 % \internalsetq {foo}{page} expands into
4715 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
4716 % When the aux file is read, ' is the escape character
4718 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
4720 % Things to be expanded by \internalsetq
4722 \def\Ypagenumber{\folio}
4724 \def\Ytitle{\thissection}
4726 \def\Ynothing{}
4728 \def\Ysectionnumberandtype{%
4729 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
4730 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
4731 \else \ifnum \subsubsecno=0 %
4732 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
4733 \else %
4734 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
4735 \fi \fi \fi }
4737 \def\Yappendixletterandtype{%
4738 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
4739 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
4740 \else \ifnum \subsubsecno=0 %
4741 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
4742 \else %
4743 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
4744 \fi \fi \fi }
4746 \gdef\xreftie{'tie}
4748 % Use TeX 3.0's \inputlineno to get the line number, for better error
4749 % messages, but if we're using an old version of TeX, don't do anything.
4751 \ifx\inputlineno\thisisundefined
4752 \let\linenumber = \empty % Non-3.0.
4753 \else
4754 \def\linenumber{\the\inputlineno:\space}
4757 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
4758 % If its value is nonempty, SUFFIX is output afterward.
4760 \def\refx#1#2{%
4761 \expandafter\ifx\csname X#1\endcsname\relax
4762 % If not defined, say something at least.
4763 \angleleft un\-de\-fined\angleright
4764 \iflinks
4765 \ifhavexrefs
4766 \message{\linenumber Undefined cross reference `#1'.}%
4767 \else
4768 \ifwarnedxrefs\else
4769 \global\warnedxrefstrue
4770 \message{Cross reference values unknown; you must run TeX again.}%
4774 \else
4775 % It's defined, so just use it.
4776 \csname X#1\endcsname
4778 #2% Output the suffix in any case.
4781 % This is the macro invoked by entries in the aux file.
4783 \def\xrdef#1{\begingroup
4784 % Reenable \ as an escape while reading the second argument.
4785 \catcode`\\ = 0
4786 \afterassignment\endgroup
4787 \expandafter\gdef\csname X#1\endcsname
4790 % Read the last existing aux file, if any. No error if none exists.
4791 \def\readauxfile{\begingroup
4792 \catcode`\^^@=\other
4793 \catcode`\^^A=\other
4794 \catcode`\^^B=\other
4795 \catcode`\^^C=\other
4796 \catcode`\^^D=\other
4797 \catcode`\^^E=\other
4798 \catcode`\^^F=\other
4799 \catcode`\^^G=\other
4800 \catcode`\^^H=\other
4801 \catcode`\^^K=\other
4802 \catcode`\^^L=\other
4803 \catcode`\^^N=\other
4804 \catcode`\^^P=\other
4805 \catcode`\^^Q=\other
4806 \catcode`\^^R=\other
4807 \catcode`\^^S=\other
4808 \catcode`\^^T=\other
4809 \catcode`\^^U=\other
4810 \catcode`\^^V=\other
4811 \catcode`\^^W=\other
4812 \catcode`\^^X=\other
4813 \catcode`\^^Z=\other
4814 \catcode`\^^[=\other
4815 \catcode`\^^\=\other
4816 \catcode`\^^]=\other
4817 \catcode`\^^^=\other
4818 \catcode`\^^_=\other
4819 \catcode`\@=\other
4820 \catcode`\^=\other
4821 % It was suggested to define this as 7, which would allow ^^e4 etc.
4822 % in xref tags, i.e., node names. But since ^^e4 notation isn't
4823 % supported in the main text, it doesn't seem desirable. Furthermore,
4824 % that is not enough: for node names that actually contain a ^
4825 % character, we would end up writing a line like this: 'xrdef {'hat
4826 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
4827 % argument, and \hat is not an expandable control sequence. It could
4828 % all be worked out, but why? Either we support ^^ or we don't.
4830 % The other change necessary for this was to define \auxhat:
4831 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
4832 % and then to call \auxhat in \setq.
4834 \catcode`\~=\other
4835 \catcode`\[=\other
4836 \catcode`\]=\other
4837 \catcode`\"=\other
4838 \catcode`\_=\other
4839 \catcode`\|=\other
4840 \catcode`\<=\other
4841 \catcode`\>=\other
4842 \catcode`\$=\other
4843 \catcode`\#=\other
4844 \catcode`\&=\other
4845 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
4846 % Make the characters 128-255 be printing characters
4848 \count 1=128
4849 \def\loop{%
4850 \catcode\count 1=\other
4851 \advance\count 1 by 1
4852 \ifnum \count 1<256 \loop \fi
4855 % The aux file uses ' as the escape (for now).
4856 % Turn off \ as an escape so we do not lose on
4857 % entries which were dumped with control sequences in their names.
4858 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
4859 % Reference to such entries still does not work the way one would wish,
4860 % but at least they do not bomb out when the aux file is read in.
4861 \catcode`\{=1
4862 \catcode`\}=2
4863 \catcode`\%=\other
4864 \catcode`\'=0
4865 \catcode`\\=\other
4867 \openin 1 \jobname.aux
4868 \ifeof 1 \else
4869 \closein 1
4870 \input \jobname.aux
4871 \global\havexrefstrue
4872 \global\warnedobstrue
4874 % Open the new aux file. TeX will close it automatically at exit.
4875 \openout\auxfile=\jobname.aux
4876 \endgroup}
4879 % Footnotes.
4881 \newcount \footnoteno
4883 % The trailing space in the following definition for supereject is
4884 % vital for proper filling; pages come out unaligned when you do a
4885 % pagealignmacro call if that space before the closing brace is
4886 % removed. (Generally, numeric constants should always be followed by a
4887 % space to prevent strange expansion errors.)
4888 \def\supereject{\par\penalty -20000\footnoteno =0 }
4890 % @footnotestyle is meaningful for info output only.
4891 \let\footnotestyle=\comment
4893 \let\ptexfootnote=\footnote
4895 {\catcode `\@=11
4897 % Auto-number footnotes. Otherwise like plain.
4898 \gdef\footnote{%
4899 \global\advance\footnoteno by \@ne
4900 \edef\thisfootno{$^{\the\footnoteno}$}%
4902 % In case the footnote comes at the end of a sentence, preserve the
4903 % extra spacing after we do the footnote number.
4904 \let\@sf\empty
4905 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
4907 % Remove inadvertent blank space before typesetting the footnote number.
4908 \unskip
4909 \thisfootno\@sf
4910 \footnotezzz
4913 % Don't bother with the trickery in plain.tex to not require the
4914 % footnote text as a parameter. Our footnotes don't need to be so general.
4916 % Oh yes, they do; otherwise, @ifset and anything else that uses
4917 % \parseargline fail inside footnotes because the tokens are fixed when
4918 % the footnote is read. --karl, 16nov96.
4920 \long\gdef\footnotezzz{\insert\footins\bgroup
4921 % We want to typeset this text as a normal paragraph, even if the
4922 % footnote reference occurs in (for example) a display environment.
4923 % So reset some parameters.
4924 \interlinepenalty\interfootnotelinepenalty
4925 \splittopskip\ht\strutbox % top baseline for broken footnotes
4926 \splitmaxdepth\dp\strutbox
4927 \floatingpenalty\@MM
4928 \leftskip\z@skip
4929 \rightskip\z@skip
4930 \spaceskip\z@skip
4931 \xspaceskip\z@skip
4932 \parindent\defaultparindent
4934 % Hang the footnote text off the number.
4935 \hang
4936 \textindent{\thisfootno}%
4938 % Don't crash into the line above the footnote text. Since this
4939 % expands into a box, it must come within the paragraph, lest it
4940 % provide a place where TeX can split the footnote.
4941 \footstrut
4942 \futurelet\next\fo@t
4944 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
4945 \else\let\next\f@t\fi \next}
4946 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
4947 \def\f@t#1{#1\@foot}
4948 \def\@foot{\strut\egroup}
4950 }%end \catcode `\@=11
4952 % Set the baselineskip to #1, and the lineskip and strut size
4953 % correspondingly. There is no deep meaning behind these magic numbers
4954 % used as factors; they just match (closely enough) what Knuth defined.
4956 \def\lineskipfactor{.08333}
4957 \def\strutheightpercent{.70833}
4958 \def\strutdepthpercent {.29167}
4960 \def\setleading#1{%
4961 \normalbaselineskip = #1\relax
4962 \normallineskip = \lineskipfactor\normalbaselineskip
4963 \normalbaselines
4964 \setbox\strutbox =\hbox{%
4965 \vrule width0pt height\strutheightpercent\baselineskip
4966 depth \strutdepthpercent \baselineskip
4970 % @| inserts a changebar to the left of the current line. It should
4971 % surround any changed text. This approach does *not* work if the
4972 % change spans more than two lines of output. To handle that, we would
4973 % have adopt a much more difficult approach (putting marks into the main
4974 % vertical list for the beginning and end of each change).
4976 \def\|{%
4977 % \vadjust can only be used in horizontal mode.
4978 \leavevmode
4980 % Append this vertical mode material after the current line in the output.
4981 \vadjust{%
4982 % We want to insert a rule with the height and depth of the current
4983 % leading; that is exactly what \strutbox is supposed to record.
4984 \vskip-\baselineskip
4986 % \vadjust-items are inserted at the left edge of the type. So
4987 % the \llap here moves out into the left-hand margin.
4988 \llap{%
4990 % For a thicker or thinner bar, change the `1pt'.
4991 \vrule height\baselineskip width1pt
4993 % This is the space between the bar and the text.
4994 \hskip 12pt
4999 % For a final copy, take out the rectangles
5000 % that mark overfull boxes (in case you have decided
5001 % that the text looks ok even though it passes the margin).
5003 \def\finalout{\overfullrule=0pt}
5005 % @image. We use the macros from epsf.tex to support this.
5006 % If epsf.tex is not installed and @image is used, we complain.
5008 % Check for and read epsf.tex up front. If we read it only at @image
5009 % time, we might be inside a group, and then its definitions would get
5010 % undone and the next image would fail.
5011 \openin 1 = epsf.tex
5012 \ifeof 1 \else
5013 \closein 1
5014 % Do not bother showing banner with post-v2.7 epsf.tex (available in
5015 % doc/epsf.tex until it shows up on ctan).
5016 \def\epsfannounce{\toks0 = }%
5017 \input epsf.tex
5020 \newif\ifwarnednoepsf
5021 \newhelp\noepsfhelp{epsf.tex must be installed for images to
5022 work. It is also included in the Texinfo distribution, or you can get
5023 it from ftp://ftp.tug.org/tex/epsf.tex.}
5025 % Only complain once about lack of epsf.tex.
5026 \def\image#1{%
5027 \ifx\epsfbox\undefined
5028 \ifwarnednoepsf \else
5029 \errhelp = \noepsfhelp
5030 \errmessage{epsf.tex not found, images will be ignored}%
5031 \global\warnednoepsftrue
5033 \else
5034 \imagexxx #1,,,\finish
5038 % Arguments to @image:
5039 % #1 is (mandatory) image filename; we tack on .eps extension.
5040 % #2 is (optional) width, #3 is (optional) height.
5041 % #4 is just the usual extra ignored arg for parsing this stuff.
5042 \def\imagexxx#1,#2,#3,#4\finish{%
5043 % \epsfbox itself resets \epsf?size at each figure.
5044 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
5045 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
5046 % If the image is by itself, center it.
5047 \ifvmode
5048 \centerline{\epsfbox{#1.eps}}%
5049 \else
5050 \epsfbox{#1.eps}%
5055 \message{paper sizes,}
5056 % And other related parameters.
5058 \newdimen\defaultparindent \defaultparindent = 15pt
5060 \chapheadingskip = 15pt plus 4pt minus 2pt
5061 \secheadingskip = 12pt plus 3pt minus 2pt
5062 \subsecheadingskip = 9pt plus 2pt minus 2pt
5064 % Prevent underfull vbox error messages.
5065 \vbadness = 10000
5067 % Don't be so finicky about underfull hboxes, either.
5068 \hbadness = 2000
5070 % Following George Bush, just get rid of widows and orphans.
5071 \widowpenalty=10000
5072 \clubpenalty=10000
5074 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
5075 % using an old version of TeX, don't do anything. We want the amount of
5076 % stretch added to depend on the line length, hence the dependence on
5077 % \hsize. This makes it come to about 9pt for the 8.5x11 format. We
5078 % call this whenever the paper size is set.
5080 \def\setemergencystretch{%
5081 \ifx\emergencystretch\thisisundefined
5082 % Allow us to assign to \emergencystretch anyway.
5083 \def\emergencystretch{\dimen0}%
5084 \else
5085 \emergencystretch = \hsize
5086 \divide\emergencystretch by 45
5090 % Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
5091 % 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can
5092 % set \parskip and call \setleading for \baselineskip.
5094 \def\internalpagesizes#1#2#3#4#5#6{%
5095 \voffset = #3\relax
5096 \topskip = #6\relax
5097 \splittopskip = \topskip
5099 \vsize = #1\relax
5100 \advance\vsize by \topskip
5101 \outervsize = \vsize
5102 \advance\outervsize by 0.6in
5103 \pageheight = \vsize
5105 \hsize = #2\relax
5106 \outerhsize = \hsize
5107 \advance\outerhsize by 0.5in
5108 \pagewidth = \hsize
5110 \normaloffset = #4\relax
5111 \bindingoffset = #5\relax
5113 \parindent = \defaultparindent
5114 \setemergencystretch
5117 % @letterpaper (the default).
5118 \def\letterpaper{{\globaldefs = 1
5119 \parskip = 3pt plus 2pt minus 1pt
5120 \setleading{13.2pt}%
5122 % If page is nothing but text, make it come out even.
5123 \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}%
5126 % Use @smallbook to reset parameters for 7x9.5 (or so) format.
5127 \def\smallbook{{\globaldefs = 1
5128 \parskip = 2pt plus 1pt
5129 \setleading{12pt}%
5131 \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}%
5133 \lispnarrowing = 0.3in
5134 \tolerance = 700
5135 \hfuzz = 1pt
5136 \contentsrightmargin = 0pt
5137 \deftypemargin = 0pt
5138 \defbodyindent = .5cm
5140 \let\smalldisplay = \smalldisplayx
5141 \let\smallexample = \smalllispx
5142 \let\smallformat = \smallformatx
5143 \let\smalllisp = \smalllispx
5146 % Use @afourpaper to print on European A4 paper.
5147 \def\afourpaper{{\globaldefs = 1
5148 \setleading{12pt}%
5149 \parskip = 3pt plus 2pt minus 1pt
5151 \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}%
5153 \tolerance = 700
5154 \hfuzz = 1pt
5157 % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
5158 % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
5159 \def\afourlatex{{\globaldefs = 1
5160 \setleading{13.6pt}%
5162 \afourpaper
5163 \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}%
5165 \globaldefs = 0
5168 % Use @afourwide to print on European A4 paper in wide format.
5169 \def\afourwide{%
5170 \afourpaper
5171 \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
5173 \globaldefs = 0
5176 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
5177 % Perhaps we should allow setting the margins, \topskip, \parskip,
5178 % and/or leading, also. Or perhaps we should compute them somehow.
5180 \def\pagesizes{\parsearg\pagesizesxxx}
5181 \def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
5182 \def\pagesizesyyy#1,#2,#3\finish{{%
5183 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
5184 \globaldefs = 1
5186 \parskip = 3pt plus 2pt minus 1pt
5187 \setleading{13.2pt}%
5189 \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}%
5192 % Set default to letter.
5194 \letterpaper
5196 \message{and turning on texinfo input format.}
5198 % Define macros to output various characters with catcode for normal text.
5199 \catcode`\"=\other
5200 \catcode`\~=\other
5201 \catcode`\^=\other
5202 \catcode`\_=\other
5203 \catcode`\|=\other
5204 \catcode`\<=\other
5205 \catcode`\>=\other
5206 \catcode`\+=\other
5207 \def\normaldoublequote{"}
5208 \def\normaltilde{~}
5209 \def\normalcaret{^}
5210 \def\normalunderscore{_}
5211 \def\normalverticalbar{|}
5212 \def\normalless{<}
5213 \def\normalgreater{>}
5214 \def\normalplus{+}
5216 % This macro is used to make a character print one way in ttfont
5217 % where it can probably just be output, and another way in other fonts,
5218 % where something hairier probably needs to be done.
5220 % #1 is what to print if we are indeed using \tt; #2 is what to print
5221 % otherwise. Since all the Computer Modern typewriter fonts have zero
5222 % interword stretch (and shrink), and it is reasonable to expect all
5223 % typewriter fonts to have this, we can check that font parameter.
5225 \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
5227 % Turn off all special characters except @
5228 % (and those which the user can use as if they were ordinary).
5229 % Most of these we simply print from the \tt font, but for some, we can
5230 % use math or other variants that look better in normal text.
5232 \catcode`\"=\active
5233 \def\activedoublequote{{\tt\char34}}
5234 \let"=\activedoublequote
5235 \catcode`\~=\active
5236 \def~{{\tt\char126}}
5237 \chardef\hat=`\^
5238 \catcode`\^=\active
5239 \def^{{\tt \hat}}
5241 \catcode`\_=\active
5242 \def_{\ifusingtt\normalunderscore\_}
5243 % Subroutine for the previous macro.
5244 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
5246 \catcode`\|=\active
5247 \def|{{\tt\char124}}
5248 \chardef \less=`\<
5249 \catcode`\<=\active
5250 \def<{{\tt \less}}
5251 \chardef \gtr=`\>
5252 \catcode`\>=\active
5253 \def>{{\tt \gtr}}
5254 \catcode`\+=\active
5255 \def+{{\tt \char 43}}
5256 %\catcode 27=\active
5257 %\def^^[{$\diamondsuit$}
5259 % Set up an active definition for =, but don't enable it most of the time.
5260 {\catcode`\==\active
5261 \global\def={{\tt \char 61}}}
5263 \catcode`+=\active
5264 \catcode`\_=\active
5266 % If a .fmt file is being used, characters that might appear in a file
5267 % name cannot be active until we have parsed the command line.
5268 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
5269 % \otherifyactive is called near the end of this file.
5270 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
5272 \catcode`\@=0
5274 % \rawbackslashxx output one backslash character in current font
5275 \global\chardef\rawbackslashxx=`\\
5276 %{\catcode`\\=\other
5277 %@gdef@rawbackslashxx{\}}
5279 % \rawbackslash redefines \ as input to do \rawbackslashxx.
5280 {\catcode`\\=\active
5281 @gdef@rawbackslash{@let\=@rawbackslashxx }}
5283 % \normalbackslash outputs one backslash in fixed width font.
5284 \def\normalbackslash{{\tt\rawbackslashxx}}
5286 % Say @foo, not \foo, in error messages.
5287 \escapechar=`\@
5289 % \catcode 17=0 % Define control-q
5290 \catcode`\\=\active
5292 % Used sometimes to turn off (effectively) the active characters
5293 % even after parsing them.
5294 @def@turnoffactive{@let"=@normaldoublequote
5295 @let\=@realbackslash
5296 @let~=@normaltilde
5297 @let^=@normalcaret
5298 @let_=@normalunderscore
5299 @let|=@normalverticalbar
5300 @let<=@normalless
5301 @let>=@normalgreater
5302 @let+=@normalplus}
5304 @def@normalturnoffactive{@let"=@normaldoublequote
5305 @let\=@normalbackslash
5306 @let~=@normaltilde
5307 @let^=@normalcaret
5308 @let_=@normalunderscore
5309 @let|=@normalverticalbar
5310 @let<=@normalless
5311 @let>=@normalgreater
5312 @let+=@normalplus}
5314 % Make _ and + \other characters, temporarily.
5315 % This is canceled by @fixbackslash.
5316 @otherifyactive
5318 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
5319 % That is what \eatinput is for; after that, the `\' should revert to printing
5320 % a backslash.
5322 @gdef@eatinput input texinfo{@fixbackslash}
5323 @global@let\ = @eatinput
5325 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
5326 % the first `\{ in the file would cause an error. This macro tries to fix
5327 % that, assuming it is called before the first `\' could plausibly occur.
5328 % Also back turn on active characters that might appear in the input
5329 % file name, in case not using a pre-dumped format.
5331 @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
5332 @catcode`+=@active @catcode`@_=@active}
5334 % These look ok in all fonts, so just make them not special. The @rm below
5335 % makes sure that the current font starts out as the newly loaded cmr10
5336 @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
5338 @textfonts
5341 @c Local variables:
5342 @c page-delimiter: "^\\\\message"
5343 @c End: