1 %% TeX macros to handle Texinfo files.
2 %% $Id: texinfo.tex,v 2.210 1997/07/04 00:07:28 rms Exp karl $
4 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
5 % 94, 95, 96, 97 Free Software Foundation, Inc.
7 %This texinfo.tex file is free software; you can redistribute it and/or
8 %modify it under the terms of the GNU General Public License as
9 %published by the Free Software Foundation; either version 2, or (at
10 %your option) any later version.
12 %This texinfo.tex file is distributed in the hope that it will be
13 %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 %General Public License for more details.
17 %You should have received a copy of the GNU General Public License
18 %along with this texinfo.tex file; see the file COPYING. If not, write
19 %to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 %Boston, MA 02111-1307, USA.
23 %In other words, you are welcome to use, share and improve this program.
24 %You are forbidden to forbid anyone else to use, share and improve
25 %what you give them. Help stamp out software-hoarding!
28 % Send bug reports to bug-texinfo@prep.ai.mit.edu.
29 % Please include a *precise* test case in each bug report.
32 % Make it possible to create a .fmt file just by loading this file:
33 % if the underlying format is not loaded, start by loading it now.
34 % Added by gildea November 1993.
35 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
37 % This automatically updates the version number based on RCS.
38 \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
39 \deftexinfoversion$Revision: 2.210 $
40 \message{Loading texinfo package [Version \texinfoversion]:}
42 % If in a .fmt file, print the version number
43 % and turn on active characters that we couldn't do earlier because
44 % they might have appeared in the input file name.
45 \everyjob{\message{[Texinfo version \texinfoversion]}\message{}
46 \catcode`+=\active \catcode`\_=\active}
48 % Save some parts of plain tex whose names we will redefine.
51 \let\ptexbullet=\bullet
57 \let\ptexequiv = \equiv
64 % Be sure we're in horizontal mode when doing a tie, since we make space
65 % equivalent to this in @example-like environments. Otherwise, a space
66 % at the beginning of a line will start with \penalty -- and
67 % since \penalty is valid in vertical mode, we'd end up putting the
68 % penalty on the vertical list instead of in the new paragraph.
70 % Avoid using \@M directly, because that causes trouble
71 % if the definition is written into an index file.
72 \global\let\tiepenalty = \@M
73 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
80 % If this character appears in an error message or help string, it
81 % starts a new line in the output.
84 % Set up fixed words for English.
85 \ifx\putwordChapter\undefined{\gdef\putwordChapter{Chapter}}\fi%
86 \def\putwordInfo{Info}%
87 \ifx\putwordSee\undefined{\gdef\putwordSee{See}}\fi%
88 \ifx\putwordsee\undefined{\gdef\putwordsee{see}}\fi%
89 \ifx\putwordfile\undefined{\gdef\putwordfile{file}}\fi%
90 \ifx\putwordpage\undefined{\gdef\putwordpage{page}}\fi%
91 \ifx\putwordsection\undefined{\gdef\putwordsection{section}}\fi%
92 \ifx\putwordSection\undefined{\gdef\putwordSection{Section}}\fi%
93 \ifx\putwordTableofContents\undefined{\gdef\putwordTableofContents{Table of Contents}}\fi%
94 \ifx\putwordShortContents\undefined{\gdef\putwordShortContents{Short Contents}}\fi%
95 \ifx\putwordAppendix\undefined{\gdef\putwordAppendix{Appendix}}\fi%
101 \hyphenation{ap-pen-dix}
102 \hyphenation{mini-buf-fer mini-buf-fers}
105 % Margin to add to right of even pages, to left of odd pages.
106 \newdimen \bindingoffset
107 \newdimen \normaloffset
108 \newdimen\pagewidth \newdimen\pageheight
110 % Sometimes it is convenient to have everything in the transcript file
111 % and nothing on the terminal. We don't just call \tracingall here,
112 % since that produces some useless output on the terminal.
114 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
115 \def\loggingall{\tracingcommands2 \tracingstats2
116 \tracingpages1 \tracingoutput1 \tracinglostchars1
117 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
118 \showboxbreadth\maxdimen\showboxdepth\maxdimen
121 % For @cropmarks command.
122 % Do @cropmarks to get crop marks.
125 \let\cropmarks = \cropmarkstrue
127 % Dimensions to add cropmarks at corners.
128 % Added by P. A. MacKay, 12 Nov. 1986
130 \newdimen\cornerlong \newdimen\cornerthick
131 \newdimen\topandbottommargin
132 \newdimen\outerhsize \newdimen\outervsize
133 \cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks
136 % Alternative @smallbook page size is 9.25in
138 \topandbottommargin=.75in
140 % Main output routine.
142 \output = {\onepageout{\pagecontents\PAGE}}
147 % \onepageout takes a vbox as an argument. Note that \pagecontents
148 % does insertions, but you have to call it yourself.
150 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
152 \ifodd\pageno \advance\hoffset by \bindingoffset
153 \else \advance\hoffset by -\bindingoffset\fi
155 % Do this outside of the \shipout so @code etc. will be expanded in
156 % the headline as they should be, not taken literally (outputting ''code).
157 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
158 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
161 % Have to do this stuff outside the \shipout because we want it to
162 % take effect in \write's, yet the group defined by the \vbox ends
163 % before the \shipout runs.
165 \escapechar = `\\ % use backslash in output files.
166 \indexdummies % don't expand commands in the output.
167 \normalturnoffactive % \ in index entries must not stay \, e.g., if
168 % the page break happens to be in the middle of an example.
170 \ifcropmarks \vbox to \outervsize\bgroup
172 \line{\ewtop\hfil\ewtop}%
175 \vbox{\moveleft\cornerthick\nstop}%
177 \vbox{\moveright\cornerthick\nstop}%
179 \vskip\topandbottommargin
181 \hfil % center the page within the outer (page) hsize.
182 \ifodd\pageno\hskip\bindingoffset\fi
188 \ifdim\ht\footlinebox > 0pt
189 % Only leave this space if the footline is nonempty.
190 % (We lessened \vsize for it in \oddfootingxxx.)
191 % The \baselineskip=24pt in plain's \makefootline has no effect.
192 \vskip 2\baselineskip
197 \egroup % end of \vbox\bgroup
198 \hfil\egroup % end of (centering) \line\bgroup
199 \vskip\topandbottommargin plus1fill minus1fill
200 \boxmaxdepth = \cornerthick
202 \vbox{\moveleft\cornerthick\nsbot}%
204 \vbox{\moveright\cornerthick\nsbot}%
207 \line{\ewbot\hfil\ewbot}%
208 \egroup % \vbox from first cropmarks clause
210 }% end of \shipout\vbox
211 }% end of group with \turnoffactive
213 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
216 \newinsert\margin \dimen\margin=\maxdimen
218 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
220 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
221 % marginal hacks, juha@viisa.uucp (Juha Takala)
222 \ifvoid\margin\else % marginal info is present
223 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
224 \dimen@=\dp#1 \unvbox#1
225 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
226 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
229 % Here are the rules for the cropmarks. Note that they are
230 % offset so that the space between them is truly \outerhsize or \outervsize
231 % (P. A. MacKay, 12 November, 1986)
233 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
235 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
236 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
238 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
240 % Parse an argument, then pass it to #1. The argument is the rest of
241 % the input line (except we remove a trailing comment). #1 should be a
242 % macro which expects an ordinary undelimited TeX argument.
248 \futurelet\temp\parseargx
251 % If the next token is an obeyed space (from an @example environment or
252 % the like), remove it and recurse. Otherwise, we're done.
254 % \obeyedspace is defined far below, after the definition of \sepspaces.
255 \ifx\obeyedspace\temp
256 \expandafter\parseargdiscardspace
258 \expandafter\parseargline
262 % Remove a single space (as the delimiter token to the macro call).
264 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
267 \gdef\parseargline#1^^M{%
268 \endgroup % End of the group started in \parsearg.
270 % First remove any @c comment, then any @comment.
271 % Result of each macro is put in \toks0.
272 \argremovec #1\c\relax %
273 \expandafter\argremovecomment \the\toks0 \comment\relax %
275 % Call the caller's macro, saved as \next in \parsearg.
276 \expandafter\next\expandafter{\the\toks0}%
280 % Since all \c{,omment} does is throw away the argument, we can let TeX
281 % do that for us. The \relax here is matched by the \relax in the call
282 % in \parseargline; it could be more or less anything, its purpose is
283 % just to delimit the argument to the \c.
284 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
285 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
287 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
288 % @end itemize @c foo
289 % will have two active spaces as part of the argument with the
290 % `itemize'. Here we remove all active spaces from #1, and assign the
293 % This loses if there are any *other* active characters besides spaces
294 % in the argument -- _ ^ +, for example -- since they get expanded.
295 % Fortunately, Texinfo does not define any such commands. (If it ever
296 % does, the catcode of the characters in questionwill have to be changed
297 % here.) But this means we cannot call \removeactivespaces as part of
298 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
299 % that \parsearg gets might well have any character at all in it.
301 \def\removeactivespaces#1{%
305 \global\toks0 = \expandafter{\temp}%
309 % Change the active space to expand to nothing.
313 \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
317 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
319 %% These are used to keep @begin/@end levels from running away
320 %% Call \inENV within environments (after a \begingroup)
321 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
323 \ifENV\errmessage{Still within an environment. Type Return to continue.}
324 \endgroup\fi} % This is not perfect, but it should reduce lossage
326 % @begin foo is the same as @foo, for now.
327 \newhelp\EMsimple{Type <Return> to continue.}
329 \outer\def\begin{\parsearg\beginxxx}
332 \expandafter\ifx\csname #1\endcsname\relax
333 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
334 \csname #1\endcsname\fi}
336 % @end foo executes the definition of \Efoo.
338 \def\end{\parsearg\endxxx}
340 \removeactivespaces{#1}%
341 \edef\endthing{\the\toks0}%
343 \expandafter\ifx\csname E\endthing\endcsname\relax
344 \expandafter\ifx\csname \endthing\endcsname\relax
345 % There's no \foo, i.e., no ``environment'' foo.
347 \errmessage{Undefined command `@end \endthing'}%
349 \unmatchedenderror\endthing
352 % Everything's ok; the right environment has been started.
353 \csname E\endthing\endcsname
357 % There is an environment #1, but it hasn't been started. Give an error.
359 \def\unmatchedenderror#1{%
361 \errmessage{This `@end #1' doesn't have a matching `@#1'}%
364 % Define the control sequence \E#1 to give an unmatched @end error.
366 \def\defineunmatchedend#1{%
367 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
371 % Single-spacing is done by various environments (specifically, in
372 % \nonfillstart and \quotations).
373 \newskip\singlespaceskip \singlespaceskip = 12.5pt
375 % Why was this kern here? It messes up equalizing space above and below
376 % environments. --karl, 6may93
377 %{\advance \baselineskip by -\singlespaceskip
378 %\kern \baselineskip}%
379 \setleading \singlespaceskip
382 %% Simple single-character @ commands
385 % Kludge this until the fonts are right (grr).
386 \def\@{{\tt \char '100}}
388 % This is turned off because it was never documented
389 % and you can use @w{...} around a quote to suppress ligatures.
390 %% Define @` and @' to be the same as ` and '
391 %% but suppressing ligatures.
395 % Used to generate quoted braces.
396 \def\mylbrace {{\tt \char '173}}
397 \def\myrbrace {{\tt \char '175}}
401 % Definitions to produce actual \{ & \} command in an index.
402 \catcode`\{ = 12 \catcode`\} = 12
403 \catcode`\[ = 1 \catcode`\] = 2
404 \catcode`\@ = 0 \catcode`\\ = 12
409 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
410 % Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
413 \def\ringaccent#1{{\accent23 #1}}
418 % Other special characters: @questiondown @exclamdown
419 % Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
420 \def\questiondown{?`}
423 % Dotless i and dotless j, used for accents.
428 \ifx\temp\imacro \ptexi
429 \else\ifx\temp\jmacro \j
430 \else \errmessage{@dotless can be used only with i or j}%
434 % @: forces normal size whitespace following.
435 \def\:{\spacefactor=1000 }
437 % @* forces a line break.
438 \def\*{\hfil\break\hbox{}\ignorespaces}
440 % @. is an end-of-sentence period.
441 \def\.{.\spacefactor=3000 }
443 % @enddots{} is an end-of-sentence ellipsis.
444 \gdef\enddots{$\mathinner{\ldotp\ldotp\ldotp\ldotp}$\spacefactor=3000}
446 % @! is an end-of-sentence bang.
447 \gdef\!{!\spacefactor=3000 }
449 % @? is an end-of-sentence query.
450 \gdef\?{?\spacefactor=3000 }
452 % @w prevents a word break. Without the \leavevmode, @w at the
453 % beginning of a paragraph, when TeX is still in vertical mode, would
454 % produce a whole line of output instead of starting the paragraph.
455 \def\w#1{\leavevmode\hbox{#1}}
457 % @group ... @end group forces ... to be all on one page, by enclosing
458 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
459 % to keep its height that of a normal line. According to the rules for
460 % \topskip (p.114 of the TeXbook), the glue inserted is
461 % max (\topskip - \ht (first item), 0). If that height is large,
462 % therefore, no glue is inserted, and the space between the headline and
463 % the text is small, which looks bad.
465 \def\group{\begingroup
466 \ifnum\catcode13=\active \else
467 \errhelp = \groupinvalidhelp
468 \errmessage{@group invalid in context where filling is enabled}%
471 % The \vtop we start below produces a box with normal height and large
472 % depth; thus, TeX puts \baselineskip glue before it, and (when the
473 % next line of text is done) \lineskip glue after it. (See p.82 of
474 % the TeXbook.) Thus, space below is not quite equal to space
475 % above. But it's pretty close.
477 \egroup % End the \vtop.
478 \endgroup % End the \group.
482 % We have to put a strut on the last line in case the @group is in
483 % the midst of an example, rather than completely enclosing it.
484 % Otherwise, the interline space between the last line of the group
485 % and the first line afterwards is too small. But we can't put the
486 % strut in \Egroup, since there it would be on a line by itself.
487 % Hence this just inserts a strut at the beginning of each line.
488 \everypar = {\strut}%
490 % Since we have a strut on every line, we don't need any of TeX's
491 % normal interline spacing.
494 % OK, but now we have to do something about blank
495 % lines in the input in @example-like environments, which normally
496 % just turn into \lisppar, which will insert no space now that we've
497 % turned off the interline space. Simplest is to make them be an
500 \edef\par{\leavevmode \par}%
502 % Reset ^^M's definition to new definition of \par.
506 % Do @comment since we are called inside an environment such as
507 % @example, where each end-of-line in the input causes an
508 % end-of-line in the output. We don't want the end-of-line after
509 % the `@group' to put extra space in the output. Since @group
510 % should appear on a line by itself (according to the Texinfo
511 % manual), we don't worry about eating any user text.
515 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
516 % message, so this ends up printing `@group can only ...'.
518 \newhelp\groupinvalidhelp{%
519 group can only be used in environments such as @example,^^J%
520 where each line of input produces a line of output.}
522 % @need space-in-mils
523 % forces a page break if there is not space-in-mils remaining.
525 \newdimen\mil \mil=0.001in
527 \def\need{\parsearg\needx}
529 % Old definition--didn't work.
530 %\def\needx #1{\par %
531 %% This method tries to make TeX break the page naturally
532 %% if the depth of the box does not fit.
534 %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
539 % Go into vertical mode, so we don't make a big box in the middle of a
543 % Don't add any leading before our big empty box, but allow a page
544 % break, since the best break might be right here.
547 \vtop to #1\mil{\vfil}%
549 % TeX does not even consider page breaks if a penalty added to the
550 % main vertical list is 10000 or more. But in order to see if the
551 % empty box we just added fits on the page, we must make it consider
552 % page breaks. On the other hand, we don't want to actually break the
553 % page after the empty box. So we use a penalty of 9999.
555 % There is an extremely small chance that TeX will actually break the
556 % page at this \penalty, if there are no other feasible breakpoints in
557 % sight. (If the user is using lots of big @group commands, which
558 % almost-but-not-quite fill up a page, TeX will have a hard time doing
559 % good page breaking, for example.) However, I could not construct an
560 % example where a page broke at this \penalty; if it happens in a real
561 % document, then we can reconsider our strategy.
564 % Back up by the size of the box, whether we did a page break or not.
567 % Do not allow a page break right after this kern.
571 % @br forces paragraph break
575 % @dots{} output some dots
579 % @page forces the start of a new page
581 \def\page{\par\vfill\supereject}
584 % outputs text on separate line in roman font, starting at standard page margin
586 % This records the amount of indent in the innermost environment.
587 % That's how much \exdent should take out.
588 \newskip\exdentamount
590 % This defn is used inside fill environments such as @defun.
591 \def\exdent{\parsearg\exdentyyy}
592 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
594 % This defn is used inside nofill environments such as @example.
595 \def\nofillexdent{\parsearg\nofillexdentyyy}
596 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
597 \leftline{\hskip\leftskip{\rm#1}}}}
599 % @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
602 \strut\vadjust{\nobreak\kern-\strutdepth
603 \vtop to \strutdepth{\baselineskip\strutdepth\vss
604 \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
605 \newskip\inmarginspacing \inmarginspacing=1cm
606 \def\strutdepth{\dp\strutbox}
608 %\hbox{{\rm#1}}\hfil\break}}
610 % @include file insert text of that file as input.
611 % Allow normal characters that we make active in the argument (a file name).
612 \def\include{\begingroup
621 \parsearg\includezzz}
622 % Restore active chars for included file.
623 \def\includezzz#1{\endgroup\begingroup
624 % Read the included file in a group so nested @include's work.
631 % @center line outputs that line, centered
633 \def\center{\parsearg\centerzzz}
634 \def\centerzzz #1{{\advance\hsize by -\leftskip
635 \advance\hsize by -\rightskip
638 % @sp n outputs n lines of vertical space
640 \def\sp{\parsearg\spxxx}
641 \def\spxxx #1{\vskip #1\baselineskip}
643 % @comment ...line which is ignored...
644 % @c is the same as @comment
645 % @ignore ... @end ignore is another way to write a comment
647 \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
648 \parsearg \commentxxx}
650 \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
654 % @paragraphindent is defined for the Info formatting commands only.
655 \let\paragraphindent=\comment
657 % Prevent errors for section commands.
658 % Used in @ignore and in failing conditionals.
659 \def\ignoresections{%
661 \let\unnumbered=\relax
663 \let\unnumberedsec=\relax
664 \let\unnumberedsection=\relax
665 \let\unnumberedsubsec=\relax
666 \let\unnumberedsubsection=\relax
667 \let\unnumberedsubsubsec=\relax
668 \let\unnumberedsubsubsection=\relax
671 \let\subsubsec=\relax
672 \let\subsection=\relax
673 \let\subsubsection=\relax
675 \let\appendixsec=\relax
676 \let\appendixsection=\relax
677 \let\appendixsubsec=\relax
678 \let\appendixsubsection=\relax
679 \let\appendixsubsubsec=\relax
680 \let\appendixsubsubsection=\relax
682 \let\smallbook=\relax
683 \let\titlepage=\relax
686 % Used in nested conditionals, where we have to parse the Texinfo source
687 % and so want to turn off most commands, in case they are used
690 \def\ignoremorecommands{%
691 \let\defcodeindex = \relax
695 \let\defindex = \relax
696 \let\defivar = \relax
698 \let\defmethod = \relax
701 \let\defspec = \relax
703 \let\deftypefn = \relax
704 \let\deftypefun = \relax
705 \let\deftypevar = \relax
706 \let\deftypevr = \relax
712 \let\printindex = \relax
714 \let\settitle = \relax
715 \let\setchapternewpage = \relax
716 \let\setchapterstyle = \relax
717 \let\everyheading = \relax
718 \let\evenheading = \relax
719 \let\oddheading = \relax
720 \let\everyfooting = \relax
721 \let\evenfooting = \relax
722 \let\oddfooting = \relax
723 \let\headings = \relax
724 \let\include = \relax
725 \let\lowersections = \relax
727 \let\raisesections = \relax
734 % Ignore @ignore ... @end ignore.
736 \def\ignore{\doignore{ignore}}
738 % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
740 \def\ifinfo{\doignore{ifinfo}}
741 \def\ifhtml{\doignore{ifhtml}}
742 \def\ifnottex{\doignore{ifnottex}}
743 \def\html{\doignore{html}}
744 \def\menu{\doignore{menu}}
745 \def\direntry{\doignore{direntry}}
747 % Also ignore @macro ... @end macro. The user must run texi2dvi,
748 % which runs makeinfo to do macro expansion. Ignore @unmacro, too.
749 \def\macro{\doignore{macro}}
750 \let\unmacro = \comment
753 % @dircategory CATEGORY -- specify a category of the dir file
754 % which this file should belong to. Ignore this in TeX.
755 \let\dircategory = \comment
757 % Ignore text until a line `@end #1'.
759 \def\doignore#1{\begingroup
760 % Don't complain about control sequences we have declared \outer.
763 % Define a command to swallow text until we reach `@end #1'.
764 \long\def\doignoretext##1\end #1{\enddoignore}%
766 % Make sure that spaces turn into tokens that match what \doignoretext wants.
769 % Ignore braces, too, so mismatched braces don't cause trouble.
773 % And now expand that command.
777 % What we do to finish off ignored text.
779 \def\enddoignore{\endgroup\ignorespaces}%
781 \newif\ifwarnedobs\warnedobsfalse
783 \ifwarnedobs\relax\else
784 % We need to warn folks that they may have trouble with TeX 3.0.
785 % This uses \immediate\write16 rather than \message to get newlines.
787 \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
788 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
789 \immediate\write16{If you are running another version of TeX, relax.}
790 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
791 \immediate\write16{ Then upgrade your TeX installation if you can.}
792 \immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
793 \immediate\write16{If you are stuck with version 3.0, run the}
794 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
795 \immediate\write16{ to use a workaround.}
797 \global\warnedobstrue
801 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
802 % workaround (which requires the file ``dummy.tfm'' to be installed),
803 % uncomment the following line:
804 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
806 % Ignore text, except that we keep track of conditional commands for
807 % purposes of nesting, up to an `@end #1' command.
809 \def\nestedignore#1{%
811 % We must actually expand the ignored text to look for the @end
812 % command, so that nested ignore constructs work. Thus, we put the
813 % text into a \vbox and then do nothing with the result. To minimize
814 % the change of memory overflow, we follow the approach outlined on
815 % page 401 of the TeXbook: make the current font be a dummy font.
817 \setbox0 = \vbox\bgroup
818 % Don't complain about control sequences we have declared \outer.
821 % Define `@end #1' to end the box, which will in turn undefine the
822 % @end command again.
823 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
825 % We are going to be parsing Texinfo commands. Most cause no
826 % trouble when they are used incorrectly, but some commands do
827 % complicated argument parsing or otherwise get confused, so we
830 % We can't do anything about stray @-signs, unfortunately;
831 % they'll produce `undefined control sequence' errors.
834 % Set the current font to be \nullfont, a TeX primitive, and define
835 % all the font commands to also use \nullfont. We don't use
836 % dummy.tfm, as suggested in the TeXbook, because not all sites
837 % might have that installed. Therefore, math mode will still
838 % produce output, but that should be an extremely small amount of
839 % stuff compared to the main input.
842 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
843 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
844 \let\tensf = \nullfont
845 % Similarly for index fonts (mostly for their use in
847 \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
848 \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
849 \let\indsf = \nullfont
851 % Don't complain when characters are missing from the fonts.
852 \tracinglostchars = 0
854 % Don't bother to do space factor calculations.
857 % Don't report underfull hboxes.
860 % Do minimal line-breaking.
861 \pretolerance = 10000
863 % Do not execute instructions in @tex
864 \def\tex{\doignore{tex}}%
867 % @set VAR sets the variable VAR to an empty value.
868 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
870 % Since we want to separate VAR from REST-OF-LINE (which might be
871 % empty), we can't just use \parsearg; we have to insert a space of our
872 % own to delimit the rest of the line, and then take it out again if we
873 % didn't need it. Make sure the catcode of space is correct to avoid
874 % losing inside @example, for instance.
876 \def\set{\begingroup\catcode` =10
877 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
879 \def\setxxx#1{\setyyy#1 \endsetyyy}
880 \def\setyyy#1 #2\endsetyyy{%
882 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
883 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
887 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
888 % \next or other control sequences that we've defined might get us into
889 % an infinite loop. Consider `@set foo @cite{bar}'.
890 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
892 % @clear VAR clears (i.e., unsets) the variable VAR.
894 \def\clear{\parsearg\clearxxx}
895 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
897 % @value{foo} gets the text saved in variable foo.
899 \def\value{\begingroup
900 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
903 \expandafter\ifx\csname SET#1\endcsname\relax
904 {\{No value for ``#1''\}}%
906 \csname SET#1\endcsname
910 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
913 \def\ifset{\parsearg\ifsetxxx}
915 \expandafter\ifx\csname SET#1\endcsname\relax
916 \expandafter\ifsetfail
918 \expandafter\ifsetsucceed
921 \def\ifsetsucceed{\conditionalsucceed{ifset}}
922 \def\ifsetfail{\nestedignore{ifset}}
923 \defineunmatchedend{ifset}
925 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
926 % defined with @set, or has been undefined with @clear.
928 \def\ifclear{\parsearg\ifclearxxx}
930 \expandafter\ifx\csname SET#1\endcsname\relax
931 \expandafter\ifclearsucceed
933 \expandafter\ifclearfail
936 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
937 \def\ifclearfail{\nestedignore{ifclear}}
938 \defineunmatchedend{ifclear}
940 % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
941 % following, through the first @end iftex (etc.). Make `@end iftex'
942 % (etc.) valid only after an @iftex.
944 \def\iftex{\conditionalsucceed{iftex}}
945 \def\ifnothtml{\conditionalsucceed{ifnothtml}}
946 \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
947 \defineunmatchedend{iftex}
948 \defineunmatchedend{ifnothtml}
949 \defineunmatchedend{ifnotinfo}
951 % We can't just want to start a group at @iftex (for example) and end it
952 % at @end iftex, since then @set commands inside the conditional have no
953 % effect (they'd get reverted at the end of the group). So we must
954 % define \Eiftex to redefine itself to be its previous value. (We can't
955 % just define it to fail again with an ``unmatched end'' error, since
956 % the @ifset might be nested.)
958 \def\conditionalsucceed#1{%
960 % Remember the current value of \E#1.
961 \let\nece{prevE#1} = \nece{E#1}%
963 % At the `@end #1', redefine \E#1 to be its previous value.
964 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
969 % We need to expand lots of \csname's, but we don't want to expand the
970 % control sequences after we've constructed them.
972 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
974 % @asis just yields its argument. Used with @table, for example.
978 % @math means output in math mode.
979 % We don't use $'s directly in the definition of \math because control
980 % sequences like \math are expanded when the toc file is written. Then,
981 % we read the toc file back, the $'s will be normal characters (as they
982 % should be, according to the definition of Texinfo). So we must use a
983 % control sequence to switch into and out of math mode.
985 % This isn't quite enough for @math to work properly in indices, but it
986 % seems unlikely it will ever be needed there.
988 \let\implicitmath = $
989 \def\math#1{\implicitmath #1\implicitmath}
991 % @bullet and @minus need the same treatment as @math, just above.
992 \def\bullet{\implicitmath\ptexbullet\implicitmath}
993 \def\minus{\implicitmath-\implicitmath}
995 \def\node{\ENVcheck\parsearg\nodezzz}
996 \def\nodezzz#1{\nodexxx [#1,]}
997 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
1001 \def\donoderef{\ifx\lastnode\relax\else
1002 \expandafter\expandafter\expandafter\setref{\lastnode}\fi
1003 \global\let\lastnode=\relax}
1005 \def\unnumbnoderef{\ifx\lastnode\relax\else
1006 \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
1007 \global\let\lastnode=\relax}
1009 \def\appendixnoderef{\ifx\lastnode\relax\else
1010 \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
1011 \global\let\lastnode=\relax}
1013 % @refill is a no-op.
1016 % @setfilename is done at the beginning of every texinfo file.
1017 % So open here the files we need to have open while reading the input.
1018 % This makes it possible to make a .fmt file for texinfo.
1023 \fixbackslash % Turn off hack to swallow `\input texinfo'.
1024 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
1026 % If texinfo.cnf is present on the system, read it.
1027 % Useful for site-wide @afourpaper, etc.
1028 % Just to be on the safe side, close the input stream before the \input.
1029 \openin 1 texinfo.cnf
1030 \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
1034 \comment % Ignore the actual filename.
1038 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1040 % \def\macro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\macroxxx}
1041 % \def\macroxxx#1#2 \end macro{%
1042 % \expandafter\gdef\macrotemp#1{#2}%
1045 %\def\linemacro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\linemacroxxx}
1046 %\def\linemacroxxx#1#2 \end linemacro{%
1047 %\let\parsearg=\relax
1048 %\edef\macrotempx{\csname M\butfirst\expandafter\string\macrotemp\endcsname}%
1049 %\expandafter\xdef\macrotemp{\parsearg\macrotempx}%
1050 %\expandafter\gdef\macrotempx#1{#2}%
1058 % Font-change commands.
1060 % Texinfo supports the sans serif font style, which plain TeX does not.
1061 % So we set up a \sf analogous to plain's \rm, etc.
1063 \def\sf{\fam=\sffam \tensf}
1064 \let\li = \sf % Sometimes we call it \li, not \sf.
1066 % We don't need math for this one.
1069 % Use Computer Modern fonts at \magstephalf (11pt).
1070 \newcount\mainmagstep
1071 \mainmagstep=\magstephalf
1073 % Set the font macro #1 to the font named #2, adding on the
1074 % specified font prefix (normally `cm').
1075 % #3 is the font's design size, #4 is a scale factor
1076 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1078 % Use cm as the default font prefix.
1079 % To specify the font prefix, you must define \fontprefix
1080 % before you read in texinfo.tex.
1081 \ifx\fontprefix\undefined
1084 % Support font families that don't use the same naming scheme as CM.
1086 \def\rmbshape{bx} %where the normal face is bold
1091 \def\ttslshape{sltt}
1102 \let\mainmagstep=\magstep1
1103 \setfont\textrm\rmshape{12}{1000}
1104 \setfont\texttt\ttshape{12}{1000}
1106 \setfont\textrm\rmshape{10}{\mainmagstep}
1107 \setfont\texttt\ttshape{10}{\mainmagstep}
1109 % Instead of cmb10, you many want to use cmbx10.
1110 % cmbx10 is a prettier font on its own, but cmb10
1111 % looks better when embedded in a line with cmr10.
1112 \setfont\textbf\bfshape{10}{\mainmagstep}
1113 \setfont\textit\itshape{10}{\mainmagstep}
1114 \setfont\textsl\slshape{10}{\mainmagstep}
1115 \setfont\textsf\sfshape{10}{\mainmagstep}
1116 \setfont\textsc\scshape{10}{\mainmagstep}
1117 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1118 \font\texti=cmmi10 scaled \mainmagstep
1119 \font\textsy=cmsy10 scaled \mainmagstep
1121 % A few fonts for @defun, etc.
1122 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1123 \setfont\deftt\ttshape{10}{\magstep1}
1124 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1126 % Fonts for indices and small examples (9pt).
1127 % We actually use the slanted font rather than the italic,
1128 % because texinfo normally uses the slanted fonts for that.
1129 % Do not make many font distinctions in general in the index, since they
1130 % aren't very useful.
1131 \setfont\ninett\ttshape{9}{1000}
1132 \setfont\indrm\rmshape{9}{1000}
1133 \setfont\indit\slshape{9}{1000}
1136 \let\indttsl=\ninett
1139 \setfont\indsc\scshape{10}{900}
1143 % Chapter (and unnumbered) fonts (17.28pt).
1144 \setfont\chaprm\rmbshape{12}{\magstep2}
1145 \setfont\chapit\itbshape{10}{\magstep3}
1146 \setfont\chapsl\slbshape{10}{\magstep3}
1147 \setfont\chaptt\ttbshape{12}{\magstep2}
1148 \setfont\chapttsl\ttslshape{10}{\magstep3}
1149 \setfont\chapsf\sfbshape{12}{\magstep2}
1151 \setfont\chapsc\scbshape{10}{\magstep3}
1152 \font\chapi=cmmi12 scaled \magstep2
1153 \font\chapsy=cmsy10 scaled \magstep3
1155 % Section fonts (14.4pt).
1156 \setfont\secrm\rmbshape{12}{\magstep1}
1157 \setfont\secit\itbshape{10}{\magstep2}
1158 \setfont\secsl\slbshape{10}{\magstep2}
1159 \setfont\sectt\ttbshape{12}{\magstep1}
1160 \setfont\secttsl\ttslshape{10}{\magstep2}
1161 \setfont\secsf\sfbshape{12}{\magstep1}
1163 \setfont\secsc\scbshape{10}{\magstep2}
1164 \font\seci=cmmi12 scaled \magstep1
1165 \font\secsy=cmsy10 scaled \magstep2
1167 % \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
1168 % \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
1169 % \setfont\ssecsl\slshape{10}{\magstep1}
1170 % \setfont\ssectt\ttshape{10}{\magstep1}
1171 % \setfont\ssecsf\sfshape{10}{\magstep1}
1173 %\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
1174 %\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
1175 %\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
1176 %\setfont\ssectt\ttshape{10}{1315}
1177 %\setfont\ssecsf\sfshape{10}{1315}
1179 %\let\ssecbf=\ssecrm
1181 % Subsection fonts (13.15pt).
1182 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1183 \setfont\ssecit\itbshape{10}{1315}
1184 \setfont\ssecsl\slbshape{10}{1315}
1185 \setfont\ssectt\ttbshape{12}{\magstephalf}
1186 \setfont\ssecttsl\ttslshape{10}{\magstep1}
1187 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1189 \setfont\ssecsc\scbshape{10}{\magstep1}
1190 \font\sseci=cmmi12 scaled \magstephalf
1191 \font\ssecsy=cmsy10 scaled \magstep1
1192 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1193 % but that is not a standard magnification.
1195 % Fonts for title page:
1196 \setfont\titlerm\rmbshape{12}{\magstep3}
1197 \let\authorrm = \secrm
1199 % In order for the font changes to affect most math symbols and letters,
1200 % we have to define the \textfont of the standard families. Since
1201 % texinfo doesn't allow for producing subscripts and superscripts, we
1202 % don't bother to reset \scriptfont and \scriptscriptfont (which would
1203 % also require loading a lot more fonts).
1205 \def\resetmathfonts{%
1206 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1207 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1208 \textfont\ttfam = \tentt \textfont\sffam = \tensf
1212 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1213 % of just \STYLE. We do this so that font changes will continue to work
1214 % in math mode, where it is the current \fam that is relevant in most
1215 % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
1216 % \tenbf}, for example. By redefining \tenbf, we obviate the need to
1217 % redefine \bf itself.
1219 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1220 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1221 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1224 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1225 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1226 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1227 \resetmathfonts \setleading{19pt}}
1229 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1230 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1231 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1232 \resetmathfonts \setleading{16pt}}
1234 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1235 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1236 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1237 \resetmathfonts \setleading{15pt}}
1238 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1240 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
1241 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
1242 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
1243 \resetmathfonts \setleading{12pt}}
1245 % Set up the default fonts, so we can use them for creating boxes.
1249 % Count depth in font-changes, for error checks
1250 \newcount\fontdepth \fontdepth=0
1252 % Fonts for short table of contents.
1253 \setfont\shortcontrm\rmshape{12}{1000}
1254 \setfont\shortcontbf\bxshape{12}{1000}
1255 \setfont\shortcontsl\slshape{12}{1000}
1257 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1258 %% serif) and @ii for TeX italic
1260 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1261 % unless the following character is such as not to need one.
1262 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1263 \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
1266 \let\var=\smartitalic
1267 \let\dfn=\smartitalic
1268 \let\emph=\smartitalic
1269 \let\cite=\smartitalic
1274 % We can't just use \exhyphenpenalty, because that only has effect at
1275 % the end of a paragraph. Restore normal hyphenation at the end of the
1276 % group within which \nohyphenation is presumably called.
1278 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1279 \def\restorehyphenation{\hyphenchar\font = `- }
1282 {\tt \rawbackslash \frenchspacing #1}%
1286 \def\samp #1{`\tclose{#1}'\null}
1287 \setfont\smallrm\rmshape{8}{1000}
1289 \def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
1290 \raise0.4pt\hbox{$\langle$}\kern-.08em\vtop{%
1291 \vbox{\hrule\kern-0.4pt
1292 \hbox{\raise0.4pt\hbox{\vphantom{$\langle$}}#1}}%
1294 \kern-.06em\raise0.4pt\hbox{$\rangle$}}}}
1295 % The old definition, with no lozenge:
1296 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1297 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1301 % @code is a modification of @t,
1302 % which makes spaces the same size as normal in the surrounding text.
1305 % Change normal interword space to be same as for the current font.
1306 \spaceskip = \fontdimen2\font
1308 % Switch to typewriter.
1311 % But `\ ' produces the large typewriter interword space.
1312 \def\ {{\spaceskip = 0pt{} }}%
1314 % Turn off hyphenation.
1324 % We *must* turn on hyphenation at `-' and `_' in \code.
1325 % Otherwise, it is too hard to avoid overfull hboxes
1326 % in the Emacs manual, the Library manual, etc.
1328 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1329 % both hyphenation at - and hyphenation within words.
1330 % We must therefore turn them both off (\tclose does that)
1331 % and arrange explicitly to hyphenate at a dash.
1337 \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
1338 % The following is used by \doprintindex to insure that long function names
1339 % wrap around. It is necessary for - and _ to be active before the index is
1340 % read from the file, as \entry parses the arguments long before \code is
1341 % ever called. -- mycroft
1342 % _ is always active; and it shouldn't be \let = to an _ that is a
1343 % subscript character anyway. Then, @cindex @samp{_} (for example)
1345 \global\def\indexbreaks{%
1346 \catcode`\-=\active \let-\realdash
1351 \def\codedash{-\discretionary{}{}{}}
1352 \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
1353 \def\codex #1{\tclose{#1}\endgroup}
1355 %\let\exp=\tclose %Was temporary
1357 % @kbd is like @code, except that if the argument is just one @key command,
1358 % then @kbd has no effect.
1360 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
1361 % `example' (@kbd uses ttsl only inside of @example and friends),
1362 % or `code' (@kbd uses normal tty font always).
1363 \def\kbdinputstyle{\parsearg\kbdinputstylexxx}
1364 \def\kbdinputstylexxx#1{%
1366 \ifx\arg\worddistinct
1367 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
1368 \else\ifx\arg\wordexample
1369 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
1370 \else\ifx\arg\wordcode
1371 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
1374 \def\worddistinct{distinct}
1375 \def\wordexample{example}
1378 % Default is kbdinputdistinct. (Too much of a hassle to call the macro,
1379 % the catcodes are wrong for parsearg to work.)
1380 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
1383 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1384 \ifx\one\xkey\ifx\threex\three \key{#2}%
1385 \else{\tclose{\kbdfont\look}}\fi
1386 \else{\tclose{\kbdfont\look}}\fi}
1388 % @url, @email. Quotes do not seem necessary.
1389 \let\url=\code % perhaps include a hypertex \special eventually
1390 % rms does not like the angle brackets --karl, 17may97.
1391 %\def\email#1{$\langle${\tt #1}$\rangle$}
1394 % @uref (abbreviation for `urlref') takes an optional second argument
1395 % specifying the text to display. First (mandatory) arg is the url.
1397 \def\uref#1{\urefxxx #1,,\finish}
1398 \def\urefxxx#1,#2,#3\finish{%
1399 \setbox0 = \hbox{\ignorespaces #2}%
1401 \unhbox0\ (\code{#1})%
1407 % Check if we are currently using a typewriter font. Since all the
1408 % Computer Modern typewriter fonts have zero interword stretch (and
1409 % shrink), and it is reasonable to expect all typewriter fonts to have
1410 % this property, we can check that font parameter.
1412 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1414 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1415 % argument is to make the input look right: @dmn{pt} instead of
1418 \def\dmn#1{\thinspace #1}
1420 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1422 % @l was never documented to mean ``switch to the Lisp font'',
1423 % and it is not used as such in any manual I can find. We need it for
1424 % Polish suppressed-l. --karl, 22sep96.
1425 %\def\l#1{{\li #1}\null}
1427 \def\r#1{{\rm #1}} % roman font
1428 % Use of \lowercase was suggested.
1429 \def\sc#1{{\smallcaps#1}} % smallcaps font
1430 \def\ii#1{{\it #1}} % italic font
1432 % @pounds{} is a sterling sign.
1433 \def\pounds{{\it\$}}
1436 \message{page headings,}
1438 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1439 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1441 % First the title page. Must do @settitle before @titlepage.
1442 \def\titlefont#1{{\titlerm #1}}
1445 \newif\iffinishedtitlepage
1447 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1448 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1449 \endgroup\page\hbox{}\page}
1451 \def\titlepage{\begingroup \parindent=0pt \textfonts
1452 \let\subtitlerm=\tenrm
1453 % I deinstalled the following change because \cmr12 is undefined.
1454 % This change was not in the ChangeLog anyway. --rms.
1455 % \let\subtitlerm=\cmr12
1456 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1458 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1460 % Leave some space at the very top of the page.
1461 \vglue\titlepagetopglue
1463 % Now you can print the title using @title.
1464 \def\title{\parsearg\titlezzz}%
1465 \def\titlezzz##1{\leftline{\titlefont{##1}}
1466 % print a rule at the page bottom also.
1467 \finishedtitlepagefalse
1468 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1469 % No rule at page bottom unless we print one at the top with @title.
1470 \finishedtitlepagetrue
1472 % Now you can put text using @subtitle.
1473 \def\subtitle{\parsearg\subtitlezzz}%
1474 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1476 % @author should come last, but may come many times.
1477 \def\author{\parsearg\authorzzz}%
1478 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1479 {\authorfont \leftline{##1}}}%
1481 % Most title ``pages'' are actually two pages long, with space
1482 % at the top of the second. We don't want the ragged left on the second.
1483 \let\oldpage = \page
1485 \iffinishedtitlepage\else
1489 \let\page = \oldpage
1491 % \def\page{\oldpage \hbox{}}
1495 \iffinishedtitlepage\else
1498 % It is important to do the page break before ending the group,
1499 % because the headline and footline are only empty inside the group.
1500 % If we use the new definition of \page, we always get a blank page
1501 % after the title page, which we certainly don't want.
1507 \def\finishtitlepage{%
1508 \vskip4pt \hrule height 2pt width \hsize
1509 \vskip\titlepagebottomglue
1510 \finishedtitlepagetrue
1513 %%% Set up page headings and footings.
1515 \let\thispage=\folio
1517 \newtoks \evenheadline % Token sequence for heading line of even pages
1518 \newtoks \oddheadline % Token sequence for heading line of odd pages
1519 \newtoks \evenfootline % Token sequence for footing line of even pages
1520 \newtoks \oddfootline % Token sequence for footing line of odd pages
1522 % Now make Tex use those variables
1523 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1524 \else \the\evenheadline \fi}}
1525 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1526 \else \the\evenfootline \fi}\HEADINGShook}
1527 \let\HEADINGShook=\relax
1529 % Commands to set those variables.
1530 % For example, this is what @headings on does
1531 % @evenheading @thistitle|@thispage|@thischapter
1532 % @oddheading @thischapter|@thispage|@thistitle
1533 % @evenfooting @thisfile||
1534 % @oddfooting ||@thisfile
1536 \def\evenheading{\parsearg\evenheadingxxx}
1537 \def\oddheading{\parsearg\oddheadingxxx}
1538 \def\everyheading{\parsearg\everyheadingxxx}
1540 \def\evenfooting{\parsearg\evenfootingxxx}
1541 \def\oddfooting{\parsearg\oddfootingxxx}
1542 \def\everyfooting{\parsearg\everyfootingxxx}
1546 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1547 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1548 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1550 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1551 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1552 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1554 \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
1556 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1557 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1558 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1560 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1561 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1562 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
1564 % Leave some space for the footline. Hopefully ok to assume
1565 % @evenfooting will not be used by itself.
1566 \global\advance\pageheight by -\baselineskip
1567 \global\advance\vsize by -\baselineskip
1570 \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
1572 }% unbind the catcode of @.
1574 % @headings double turns headings on for double-sided printing.
1575 % @headings single turns headings on for single-sided printing.
1576 % @headings off turns them off.
1577 % @headings on same as @headings double, retained for compatibility.
1578 % @headings after turns on double-sided headings after this page.
1579 % @headings doubleafter turns on double-sided headings after this page.
1580 % @headings singleafter turns on single-sided headings after this page.
1581 % By default, they are off at the start of a document,
1582 % and turned `on' after @end titlepage.
1584 \def\headings #1 {\csname HEADINGS#1\endcsname}
1587 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1588 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1590 % When we turn headings on, set the page number to 1.
1591 % For double-sided printing, put current file name in lower left corner,
1592 % chapter name on inside top of right hand pages, document
1593 % title on inside top of left hand pages, and page numbers on outside top
1594 % edge of all pages.
1595 \def\HEADINGSdouble{
1597 \global\evenfootline={\hfil}
1598 \global\oddfootline={\hfil}
1599 \global\evenheadline={\line{\folio\hfil\thistitle}}
1600 \global\oddheadline={\line{\thischapter\hfil\folio}}
1601 \global\let\contentsalignmacro = \chapoddpage
1603 \let\contentsalignmacro = \chappager
1605 % For single-sided printing, chapter title goes across top left of page,
1606 % page number on top right.
1607 \def\HEADINGSsingle{
1609 \global\evenfootline={\hfil}
1610 \global\oddfootline={\hfil}
1611 \global\evenheadline={\line{\thischapter\hfil\folio}}
1612 \global\oddheadline={\line{\thischapter\hfil\folio}}
1613 \global\let\contentsalignmacro = \chappager
1615 \def\HEADINGSon{\HEADINGSdouble}
1617 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1618 \let\HEADINGSdoubleafter=\HEADINGSafter
1619 \def\HEADINGSdoublex{%
1620 \global\evenfootline={\hfil}
1621 \global\oddfootline={\hfil}
1622 \global\evenheadline={\line{\folio\hfil\thistitle}}
1623 \global\oddheadline={\line{\thischapter\hfil\folio}}
1624 \global\let\contentsalignmacro = \chapoddpage
1627 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1628 \def\HEADINGSsinglex{%
1629 \global\evenfootline={\hfil}
1630 \global\oddfootline={\hfil}
1631 \global\evenheadline={\line{\thischapter\hfil\folio}}
1632 \global\oddheadline={\line{\thischapter\hfil\folio}}
1633 \global\let\contentsalignmacro = \chappager
1636 % Subroutines used in generating headings
1637 % Produces Day Month Year style of output.
1638 \def\today{\number\day\space
1640 January\or February\or March\or April\or May\or June\or
1641 July\or August\or September\or October\or November\or December\fi
1644 % Use this if you want the Month Day, Year style of output.
1645 %\def\today{\ifcase\month\or
1646 %January\or February\or March\or April\or May\or June\or
1647 %July\or August\or September\or October\or November\or December\fi
1648 %\space\number\day, \number\year}
1650 % @settitle line... specifies the title of the document, for headings
1651 % It generates no output of its own
1653 \def\thistitle{No Title}
1654 \def\settitle{\parsearg\settitlezzz}
1655 \def\settitlezzz #1{\gdef\thistitle{#1}}
1660 % @tabs -- simple alignment
1662 % These don't work. For one thing, \+ is defined as outer.
1663 % So these macros cannot even be defined.
1665 %\def\tabs{\parsearg\tabszzz}
1666 %\def\tabszzz #1{\settabs\+#1\cr}
1667 %\def\tabline{\parsearg\tablinezzz}
1668 %\def\tablinezzz #1{\+#1\cr}
1671 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1673 % default indentation of table text
1674 \newdimen\tableindent \tableindent=.8in
1675 % default indentation of @itemize and @enumerate text
1676 \newdimen\itemindent \itemindent=.3in
1677 % margin between end of table item and start of table text.
1678 \newdimen\itemmargin \itemmargin=.1in
1680 % used internally for \itemindent minus \itemmargin
1683 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1685 % They also define \itemindex
1686 % to index the item name in whatever manner is desired (perhaps none).
1688 \newif\ifitemxneedsnegativevskip
1690 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1692 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1693 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1695 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1696 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1698 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1699 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1701 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1704 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1707 \def\itemzzz #1{\begingroup %
1708 \advance\hsize by -\rightskip
1709 \advance\hsize by -\tableindent
1710 \setbox0=\hbox{\itemfont{#1}}%
1712 \nobreak % This prevents a break before @itemx.
1714 % Be sure we are not still in the middle of a paragraph.
1719 % If the item text does not fit in the space we have, put it on a line
1720 % by itself, and do not allow a page break either before or after that
1721 % line. We do not start a paragraph here because then if the next
1722 % command is, e.g., @kindex, the whatsit would get put into the
1723 % horizontal list on a line by itself, resulting in extra blank space.
1724 \ifdim \wd0>\itemmax
1726 % Make this a paragraph so we get the \parskip glue and wrapping,
1727 % but leave it ragged-right.
1729 \advance\leftskip by-\tableindent
1730 \advance\hsize by\tableindent
1731 \advance\rightskip by0pt plus1fil
1732 \leavevmode\unhbox0\par
1735 % We're going to be starting a paragraph, but we don't want the
1736 % \parskip glue -- logically it's part of the @item we just started.
1737 \nobreak \vskip-\parskip
1739 % Stop a page break at the \parskip glue coming up. Unfortunately
1740 % we can't prevent a possible page break at the following
1741 % \baselineskip glue.
1744 \itemxneedsnegativevskipfalse
1746 % The item text fits into the space. Start a paragraph, so that the
1747 % following text (if any) will end up on the same line. Since that
1748 % text will be indented by \tableindent, we make the item text be in
1751 \rlap{\hskip -\tableindent\box0}\ignorespaces%
1753 \itemxneedsnegativevskiptrue%
1757 \def\item{\errmessage{@item while not in a table}}
1758 \def\itemx{\errmessage{@itemx while not in a table}}
1759 \def\kitem{\errmessage{@kitem while not in a table}}
1760 \def\kitemx{\errmessage{@kitemx while not in a table}}
1761 \def\xitem{\errmessage{@xitem while not in a table}}
1762 \def\xitemx{\errmessage{@xitemx while not in a table}}
1764 %% Contains a kludge to get @end[description] to work
1765 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1767 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1768 {\obeylines\obeyspaces%
1769 \gdef\tablex #1^^M{%
1770 \tabley\dontindex#1 \endtabley}}
1772 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1773 {\obeylines\obeyspaces%
1774 \gdef\ftablex #1^^M{%
1775 \tabley\fnitemindex#1 \endtabley
1776 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1777 \let\Etable=\relax}}
1779 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1780 {\obeylines\obeyspaces%
1781 \gdef\vtablex #1^^M{%
1782 \tabley\vritemindex#1 \endtabley
1783 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1784 \let\Etable=\relax}}
1787 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1788 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1791 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1792 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1794 \def\tablez #1#2#3#4#5#6{%
1797 \def\Edescription{\Etable}% Necessary kludge.
1799 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1800 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1801 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1803 \itemmax=\tableindent %
1804 \advance \itemmax by -\itemmargin %
1805 \advance \leftskip by \tableindent %
1806 \exdentamount=\tableindent
1808 \parskip = \smallskipamount
1809 \ifdim \parskip=0pt \parskip=2pt \fi%
1810 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1811 \let\item = \internalBitem %
1812 \let\itemx = \internalBitemx %
1813 \let\kitem = \internalBkitem %
1814 \let\kitemx = \internalBkitemx %
1815 \let\xitem = \internalBxitem %
1816 \let\xitemx = \internalBxitemx %
1819 % This is the counter used by @enumerate, which is really @itemize
1823 \def\itemize{\parsearg\itemizezzz}
1825 \def\itemizezzz #1{%
1826 \begingroup % ended by the @end itemsize
1827 \itemizey {#1}{\Eitemize}
1830 \def\itemizey #1#2{%
1832 \itemmax=\itemindent %
1833 \advance \itemmax by -\itemmargin %
1834 \advance \leftskip by \itemindent %
1835 \exdentamount=\itemindent
1837 \parskip = \smallskipamount %
1838 \ifdim \parskip=0pt \parskip=2pt \fi%
1839 \def#2{\endgraf\afterenvbreak\endgroup}%
1840 \def\itemcontents{#1}%
1841 \let\item=\itemizeitem}
1843 % Set sfcode to normal for the chars that usually have another value.
1844 % These are `.?!:;,'
1845 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1846 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1848 % \splitoff TOKENS\endmark defines \first to be the first token in
1849 % TOKENS, and \rest to be the remainder.
1851 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1853 % Allow an optional argument of an uppercase letter, lowercase letter,
1854 % or number, to specify the first label in the enumerated list. No
1855 % argument is the same as `1'.
1857 \def\enumerate{\parsearg\enumeratezzz}
1858 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1859 \def\enumeratey #1 #2\endenumeratey{%
1860 \begingroup % ended by the @end enumerate
1862 % If we were given no argument, pretend we were given `1'.
1864 \ifx\thearg\empty \def\thearg{1}\fi
1866 % Detect if the argument is a single token. If so, it might be a
1867 % letter. Otherwise, the only valid thing it can be is a number.
1868 % (We will always have one token, because of the test we just made.
1869 % This is a good thing, since \splitoff doesn't work given nothing at
1870 % all -- the first parameter is undelimited.)
1871 \expandafter\splitoff\thearg\endmark
1873 % Only one token in the argument. It could still be anything.
1874 % A ``lowercase letter'' is one whose \lccode is nonzero.
1875 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1876 % not equal to itself.
1877 % Otherwise, we assume it's a number.
1879 % We need the \relax at the end of the \ifnum lines to stop TeX from
1880 % continuing to look for a <number>.
1882 \ifnum\lccode\expandafter`\thearg=0\relax
1883 \numericenumerate % a number (we hope)
1886 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1887 \lowercaseenumerate % lowercase letter
1889 \uppercaseenumerate % uppercase letter
1893 % Multiple tokens in the argument. We hope it's a number.
1898 % An @enumerate whose labels are integers. The starting integer is
1901 \def\numericenumerate{%
1903 \startenumeration{\the\itemno}%
1906 % The starting (lowercase) letter is in \thearg.
1907 \def\lowercaseenumerate{%
1908 \itemno = \expandafter`\thearg
1910 % Be sure we're not beyond the end of the alphabet.
1912 \errmessage{No more lowercase letters in @enumerate; get a bigger
1919 % The starting (uppercase) letter is in \thearg.
1920 \def\uppercaseenumerate{%
1921 \itemno = \expandafter`\thearg
1923 % Be sure we're not beyond the end of the alphabet.
1925 \errmessage{No more uppercase letters in @enumerate; get a bigger
1932 % Call itemizey, adding a period to the first argument and supplying the
1933 % common last two arguments. Also subtract one from the initial value in
1934 % \itemno, since @item increments \itemno.
1936 \def\startenumeration#1{%
1937 \advance\itemno by -1
1938 \itemizey{#1.}\Eenumerate\flushcr
1941 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
1944 \def\alphaenumerate{\enumerate{a}}
1945 \def\capsenumerate{\enumerate{A}}
1946 \def\Ealphaenumerate{\Eenumerate}
1947 \def\Ecapsenumerate{\Eenumerate}
1949 % Definition of @item while inside @itemize.
1952 \advance\itemno by 1
1953 {\let\par=\endgraf \smallbreak}%
1954 \ifhmode \errmessage{In hmode at itemizeitem}\fi
1955 {\parskip=0in \hskip 0pt
1956 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
1957 \vadjust{\penalty 1200}}%
1960 % @multitable macros
1961 % Amy Hendrickson, 8/18/94, 3/6/96
1963 % @multitable ... @end multitable will make as many columns as desired.
1964 % Contents of each column will wrap at width given in preamble. Width
1965 % can be specified either with sample text given in a template line,
1966 % or in percent of \hsize, the current width of text on page.
1968 % Table can continue over pages but will only break between lines.
1972 % Either define widths of columns in terms of percent of \hsize:
1973 % @multitable @columnfractions .25 .3 .45
1976 % Numbers following @columnfractions are the percent of the total
1977 % current hsize to be used for each column. You may use as many
1978 % columns as desired.
1981 % Or use a template:
1982 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
1984 % using the widest term desired in each column.
1986 % For those who want to use more than one line's worth of words in
1987 % the preamble, break the line within one argument and it
1988 % will parse correctly, i.e.,
1990 % @multitable {Column 1 template} {Column 2 template} {Column 3
1993 % @multitable {Column 1 template} {Column 2 template}
1994 % {Column 3 template}
1996 % Each new table line starts with @item, each subsequent new column
1997 % starts with @tab. Empty columns may be produced by supplying @tab's
1998 % with nothing between them for as many times as empty columns are needed,
1999 % ie, @tab@tab@tab will produce two empty columns.
2001 % @item, @tab, @multitable or @end multitable do not need to be on their
2002 % own lines, but it will not hurt if they are.
2004 % Sample multitable:
2006 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2007 % @item first col stuff @tab second col stuff @tab third col
2014 % @item first col stuff @tab second col stuff
2015 % @tab Many paragraphs of text may be used in any column.
2017 % They will wrap at the width determined by the template.
2018 % @item@tab@tab This will be in third column.
2021 % Default dimensions may be reset by user.
2022 % @multitableparskip is vertical space between paragraphs in table.
2023 % @multitableparindent is paragraph indent in table.
2024 % @multitablecolmargin is horizontal space to be left between columns.
2025 % @multitablelinespace is space to leave between table items, baseline
2027 % 0pt means it depends on current normal line spacing.
2032 \newskip\multitableparskip
2033 \newskip\multitableparindent
2034 \newdimen\multitablecolspace
2035 \newskip\multitablelinespace
2036 \multitableparskip=0pt
2037 \multitableparindent=6pt
2038 \multitablecolspace=12pt
2039 \multitablelinespace=0pt
2042 % Macros used to set up halign preamble:
2043 \let\endsetuptable\relax
2044 \def\xendsetuptable{\endsetuptable}
2045 \let\columnfractions\relax
2046 \def\xcolumnfractions{\columnfractions}
2049 %% 2/1/96, to allow fractions to be given with more than one digit.
2050 \def\pickupwholefraction#1 {\global\advance\colcount by1 %
2051 \expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
2055 \def\setuptable#1{\def\firstarg{#1}%
2056 \ifx\firstarg\xendsetuptable\let\go\relax%
2058 \ifx\firstarg\xcolumnfractions\global\setpercenttrue%
2061 \let\go\pickupwholefraction % In this case arg of setuptable
2062 % is the decimal point before the
2063 % number given in percent of hsize.
2064 % We don't need this so we don't use it.
2066 \global\advance\colcount by1
2067 \setbox0=\hbox{#1 }% Add a normal word space as a separator;
2068 % typically that is always in the input, anyway.
2069 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2072 \ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
2077 \def\tab{&\hskip1sp\relax} % 2/2/96
2078 % tiny skip here makes sure this column space is
2079 % maintained, even if it is never used.
2083 % @multitable ... @end multitable definitions:
2085 \def\multitable{\parsearg\dotable}
2087 \def\dotable#1{\bgroup
2091 \setmultitablespacing
2092 \parskip=\multitableparskip
2093 \parindent=\multitableparindent
2095 \global\colcount=0\relax%
2096 \def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}%
2097 % To parse everything between @multitable and @item :
2098 \setuptable#1 \endsetuptable
2099 % Need to reset this to 0 after \setuptable.
2100 \global\colcount=0\relax%
2102 % This preamble sets up a generic column definition, which will
2103 % be used as many times as user calls for columns.
2104 % \vtop will set a single line and will also let text wrap and
2105 % continue for many paragraphs if desired.
2106 \halign\bgroup&\global\advance\colcount by 1\relax%
2107 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2108 % In order to keep entries from bumping into each other
2109 % we will add a \leftskip of \multitablecolspace to all columns after
2111 % If a template has been used, we will add \multitablecolspace
2112 % to the width of each template entry.
2113 % If user has set preamble in terms of percent of \hsize
2114 % we will use that dimension as the width of the column, and
2115 % the \leftskip will keep entries from bumping into each other.
2116 % Table will start at left margin and final column will justify at
2122 % If user has <not> set preamble in terms of percent of \hsize
2123 % we will advance \hsize by \multitablecolspace
2124 \advance\hsize by \multitablecolspace
2126 % In either case we will make \leftskip=\multitablecolspace:
2127 \leftskip=\multitablecolspace
2129 % Ignoring space at the beginning and end avoids an occasional spurious
2130 % blank line, when TeX decides to break the line at the space before the
2131 % box from the multistrut, so the strut ends up on a line by itself.
2133 % @multitable @columnfractions .11 .89
2135 % @tab Legal holiday which is valid in major parts of the whole country.
2136 % Is automatically provided with highlighting sequences respectively marking
2138 \noindent\ignorespaces##\unskip\multistrut}\cr
2139 % \everycr will reset column counter, \colcount, at the end of
2140 % each line. Every column entry will cause \colcount to advance by one.
2141 % The table preamble
2142 % looks at the current \colcount to find the correct column width.
2143 \global\everycr{\noalign{%
2144 % \filbreak%% keeps underfull box messages off when table breaks over pages.
2145 % Maybe so, but it also creates really weird page breaks when the table
2146 % breaks over pages Wouldn't \vfil be better? Wait until the problem
2147 % manifests itself, so it can be fixed for real --karl.
2148 \global\colcount=0\relax}}
2151 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2152 % If so, do nothing. If not, give it an appropriate dimension based on
2153 % current baselineskip.
2154 \ifdim\multitablelinespace=0pt
2155 %% strut to put in table in case some entry doesn't have descenders,
2156 %% to keep lines equally spaced
2157 \let\multistrut = \strut
2158 %% Test to see if parskip is larger than space between lines of
2159 %% table. If not, do nothing.
2160 %% If so, set to same dimension as multitablelinespace.
2162 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2164 \ifdim\multitableparskip>\multitablelinespace
2165 \global\multitableparskip=\multitablelinespace
2166 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2167 %% than skip between lines in the table.
2169 \ifdim\multitableparskip=0pt
2170 \global\multitableparskip=\multitablelinespace
2171 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2172 %% than skip between lines in the table.
2177 % Index generation facilities
2179 % Define \newwrite to be identical to plain tex's \newwrite
2180 % except not \outer, so it can be used within \newindex.
2182 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2184 % \newindex {foo} defines an index named foo.
2185 % It automatically defines \fooindex such that
2186 % \fooindex ...rest of line... puts an entry in the index foo.
2187 % It also defines \fooindfile to be the number of the output channel for
2188 % the file that accumulates this index. The file's extension is foo.
2189 % The name of an index should be no more than 2 characters long
2190 % for the sake of vms.
2193 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
2194 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2195 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2196 \noexpand\doindex {#1}}
2199 % @defindex foo == \newindex{foo}
2201 \def\defindex{\parsearg\newindex}
2203 % Define @defcodeindex, like @defindex except put all entries in @code.
2205 \def\newcodeindex #1{
2206 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
2207 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2208 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2209 \noexpand\docodeindex {#1}}
2212 \def\defcodeindex{\parsearg\newcodeindex}
2214 % @synindex foo bar makes index foo feed into index bar.
2215 % Do this instead of @defindex foo if you don't want it as a separate index.
2216 \def\synindex #1 #2 {%
2217 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2218 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2219 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2220 \noexpand\doindex {#2}}%
2223 % @syncodeindex foo bar similar, but put all entries made for index foo
2225 \def\syncodeindex #1 #2 {%
2226 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2227 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2228 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2229 \noexpand\docodeindex {#2}}%
2232 % Define \doindex, the driver for all \fooindex macros.
2233 % Argument #1 is generated by the calling \fooindex macro,
2234 % and it is "foo", the name of the index.
2236 % \doindex just uses \parsearg; it calls \doind for the actual work.
2237 % This is because \doind is more useful to call from other macros.
2239 % There is also \dosubind {index}{topic}{subtopic}
2240 % which makes an entry in a two-level index such as the operation index.
2242 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
2243 \def\singleindexer #1{\doind{\indexname}{#1}}
2245 % like the previous two, but they put @code around the argument.
2246 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2247 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2250 % Take care of the plain tex accent commands.
2251 \def\"{\realbackslash "}%
2252 \def\`{\realbackslash `}%
2253 \def\'{\realbackslash '}%
2254 \def\^{\realbackslash ^}%
2255 \def\~{\realbackslash ~}%
2256 \def\={\realbackslash =}%
2257 \def\b{\realbackslash b}%
2258 \def\c{\realbackslash c}%
2259 \def\d{\realbackslash d}%
2260 \def\u{\realbackslash u}%
2261 \def\v{\realbackslash v}%
2262 \def\H{\realbackslash H}%
2263 % Take care of the plain tex special European modified letters.
2264 \def\oe{\realbackslash oe}%
2265 \def\ae{\realbackslash ae}%
2266 \def\aa{\realbackslash aa}%
2267 \def\OE{\realbackslash OE}%
2268 \def\AE{\realbackslash AE}%
2269 \def\AA{\realbackslash AA}%
2270 \def\o{\realbackslash o}%
2271 \def\O{\realbackslash O}%
2272 \def\l{\realbackslash l}%
2273 \def\L{\realbackslash L}%
2274 \def\ss{\realbackslash ss}%
2275 % Take care of texinfo commands likely to appear in an index entry.
2276 % (Must be a way to avoid doing expansion at all, and thus not have to
2277 % laboriously list every single command here.)
2278 \def\@{@}% will be @@ when we switch to @ as escape char.
2279 %\let\{ = \lbracecmd
2280 %\let\} = \rbracecmd
2281 \def\_{{\realbackslash _}}%
2282 \def\w{\realbackslash w }%
2283 \def\bf{\realbackslash bf }%
2284 %\def\rm{\realbackslash rm }%
2285 \def\sl{\realbackslash sl }%
2286 \def\sf{\realbackslash sf}%
2287 \def\tt{\realbackslash tt}%
2288 \def\gtr{\realbackslash gtr}%
2289 \def\less{\realbackslash less}%
2290 \def\hat{\realbackslash hat}%
2291 %\def\char{\realbackslash char}%
2292 \def\TeX{\realbackslash TeX}%
2293 \def\dots{\realbackslash dots }%
2294 \def\result{\realbackslash result}%
2295 \def\equiv{\realbackslash equiv}%
2296 \def\expansion{\realbackslash expansion}%
2297 \def\print{\realbackslash print}%
2298 \def\error{\realbackslash error}%
2299 \def\point{\realbackslash point}%
2300 \def\copyright{\realbackslash copyright}%
2301 \def\tclose##1{\realbackslash tclose {##1}}%
2302 \def\code##1{\realbackslash code {##1}}%
2303 \def\dotless##1{\realbackslash dotless {##1}}%
2304 \def\samp##1{\realbackslash samp {##1}}%
2305 \def\,##1{\realbackslash ,{##1}}%
2306 \def\t##1{\realbackslash t {##1}}%
2307 \def\r##1{\realbackslash r {##1}}%
2308 \def\i##1{\realbackslash i {##1}}%
2309 \def\b##1{\realbackslash b {##1}}%
2310 \def\sc##1{\realbackslash sc {##1}}%
2311 \def\cite##1{\realbackslash cite {##1}}%
2312 \def\key##1{\realbackslash key {##1}}%
2313 \def\file##1{\realbackslash file {##1}}%
2314 \def\var##1{\realbackslash var {##1}}%
2315 \def\kbd##1{\realbackslash kbd {##1}}%
2316 \def\dfn##1{\realbackslash dfn {##1}}%
2317 \def\emph##1{\realbackslash emph {##1}}%
2321 % If an index command is used in an @example environment, any spaces
2322 % therein should become regular spaces in the raw index file, not the
2323 % expansion of \tie (\\leavevmode \penalty \@M \ ).
2325 \gdef\unsepspaces{\obeyspaces\let =\space}}
2327 % \indexnofonts no-ops all font-change commands.
2328 % This is used when outputting the strings to sort the index by.
2329 \def\indexdummyfont#1{#1}
2330 \def\indexdummytex{TeX}
2331 \def\indexdummydots{...}
2334 % Just ignore accents.
2335 \let\,=\indexdummyfont
2336 \let\"=\indexdummyfont
2337 \let\`=\indexdummyfont
2338 \let\'=\indexdummyfont
2339 \let\^=\indexdummyfont
2340 \let\~=\indexdummyfont
2341 \let\==\indexdummyfont
2342 \let\b=\indexdummyfont
2343 \let\c=\indexdummyfont
2344 \let\d=\indexdummyfont
2345 \let\u=\indexdummyfont
2346 \let\v=\indexdummyfont
2347 \let\H=\indexdummyfont
2348 \let\dotless=\indexdummyfont
2349 % Take care of the plain tex special European modified letters.
2361 \let\w=\indexdummyfont
2362 \let\t=\indexdummyfont
2363 \let\r=\indexdummyfont
2364 \let\i=\indexdummyfont
2365 \let\b=\indexdummyfont
2366 \let\emph=\indexdummyfont
2367 \let\strong=\indexdummyfont
2368 \let\cite=\indexdummyfont
2369 \let\sc=\indexdummyfont
2370 %Don't no-op \tt, since it isn't a user-level command
2371 % and is used in the definitions of the active chars like <, >, |...
2372 %\let\tt=\indexdummyfont
2373 \let\tclose=\indexdummyfont
2374 \let\code=\indexdummyfont
2375 \let\file=\indexdummyfont
2376 \let\samp=\indexdummyfont
2377 \let\kbd=\indexdummyfont
2378 \let\key=\indexdummyfont
2379 \let\var=\indexdummyfont
2380 \let\TeX=\indexdummytex
2381 \let\dots=\indexdummydots
2385 % To define \realbackslash, we must make \ not be an escape.
2386 % We must first make another character (@) an escape
2387 % so we do not become unable to do a definition.
2389 {\catcode`\@=0 \catcode`\\=\other
2390 @gdef@realbackslash{\}}
2392 \let\indexbackslash=0 %overridden during \printindex.
2394 \let\SETmarginindex=\relax %initialize!
2395 % workhorse for all \fooindexes
2396 % #1 is name of index, #2 is stuff to put there
2398 % Put the index entry in the margin if desired.
2399 \ifx\SETmarginindex\relax\else
2400 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2403 \count255=\lastpenalty
2405 \indexdummies % Must do this here, since \bf, etc expand at this stage
2408 \let\folio=0% We will expand all macros now EXCEPT \folio.
2409 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2410 % so it will be output as is; and it will print as backslash.
2412 % First process the index-string with all font commands turned off
2413 % to get the string to sort by.
2414 {\indexnofonts \xdef\indexsorttmp{#2}}%
2416 % Now produce the complete index entry, with both the sort key and the
2417 % original text, including any font commands.
2420 \write\csname#1indfile\endcsname{%
2421 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
2430 \def\dosubind #1#2#3{%
2431 {\count10=\lastpenalty %
2432 {\indexdummies % Must do this here, since \bf, etc expand at this stage
2435 \def\rawbackslashxx{\indexbackslash}%
2437 % Now process the index-string once, with all font commands turned off,
2438 % to get the string to sort the index by.
2442 % Now produce the complete index entry. We process the index-string again,
2443 % this time with font commands expanded, to get what to print in the index.
2445 \write \csname#1indfile\endcsname{%
2446 \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
2450 % The index entry written in the file actually looks like
2451 % \entry {sortstring}{page}{topic}
2453 % \entry {sortstring}{page}{topic}{subtopic}
2454 % The texindex program reads in these files and writes files
2455 % containing these kinds of lines:
2457 % before the first topic whose initial is c
2458 % \entry {topic}{pagelist}
2459 % for a topic that is used without subtopics
2461 % for the beginning of a topic that is used with subtopics
2462 % \secondary {subtopic}{pagelist}
2463 % for each subtopic.
2465 % Define the user-accessible indexing commands
2466 % @findex, @vindex, @kindex, @cindex.
2468 \def\findex {\fnindex}
2469 \def\kindex {\kyindex}
2470 \def\cindex {\cpindex}
2471 \def\vindex {\vrindex}
2472 \def\tindex {\tpindex}
2473 \def\pindex {\pgindex}
2475 \def\cindexsub {\begingroup\obeylines\cindexsub}
2477 \gdef\cindexsub "#1" #2^^M{\endgroup %
2478 \dosubind{cp}{#2}{#1}}}
2480 % Define the macros used in formatting output of the sorted index material.
2482 % @printindex causes a particular index (the ??s file) to get printed.
2483 % It does not print any chapter heading (usually an @unnumbered).
2485 \def\printindex{\parsearg\doprintindex}
2486 \def\doprintindex#1{\begingroup
2487 \dobreak \chapheadingskip{10000}%
2493 % See if the index file exists and is nonempty.
2494 \openin 1 \jobname.#1s
2496 % \enddoublecolumns gets confused if there is no text in the index,
2497 % and it loses the chapter title and the aux file entries for the
2498 % index. The easiest way to prevent this problem is to make sure
2499 % there is some text.
2500 (Index is nonexistent)
2503 % If the index file exists but is empty, then \openin leaves \ifeof
2504 % false. We have to make TeX try to read something from the file, so
2505 % it can discover if there is anything in it.
2510 % Index files are almost Texinfo source, but we use \ as the escape
2511 % character. It would be better to use @, but that's too big a change
2512 % to make right now.
2513 \def\indexbackslash{\rawbackslashxx}%
2525 % These macros are used by the sorted index file itself.
2526 % Change them to control the appearance of the index.
2528 % Same as \bigskipamount except no shrink.
2529 % \balancecolumns gets confused if there is any shrink.
2530 \newskip\initialskipamount \initialskipamount 12pt plus4pt
2533 {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2534 \ifdim\lastskip<\initialskipamount
2535 \removelastskip \penalty-200 \vskip \initialskipamount\fi
2536 \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
2538 % This typesets a paragraph consisting of #1, dot leaders, and then #2
2539 % flush to the right margin. It is used for index and table of contents
2540 % entries. The paragraph is indented by \leftskip.
2542 \def\entry #1#2{\begingroup
2544 % Start a new paragraph if necessary, so our assignments below can't
2545 % affect previous text.
2548 % Do not fill out the last line with white space.
2551 % No extra space above this paragraph.
2554 % Do not prefer a separate line ending with a hyphen to fewer lines.
2555 \finalhyphendemerits = 0
2557 % \hangindent is only relevant when the entry text and page number
2558 % don't both fit on one line. In that case, bob suggests starting the
2559 % dots pretty far over on the line. Unfortunately, a large
2560 % indentation looks wrong when the entry text itself is broken across
2561 % lines. So we use a small indentation and put up with long leaders.
2563 % \hangafter is reset to 1 (which is the value we want) at the start
2564 % of each paragraph, so we need not do anything with that.
2567 % When the entry text needs to be broken, just fill out the first line
2569 \rightskip = 0pt plus1fil
2571 % Start a ``paragraph'' for the index entry so the line breaking
2572 % parameters we've set above will have an effect.
2575 % Insert the text of the index entry. TeX will do line-breaking on it.
2577 % The following is kludged to not output a line of dots in the index if
2578 % there are no page numbers. The next person who breaks this will be
2579 % cursed by a Unix daemon.
2582 \edef\tempc{\tempa}%
2583 \edef\tempd{\tempb}%
2584 \ifx\tempc\tempd\ \else%
2586 % If we must, put the page number on a line of its own, and fill out
2587 % this line with blank space. (The \hfil is overwhelmed with the
2588 % fill leaders glue in \indexdotfill if the page number does fit.)
2590 \null\nobreak\indexdotfill % Have leaders before the page number.
2592 % The `\ ' here is removed by the implicit \unskip that TeX does as
2593 % part of (the primitive) \par. Without it, a spurious underfull
2595 \ #2% The page number ends the paragraph.
2600 % Like \dotfill except takes at least 1 em.
2601 \def\indexdotfill{\cleaders
2602 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
2604 \def\primary #1{\line{#1\hfil}}
2606 \newskip\secondaryindent \secondaryindent=0.5cm
2608 \def\secondary #1#2{
2609 {\parfillskip=0in \parskip=0in
2610 \hangindent =1in \hangafter=1
2611 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
2614 % Define two-column mode, which we use to typeset indexes.
2615 % Adapted from the TeXbook, page 416, which is to say,
2616 % the manmac.tex format used to print the TeXbook itself.
2620 \newdimen\doublecolumnhsize
2622 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
2623 % Grab any single-column material above us.
2624 \output = {\global\setbox\partialpage = \vbox{%
2626 % Here is a possibility not foreseen in manmac: if we accumulate a
2627 % whole lot of material, we might end up calling this \output
2628 % routine twice in a row (see the doublecol-lose test, which is
2629 % essentially a couple of indexes with @setchapternewpage off). In
2630 % that case, we must prevent the second \partialpage from
2631 % simply overwriting the first, causing us to lose the page.
2632 % This will preserve it until a real output routine can ship it
2633 % out. Generally, \partialpage will be empty when this runs and
2634 % this will be a no-op.
2637 % Unvbox the main output page.
2639 \kern-\topskip \kern\baselineskip
2643 % Use the double-column output routine for subsequent pages.
2644 \output = {\doublecolumnout}%
2646 % Change the page size parameters. We could do this once outside this
2647 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
2648 % format, but then we repeat the same computation. Repeating a couple
2649 % of assignments once per index is clearly meaningless for the
2650 % execution time, so we may as well do it in one place.
2652 % First we halve the line length, less a little for the gutter between
2653 % the columns. We compute the gutter based on the line length, so it
2654 % changes automatically with the paper format. The magic constant
2655 % below is chosen so that the gutter has the same value (well, +-<1pt)
2656 % as it did when we hard-coded it.
2658 % We put the result in a separate register, \doublecolumhsize, so we
2659 % can restore it in \pagesofar, after \hsize itself has (potentially)
2662 \doublecolumnhsize = \hsize
2663 \advance\doublecolumnhsize by -.04154\hsize
2664 \divide\doublecolumnhsize by 2
2665 \hsize = \doublecolumnhsize
2667 % Double the \vsize as well. (We don't need a separate register here,
2668 % since nobody clobbers \vsize.)
2671 \def\doublecolumnout{%
2672 \splittopskip=\topskip \splitmaxdepth=\maxdepth
2673 % Get the available space for the double columns -- the normal
2674 % (undoubled) page height minus any material left over from the
2676 \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
2677 % box0 will be the left-hand column, box2 the right.
2678 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
2679 \onepageout\pagesofar
2681 \penalty\outputpenalty
2684 % Re-output the contents of the output page -- any previous material,
2685 % followed by the two boxes we just split.
2687 \hsize = \doublecolumnhsize
2688 \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}%
2690 \def\enddoublecolumns{%
2691 \output = {\balancecolumns}\eject % split what we have
2692 \endgroup % started in \begindoublecolumns
2694 % Back to normal single-column typesetting, but take account of the
2695 % fact that we just accumulated some stuff on the output page.
2698 \def\balancecolumns{%
2699 % Called at the end of the double column material.
2700 \setbox0 = \vbox{\unvbox255}%
2702 \advance\dimen@ by \topskip
2703 \advance\dimen@ by-\baselineskip
2705 \splittopskip = \topskip
2706 % Loop until we get a decent breakpoint.
2707 {\vbadness=10000 \loop
2708 \global\setbox3=\copy0
2709 \global\setbox1=\vsplit3 to\dimen@
2710 \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt
2712 \setbox0=\vbox to\dimen@{\unvbox1}%
2713 \setbox2=\vbox to\dimen@{\unvbox3}%
2716 \catcode`\@ = \other
2719 \message{sectioning,}
2720 % Define chapters, sections, etc.
2723 \newcount\secno \secno=0
2724 \newcount\subsecno \subsecno=0
2725 \newcount\subsubsecno \subsubsecno=0
2727 % This counter is funny since it counts through charcodes of letters A, B, ...
2728 \newcount\appendixno \appendixno = `\@
2729 \def\appendixletter{\char\the\appendixno}
2731 \newwrite\contentsfile
2732 % This is called from \setfilename.
2733 \def\opencontents{\openout\contentsfile = \jobname.toc }
2735 % Each @chapter defines this as the name of the chapter.
2736 % page headings and footings can use it. @section does likewise
2738 \def\thischapter{} \def\thissection{}
2739 \def\seccheck#1{\ifnum \pageno<0
2740 \errmessage{@#1 not allowed after generating table of contents}%
2743 \def\chapternofonts{%
2744 \let\rawbackslash=\relax
2745 \let\frenchspacing=\relax
2746 \def\result{\realbackslash result}%
2747 \def\equiv{\realbackslash equiv}%
2748 \def\expansion{\realbackslash expansion}%
2749 \def\print{\realbackslash print}%
2750 \def\TeX{\realbackslash TeX}%
2751 \def\dots{\realbackslash dots}%
2752 \def\result{\realbackslash result}%
2753 \def\equiv{\realbackslash equiv}%
2754 \def\expansion{\realbackslash expansion}%
2755 \def\print{\realbackslash print}%
2756 \def\error{\realbackslash error}%
2757 \def\point{\realbackslash point}%
2758 \def\copyright{\realbackslash copyright}%
2759 \def\tt{\realbackslash tt}%
2760 \def\bf{\realbackslash bf}%
2761 \def\w{\realbackslash w}%
2762 \def\less{\realbackslash less}%
2763 \def\gtr{\realbackslash gtr}%
2764 \def\hat{\realbackslash hat}%
2765 \def\char{\realbackslash char}%
2766 \def\tclose##1{\realbackslash tclose{##1}}%
2767 \def\code##1{\realbackslash code{##1}}%
2768 \def\samp##1{\realbackslash samp{##1}}%
2769 \def\r##1{\realbackslash r{##1}}%
2770 \def\b##1{\realbackslash b{##1}}%
2771 \def\key##1{\realbackslash key{##1}}%
2772 \def\file##1{\realbackslash file{##1}}%
2773 \def\kbd##1{\realbackslash kbd{##1}}%
2774 % These are redefined because @smartitalic wouldn't work inside xdef.
2775 \def\i##1{\realbackslash i{##1}}%
2776 \def\cite##1{\realbackslash cite{##1}}%
2777 \def\var##1{\realbackslash var{##1}}%
2778 \def\emph##1{\realbackslash emph{##1}}%
2779 \def\dfn##1{\realbackslash dfn{##1}}%
2782 \newcount\absseclevel % used to calculate proper heading level
2783 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
2785 % @raisesections: treat @section as chapter, @subsection as section, etc.
2786 \def\raisesections{\global\advance\secbase by -1}
2787 \let\up=\raisesections % original BFox name
2789 % @lowersections: treat @chapter as section, @section as subsection, etc.
2790 \def\lowersections{\global\advance\secbase by 1}
2791 \let\down=\lowersections % original BFox name
2793 % Choose a numbered-heading macro
2794 % #1 is heading level if unmodified by @raisesections or @lowersections
2795 % #2 is text for heading
2796 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2802 \numberedsubseczzz{#2}
2804 \numberedsubsubseczzz{#2}
2806 \ifnum \absseclevel<0
2809 \numberedsubsubseczzz{#2}
2814 % like \numhead, but chooses appendix heading levels
2815 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2819 \appendixsectionzzz{#2}
2821 \appendixsubseczzz{#2}
2823 \appendixsubsubseczzz{#2}
2825 \ifnum \absseclevel<0
2828 \appendixsubsubseczzz{#2}
2833 % like \numhead, but chooses numberless heading levels
2834 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2838 \unnumberedseczzz{#2}
2840 \unnumberedsubseczzz{#2}
2842 \unnumberedsubsubseczzz{#2}
2844 \ifnum \absseclevel<0
2847 \unnumberedsubsubseczzz{#2}
2853 \def\thischaptername{No Chapter Title}
2854 \outer\def\chapter{\parsearg\chapteryyy}
2855 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
2856 \def\chapterzzz #1{\seccheck{chapter}%
2857 \secno=0 \subsecno=0 \subsubsecno=0
2858 \global\advance \chapno by 1 \message{\putwordChapter \the\chapno}%
2859 \chapmacro {#1}{\the\chapno}%
2860 \gdef\thissection{#1}%
2861 \gdef\thischaptername{#1}%
2862 % We don't substitute the actual chapter name into \thischapter
2863 % because we don't want its macros evaluated now.
2864 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
2867 \edef\temp{{\realbackslash chapentry{\the\toks0}{\the\chapno}{\noexpand\folio}}}%
2869 \write \contentsfile \temp %
2871 \global\let\section = \numberedsec
2872 \global\let\subsection = \numberedsubsec
2873 \global\let\subsubsection = \numberedsubsubsec
2876 \outer\def\appendix{\parsearg\appendixyyy}
2877 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
2878 \def\appendixzzz #1{\seccheck{appendix}%
2879 \secno=0 \subsecno=0 \subsubsecno=0
2880 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
2881 \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
2882 \gdef\thissection{#1}%
2883 \gdef\thischaptername{#1}%
2884 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
2887 \edef\temp{{\realbackslash chapentry{\the\toks0}%
2888 {\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
2890 \write \contentsfile \temp %
2892 \global\let\section = \appendixsec
2893 \global\let\subsection = \appendixsubsec
2894 \global\let\subsubsection = \appendixsubsubsec
2897 % @centerchap is like @unnumbered, but the heading is centered.
2898 \outer\def\centerchap{\parsearg\centerchapyyy}
2899 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
2901 \outer\def\top{\parsearg\unnumberedyyy}
2902 \outer\def\unnumbered{\parsearg\unnumberedyyy}
2903 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
2904 \def\unnumberedzzz #1{\seccheck{unnumbered}%
2905 \secno=0 \subsecno=0 \subsubsecno=0
2907 % This used to be simply \message{#1}, but TeX fully expands the
2908 % argument to \message. Therefore, if #1 contained @-commands, TeX
2909 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
2910 % expanded @cite (which turns out to cause errors because \cite is meant
2911 % to be executed, not expanded).
2913 % Anyway, we don't want the fully-expanded definition of @cite to appear
2914 % as a result of the \message, we just want `@cite' itself. We use
2915 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
2916 % simply yielding the contents of the <toks register>.
2917 \toks0 = {#1}\message{(\the\toks0)}%
2919 \unnumbchapmacro {#1}%
2920 \gdef\thischapter{#1}\gdef\thissection{#1}%
2923 \edef\temp{{\realbackslash unnumbchapentry{\the\toks0}{\noexpand\folio}}}%
2925 \write \contentsfile \temp %
2927 \global\let\section = \unnumberedsec
2928 \global\let\subsection = \unnumberedsubsec
2929 \global\let\subsubsection = \unnumberedsubsubsec
2932 \outer\def\numberedsec{\parsearg\secyyy}
2933 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
2934 \def\seczzz #1{\seccheck{section}%
2935 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
2936 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
2939 \edef\temp{{\realbackslash secentry %
2940 {\the\toks0}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
2942 \write \contentsfile \temp %
2947 \outer\def\appendixsection{\parsearg\appendixsecyyy}
2948 \outer\def\appendixsec{\parsearg\appendixsecyyy}
2949 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
2950 \def\appendixsectionzzz #1{\seccheck{appendixsection}%
2951 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
2952 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
2955 \edef\temp{{\realbackslash secentry %
2956 {\the\toks0}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
2958 \write \contentsfile \temp %
2963 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
2964 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
2965 \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
2966 \plainsecheading {#1}\gdef\thissection{#1}%
2969 \edef\temp{{\realbackslash unnumbsecentry{\the\toks0}{\noexpand\folio}}}%
2971 \write \contentsfile \temp %
2976 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
2977 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
2978 \def\numberedsubseczzz #1{\seccheck{subsection}%
2979 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
2980 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
2983 \edef\temp{{\realbackslash subsecentry %
2984 {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
2986 \write \contentsfile \temp %
2991 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
2992 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
2993 \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
2994 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
2995 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
2998 \edef\temp{{\realbackslash subsecentry %
2999 {\the\toks0}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
3001 \write \contentsfile \temp %
3006 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
3007 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
3008 \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
3009 \plainsubsecheading {#1}\gdef\thissection{#1}%
3012 \edef\temp{{\realbackslash unnumbsubsecentry{\the\toks0}{\noexpand\folio}}}%
3014 \write \contentsfile \temp %
3019 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
3020 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
3021 \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
3022 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3023 \subsubsecheading {#1}
3024 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3027 \edef\temp{{\realbackslash subsubsecentry{\the\toks0}
3028 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
3029 {\noexpand\folio}}}%
3031 \write \contentsfile \temp %
3036 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
3037 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
3038 \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
3039 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3040 \subsubsecheading {#1}
3041 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3044 \edef\temp{{\realbackslash subsubsecentry{\the\toks0}%
3046 {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
3048 \write \contentsfile \temp %
3053 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
3054 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
3055 \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
3056 \plainsubsubsecheading {#1}\gdef\thissection{#1}%
3059 \edef\temp{{\realbackslash unnumbsubsubsecentry{\the\toks0}{\noexpand\folio}}}%
3061 \write \contentsfile \temp %
3066 % These are variants which are not "outer", so they can appear in @ifinfo.
3067 % Actually, they should now be obsolete; ordinary section commands should work.
3068 \def\infotop{\parsearg\unnumberedzzz}
3069 \def\infounnumbered{\parsearg\unnumberedzzz}
3070 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
3071 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
3072 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
3074 \def\infoappendix{\parsearg\appendixzzz}
3075 \def\infoappendixsec{\parsearg\appendixseczzz}
3076 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
3077 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
3079 \def\infochapter{\parsearg\chapterzzz}
3080 \def\infosection{\parsearg\sectionzzz}
3081 \def\infosubsection{\parsearg\subsectionzzz}
3082 \def\infosubsubsection{\parsearg\subsubsectionzzz}
3084 % These macros control what the section commands do, according
3085 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
3086 % Define them by default for a numbered chapter.
3087 \global\let\section = \numberedsec
3088 \global\let\subsection = \numberedsubsec
3089 \global\let\subsubsection = \numberedsubsubsec
3091 % Define @majorheading, @heading and @subheading
3093 % NOTE on use of \vbox for chapter headings, section headings, and
3095 % 1) We use \vbox rather than the earlier \line to permit
3096 % overlong headings to fold.
3097 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
3098 % heading is obnoxious; this forbids it.
3099 % 3) Likewise, headings look best if no \parindent is used, and
3100 % if justification is not attempted. Hence \raggedright.
3103 \def\majorheading{\parsearg\majorheadingzzz}
3104 \def\majorheadingzzz #1{%
3105 {\advance\chapheadingskip by 10pt \chapbreak }%
3106 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3107 \parindent=0pt\raggedright
3108 \rm #1\hfill}}\bigskip \par\penalty 200}
3110 \def\chapheading{\parsearg\chapheadingzzz}
3111 \def\chapheadingzzz #1{\chapbreak %
3112 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3113 \parindent=0pt\raggedright
3114 \rm #1\hfill}}\bigskip \par\penalty 200}
3116 % @heading, @subheading, @subsubheading.
3117 \def\heading{\parsearg\plainsecheading}
3118 \def\subheading{\parsearg\plainsubsecheading}
3119 \def\subsubheading{\parsearg\plainsubsubsecheading}
3121 % These macros generate a chapter, section, etc. heading only
3122 % (including whitespace, linebreaking, etc. around it),
3123 % given all the information in convenient, parsed form.
3125 %%% Args are the skip and penalty (usually negative)
3126 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
3128 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
3130 %%% Define plain chapter starts, and page on/off switching for it
3131 % Parameter controlling skip before chapter headings (if needed)
3133 \newskip\chapheadingskip
3135 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
3136 \def\chappager{\par\vfill\supereject}
3137 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
3139 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
3142 \global\let\contentsalignmacro = \chappager
3143 \global\let\pchapsepmacro=\chapbreak
3144 \global\let\pagealignmacro=\chappager}
3147 \global\let\contentsalignmacro = \chappager
3148 \global\let\pchapsepmacro=\chappager
3149 \global\let\pagealignmacro=\chappager
3150 \global\def\HEADINGSon{\HEADINGSsingle}}
3153 \global\let\contentsalignmacro = \chapoddpage
3154 \global\let\pchapsepmacro=\chapoddpage
3155 \global\let\pagealignmacro=\chapoddpage
3156 \global\def\HEADINGSon{\HEADINGSdouble}}
3161 \global\let\chapmacro=\chfplain
3162 \global\let\unnumbchapmacro=\unnchfplain
3163 \global\let\centerchapmacro=\centerchfplain}
3165 % Plain chapter opening.
3166 % #1 is the text, #2 the chapter number or empty if unnumbered.
3172 \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
3173 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3174 \hangindent = \wd0 \centerparametersmaybe
3177 \nobreak\bigskip % no page break after a chapter title
3181 % Plain opening for unnumbered.
3182 \def\unnchfplain#1{\chfplain{#1}{}}
3184 % @centerchap -- centered and unnumbered.
3185 \let\centerparametersmaybe = \relax
3186 \def\centerchfplain#1{{%
3187 \def\centerparametersmaybe{%
3188 \advance\rightskip by 3\rightskip
3189 \leftskip = \rightskip
3195 \CHAPFplain % The default
3197 \def\unnchfopen #1{%
3198 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3199 \parindent=0pt\raggedright
3200 \rm #1\hfill}}\bigskip \par\penalty 10000 %
3203 \def\chfopen #1#2{\chapoddpage {\chapfonts
3204 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
3208 \def\centerchfopen #1{%
3209 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3211 \hfill {\rm #1}\hfill}}\bigskip \par\penalty 10000 %
3215 \global\let\chapmacro=\chfopen
3216 \global\let\unnumbchapmacro=\unnchfopen
3217 \global\let\centerchapmacro=\centerchfopen}
3221 \newskip\secheadingskip
3222 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
3223 \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
3224 \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
3226 % Subsection titles.
3227 \newskip \subsecheadingskip
3228 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
3229 \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
3230 \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
3232 % Subsubsection titles.
3233 \let\subsubsecheadingskip = \subsecheadingskip
3234 \let\subsubsecheadingbreak = \subsecheadingbreak
3235 \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
3236 \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
3239 % Print any size section title.
3241 % #1 is the section type (sec/subsec/subsubsec), #2 is the section
3242 % number (maybe empty), #3 the text.
3243 \def\sectionheading#1#2#3{%
3245 \expandafter\advance\csname #1headingskip\endcsname by \parskip
3246 \csname #1headingbreak\endcsname
3249 % Switch to the right set of fonts.
3250 \csname #1fonts\endcsname \rm
3252 % Only insert the separating space if we have a section number.
3254 \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
3256 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3257 \hangindent = \wd0 % zero if no section number
3260 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
3264 \message{toc printing,}
3265 % Finish up the main text and prepare to read what we've written
3268 \newskip\contentsrightmargin \contentsrightmargin=1in
3269 \def\startcontents#1{%
3270 % If @setchapternewpage on, and @headings double, the contents should
3271 % start on an odd page, unlike chapters. Thus, we maintain
3272 % \contentsalignmacro in parallel with \pagealignmacro.
3273 % From: Torbjorn Granlund <tege@matematik.su.se>
3275 \immediate\closeout \contentsfile
3277 \pageno = -1 % Request roman numbered pages.
3279 % Don't need to put `Contents' or `Short Contents' in the headline.
3280 % It is abundantly clear what they are.
3281 \unnumbchapmacro{#1}\def\thischapter{}%
3282 \begingroup % Set up to handle contents files properly.
3283 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
3284 \catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3285 \raggedbottom % Worry more about breakpoints than the bottom.
3286 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3290 % Normal (long) toc.
3291 \outer\def\contents{%
3292 \startcontents{\putwordTableofContents}%
3298 % And just the chapters.
3299 \outer\def\summarycontents{%
3300 \startcontents{\putwordShortContents}%
3302 \let\chapentry = \shortchapentry
3303 \let\unnumbchapentry = \shortunnumberedentry
3304 % We want a true roman here for the page numbers.
3306 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
3308 \hyphenpenalty = 10000
3309 \advance\baselineskip by 1pt % Open it up a little.
3310 \def\secentry ##1##2##3##4{}
3311 \def\unnumbsecentry ##1##2{}
3312 \def\subsecentry ##1##2##3##4##5{}
3313 \def\unnumbsubsecentry ##1##2{}
3314 \def\subsubsecentry ##1##2##3##4##5##6{}
3315 \def\unnumbsubsubsecentry ##1##2{}
3320 \let\shortcontents = \summarycontents
3322 % These macros generate individual entries in the table of contents.
3323 % The first argument is the chapter or section name.
3324 % The last argument is the page number.
3325 % The arguments in between are the chapter number, section number, ...
3327 % Chapter-level things, for both the long and short contents.
3328 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3330 % See comments in \dochapentry re vbox and related settings
3331 \def\shortchapentry#1#2#3{%
3332 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
3335 % Typeset the label for a chapter or appendix for the short contents.
3336 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
3337 % We could simplify the code here by writing out an \appendixentry
3338 % command in the toc file for appendices, instead of using \chapentry
3339 % for both, but it doesn't seem worth it.
3340 \setbox0 = \hbox{\shortcontrm \putwordAppendix }
3341 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
3343 \def\shortchaplabel#1{%
3344 % We typeset #1 in a box of constant width, regardless of the text of
3345 % #1, so the chapter titles will come out aligned.
3346 \setbox0 = \hbox{#1}%
3347 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3349 % This space should be plenty, since a single number is .5em, and the
3350 % widest letter (M) is 1em, at least in the Computer Modern fonts.
3351 % (This space doesn't include the extra space that gets added after
3352 % the label; that gets put in by \shortchapentry above.)
3353 \advance\dimen0 by 1.1em
3354 \hbox to \dimen0{#1\hfil}%
3357 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3358 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
3361 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3362 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
3365 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
3366 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
3368 % And subsubsections.
3369 \def\subsubsecentry#1#2#3#4#5#6{%
3370 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
3371 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
3373 % This parameter controls the indentation of the various levels.
3374 \newdimen\tocindent \tocindent = 3pc
3376 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
3379 % If the toc has to be broken over pages, we want it to be at chapters
3380 % if at all possible; hence the \penalty.
3381 \def\dochapentry#1#2{%
3382 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
3385 \tocentry{#1}{\dopageno{#2}}%
3387 \nobreak\vskip .25\baselineskip plus.1\baselineskip
3390 \def\dosecentry#1#2{\begingroup
3391 \secentryfonts \leftskip=\tocindent
3392 \tocentry{#1}{\dopageno{#2}}%
3395 \def\dosubsecentry#1#2{\begingroup
3396 \subsecentryfonts \leftskip=2\tocindent
3397 \tocentry{#1}{\dopageno{#2}}%
3400 \def\dosubsubsecentry#1#2{\begingroup
3401 \subsubsecentryfonts \leftskip=3\tocindent
3402 \tocentry{#1}{\dopageno{#2}}%
3405 % Final typesetting of a toc entry; we use the same \entry macro as for
3406 % the index entries, but we want to suppress hyphenation here. (We
3407 % can't do that in the \entry macro, since index entries might consist
3408 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
3410 % \turnoffactive is for the sake of @" used for umlauts.
3411 \def\tocentry#1#2{\begingroup
3412 \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
3413 \entry{\turnoffactive #1}{\turnoffactive #2}%
3416 % Space between chapter (or whatever) number and the title.
3417 \def\labelspace{\hskip1em \relax}
3419 \def\dopageno#1{{\rm #1}}
3420 \def\doshortpageno#1{{\rm #1}}
3422 \def\chapentryfonts{\secfonts \rm}
3423 \def\secentryfonts{\textfonts}
3424 \let\subsecentryfonts = \textfonts
3425 \let\subsubsecentryfonts = \textfonts
3428 \message{environments,}
3430 % Since these characters are used in examples, it should be an even number of
3431 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3432 % Furthermore, these definitions must come after we define our fonts.
3433 \newbox\dblarrowbox \newbox\longdblarrowbox
3434 \newbox\pushcharbox \newbox\bullbox
3435 \newbox\equivbox \newbox\errorbox
3438 %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
3439 %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
3440 %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
3441 %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
3442 % Adapted from the manmac format (p.420 of TeXbook)
3443 %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
3447 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3449 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3450 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
3451 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3452 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3454 % Adapted from the TeXbook's \boxit.
3455 {\tentt \global\dimen0 = 3em}% Width of the box.
3456 \dimen2 = .55pt % Thickness of rules
3457 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3458 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
3460 \global\setbox\errorbox=\hbox to \dimen0{\hfil
3461 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3462 \advance\hsize by -2\dimen2 % Rules.
3464 \hrule height\dimen2
3465 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3466 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3467 \kern3pt\vrule width\dimen2}% Space to right.
3468 \hrule height\dimen2}
3471 % The @error{} command.
3472 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3474 % @tex ... @end tex escapes into raw Tex temporarily.
3475 % One exception: @ is still an escape character, so that @end tex works.
3476 % But \@ or @@ will get a plain tex @ character.
3478 \def\tex{\begingroup
3479 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
3480 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
3481 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
3483 \catcode 43=12 % plus
3497 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
3498 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
3500 \let\bullet=\ptexbullet
3501 \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext
3503 \let\Etex=\endgroup}
3505 % Define @lisp ... @endlisp.
3506 % @lisp does a \begingroup so it can rebind things,
3507 % including the definition of @endlisp (which normally is erroneous).
3509 % Amount to narrow the margins by for @lisp.
3510 \newskip\lispnarrowing \lispnarrowing=0.4in
3512 % This is the definition that ^^M gets inside @lisp, @example, and other
3513 % such environments. \null is better than a space, since it doesn't
3515 \def\lisppar{\null\endgraf}
3517 % Make each space character in the input produce a normal interword
3518 % space in the output. Don't allow a line break at this space, as this
3519 % is used only in environments like @example, where each line of input
3520 % should produce a line of output anyway.
3523 \gdef\sepspaces{\obeyspaces\let =\tie}}
3525 % Define \obeyedspace to be our active space, whatever it is. This is
3526 % for use in \parsearg.
3528 \global\let\obeyedspace= }
3530 % This space is always present above and below environments.
3531 \newskip\envskipamount \envskipamount = 0pt
3533 % Make spacing and below environment symmetrical. We use \parskip here
3534 % to help in doing that, since in @example-like environments \parskip
3535 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
3536 % start of the next paragraph will insert \parskip
3538 \def\aboveenvbreak{{\advance\envskipamount by \parskip
3539 \endgraf \ifdim\lastskip<\envskipamount
3540 \removelastskip \penalty-50 \vskip\envskipamount \fi}}
3542 \let\afterenvbreak = \aboveenvbreak
3544 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
3545 \let\nonarrowing=\relax
3547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3548 % \cartouche: draw rectangle w/rounded corners around argument
3549 \font\circle=lcircle10
3551 \newdimen\cartouter\newdimen\cartinner
3552 \newskip\normbskip\newskip\normpskip\newskip\normlskip
3553 \circthick=\fontdimen8\circle
3555 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
3556 \def\ctr{{\hskip 6pt\circle\char'010}}
3557 \def\cbl{{\circle\char'012\hskip -6pt}}
3558 \def\cbr{{\hskip 6pt\circle\char'011}}
3559 \def\carttop{\hbox to \cartouter{\hskip\lskip
3560 \ctl\leaders\hrule height\circthick\hfil\ctr
3562 \def\cartbot{\hbox to \cartouter{\hskip\lskip
3563 \cbl\leaders\hrule height\circthick\hfil\cbr
3566 \newskip\lskip\newskip\rskip
3568 \long\def\cartouche{%
3570 \lskip=\leftskip \rskip=\rightskip
3571 \leftskip=0pt\rightskip=0pt %we want these *outside*.
3572 \cartinner=\hsize \advance\cartinner by-\lskip
3573 \advance\cartinner by-\rskip
3575 \advance\cartouter by 18pt % allow for 3pt kerns on either
3576 % side, and for 6pt waste from
3578 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
3579 % Flag to tell @lisp, etc., not to narrow margin.
3580 \let\nonarrowing=\comment
3582 \baselineskip=0pt\parskip=0pt\lineskip=0pt
3591 \baselineskip=\normbskip
3592 \lineskip=\normlskip
3608 % This macro is called at the beginning of all the @example variants,
3612 \inENV % This group ends at the end of the body
3613 \hfuzz = 12pt % Don't be fussy
3614 \sepspaces % Make spaces be word-separators rather than space tokens.
3616 \let\par = \lisppar % don't ignore blank lines
3617 \obeylines % each line of input is a line of output
3620 \emergencystretch = 0pt % don't try to avoid overfull boxes
3621 % @cartouche defines \nonarrowing to inhibit narrowing
3622 % at next level down.
3623 \ifx\nonarrowing\relax
3624 \advance \leftskip by \lispnarrowing
3625 \exdentamount=\lispnarrowing
3626 \let\exdent=\nofillexdent
3627 \let\nonarrowing=\relax
3631 % To ending an @example-like environment, we first end the paragraph
3632 % (via \afterenvbreak's vertical glue), and then the group. That way we
3633 % keep the zero \parskip that the environments set -- \parskip glue
3634 % will be inserted at the beginning of the next paragraph in the
3635 % document, after the environment.
3637 \def\nonfillfinish{\afterenvbreak\endgroup}%
3639 \def\lisp{\begingroup
3641 \let\Elisp = \nonfillfinish
3643 % Make @kbd do something special, if requested.
3644 \let\kbdfont\kbdexamplefont
3645 \rawbackslash % have \ input char produce \ char from current font
3649 % Define the \E... control sequence only if we are inside the
3650 % environment, so the error checking in \end will work.
3652 % We must call \lisp last in the definition, since it reads the
3653 % return following the @example (or whatever) command.
3655 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
3656 \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
3657 \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
3659 % @smallexample and @smalllisp. This is not used unless the @smallbook
3660 % command is given. Originally contributed by Pavel@xerox.
3662 \def\smalllispx{\begingroup
3664 \let\Esmalllisp = \nonfillfinish
3665 \let\Esmallexample = \nonfillfinish
3667 % Smaller fonts for small examples.
3669 \rawbackslash % make \ output the \ character from the current font (tt)
3673 % This is @display; same as @lisp except use roman font.
3675 \def\display{\begingroup
3677 \let\Edisplay = \nonfillfinish
3681 % This is @format; same as @display except don't narrow margins.
3683 \def\format{\begingroup
3684 \let\nonarrowing = t
3686 \let\Eformat = \nonfillfinish
3690 % @flushleft (same as @format) and @flushright.
3692 \def\flushleft{\begingroup
3693 \let\nonarrowing = t
3695 \let\Eflushleft = \nonfillfinish
3698 \def\flushright{\begingroup
3699 \let\nonarrowing = t
3701 \let\Eflushright = \nonfillfinish
3702 \advance\leftskip by 0pt plus 1fill
3705 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
3706 % and narrows the margins.
3709 \begingroup\inENV %This group ends at the end of the @quotation body
3710 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
3713 % We have retained a nonzero parskip for the environment, since we're
3714 % doing normal filling. So to avoid extra space below the environment...
3715 \def\Equotation{\parskip = 0pt \nonfillfinish}%
3717 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
3718 \ifx\nonarrowing\relax
3719 \advance\leftskip by \lispnarrowing
3720 \advance\rightskip by \lispnarrowing
3721 \exdentamount = \lispnarrowing
3722 \let\nonarrowing = \relax
3727 % Define formatter for defuns
3728 % First, allow user to change definition object font (\df) internally
3729 \def\setdeffont #1 {\csname DEF#1\endcsname}
3731 \newskip\defbodyindent \defbodyindent=.4in
3732 \newskip\defargsindent \defargsindent=50pt
3733 \newskip\deftypemargin \deftypemargin=12pt
3734 \newskip\deflastargmargin \deflastargmargin=18pt
3736 \newcount\parencount
3737 % define \functionparens, which makes ( and ) and & do special things.
3738 % \functionparens affects the group it is contained in.
3740 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
3741 \catcode`\[=\active \catcode`\]=\active}
3743 % Make control sequences which act like normal parenthesis chars.
3744 \let\lparen = ( \let\rparen = )
3746 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
3748 % Be sure that we always have a definition for `(', etc. For example,
3749 % if the fn name has parens in it, \boldbrax will not be in effect yet,
3750 % so TeX would otherwise complain about undefined control sequence.
3751 \global\let(=\lparen \global\let)=\rparen
3752 \global\let[=\lbrack \global\let]=\rbrack
3754 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
3755 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
3756 % This is used to turn on special parens
3757 % but make & act ordinary (given that it's active).
3758 \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
3760 % Definitions of (, ) and & used in args for functions.
3761 % This is the definition of ( outside of all parentheses.
3762 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
3763 \global\advance\parencount by 1
3766 % This is the definition of ( when already inside a level of parens.
3767 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
3769 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
3770 % also in that case restore the outer-level definition of (.
3771 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
3772 \global\advance \parencount by -1 }
3773 % If we encounter &foo, then turn on ()-hacking afterwards
3774 \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
3776 \gdef\normalparens{\boldbrax\let&=\ampnr}
3777 } % End of definition inside \activeparens
3778 %% These parens (in \boldbrax) actually are a little bolder than the
3779 %% contained text. This is especially needed for [ and ]
3780 \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
3781 \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
3783 \def\lbrb{{\bf\char`\[}}
3784 \def\rbrb{{\bf\char`\]}}
3786 % First, defname, which formats the header line itself.
3787 % #1 should be the function name.
3788 % #2 should be the type of definition, such as "Function".
3791 % Get the values of \leftskip and \rightskip as they were
3792 % outside the @def...
3794 \advance\dimen2 by -\defbodyindent
3796 \advance\dimen3 by -\defbodyindent
3798 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
3799 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
3800 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
3801 \parshape 2 0in \dimen0 \defargsindent \dimen1 %
3802 % Now output arg 2 ("Function" or some such)
3803 % ending at \deftypemargin from the right margin,
3804 % but stuck inside a box of width 0 so it does not interfere with linebreaking
3805 {% Adjust \hsize to exclude the ambient margins,
3806 % so that \rightline will obey them.
3807 \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
3808 \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
3809 % Make all lines underfull and no complaints:
3810 \tolerance=10000 \hbadness=10000
3811 \advance\leftskip by -\defbodyindent
3812 \exdentamount=\defbodyindent
3813 {\df #1}\enskip % Generate function name
3816 % Actually process the body of a definition
3817 % #1 should be the terminating control sequence, such as \Edefun.
3818 % #2 should be the "another name" control sequence, such as \defunx.
3819 % #3 should be the control sequence that actually processes the header,
3820 % such as \defunheader.
3822 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3824 % Define the end token that this defining construct specifies
3825 % so that it will exit this group.
3826 \def#1{\endgraf\endgroup\medbreak}%
3827 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
3829 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3830 \exdentamount=\defbodyindent
3832 \catcode 61=\active % 61 is `='
3833 \obeylines\activeparens\spacesplit#3}
3835 \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
3837 % Define the end token that this defining construct specifies
3838 % so that it will exit this group.
3839 \def#1{\endgraf\endgroup\medbreak}%
3840 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
3842 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3843 \exdentamount=\defbodyindent
3844 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
3846 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
3848 % Define the end token that this defining construct specifies
3849 % so that it will exit this group.
3850 \def#1{\endgraf\endgroup\medbreak}%
3851 \def#2##1 ##2 {\def#4{##1}%
3852 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
3854 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3855 \exdentamount=\defbodyindent
3856 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
3858 % These parsing functions are similar to the preceding ones
3859 % except that they do not make parens into active characters.
3860 % These are used for "variables" since they have no arguments.
3862 \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3864 % Define the end token that this defining construct specifies
3865 % so that it will exit this group.
3866 \def#1{\endgraf\endgroup\medbreak}%
3867 \def#2{\begingroup\obeylines\spacesplit#3}%
3869 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3870 \exdentamount=\defbodyindent
3872 \catcode 61=\active %
3873 \obeylines\spacesplit#3}
3875 % This is used for \def{tp,vr}parsebody. It could probably be used for
3876 % some of the others, too, with some judicious conditionals.
3878 \def\parsebodycommon#1#2#3{%
3881 % Define the end token that this defining construct specifies
3882 % so that it will exit this group.
3883 \def#1{\endgraf\endgroup\medbreak}%
3884 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
3886 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3887 \exdentamount=\defbodyindent
3888 \begingroup\obeylines
3891 \def\defvrparsebody#1#2#3#4 {%
3892 \parsebodycommon{#1}{#2}{#3}%
3893 \spacesplit{#3{#4}}%
3896 % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
3897 % type is just `struct', because we lose the braces in `{struct
3898 % termios}' when \spacesplit reads its undelimited argument. Sigh.
3899 % \let\deftpparsebody=\defvrparsebody
3901 % So, to get around this, we put \empty in with the type name. That
3902 % way, TeX won't find exactly `{...}' as an undelimited argument, and
3903 % won't strip off the braces.
3905 \def\deftpparsebody #1#2#3#4 {%
3906 \parsebodycommon{#1}{#2}{#3}%
3907 \spacesplit{\parsetpheaderline{#3{#4}}}\empty
3910 % Fine, but then we have to eventually remove the \empty *and* the
3911 % braces (if any). That's what this does.
3913 \def\removeemptybraces\empty#1\relax{#1}
3915 % After \spacesplit has done its work, this is called -- #1 is the final
3916 % thing to call, #2 the type name (which starts with \empty), and #3
3917 % (which might be empty) the arguments.
3919 \def\parsetpheaderline#1#2#3{%
3920 #1{\removeemptybraces#2\relax}{#3}%
3923 \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
3925 % Define the end token that this defining construct specifies
3926 % so that it will exit this group.
3927 \def#1{\endgraf\endgroup\medbreak}%
3928 \def#2##1 ##2 {\def#4{##1}%
3929 \begingroup\obeylines\spacesplit{#3{##2}}}%
3931 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3932 \exdentamount=\defbodyindent
3933 \begingroup\obeylines\spacesplit{#3{#5}}}
3935 % Split up #2 at the first space token.
3936 % call #1 with two arguments:
3937 % the first is all of #2 before the space token,
3938 % the second is all of #2 after that space token.
3939 % If #2 contains no space token, all of it is passed as the first arg
3940 % and the second is passed as empty.
3943 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
3944 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
3946 #1{#2}{}\else #1{#2}{#3#4}\fi}}
3948 % So much for the things common to all kinds of definitions.
3952 % First, define the processing that is wanted for arguments of \defun
3953 % Use this to expand the args and terminate the paragraph they make up
3955 \def\defunargs #1{\functionparens \sl
3956 % Expand, preventing hyphenation at `-' chars.
3957 % Note that groups don't affect changes in \hyphenchar.
3960 \hyphenchar\tensl=45
3961 \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
3962 \interlinepenalty=10000
3963 \advance\rightskip by 0pt plus 1fil
3964 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
3967 \def\deftypefunargs #1{%
3968 % Expand, preventing hyphenation at `-' chars.
3969 % Note that groups don't affect changes in \hyphenchar.
3970 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
3972 \tclose{#1}% avoid \code because of side effects on active chars
3973 \interlinepenalty=10000
3974 \advance\rightskip by 0pt plus 1fil
3975 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
3978 % Do complete processing of one @defun or @defunx line already parsed.
3980 % @deffn Command forward-char nchars
3982 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
3984 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
3985 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
3986 \catcode 61=\other % Turn off change made in \defparsebody
3989 % @defun == @deffn Function
3991 \def\defun{\defparsebody\Edefun\defunx\defunheader}
3993 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3994 \begingroup\defname {#1}{Function}%
3995 \defunargs {#2}\endgroup %
3996 \catcode 61=\other % Turn off change made in \defparsebody
3999 % @deftypefun int foobar (int @var{foo}, float @var{bar})
4001 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
4003 % #1 is the data type. #2 is the name and args.
4004 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
4005 % #1 is the data type, #2 the name, #3 the args.
4006 \def\deftypefunheaderx #1#2 #3\relax{%
4007 \doind {fn}{\code{#2}}% Make entry in function index
4008 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
4009 \deftypefunargs {#3}\endgroup %
4010 \catcode 61=\other % Turn off change made in \defparsebody
4013 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
4015 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
4017 % \defheaderxcond#1\relax$$$
4018 % puts #1 in @code, followed by a space, but does nothing if #1 is null.
4019 \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
4021 % #1 is the classification. #2 is the data type. #3 is the name and args.
4022 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
4023 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
4024 \def\deftypefnheaderx #1#2#3 #4\relax{%
4025 \doind {fn}{\code{#3}}% Make entry in function index
4027 \normalparens % notably, turn off `&' magic, which prevents
4028 % at least some C++ text from working
4029 \defname {\defheaderxcond#2\relax$$$#3}{#1}%
4030 \deftypefunargs {#4}\endgroup %
4031 \catcode 61=\other % Turn off change made in \defparsebody
4034 % @defmac == @deffn Macro
4036 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
4038 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4039 \begingroup\defname {#1}{Macro}%
4040 \defunargs {#2}\endgroup %
4041 \catcode 61=\other % Turn off change made in \defparsebody
4044 % @defspec == @deffn Special Form
4046 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
4048 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4049 \begingroup\defname {#1}{Special Form}%
4050 \defunargs {#2}\endgroup %
4051 \catcode 61=\other % Turn off change made in \defparsebody
4054 % This definition is run if you use @defunx
4055 % anywhere other than immediately after a @defun or @defunx.
4057 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
4058 \def\defunx #1 {\errmessage{@defunx in invalid context}}
4059 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
4060 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
4061 \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
4062 \def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}}
4063 \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
4065 % @defmethod, and so on
4067 % @defop {Funny Method} foo-class frobnicate argument
4069 \def\defop #1 {\def\defoptype{#1}%
4070 \defopparsebody\Edefop\defopx\defopheader\defoptype}
4072 \def\defopheader #1#2#3{%
4073 \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
4074 \begingroup\defname {#2}{\defoptype{} on #1}%
4075 \defunargs {#3}\endgroup %
4078 % @deftypemethod foo-class return-type foo-method args
4080 \def\deftypemethod{%
4081 \defmethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
4083 % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
4084 \def\deftypemethodheader#1#2#3#4{%
4085 \deftypefnheaderx{Method on #1}{#2}#3 #4\relax
4088 % @defmethod == @defop Method
4090 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
4092 \def\defmethodheader #1#2#3{%
4093 \dosubind {fn}{\code{#2}}{on #1}% entry in function index
4094 \begingroup\defname {#2}{Method on #1}%
4095 \defunargs {#3}\endgroup %
4098 % @defcv {Class Option} foo-class foo-flag
4100 \def\defcv #1 {\def\defcvtype{#1}%
4101 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
4103 \def\defcvarheader #1#2#3{%
4104 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4105 \begingroup\defname {#2}{\defcvtype{} of #1}%
4106 \defvarargs {#3}\endgroup %
4109 % @defivar == @defcv {Instance Variable}
4111 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
4113 \def\defivarheader #1#2#3{%
4114 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4115 \begingroup\defname {#2}{Instance Variable of #1}%
4116 \defvarargs {#3}\endgroup %
4119 % These definitions are run if you use @defmethodx, etc.,
4120 % anywhere other than immediately after a @defmethod, etc.
4122 \def\defopx #1 {\errmessage{@defopx in invalid context}}
4123 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
4124 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
4125 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
4129 % First, define the processing that is wanted for arguments of @defvar.
4130 % This is actually simple: just print them in roman.
4131 % This must expand the args and terminate the paragraph they make up
4132 \def\defvarargs #1{\normalparens #1%
4133 \interlinepenalty=10000
4134 \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
4136 % @defvr Counter foo-count
4138 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
4140 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
4141 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
4143 % @defvar == @defvr Variable
4145 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
4147 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4148 \begingroup\defname {#1}{Variable}%
4149 \defvarargs {#2}\endgroup %
4152 % @defopt == @defvr {User Option}
4154 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
4156 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4157 \begingroup\defname {#1}{User Option}%
4158 \defvarargs {#2}\endgroup %
4161 % @deftypevar int foobar
4163 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
4165 % #1 is the data type. #2 is the name, perhaps followed by text that
4166 % is actually part of the data type, which should not be put into the index.
4167 \def\deftypevarheader #1#2{%
4168 \dovarind#2 \relax% Make entry in variables index
4169 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
4170 \interlinepenalty=10000
4171 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
4173 \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
4175 % @deftypevr {Global Flag} int enable
4177 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
4179 \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
4180 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
4181 \interlinepenalty=10000
4182 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
4185 % This definition is run if you use @defvarx
4186 % anywhere other than immediately after a @defvar or @defvarx.
4188 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
4189 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
4190 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
4191 \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
4192 \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
4195 % Args are printed in bold, a slight difference from @defvar.
4197 \def\deftpargs #1{\bf \defvarargs{#1}}
4199 % @deftp Class window height width ...
4201 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
4203 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4204 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4206 % This definition is run if you use @deftpx, etc
4207 % anywhere other than immediately after a @deftp, etc.
4209 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
4212 \message{cross reference,}
4213 % Define cross-reference macros
4216 \newif\ifhavexrefs % True if xref values are known.
4217 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
4219 % @inforef is simple.
4220 \def\inforef #1{\inforefzzz #1,,,,**}
4221 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
4222 node \samp{\ignorespaces#1{}}}
4224 % \setref{foo} defines a cross-reference point named foo.
4227 \dosetq{#1-title}{Ytitle}%
4228 \dosetq{#1-pg}{Ypagenumber}%
4229 \dosetq{#1-snt}{Ysectionnumberandtype}}
4231 \def\unnumbsetref#1{%
4232 \dosetq{#1-title}{Ytitle}%
4233 \dosetq{#1-pg}{Ypagenumber}%
4234 \dosetq{#1-snt}{Ynothing}}
4236 \def\appendixsetref#1{%
4237 \dosetq{#1-title}{Ytitle}%
4238 \dosetq{#1-pg}{Ypagenumber}%
4239 \dosetq{#1-snt}{Yappendixletterandtype}}
4241 % \xref, \pxref, and \ref generate cross-references to specified points.
4242 % For \xrefX, #1 is the node name, #2 the name of the Info
4243 % cross-reference, #3 the printed node name, #4 the name of the Info
4244 % file, #5 the name of the printed manual. All but the node name can be
4247 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
4248 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
4249 \def\ref#1{\xrefX[#1,,,,,,,]}
4250 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
4251 \def\printedmanual{\ignorespaces #5}%
4252 \def\printednodename{\ignorespaces #3}%
4253 \setbox1=\hbox{\printedmanual}%
4254 \setbox0=\hbox{\printednodename}%
4256 % No printed node name was explicitly given.
4257 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
4258 % Use the node name inside the square brackets.
4259 \def\printednodename{\ignorespaces #1}%
4261 % Use the actual chapter/section title appear inside
4262 % the square brackets. Use the real section title if we have it.
4264 % It is in another manual, so we don't have it.
4265 \def\printednodename{\ignorespaces #1}%
4268 % We know the real title if we have the xref values.
4269 \def\printednodename{\refx{#1-title}{}}%
4271 % Otherwise just copy the Info node name.
4272 \def\printednodename{\ignorespaces #1}%
4278 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
4279 % insert empty discretionaries after hyphens, which means that it will
4280 % not find a line break at a hyphen in a node names. Since some manuals
4281 % are best written with fairly long node names, containing hyphens, this
4282 % is a loss. Therefore, we give the text of the node name again, so it
4283 % is as if TeX is seeing it for the first time.
4285 \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
4287 % _ (for example) has to be the character _ for the purposes of the
4288 % control sequence corresponding to the node, but it has to expand
4289 % into the usual \leavevmode...\vrule stuff for purposes of
4290 % printing. So we \turnoffactive for the \refx-snt, back on for the
4291 % printing, back off for the \refx-pg.
4292 {\turnoffactive \refx{#1-snt}{}}%
4293 \space [\printednodename],\space
4294 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
4298 % \dosetq is the interface for calls from other macros
4300 % Use \turnoffactive so that punctuation chars such as underscore
4301 % work in node names.
4302 \def\dosetq #1#2{{\let\folio=0 \turnoffactive
4303 \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
4306 % \internalsetq {foo}{page} expands into
4307 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
4308 % When the aux file is read, ' is the escape character
4310 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
4312 % Things to be expanded by \internalsetq
4314 \def\Ypagenumber{\folio}
4316 \def\Ytitle{\thissection}
4320 \def\Ysectionnumberandtype{%
4321 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
4322 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
4323 \else \ifnum \subsubsecno=0 %
4324 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
4326 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
4329 \def\Yappendixletterandtype{%
4330 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
4331 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
4332 \else \ifnum \subsubsecno=0 %
4333 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
4335 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
4340 % Use TeX 3.0's \inputlineno to get the line number, for better error
4341 % messages, but if we're using an old version of TeX, don't do anything.
4343 \ifx\inputlineno\thisisundefined
4344 \let\linenumber = \empty % Non-3.0.
4346 \def\linenumber{\the\inputlineno:\space}
4349 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
4350 % If its value is nonempty, SUFFIX is output afterward.
4353 \expandafter\ifx\csname X#1\endcsname\relax
4354 % If not defined, say something at least.
4355 $\langle$un\-de\-fined$\rangle$%
4357 \message{\linenumber Undefined cross reference `#1'.}%
4360 \global\warnedxrefstrue
4361 \message{Cross reference values unknown; you must run TeX again.}%
4365 % It's defined, so just use it.
4366 \csname X#1\endcsname
4368 #2% Output the suffix in any case.
4371 % This is the macro invoked by entries in the aux file.
4374 \expandafter\gdef\csname X#1\endcsname{#2}%
4377 % Read the last existing aux file, if any. No error if none exists.
4378 \def\readauxfile{\begingroup
4379 \catcode`\^^@=\other
4380 \catcode`\^^A=\other
4381 \catcode`\^^B=\other
4382 \catcode`\^^C=\other
4383 \catcode`\^^D=\other
4384 \catcode`\^^E=\other
4385 \catcode`\^^F=\other
4386 \catcode`\^^G=\other
4387 \catcode`\^^H=\other
4388 \catcode`\^^K=\other
4389 \catcode`\^^L=\other
4390 \catcode`\^^N=\other
4391 \catcode`\^^P=\other
4392 \catcode`\^^Q=\other
4393 \catcode`\^^R=\other
4394 \catcode`\^^S=\other
4395 \catcode`\^^T=\other
4396 \catcode`\^^U=\other
4397 \catcode`\^^V=\other
4398 \catcode`\^^W=\other
4399 \catcode`\^^X=\other
4400 \catcode`\^^Z=\other
4401 \catcode`\^^[=\other
4402 \catcode`\^^\=\other
4403 \catcode`\^^]=\other
4404 \catcode`\^^^=\other
4405 \catcode`\^^_=\other
4408 % It was suggested to define this as 7, which would allow ^^e4 etc.
4409 % in xref tags, i.e., node names. But since ^^e4 notation isn't
4410 % supported in the main text, it doesn't seem desirable. Furthermore,
4411 % that is not enough: for node names that actually contain a ^
4412 % character, we would end up writing a line like this: 'xrdef {'hat
4413 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
4414 % argument, and \hat is not an expandable control sequence. It could
4415 % all be worked out, but why? Either we support ^^ or we don't.
4417 % The other change necessary for this was to define \auxhat:
4418 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
4419 % and then to call \auxhat in \setq.
4432 % `\+ does not work, so use 43.
4434 % Make the characters 128-255 be printing characters
4438 \catcode\count 1=\other
4439 \advance\count 1 by 1
4440 \ifnum \count 1<256 \loop \fi
4443 % The aux file uses ' as the escape (for now).
4444 % Turn off \ as an escape so we do not lose on
4445 % entries which were dumped with control sequences in their names.
4446 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
4447 % Reference to such entries still does not work the way one would wish,
4448 % but at least they do not bomb out when the aux file is read in.
4455 \openin 1 \jobname.aux
4459 \global\havexrefstrue
4460 \global\warnedobstrue
4462 % Open the new aux file. TeX will close it automatically at exit.
4463 \openout\auxfile=\jobname.aux
4469 \newcount \footnoteno
4471 % The trailing space in the following definition for supereject is
4472 % vital for proper filling; pages come out unaligned when you do a
4473 % pagealignmacro call if that space before the closing brace is
4474 % removed. (Generally, numeric constants should always be followed by a
4475 % space to prevent strange expansion errors.)
4476 \def\supereject{\par\penalty -20000\footnoteno =0 }
4478 % @footnotestyle is meaningful for info output only.
4479 \let\footnotestyle=\comment
4481 \let\ptexfootnote=\footnote
4485 % Auto-number footnotes. Otherwise like plain.
4487 \global\advance\footnoteno by \@ne
4488 \edef\thisfootno{$^{\the\footnoteno}$}%
4490 % In case the footnote comes at the end of a sentence, preserve the
4491 % extra spacing after we do the footnote number.
4493 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
4495 % Remove inadvertent blank space before typesetting the footnote number.
4501 % Don't bother with the trickery in plain.tex to not require the
4502 % footnote text as a parameter. Our footnotes don't need to be so general.
4504 % Oh yes, they do; otherwise, @ifset and anything else that uses
4505 % \parseargline fail inside footnotes because the tokens are fixed when
4506 % the footnote is read. --karl, 16nov96.
4508 \long\gdef\footnotezzz{\insert\footins\bgroup
4509 % We want to typeset this text as a normal paragraph, even if the
4510 % footnote reference occurs in (for example) a display environment.
4511 % So reset some parameters.
4512 \interlinepenalty\interfootnotelinepenalty
4513 \splittopskip\ht\strutbox % top baseline for broken footnotes
4514 \splitmaxdepth\dp\strutbox
4515 \floatingpenalty\@MM
4520 \parindent\defaultparindent
4522 % Hang the footnote text off the number.
4524 \textindent{\thisfootno}%
4526 % Don't crash into the line above the footnote text. Since this
4527 % expands into a box, it must come within the paragraph, lest it
4528 % provide a place where TeX can split the footnote.
4530 \futurelet\next\fo@t
4532 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
4533 \else\let\next\f@t\fi \next}
4534 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
4535 \def\f@t#1{#1\@foot}
4536 \def\@foot{\strut\egroup}
4538 }%end \catcode `\@=11
4540 % Set the baselineskip to #1, and the lineskip and strut size
4541 % correspondingly. There is no deep meaning behind these magic numbers
4542 % used as factors; they just match (closely enough) what Knuth defined.
4544 \def\lineskipfactor{.08333}
4545 \def\strutheightpercent{.70833}
4546 \def\strutdepthpercent {.29167}
4549 \normalbaselineskip = #1\relax
4550 \normallineskip = \lineskipfactor\normalbaselineskip
4552 \setbox\strutbox =\hbox{%
4553 \vrule width0pt height\strutheightpercent\baselineskip
4554 depth \strutdepthpercent \baselineskip
4558 % @| inserts a changebar to the left of the current line. It should
4559 % surround any changed text. This approach does *not* work if the
4560 % change spans more than two lines of output. To handle that, we would
4561 % have adopt a much more difficult approach (putting marks into the main
4562 % vertical list for the beginning and end of each change).
4565 % \vadjust can only be used in horizontal mode.
4568 % Append this vertical mode material after the current line in the output.
4570 % We want to insert a rule with the height and depth of the current
4571 % leading; that is exactly what \strutbox is supposed to record.
4572 \vskip-\baselineskip
4574 % \vadjust-items are inserted at the left edge of the type. So
4575 % the \llap here moves out into the left-hand margin.
4578 % For a thicker or thinner bar, change the `1pt'.
4579 \vrule height\baselineskip width1pt
4581 % This is the space between the bar and the text.
4587 % For a final copy, take out the rectangles
4588 % that mark overfull boxes (in case you have decided
4589 % that the text looks ok even though it passes the margin).
4591 \def\finalout{\overfullrule=0pt}
4593 % @image. We use the macros from epsf.tex to support this.
4594 % If epsf.tex is not installed and @image is used, we complain.
4596 % Check for and read epsf.tex up front. If we read it only at @image
4597 % time, we might be inside a group, and then its definitions would get
4598 % undone and the next image would fail.
4599 \openin 1 = xepsf.tex
4602 \def\epsfannounce{\toks0 = }% do not bother showing banner
4606 \newif\ifwarnednoepsf
4607 \newhelp\noepsfhelp{epsf.tex must be installed for images to
4608 work. It is also included in the Texinfo distribution, or you can get
4609 it from ftp://ftp.tug.org/tex/epsf.tex.}
4611 % Only complain once about lack of epsf.tex.
4613 \ifx\epsfbox\undefined
4614 \ifwarnednoepsf \else
4615 \errhelp = \noepsfhelp
4616 \errmessage{epsf.tex not found, images will be ignored}%
4617 \global\warnednoepsftrue
4620 \imagexxx #1,,,\finish
4624 % Arguments to @image:
4625 % #1 is (mandatory) image filename; we tack on .eps extension.
4626 % #2 is (optional) width, #3 is (optional) height.
4627 % #4 is just the usual extra ignored arg for parsing this stuff.
4628 \def\imagexxx#1,#2,#3,#4\finish{%
4629 % \epsfbox itself resets \epsf?size at each figure.
4630 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
4631 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
4635 % End of control word definitions.
4638 \message{and turning on texinfo input format.}
4649 % Set some numeric style parameters, for 8.5 x 11 format.
4653 \newdimen\defaultparindent \defaultparindent = 15pt
4654 \parindent = \defaultparindent
4655 \parskip 3pt plus 2pt minus 1pt
4657 \advance\topskip by 1.2cm
4659 \chapheadingskip = 15pt plus 4pt minus 2pt
4660 \secheadingskip = 12pt plus 3pt minus 2pt
4661 \subsecheadingskip = 9pt plus 2pt minus 2pt
4663 % Prevent underfull vbox error messages.
4666 % Following George Bush, just get rid of widows and orphans.
4670 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
4671 % using an old version of TeX, don't do anything. We want the amount of
4672 % stretch added to depend on the line length, hence the dependence on
4673 % \hsize. This makes it come to about 9pt for the 8.5x11 format.
4675 \ifx\emergencystretch\thisisundefined
4676 % Allow us to assign to \emergencystretch anyway.
4677 \def\emergencystretch{\dimen0}%
4679 \emergencystretch = \hsize
4680 \divide\emergencystretch by 45
4683 % Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25)
4685 \global\chapheadingskip = 15pt plus 4pt minus 2pt
4686 \global\secheadingskip = 12pt plus 3pt minus 2pt
4687 \global\subsecheadingskip = 9pt plus 2pt minus 2pt
4689 \global\lispnarrowing = 0.3in
4691 \advance\topskip by -1cm
4692 \global\parskip 2pt plus 1pt
4695 \global\tolerance=700
4697 \global\contentsrightmargin=0pt
4698 \global\deftypemargin=0pt
4699 \global\defbodyindent=.5cm
4701 \global\pagewidth=\hsize
4702 \global\pageheight=\vsize
4704 \global\let\smalllisp=\smalllispx
4705 \global\let\smallexample=\smalllispx
4706 \global\def\Esmallexample{\Esmalllisp}
4709 % Use @afourpaper to print on European A4 paper.
4711 \global\tolerance=700
4714 \global\parskip 15pt plus 1pt
4716 \global\vsize= 53\baselineskip
4717 \advance\vsize by \topskip
4718 %\global\hsize= 5.85in % A4 wide 10pt
4719 \global\hsize= 6.5in
4720 \global\outerhsize=\hsize
4721 \global\advance\outerhsize by 0.5in
4722 \global\outervsize=\vsize
4723 \global\advance\outervsize by 0.6in
4725 \global\pagewidth=\hsize
4726 \global\pageheight=\vsize
4730 \normaloffset=\hoffset
4734 % Allow control of the text dimensions. Parameters in order: textheight;
4735 % textwidth; voffset; hoffset; binding offset; topskip.
4736 % All require a dimension;
4737 % header is additional; added length extends the bottom of the page.
4739 \def\changepagesizes#1#2#3#4#5#6{
4742 \advance\vsize by \topskip
4745 \global\outerhsize=\hsize
4746 \global\advance\outerhsize by 0.5in
4747 \global\outervsize=\vsize
4748 \global\advance\outervsize by 0.6in
4749 \global\pagewidth=\hsize
4750 \global\pageheight=\vsize
4751 \global\normaloffset= #4
4752 \global\bindingoffset= #5}
4754 % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
4755 % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
4757 {\global\tolerance=700
4760 \global\parskip 15pt plus 1pt
4761 \advance\baselineskip by 1.6pt
4762 \changepagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}
4765 % Use @afourwide to print on European A4 paper in wide format.
4766 \def\afourwide{\afourpaper
4767 \changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}}
4769 % Define macros to output various characters with catcode for normal text.
4778 \def\normaldoublequote{"}
4781 \def\normalunderscore{_}
4782 \def\normalverticalbar{|}
4784 \def\normalgreater{>}
4787 % This macro is used to make a character print one way in ttfont
4788 % where it can probably just be output, and another way in other fonts,
4789 % where something hairier probably needs to be done.
4791 % #1 is what to print if we are indeed using \tt; #2 is what to print
4792 % otherwise. Since all the Computer Modern typewriter fonts have zero
4793 % interword stretch (and shrink), and it is reasonable to expect all
4794 % typewriter fonts to have this, we can check that font parameter.
4796 \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
4798 % Turn off all special characters except @
4799 % (and those which the user can use as if they were ordinary).
4800 % Most of these we simply print from the \tt font, but for some, we can
4801 % use math or other variants that look better in normal text.
4804 \def\activedoublequote{{\tt \char '042}}
4805 \let"=\activedoublequote
4807 \def~{{\tt \char '176}}
4813 \def_{\ifusingtt\normalunderscore\_}
4814 % Subroutine for the previous macro.
4815 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
4818 \def|{{\tt \char '174}}
4826 \def+{{\tt \char 43}}
4827 %\catcode 27=\active
4828 %\def^^[{$\diamondsuit$}
4830 % Set up an active definition for =, but don't enable it most of the time.
4831 {\catcode`\==\active
4832 \global\def={{\tt \char 61}}}
4837 % If a .fmt file is being used, characters that might appear in a file
4838 % name cannot be active until we have parsed the command line.
4839 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
4840 % \otherifyactive is called near the end of this file.
4841 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
4845 % \rawbackslashxx output one backslash character in current font
4846 \global\chardef\rawbackslashxx=`\\
4847 %{\catcode`\\=\other
4848 %@gdef@rawbackslashxx{\}}
4850 % \rawbackslash redefines \ as input to do \rawbackslashxx.
4851 {\catcode`\\=\active
4852 @gdef@rawbackslash{@let\=@rawbackslashxx }}
4854 % \normalbackslash outputs one backslash in fixed width font.
4855 \def\normalbackslash{{\tt\rawbackslashxx}}
4857 % Say @foo, not \foo, in error messages.
4860 % \catcode 17=0 % Define control-q
4863 % Used sometimes to turn off (effectively) the active characters
4864 % even after parsing them.
4865 @def@turnoffactive{@let"=@normaldoublequote
4866 @let\=@realbackslash
4869 @let_=@normalunderscore
4870 @let|=@normalverticalbar
4872 @let>=@normalgreater
4875 @def@normalturnoffactive{@let"=@normaldoublequote
4876 @let\=@normalbackslash
4879 @let_=@normalunderscore
4880 @let|=@normalverticalbar
4882 @let>=@normalgreater
4885 % Make _ and + \other characters, temporarily.
4886 % This is canceled by @fixbackslash.
4889 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
4890 % That is what \eatinput is for; after that, the `\' should revert to printing
4893 @gdef@eatinput input texinfo{@fixbackslash}
4894 @global@let\ = @eatinput
4896 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
4897 % the first `\{ in the file would cause an error. This macro tries to fix
4898 % that, assuming it is called before the first `\' could plausibly occur.
4899 % Also back turn on active characters that might appear in the input
4900 % file name, in case not using a pre-dumped format.
4902 @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
4903 @catcode`+=@active @catcode`@_=@active}
4905 %% These look ok in all fonts, so just make them not special. The @rm below
4906 %% makes sure that the current font starts out as the newly loaded cmr10
4907 @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
4913 @c page-delimiter: "^\\\\message"