1 %% TeX macros to handle texinfo files
3 % Copyright (C) 1985, 86, 88, 90, 91, 92, 1993 Free Software Foundation, Inc.
5 %This texinfo.tex file is free software; you can redistribute it and/or
6 %modify it under the terms of the GNU General Public License as
7 %published by the Free Software Foundation; either version 2, or (at
8 %your option) any later version.
10 %This texinfo.tex file is distributed in the hope that it will be
11 %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 %General Public License for more details.
15 %You should have received a copy of the GNU General Public License
16 %along with this texinfo.tex file; see the file COPYING. If not, write
17 %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
21 %In other words, you are welcome to use, share and improve this program.
22 %You are forbidden to forbid anyone else to use, share and improve
23 %what you give them. Help stamp out software-hoarding!
25 \def\texinfoversion{2.108}
26 \message{Loading texinfo package [Version \texinfoversion]:}
28 % Print the version number if in a .fmt file.
29 \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
31 % Save some parts of plain tex whose names we will redefine.
39 \let\ptexbullet=\bullet
47 \def\tie{\penalty 10000\ } % Save plain tex definition of ~.
52 % If this character appears in an error message or help string, it
53 % starts a new line in the output.
60 \hyphenation{ap-pen-dix}
61 \hyphenation{mini-buf-fer mini-buf-fers}
64 % Margin to add to right of even pages, to left of odd pages.
65 \newdimen \bindingoffset \bindingoffset=0pt
66 \newdimen \normaloffset \normaloffset=\hoffset
67 \newdimen\pagewidth \newdimen\pageheight
68 \pagewidth=\hsize \pageheight=\vsize
70 % Sometimes it is convenient to have everything in the transcript file
71 % and nothing on the terminal. We don't just call \tracingall here,
72 % since that produces some useless output on the terminal.
74 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
75 \def\loggingall{\tracingcommands2 \tracingstats2
76 \tracingpages1 \tracingoutput1 \tracinglostchars1
77 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
78 \showboxbreadth\maxdimen\showboxdepth\maxdimen
81 %---------------------Begin change-----------------------
83 %%%% For @cropmarks command.
84 % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
86 \newdimen\cornerlong \newdimen\cornerthick
87 \newdimen \topandbottommargin
88 \newdimen \outerhsize \newdimen \outervsize
89 \cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks
92 % Alternative @smallbook page size is 9.25in
94 \topandbottommargin=.75in
96 %---------------------End change-----------------------
98 % \onepageout takes a vbox as an argument. Note that \pagecontents
99 % does insertions itself, but you have to call it yourself.
100 \chardef\PAGE=255 \output={\onepageout{\pagecontents\PAGE}}
101 \def\onepageout#1{\hoffset=\normaloffset
102 \ifodd\pageno \advance\hoffset by \bindingoffset
103 \else \advance\hoffset by -\bindingoffset\fi
104 {\escapechar=`\\\relax % makes sure backslash is used in output files.
105 \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
106 {\let\hsize=\pagewidth \makefootline}}}%
107 \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
109 %%%% For @cropmarks command %%%%
111 % Here is a modification of the main output routine for Near East Publications
112 % This provides right-angle cropmarks at all four corners.
113 % The contents of the page are centerlined into the cropmarks,
114 % and any desired binding offset is added as an \hskip on either
115 % site of the centerlined box. (P. A. MacKay, 12 November, 1986)
117 \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
118 {\escapechar=`\\\relax % makes sure backslash is used in output files.
120 \vbox to \outervsize{\hsize=\outerhsize
121 \vbox{\line{\ewtop\hfill\ewtop}}
123 \line{\vbox{\moveleft\cornerthick\nstop}
125 \vbox{\moveright\cornerthick\nstop}}
126 \vskip \topandbottommargin
127 \centerline{\ifodd\pageno\hskip\bindingoffset\fi
129 {\let\hsize=\pagewidth \makeheadline}
131 {\let\hsize=\pagewidth \makefootline}}
132 \ifodd\pageno\else\hskip\bindingoffset\fi}
133 \vskip \topandbottommargin plus1fill minus1fill
134 \boxmaxdepth\cornerthick
135 \line{\vbox{\moveleft\cornerthick\nsbot}
137 \vbox{\moveright\cornerthick\nsbot}}
139 \vbox{\line{\ewbot\hfill\ewbot}}
142 \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
144 % Do @cropmarks to get crop marks
145 \def\cropmarks{\let\onepageout=\croppageout }
147 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
149 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
150 \dimen@=\dp#1 \unvbox#1
151 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
152 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
156 % Here are the rules for the cropmarks. Note that they are
157 % offset so that the space between them is truly \outerhsize or \outervsize
158 % (P. A. MacKay, 12 November, 1986)
160 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
162 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
163 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
165 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
167 % Parse an argument, then pass it to #1. The argument is the rest of
168 % the input line (except we remove a trailing comment). #1 should be a
169 % macro which expects an ordinary undelimited TeX argument.
175 \futurelet\temp\parseargx
178 % If the next token is an obeyed space (from an @example environment or
179 % the like), remove it and recurse. Otherwise, we're done.
181 % \obeyedspace is defined far below, after the definition of \sepspaces.
182 \ifx\obeyedspace\temp
183 \expandafter\parseargdiscardspace
185 \expandafter\parseargline
189 % Remove a single space (as the delimiter token to the macro call).
191 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
194 \gdef\parseargline#1^^M{%
195 \endgroup % End of the group started in \parsearg.
197 % First remove any @c comment, then any @comment.
198 % Result of each macro is put in \toks0.
199 \argremovec #1\c\relax %
200 \expandafter\argremovecomment \the\toks0 \comment\relax %
202 % Call the caller's macro, saved as \next in \parsearg.
203 \expandafter\next\expandafter{\the\toks0}%
207 % Since all \c{,omment} does is throw away the argument, we can let TeX
208 % do that for us. The \relax here is matched by the \relax in the call
209 % in \parseargline; it could be more or less anything, its purpose is
210 % just to delimit the argument to the \c.
211 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
212 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
214 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
215 % @end itemize @c foo
216 % will have two active spaces as part of the argument with the
217 % `itemize'. Here we remove all active spaces from #1, and assign the
220 % This loses if there are any *other* active characters besides spaces
221 % in the argument -- _ ^ +, for example -- since they get expanded.
222 % Fortunately, Texinfo does not define any such commands. (If it ever
223 % does, the catcode of the characters in questionwill have to be changed
224 % here.) But this means we cannot call \removeactivespaces as part of
225 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
226 % that \parsearg gets might well have any character at all in it.
228 \def\removeactivespaces#1{%
232 \global\toks0 = \expandafter{\temp}%
236 % Change the active space to expand to nothing.
240 \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
244 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
246 %% These are used to keep @begin/@end levels from running away
247 %% Call \inENV within environments (after a \begingroup)
248 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
250 \ifENV\errmessage{Still within an environment. Type Return to continue.}
251 \endgroup\fi} % This is not perfect, but it should reduce lossage
253 % @begin foo is the same as @foo, for now.
254 \newhelp\EMsimple{Type <Return> to continue.}
256 \outer\def\begin{\parsearg\beginxxx}
259 \expandafter\ifx\csname #1\endcsname\relax
260 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
261 \csname #1\endcsname\fi}
263 % @end foo executes the definition of \Efoo.
265 \def\end{\parsearg\endxxx}
267 \removeactivespaces{#1}%
268 \edef\endthing{\the\toks0}%
270 \expandafter\ifx\csname E\endthing\endcsname\relax
271 \expandafter\ifx\csname \endthing\endcsname\relax
272 % There's no \foo, i.e., no ``environment'' foo.
274 \errmessage{Undefined command `@end \endthing'}%
276 \unmatchedenderror\endthing
279 % Everything's ok; the right environment has been started.
280 \csname E\endthing\endcsname
284 % There is an environment #1, but it hasn't been started. Give an error.
286 \def\unmatchedenderror#1{%
288 \errmessage{This `@end #1' doesn't have a matching `@#1'}%
291 % Define the control sequence \E#1 to give an unmatched @end error.
293 \def\defineunmatchedend#1{%
294 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
298 % Single-spacing is done by various environments (specifically, in
299 % \nonfillstart and \quotations).
300 \newskip\singlespaceskip \singlespaceskip = \baselineskip
302 % Why was this kern here? It messes up equalizing space above and below
303 % environments. --karl, 6may93
304 %{\advance \baselineskip by -\singlespaceskip
305 %\kern \baselineskip}%
306 \baselineskip=\singlespaceskip
309 %% Simple single-character @ commands
312 % Kludge this until the fonts are right (grr).
313 \def\@{{\tt \char '100}}
315 % This is turned off because it was never documented
316 % and you can use @w{...} around a quote to suppress ligatures.
317 %% Define @` and @' to be the same as ` and '
318 %% but suppressing ligatures.
322 % Used to generate quoted braces.
324 \def\mylbrace {{\tt \char '173}}
325 \def\myrbrace {{\tt \char '175}}
329 % @: forces normal size whitespace following.
330 \def\:{\spacefactor=1000 }
332 % @* forces a line break.
333 \def\*{\hfil\break\hbox{}\ignorespaces}
335 % @. is an end-of-sentence period.
336 \def\.{.\spacefactor=3000 }
338 % @w prevents a word break. Without the \leavevmode, @w at the
339 % beginning of a paragraph, when TeX is still in vertical mode, would
340 % produce a whole line of output instead of starting the paragraph.
341 \def\w#1{\leavevmode\hbox{#1}}
343 % @group ... @end group forces ... to be all on one page, by enclosing
344 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
345 % to keep its height that of a normal line. According to the rules for
346 % \topskip (p.114 of the TeXbook), the glue inserted is
347 % max (\topskip - \ht (first item), 0). If that height is large,
348 % therefore, no glue is inserted, and the space between the headline and
349 % the text is small, which looks bad.
351 \def\group{\begingroup
352 \ifnum\catcode13=\active \else
353 \errhelp = \groupinvalidhelp
354 \errmessage{@group invalid in context where filling is enabled}%
357 % The \vtop we start below produces a box with normal height and large
358 % depth; thus, TeX puts \baselineskip glue before it, and (when the
359 % next line of text is done) \lineskip glue after it. (See p.82 of
360 % the TeXbook.) Thus, space below is not quite equal to space
361 % above. But it's pretty close.
363 \egroup % End the \vtop.
364 \endgroup % End the \group.
368 % We have to put a strut on the last line in case the @group is in
369 % the midst of an example, rather than completely enclosing it.
370 % Otherwise, the interline space between the last line of the group
371 % and the first line afterwards is too small. But we can't put the
372 % strut in \Egroup, since there it would be on a line by itself.
373 % Hence this just inserts a strut at the beginning of each line.
374 \everypar = {\strut}%
376 % Since we have a strut on every line, we don't need any of TeX's
377 % normal interline spacing.
380 % OK, but now we have to do something about blank
381 % lines in the input in @example-like environments, which normally
382 % just turn into \lisppar, which will insert no space now that we've
383 % turned off the interline space. Simplest is to make them be an
386 \edef\par{\leavevmode \par}%
388 % Reset ^^M's definition to new definition of \par.
392 % We do @comment here in case we are called inside an environment,
393 % such as @example, where each end-of-line in the input causes an
394 % end-of-line in the output. We don't want the end-of-line after
395 % the `@group' to put extra space in the output. Since @group
396 % should appear on a line by itself (according to the Texinfo
397 % manual), we don't worry about eating any user text.
401 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
402 % message, so this ends up printing `@group can only ...'.
404 \newhelp\groupinvalidhelp{%
405 group can only be used in environments such as @example,^^J%
406 where each line of input produces a line of output.}
408 % @need space-in-mils
409 % forces a page break if there is not space-in-mils remaining.
411 \newdimen\mil \mil=0.001in
413 \def\need{\parsearg\needx}
415 % Old definition--didn't work.
416 %\def\needx #1{\par %
417 %% This method tries to make TeX break the page naturally
418 %% if the depth of the box does not fit.
420 %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
425 % Go into vertical mode, so we don't make a big box in the middle of a
429 % Don't add any leading before our big empty box, but allow a page
430 % break, since the best break might be right here.
433 \vtop to #1\mil{\vfil}%
435 % TeX does not even consider page breaks if a penalty added to the
436 % main vertical list is 10000 or more. But in order to see if the
437 % empty box we just added fits on the page, we must make it consider
438 % page breaks. On the other hand, we don't want to actually break the
439 % page after the empty box. So we use a penalty of 9999.
441 % There is an extremely small chance that TeX will actually break the
442 % page at this \penalty, if there are no other feasible breakpoints in
443 % sight. (If the user is using lots of big @group commands, which
444 % almost-but-not-quite fill up a page, TeX will have a hard time doing
445 % good page breaking, for example.) However, I could not construct an
446 % example where a page broke at this \penalty; if it happens in a real
447 % document, then we can reconsider our strategy.
450 % Back up by the size of the box, whether we did a page break or not.
453 % Do not allow a page break right after this kern.
457 % @br forces paragraph break
461 % @dots{} output some dots
465 % @page forces the start of a new page
467 \def\page{\par\vfill\supereject}
470 % outputs text on separate line in roman font, starting at standard page margin
472 % This records the amount of indent in the innermost environment.
473 % That's how much \exdent should take out.
474 \newskip\exdentamount
476 % This defn is used inside fill environments such as @defun.
477 \def\exdent{\parsearg\exdentyyy}
478 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
480 % This defn is used inside nofill environments such as @example.
481 \def\nofillexdent{\parsearg\nofillexdentyyy}
482 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
483 \leftline{\hskip\leftskip{\rm#1}}}}
485 %\hbox{{\rm#1}}\hfil\break}}
487 % @include file insert text of that file as input.
489 \def\include{\parsearg\includezzz}
490 %Use \input\thisfile to avoid blank after \input, which may be an active
491 %char (in which case the blank would become the \input argument).
492 %The grouping keeps the value of \thisfile correct even when @include
494 \def\includezzz #1{\begingroup
495 \def\thisfile{#1}\input\thisfile
500 % @center line outputs that line, centered
502 \def\center{\parsearg\centerzzz}
503 \def\centerzzz #1{{\advance\hsize by -\leftskip
504 \advance\hsize by -\rightskip
507 % @sp n outputs n lines of vertical space
509 \def\sp{\parsearg\spxxx}
510 \def\spxxx #1{\par \vskip #1\baselineskip}
512 % @comment ...line which is ignored...
513 % @c is the same as @comment
514 % @ignore ... @end ignore is another way to write a comment
516 \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
517 \parsearg \commentxxx}
519 \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
523 % Prevent errors for section commands.
524 % Used in @ignore and in failing conditionals.
525 \def\ignoresections{%
527 \let\unnumbered=\relax
529 \let\unnumberedsec=\relax
530 \let\unnumberedsection=\relax
531 \let\unnumberedsubsec=\relax
532 \let\unnumberedsubsection=\relax
533 \let\unnumberedsubsubsec=\relax
534 \let\unnumberedsubsubsection=\relax
537 \let\subsubsec=\relax
538 \let\subsection=\relax
539 \let\subsubsection=\relax
541 \let\appendixsec=\relax
542 \let\appendixsection=\relax
543 \let\appendixsubsec=\relax
544 \let\appendixsubsection=\relax
545 \let\appendixsubsubsec=\relax
546 \let\appendixsubsubsection=\relax
548 \let\smallbook=\relax
549 \let\titlepage=\relax
552 % Used in nested conditionals, where we have to parse the Texinfo source
553 % and so want to turn off most commands, in case they are used
556 \def\ignoremorecommands{%
560 \let\defindex = \relax
561 \let\defivar = \relax
563 \let\defmethod = \relax
566 \let\defspec = \relax
568 \let\deftypefn = \relax
569 \let\deftypefun = \relax
570 \let\deftypevar = \relax
571 \let\deftypevr = \relax
577 \let\printindex = \relax
579 \let\settitle = \relax
580 \let\include = \relax
581 \let\lowersections = \relax
583 \let\raisesections = \relax
589 % Ignore @ignore ... @end ignore.
591 \def\ignore{\doignore{ignore}}
593 % Also ignore @ifinfo, @menu, and @direntry text.
595 \def\ifinfo{\doignore{ifinfo}}
596 \def\menu{\doignore{menu}}
597 \def\direntry{\doignore{direntry}}
599 % Ignore text until a line `@end #1'.
601 \def\doignore#1{\begingroup
602 % Don't complain about control sequences we have declared \outer.
605 % Define a command to swallow text until we reach `@end #1'.
606 \long\def\doignoretext##1\end #1{\enddoignore}%
608 % Make sure that spaces turn into tokens that match what \doignoretext wants.
611 % And now expand that command.
615 % What we do to finish off ignored text.
617 \def\enddoignore{\endgroup\ignorespaces}%
619 \newif\ifwarnedobs\warnedobsfalse
621 \ifwarnedobs\relax\else
622 % We need to warn folks that they may have trouble with TeX 3.0.
623 % This uses \immediate\write16 rather than \message to get newlines.
625 \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
626 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
627 \immediate\write16{If you are running another version of TeX, relax.}
628 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
629 \immediate\write16{ Then upgrade your TeX installation if you can.}
630 \immediate\write16{If you are stuck with version 3.0, run the}
631 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
632 \immediate\write16{ to use a workaround.}
638 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
639 % workaround (which requires the file ``dummy.tfm'' to be installed),
640 % uncomment the following line:
641 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
643 % Ignore text, except that we keep track of conditional commands for
644 % purposes of nesting, up to an `@end #1' command.
646 \def\nestedignore#1{%
648 % We must actually expand the ignored text to look for the @end
649 % command, so that nested ignore constructs work. Thus, we put the
650 % text into a \vbox and then do nothing with the result. To minimize
651 % the change of memory overflow, we follow the approach outlined on
652 % page 401 of the TeXbook: make the current font be a dummy font.
654 \setbox0 = \vbox\bgroup
655 % Don't complain about control sequences we have declared \outer.
658 % Define `@end #1' to end the box, which will in turn undefine the
659 % @end command again.
660 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
662 % We are going to be parsing Texinfo commands. Most cause no
663 % trouble when they are used incorrectly, but some commands do
664 % complicated argument parsing or otherwise get confused, so we
667 % We can't do anything about stray @-signs, unfortunately;
668 % they'll produce `undefined control sequence' errors.
671 % Set the current font to be \nullfont, a TeX primitive, and define
672 % all the font commands to also use \nullfont. We don't use
673 % dummy.tfm, as suggested in the TeXbook, because not all sites
674 % might have that installed. Therefore, math mode will still
675 % produce output, but that should be an extremely small amount of
676 % stuff compared to the main input.
679 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
680 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
681 \let\tensf = \nullfont
683 % Don't complain when characters are missing from the fonts.
684 \tracinglostchars = 0
686 % Don't bother to do space factor calculations.
689 % Don't report underfull hboxes.
692 % Do minimal line-breaking.
693 \pretolerance = 10000
695 % Do not execute instructions in @tex
696 \def\tex{\doignore{tex}}
699 % @set VAR sets the variable VAR to an empty value.
700 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
702 % Since we want to separate VAR from REST-OF-LINE (which might be
703 % empty), we can't just use \parsearg; we have to insert a space of our
704 % own to delimit the rest of the line, and then take it out again if we
707 \def\set{\parsearg\setxxx}
708 \def\setxxx#1{\setyyy#1 \endsetyyy}
709 \def\setyyy#1 #2\endsetyyy{%
711 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
712 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
715 \def\setzzz#1#2 \endsetzzz{\expandafter\xdef\csname SET#1\endcsname{#2}}
717 % @clear VAR clears (i.e., unsets) the variable VAR.
719 \def\clear{\parsearg\clearxxx}
720 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
722 % @value{foo} gets the text saved in variable foo.
724 \def\value#1{\expandafter
725 \ifx\csname SET#1\endcsname\relax
726 {\{No value for ``#1''\}}
727 \else \csname SET#1\endcsname \fi}
729 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
732 \def\ifset{\parsearg\ifsetxxx}
734 \expandafter\ifx\csname SET#1\endcsname\relax
735 \expandafter\ifsetfail
737 \expandafter\ifsetsucceed
740 \def\ifsetsucceed{\conditionalsucceed{ifset}}
741 \def\ifsetfail{\nestedignore{ifset}}
742 \defineunmatchedend{ifset}
744 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
745 % defined with @set, or has been undefined with @clear.
747 \def\ifclear{\parsearg\ifclearxxx}
749 \expandafter\ifx\csname SET#1\endcsname\relax
750 \expandafter\ifclearsucceed
752 \expandafter\ifclearfail
755 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
756 \def\ifclearfail{\nestedignore{ifclear}}
757 \defineunmatchedend{ifclear}
759 % @iftex always succeeds; we read the text following, through @end
760 % iftex). But `@end iftex' should be valid only after an @iftex.
762 \def\iftex{\conditionalsucceed{iftex}}
763 \defineunmatchedend{iftex}
765 % We can't just want to start a group at @iftex (for example) and end it
766 % at @end iftex, since then @set commands inside the conditional have no
767 % effect (they'd get reverted at the end of the group). So we must
768 % define \Eiftex to redefine itself to be its previous value. (We can't
769 % just define it to fail again with an ``unmatched end'' error, since
770 % the @ifset might be nested.)
772 \def\conditionalsucceed#1{%
774 % Remember the current value of \E#1.
775 \let\nece{prevE#1} = \nece{E#1}%
777 % At the `@end #1', redefine \E#1 to be its previous value.
778 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
783 % We need to expand lots of \csname's, but we don't want to expand the
784 % control sequences after we've constructed them.
786 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
788 % @asis just yields its argument. Used with @table, for example.
792 % @math means output in math mode.
793 % We don't use $'s directly in the definition of \math because control
794 % sequences like \math are expanded when the toc file is written. Then,
795 % we read the toc file back, the $'s will be normal characters (as they
796 % should be, according to the definition of Texinfo). So we must use a
797 % control sequence to switch into and out of math mode.
799 % This isn't quite enough for @math to work properly in indices, but it
800 % seems unlikely it will ever be needed there.
802 \let\implicitmath = $
803 \def\math#1{\implicitmath #1\implicitmath}
805 % @bullet and @minus need the same treatment as @math, just above.
806 \def\bullet{\implicitmath\ptexbullet\implicitmath}
807 \def\minus{\implicitmath-\implicitmath}
809 \def\node{\ENVcheck\parsearg\nodezzz}
810 \def\nodezzz#1{\nodexxx [#1,]}
811 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
815 \def\donoderef{\ifx\lastnode\relax\else
816 \expandafter\expandafter\expandafter\setref{\lastnode}\fi
817 \let\lastnode=\relax}
819 \def\unnumbnoderef{\ifx\lastnode\relax\else
820 \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
821 \let\lastnode=\relax}
823 \def\appendixnoderef{\ifx\lastnode\relax\else
824 \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
825 \let\lastnode=\relax}
829 % @setfilename is done at the beginning of every texinfo file.
830 % So open here the files we need to have open while reading the input.
831 % This makes it possible to make a .fmt file for texinfo.
836 \fixbackslash % Turn off hack to swallow `\input texinfo'.
837 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
838 \comment % Ignore the actual filename.
841 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
843 \def\inforef #1{\inforefzzz #1,,,,**}
844 \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\ignorespaces #3{}},
845 node \samp{\ignorespaces#1{}}}
849 % Font-change commands.
851 % Texinfo supports the sans serif font style, which plain TeX does not.
852 % So we set up a \sf analogous to plain's \rm, etc.
854 \def\sf{\fam=\sffam \tensf}
855 \let\li = \sf % Sometimes we call it \li, not \sf.
857 %% Try out Computer Modern fonts at \magstephalf
858 \let\mainmagstep=\magstephalf
861 \let\mainmagstep=\magstep1
865 \font\textrm=cmr10 scaled \mainmagstep
866 \font\texttt=cmtt10 scaled \mainmagstep
868 % Instead of cmb10, you many want to use cmbx10.
869 % cmbx10 is a prettier font on its own, but cmb10
870 % looks better when embedded in a line with cmr10.
871 \font\textbf=cmb10 scaled \mainmagstep
872 \font\textit=cmti10 scaled \mainmagstep
873 \font\textsl=cmsl10 scaled \mainmagstep
874 \font\textsf=cmss10 scaled \mainmagstep
875 \font\textsc=cmcsc10 scaled \mainmagstep
876 \font\texti=cmmi10 scaled \mainmagstep
877 \font\textsy=cmsy10 scaled \mainmagstep
879 % A few fonts for @defun, etc.
880 \font\defbf=cmbx10 scaled \magstep1 %was 1314
881 \font\deftt=cmtt10 scaled \magstep1
882 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
884 % Fonts for indices and small examples.
885 % We actually use the slanted font rather than the italic,
886 % because texinfo normally uses the slanted fonts for that.
887 % Do not make many font distinctions in general in the index, since they
888 % aren't very useful.
901 \font\chaprm=cmbx12 scaled \magstep2
902 \font\chapit=cmti12 scaled \magstep2
903 \font\chapsl=cmsl12 scaled \magstep2
904 \font\chaptt=cmtt12 scaled \magstep2
905 \font\chapsf=cmss12 scaled \magstep2
907 \font\chapsc=cmcsc10 scaled\magstep3
908 \font\chapi=cmmi12 scaled \magstep2
909 \font\chapsy=cmsy10 scaled \magstep3
911 \font\secrm=cmbx12 scaled \magstep1
912 \font\secit=cmti12 scaled \magstep1
913 \font\secsl=cmsl12 scaled \magstep1
914 \font\sectt=cmtt12 scaled \magstep1
915 \font\secsf=cmss12 scaled \magstep1
916 \font\secbf=cmbx12 scaled \magstep1
917 \font\secsc=cmcsc10 scaled\magstep2
918 \font\seci=cmmi12 scaled \magstep1
919 \font\secsy=cmsy10 scaled \magstep2
921 % \font\ssecrm=cmbx10 scaled \magstep1 % This size an font looked bad.
922 % \font\ssecit=cmti10 scaled \magstep1 % The letters were too crowded.
923 % \font\ssecsl=cmsl10 scaled \magstep1
924 % \font\ssectt=cmtt10 scaled \magstep1
925 % \font\ssecsf=cmss10 scaled \magstep1
927 %\font\ssecrm=cmb10 scaled 1315 % Note the use of cmb rather than cmbx.
928 %\font\ssecit=cmti10 scaled 1315 % Also, the size is a little larger than
929 %\font\ssecsl=cmsl10 scaled 1315 % being scaled magstep1.
930 %\font\ssectt=cmtt10 scaled 1315
931 %\font\ssecsf=cmss10 scaled 1315
935 \font\ssecrm=cmbx12 scaled \magstephalf
936 \font\ssecit=cmti12 scaled \magstephalf
937 \font\ssecsl=cmsl12 scaled \magstephalf
938 \font\ssectt=cmtt12 scaled \magstephalf
939 \font\ssecsf=cmss12 scaled \magstephalf
940 \font\ssecbf=cmbx12 scaled \magstephalf
941 \font\ssecsc=cmcsc10 scaled \magstep1
942 \font\sseci=cmmi12 scaled \magstephalf
943 \font\ssecsy=cmsy10 scaled \magstep1
944 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
945 % but that is not a standard magnification.
947 % Fonts for title page:
948 \font\titlerm = cmbx12 scaled \magstep3
949 \let\authorrm = \secrm
951 % In order for the font changes to affect most math symbols and letters,
952 % we have to define the \textfont of the standard families. Since
953 % texinfo doesn't allow for producing subscripts and superscripts, we
954 % don't bother to reset \scriptfont and \scriptscriptfont (which would
955 % also require loading a lot more fonts).
957 \def\resetmathfonts{%
958 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
959 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
960 \textfont\ttfam = \tentt \textfont\sffam = \tensf
964 % The font-changing commands redefine the meanings of \tenSTYLE, instead
965 % of just \STYLE. We do this so that font changes will continue to work
966 % in math mode, where it is the current \fam that is relevant in most
967 % cases, not the current. Plain TeX does, for example,
968 % \def\bf{\fam=\bffam \tenbf} By redefining \tenbf, we obviate the need
969 % to redefine \bf itself.
971 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
972 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
973 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
976 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
977 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
978 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
981 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
982 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
983 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
986 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
987 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
988 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
991 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
992 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
993 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
996 % Set up the default fonts, so we can use them for creating boxes.
1000 % Count depth in font-changes, for error checks
1001 \newcount\fontdepth \fontdepth=0
1003 % Fonts for short table of contents.
1004 \font\shortcontrm=cmr12
1005 \font\shortcontbf=cmbx12
1006 \font\shortcontsl=cmsl12
1008 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1009 %% serif) and @ii for TeX italic
1011 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1012 % unless the following character is such as not to need one.
1013 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1014 \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
1017 \let\var=\smartitalic
1018 \let\dfn=\smartitalic
1019 \let\emph=\smartitalic
1020 \let\cite=\smartitalic
1025 % We can't just use \exhyphenpenalty, because that only has effect at
1026 % the end of a paragraph. Restore normal hyphenation at the end of the
1027 % group within which \nohyphenation is presumably called.
1029 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1030 \def\restorehyphenation{\hyphenchar\font = `- }
1033 {\tt \nohyphenation \rawbackslash \frenchspacing #1}%
1037 %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
1038 \def\samp #1{`\tclose{#1}'\null}
1039 \def\key #1{{\tt \nohyphenation \uppercase{#1}}\null}
1040 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1044 % @code is a modification of @t,
1045 % which makes spaces the same size as normal in the surrounding text.
1048 % Change normal interword space to be same as for the current font.
1049 \spaceskip = \fontdimen2\font
1051 % Switch to typewriter.
1054 % But `\ ' produces the large typewriter interword space.
1055 \def\ {{\spaceskip = 0pt{} }}%
1057 % Turn off hyphenation.
1067 % We *must* turn on hyphenation at `-' and `_' in \code.
1068 % Otherwise, it is too hard to avoid overful hboxes
1069 % in the Emacs manual, the Library manual, etc.
1071 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1072 % both hyphenation at - and hyphenation within words.
1073 % We must therefore turn them both off (\tclose does that)
1074 % and arrange explicitly to hyphenate an a dash.
1077 \catcode `\-=\active
1078 \catcode `\_=\active
1079 \global\def\code{\begingroup \catcode `\-=\active \let-\codedash \let_\codeunder \codex}
1081 \def\codedash{-\discretionary{}{}{}}
1082 \def\codeunder{\normalunderscore\discretionary{}{}{}}
1083 \def\codex #1{\tclose{#1}\endgroup}
1085 %\let\exp=\tclose %Was temporary
1087 % @kbd is like @code, except that if the argument is just one @key command,
1088 % then @kbd has no effect.
1091 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1092 \ifx\one\xkey\ifx\threex\three \key{#2}%
1093 \else\tclose{\look}\fi
1094 \else\tclose{\look}\fi}
1096 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1097 % argument is to make the input look right: @dmn{pt} instead of
1100 \def\dmn#1{\thinspace #1}
1102 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1104 \def\l#1{{\li #1}\null} %
1106 \def\r#1{{\rm #1}} % roman font
1107 % Use of \lowercase was suggested.
1108 \def\sc#1{{\smallcaps#1}} % smallcaps font
1109 \def\ii#1{{\it #1}} % italic font
1111 \message{page headings,}
1113 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1114 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1116 % First the title page. Must do @settitle before @titlepage.
1117 \def\titlefont#1{{\titlerm #1}}
1120 \newif\iffinishedtitlepage
1122 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1123 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1124 \endgroup\page\hbox{}\page}
1126 \def\titlepage{\begingroup \parindent=0pt \textfonts
1127 \let\subtitlerm=\tenrm
1128 % I deinstalled the following change because \cmr12 is undefined.
1129 % This change was not in the ChangeLog anyway. --rms.
1130 % \let\subtitlerm=\cmr12
1131 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1133 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1135 % Leave some space at the very top of the page.
1136 \vglue\titlepagetopglue
1138 % Now you can print the title using @title.
1139 \def\title{\parsearg\titlezzz}%
1140 \def\titlezzz##1{\leftline{\titlefont{##1}}
1141 % print a rule at the page bottom also.
1142 \finishedtitlepagefalse
1143 \vskip4pt \hrule height 4pt \vskip4pt}%
1144 % No rule at page bottom unless we print one at the top with @title.
1145 \finishedtitlepagetrue
1147 % Now you can put text using @subtitle.
1148 \def\subtitle{\parsearg\subtitlezzz}%
1149 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1151 % @author should come last, but may come many times.
1152 \def\author{\parsearg\authorzzz}%
1153 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1154 {\authorfont \leftline{##1}}}%
1156 % Most title ``pages'' are actually two pages long, with space
1157 % at the top of the second. We don't want the ragged left on the second.
1158 \let\oldpage = \page
1160 \iffinishedtitlepage\else
1164 \let\page = \oldpage
1166 % \def\page{\oldpage \hbox{}}
1170 \iffinishedtitlepage\else
1173 % It is important to do the page break before ending the group,
1174 % because the headline and footline are only empty inside the group.
1175 % If we use the new definition of \page, we always get a blank page
1176 % after the title page, which we certainly don't want.
1182 \def\finishtitlepage{%
1183 \vskip4pt \hrule height 2pt
1184 \vskip\titlepagebottomglue
1185 \finishedtitlepagetrue
1188 %%% Set up page headings and footings.
1190 \let\thispage=\folio
1192 \newtoks \evenheadline % Token sequence for heading line of even pages
1193 \newtoks \oddheadline % Token sequence for heading line of odd pages
1194 \newtoks \evenfootline % Token sequence for footing line of even pages
1195 \newtoks \oddfootline % Token sequence for footing line of odd pages
1197 % Now make Tex use those variables
1198 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1199 \else \the\evenheadline \fi}}
1200 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1201 \else \the\evenfootline \fi}\HEADINGShook}
1202 \let\HEADINGShook=\relax
1204 % Commands to set those variables.
1205 % For example, this is what @headings on does
1206 % @evenheading @thistitle|@thispage|@thischapter
1207 % @oddheading @thischapter|@thispage|@thistitle
1208 % @evenfooting @thisfile||
1209 % @oddfooting ||@thisfile
1211 \def\evenheading{\parsearg\evenheadingxxx}
1212 \def\oddheading{\parsearg\oddheadingxxx}
1213 \def\everyheading{\parsearg\everyheadingxxx}
1215 \def\evenfooting{\parsearg\evenfootingxxx}
1216 \def\oddfooting{\parsearg\oddfootingxxx}
1217 \def\everyfooting{\parsearg\everyfootingxxx}
1221 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1222 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1223 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1225 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1226 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1227 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1229 \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
1230 \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
1231 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
1232 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1234 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1235 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1236 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1238 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1239 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1240 \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1242 \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
1243 \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
1244 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
1245 \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1247 }% unbind the catcode of @.
1249 % @headings double turns headings on for double-sided printing.
1250 % @headings single turns headings on for single-sided printing.
1251 % @headings off turns them off.
1252 % @headings on same as @headings double, retained for compatibility.
1253 % @headings after turns on double-sided headings after this page.
1254 % @headings doubleafter turns on double-sided headings after this page.
1255 % @headings singleafter turns on single-sided headings after this page.
1256 % By default, they are off.
1258 \def\headings #1 {\csname HEADINGS#1\endcsname}
1261 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1262 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1264 % When we turn headings on, set the page number to 1.
1265 % For double-sided printing, put current file name in lower left corner,
1266 % chapter name on inside top of right hand pages, document
1267 % title on inside top of left hand pages, and page numbers on outside top
1268 % edge of all pages.
1269 \def\HEADINGSdouble{
1272 \global\evenfootline={\hfil}
1273 \global\oddfootline={\hfil}
1274 \global\evenheadline={\line{\folio\hfil\thistitle}}
1275 \global\oddheadline={\line{\thischapter\hfil\folio}}
1277 % For single-sided printing, chapter title goes across top left of page,
1278 % page number on top right.
1279 \def\HEADINGSsingle{
1282 \global\evenfootline={\hfil}
1283 \global\oddfootline={\hfil}
1284 \global\evenheadline={\line{\thischapter\hfil\folio}}
1285 \global\oddheadline={\line{\thischapter\hfil\folio}}
1287 \def\HEADINGSon{\HEADINGSdouble}
1289 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1290 \let\HEADINGSdoubleafter=\HEADINGSafter
1291 \def\HEADINGSdoublex{%
1292 \global\evenfootline={\hfil}
1293 \global\oddfootline={\hfil}
1294 \global\evenheadline={\line{\folio\hfil\thistitle}}
1295 \global\oddheadline={\line{\thischapter\hfil\folio}}
1298 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1299 \def\HEADINGSsinglex{%
1300 \global\evenfootline={\hfil}
1301 \global\oddfootline={\hfil}
1302 \global\evenheadline={\line{\thischapter\hfil\folio}}
1303 \global\oddheadline={\line{\thischapter\hfil\folio}}
1306 % Subroutines used in generating headings
1307 % Produces Day Month Year style of output.
1308 \def\today{\number\day\space
1310 January\or February\or March\or April\or May\or June\or
1311 July\or August\or September\or October\or November\or December\fi
1314 % Use this if you want the Month Day, Year style of output.
1315 %\def\today{\ifcase\month\or
1316 %January\or February\or March\or April\or May\or June\or
1317 %July\or August\or September\or October\or November\or December\fi
1318 %\space\number\day, \number\year}
1320 % @settitle line... specifies the title of the document, for headings
1321 % It generates no output of its own
1323 \def\thistitle{No Title}
1324 \def\settitle{\parsearg\settitlezzz}
1325 \def\settitlezzz #1{\gdef\thistitle{#1}}
1329 % @tabs -- simple alignment
1331 % These don't work. For one thing, \+ is defined as outer.
1332 % So these macros cannot even be defined.
1334 %\def\tabs{\parsearg\tabszzz}
1335 %\def\tabszzz #1{\settabs\+#1\cr}
1336 %\def\tabline{\parsearg\tablinezzz}
1337 %\def\tablinezzz #1{\+#1\cr}
1340 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1342 % default indentation of table text
1343 \newdimen\tableindent \tableindent=.8in
1344 % default indentation of @itemize and @enumerate text
1345 \newdimen\itemindent \itemindent=.3in
1346 % margin between end of table item and start of table text.
1347 \newdimen\itemmargin \itemmargin=.1in
1349 % used internally for \itemindent minus \itemmargin
1352 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1354 % They also define \itemindex
1355 % to index the item name in whatever manner is desired (perhaps none).
1357 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1358 \def\internalBitemx{\par \parsearg\itemzzz}
1360 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1361 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
1363 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1364 \def\internalBkitemx{\par \parsearg\kitemzzz}
1366 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1369 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1372 \def\itemzzz #1{\begingroup %
1373 \advance\hsize by -\rightskip
1374 \advance\hsize by -\tableindent
1375 \setbox0=\hbox{\itemfont{#1}}%
1377 \nobreak % This prevents a break before @itemx.
1379 % Be sure we are not still in the middle of a paragraph.
1384 % If the item text does not fit in the space we have, put it on a line
1385 % by itself, and do not allow a page break either before or after that
1386 % line. We do not start a paragraph here because then if the next
1387 % command is, e.g., @kindex, the whatsit would get put into the
1388 % horizontal list on a line by itself, resulting in extra blank space.
1389 \ifdim \wd0>\itemmax
1390 \setbox0=\hbox{\hskip \leftskip \hskip -\tableindent \unhbox0}\box0
1392 % We're going to be starting a paragraph, but we don't want the
1393 % \parskip glue -- logically it's part of the @item we just started.
1394 \nobreak \vskip-\parskip
1396 % Stop a page break at the \parskip glue coming up. Unfortunately
1397 % we can't prevent a possible page break at the following
1398 % \baselineskip glue.
1401 % The item text fits into the space. Start a paragraph, so that the
1402 % following text (if any) will end up on the same line. Since that
1403 % text will be indented by \tableindent, we make the item text be in
1406 \rlap{\hskip -\tableindent\box0}%
1411 \def\item{\errmessage{@item while not in a table}}
1412 \def\itemx{\errmessage{@itemx while not in a table}}
1413 \def\kitem{\errmessage{@kitem while not in a table}}
1414 \def\kitemx{\errmessage{@kitemx while not in a table}}
1415 \def\xitem{\errmessage{@xitem while not in a table}}
1416 \def\xitemx{\errmessage{@xitemx while not in a table}}
1418 %% Contains a kludge to get @end[description] to work
1419 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1421 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1422 {\obeylines\obeyspaces%
1423 \gdef\tablex #1^^M{%
1424 \tabley\dontindex#1 \endtabley}}
1426 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1427 {\obeylines\obeyspaces%
1428 \gdef\ftablex #1^^M{%
1429 \tabley\fnitemindex#1 \endtabley
1430 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1431 \let\Etable=\relax}}
1433 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1434 {\obeylines\obeyspaces%
1435 \gdef\vtablex #1^^M{%
1436 \tabley\vritemindex#1 \endtabley
1437 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1438 \let\Etable=\relax}}
1441 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1442 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1445 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1446 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1448 \def\tablez #1#2#3#4#5#6{%
1451 \def\Edescription{\Etable}% Neccessary kludge.
1453 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1454 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1455 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1457 \itemmax=\tableindent %
1458 \advance \itemmax by -\itemmargin %
1459 \advance \leftskip by \tableindent %
1460 \exdentamount=\tableindent
1462 \parskip = \smallskipamount
1463 \ifdim \parskip=0pt \parskip=2pt \fi%
1464 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1465 \let\item = \internalBitem %
1466 \let\itemx = \internalBitemx %
1467 \let\kitem = \internalBkitem %
1468 \let\kitemx = \internalBkitemx %
1469 \let\xitem = \internalBxitem %
1470 \let\xitemx = \internalBxitemx %
1473 % This is the counter used by @enumerate, which is really @itemize
1477 \def\itemize{\parsearg\itemizezzz}
1479 \def\itemizezzz #1{%
1480 \begingroup % ended by the @end itemsize
1481 \itemizey {#1}{\Eitemize}
1484 \def\itemizey #1#2{%
1486 \itemmax=\itemindent %
1487 \advance \itemmax by -\itemmargin %
1488 \advance \leftskip by \itemindent %
1489 \exdentamount=\itemindent
1491 \parskip = \smallskipamount %
1492 \ifdim \parskip=0pt \parskip=2pt \fi%
1493 \def#2{\endgraf\afterenvbreak\endgroup}%
1494 \def\itemcontents{#1}%
1495 \let\item=\itemizeitem}
1497 % Set sfcode to normal for the chars that usually have another value.
1498 % These are `.?!:;,'
1499 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1500 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1502 % \splitoff TOKENS\endmark defines \first to be the first token in
1503 % TOKENS, and \rest to be the remainder.
1505 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1507 % Allow an optional argument of an uppercase letter, lowercase letter,
1508 % or number, to specify the first label in the enumerated list. No
1509 % argument is the same as `1'.
1511 \def\enumerate{\parsearg\enumeratezzz}
1512 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1513 \def\enumeratey #1 #2\endenumeratey{%
1514 \begingroup % ended by the @end enumerate
1516 % If we were given no argument, pretend we were given `1'.
1518 \ifx\thearg\empty \def\thearg{1}\fi
1520 % Detect if the argument is a single token. If so, it might be a
1521 % letter. Otherwise, the only valid thing it can be is a number.
1522 % (We will always have one token, because of the test we just made.
1523 % This is a good thing, since \splitoff doesn't work given nothing at
1524 % all -- the first parameter is undelimited.)
1525 \expandafter\splitoff\thearg\endmark
1527 % Only one token in the argument. It could still be anything.
1528 % A ``lowercase letter'' is one whose \lccode is nonzero.
1529 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1530 % not equal to itself.
1531 % Otherwise, we assume it's a number.
1533 % We need the \relax at the end of the \ifnum lines to stop TeX from
1534 % continuing to look for a <number>.
1536 \ifnum\lccode\expandafter`\thearg=0\relax
1537 \numericenumerate % a number (we hope)
1540 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1541 \lowercaseenumerate % lowercase letter
1543 \uppercaseenumerate % uppercase letter
1547 % Multiple tokens in the argument. We hope it's a number.
1552 % An @enumerate whose labels are integers. The starting integer is
1555 \def\numericenumerate{%
1557 \startenumeration{\the\itemno}%
1560 % The starting (lowercase) letter is in \thearg.
1561 \def\lowercaseenumerate{%
1562 \itemno = \expandafter`\thearg
1564 % Be sure we're not beyond the end of the alphabet.
1566 \errmessage{No more lowercase letters in @enumerate; get a bigger
1573 % The starting (uppercase) letter is in \thearg.
1574 \def\uppercaseenumerate{%
1575 \itemno = \expandafter`\thearg
1577 % Be sure we're not beyond the end of the alphabet.
1579 \errmessage{No more uppercase letters in @enumerate; get a bigger
1586 % Call itemizey, adding a period to the first argument and supplying the
1587 % common last two arguments. Also subtract one from the initial value in
1588 % \itemno, since @item increments \itemno.
1590 \def\startenumeration#1{%
1591 \advance\itemno by -1
1592 \itemizey{#1.}\Eenumerate\flushcr
1595 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
1598 \def\alphaenumerate{\enumerate{a}}
1599 \def\capsenumerate{\enumerate{A}}
1600 \def\Ealphaenumerate{\Eenumerate}
1601 \def\Ecapsenumerate{\Eenumerate}
1603 % Definition of @item while inside @itemize.
1606 \advance\itemno by 1
1607 {\let\par=\endgraf \smallbreak}%
1608 \ifhmode \errmessage{\in hmode at itemizeitem}\fi
1609 {\parskip=0in \hskip 0pt
1610 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
1611 \vadjust{\penalty 1200}}%
1615 % Index generation facilities
1617 % Define \newwrite to be identical to plain tex's \newwrite
1618 % except not \outer, so it can be used within \newindex.
1620 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
1622 % \newindex {foo} defines an index named foo.
1623 % It automatically defines \fooindex such that
1624 % \fooindex ...rest of line... puts an entry in the index foo.
1625 % It also defines \fooindfile to be the number of the output channel for
1626 % the file that accumulates this index. The file's extension is foo.
1627 % The name of an index should be no more than 2 characters long
1628 % for the sake of vms.
1631 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
1632 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
1633 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1634 \noexpand\doindex {#1}}
1637 % @defindex foo == \newindex{foo}
1639 \def\defindex{\parsearg\newindex}
1641 % Define @defcodeindex, like @defindex except put all entries in @code.
1643 \def\newcodeindex #1{
1644 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
1645 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
1646 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1647 \noexpand\docodeindex {#1}}
1650 \def\defcodeindex{\parsearg\newcodeindex}
1652 % @synindex foo bar makes index foo feed into index bar.
1653 % Do this instead of @defindex foo if you don't want it as a separate index.
1654 \def\synindex #1 #2 {%
1655 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
1656 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
1657 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1658 \noexpand\doindex {#2}}%
1661 % @syncodeindex foo bar similar, but put all entries made for index foo
1663 \def\syncodeindex #1 #2 {%
1664 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
1665 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
1666 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1667 \noexpand\docodeindex {#2}}%
1670 % Define \doindex, the driver for all \fooindex macros.
1671 % Argument #1 is generated by the calling \fooindex macro,
1672 % and it is "foo", the name of the index.
1674 % \doindex just uses \parsearg; it calls \doind for the actual work.
1675 % This is because \doind is more useful to call from other macros.
1677 % There is also \dosubind {index}{topic}{subtopic}
1678 % which makes an entry in a two-level index such as the operation index.
1680 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
1681 \def\singleindexer #1{\doind{\indexname}{#1}}
1683 % like the previous two, but they put @code around the argument.
1684 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
1685 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
1688 \def\_{{\realbackslash _}}%
1689 \def\w{\realbackslash w }%
1690 \def\bf{\realbackslash bf }%
1691 \def\rm{\realbackslash rm }%
1692 \def\sl{\realbackslash sl }%
1693 \def\sf{\realbackslash sf}%
1694 \def\tt{\realbackslash tt}%
1695 \def\gtr{\realbackslash gtr}%
1696 \def\less{\realbackslash less}%
1697 \def\hat{\realbackslash hat}%
1698 \def\char{\realbackslash char}%
1699 \def\TeX{\realbackslash TeX}%
1700 \def\dots{\realbackslash dots }%
1701 \def\copyright{\realbackslash copyright }%
1702 \def\tclose##1{\realbackslash tclose {##1}}%
1703 \def\code##1{\realbackslash code {##1}}%
1704 \def\samp##1{\realbackslash samp {##1}}%
1705 \def\t##1{\realbackslash r {##1}}%
1706 \def\r##1{\realbackslash r {##1}}%
1707 \def\i##1{\realbackslash i {##1}}%
1708 \def\b##1{\realbackslash b {##1}}%
1709 \def\cite##1{\realbackslash cite {##1}}%
1710 \def\key##1{\realbackslash key {##1}}%
1711 \def\file##1{\realbackslash file {##1}}%
1712 \def\var##1{\realbackslash var {##1}}%
1713 \def\kbd##1{\realbackslash kbd {##1}}%
1714 \def\dfn##1{\realbackslash dfn {##1}}%
1715 \def\emph##1{\realbackslash emph {##1}}%
1718 % \indexnofonts no-ops all font-change commands.
1719 % This is used when outputting the strings to sort the index by.
1720 \def\indexdummyfont#1{#1}
1721 \def\indexdummytex{TeX}
1722 \def\indexdummydots{...}
1725 \let\w=\indexdummyfont
1726 \let\t=\indexdummyfont
1727 \let\r=\indexdummyfont
1728 \let\i=\indexdummyfont
1729 \let\b=\indexdummyfont
1730 \let\emph=\indexdummyfont
1731 \let\strong=\indexdummyfont
1732 \let\cite=\indexdummyfont
1733 \let\sc=\indexdummyfont
1734 %Don't no-op \tt, since it isn't a user-level command
1735 % and is used in the definitions of the active chars like <, >, |...
1736 %\let\tt=\indexdummyfont
1737 \let\tclose=\indexdummyfont
1738 \let\code=\indexdummyfont
1739 \let\file=\indexdummyfont
1740 \let\samp=\indexdummyfont
1741 \let\kbd=\indexdummyfont
1742 \let\key=\indexdummyfont
1743 \let\var=\indexdummyfont
1744 \let\TeX=\indexdummytex
1745 \let\dots=\indexdummydots
1748 % To define \realbackslash, we must make \ not be an escape.
1749 % We must first make another character (@) an escape
1750 % so we do not become unable to do a definition.
1752 {\catcode`\@=0 \catcode`\\=\other
1753 @gdef@realbackslash{\}}
1755 \let\indexbackslash=0 %overridden during \printindex.
1758 {\count10=\lastpenalty %
1759 {\indexdummies % Must do this here, since \bf, etc expand at this stage
1761 {\let\folio=0% Expand all macros now EXCEPT \folio
1762 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
1763 % so it will be output as is; and it will print as backslash in the indx.
1765 % Now process the index-string once, with all font commands turned off,
1766 % to get the string to sort the index by.
1770 % Now produce the complete index entry. We process the index-string again,
1771 % this time with font commands expanded, to get what to print in the index.
1773 \write \csname#1indfile\endcsname{%
1774 \realbackslash entry {\temp1}{\folio}{#2}}}%
1778 \def\dosubind #1#2#3{%
1779 {\count10=\lastpenalty %
1780 {\indexdummies % Must do this here, since \bf, etc expand at this stage
1783 \def\rawbackslashxx{\indexbackslash}%
1785 % Now process the index-string once, with all font commands turned off,
1786 % to get the string to sort the index by.
1790 % Now produce the complete index entry. We process the index-string again,
1791 % this time with font commands expanded, to get what to print in the index.
1793 \write \csname#1indfile\endcsname{%
1794 \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
1798 % The index entry written in the file actually looks like
1799 % \entry {sortstring}{page}{topic}
1801 % \entry {sortstring}{page}{topic}{subtopic}
1802 % The texindex program reads in these files and writes files
1803 % containing these kinds of lines:
1805 % before the first topic whose initial is c
1806 % \entry {topic}{pagelist}
1807 % for a topic that is used without subtopics
1809 % for the beginning of a topic that is used with subtopics
1810 % \secondary {subtopic}{pagelist}
1811 % for each subtopic.
1813 % Define the user-accessible indexing commands
1814 % @findex, @vindex, @kindex, @cindex.
1816 \def\findex {\fnindex}
1817 \def\kindex {\kyindex}
1818 \def\cindex {\cpindex}
1819 \def\vindex {\vrindex}
1820 \def\tindex {\tpindex}
1821 \def\pindex {\pgindex}
1823 \def\cindexsub {\begingroup\obeylines\cindexsub}
1825 \gdef\cindexsub "#1" #2^^M{\endgroup %
1826 \dosubind{cp}{#2}{#1}}}
1828 % Define the macros used in formatting output of the sorted index material.
1830 % This is what you call to cause a particular index to get printed.
1832 % @unnumbered Function Index
1835 \def\printindex{\parsearg\doprintindex}
1837 \def\doprintindex#1{%
1839 \dobreak \chapheadingskip {10000}
1840 \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
1841 \catcode`\$=\other\catcode`\_=\other
1844 % The following don't help, since the chars were translated
1845 % when the raw index was written, and their fonts were discarded
1846 % due to \indexnofonts.
1847 %\catcode`\"=\active
1848 %\catcode`\^=\active
1849 %\catcode`\_=\active
1850 %\catcode`\|=\active
1851 %\catcode`\<=\active
1852 %\catcode`\>=\active
1854 \def\indexbackslash{\rawbackslashxx}
1855 \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
1858 % See if the index file exists and is nonempty.
1859 \openin 1 \jobname.#1s
1861 % \enddoublecolumns gets confused if there is no text in the index,
1862 % and it loses the chapter title and the aux file entries for the
1863 % index. The easiest way to prevent this problem is to make sure
1864 % there is some text.
1865 (Index is nonexistent)
1868 % If the index file exists but is empty, then \openin leaves \ifeof
1869 % false. We have to make TeX try to read something from the file, so
1870 % it can discover if there is anything in it.
1883 % These macros are used by the sorted index file itself.
1884 % Change them to control the appearance of the index.
1886 % Same as \bigskipamount except no shrink.
1887 % \balancecolumns gets confused if there is any shrink.
1888 \newskip\initialskipamount \initialskipamount 12pt plus4pt
1891 {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
1892 \ifdim\lastskip<\initialskipamount
1893 \removelastskip \penalty-200 \vskip \initialskipamount\fi
1894 \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
1896 % This typesets a paragraph consisting of #1, dot leaders, and then #2
1897 % flush to the right margin. It is used for index and table of contents
1898 % entries. The paragraph is indented by \leftskip.
1900 \def\entry #1#2{\begingroup
1902 % Start a new paragraph if necessary, so our assignments below can't
1903 % affect previous text.
1906 % Do not fill out the last line with white space.
1909 % No extra space above this paragraph.
1912 % Do not prefer a separate line ending with a hyphen to fewer lines.
1913 \finalhyphendemerits = 0
1915 % \hangindent is only relevant when the entry text and page number
1916 % don't both fit on one line. In that case, bob suggests starting the
1917 % dots pretty far over on the line. Unfortunately, a large
1918 % indentation looks wrong when the entry text itself is broken across
1919 % lines. So we use a small indentation and put up with long leaders.
1921 % \hangafter is reset to 1 (which is the value we want) at the start
1922 % of each paragraph, so we need not do anything with that.
1925 % When the entry text needs to be broken, just fill out the first line
1927 \rightskip = 0pt plus1fil
1929 % Start a ``paragraph'' for the index entry so the line breaking
1930 % parameters we've set above will have an effect.
1933 % Insert the text of the index entry. TeX will do line-breaking on it.
1936 % If we must, put the page number on a line of its own, and fill out
1937 % this line with blank space. (The \hfil is overwhelmed with the
1938 % fill leaders glue in \indexdotfill if the page number does fit.)
1940 \null\nobreak\indexdotfill % Have leaders before the page number.
1942 % The `\ ' here is removed by the implicit \unskip that TeX does as
1943 % part of (the primitive) \par. Without it, a spurious underfull
1945 \ #2% The page number ends the paragraph.
1949 % Like \dotfill except takes at least 1 em.
1950 \def\indexdotfill{\cleaders
1951 \hbox{$\mathsurround=0pt \mkern1.5mu . \mkern1.5mu$}\hskip 1em plus 1fill}
1953 \def\primary #1{\line{#1\hfil}}
1955 \newskip\secondaryindent \secondaryindent=0.5cm
1957 \def\secondary #1#2{
1958 {\parfillskip=0in \parskip=0in
1959 \hangindent =1in \hangafter=1
1960 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
1963 %% Define two-column mode, which is used in indexes.
1964 %% Adapted from the TeXbook, page 416.
1969 \newdimen\doublecolumnhsize
1971 \def\begindoublecolumns{\begingroup
1972 % Grab any single-column material above us.
1973 \output = {\global\setbox\partialpage
1974 =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
1977 % Now switch to the double-column output routine.
1978 \output={\doublecolumnout}%
1980 % Change the page size parameters. We could do this once outside this
1981 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
1982 % format, but then we repeat the same computation. Repeating a couple
1983 % of assignments once per index is clearly meaningless for the
1984 % execution time, so we may as well do it once.
1986 % First we halve the line length, less a little for the gutter between
1987 % the columns. We compute the gutter based on the line length, so it
1988 % changes automatically with the paper format. The magic constant
1989 % below is chosen so that the gutter has the same value (well, +- <
1990 % 1pt) as it did when we hard-coded it.
1992 % We put the result in a separate register, \doublecolumhsize, so we
1993 % can restore it in \pagesofar, after \hsize itself has (potentially)
1996 \doublecolumnhsize = \hsize
1997 \advance\doublecolumnhsize by -.04154\hsize
1998 \divide\doublecolumnhsize by 2
1999 \hsize = \doublecolumnhsize
2001 % Double the \vsize as well. (We don't need a separate register here,
2002 % since nobody clobbers \vsize.)
2004 \doublecolumnpagegoal
2007 \def\enddoublecolumns{\eject \endgroup \pagegoal=\vsize \unvbox\partialpage}
2009 \def\doublecolumnsplit{\splittopskip=\topskip \splitmaxdepth=\maxdepth
2010 \global\dimen@=\pageheight \global\advance\dimen@ by-\ht\partialpage
2011 \global\setbox1=\vsplit255 to\dimen@ \global\setbox0=\vbox{\unvbox1}
2012 \global\setbox3=\vsplit255 to\dimen@ \global\setbox2=\vbox{\unvbox3}
2013 \ifdim\ht0>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
2014 \ifdim\ht2>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
2016 \def\doublecolumnpagegoal{%
2017 \dimen@=\vsize \advance\dimen@ by-2\ht\partialpage \global\pagegoal=\dimen@
2019 \def\pagesofar{\unvbox\partialpage %
2020 \hsize=\doublecolumnhsize % have to restore this since output routine
2021 \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
2022 \def\doublecolumnout{%
2024 {\vbadness=10000 \doublecolumnsplit}
2026 \setbox0=\vtop to\dimen@{\unvbox0}
2027 \setbox2=\vtop to\dimen@{\unvbox2}
2028 \onepageout\pagesofar \unvbox255 \penalty\outputpenalty
2030 \setbox0=\vbox{\unvbox5}
2032 \dimen@=\ht0 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
2033 \divide\dimen@ by2 \splittopskip=\topskip \splitmaxdepth=\maxdepth
2035 \loop \global\setbox5=\copy0
2036 \setbox1=\vsplit5 to\dimen@
2037 \setbox3=\vsplit5 to\dimen@
2038 \ifvbox5 \global\advance\dimen@ by1pt \repeat
2039 \setbox0=\vbox to\dimen@{\unvbox1}
2040 \setbox2=\vbox to\dimen@{\unvbox3}
2041 \global\setbox\partialpage=\vbox{\pagesofar}
2042 \doublecolumnpagegoal
2049 \message{sectioning,}
2050 % Define chapters, sections, etc.
2053 \newcount \secno \secno=0
2054 \newcount \subsecno \subsecno=0
2055 \newcount \subsubsecno \subsubsecno=0
2057 % This counter is funny since it counts through charcodes of letters A, B, ...
2058 \newcount \appendixno \appendixno = `\@
2059 \def\appendixletter{\char\the\appendixno}
2061 \newwrite \contentsfile
2062 % This is called from \setfilename.
2063 \def\opencontents{\openout \contentsfile = \jobname.toc}
2065 % Each @chapter defines this as the name of the chapter.
2066 % page headings and footings can use it. @section does likewise
2068 \def\thischapter{} \def\thissection{}
2069 \def\seccheck#1{\if \pageno<0 %
2070 \errmessage{@#1 not allowed after generating table of contents}\fi
2074 \def\chapternofonts{%
2075 \let\rawbackslash=\relax%
2076 \let\frenchspacing=\relax%
2077 \def\result{\realbackslash result}
2078 \def\equiv{\realbackslash equiv}
2079 \def\expansion{\realbackslash expansion}
2080 \def\print{\realbackslash print}
2081 \def\TeX{\realbackslash TeX}
2082 \def\dots{\realbackslash dots}
2083 \def\copyright{\realbackslash copyright}
2084 \def\tt{\realbackslash tt}
2085 \def\bf{\realbackslash bf }
2086 \def\w{\realbackslash w}
2087 \def\less{\realbackslash less}
2088 \def\gtr{\realbackslash gtr}
2089 \def\hat{\realbackslash hat}
2090 \def\char{\realbackslash char}
2091 \def\tclose##1{\realbackslash tclose {##1}}
2092 \def\code##1{\realbackslash code {##1}}
2093 \def\samp##1{\realbackslash samp {##1}}
2094 \def\r##1{\realbackslash r {##1}}
2095 \def\b##1{\realbackslash b {##1}}
2096 \def\key##1{\realbackslash key {##1}}
2097 \def\file##1{\realbackslash file {##1}}
2098 \def\kbd##1{\realbackslash kbd {##1}}
2099 % These are redefined because @smartitalic wouldn't work inside xdef.
2100 \def\i##1{\realbackslash i {##1}}
2101 \def\cite##1{\realbackslash cite {##1}}
2102 \def\var##1{\realbackslash var {##1}}
2103 \def\emph##1{\realbackslash emph {##1}}
2104 \def\dfn##1{\realbackslash dfn {##1}}
2107 \newcount\absseclevel % used to calculate proper heading level
2108 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
2110 % @raisesections: treat @section as chapter, @subsection as section, etc.
2111 \def\raisesections{\global\advance\secbase by -1}
2112 \let\up=\raisesections % original BFox name
2114 % @lowersections: treat @chapter as section, @section as subsection, etc.
2115 \def\lowersections{\global\advance\secbase by 1}
2116 \let\down=\lowersections % original BFox name
2118 % Choose a numbered-heading macro
2119 % #1 is heading level if unmodified by @raisesections or @lowersections
2120 % #2 is text for heading
2121 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2127 \numberedsubseczzz{#2}
2129 \numberedsubsubseczzz{#2}
2131 \ifnum \absseclevel<0
2134 \numberedsubsubseczzz{#2}
2139 % like \numhead, but chooses appendix heading levels
2140 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2144 \appendixsectionzzz{#2}
2146 \appendixsubseczzz{#2}
2148 \appendixsubsubseczzz{#2}
2150 \ifnum \absseclevel<0
2153 \appendixsubsubseczzz{#2}
2158 % like \numhead, but chooses numberless heading levels
2159 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2163 \unnumberedseczzz{#2}
2165 \unnumberedsubseczzz{#2}
2167 \unnumberedsubsubseczzz{#2}
2169 \ifnum \absseclevel<0
2172 \unnumberedsubsubseczzz{#2}
2178 \def\thischaptername{No Chapter Title}
2179 \outer\def\chapter{\parsearg\chapteryyy}
2180 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
2181 \def\chapterzzz #1{\seccheck{chapter}%
2182 \secno=0 \subsecno=0 \subsubsecno=0
2183 \global\advance \chapno by 1 \message{Chapter \the\chapno}%
2184 \chapmacro {#1}{\the\chapno}%
2185 \gdef\thissection{#1}%
2186 \gdef\thischaptername{#1}%
2187 % We don't substitute the actual chapter name into \thischapter
2188 % because we don't want its macros evaluated now.
2189 \xdef\thischapter{Chapter \the\chapno: \noexpand\thischaptername}%
2191 \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
2193 \write \contentsfile \temp %
2195 \global\let\section = \numberedsec
2196 \global\let\subsection = \numberedsubsec
2197 \global\let\subsubsection = \numberedsubsubsec
2200 \outer\def\appendix{\parsearg\appendixyyy}
2201 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
2202 \def\appendixzzz #1{\seccheck{appendix}%
2203 \secno=0 \subsecno=0 \subsubsecno=0
2204 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
2205 \chapmacro {#1}{Appendix \appendixletter}%
2206 \gdef\thissection{#1}%
2207 \gdef\thischaptername{#1}%
2208 \xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}%
2210 \edef\temp{{\realbackslash chapentry
2211 {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
2213 \write \contentsfile \temp %
2215 \global\let\section = \appendixsec
2216 \global\let\subsection = \appendixsubsec
2217 \global\let\subsubsection = \appendixsubsubsec
2220 \outer\def\top{\parsearg\unnumberedyyy}
2221 \outer\def\unnumbered{\parsearg\unnumberedyyy}
2222 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
2223 \def\unnumberedzzz #1{\seccheck{unnumbered}%
2224 \secno=0 \subsecno=0 \subsubsecno=0
2226 % This used to be simply \message{#1}, but TeX fully expands the
2227 % argument to \message. Therefore, if #1 contained @-commands, TeX
2228 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
2229 % expanded @cite (which turns out to cause errors because \cite is meant
2230 % to be executed, not expanded).
2232 % Anyway, we don't want the fully-expanded definition of @cite to appear
2233 % as a result of the \message, we just want `@cite' itself. We use
2234 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
2235 % simply yielding the contents of the <toks register>.
2236 \toks0 = {#1}\message{(\the\toks0)}%
2238 \unnumbchapmacro {#1}%
2239 \gdef\thischapter{#1}\gdef\thissection{#1}%
2241 \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
2243 \write \contentsfile \temp %
2245 \global\let\section = \unnumberedsec
2246 \global\let\subsection = \unnumberedsubsec
2247 \global\let\subsubsection = \unnumberedsubsubsec
2250 \outer\def\numberedsec{\parsearg\secyyy}
2251 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
2252 \def\seczzz #1{\seccheck{section}%
2253 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
2254 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
2256 \edef\temp{{\realbackslash secentry %
2257 {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
2259 \write \contentsfile \temp %
2264 \outer\def\appenixsection{\parsearg\appendixsecyyy}
2265 \outer\def\appendixsec{\parsearg\appendixsecyyy}
2266 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
2267 \def\appendixsectionzzz #1{\seccheck{appendixsection}%
2268 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
2269 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
2271 \edef\temp{{\realbackslash secentry %
2272 {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
2274 \write \contentsfile \temp %
2279 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
2280 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
2281 \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
2282 \plainsecheading {#1}\gdef\thissection{#1}%
2284 \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
2286 \write \contentsfile \temp %
2291 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
2292 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
2293 \def\numberedsubseczzz #1{\seccheck{subsection}%
2294 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
2295 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
2297 \edef\temp{{\realbackslash subsecentry %
2298 {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
2300 \write \contentsfile \temp %
2305 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
2306 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
2307 \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
2308 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
2309 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
2311 \edef\temp{{\realbackslash subsecentry %
2312 {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
2314 \write \contentsfile \temp %
2319 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
2320 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
2321 \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
2322 \plainsecheading {#1}\gdef\thissection{#1}%
2324 \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
2326 \write \contentsfile \temp %
2331 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
2332 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
2333 \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
2334 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
2335 \subsubsecheading {#1}
2336 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
2338 \edef\temp{{\realbackslash subsubsecentry %
2340 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
2341 {\noexpand\folio}}}%
2343 \write \contentsfile \temp %
2348 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
2349 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
2350 \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
2351 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
2352 \subsubsecheading {#1}
2353 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
2355 \edef\temp{{\realbackslash subsubsecentry{#1}%
2357 {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
2359 \write \contentsfile \temp %
2364 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
2365 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
2366 \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
2367 \plainsecheading {#1}\gdef\thissection{#1}%
2369 \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
2371 \write \contentsfile \temp %
2376 % These are variants which are not "outer", so they can appear in @ifinfo.
2377 % Actually, they should now be obsolete; ordinary section commands should work.
2378 \def\infotop{\parsearg\unnumberedzzz}
2379 \def\infounnumbered{\parsearg\unnumberedzzz}
2380 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
2381 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
2382 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
2384 \def\infoappendix{\parsearg\appendixzzz}
2385 \def\infoappendixsec{\parsearg\appendixseczzz}
2386 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
2387 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
2389 \def\infochapter{\parsearg\chapterzzz}
2390 \def\infosection{\parsearg\sectionzzz}
2391 \def\infosubsection{\parsearg\subsectionzzz}
2392 \def\infosubsubsection{\parsearg\subsubsectionzzz}
2394 % These macros control what the section commands do, according
2395 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
2396 % Define them by default for a numbered chapter.
2397 \global\let\section = \numberedsec
2398 \global\let\subsection = \numberedsubsec
2399 \global\let\subsubsection = \numberedsubsubsec
2401 % Define @majorheading, @heading and @subheading
2403 % NOTE on use of \vbox for chapter headings, section headings, and
2405 % 1) We use \vbox rather than the earlier \line to permit
2406 % overlong headings to fold.
2407 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
2408 % heading is obnoxious; this forbids it.
2409 % 3) Likewise, headings look best if no \parindent is used, and
2410 % if justification is not attempted. Hence \raggedright.
2413 \def\majorheading{\parsearg\majorheadingzzz}
2414 \def\majorheadingzzz #1{%
2415 {\advance\chapheadingskip by 10pt \chapbreak }%
2416 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2417 \parindent=0pt\raggedright
2418 \rm #1\hfill}}\bigskip \par\penalty 200}
2420 \def\chapheading{\parsearg\chapheadingzzz}
2421 \def\chapheadingzzz #1{\chapbreak %
2422 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2423 \parindent=0pt\raggedright
2424 \rm #1\hfill}}\bigskip \par\penalty 200}
2426 \def\heading{\parsearg\secheadingi}
2428 \def\subheading{\parsearg\subsecheadingi}
2430 \def\subsubheading{\parsearg\subsubsecheadingi}
2432 % These macros generate a chapter, section, etc. heading only
2433 % (including whitespace, linebreaking, etc. around it),
2434 % given all the information in convenient, parsed form.
2436 %%% Args are the skip and penalty (usually negative)
2437 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
2439 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
2441 %%% Define plain chapter starts, and page on/off switching for it
2442 % Parameter controlling skip before chapter headings (if needed)
2444 \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
2446 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
2447 \def\chappager{\par\vfill\supereject}
2448 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
2450 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
2453 \global\let\pchapsepmacro=\chapbreak
2454 \global\let\pagealignmacro=\chappager}
2457 \global\let\pchapsepmacro=\chappager
2458 \global\let\pagealignmacro=\chappager
2459 \global\def\HEADINGSon{\HEADINGSsingle}}
2462 \global\let\pchapsepmacro=\chapoddpage
2463 \global\let\pagealignmacro=\chapoddpage
2464 \global\def\HEADINGSon{\HEADINGSdouble}}
2469 \global\let\chapmacro=\chfplain
2470 \global\let\unnumbchapmacro=\unnchfplain}
2472 \def\chfplain #1#2{%
2475 \chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2476 \parindent=0pt\raggedright
2483 \def\unnchfplain #1{%
2485 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2486 \parindent=0pt\raggedright
2487 \rm #1\hfill}}\bigskip \par\penalty 10000 %
2489 \CHAPFplain % The default
2491 \def\unnchfopen #1{%
2492 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2493 \parindent=0pt\raggedright
2494 \rm #1\hfill}}\bigskip \par\penalty 10000 %
2497 \def\chfopen #1#2{\chapoddpage {\chapfonts
2498 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
2503 \global\let\chapmacro=\chfopen
2504 \global\let\unnumbchapmacro=\unnchfopen}
2506 % Parameter controlling skip before section headings.
2508 \newskip \subsecheadingskip \subsecheadingskip = 17pt plus 8pt minus 4pt
2509 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
2511 \newskip \secheadingskip \secheadingskip = 21pt plus 8pt minus 4pt
2512 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
2514 % @paragraphindent is defined for the Info formatting commands only.
2515 \let\paragraphindent=\comment
2517 % Section fonts are the base font at magstep2, which produces
2518 % a size a bit more than 14 points in the default situation.
2520 \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
2521 \def\plainsecheading #1{\secheadingi {#1}}
2522 \def\secheadingi #1{{\advance \secheadingskip by \parskip %
2524 {\secfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2525 \parindent=0pt\raggedright
2527 \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
2530 % Subsection fonts are the base font at magstep1,
2531 % which produces a size of 12 points.
2533 \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
2534 \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
2535 \subsecheadingbreak}%
2536 {\subsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2537 \parindent=0pt\raggedright
2539 \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
2541 \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
2542 % Perhaps make sssec fonts scaled
2544 \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
2545 \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
2546 \subsecheadingbreak}%
2547 {\subsubsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2548 \parindent=0pt\raggedright
2550 \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
2553 \message{toc printing,}
2555 % Finish up the main text and prepare to read what we've written
2558 \newskip\contentsrightmargin \contentsrightmargin=1in
2559 \def\startcontents#1{%
2561 \immediate\closeout \contentsfile
2563 \pageno = -1 % Request roman numbered pages.
2565 % Don't need to put `Contents' or `Short Contents' in the headline.
2566 % It is abundantly clear what they are.
2567 \unnumbchapmacro{#1}\def\thischapter{}%
2568 \begingroup % Set up to handle contents files properly.
2569 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
2570 \raggedbottom % Worry more about breakpoints than the bottom.
2571 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
2575 % Normal (long) toc.
2576 \outer\def\contents{%
2577 \startcontents{Table of Contents}%
2583 % And just the chapters.
2584 \outer\def\summarycontents{%
2585 \startcontents{Short Contents}%
2587 \let\chapentry = \shortchapentry
2588 \let\unnumbchapentry = \shortunnumberedentry
2589 % We want a true roman here for the page numbers.
2591 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
2593 \advance\baselineskip by 1pt % Open it up a little.
2594 \def\secentry ##1##2##3##4{}
2595 \def\unnumbsecentry ##1##2{}
2596 \def\subsecentry ##1##2##3##4##5{}
2597 \def\unnumbsubsecentry ##1##2{}
2598 \def\subsubsecentry ##1##2##3##4##5##6{}
2599 \def\unnumbsubsubsecentry ##1##2{}
2604 \let\shortcontents = \summarycontents
2606 % These macros generate individual entries in the table of contents.
2607 % The first argument is the chapter or section name.
2608 % The last argument is the page number.
2609 % The arguments in between are the chapter number, section number, ...
2611 % Chapter-level things, for both the long and short contents.
2612 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
2614 % See comments in \dochapentry re vbox and related settings
2615 \def\shortchapentry#1#2#3{%
2616 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
2619 % Typeset the label for a chapter or appendix for the short contents.
2620 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
2621 % We could simplify the code here by writing out an \appendixentry
2622 % command in the toc file for appendices, instead of using \chapentry
2623 % for both, but it doesn't seem worth it.
2624 \setbox0 = \hbox{\shortcontrm Appendix }
2625 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
2627 \def\shortchaplabel#1{%
2628 % We typeset #1 in a box of constant width, regardless of the text of
2629 % #1, so the chapter titles will come out aligned.
2630 \setbox0 = \hbox{#1}%
2631 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
2633 % This space should be plenty, since a single number is .5em, and the
2634 % widest letter (M) is 1em, at least in the Computer Modern fonts.
2635 % (This space doesn't include the extra space that gets added after
2636 % the label; that gets put in in \shortchapentry above.)
2637 \advance\dimen0 by 1.1em
2638 \hbox to \dimen0{#1\hfil}%
2641 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
2642 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
2645 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
2646 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
2649 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
2650 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
2652 % And subsubsections.
2653 \def\subsubsecentry#1#2#3#4#5#6{%
2654 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
2655 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
2658 % This parameter controls the indentation of the various levels.
2659 \newdimen\tocindent \tocindent = 3pc
2661 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
2664 % If the toc has to be broken over pages, we would want to be at chapters
2665 % if at all possible; hence the \penalty.
2666 \def\dochapentry#1#2{%
2667 \penalty-300 \vskip\baselineskip
2670 \tocentry{#1}{\dopageno{#2}}%
2672 \nobreak\vskip .25\baselineskip
2675 \def\dosecentry#1#2{\begingroup
2676 \secentryfonts \leftskip=\tocindent
2677 \tocentry{#1}{\dopageno{#2}}%
2680 \def\dosubsecentry#1#2{\begingroup
2681 \subsecentryfonts \leftskip=2\tocindent
2682 \tocentry{#1}{\dopageno{#2}}%
2685 \def\dosubsubsecentry#1#2{\begingroup
2686 \subsubsecentryfonts \leftskip=3\tocindent
2687 \tocentry{#1}{\dopageno{#2}}%
2690 % Final typesetting of a toc entry; we use the same \entry macro as for
2691 % the index entries, but we want to suppress hyphenation here. (We
2692 % can't do that in the \entry macro, since index entries might consist
2693 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
2695 \def\tocentry#1#2{\begingroup
2696 \hyphenpenalty = 10000
2700 % Space between chapter (or whatever) number and the title.
2701 \def\labelspace{\hskip1em \relax}
2703 \def\dopageno#1{{\rm #1}}
2704 \def\doshortpageno#1{{\rm #1}}
2706 \def\chapentryfonts{\secfonts \rm}
2707 \def\secentryfonts{\textfonts}
2708 \let\subsecentryfonts = \textfonts
2709 \let\subsubsecentryfonts = \textfonts
2712 \message{environments,}
2714 % Since these characters are used in examples, it should be an even number of
2715 % \tt widths. Each \tt character is 1en, so two makes it 1em.
2716 % Furthermore, these definitions must come after we define our fonts.
2717 \newbox\dblarrowbox \newbox\longdblarrowbox
2718 \newbox\pushcharbox \newbox\bullbox
2719 \newbox\equivbox \newbox\errorbox
2721 \let\ptexequiv = \equiv
2724 %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
2725 %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
2726 %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
2727 %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
2728 % Adapted from the manmac format (p.420 of TeXbook)
2729 %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
2735 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
2736 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
2737 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
2739 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
2741 % Adapted from the TeXbook's \boxit.
2742 {\tentt \global\dimen0 = 3em}% Width of the box.
2743 \dimen2 = .55pt % Thickness of rules
2744 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
2745 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
2747 \global\setbox\errorbox=\hbox to \dimen0{\hfil
2748 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
2749 \advance\hsize by -2\dimen2 % Rules.
2751 \hrule height\dimen2
2752 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
2753 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
2754 \kern3pt\vrule width\dimen2}% Space to right.
2755 \hrule height\dimen2}
2758 % The @error{} command.
2759 \def\error{\leavevmode\lower.7ex\copy\errorbox}
2761 % @tex ... @end tex escapes into raw Tex temporarily.
2762 % One exception: @ is still an escape character, so that @end tex works.
2763 % But \@ or @@ will get a plain tex @ character.
2765 \def\tex{\begingroup
2766 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
2767 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
2768 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
2784 \let\bullet=\ptexbullet
2785 \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
2788 \let\Etex=\endgroup}
2790 % Define @lisp ... @endlisp.
2791 % @lisp does a \begingroup so it can rebind things,
2792 % including the definition of @endlisp (which normally is erroneous).
2794 % Amount to narrow the margins by for @lisp.
2795 \newskip\lispnarrowing \lispnarrowing=0.4in
2797 % This is the definition that ^^M gets inside @lisp, @example, and other
2798 % such environments. \null is better than a space, since it doesn't
2800 \def\lisppar{\null\endgraf}
2802 % Make each space character in the input produce a normal interword
2803 % space in the output. Don't allow a line break at this space, as this
2804 % is used only in environments like @example, where each line of input
2805 % should produce a line of output anyway.
2808 \gdef\sepspaces{\obeyspaces\let =\tie}}
2810 % Define \obeyedspace to be our active space, whatever it is. This is
2811 % for use in \parsearg.
2813 \global\let\obeyedspace= }
2815 % This space is always present above and below environments.
2816 \newskip\envskipamount \envskipamount = 0pt
2818 % Make spacing and below environment symmetrical. We use \parskip here
2819 % to help in doing that, since in @example-like environments \parskip
2820 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
2821 % start of the next paragraph will insert \parskip
2823 \def\aboveenvbreak{{\advance\envskipamount by \parskip
2824 \endgraf \ifdim\lastskip<\envskipamount
2825 \removelastskip \penalty-50 \vskip\envskipamount \fi}}
2827 \let\afterenvbreak = \aboveenvbreak
2829 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
2830 \let\nonarrowing=\relax
2832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2833 % \cartouche: draw rectangle w/rounded corners around argument
2834 \font\circle=lcircle10
2836 \newdimen\cartouter\newdimen\cartinner
2837 \newskip\normbskip\newskip\normpskip\newskip\normlskip
2838 \circthick=\fontdimen8\circle
2840 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
2841 \def\ctr{{\hskip 6pt\circle\char'010}}
2842 \def\cbl{{\circle\char'012\hskip -6pt}}
2843 \def\cbr{{\hskip 6pt\circle\char'011}}
2844 \def\carttop{\hbox to \cartouter{\hskip\lskip
2845 \ctl\leaders\hrule height\circthick\hfil\ctr
2847 \def\cartbot{\hbox to \cartouter{\hskip\lskip
2848 \cbl\leaders\hrule height\circthick\hfil\cbr
2851 \newskip\lskip\newskip\rskip
2853 \long\def\cartouche{%
2855 \lskip=\leftskip \rskip=\rightskip
2856 \leftskip=0pt\rightskip=0pt %we want these *outside*.
2857 \cartinner=\hsize \advance\cartinner by-\lskip
2858 \advance\cartinner by-\rskip
2860 \advance\cartouter by 18pt % allow for 3pt kerns on either
2861 % side, and for 6pt waste from
2863 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
2864 % Flag to tell @lisp, etc., not to narrow margin.
2865 \let\nonarrowing=\comment
2867 \baselineskip=0pt\parskip=0pt\lineskip=0pt
2876 \baselineskip=\normbskip
2877 \lineskip=\normlskip
2893 % This macro is called at the beginning of all the @example variants,
2897 \inENV % This group ends at the end of the body
2898 \hfuzz = 12pt % Don't be fussy
2899 \sepspaces % Make spaces be word-separators rather than space tokens.
2901 \let\par = \lisppar % don't ignore blank lines
2902 \obeylines % each line of input is a line of output
2905 \emergencystretch = 0pt % don't try to avoid overfull boxes
2906 % @cartouche defines \nonarrowing to inhibit narrowing
2907 % at next level down.
2908 \ifx\nonarrowing\relax
2909 \advance \leftskip by \lispnarrowing
2910 \exdentamount=\lispnarrowing
2911 \let\exdent=\nofillexdent
2912 \let\nonarrowing=\relax
2916 % To ending an @example-like environment, we first end the paragraph
2917 % (via \afterenvbreak's vertical glue), and then the group. That way we
2918 % keep the zero \parskip that the environments set -- \parskip glue
2919 % will be inserted at the beginning of the next paragraph in the
2920 % document, after the environment.
2922 \def\nonfillfinish{\afterenvbreak\endgroup}%
2925 \def\lisp{\begingroup
2927 \let\Elisp = \nonfillfinish
2929 \rawbackslash % have \ input char produce \ char from current font
2933 % Define the \E... control sequence only if we are inside the
2934 % environment, so the error checking in \end will work.
2936 % We must call \lisp last in the definition, since it reads the
2937 % return following the @example (or whatever) command.
2939 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
2940 \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
2941 \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
2943 % @smallexample and @smalllisp. This is not used unless the @smallbook
2944 % command is given. Originally contributed by Pavel@xerox.
2946 \def\smalllispx{\begingroup
2948 \let\Esmalllisp = \nonfillfinish
2949 \let\Esmallexample = \nonfillfinish
2951 % Smaller interline space and fonts for small examples.
2954 \rawbackslash % output the \ character from the current font
2958 % This is @display; same as @lisp except use roman font.
2960 \def\display{\begingroup
2962 \let\Edisplay = \nonfillfinish
2966 % This is @format; same as @display except don't narrow margins.
2968 \def\format{\begingroup
2969 \let\nonarrowing = t
2971 \let\Eformat = \nonfillfinish
2975 % @flushleft (same as @format) and @flushright.
2977 \def\flushleft{\begingroup
2978 \let\nonarrowing = t
2980 \let\Eflushleft = \nonfillfinish
2983 \def\flushright{\begingroup
2984 \let\nonarrowing = t
2986 \let\Eflushright = \nonfillfinish
2987 \advance\leftskip by 0pt plus 1fill
2990 % @quotation does normal linebreaking and narrows the margins.
2993 \begingroup\inENV %This group ends at the end of the @quotation body
2994 {\parskip=0pt % because we will skip by \parskip too, later
2998 \let\Equotation = \nonfillfinish
2999 % @cartouche defines \nonarrowing to inhibit narrowing
3000 % at next level down.
3001 \ifx\nonarrowing\relax
3002 \advance \leftskip by \lispnarrowing
3003 \advance \rightskip by \lispnarrowing
3004 \exdentamount=\lispnarrowing
3005 \let\nonarrowing=\relax
3009 % Define formatter for defuns
3010 % First, allow user to change definition object font (\df) internally
3011 \def\setdeffont #1 {\csname DEF#1\endcsname}
3013 \newskip\defbodyindent \defbodyindent=.4in
3014 \newskip\defargsindent \defargsindent=50pt
3015 \newskip\deftypemargin \deftypemargin=12pt
3016 \newskip\deflastargmargin \deflastargmargin=18pt
3018 \newcount\parencount
3019 % define \functionparens, which makes ( and ) and & do special things.
3020 % \functionparens affects the group it is contained in.
3022 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
3023 \catcode`\[=\active \catcode`\]=\active}
3025 % Make control sequences which act like normal parenthesis chars.
3026 \let\lparen = ( \let\rparen = )
3028 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
3030 % Be sure that we always have a definition for `(', etc. For example,
3031 % if the fn name has parens in it, \boldbrax will not be in effect yet,
3032 % so TeX would otherwise complain about undefined control sequence.
3033 \global\let(=\lparen \global\let)=\rparen
3034 \global\let[=\lbrack \global\let]=\rbrack
3036 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
3037 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
3039 % Definitions of (, ) and & used in args for functions.
3040 % This is the definition of ( outside of all parentheses.
3041 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
3042 \global\advance\parencount by 1 }
3044 % This is the definition of ( when already inside a level of parens.
3045 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
3047 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
3048 % also in that case restore the outer-level definition of (.
3049 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
3050 \global\advance \parencount by -1 }
3051 % If we encounter &foo, then turn on ()-hacking afterwards
3052 \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
3054 \gdef\normalparens{\boldbrax\let&=\ampnr}
3055 } % End of definition inside \activeparens
3056 %% These parens (in \boldbrax) actually are a little bolder than the
3057 %% contained text. This is especially needed for [ and ]
3058 \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
3059 \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
3061 % First, defname, which formats the header line itself.
3062 % #1 should be the function name.
3063 % #2 should be the type of definition, such as "Function".
3066 % Get the values of \leftskip and \rightskip as they were
3067 % outside the @def...
3069 \advance\dimen2 by -\defbodyindent
3071 \advance\dimen3 by -\defbodyindent
3073 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
3074 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
3075 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
3076 \parshape 2 0in \dimen0 \defargsindent \dimen1 %
3077 % Now output arg 2 ("Function" or some such)
3078 % ending at \deftypemargin from the right margin,
3079 % but stuck inside a box of width 0 so it does not interfere with linebreaking
3080 {% Adjust \hsize to exclude the ambient margins,
3081 % so that \rightline will obey them.
3082 \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
3083 \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
3084 % Make all lines underfull and no complaints:
3085 \tolerance=10000 \hbadness=10000
3086 \advance\leftskip by -\defbodyindent
3087 \exdentamount=\defbodyindent
3088 {\df #1}\enskip % Generate function name
3091 % Actually process the body of a definition
3092 % #1 should be the terminating control sequence, such as \Edefun.
3093 % #2 should be the "another name" control sequence, such as \defunx.
3094 % #3 should be the control sequence that actually processes the header,
3095 % such as \defunheader.
3097 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3099 % Define the end token that this defining construct specifies
3100 % so that it will exit this group.
3101 \def#1{\endgraf\endgroup\medbreak}%
3102 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
3104 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3105 \exdentamount=\defbodyindent
3107 \catcode 61=\active %
3108 \obeylines\activeparens\spacesplit#3}
3110 \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
3112 % Define the end token that this defining construct specifies
3113 % so that it will exit this group.
3114 \def#1{\endgraf\endgroup\medbreak}%
3115 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
3117 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3118 \exdentamount=\defbodyindent
3119 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
3121 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
3123 % Define the end token that this defining construct specifies
3124 % so that it will exit this group.
3125 \def#1{\endgraf\endgroup\medbreak}%
3126 \def#2##1 ##2 {\def#4{##1}%
3127 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
3129 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3130 \exdentamount=\defbodyindent
3131 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
3133 % These parsing functions are similar to the preceding ones
3134 % except that they do not make parens into active characters.
3135 % These are used for "variables" since they have no arguments.
3137 \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3139 % Define the end token that this defining construct specifies
3140 % so that it will exit this group.
3141 \def#1{\endgraf\endgroup\medbreak}%
3142 \def#2{\begingroup\obeylines\spacesplit#3}%
3144 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3145 \exdentamount=\defbodyindent
3147 \catcode 61=\active %
3148 \obeylines\spacesplit#3}
3150 \def\defvrparsebody #1#2#3#4 {\begingroup\inENV %
3152 % Define the end token that this defining construct specifies
3153 % so that it will exit this group.
3154 \def#1{\endgraf\endgroup\medbreak}%
3155 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
3157 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3158 \exdentamount=\defbodyindent
3159 \begingroup\obeylines\spacesplit{#3{#4}}}
3161 % This seems to work right in all cases.
3162 \let\deftpparsebody=\defvrparsebody
3163 % This fails to work. When given `@deftp {Data Type} foo_t',
3164 % it thinks the type name is just `f'.
3165 %%% This is the same as all the others except for the last line. We need
3166 %%% to parse the arguments differently for @deftp, since the ``attributes''
3167 %%% there are optional.
3169 %%\def\deftpparsebody #1#2#3#4 {\begingroup\inENV %
3171 %%% Define the end token that this defining construct specifies
3172 %%% so that it will exit this group.
3173 %%\def#1{\endgraf\endgroup\medbreak}%
3174 %%\def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
3176 %%\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3177 %%\exdentamount=\defbodyindent
3178 %%\begingroup\obeylines\parsetpheaderline{#3{#4}}}
3181 %% % Parse the type name and any attributes (field names, etc.).
3182 %% % #1 is the beginning of the macro call that will produce the output,
3183 %% % i.e., \deftpheader{CLASS}; this is passed from \deftpparsebody.
3184 %% % #2 is the type name, e.g., `struct termios'.
3185 %% % #3 is the (possibly empty) attribute list.
3187 %% \gdef\parsetpheaderline#1#2#3^^M{%
3188 %% \endgroup % Started in \deftpparsebody.
3190 %% % If the attribute list is in fact empty, there will be no space after
3191 %% % #2; so we can't put a space in our TeX parameter list. But if it
3192 %% % isn't empty, then #3 will begin with an unwanted space.
3193 %% \def\theargs{\ignorespaces #3}%
3195 %% % Call the macro to produce the output.
3200 \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
3202 % Define the end token that this defining construct specifies
3203 % so that it will exit this group.
3204 \def#1{\endgraf\endgroup\medbreak}%
3205 \def#2##1 ##2 {\def#4{##1}%
3206 \begingroup\obeylines\spacesplit{#3{##2}}}%
3208 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3209 \exdentamount=\defbodyindent
3210 \begingroup\obeylines\spacesplit{#3{#5}}}
3212 % Split up #2 at the first space token.
3213 % call #1 with two arguments:
3214 % the first is all of #2 before the space token,
3215 % the second is all of #2 after that space token.
3216 % If #2 contains no space token, all of it is passed as the first arg
3217 % and the second is passed as empty.
3220 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
3221 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
3223 #1{#2}{}\else #1{#2}{#3#4}\fi}}
3225 % So much for the things common to all kinds of definitions.
3229 % First, define the processing that is wanted for arguments of \defun
3230 % Use this to expand the args and terminate the paragraph they make up
3232 \def\defunargs #1{\functionparens \sl
3233 % Expand, preventing hyphenation at `-' chars.
3234 % Note that groups don't affect changes in \hyphenchar.
3237 \hyphenchar\tensl=45
3238 \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
3239 \interlinepenalty=10000
3240 \advance\rightskip by 0pt plus 1fil
3241 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
3244 \def\deftypefunargs #1{%
3245 % Expand, preventing hyphenation at `-' chars.
3246 % Note that groups don't affect changes in \hyphenchar.
3249 \interlinepenalty=10000
3250 \advance\rightskip by 0pt plus 1fil
3251 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
3254 % Do complete processing of one @defun or @defunx line already parsed.
3256 % @deffn Command forward-char nchars
3258 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
3260 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
3261 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
3262 \catcode 61=\other % Turn off change made in \defparsebody
3265 % @defun == @deffn Function
3267 \def\defun{\defparsebody\Edefun\defunx\defunheader}
3269 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3270 \begingroup\defname {#1}{Function}%
3271 \defunargs {#2}\endgroup %
3272 \catcode 61=\other % Turn off change made in \defparsebody
3275 % @deftypefun int foobar (int @var{foo}, float @var{bar})
3277 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
3279 % #1 is the data type. #2 is the name and args.
3280 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
3281 % #1 is the data type, #2 the name, #3 the args.
3282 \def\deftypefunheaderx #1#2 #3\relax{%
3283 \doind {fn}{\code{#2}}% Make entry in function index
3284 \begingroup\defname {\code{#1} #2}{Function}%
3285 \deftypefunargs {#3}\endgroup %
3286 \catcode 61=\other % Turn off change made in \defparsebody
3289 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
3291 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
3293 % #1 is the classification. #2 is the data type. #3 is the name and args.
3294 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
3295 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
3296 \def\deftypefnheaderx #1#2#3 #4\relax{%
3297 \doind {fn}{\code{#3}}% Make entry in function index
3298 \begingroup\defname {\code{#2} #3}{#1}%
3299 \deftypefunargs {#4}\endgroup %
3300 \catcode 61=\other % Turn off change made in \defparsebody
3303 % @defmac == @deffn Macro
3305 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
3307 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3308 \begingroup\defname {#1}{Macro}%
3309 \defunargs {#2}\endgroup %
3310 \catcode 61=\other % Turn off change made in \defparsebody
3313 % @defspec == @deffn Special Form
3315 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
3317 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3318 \begingroup\defname {#1}{Special Form}%
3319 \defunargs {#2}\endgroup %
3320 \catcode 61=\other % Turn off change made in \defparsebody
3323 % This definition is run if you use @defunx
3324 % anywhere other than immediately after a @defun or @defunx.
3326 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
3327 \def\defunx #1 {\errmessage{@defunx in invalid context}}
3328 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
3329 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
3330 \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
3331 \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
3333 % @defmethod, and so on
3335 % @defop {Funny Method} foo-class frobnicate argument
3337 \def\defop #1 {\def\defoptype{#1}%
3338 \defopparsebody\Edefop\defopx\defopheader\defoptype}
3340 \def\defopheader #1#2#3{%
3341 \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
3342 \begingroup\defname {#2}{\defoptype{} on #1}%
3343 \defunargs {#3}\endgroup %
3346 % @defmethod == @defop Method
3348 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
3350 \def\defmethodheader #1#2#3{%
3351 \dosubind {fn}{\code{#2}}{on #1}% entry in function index
3352 \begingroup\defname {#2}{Method on #1}%
3353 \defunargs {#3}\endgroup %
3356 % @defcv {Class Option} foo-class foo-flag
3358 \def\defcv #1 {\def\defcvtype{#1}%
3359 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
3361 \def\defcvarheader #1#2#3{%
3362 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
3363 \begingroup\defname {#2}{\defcvtype{} of #1}%
3364 \defvarargs {#3}\endgroup %
3367 % @defivar == @defcv {Instance Variable}
3369 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
3371 \def\defivarheader #1#2#3{%
3372 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
3373 \begingroup\defname {#2}{Instance Variable of #1}%
3374 \defvarargs {#3}\endgroup %
3377 % These definitions are run if you use @defmethodx, etc.,
3378 % anywhere other than immediately after a @defmethod, etc.
3380 \def\defopx #1 {\errmessage{@defopx in invalid context}}
3381 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
3382 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
3383 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
3387 % First, define the processing that is wanted for arguments of @defvar.
3388 % This is actually simple: just print them in roman.
3389 % This must expand the args and terminate the paragraph they make up
3390 \def\defvarargs #1{\normalparens #1%
3391 \interlinepenalty=10000
3392 \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
3394 % @defvr Counter foo-count
3396 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
3398 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
3399 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
3401 % @defvar == @defvr Variable
3403 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
3405 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
3406 \begingroup\defname {#1}{Variable}%
3407 \defvarargs {#2}\endgroup %
3410 % @defopt == @defvr {User Option}
3412 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
3414 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
3415 \begingroup\defname {#1}{User Option}%
3416 \defvarargs {#2}\endgroup %
3419 % @deftypevar int foobar
3421 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
3423 % #1 is the data type. #2 is the name.
3424 \def\deftypevarheader #1#2{%
3425 \doind {vr}{\code{#2}}% Make entry in variables index
3426 \begingroup\defname {\code{#1} #2}{Variable}%
3427 \interlinepenalty=10000
3428 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
3431 % @deftypevr {Global Flag} int enable
3433 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
3435 \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
3436 \begingroup\defname {\code{#2} #3}{#1}
3437 \interlinepenalty=10000
3438 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
3441 % This definition is run if you use @defvarx
3442 % anywhere other than immediately after a @defvar or @defvarx.
3444 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
3445 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
3446 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
3447 \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
3448 \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
3451 % Args are printed in bold, a slight difference from @defvar.
3453 \def\deftpargs #1{\bf \defvarargs{#1}}
3455 % @deftp Class window height width ...
3457 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
3459 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
3460 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
3462 % This definition is run if you use @deftpx, etc
3463 % anywhere other than immediately after a @deftp, etc.
3465 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
3467 \message{cross reference,}
3468 % Define cross-reference macros
3471 \newif\ifhavexrefs % True if xref values are known.
3472 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
3474 % \setref{foo} defines a cross-reference point named foo.
3477 %\dosetq{#1-title}{Ytitle}%
3478 \dosetq{#1-pg}{Ypagenumber}%
3479 \dosetq{#1-snt}{Ysectionnumberandtype}}
3481 \def\unnumbsetref#1{%
3482 %\dosetq{#1-title}{Ytitle}%
3483 \dosetq{#1-pg}{Ypagenumber}%
3484 \dosetq{#1-snt}{Ynothing}}
3486 \def\appendixsetref#1{%
3487 %\dosetq{#1-title}{Ytitle}%
3488 \dosetq{#1-pg}{Ypagenumber}%
3489 \dosetq{#1-snt}{Yappendixletterandtype}}
3491 % \xref, \pxref, and \ref generate cross-references to specified points.
3492 % For \xrefX, #1 is the node name, #2 the name of the Info
3493 % cross-reference, #3 the printed node name, #4 the name of the Info
3494 % file, #5 the name of the printed manual. All but the node name can be
3497 \def\pxref#1{see \xrefX[#1,,,,,,,]}
3498 \def\xref#1{See \xrefX[#1,,,,,,,]}
3499 \def\ref#1{\xrefX[#1,,,,,,,]}
3500 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup%
3501 \def\printedmanual{\ignorespaces #5}%
3502 \def\printednodename{\ignorespaces #3}%
3504 \setbox1=\hbox{\printedmanual}%
3505 \setbox0=\hbox{\printednodename}%
3507 \def\printednodename{\ignorespaces #1}%
3508 %%% Uncommment the following line to make the actual chapter or section title
3509 %%% appear inside the square brackets.
3510 %\def\printednodename{#1-title}%
3514 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does
3515 % not insert empty discretionaries after hyphens, which means that it
3516 % will not find a line break at a hyphen in a node names. Since some
3517 % manuals are best written with fairly long node names, containing
3518 % hyphens, this is a loss. Therefore, we simply give the text of
3519 % the node name again, so it is as if TeX is seeing it for the first
3522 section ``\printednodename'' in \cite{\printedmanual}%
3525 \refx{#1-snt}{} [\printednodename], page\tie\refx{#1-pg}{}%
3529 % \dosetq is the interface for calls from other macros
3531 % Use \turnoffactive so that punctuation chars such as underscore
3532 % work in node names.
3533 \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
3534 \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
3537 % \internalsetq {foo}{page} expands into
3538 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
3539 % When the aux file is read, ' is the escape character
3541 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
3543 % Things to be expanded by \internalsetq
3545 \def\Ypagenumber{\folio}
3547 \def\Ytitle{\thischapter}
3551 \def\Ysectionnumberandtype{%
3552 \ifnum\secno=0 Chapter\xreftie\the\chapno %
3553 \else \ifnum \subsecno=0 Section\xreftie\the\chapno.\the\secno %
3554 \else \ifnum \subsubsecno=0 %
3555 Section\xreftie\the\chapno.\the\secno.\the\subsecno %
3557 Section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
3560 \def\Yappendixletterandtype{%
3561 \ifnum\secno=0 Appendix\xreftie'char\the\appendixno{}%
3562 \else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %
3563 \else \ifnum \subsubsecno=0 %
3564 Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
3566 Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
3571 % Use TeX 3.0's \inputlineno to get the line number, for better error
3572 % messages, but if we're using an old version of TeX, don't do anything.
3574 \ifx\inputlineno\thisisundefined
3575 \let\linenumber = \empty % Non-3.0.
3577 \def\linenumber{\the\inputlineno:\space}
3580 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
3581 % If its value is nonempty, SUFFIX is output afterward.
3584 \expandafter\ifx\csname X#1\endcsname\relax
3585 % If not defined, say something at least.
3586 $\langle$un\-de\-fined$\rangle$%
3588 \message{\linenumber Undefined cross reference `#1'.}%
3591 \global\warnedxrefstrue
3592 \message{Cross reference values unknown; you must run TeX again.}%
3596 % It's defined, so just use it.
3597 \csname X#1\endcsname
3599 #2% Output the suffix in any case.
3602 % Read the last existing aux file, if any. No error if none exists.
3604 % This is the macro invoked by entries in the aux file.
3606 {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
3610 \catcode `\^^@=\other
3611 \catcode `\
\ 1=\other
3612 \catcode `\
\ 2=\other
3613 \catcode `\^^C=\other
3614 \catcode `\^^D=\other
3615 \catcode `\^^E=\other
3616 \catcode `\^^F=\other
3617 \catcode `\^^G=\other
3618 \catcode `\^^H=\other
3619 \catcode `\
\v=\other
3620 \catcode `\^^L=\other
3621 \catcode `\
\ e=\other
3622 \catcode `\
\ f=\other
3623 \catcode `\
\10=\other
3624 \catcode `\
\11=\other
3625 \catcode `\
\12=\other
3626 \catcode `\
\13=\other
3627 \catcode `\
\14=\other
3628 \catcode `\
\15=\other
3629 \catcode `\
\16=\other
3630 \catcode `\
\17=\other
3631 \catcode `\
\18=\other
3632 \catcode `\
\19=\other
3634 \catcode `\^^[=\other
3635 \catcode `\^^\=\other
3636 \catcode `\^^]=\other
3637 \catcode `\^^^=\other
3638 \catcode `\^^_=\other
3652 % `\+ does not work, so use 43.
3654 % the aux file uses ' as the escape.
3655 % Turn off \ as an escape so we do not lose on
3656 % entries which were dumped with control sequences in their names.
3657 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
3658 % Reference to such entries still does not work the way one would wish,
3659 % but at least they do not bomb out when the aux file is read in.
3660 \catcode `\{=1 \catcode `\}=2
3664 \openin 1 \jobname.aux
3665 \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
3666 \global\warnedobstrue
3668 % Open the new aux file. Tex will close it automatically at exit.
3669 \openout \auxfile=\jobname.aux
3675 \newcount \footnoteno
3677 % The trailing space in the following definition for supereject is
3678 % vital for proper filling; pages come out unaligned when you do a
3679 % pagealignmacro call if that space before the closing brace is
3681 \def\supereject{\par\penalty -20000\footnoteno =0 }
3683 % @footnotestyle is meaningful for info output only..
3684 \let\footnotestyle=\comment
3686 \let\ptexfootnote=\footnote
3690 % Auto-number footnotes. Otherwise like plain.
3692 \global\advance\footnoteno by \@ne
3693 \edef\thisfootno{$^{\the\footnoteno}$}%
3695 % In case the footnote comes at the end of a sentence, preserve the
3696 % extra spacing after we do the footnote number.
3698 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
3700 % Remove inadvertent blank space before typesetting the footnote number.
3706 % Don't bother with the trickery in plain.tex to not require the
3707 % footnote text as a parameter. Our footnotes don't need to be so general.
3709 \long\gdef\footnotezzz#1{\insert\footins{%
3710 % We want to typeset this text as a normal paragraph, even if the
3711 % footnote reference occurs in (for example) a display environment.
3712 % So reset some parameters.
3713 \interlinepenalty\interfootnotelinepenalty
3714 \splittopskip\ht\strutbox % top baseline for broken footnotes
3715 \splitmaxdepth\dp\strutbox
3716 \floatingpenalty\@MM
3721 \parindent\defaultparindent
3723 % Hang the footnote text off the number.
3725 \textindent{\thisfootno}%
3727 % Don't crash into the line above the footnote text. Since this
3728 % expands into a box, it must come within the paragraph, lest it
3729 % provide a place where TeX can split the footnote.
3734 }%end \catcode `\@=11
3736 % Set the baselineskip to #1, and the lineskip and strut size
3737 % correspondingly. There is no deep meaning behind these magic numbers
3738 % used as factors; they just match (closely enough) what Knuth defined.
3740 \def\lineskipfactor{.08333}
3741 \def\strutheightpercent{.70833}
3742 \def\strutdepthpercent {.29167}
3745 \normalbaselineskip = #1\relax
3746 \normallineskip = \lineskipfactor\normalbaselineskip
3748 \setbox\strutbox =\hbox{%
3749 \vrule width0pt height\strutheightpercent\baselineskip
3750 depth \strutdepthpercent \baselineskip
3754 % @| inserts a changebar to the left of the current line. It should
3755 % surround any changed text. This approach does *not* work if the
3756 % change spans more than two lines of output. To handle that, we would
3757 % have adopt a much more difficult approach (putting marks into the main
3758 % vertical list for the beginning and end of each change).
3761 % \vadjust can only be used in horizontal mode.
3764 % Append this vertical mode material after the current line in the output.
3766 % We want to insert a rule with the height and depth of the current
3767 % leading; that is exactly what \strutbox is supposed to record.
3768 \vskip-\baselineskip
3770 % \vadjust-items are inserted at the left edge of the type. So
3771 % the \llap here moves out into the left-hand margin.
3774 % For a thicker or thinner bar, change the `1pt'.
3775 \vrule height\baselineskip width1pt
3777 % This is the space between the bar and the text.
3783 % For a final copy, take out the rectangles
3784 % that mark overfull boxes (in case you have decided
3785 % that the text looks ok even though it passes the margin).
3787 \def\finalout{\overfullrule=0pt}
3790 % End of control word definitions.
3792 \message{and turning on texinfo input format.}
3803 % Set some numeric style parameters, for 8.5 x 11 format.
3806 \newdimen\defaultparindent \defaultparindent = 15pt
3807 \parindent = \defaultparindent
3808 \parskip 18pt plus 1pt
3810 \advance\topskip by 1.2cm
3812 % Prevent underfull vbox error messages.
3815 % Following George Bush, just get rid of widows and orphans.
3819 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
3820 % using an old version of TeX, don't do anything. We want the amount of
3821 % stretch added to depend on the line length, hence the dependence on
3822 % \hsize. This makes it come to about 9pt for the 8.5x11 format.
3824 \ifx\emergencystretch\thisisundefined
3825 % Allow us to assign to \emergencystretch anyway.
3826 \def\emergencystretch{\dimen0}%
3828 \emergencystretch = \hsize
3829 \divide\emergencystretch by 45
3832 % Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25)
3835 % These values for secheadingskip and subsecheadingskip are
3836 % experiments. RJC 7 Aug 1992
3837 \global\secheadingskip = 17pt plus 6pt minus 3pt
3838 \global\subsecheadingskip = 14pt plus 6pt minus 3pt
3840 \global\lispnarrowing = 0.3in
3842 \advance\topskip by -1cm
3843 \global\parskip 3pt plus 1pt
3846 \global\tolerance=700
3848 \global\contentsrightmargin=0pt
3850 \global\pagewidth=\hsize
3851 \global\pageheight=\vsize
3853 \global\let\smalllisp=\smalllispx
3854 \global\let\smallexample=\smalllispx
3855 \global\def\Esmallexample{\Esmalllisp}
3858 % Use @afourpaper to print on European A4 paper.
3860 \global\tolerance=700
3863 \global\parskip 15pt plus 1pt
3865 \global\vsize= 53\baselineskip
3866 \advance\vsize by \topskip
3867 %\global\hsize= 5.85in % A4 wide 10pt
3868 \global\hsize= 6.5in
3869 \global\outerhsize=\hsize
3870 \global\advance\outerhsize by 0.5in
3871 \global\outervsize=\vsize
3872 \global\advance\outervsize by 0.6in
3874 \global\pagewidth=\hsize
3875 \global\pageheight=\vsize
3878 % Define macros to output various characters with catcode for normal text.
3887 \def\normaldoublequote{"}
3890 \def\normalunderscore{_}
3891 \def\normalverticalbar{|}
3893 \def\normalgreater{>}
3896 % This macro is used to make a character print one way in ttfont
3897 % where it can probably just be output, and another way in other fonts,
3898 % where something hairier probably needs to be done.
3900 % #1 is what to print if we are indeed using \tt; #2 is what to print
3901 % otherwise. Since all the Computer Modern typewriter fonts have zero
3902 % interword stretch (and shrink), and it is reasonable to expect all
3903 % typewriter fonts to have this, we can check that font parameter.
3905 \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
3907 % Turn off all special characters except @
3908 % (and those which the user can use as if they were ordinary).
3909 % Most of these we simply print from the \tt font, but for some, we can
3910 % use math or other variants that look better in normal text.
3913 \def\activedoublequote{{\tt \char '042}}
3914 \let"=\activedoublequote
3916 \def~{{\tt \char '176}}
3922 \def_{\ifusingtt\normalunderscore\_}
3923 % Subroutine for the previous macro.
3924 \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
3926 % \lvvmode is equivalent in function to \leavevmode.
3927 % Using \leavevmode runs into trouble when written out to
3928 % an index file due to the expansion of \leavevmode into ``\unhbox
3929 % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
3930 % magic tricks with @.
3931 \def\lvvmode{\vbox to 0pt{}}
3934 \def|{{\tt \char '174}}
3942 \def+{{\tt \char 43}}
3943 %\catcode 27=\active
3944 %\def^^[{$\diamondsuit$}
3946 % Used sometimes to turn off (effectively) the active characters
3947 % even after parsing them.
3948 \def\turnoffactive{\let"=\normaldoublequote
3951 \let_=\normalunderscore
3952 \let|=\normalverticalbar
3954 \let>=\normalgreater
3957 % Set up an active definition for =, but don't enable it most of the time.
3958 {\catcode`\==\active
3959 \global\def={{\tt \char 61}}}
3963 % \rawbackslashxx output one backslash character in current font
3964 \global\chardef\rawbackslashxx=`\\
3965 %{\catcode`\\=\other
3966 %@gdef@rawbackslashxx{\}}
3968 % \rawbackslash redefines \ as input to do \rawbackslashxx.
3969 {\catcode`\\=\active
3970 @gdef@rawbackslash{@let\=@rawbackslashxx }}
3972 % \normalbackslash outputs one backslash in fixed width font.
3973 \def\normalbackslash{{\tt\rawbackslashxx}}
3975 % Say @foo, not \foo, in error messages.
3978 % \catcode 17=0 % Define control-q
3981 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
3982 % That is what \eatinput is for; after that, the `\' should revert to printing
3985 @gdef@eatinput input texinfo{@fixbackslash}
3986 @global@let\ = @eatinput
3988 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
3989 % the first `\{ in the file would cause an error. This macro tries to fix
3990 % that, assuming it is called before the first `\' could plausibly occur.
3992 @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
3994 %% These look ok in all fonts, so just make them not special. The @rm below
3995 %% makes sure that the current font starts out as the newly loaded cmr10
3996 @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
4002 @c page-delimiter: "^\\\\message"