1 %% TeX macros to handle Texinfo files.
2 %% $Id: texinfo.tex,v 2.202 1997/06/04 21:46:06 karl Exp $
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.200 $
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
191 \egroup % end of \vbox\bgroup
192 \hfil\egroup % end of (centering) \line\bgroup
193 \vskip\topandbottommargin plus1fill minus1fill
194 \boxmaxdepth = \cornerthick
196 \vbox{\moveleft\cornerthick\nsbot}%
198 \vbox{\moveright\cornerthick\nsbot}%
201 \line{\ewbot\hfil\ewbot}%
202 \egroup % \vbox from first cropmarks clause
204 }% end of \shipout\vbox
205 }% end of group with \turnoffactive
207 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
210 \newinsert\margin \dimen\margin=\maxdimen
212 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
214 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
215 % marginal hacks, juha@viisa.uucp (Juha Takala)
216 \ifvoid\margin\else % marginal info is present
217 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
218 \dimen@=\dp#1 \unvbox#1
219 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
220 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
223 % Here are the rules for the cropmarks. Note that they are
224 % offset so that the space between them is truly \outerhsize or \outervsize
225 % (P. A. MacKay, 12 November, 1986)
227 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
229 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
230 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
232 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
234 % Parse an argument, then pass it to #1. The argument is the rest of
235 % the input line (except we remove a trailing comment). #1 should be a
236 % macro which expects an ordinary undelimited TeX argument.
242 \futurelet\temp\parseargx
245 % If the next token is an obeyed space (from an @example environment or
246 % the like), remove it and recurse. Otherwise, we're done.
248 % \obeyedspace is defined far below, after the definition of \sepspaces.
249 \ifx\obeyedspace\temp
250 \expandafter\parseargdiscardspace
252 \expandafter\parseargline
256 % Remove a single space (as the delimiter token to the macro call).
258 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
261 \gdef\parseargline#1^^M{%
262 \endgroup % End of the group started in \parsearg.
264 % First remove any @c comment, then any @comment.
265 % Result of each macro is put in \toks0.
266 \argremovec #1\c\relax %
267 \expandafter\argremovecomment \the\toks0 \comment\relax %
269 % Call the caller's macro, saved as \next in \parsearg.
270 \expandafter\next\expandafter{\the\toks0}%
274 % Since all \c{,omment} does is throw away the argument, we can let TeX
275 % do that for us. The \relax here is matched by the \relax in the call
276 % in \parseargline; it could be more or less anything, its purpose is
277 % just to delimit the argument to the \c.
278 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
279 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
281 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
282 % @end itemize @c foo
283 % will have two active spaces as part of the argument with the
284 % `itemize'. Here we remove all active spaces from #1, and assign the
287 % This loses if there are any *other* active characters besides spaces
288 % in the argument -- _ ^ +, for example -- since they get expanded.
289 % Fortunately, Texinfo does not define any such commands. (If it ever
290 % does, the catcode of the characters in questionwill have to be changed
291 % here.) But this means we cannot call \removeactivespaces as part of
292 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
293 % that \parsearg gets might well have any character at all in it.
295 \def\removeactivespaces#1{%
299 \global\toks0 = \expandafter{\temp}%
303 % Change the active space to expand to nothing.
307 \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
311 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
313 %% These are used to keep @begin/@end levels from running away
314 %% Call \inENV within environments (after a \begingroup)
315 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
317 \ifENV\errmessage{Still within an environment. Type Return to continue.}
318 \endgroup\fi} % This is not perfect, but it should reduce lossage
320 % @begin foo is the same as @foo, for now.
321 \newhelp\EMsimple{Type <Return> to continue.}
323 \outer\def\begin{\parsearg\beginxxx}
326 \expandafter\ifx\csname #1\endcsname\relax
327 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
328 \csname #1\endcsname\fi}
330 % @end foo executes the definition of \Efoo.
332 \def\end{\parsearg\endxxx}
334 \removeactivespaces{#1}%
335 \edef\endthing{\the\toks0}%
337 \expandafter\ifx\csname E\endthing\endcsname\relax
338 \expandafter\ifx\csname \endthing\endcsname\relax
339 % There's no \foo, i.e., no ``environment'' foo.
341 \errmessage{Undefined command `@end \endthing'}%
343 \unmatchedenderror\endthing
346 % Everything's ok; the right environment has been started.
347 \csname E\endthing\endcsname
351 % There is an environment #1, but it hasn't been started. Give an error.
353 \def\unmatchedenderror#1{%
355 \errmessage{This `@end #1' doesn't have a matching `@#1'}%
358 % Define the control sequence \E#1 to give an unmatched @end error.
360 \def\defineunmatchedend#1{%
361 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
365 % Single-spacing is done by various environments (specifically, in
366 % \nonfillstart and \quotations).
367 \newskip\singlespaceskip \singlespaceskip = 12.5pt
369 % Why was this kern here? It messes up equalizing space above and below
370 % environments. --karl, 6may93
371 %{\advance \baselineskip by -\singlespaceskip
372 %\kern \baselineskip}%
373 \setleading \singlespaceskip
376 %% Simple single-character @ commands
379 % Kludge this until the fonts are right (grr).
380 \def\@{{\tt \char '100}}
382 % This is turned off because it was never documented
383 % and you can use @w{...} around a quote to suppress ligatures.
384 %% Define @` and @' to be the same as ` and '
385 %% but suppressing ligatures.
389 % Used to generate quoted braces.
390 \def\mylbrace {{\tt \char '173}}
391 \def\myrbrace {{\tt \char '175}}
395 % Definitions to produce actual \{ & \} command in an index.
396 \catcode`\{ = 12 \catcode`\} = 12
397 \catcode`\[ = 1 \catcode`\] = 2
398 \catcode`\@ = 0 \catcode`\\ = 12
403 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
404 % Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
407 \def\ringaccent#1{{\accent23 #1}}
412 % Other special characters: @questiondown @exclamdown
413 % Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
414 \def\questiondown{?`}
417 % Dotless i and dotless j, used for accents.
422 \ifx\temp\imacro \ptexi
423 \else\ifx\temp\jmacro \j
424 \else \errmessage{@dotless can be used only with i or j}%
428 % @: forces normal size whitespace following.
429 \def\:{\spacefactor=1000 }
431 % @* forces a line break.
432 \def\*{\hfil\break\hbox{}\ignorespaces}
434 % @. is an end-of-sentence period.
435 \def\.{.\spacefactor=3000 }
437 % @enddots{} is an end-of-sentence ellipsis.
438 \gdef\enddots{$\mathinner{\ldotp\ldotp\ldotp\ldotp}$\spacefactor=3000}
440 % @! is an end-of-sentence bang.
441 \gdef\!{!\spacefactor=3000 }
443 % @? is an end-of-sentence query.
444 \gdef\?{?\spacefactor=3000 }
446 % @w prevents a word break. Without the \leavevmode, @w at the
447 % beginning of a paragraph, when TeX is still in vertical mode, would
448 % produce a whole line of output instead of starting the paragraph.
449 \def\w#1{\leavevmode\hbox{#1}}
451 % @group ... @end group forces ... to be all on one page, by enclosing
452 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
453 % to keep its height that of a normal line. According to the rules for
454 % \topskip (p.114 of the TeXbook), the glue inserted is
455 % max (\topskip - \ht (first item), 0). If that height is large,
456 % therefore, no glue is inserted, and the space between the headline and
457 % the text is small, which looks bad.
459 \def\group{\begingroup
460 \ifnum\catcode13=\active \else
461 \errhelp = \groupinvalidhelp
462 \errmessage{@group invalid in context where filling is enabled}%
465 % The \vtop we start below produces a box with normal height and large
466 % depth; thus, TeX puts \baselineskip glue before it, and (when the
467 % next line of text is done) \lineskip glue after it. (See p.82 of
468 % the TeXbook.) Thus, space below is not quite equal to space
469 % above. But it's pretty close.
471 \egroup % End the \vtop.
472 \endgroup % End the \group.
476 % We have to put a strut on the last line in case the @group is in
477 % the midst of an example, rather than completely enclosing it.
478 % Otherwise, the interline space between the last line of the group
479 % and the first line afterwards is too small. But we can't put the
480 % strut in \Egroup, since there it would be on a line by itself.
481 % Hence this just inserts a strut at the beginning of each line.
482 \everypar = {\strut}%
484 % Since we have a strut on every line, we don't need any of TeX's
485 % normal interline spacing.
488 % OK, but now we have to do something about blank
489 % lines in the input in @example-like environments, which normally
490 % just turn into \lisppar, which will insert no space now that we've
491 % turned off the interline space. Simplest is to make them be an
494 \edef\par{\leavevmode \par}%
496 % Reset ^^M's definition to new definition of \par.
500 % Do @comment since we are called inside an environment such as
501 % @example, where each end-of-line in the input causes an
502 % end-of-line in the output. We don't want the end-of-line after
503 % the `@group' to put extra space in the output. Since @group
504 % should appear on a line by itself (according to the Texinfo
505 % manual), we don't worry about eating any user text.
509 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
510 % message, so this ends up printing `@group can only ...'.
512 \newhelp\groupinvalidhelp{%
513 group can only be used in environments such as @example,^^J%
514 where each line of input produces a line of output.}
516 % @need space-in-mils
517 % forces a page break if there is not space-in-mils remaining.
519 \newdimen\mil \mil=0.001in
521 \def\need{\parsearg\needx}
523 % Old definition--didn't work.
524 %\def\needx #1{\par %
525 %% This method tries to make TeX break the page naturally
526 %% if the depth of the box does not fit.
528 %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
533 % Go into vertical mode, so we don't make a big box in the middle of a
537 % Don't add any leading before our big empty box, but allow a page
538 % break, since the best break might be right here.
541 \vtop to #1\mil{\vfil}%
543 % TeX does not even consider page breaks if a penalty added to the
544 % main vertical list is 10000 or more. But in order to see if the
545 % empty box we just added fits on the page, we must make it consider
546 % page breaks. On the other hand, we don't want to actually break the
547 % page after the empty box. So we use a penalty of 9999.
549 % There is an extremely small chance that TeX will actually break the
550 % page at this \penalty, if there are no other feasible breakpoints in
551 % sight. (If the user is using lots of big @group commands, which
552 % almost-but-not-quite fill up a page, TeX will have a hard time doing
553 % good page breaking, for example.) However, I could not construct an
554 % example where a page broke at this \penalty; if it happens in a real
555 % document, then we can reconsider our strategy.
558 % Back up by the size of the box, whether we did a page break or not.
561 % Do not allow a page break right after this kern.
565 % @br forces paragraph break
569 % @dots{} output some dots
573 % @page forces the start of a new page
575 \def\page{\par\vfill\supereject}
578 % outputs text on separate line in roman font, starting at standard page margin
580 % This records the amount of indent in the innermost environment.
581 % That's how much \exdent should take out.
582 \newskip\exdentamount
584 % This defn is used inside fill environments such as @defun.
585 \def\exdent{\parsearg\exdentyyy}
586 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
588 % This defn is used inside nofill environments such as @example.
589 \def\nofillexdent{\parsearg\nofillexdentyyy}
590 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
591 \leftline{\hskip\leftskip{\rm#1}}}}
593 % @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
596 \strut\vadjust{\nobreak\kern-\strutdepth
597 \vtop to \strutdepth{\baselineskip\strutdepth\vss
598 \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
599 \newskip\inmarginspacing \inmarginspacing=1cm
600 \def\strutdepth{\dp\strutbox}
602 %\hbox{{\rm#1}}\hfil\break}}
604 % @include file insert text of that file as input.
605 % Allow normal characters that we make active in the argument (a file name).
606 \def\include{\begingroup
615 \parsearg\includezzz}
616 % Restore active chars for included file.
617 \def\includezzz#1{\endgroup\begingroup
618 % Read the included file in a group so nested @include's work.
625 % @center line outputs that line, centered
627 \def\center{\parsearg\centerzzz}
628 \def\centerzzz #1{{\advance\hsize by -\leftskip
629 \advance\hsize by -\rightskip
632 % @sp n outputs n lines of vertical space
634 \def\sp{\parsearg\spxxx}
635 \def\spxxx #1{\vskip #1\baselineskip}
637 % @comment ...line which is ignored...
638 % @c is the same as @comment
639 % @ignore ... @end ignore is another way to write a comment
641 \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
642 \parsearg \commentxxx}
644 \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
648 % @paragraphindent is defined for the Info formatting commands only.
649 \let\paragraphindent=\comment
651 % Prevent errors for section commands.
652 % Used in @ignore and in failing conditionals.
653 \def\ignoresections{%
655 \let\unnumbered=\relax
657 \let\unnumberedsec=\relax
658 \let\unnumberedsection=\relax
659 \let\unnumberedsubsec=\relax
660 \let\unnumberedsubsection=\relax
661 \let\unnumberedsubsubsec=\relax
662 \let\unnumberedsubsubsection=\relax
665 \let\subsubsec=\relax
666 \let\subsection=\relax
667 \let\subsubsection=\relax
669 \let\appendixsec=\relax
670 \let\appendixsection=\relax
671 \let\appendixsubsec=\relax
672 \let\appendixsubsection=\relax
673 \let\appendixsubsubsec=\relax
674 \let\appendixsubsubsection=\relax
676 \let\smallbook=\relax
677 \let\titlepage=\relax
680 % Used in nested conditionals, where we have to parse the Texinfo source
681 % and so want to turn off most commands, in case they are used
684 \def\ignoremorecommands{%
685 \let\defcodeindex = \relax
689 \let\defindex = \relax
690 \let\defivar = \relax
692 \let\defmethod = \relax
695 \let\defspec = \relax
697 \let\deftypefn = \relax
698 \let\deftypefun = \relax
699 \let\deftypevar = \relax
700 \let\deftypevr = \relax
706 \let\printindex = \relax
708 \let\settitle = \relax
709 \let\setchapternewpage = \relax
710 \let\setchapterstyle = \relax
711 \let\everyheading = \relax
712 \let\evenheading = \relax
713 \let\oddheading = \relax
714 \let\everyfooting = \relax
715 \let\evenfooting = \relax
716 \let\oddfooting = \relax
717 \let\headings = \relax
718 \let\include = \relax
719 \let\lowersections = \relax
721 \let\raisesections = \relax
728 % Ignore @ignore ... @end ignore.
730 \def\ignore{\doignore{ignore}}
732 % Also ignore @ifinfo, @ifhtml, @html, @menu, and @direntry text.
734 \def\ifinfo{\doignore{ifinfo}}
735 \def\ifhtml{\doignore{ifhtml}}
736 \def\html{\doignore{html}}
737 \def\menu{\doignore{menu}}
738 \def\direntry{\doignore{direntry}}
740 % Also ignore @macro ... @end macro. The user must run texi2dvi,
741 % which runs makeinfo to do macro expansion. Ignore @unmacro, too.
742 \def\macro{\doignore{macro}}
743 \let\unmacro = \comment
746 % @dircategory CATEGORY -- specify a category of the dir file
747 % which this file should belong to. Ignore this in TeX.
748 \let\dircategory = \comment
750 % Ignore text until a line `@end #1'.
752 \def\doignore#1{\begingroup
753 % Don't complain about control sequences we have declared \outer.
756 % Define a command to swallow text until we reach `@end #1'.
757 \long\def\doignoretext##1\end #1{\enddoignore}%
759 % Make sure that spaces turn into tokens that match what \doignoretext wants.
762 % And now expand that command.
766 % What we do to finish off ignored text.
768 \def\enddoignore{\endgroup\ignorespaces}%
770 \newif\ifwarnedobs\warnedobsfalse
772 \ifwarnedobs\relax\else
773 % We need to warn folks that they may have trouble with TeX 3.0.
774 % This uses \immediate\write16 rather than \message to get newlines.
776 \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
777 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
778 \immediate\write16{If you are running another version of TeX, relax.}
779 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
780 \immediate\write16{ Then upgrade your TeX installation if you can.}
781 \immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
782 \immediate\write16{If you are stuck with version 3.0, run the}
783 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
784 \immediate\write16{ to use a workaround.}
786 \global\warnedobstrue
790 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
791 % workaround (which requires the file ``dummy.tfm'' to be installed),
792 % uncomment the following line:
793 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
795 % Ignore text, except that we keep track of conditional commands for
796 % purposes of nesting, up to an `@end #1' command.
798 \def\nestedignore#1{%
800 % We must actually expand the ignored text to look for the @end
801 % command, so that nested ignore constructs work. Thus, we put the
802 % text into a \vbox and then do nothing with the result. To minimize
803 % the change of memory overflow, we follow the approach outlined on
804 % page 401 of the TeXbook: make the current font be a dummy font.
806 \setbox0 = \vbox\bgroup
807 % Don't complain about control sequences we have declared \outer.
810 % Define `@end #1' to end the box, which will in turn undefine the
811 % @end command again.
812 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
814 % We are going to be parsing Texinfo commands. Most cause no
815 % trouble when they are used incorrectly, but some commands do
816 % complicated argument parsing or otherwise get confused, so we
819 % We can't do anything about stray @-signs, unfortunately;
820 % they'll produce `undefined control sequence' errors.
823 % Set the current font to be \nullfont, a TeX primitive, and define
824 % all the font commands to also use \nullfont. We don't use
825 % dummy.tfm, as suggested in the TeXbook, because not all sites
826 % might have that installed. Therefore, math mode will still
827 % produce output, but that should be an extremely small amount of
828 % stuff compared to the main input.
831 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
832 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
833 \let\tensf = \nullfont
834 % Similarly for index fonts (mostly for their use in
836 \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
837 \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
838 \let\indsf = \nullfont
840 % Don't complain when characters are missing from the fonts.
841 \tracinglostchars = 0
843 % Don't bother to do space factor calculations.
846 % Don't report underfull hboxes.
849 % Do minimal line-breaking.
850 \pretolerance = 10000
852 % Do not execute instructions in @tex
853 \def\tex{\doignore{tex}}
856 % @set VAR sets the variable VAR to an empty value.
857 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
859 % Since we want to separate VAR from REST-OF-LINE (which might be
860 % empty), we can't just use \parsearg; we have to insert a space of our
861 % own to delimit the rest of the line, and then take it out again if we
862 % didn't need it. Make sure the catcode of space is correct to avoid
863 % losing inside @example, for instance.
865 \def\set{\begingroup\catcode` =10
866 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
868 \def\setxxx#1{\setyyy#1 \endsetyyy}
869 \def\setyyy#1 #2\endsetyyy{%
871 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
872 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
876 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
877 % \next or other control sequences that we've defined might get us into
878 % an infinite loop. Consider `@set foo @cite{bar}'.
879 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
881 % @clear VAR clears (i.e., unsets) the variable VAR.
883 \def\clear{\parsearg\clearxxx}
884 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
886 % @value{foo} gets the text saved in variable foo.
888 \def\value{\begingroup
889 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
892 \expandafter\ifx\csname SET#1\endcsname\relax
893 {\{No value for ``#1''\}}%
895 \csname SET#1\endcsname
899 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
902 \def\ifset{\parsearg\ifsetxxx}
904 \expandafter\ifx\csname SET#1\endcsname\relax
905 \expandafter\ifsetfail
907 \expandafter\ifsetsucceed
910 \def\ifsetsucceed{\conditionalsucceed{ifset}}
911 \def\ifsetfail{\nestedignore{ifset}}
912 \defineunmatchedend{ifset}
914 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
915 % defined with @set, or has been undefined with @clear.
917 \def\ifclear{\parsearg\ifclearxxx}
919 \expandafter\ifx\csname SET#1\endcsname\relax
920 \expandafter\ifclearsucceed
922 \expandafter\ifclearfail
925 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
926 \def\ifclearfail{\nestedignore{ifclear}}
927 \defineunmatchedend{ifclear}
929 % @iftex always succeeds; we read the text following, through @end
930 % iftex). But `@end iftex' should be valid only after an @iftex.
932 \def\iftex{\conditionalsucceed{iftex}}
933 \defineunmatchedend{iftex}
935 % We can't just want to start a group at @iftex (for example) and end it
936 % at @end iftex, since then @set commands inside the conditional have no
937 % effect (they'd get reverted at the end of the group). So we must
938 % define \Eiftex to redefine itself to be its previous value. (We can't
939 % just define it to fail again with an ``unmatched end'' error, since
940 % the @ifset might be nested.)
942 \def\conditionalsucceed#1{%
944 % Remember the current value of \E#1.
945 \let\nece{prevE#1} = \nece{E#1}%
947 % At the `@end #1', redefine \E#1 to be its previous value.
948 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
953 % We need to expand lots of \csname's, but we don't want to expand the
954 % control sequences after we've constructed them.
956 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
958 % @asis just yields its argument. Used with @table, for example.
962 % @math means output in math mode.
963 % We don't use $'s directly in the definition of \math because control
964 % sequences like \math are expanded when the toc file is written. Then,
965 % we read the toc file back, the $'s will be normal characters (as they
966 % should be, according to the definition of Texinfo). So we must use a
967 % control sequence to switch into and out of math mode.
969 % This isn't quite enough for @math to work properly in indices, but it
970 % seems unlikely it will ever be needed there.
972 \let\implicitmath = $
973 \def\math#1{\implicitmath #1\implicitmath}
975 % @bullet and @minus need the same treatment as @math, just above.
976 \def\bullet{\implicitmath\ptexbullet\implicitmath}
977 \def\minus{\implicitmath-\implicitmath}
979 \def\node{\ENVcheck\parsearg\nodezzz}
980 \def\nodezzz#1{\nodexxx [#1,]}
981 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
985 \def\donoderef{\ifx\lastnode\relax\else
986 \expandafter\expandafter\expandafter\setref{\lastnode}\fi
987 \global\let\lastnode=\relax}
989 \def\unnumbnoderef{\ifx\lastnode\relax\else
990 \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
991 \global\let\lastnode=\relax}
993 \def\appendixnoderef{\ifx\lastnode\relax\else
994 \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
995 \global\let\lastnode=\relax}
997 % @refill is a no-op.
1000 % @setfilename is done at the beginning of every texinfo file.
1001 % So open here the files we need to have open while reading the input.
1002 % This makes it possible to make a .fmt file for texinfo.
1007 \fixbackslash % Turn off hack to swallow `\input texinfo'.
1008 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
1009 \comment % Ignore the actual filename.
1013 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1015 % \def\macro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\macroxxx}
1016 % \def\macroxxx#1#2 \end macro{%
1017 % \expandafter\gdef\macrotemp#1{#2}%
1020 %\def\linemacro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\linemacroxxx}
1021 %\def\linemacroxxx#1#2 \end linemacro{%
1022 %\let\parsearg=\relax
1023 %\edef\macrotempx{\csname M\butfirst\expandafter\string\macrotemp\endcsname}%
1024 %\expandafter\xdef\macrotemp{\parsearg\macrotempx}%
1025 %\expandafter\gdef\macrotempx#1{#2}%
1033 % Font-change commands.
1035 % Texinfo supports the sans serif font style, which plain TeX does not.
1036 % So we set up a \sf analogous to plain's \rm, etc.
1038 \def\sf{\fam=\sffam \tensf}
1039 \let\li = \sf % Sometimes we call it \li, not \sf.
1041 % We don't need math for this one.
1044 % Use Computer Modern fonts at \magstephalf (11pt).
1045 \newcount\mainmagstep
1046 \mainmagstep=\magstephalf
1048 % Set the font macro #1 to the font named #2, adding on the
1049 % specified font prefix (normally `cm').
1050 % #3 is the font's design size, #4 is a scale factor
1051 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1053 % Use cm as the default font prefix.
1054 % To specify the font prefix, you must define \fontprefix
1055 % before you read in texinfo.tex.
1056 \ifx\fontprefix\undefined
1059 % Support font families that don't use the same naming scheme as CM.
1061 \def\rmbshape{bx} %where the normal face is bold
1066 \def\ttslshape{sltt}
1077 \let\mainmagstep=\magstep1
1078 \setfont\textrm\rmshape{12}{1000}
1079 \setfont\texttt\ttshape{12}{1000}
1081 \setfont\textrm\rmshape{10}{\mainmagstep}
1082 \setfont\texttt\ttshape{10}{\mainmagstep}
1084 % Instead of cmb10, you many want to use cmbx10.
1085 % cmbx10 is a prettier font on its own, but cmb10
1086 % looks better when embedded in a line with cmr10.
1087 \setfont\textbf\bfshape{10}{\mainmagstep}
1088 \setfont\textit\itshape{10}{\mainmagstep}
1089 \setfont\textsl\slshape{10}{\mainmagstep}
1090 \setfont\textsf\sfshape{10}{\mainmagstep}
1091 \setfont\textsc\scshape{10}{\mainmagstep}
1092 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1093 \font\texti=cmmi10 scaled \mainmagstep
1094 \font\textsy=cmsy10 scaled \mainmagstep
1096 % A few fonts for @defun, etc.
1097 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1098 \setfont\deftt\ttshape{10}{\magstep1}
1099 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1101 % Fonts for indices and small examples (9pt).
1102 % We actually use the slanted font rather than the italic,
1103 % because texinfo normally uses the slanted fonts for that.
1104 % Do not make many font distinctions in general in the index, since they
1105 % aren't very useful.
1106 \setfont\ninett\ttshape{9}{1000}
1107 \setfont\indrm\rmshape{9}{1000}
1108 \setfont\indit\slshape{9}{1000}
1111 \let\indttsl=\ninett
1114 \setfont\indsc\scshape{10}{900}
1118 % Chapter (and unnumbered) fonts (17.28pt).
1119 \setfont\chaprm\rmbshape{12}{\magstep2}
1120 \setfont\chapit\itbshape{10}{\magstep3}
1121 \setfont\chapsl\slbshape{10}{\magstep3}
1122 \setfont\chaptt\ttbshape{12}{\magstep2}
1123 \setfont\chapttsl\ttslshape{10}{\magstep3}
1124 \setfont\chapsf\sfbshape{12}{\magstep2}
1126 \setfont\chapsc\scbshape{10}{\magstep3}
1127 \font\chapi=cmmi12 scaled \magstep2
1128 \font\chapsy=cmsy10 scaled \magstep3
1130 % Section fonts (14.4pt).
1131 \setfont\secrm\rmbshape{12}{\magstep1}
1132 \setfont\secit\itbshape{10}{\magstep2}
1133 \setfont\secsl\slbshape{10}{\magstep2}
1134 \setfont\sectt\ttbshape{12}{\magstep1}
1135 \setfont\secttsl\ttslshape{10}{\magstep2}
1136 \setfont\secsf\sfbshape{12}{\magstep1}
1138 \setfont\secsc\scbshape{10}{\magstep2}
1139 \font\seci=cmmi12 scaled \magstep1
1140 \font\secsy=cmsy10 scaled \magstep2
1142 % \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
1143 % \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
1144 % \setfont\ssecsl\slshape{10}{\magstep1}
1145 % \setfont\ssectt\ttshape{10}{\magstep1}
1146 % \setfont\ssecsf\sfshape{10}{\magstep1}
1148 %\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
1149 %\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
1150 %\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
1151 %\setfont\ssectt\ttshape{10}{1315}
1152 %\setfont\ssecsf\sfshape{10}{1315}
1154 %\let\ssecbf=\ssecrm
1156 % Subsection fonts (13.15pt).
1157 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1158 \setfont\ssecit\itbshape{10}{1315}
1159 \setfont\ssecsl\slbshape{10}{1315}
1160 \setfont\ssectt\ttbshape{12}{\magstephalf}
1161 \setfont\ssecttsl\ttslshape{10}{\magstep1}
1162 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1164 \setfont\ssecsc\scbshape{10}{\magstep1}
1165 \font\sseci=cmmi12 scaled \magstephalf
1166 \font\ssecsy=cmsy10 scaled \magstep1
1167 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1168 % but that is not a standard magnification.
1170 % Fonts for title page:
1171 \setfont\titlerm\rmbshape{12}{\magstep3}
1172 \let\authorrm = \secrm
1174 % In order for the font changes to affect most math symbols and letters,
1175 % we have to define the \textfont of the standard families. Since
1176 % texinfo doesn't allow for producing subscripts and superscripts, we
1177 % don't bother to reset \scriptfont and \scriptscriptfont (which would
1178 % also require loading a lot more fonts).
1180 \def\resetmathfonts{%
1181 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1182 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1183 \textfont\ttfam = \tentt \textfont\sffam = \tensf
1187 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1188 % of just \STYLE. We do this so that font changes will continue to work
1189 % in math mode, where it is the current \fam that is relevant in most
1190 % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
1191 % \tenbf}, for example. By redefining \tenbf, we obviate the need to
1192 % redefine \bf itself.
1194 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1195 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1196 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1199 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1200 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1201 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1202 \resetmathfonts \setleading{19pt}}
1204 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1205 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1206 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1207 \resetmathfonts \setleading{16pt}}
1209 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1210 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1211 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1212 \resetmathfonts \setleading{15pt}}
1213 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1215 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
1216 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
1217 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
1218 \resetmathfonts \setleading{12pt}}
1220 % Set up the default fonts, so we can use them for creating boxes.
1224 % Count depth in font-changes, for error checks
1225 \newcount\fontdepth \fontdepth=0
1227 % Fonts for short table of contents.
1228 \setfont\shortcontrm\rmshape{12}{1000}
1229 \setfont\shortcontbf\bxshape{12}{1000}
1230 \setfont\shortcontsl\slshape{12}{1000}
1232 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1233 %% serif) and @ii for TeX italic
1235 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1236 % unless the following character is such as not to need one.
1237 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1238 \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
1241 \let\var=\smartitalic
1242 \let\dfn=\smartitalic
1243 \let\emph=\smartitalic
1244 \let\cite=\smartitalic
1249 % We can't just use \exhyphenpenalty, because that only has effect at
1250 % the end of a paragraph. Restore normal hyphenation at the end of the
1251 % group within which \nohyphenation is presumably called.
1253 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1254 \def\restorehyphenation{\hyphenchar\font = `- }
1257 {\tt \rawbackslash \frenchspacing #1}%
1261 \def\samp #1{`\tclose{#1}'\null}
1262 \setfont\smallrm\rmshape{8}{1000}
1264 \def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
1265 \raise0.4pt\hbox{$\langle$}\kern-.08em\vtop{%
1266 \vbox{\hrule\kern-0.4pt
1267 \hbox{\raise0.4pt\hbox{\vphantom{$\langle$}}#1}}%
1269 \kern-.06em\raise0.4pt\hbox{$\rangle$}}}}
1270 % The old definition, with no lozenge:
1271 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1272 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1276 % @code is a modification of @t,
1277 % which makes spaces the same size as normal in the surrounding text.
1280 % Change normal interword space to be same as for the current font.
1281 \spaceskip = \fontdimen2\font
1283 % Switch to typewriter.
1286 % But `\ ' produces the large typewriter interword space.
1287 \def\ {{\spaceskip = 0pt{} }}%
1289 % Turn off hyphenation.
1299 % We *must* turn on hyphenation at `-' and `_' in \code.
1300 % Otherwise, it is too hard to avoid overfull hboxes
1301 % in the Emacs manual, the Library manual, etc.
1303 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1304 % both hyphenation at - and hyphenation within words.
1305 % We must therefore turn them both off (\tclose does that)
1306 % and arrange explicitly to hyphenate at a dash.
1312 \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
1313 % The following is used by \doprintindex to insure that long function names
1314 % wrap around. It is necessary for - and _ to be active before the index is
1315 % read from the file, as \entry parses the arguments long before \code is
1316 % ever called. -- mycroft
1317 % _ is always active; and it shouldn't be \let = to an _ that is a
1318 % subscript character anyway. Then, @cindex @samp{_} (for example)
1320 \global\def\indexbreaks{%
1321 \catcode`\-=\active \let-\realdash
1326 \def\codedash{-\discretionary{}{}{}}
1327 \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
1328 \def\codex #1{\tclose{#1}\endgroup}
1330 %\let\exp=\tclose %Was temporary
1332 % @kbd is like @code, except that if the argument is just one @key command,
1333 % then @kbd has no effect.
1336 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1337 \ifx\one\xkey\ifx\threex\three \key{#2}%
1338 \else{\tclose{\ttsl\look}}\fi
1339 \else{\tclose{\ttsl\look}}\fi}
1341 % @url, @uref, @email. Quotes do not seem necessary.
1342 \let\url=\code % perhaps include a hypertex \special eventually
1344 % rms does not like the angle brackets --karl, 17may97.
1345 %\def\email#1{$\langle${\tt #1}$\rangle$}
1348 % Check if we are currently using a typewriter font. Since all the
1349 % Computer Modern typewriter fonts have zero interword stretch (and
1350 % shrink), and it is reasonable to expect all typewriter fonts to have
1351 % this property, we can check that font parameter.
1353 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1355 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1356 % argument is to make the input look right: @dmn{pt} instead of
1359 \def\dmn#1{\thinspace #1}
1361 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1363 % @l was never documented to mean ``switch to the Lisp font'',
1364 % and it is not used as such in any manual I can find. We need it for
1365 % Polish suppressed-l. --karl, 22sep96.
1366 %\def\l#1{{\li #1}\null}
1368 \def\r#1{{\rm #1}} % roman font
1369 % Use of \lowercase was suggested.
1370 \def\sc#1{{\smallcaps#1}} % smallcaps font
1371 \def\ii#1{{\it #1}} % italic font
1373 % @pounds{} is a sterling sign.
1374 \def\pounds{{\it\$}}
1377 \message{page headings,}
1379 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1380 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1382 % First the title page. Must do @settitle before @titlepage.
1383 \def\titlefont#1{{\titlerm #1}}
1386 \newif\iffinishedtitlepage
1388 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1389 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1390 \endgroup\page\hbox{}\page}
1392 \def\titlepage{\begingroup \parindent=0pt \textfonts
1393 \let\subtitlerm=\tenrm
1394 % I deinstalled the following change because \cmr12 is undefined.
1395 % This change was not in the ChangeLog anyway. --rms.
1396 % \let\subtitlerm=\cmr12
1397 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1399 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1401 % Leave some space at the very top of the page.
1402 \vglue\titlepagetopglue
1404 % Now you can print the title using @title.
1405 \def\title{\parsearg\titlezzz}%
1406 \def\titlezzz##1{\leftline{\titlefont{##1}}
1407 % print a rule at the page bottom also.
1408 \finishedtitlepagefalse
1409 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1410 % No rule at page bottom unless we print one at the top with @title.
1411 \finishedtitlepagetrue
1413 % Now you can put text using @subtitle.
1414 \def\subtitle{\parsearg\subtitlezzz}%
1415 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1417 % @author should come last, but may come many times.
1418 \def\author{\parsearg\authorzzz}%
1419 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1420 {\authorfont \leftline{##1}}}%
1422 % Most title ``pages'' are actually two pages long, with space
1423 % at the top of the second. We don't want the ragged left on the second.
1424 \let\oldpage = \page
1426 \iffinishedtitlepage\else
1430 \let\page = \oldpage
1432 % \def\page{\oldpage \hbox{}}
1436 \iffinishedtitlepage\else
1439 % It is important to do the page break before ending the group,
1440 % because the headline and footline are only empty inside the group.
1441 % If we use the new definition of \page, we always get a blank page
1442 % after the title page, which we certainly don't want.
1448 \def\finishtitlepage{%
1449 \vskip4pt \hrule height 2pt width \hsize
1450 \vskip\titlepagebottomglue
1451 \finishedtitlepagetrue
1454 %%% Set up page headings and footings.
1456 \let\thispage=\folio
1458 \newtoks \evenheadline % Token sequence for heading line of even pages
1459 \newtoks \oddheadline % Token sequence for heading line of odd pages
1460 \newtoks \evenfootline % Token sequence for footing line of even pages
1461 \newtoks \oddfootline % Token sequence for footing line of odd pages
1463 % Now make Tex use those variables
1464 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1465 \else \the\evenheadline \fi}}
1466 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1467 \else \the\evenfootline \fi}\HEADINGShook}
1468 \let\HEADINGShook=\relax
1470 % Commands to set those variables.
1471 % For example, this is what @headings on does
1472 % @evenheading @thistitle|@thispage|@thischapter
1473 % @oddheading @thischapter|@thispage|@thistitle
1474 % @evenfooting @thisfile||
1475 % @oddfooting ||@thisfile
1477 \def\evenheading{\parsearg\evenheadingxxx}
1478 \def\oddheading{\parsearg\oddheadingxxx}
1479 \def\everyheading{\parsearg\everyheadingxxx}
1481 \def\evenfooting{\parsearg\evenfootingxxx}
1482 \def\oddfooting{\parsearg\oddfootingxxx}
1483 \def\everyfooting{\parsearg\everyfootingxxx}
1487 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1488 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1489 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1491 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1492 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1493 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1495 \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
1496 \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
1497 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
1498 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1500 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1501 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1502 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1504 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1505 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1506 \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1508 \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
1509 \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
1510 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
1511 \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1513 }% unbind the catcode of @.
1515 % @headings double turns headings on for double-sided printing.
1516 % @headings single turns headings on for single-sided printing.
1517 % @headings off turns them off.
1518 % @headings on same as @headings double, retained for compatibility.
1519 % @headings after turns on double-sided headings after this page.
1520 % @headings doubleafter turns on double-sided headings after this page.
1521 % @headings singleafter turns on single-sided headings after this page.
1522 % By default, they are off at the start of a document,
1523 % and turned `on' after @end titlepage.
1525 \def\headings #1 {\csname HEADINGS#1\endcsname}
1528 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1529 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1531 % When we turn headings on, set the page number to 1.
1532 % For double-sided printing, put current file name in lower left corner,
1533 % chapter name on inside top of right hand pages, document
1534 % title on inside top of left hand pages, and page numbers on outside top
1535 % edge of all pages.
1536 \def\HEADINGSdouble{
1538 \global\evenfootline={\hfil}
1539 \global\oddfootline={\hfil}
1540 \global\evenheadline={\line{\folio\hfil\thistitle}}
1541 \global\oddheadline={\line{\thischapter\hfil\folio}}
1542 \global\let\contentsalignmacro = \chapoddpage
1544 \let\contentsalignmacro = \chappager
1546 % For single-sided printing, chapter title goes across top left of page,
1547 % page number on top right.
1548 \def\HEADINGSsingle{
1550 \global\evenfootline={\hfil}
1551 \global\oddfootline={\hfil}
1552 \global\evenheadline={\line{\thischapter\hfil\folio}}
1553 \global\oddheadline={\line{\thischapter\hfil\folio}}
1554 \global\let\contentsalignmacro = \chappager
1556 \def\HEADINGSon{\HEADINGSdouble}
1558 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1559 \let\HEADINGSdoubleafter=\HEADINGSafter
1560 \def\HEADINGSdoublex{%
1561 \global\evenfootline={\hfil}
1562 \global\oddfootline={\hfil}
1563 \global\evenheadline={\line{\folio\hfil\thistitle}}
1564 \global\oddheadline={\line{\thischapter\hfil\folio}}
1565 \global\let\contentsalignmacro = \chapoddpage
1568 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1569 \def\HEADINGSsinglex{%
1570 \global\evenfootline={\hfil}
1571 \global\oddfootline={\hfil}
1572 \global\evenheadline={\line{\thischapter\hfil\folio}}
1573 \global\oddheadline={\line{\thischapter\hfil\folio}}
1574 \global\let\contentsalignmacro = \chappager
1577 % Subroutines used in generating headings
1578 % Produces Day Month Year style of output.
1579 \def\today{\number\day\space
1581 January\or February\or March\or April\or May\or June\or
1582 July\or August\or September\or October\or November\or December\fi
1585 % Use this if you want the Month Day, Year style of output.
1586 %\def\today{\ifcase\month\or
1587 %January\or February\or March\or April\or May\or June\or
1588 %July\or August\or September\or October\or November\or December\fi
1589 %\space\number\day, \number\year}
1591 % @settitle line... specifies the title of the document, for headings
1592 % It generates no output of its own
1594 \def\thistitle{No Title}
1595 \def\settitle{\parsearg\settitlezzz}
1596 \def\settitlezzz #1{\gdef\thistitle{#1}}
1601 % @tabs -- simple alignment
1603 % These don't work. For one thing, \+ is defined as outer.
1604 % So these macros cannot even be defined.
1606 %\def\tabs{\parsearg\tabszzz}
1607 %\def\tabszzz #1{\settabs\+#1\cr}
1608 %\def\tabline{\parsearg\tablinezzz}
1609 %\def\tablinezzz #1{\+#1\cr}
1612 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1614 % default indentation of table text
1615 \newdimen\tableindent \tableindent=.8in
1616 % default indentation of @itemize and @enumerate text
1617 \newdimen\itemindent \itemindent=.3in
1618 % margin between end of table item and start of table text.
1619 \newdimen\itemmargin \itemmargin=.1in
1621 % used internally for \itemindent minus \itemmargin
1624 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1626 % They also define \itemindex
1627 % to index the item name in whatever manner is desired (perhaps none).
1629 \newif\ifitemxneedsnegativevskip
1631 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1633 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1634 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1636 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1637 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1639 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1640 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1642 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1645 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1648 \def\itemzzz #1{\begingroup %
1649 \advance\hsize by -\rightskip
1650 \advance\hsize by -\tableindent
1651 \setbox0=\hbox{\itemfont{#1}}%
1653 \nobreak % This prevents a break before @itemx.
1655 % Be sure we are not still in the middle of a paragraph.
1660 % If the item text does not fit in the space we have, put it on a line
1661 % by itself, and do not allow a page break either before or after that
1662 % line. We do not start a paragraph here because then if the next
1663 % command is, e.g., @kindex, the whatsit would get put into the
1664 % horizontal list on a line by itself, resulting in extra blank space.
1665 \ifdim \wd0>\itemmax
1667 % Make this a paragraph so we get the \parskip glue and wrapping,
1668 % but leave it ragged-right.
1670 \advance\leftskip by-\tableindent
1671 \advance\hsize by\tableindent
1672 \advance\rightskip by0pt plus1fil
1673 \leavevmode\unhbox0\par
1676 % We're going to be starting a paragraph, but we don't want the
1677 % \parskip glue -- logically it's part of the @item we just started.
1678 \nobreak \vskip-\parskip
1680 % Stop a page break at the \parskip glue coming up. Unfortunately
1681 % we can't prevent a possible page break at the following
1682 % \baselineskip glue.
1685 \itemxneedsnegativevskipfalse
1687 % The item text fits into the space. Start a paragraph, so that the
1688 % following text (if any) will end up on the same line. Since that
1689 % text will be indented by \tableindent, we make the item text be in
1692 \rlap{\hskip -\tableindent\box0}\ignorespaces%
1694 \itemxneedsnegativevskiptrue%
1698 \def\item{\errmessage{@item while not in a table}}
1699 \def\itemx{\errmessage{@itemx while not in a table}}
1700 \def\kitem{\errmessage{@kitem while not in a table}}
1701 \def\kitemx{\errmessage{@kitemx while not in a table}}
1702 \def\xitem{\errmessage{@xitem while not in a table}}
1703 \def\xitemx{\errmessage{@xitemx while not in a table}}
1705 %% Contains a kludge to get @end[description] to work
1706 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1708 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1709 {\obeylines\obeyspaces%
1710 \gdef\tablex #1^^M{%
1711 \tabley\dontindex#1 \endtabley}}
1713 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1714 {\obeylines\obeyspaces%
1715 \gdef\ftablex #1^^M{%
1716 \tabley\fnitemindex#1 \endtabley
1717 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1718 \let\Etable=\relax}}
1720 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1721 {\obeylines\obeyspaces%
1722 \gdef\vtablex #1^^M{%
1723 \tabley\vritemindex#1 \endtabley
1724 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1725 \let\Etable=\relax}}
1728 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1729 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1732 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1733 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1735 \def\tablez #1#2#3#4#5#6{%
1738 \def\Edescription{\Etable}% Necessary kludge.
1740 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1741 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1742 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1744 \itemmax=\tableindent %
1745 \advance \itemmax by -\itemmargin %
1746 \advance \leftskip by \tableindent %
1747 \exdentamount=\tableindent
1749 \parskip = \smallskipamount
1750 \ifdim \parskip=0pt \parskip=2pt \fi%
1751 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1752 \let\item = \internalBitem %
1753 \let\itemx = \internalBitemx %
1754 \let\kitem = \internalBkitem %
1755 \let\kitemx = \internalBkitemx %
1756 \let\xitem = \internalBxitem %
1757 \let\xitemx = \internalBxitemx %
1760 % This is the counter used by @enumerate, which is really @itemize
1764 \def\itemize{\parsearg\itemizezzz}
1766 \def\itemizezzz #1{%
1767 \begingroup % ended by the @end itemsize
1768 \itemizey {#1}{\Eitemize}
1771 \def\itemizey #1#2{%
1773 \itemmax=\itemindent %
1774 \advance \itemmax by -\itemmargin %
1775 \advance \leftskip by \itemindent %
1776 \exdentamount=\itemindent
1778 \parskip = \smallskipamount %
1779 \ifdim \parskip=0pt \parskip=2pt \fi%
1780 \def#2{\endgraf\afterenvbreak\endgroup}%
1781 \def\itemcontents{#1}%
1782 \let\item=\itemizeitem}
1784 % Set sfcode to normal for the chars that usually have another value.
1785 % These are `.?!:;,'
1786 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1787 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1789 % \splitoff TOKENS\endmark defines \first to be the first token in
1790 % TOKENS, and \rest to be the remainder.
1792 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1794 % Allow an optional argument of an uppercase letter, lowercase letter,
1795 % or number, to specify the first label in the enumerated list. No
1796 % argument is the same as `1'.
1798 \def\enumerate{\parsearg\enumeratezzz}
1799 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1800 \def\enumeratey #1 #2\endenumeratey{%
1801 \begingroup % ended by the @end enumerate
1803 % If we were given no argument, pretend we were given `1'.
1805 \ifx\thearg\empty \def\thearg{1}\fi
1807 % Detect if the argument is a single token. If so, it might be a
1808 % letter. Otherwise, the only valid thing it can be is a number.
1809 % (We will always have one token, because of the test we just made.
1810 % This is a good thing, since \splitoff doesn't work given nothing at
1811 % all -- the first parameter is undelimited.)
1812 \expandafter\splitoff\thearg\endmark
1814 % Only one token in the argument. It could still be anything.
1815 % A ``lowercase letter'' is one whose \lccode is nonzero.
1816 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1817 % not equal to itself.
1818 % Otherwise, we assume it's a number.
1820 % We need the \relax at the end of the \ifnum lines to stop TeX from
1821 % continuing to look for a <number>.
1823 \ifnum\lccode\expandafter`\thearg=0\relax
1824 \numericenumerate % a number (we hope)
1827 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1828 \lowercaseenumerate % lowercase letter
1830 \uppercaseenumerate % uppercase letter
1834 % Multiple tokens in the argument. We hope it's a number.
1839 % An @enumerate whose labels are integers. The starting integer is
1842 \def\numericenumerate{%
1844 \startenumeration{\the\itemno}%
1847 % The starting (lowercase) letter is in \thearg.
1848 \def\lowercaseenumerate{%
1849 \itemno = \expandafter`\thearg
1851 % Be sure we're not beyond the end of the alphabet.
1853 \errmessage{No more lowercase letters in @enumerate; get a bigger
1860 % The starting (uppercase) letter is in \thearg.
1861 \def\uppercaseenumerate{%
1862 \itemno = \expandafter`\thearg
1864 % Be sure we're not beyond the end of the alphabet.
1866 \errmessage{No more uppercase letters in @enumerate; get a bigger
1873 % Call itemizey, adding a period to the first argument and supplying the
1874 % common last two arguments. Also subtract one from the initial value in
1875 % \itemno, since @item increments \itemno.
1877 \def\startenumeration#1{%
1878 \advance\itemno by -1
1879 \itemizey{#1.}\Eenumerate\flushcr
1882 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
1885 \def\alphaenumerate{\enumerate{a}}
1886 \def\capsenumerate{\enumerate{A}}
1887 \def\Ealphaenumerate{\Eenumerate}
1888 \def\Ecapsenumerate{\Eenumerate}
1890 % Definition of @item while inside @itemize.
1893 \advance\itemno by 1
1894 {\let\par=\endgraf \smallbreak}%
1895 \ifhmode \errmessage{In hmode at itemizeitem}\fi
1896 {\parskip=0in \hskip 0pt
1897 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
1898 \vadjust{\penalty 1200}}%
1901 % @multitable macros
1902 % Amy Hendrickson, 8/18/94, 3/6/96
1904 % @multitable ... @end multitable will make as many columns as desired.
1905 % Contents of each column will wrap at width given in preamble. Width
1906 % can be specified either with sample text given in a template line,
1907 % or in percent of \hsize, the current width of text on page.
1909 % Table can continue over pages but will only break between lines.
1913 % Either define widths of columns in terms of percent of \hsize:
1914 % @multitable @columnfractions .25 .3 .45
1917 % Numbers following @columnfractions are the percent of the total
1918 % current hsize to be used for each column. You may use as many
1919 % columns as desired.
1922 % Or use a template:
1923 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
1925 % using the widest term desired in each column.
1927 % For those who want to use more than one line's worth of words in
1928 % the preamble, break the line within one argument and it
1929 % will parse correctly, i.e.,
1931 % @multitable {Column 1 template} {Column 2 template} {Column 3
1934 % @multitable {Column 1 template} {Column 2 template}
1935 % {Column 3 template}
1937 % Each new table line starts with @item, each subsequent new column
1938 % starts with @tab. Empty columns may be produced by supplying @tab's
1939 % with nothing between them for as many times as empty columns are needed,
1940 % ie, @tab@tab@tab will produce two empty columns.
1942 % @item, @tab, @multitable or @end multitable do not need to be on their
1943 % own lines, but it will not hurt if they are.
1945 % Sample multitable:
1947 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
1948 % @item first col stuff @tab second col stuff @tab third col
1955 % @item first col stuff @tab second col stuff
1956 % @tab Many paragraphs of text may be used in any column.
1958 % They will wrap at the width determined by the template.
1959 % @item@tab@tab This will be in third column.
1962 % Default dimensions may be reset by user.
1963 % @multitableparskip is vertical space between paragraphs in table.
1964 % @multitableparindent is paragraph indent in table.
1965 % @multitablecolmargin is horizontal space to be left between columns.
1966 % @multitablelinespace is space to leave between table items, baseline
1968 % 0pt means it depends on current normal line spacing.
1973 \newskip\multitableparskip
1974 \newskip\multitableparindent
1975 \newdimen\multitablecolspace
1976 \newskip\multitablelinespace
1977 \multitableparskip=0pt
1978 \multitableparindent=6pt
1979 \multitablecolspace=12pt
1980 \multitablelinespace=0pt
1983 % Macros used to set up halign preamble:
1984 \let\endsetuptable\relax
1985 \def\xendsetuptable{\endsetuptable}
1986 \let\columnfractions\relax
1987 \def\xcolumnfractions{\columnfractions}
1990 %% 2/1/96, to allow fractions to be given with more than one digit.
1991 \def\pickupwholefraction#1 {\global\advance\colcount by1 %
1992 \expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
1996 \def\setuptable#1{\def\firstarg{#1}%
1997 \ifx\firstarg\xendsetuptable\let\go\relax%
1999 \ifx\firstarg\xcolumnfractions\global\setpercenttrue%
2002 \let\go\pickupwholefraction % In this case arg of setuptable
2003 % is the decimal point before the
2004 % number given in percent of hsize.
2005 % We don't need this so we don't use it.
2007 \global\advance\colcount by1
2008 \setbox0=\hbox{#1 }% Add a normal word space as a separator;
2009 % typically that is always in the input, anyway.
2010 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2013 \ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
2018 \def\tab{&\hskip1sp\relax} % 2/2/96
2019 % tiny skip here makes sure this column space is
2020 % maintained, even if it is never used.
2024 % @multitable ... @end multitable definitions:
2026 \def\multitable{\parsearg\dotable}
2028 \def\dotable#1{\bgroup
2032 \setmultitablespacing
2033 \parskip=\multitableparskip
2034 \parindent=\multitableparindent
2036 \global\colcount=0\relax%
2037 \def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}%
2038 % To parse everything between @multitable and @item :
2039 \setuptable#1 \endsetuptable
2040 % Need to reset this to 0 after \setuptable.
2041 \global\colcount=0\relax%
2043 % This preamble sets up a generic column definition, which will
2044 % be used as many times as user calls for columns.
2045 % \vtop will set a single line and will also let text wrap and
2046 % continue for many paragraphs if desired.
2047 \halign\bgroup&\global\advance\colcount by 1\relax%
2048 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2049 % In order to keep entries from bumping into each other
2050 % we will add a \leftskip of \multitablecolspace to all columns after
2052 % If a template has been used, we will add \multitablecolspace
2053 % to the width of each template entry.
2054 % If user has set preamble in terms of percent of \hsize
2055 % we will use that dimension as the width of the column, and
2056 % the \leftskip will keep entries from bumping into each other.
2057 % Table will start at left margin and final column will justify at
2063 % If user has <not> set preamble in terms of percent of \hsize
2064 % we will advance \hsize by \multitablecolspace
2065 \advance\hsize by \multitablecolspace
2067 % In either case we will make \leftskip=\multitablecolspace:
2068 \leftskip=\multitablecolspace
2070 % Ignoring space at the beginning and end avoids an occasional spurious
2071 % blank line, when TeX decides to break the line at the space before the
2072 % box from the multistrut, so the strut ends up on a line by itself.
2074 % @multitable @columnfractions .11 .89
2076 % @tab Legal holiday which is valid in major parts of the whole country.
2077 % Is automatically provided with highlighting sequences respectively marking
2079 \noindent\ignorespaces##\unskip\multistrut}\cr
2080 % \everycr will reset column counter, \colcount, at the end of
2081 % each line. Every column entry will cause \colcount to advance by one.
2082 % The table preamble
2083 % looks at the current \colcount to find the correct column width.
2084 \global\everycr{\noalign{%
2085 % \filbreak%% keeps underfull box messages off when table breaks over pages.
2086 % Maybe so, but it also creates really weird page breaks when the table
2087 % breaks over pages Wouldn't \vfil be better? Wait until the problem
2088 % manifests itself, so it can be fixed for real --karl.
2089 \global\colcount=0\relax}}
2092 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2093 % If so, do nothing. If not, give it an appropriate dimension based on
2094 % current baselineskip.
2095 \ifdim\multitablelinespace=0pt
2096 %% strut to put in table in case some entry doesn't have descenders,
2097 %% to keep lines equally spaced
2098 \let\multistrut = \strut
2099 %% Test to see if parskip is larger than space between lines of
2100 %% table. If not, do nothing.
2101 %% If so, set to same dimension as multitablelinespace.
2103 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2105 \ifdim\multitableparskip>\multitablelinespace
2106 \global\multitableparskip=\multitablelinespace
2107 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2108 %% than skip between lines in the table.
2110 \ifdim\multitableparskip=0pt
2111 \global\multitableparskip=\multitablelinespace
2112 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2113 %% than skip between lines in the table.
2118 % Index generation facilities
2120 % Define \newwrite to be identical to plain tex's \newwrite
2121 % except not \outer, so it can be used within \newindex.
2123 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2125 % \newindex {foo} defines an index named foo.
2126 % It automatically defines \fooindex such that
2127 % \fooindex ...rest of line... puts an entry in the index foo.
2128 % It also defines \fooindfile to be the number of the output channel for
2129 % the file that accumulates this index. The file's extension is foo.
2130 % The name of an index should be no more than 2 characters long
2131 % for the sake of vms.
2134 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
2135 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2136 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2137 \noexpand\doindex {#1}}
2140 % @defindex foo == \newindex{foo}
2142 \def\defindex{\parsearg\newindex}
2144 % Define @defcodeindex, like @defindex except put all entries in @code.
2146 \def\newcodeindex #1{
2147 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
2148 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2149 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2150 \noexpand\docodeindex {#1}}
2153 \def\defcodeindex{\parsearg\newcodeindex}
2155 % @synindex foo bar makes index foo feed into index bar.
2156 % Do this instead of @defindex foo if you don't want it as a separate index.
2157 \def\synindex #1 #2 {%
2158 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2159 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2160 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2161 \noexpand\doindex {#2}}%
2164 % @syncodeindex foo bar similar, but put all entries made for index foo
2166 \def\syncodeindex #1 #2 {%
2167 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2168 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2169 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2170 \noexpand\docodeindex {#2}}%
2173 % Define \doindex, the driver for all \fooindex macros.
2174 % Argument #1 is generated by the calling \fooindex macro,
2175 % and it is "foo", the name of the index.
2177 % \doindex just uses \parsearg; it calls \doind for the actual work.
2178 % This is because \doind is more useful to call from other macros.
2180 % There is also \dosubind {index}{topic}{subtopic}
2181 % which makes an entry in a two-level index such as the operation index.
2183 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
2184 \def\singleindexer #1{\doind{\indexname}{#1}}
2186 % like the previous two, but they put @code around the argument.
2187 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2188 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2191 % Take care of the plain tex accent commands.
2192 \def\"{\realbackslash "}%
2193 \def\`{\realbackslash `}%
2194 \def\'{\realbackslash '}%
2195 \def\^{\realbackslash ^}%
2196 \def\~{\realbackslash ~}%
2197 \def\={\realbackslash =}%
2198 \def\b{\realbackslash b}%
2199 \def\c{\realbackslash c}%
2200 \def\d{\realbackslash d}%
2201 \def\u{\realbackslash u}%
2202 \def\v{\realbackslash v}%
2203 \def\H{\realbackslash H}%
2204 % Take care of the plain tex special European modified letters.
2205 \def\oe{\realbackslash oe}%
2206 \def\ae{\realbackslash ae}%
2207 \def\aa{\realbackslash aa}%
2208 \def\OE{\realbackslash OE}%
2209 \def\AE{\realbackslash AE}%
2210 \def\AA{\realbackslash AA}%
2211 \def\o{\realbackslash o}%
2212 \def\O{\realbackslash O}%
2213 \def\l{\realbackslash l}%
2214 \def\L{\realbackslash L}%
2215 \def\ss{\realbackslash ss}%
2216 % Take care of texinfo commands likely to appear in an index entry.
2217 % (Must be a way to avoid doing expansion at all, and thus not have to
2218 % laboriously list every single command here.)
2219 \def\@{@}% will be @@ when we switch to @ as escape char.
2220 %\let\{ = \lbracecmd
2221 %\let\} = \rbracecmd
2222 \def\_{{\realbackslash _}}%
2223 \def\w{\realbackslash w }%
2224 \def\bf{\realbackslash bf }%
2225 %\def\rm{\realbackslash rm }%
2226 \def\sl{\realbackslash sl }%
2227 \def\sf{\realbackslash sf}%
2228 \def\tt{\realbackslash tt}%
2229 \def\gtr{\realbackslash gtr}%
2230 \def\less{\realbackslash less}%
2231 \def\hat{\realbackslash hat}%
2232 %\def\char{\realbackslash char}%
2233 \def\TeX{\realbackslash TeX}%
2234 \def\dots{\realbackslash dots }%
2235 \def\copyright{\realbackslash copyright }%
2236 \def\tclose##1{\realbackslash tclose {##1}}%
2237 \def\code##1{\realbackslash code {##1}}%
2238 \def\dotless##1{\realbackslash dotless {##1}}%
2239 \def\samp##1{\realbackslash samp {##1}}%
2240 \def\,##1{\realbackslash ,{##1}}%
2241 \def\t##1{\realbackslash t {##1}}%
2242 \def\r##1{\realbackslash r {##1}}%
2243 \def\i##1{\realbackslash i {##1}}%
2244 \def\b##1{\realbackslash b {##1}}%
2245 \def\sc##1{\realbackslash sc {##1}}%
2246 \def\cite##1{\realbackslash cite {##1}}%
2247 \def\key##1{\realbackslash key {##1}}%
2248 \def\file##1{\realbackslash file {##1}}%
2249 \def\var##1{\realbackslash var {##1}}%
2250 \def\kbd##1{\realbackslash kbd {##1}}%
2251 \def\dfn##1{\realbackslash dfn {##1}}%
2252 \def\emph##1{\realbackslash emph {##1}}%
2256 % If an index command is used in an @example environment, any spaces
2257 % therein should become regular spaces in the raw index file, not the
2258 % expansion of \tie (\\leavevmode \penalty \@M \ ).
2260 \gdef\unsepspaces{\obeyspaces\let =\space}}
2262 % \indexnofonts no-ops all font-change commands.
2263 % This is used when outputting the strings to sort the index by.
2264 \def\indexdummyfont#1{#1}
2265 \def\indexdummytex{TeX}
2266 \def\indexdummydots{...}
2269 % Just ignore accents.
2270 \let\,=\indexdummyfont
2271 \let\"=\indexdummyfont
2272 \let\`=\indexdummyfont
2273 \let\'=\indexdummyfont
2274 \let\^=\indexdummyfont
2275 \let\~=\indexdummyfont
2276 \let\==\indexdummyfont
2277 \let\b=\indexdummyfont
2278 \let\c=\indexdummyfont
2279 \let\d=\indexdummyfont
2280 \let\u=\indexdummyfont
2281 \let\v=\indexdummyfont
2282 \let\H=\indexdummyfont
2283 \let\dotless=\indexdummyfont
2284 % Take care of the plain tex special European modified letters.
2296 \let\w=\indexdummyfont
2297 \let\t=\indexdummyfont
2298 \let\r=\indexdummyfont
2299 \let\i=\indexdummyfont
2300 \let\b=\indexdummyfont
2301 \let\emph=\indexdummyfont
2302 \let\strong=\indexdummyfont
2303 \let\cite=\indexdummyfont
2304 \let\sc=\indexdummyfont
2305 %Don't no-op \tt, since it isn't a user-level command
2306 % and is used in the definitions of the active chars like <, >, |...
2307 %\let\tt=\indexdummyfont
2308 \let\tclose=\indexdummyfont
2309 \let\code=\indexdummyfont
2310 \let\file=\indexdummyfont
2311 \let\samp=\indexdummyfont
2312 \let\kbd=\indexdummyfont
2313 \let\key=\indexdummyfont
2314 \let\var=\indexdummyfont
2315 \let\TeX=\indexdummytex
2316 \let\dots=\indexdummydots
2320 % To define \realbackslash, we must make \ not be an escape.
2321 % We must first make another character (@) an escape
2322 % so we do not become unable to do a definition.
2324 {\catcode`\@=0 \catcode`\\=\other
2325 @gdef@realbackslash{\}}
2327 \let\indexbackslash=0 %overridden during \printindex.
2329 \let\SETmarginindex=\relax %initialize!
2330 % workhorse for all \fooindexes
2331 % #1 is name of index, #2 is stuff to put there
2333 % Put the index entry in the margin if desired.
2334 \ifx\SETmarginindex\relax\else
2335 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2338 \count255=\lastpenalty
2340 \indexdummies % Must do this here, since \bf, etc expand at this stage
2343 \let\folio=0% We will expand all macros now EXCEPT \folio.
2344 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2345 % so it will be output as is; and it will print as backslash.
2347 % First process the index-string with all font commands turned off
2348 % to get the string to sort by.
2349 {\indexnofonts \xdef\indexsorttmp{#2}}%
2351 % Now produce the complete index entry, with both the sort key and the
2352 % original text, including any font commands.
2355 \write\csname#1indfile\endcsname{%
2356 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
2365 \def\dosubind #1#2#3{%
2366 {\count10=\lastpenalty %
2367 {\indexdummies % Must do this here, since \bf, etc expand at this stage
2370 \def\rawbackslashxx{\indexbackslash}%
2372 % Now process the index-string once, with all font commands turned off,
2373 % to get the string to sort the index by.
2377 % Now produce the complete index entry. We process the index-string again,
2378 % this time with font commands expanded, to get what to print in the index.
2380 \write \csname#1indfile\endcsname{%
2381 \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
2385 % The index entry written in the file actually looks like
2386 % \entry {sortstring}{page}{topic}
2388 % \entry {sortstring}{page}{topic}{subtopic}
2389 % The texindex program reads in these files and writes files
2390 % containing these kinds of lines:
2392 % before the first topic whose initial is c
2393 % \entry {topic}{pagelist}
2394 % for a topic that is used without subtopics
2396 % for the beginning of a topic that is used with subtopics
2397 % \secondary {subtopic}{pagelist}
2398 % for each subtopic.
2400 % Define the user-accessible indexing commands
2401 % @findex, @vindex, @kindex, @cindex.
2403 \def\findex {\fnindex}
2404 \def\kindex {\kyindex}
2405 \def\cindex {\cpindex}
2406 \def\vindex {\vrindex}
2407 \def\tindex {\tpindex}
2408 \def\pindex {\pgindex}
2410 \def\cindexsub {\begingroup\obeylines\cindexsub}
2412 \gdef\cindexsub "#1" #2^^M{\endgroup %
2413 \dosubind{cp}{#2}{#1}}}
2415 % Define the macros used in formatting output of the sorted index material.
2417 % @printindex causes a particular index (the ??s file) to get printed.
2418 % It does not print any chapter heading (usually an @unnumbered).
2420 \def\printindex{\parsearg\doprintindex}
2421 \def\doprintindex#1{\begingroup
2422 \dobreak \chapheadingskip{10000}%
2428 % See if the index file exists and is nonempty.
2429 \openin 1 \jobname.#1s
2431 % \enddoublecolumns gets confused if there is no text in the index,
2432 % and it loses the chapter title and the aux file entries for the
2433 % index. The easiest way to prevent this problem is to make sure
2434 % there is some text.
2435 (Index is nonexistent)
2438 % If the index file exists but is empty, then \openin leaves \ifeof
2439 % false. We have to make TeX try to read something from the file, so
2440 % it can discover if there is anything in it.
2445 % Index files are almost Texinfo source, but we use \ as the escape
2446 % character. It would be better to use @, but that's too big a change
2447 % to make right now.
2448 \def\indexbackslash{\rawbackslashxx}%
2460 % These macros are used by the sorted index file itself.
2461 % Change them to control the appearance of the index.
2463 % Same as \bigskipamount except no shrink.
2464 % \balancecolumns gets confused if there is any shrink.
2465 \newskip\initialskipamount \initialskipamount 12pt plus4pt
2468 {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2469 \ifdim\lastskip<\initialskipamount
2470 \removelastskip \penalty-200 \vskip \initialskipamount\fi
2471 \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
2473 % This typesets a paragraph consisting of #1, dot leaders, and then #2
2474 % flush to the right margin. It is used for index and table of contents
2475 % entries. The paragraph is indented by \leftskip.
2477 \def\entry #1#2{\begingroup
2479 % Start a new paragraph if necessary, so our assignments below can't
2480 % affect previous text.
2483 % Do not fill out the last line with white space.
2486 % No extra space above this paragraph.
2489 % Do not prefer a separate line ending with a hyphen to fewer lines.
2490 \finalhyphendemerits = 0
2492 % \hangindent is only relevant when the entry text and page number
2493 % don't both fit on one line. In that case, bob suggests starting the
2494 % dots pretty far over on the line. Unfortunately, a large
2495 % indentation looks wrong when the entry text itself is broken across
2496 % lines. So we use a small indentation and put up with long leaders.
2498 % \hangafter is reset to 1 (which is the value we want) at the start
2499 % of each paragraph, so we need not do anything with that.
2502 % When the entry text needs to be broken, just fill out the first line
2504 \rightskip = 0pt plus1fil
2506 % Start a ``paragraph'' for the index entry so the line breaking
2507 % parameters we've set above will have an effect.
2510 % Insert the text of the index entry. TeX will do line-breaking on it.
2512 % The following is kludged to not output a line of dots in the index if
2513 % there are no page numbers. The next person who breaks this will be
2514 % cursed by a Unix daemon.
2517 \edef\tempc{\tempa}%
2518 \edef\tempd{\tempb}%
2519 \ifx\tempc\tempd\ \else%
2521 % If we must, put the page number on a line of its own, and fill out
2522 % this line with blank space. (The \hfil is overwhelmed with the
2523 % fill leaders glue in \indexdotfill if the page number does fit.)
2525 \null\nobreak\indexdotfill % Have leaders before the page number.
2527 % The `\ ' here is removed by the implicit \unskip that TeX does as
2528 % part of (the primitive) \par. Without it, a spurious underfull
2530 \ #2% The page number ends the paragraph.
2535 % Like \dotfill except takes at least 1 em.
2536 \def\indexdotfill{\cleaders
2537 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
2539 \def\primary #1{\line{#1\hfil}}
2541 \newskip\secondaryindent \secondaryindent=0.5cm
2543 \def\secondary #1#2{
2544 {\parfillskip=0in \parskip=0in
2545 \hangindent =1in \hangafter=1
2546 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
2549 % Define two-column mode, which we use to typeset indexes.
2550 % Adapted from the TeXbook, page 416, which is to say,
2551 % the manmac.tex format used to print the TeXbook itself.
2555 \newdimen\doublecolumnhsize
2557 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
2558 % Grab any single-column material above us.
2559 \output = {\global\setbox\partialpage = \vbox{%
2561 % Here is a possibility not foreseen in manmac: if we accumulate a
2562 % whole lot of material, we might end up calling this \output
2563 % routine twice in a row (see the doublecol-lose test, which is
2564 % essentially a couple of indexes with @setchapternewpage off). In
2565 % that case, we must prevent the second \partialpage from
2566 % simply overwriting the first, causing us to lose the page.
2567 % This will preserve it until a real output routine can ship it
2568 % out. Generally, \partialpage will be empty when this runs and
2569 % this will be a no-op.
2572 % Unvbox the main output page.
2574 \kern-\topskip \kern\baselineskip
2578 % Use the double-column output routine for subsequent pages.
2579 \output = {\doublecolumnout}%
2581 % Change the page size parameters. We could do this once outside this
2582 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
2583 % format, but then we repeat the same computation. Repeating a couple
2584 % of assignments once per index is clearly meaningless for the
2585 % execution time, so we may as well do it in one place.
2587 % First we halve the line length, less a little for the gutter between
2588 % the columns. We compute the gutter based on the line length, so it
2589 % changes automatically with the paper format. The magic constant
2590 % below is chosen so that the gutter has the same value (well, +-<1pt)
2591 % as it did when we hard-coded it.
2593 % We put the result in a separate register, \doublecolumhsize, so we
2594 % can restore it in \pagesofar, after \hsize itself has (potentially)
2597 \doublecolumnhsize = \hsize
2598 \advance\doublecolumnhsize by -.04154\hsize
2599 \divide\doublecolumnhsize by 2
2600 \hsize = \doublecolumnhsize
2602 % Double the \vsize as well. (We don't need a separate register here,
2603 % since nobody clobbers \vsize.)
2606 \def\doublecolumnout{%
2607 \splittopskip=\topskip \splitmaxdepth=\maxdepth
2608 % Get the available space for the double columns -- the normal
2609 % (undoubled) page height minus any material left over from the
2611 \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
2612 % box0 will be the left-hand column, box2 the right.
2613 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
2614 \onepageout\pagesofar
2616 \penalty\outputpenalty
2619 % Re-output the contents of the output page -- any previous material,
2620 % followed by the two boxes we just split.
2622 \hsize = \doublecolumnhsize
2623 \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}%
2625 \def\enddoublecolumns{%
2626 \output = {\balancecolumns}\eject % split what we have
2627 \endgroup % started in \begindoublecolumns
2629 % Back to normal single-column typesetting, but take account of the
2630 % fact that we just accumulated some stuff on the output page.
2633 \def\balancecolumns{%
2634 % Called at the end of the double column material.
2635 \setbox0 = \vbox{\unvbox255}%
2637 \advance\dimen@ by \topskip
2638 \advance\dimen@ by-\baselineskip
2640 \splittopskip = \topskip
2641 % Loop until we get a decent breakpoint.
2642 {\vbadness=10000 \loop
2643 \global\setbox3=\copy0
2644 \global\setbox1=\vsplit3 to\dimen@
2645 \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt
2647 \setbox0=\vbox to\dimen@{\unvbox1}%
2648 \setbox2=\vbox to\dimen@{\unvbox3}%
2651 \catcode`\@ = \other
2654 \message{sectioning,}
2655 % Define chapters, sections, etc.
2658 \newcount\secno \secno=0
2659 \newcount\subsecno \subsecno=0
2660 \newcount\subsubsecno \subsubsecno=0
2662 % This counter is funny since it counts through charcodes of letters A, B, ...
2663 \newcount\appendixno \appendixno = `\@
2664 \def\appendixletter{\char\the\appendixno}
2666 \newwrite\contentsfile
2667 % This is called from \setfilename.
2668 \def\opencontents{\openout\contentsfile = \jobname.toc }
2670 % Each @chapter defines this as the name of the chapter.
2671 % page headings and footings can use it. @section does likewise
2673 \def\thischapter{} \def\thissection{}
2674 \def\seccheck#1{\ifnum \pageno<0
2675 \errmessage{@#1 not allowed after generating table of contents}%
2678 \def\chapternofonts{%
2679 \let\rawbackslash=\relax
2680 \let\frenchspacing=\relax
2681 \def\result{\realbackslash result}%
2682 \def\equiv{\realbackslash equiv}%
2683 \def\expansion{\realbackslash expansion}%
2684 \def\print{\realbackslash print}%
2685 \def\TeX{\realbackslash TeX}%
2686 \def\dots{\realbackslash dots}%
2687 \def\copyright{\realbackslash copyright}%
2688 \def\tt{\realbackslash tt}%
2689 \def\bf{\realbackslash bf}%
2690 \def\w{\realbackslash w}%
2691 \def\less{\realbackslash less}%
2692 \def\gtr{\realbackslash gtr}%
2693 \def\hat{\realbackslash hat}%
2694 \def\char{\realbackslash char}%
2695 \def\tclose##1{\realbackslash tclose{##1}}%
2696 \def\code##1{\realbackslash code{##1}}%
2697 \def\samp##1{\realbackslash samp{##1}}%
2698 \def\r##1{\realbackslash r{##1}}%
2699 \def\b##1{\realbackslash b{##1}}%
2700 \def\key##1{\realbackslash key{##1}}%
2701 \def\file##1{\realbackslash file{##1}}%
2702 \def\kbd##1{\realbackslash kbd{##1}}%
2703 % These are redefined because @smartitalic wouldn't work inside xdef.
2704 \def\i##1{\realbackslash i{##1}}%
2705 \def\cite##1{\realbackslash cite{##1}}%
2706 \def\var##1{\realbackslash var{##1}}%
2707 \def\emph##1{\realbackslash emph{##1}}%
2708 \def\dfn##1{\realbackslash dfn{##1}}%
2711 \newcount\absseclevel % used to calculate proper heading level
2712 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
2714 % @raisesections: treat @section as chapter, @subsection as section, etc.
2715 \def\raisesections{\global\advance\secbase by -1}
2716 \let\up=\raisesections % original BFox name
2718 % @lowersections: treat @chapter as section, @section as subsection, etc.
2719 \def\lowersections{\global\advance\secbase by 1}
2720 \let\down=\lowersections % original BFox name
2722 % Choose a numbered-heading macro
2723 % #1 is heading level if unmodified by @raisesections or @lowersections
2724 % #2 is text for heading
2725 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2731 \numberedsubseczzz{#2}
2733 \numberedsubsubseczzz{#2}
2735 \ifnum \absseclevel<0
2738 \numberedsubsubseczzz{#2}
2743 % like \numhead, but chooses appendix heading levels
2744 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2748 \appendixsectionzzz{#2}
2750 \appendixsubseczzz{#2}
2752 \appendixsubsubseczzz{#2}
2754 \ifnum \absseclevel<0
2757 \appendixsubsubseczzz{#2}
2762 % like \numhead, but chooses numberless heading levels
2763 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2767 \unnumberedseczzz{#2}
2769 \unnumberedsubseczzz{#2}
2771 \unnumberedsubsubseczzz{#2}
2773 \ifnum \absseclevel<0
2776 \unnumberedsubsubseczzz{#2}
2782 \def\thischaptername{No Chapter Title}
2783 \outer\def\chapter{\parsearg\chapteryyy}
2784 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
2785 \def\chapterzzz #1{\seccheck{chapter}%
2786 \secno=0 \subsecno=0 \subsubsecno=0
2787 \global\advance \chapno by 1 \message{\putwordChapter \the\chapno}%
2788 \chapmacro {#1}{\the\chapno}%
2789 \gdef\thissection{#1}%
2790 \gdef\thischaptername{#1}%
2791 % We don't substitute the actual chapter name into \thischapter
2792 % because we don't want its macros evaluated now.
2793 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
2796 \edef\temp{{\realbackslash chapentry{\the\toks0}{\the\chapno}{\noexpand\folio}}}%
2798 \write \contentsfile \temp %
2800 \global\let\section = \numberedsec
2801 \global\let\subsection = \numberedsubsec
2802 \global\let\subsubsection = \numberedsubsubsec
2805 \outer\def\appendix{\parsearg\appendixyyy}
2806 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
2807 \def\appendixzzz #1{\seccheck{appendix}%
2808 \secno=0 \subsecno=0 \subsubsecno=0
2809 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
2810 \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
2811 \gdef\thissection{#1}%
2812 \gdef\thischaptername{#1}%
2813 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
2816 \edef\temp{{\realbackslash chapentry{\the\toks0}%
2817 {\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
2819 \write \contentsfile \temp %
2821 \global\let\section = \appendixsec
2822 \global\let\subsection = \appendixsubsec
2823 \global\let\subsubsection = \appendixsubsubsec
2826 % @centerchap is like @unnumbered, but the heading is centered.
2827 \outer\def\centerchap{\parsearg\centerchapyyy}
2828 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
2830 \outer\def\top{\parsearg\unnumberedyyy}
2831 \outer\def\unnumbered{\parsearg\unnumberedyyy}
2832 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
2833 \def\unnumberedzzz #1{\seccheck{unnumbered}%
2834 \secno=0 \subsecno=0 \subsubsecno=0
2836 % This used to be simply \message{#1}, but TeX fully expands the
2837 % argument to \message. Therefore, if #1 contained @-commands, TeX
2838 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
2839 % expanded @cite (which turns out to cause errors because \cite is meant
2840 % to be executed, not expanded).
2842 % Anyway, we don't want the fully-expanded definition of @cite to appear
2843 % as a result of the \message, we just want `@cite' itself. We use
2844 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
2845 % simply yielding the contents of the <toks register>.
2846 \toks0 = {#1}\message{(\the\toks0)}%
2848 \unnumbchapmacro {#1}%
2849 \gdef\thischapter{#1}\gdef\thissection{#1}%
2852 \edef\temp{{\realbackslash unnumbchapentry{\the\toks0}{\noexpand\folio}}}%
2854 \write \contentsfile \temp %
2856 \global\let\section = \unnumberedsec
2857 \global\let\subsection = \unnumberedsubsec
2858 \global\let\subsubsection = \unnumberedsubsubsec
2861 \outer\def\numberedsec{\parsearg\secyyy}
2862 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
2863 \def\seczzz #1{\seccheck{section}%
2864 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
2865 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
2868 \edef\temp{{\realbackslash secentry %
2869 {\the\toks0}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
2871 \write \contentsfile \temp %
2876 \outer\def\appendixsection{\parsearg\appendixsecyyy}
2877 \outer\def\appendixsec{\parsearg\appendixsecyyy}
2878 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
2879 \def\appendixsectionzzz #1{\seccheck{appendixsection}%
2880 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
2881 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
2884 \edef\temp{{\realbackslash secentry %
2885 {\the\toks0}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
2887 \write \contentsfile \temp %
2892 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
2893 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
2894 \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
2895 \plainsecheading {#1}\gdef\thissection{#1}%
2898 \edef\temp{{\realbackslash unnumbsecentry{\the\toks0}{\noexpand\folio}}}%
2900 \write \contentsfile \temp %
2905 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
2906 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
2907 \def\numberedsubseczzz #1{\seccheck{subsection}%
2908 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
2909 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
2912 \edef\temp{{\realbackslash subsecentry %
2913 {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
2915 \write \contentsfile \temp %
2920 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
2921 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
2922 \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
2923 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
2924 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
2927 \edef\temp{{\realbackslash subsecentry %
2928 {\the\toks0}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
2930 \write \contentsfile \temp %
2935 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
2936 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
2937 \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
2938 \plainsubsecheading {#1}\gdef\thissection{#1}%
2941 \edef\temp{{\realbackslash unnumbsubsecentry{\the\toks0}{\noexpand\folio}}}%
2943 \write \contentsfile \temp %
2948 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
2949 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
2950 \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
2951 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
2952 \subsubsecheading {#1}
2953 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
2956 \edef\temp{{\realbackslash subsubsecentry{\the\toks0}
2957 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
2958 {\noexpand\folio}}}%
2960 \write \contentsfile \temp %
2965 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
2966 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
2967 \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
2968 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
2969 \subsubsecheading {#1}
2970 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
2973 \edef\temp{{\realbackslash subsubsecentry{\the\toks0}%
2975 {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
2977 \write \contentsfile \temp %
2982 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
2983 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
2984 \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
2985 \plainsubsubsecheading {#1}\gdef\thissection{#1}%
2988 \edef\temp{{\realbackslash unnumbsubsubsecentry{\the\toks0}{\noexpand\folio}}}%
2990 \write \contentsfile \temp %
2995 % These are variants which are not "outer", so they can appear in @ifinfo.
2996 % Actually, they should now be obsolete; ordinary section commands should work.
2997 \def\infotop{\parsearg\unnumberedzzz}
2998 \def\infounnumbered{\parsearg\unnumberedzzz}
2999 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
3000 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
3001 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
3003 \def\infoappendix{\parsearg\appendixzzz}
3004 \def\infoappendixsec{\parsearg\appendixseczzz}
3005 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
3006 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
3008 \def\infochapter{\parsearg\chapterzzz}
3009 \def\infosection{\parsearg\sectionzzz}
3010 \def\infosubsection{\parsearg\subsectionzzz}
3011 \def\infosubsubsection{\parsearg\subsubsectionzzz}
3013 % These macros control what the section commands do, according
3014 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
3015 % Define them by default for a numbered chapter.
3016 \global\let\section = \numberedsec
3017 \global\let\subsection = \numberedsubsec
3018 \global\let\subsubsection = \numberedsubsubsec
3020 % Define @majorheading, @heading and @subheading
3022 % NOTE on use of \vbox for chapter headings, section headings, and
3024 % 1) We use \vbox rather than the earlier \line to permit
3025 % overlong headings to fold.
3026 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
3027 % heading is obnoxious; this forbids it.
3028 % 3) Likewise, headings look best if no \parindent is used, and
3029 % if justification is not attempted. Hence \raggedright.
3032 \def\majorheading{\parsearg\majorheadingzzz}
3033 \def\majorheadingzzz #1{%
3034 {\advance\chapheadingskip by 10pt \chapbreak }%
3035 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3036 \parindent=0pt\raggedright
3037 \rm #1\hfill}}\bigskip \par\penalty 200}
3039 \def\chapheading{\parsearg\chapheadingzzz}
3040 \def\chapheadingzzz #1{\chapbreak %
3041 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3042 \parindent=0pt\raggedright
3043 \rm #1\hfill}}\bigskip \par\penalty 200}
3045 % @heading, @subheading, @subsubheading.
3046 \def\heading{\parsearg\plainsecheading}
3047 \def\subheading{\parsearg\plainsubsecheading}
3048 \def\subsubheading{\parsearg\plainsubsubsecheading}
3050 % These macros generate a chapter, section, etc. heading only
3051 % (including whitespace, linebreaking, etc. around it),
3052 % given all the information in convenient, parsed form.
3054 %%% Args are the skip and penalty (usually negative)
3055 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
3057 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
3059 %%% Define plain chapter starts, and page on/off switching for it
3060 % Parameter controlling skip before chapter headings (if needed)
3062 \newskip\chapheadingskip
3064 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
3065 \def\chappager{\par\vfill\supereject}
3066 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
3068 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
3071 \global\let\contentsalignmacro = \chappager
3072 \global\let\pchapsepmacro=\chapbreak
3073 \global\let\pagealignmacro=\chappager}
3076 \global\let\contentsalignmacro = \chappager
3077 \global\let\pchapsepmacro=\chappager
3078 \global\let\pagealignmacro=\chappager
3079 \global\def\HEADINGSon{\HEADINGSsingle}}
3082 \global\let\contentsalignmacro = \chapoddpage
3083 \global\let\pchapsepmacro=\chapoddpage
3084 \global\let\pagealignmacro=\chapoddpage
3085 \global\def\HEADINGSon{\HEADINGSdouble}}
3090 \global\let\chapmacro=\chfplain
3091 \global\let\unnumbchapmacro=\unnchfplain
3092 \global\let\centerchapmacro=\centerchfplain}
3094 % Plain chapter opening.
3095 % #1 is the text, #2 the chapter number or empty if unnumbered.
3101 \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
3102 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3103 \hangindent = \wd0 \centerparametersmaybe
3106 \nobreak\bigskip % no page break after a chapter title
3110 % Plain opening for unnumbered.
3111 \def\unnchfplain#1{\chfplain{#1}{}}
3113 % @centerchap -- centered and unnumbered.
3114 \let\centerparametersmaybe = \relax
3115 \def\centerchfplain#1{{%
3116 \def\centerparametersmaybe{%
3117 \advance\rightskip by 3\rightskip
3118 \leftskip = \rightskip
3124 \CHAPFplain % The default
3126 \def\unnchfopen #1{%
3127 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3128 \parindent=0pt\raggedright
3129 \rm #1\hfill}}\bigskip \par\penalty 10000 %
3132 \def\chfopen #1#2{\chapoddpage {\chapfonts
3133 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
3137 \def\centerchfopen #1{%
3138 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3140 \hfill {\rm #1}\hfill}}\bigskip \par\penalty 10000 %
3144 \global\let\chapmacro=\chfopen
3145 \global\let\unnumbchapmacro=\unnchfopen
3146 \global\let\centerchapmacro=\centerchfopen}
3150 \newskip\secheadingskip
3151 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
3152 \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
3153 \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
3155 % Subsection titles.
3156 \newskip \subsecheadingskip
3157 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
3158 \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
3159 \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
3161 % Subsubsection titles.
3162 \let\subsubsecheadingskip = \subsecheadingskip
3163 \let\subsubsecheadingbreak = \subsecheadingbreak
3164 \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
3165 \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
3168 % Print any size section title.
3170 % #1 is the section type (sec/subsec/subsubsec), #2 is the section
3171 % number (maybe empty), #3 the text.
3172 \def\sectionheading#1#2#3{%
3174 \expandafter\advance\csname #1headingskip\endcsname by \parskip
3175 \csname #1headingbreak\endcsname
3178 % Switch to the right set of fonts.
3179 \csname #1fonts\endcsname \rm
3181 % Only insert the separating space if we have a section number.
3183 \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
3185 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3186 \hangindent = \wd0 % zero if no section number
3189 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
3193 \message{toc printing,}
3194 % Finish up the main text and prepare to read what we've written
3197 \newskip\contentsrightmargin \contentsrightmargin=1in
3198 \def\startcontents#1{%
3199 % If @setchapternewpage on, and @headings double, the contents should
3200 % start on an odd page, unlike chapters. Thus, we maintain
3201 % \contentsalignmacro in parallel with \pagealignmacro.
3202 % From: Torbjorn Granlund <tege@matematik.su.se>
3204 \immediate\closeout \contentsfile
3206 \pageno = -1 % Request roman numbered pages.
3208 % Don't need to put `Contents' or `Short Contents' in the headline.
3209 % It is abundantly clear what they are.
3210 \unnumbchapmacro{#1}\def\thischapter{}%
3211 \begingroup % Set up to handle contents files properly.
3212 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
3213 \catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3214 \raggedbottom % Worry more about breakpoints than the bottom.
3215 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3219 % Normal (long) toc.
3220 \outer\def\contents{%
3221 \startcontents{\putwordTableofContents}%
3227 % And just the chapters.
3228 \outer\def\summarycontents{%
3229 \startcontents{\putwordShortContents}%
3231 \let\chapentry = \shortchapentry
3232 \let\unnumbchapentry = \shortunnumberedentry
3233 % We want a true roman here for the page numbers.
3235 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
3237 \hyphenpenalty = 10000
3238 \advance\baselineskip by 1pt % Open it up a little.
3239 \def\secentry ##1##2##3##4{}
3240 \def\unnumbsecentry ##1##2{}
3241 \def\subsecentry ##1##2##3##4##5{}
3242 \def\unnumbsubsecentry ##1##2{}
3243 \def\subsubsecentry ##1##2##3##4##5##6{}
3244 \def\unnumbsubsubsecentry ##1##2{}
3249 \let\shortcontents = \summarycontents
3251 % These macros generate individual entries in the table of contents.
3252 % The first argument is the chapter or section name.
3253 % The last argument is the page number.
3254 % The arguments in between are the chapter number, section number, ...
3256 % Chapter-level things, for both the long and short contents.
3257 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3259 % See comments in \dochapentry re vbox and related settings
3260 \def\shortchapentry#1#2#3{%
3261 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
3264 % Typeset the label for a chapter or appendix for the short contents.
3265 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
3266 % We could simplify the code here by writing out an \appendixentry
3267 % command in the toc file for appendices, instead of using \chapentry
3268 % for both, but it doesn't seem worth it.
3269 \setbox0 = \hbox{\shortcontrm \putwordAppendix }
3270 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
3272 \def\shortchaplabel#1{%
3273 % We typeset #1 in a box of constant width, regardless of the text of
3274 % #1, so the chapter titles will come out aligned.
3275 \setbox0 = \hbox{#1}%
3276 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3278 % This space should be plenty, since a single number is .5em, and the
3279 % widest letter (M) is 1em, at least in the Computer Modern fonts.
3280 % (This space doesn't include the extra space that gets added after
3281 % the label; that gets put in by \shortchapentry above.)
3282 \advance\dimen0 by 1.1em
3283 \hbox to \dimen0{#1\hfil}%
3286 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3287 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
3290 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3291 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
3294 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
3295 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
3297 % And subsubsections.
3298 \def\subsubsecentry#1#2#3#4#5#6{%
3299 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
3300 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
3302 % This parameter controls the indentation of the various levels.
3303 \newdimen\tocindent \tocindent = 3pc
3305 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
3308 % If the toc has to be broken over pages, we want it to be at chapters
3309 % if at all possible; hence the \penalty.
3310 \def\dochapentry#1#2{%
3311 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
3314 \tocentry{#1}{\dopageno{#2}}%
3316 \nobreak\vskip .25\baselineskip plus.1\baselineskip
3319 \def\dosecentry#1#2{\begingroup
3320 \secentryfonts \leftskip=\tocindent
3321 \tocentry{#1}{\dopageno{#2}}%
3324 \def\dosubsecentry#1#2{\begingroup
3325 \subsecentryfonts \leftskip=2\tocindent
3326 \tocentry{#1}{\dopageno{#2}}%
3329 \def\dosubsubsecentry#1#2{\begingroup
3330 \subsubsecentryfonts \leftskip=3\tocindent
3331 \tocentry{#1}{\dopageno{#2}}%
3334 % Final typesetting of a toc entry; we use the same \entry macro as for
3335 % the index entries, but we want to suppress hyphenation here. (We
3336 % can't do that in the \entry macro, since index entries might consist
3337 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
3339 % \turnoffactive is for the sake of @" used for umlauts.
3340 \def\tocentry#1#2{\begingroup
3341 \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
3342 \entry{\turnoffactive #1}{\turnoffactive #2}%
3345 % Space between chapter (or whatever) number and the title.
3346 \def\labelspace{\hskip1em \relax}
3348 \def\dopageno#1{{\rm #1}}
3349 \def\doshortpageno#1{{\rm #1}}
3351 \def\chapentryfonts{\secfonts \rm}
3352 \def\secentryfonts{\textfonts}
3353 \let\subsecentryfonts = \textfonts
3354 \let\subsubsecentryfonts = \textfonts
3357 \message{environments,}
3359 % Since these characters are used in examples, it should be an even number of
3360 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3361 % Furthermore, these definitions must come after we define our fonts.
3362 \newbox\dblarrowbox \newbox\longdblarrowbox
3363 \newbox\pushcharbox \newbox\bullbox
3364 \newbox\equivbox \newbox\errorbox
3367 %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
3368 %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
3369 %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
3370 %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
3371 % Adapted from the manmac format (p.420 of TeXbook)
3372 %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
3376 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3378 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3379 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
3380 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3381 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3383 % Adapted from the TeXbook's \boxit.
3384 {\tentt \global\dimen0 = 3em}% Width of the box.
3385 \dimen2 = .55pt % Thickness of rules
3386 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3387 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
3389 \global\setbox\errorbox=\hbox to \dimen0{\hfil
3390 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3391 \advance\hsize by -2\dimen2 % Rules.
3393 \hrule height\dimen2
3394 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3395 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3396 \kern3pt\vrule width\dimen2}% Space to right.
3397 \hrule height\dimen2}
3400 % The @error{} command.
3401 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3403 % @tex ... @end tex escapes into raw Tex temporarily.
3404 % One exception: @ is still an escape character, so that @end tex works.
3405 % But \@ or @@ will get a plain tex @ character.
3407 \def\tex{\begingroup
3408 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
3409 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
3410 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
3412 \catcode 43=12 % plus
3426 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
3427 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
3429 \let\bullet=\ptexbullet
3430 \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext
3432 \let\Etex=\endgroup}
3434 % Define @lisp ... @endlisp.
3435 % @lisp does a \begingroup so it can rebind things,
3436 % including the definition of @endlisp (which normally is erroneous).
3438 % Amount to narrow the margins by for @lisp.
3439 \newskip\lispnarrowing \lispnarrowing=0.4in
3441 % This is the definition that ^^M gets inside @lisp, @example, and other
3442 % such environments. \null is better than a space, since it doesn't
3444 \def\lisppar{\null\endgraf}
3446 % Make each space character in the input produce a normal interword
3447 % space in the output. Don't allow a line break at this space, as this
3448 % is used only in environments like @example, where each line of input
3449 % should produce a line of output anyway.
3452 \gdef\sepspaces{\obeyspaces\let =\tie}}
3454 % Define \obeyedspace to be our active space, whatever it is. This is
3455 % for use in \parsearg.
3457 \global\let\obeyedspace= }
3459 % This space is always present above and below environments.
3460 \newskip\envskipamount \envskipamount = 0pt
3462 % Make spacing and below environment symmetrical. We use \parskip here
3463 % to help in doing that, since in @example-like environments \parskip
3464 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
3465 % start of the next paragraph will insert \parskip
3467 \def\aboveenvbreak{{\advance\envskipamount by \parskip
3468 \endgraf \ifdim\lastskip<\envskipamount
3469 \removelastskip \penalty-50 \vskip\envskipamount \fi}}
3471 \let\afterenvbreak = \aboveenvbreak
3473 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
3474 \let\nonarrowing=\relax
3476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3477 % \cartouche: draw rectangle w/rounded corners around argument
3478 \font\circle=lcircle10
3480 \newdimen\cartouter\newdimen\cartinner
3481 \newskip\normbskip\newskip\normpskip\newskip\normlskip
3482 \circthick=\fontdimen8\circle
3484 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
3485 \def\ctr{{\hskip 6pt\circle\char'010}}
3486 \def\cbl{{\circle\char'012\hskip -6pt}}
3487 \def\cbr{{\hskip 6pt\circle\char'011}}
3488 \def\carttop{\hbox to \cartouter{\hskip\lskip
3489 \ctl\leaders\hrule height\circthick\hfil\ctr
3491 \def\cartbot{\hbox to \cartouter{\hskip\lskip
3492 \cbl\leaders\hrule height\circthick\hfil\cbr
3495 \newskip\lskip\newskip\rskip
3497 \long\def\cartouche{%
3499 \lskip=\leftskip \rskip=\rightskip
3500 \leftskip=0pt\rightskip=0pt %we want these *outside*.
3501 \cartinner=\hsize \advance\cartinner by-\lskip
3502 \advance\cartinner by-\rskip
3504 \advance\cartouter by 18pt % allow for 3pt kerns on either
3505 % side, and for 6pt waste from
3507 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
3508 % Flag to tell @lisp, etc., not to narrow margin.
3509 \let\nonarrowing=\comment
3511 \baselineskip=0pt\parskip=0pt\lineskip=0pt
3520 \baselineskip=\normbskip
3521 \lineskip=\normlskip
3537 % This macro is called at the beginning of all the @example variants,
3541 \inENV % This group ends at the end of the body
3542 \hfuzz = 12pt % Don't be fussy
3543 \sepspaces % Make spaces be word-separators rather than space tokens.
3545 \let\par = \lisppar % don't ignore blank lines
3546 \obeylines % each line of input is a line of output
3549 \emergencystretch = 0pt % don't try to avoid overfull boxes
3550 % @cartouche defines \nonarrowing to inhibit narrowing
3551 % at next level down.
3552 \ifx\nonarrowing\relax
3553 \advance \leftskip by \lispnarrowing
3554 \exdentamount=\lispnarrowing
3555 \let\exdent=\nofillexdent
3556 \let\nonarrowing=\relax
3560 % To ending an @example-like environment, we first end the paragraph
3561 % (via \afterenvbreak's vertical glue), and then the group. That way we
3562 % keep the zero \parskip that the environments set -- \parskip glue
3563 % will be inserted at the beginning of the next paragraph in the
3564 % document, after the environment.
3566 \def\nonfillfinish{\afterenvbreak\endgroup}%
3569 \def\lisp{\begingroup
3571 \let\Elisp = \nonfillfinish
3573 \rawbackslash % have \ input char produce \ char from current font
3577 % Define the \E... control sequence only if we are inside the
3578 % environment, so the error checking in \end will work.
3580 % We must call \lisp last in the definition, since it reads the
3581 % return following the @example (or whatever) command.
3583 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
3584 \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
3585 \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
3587 % @smallexample and @smalllisp. This is not used unless the @smallbook
3588 % command is given. Originally contributed by Pavel@xerox.
3590 \def\smalllispx{\begingroup
3592 \let\Esmalllisp = \nonfillfinish
3593 \let\Esmallexample = \nonfillfinish
3595 % Smaller fonts for small examples.
3597 \rawbackslash % make \ output the \ character from the current font (tt)
3601 % This is @display; same as @lisp except use roman font.
3603 \def\display{\begingroup
3605 \let\Edisplay = \nonfillfinish
3609 % This is @format; same as @display except don't narrow margins.
3611 \def\format{\begingroup
3612 \let\nonarrowing = t
3614 \let\Eformat = \nonfillfinish
3618 % @flushleft (same as @format) and @flushright.
3620 \def\flushleft{\begingroup
3621 \let\nonarrowing = t
3623 \let\Eflushleft = \nonfillfinish
3626 \def\flushright{\begingroup
3627 \let\nonarrowing = t
3629 \let\Eflushright = \nonfillfinish
3630 \advance\leftskip by 0pt plus 1fill
3633 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
3634 % and narrows the margins.
3637 \begingroup\inENV %This group ends at the end of the @quotation body
3638 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
3641 % We have retained a nonzero parskip for the environment, since we're
3642 % doing normal filling. So to avoid extra space below the environment...
3643 \def\Equotation{\parskip = 0pt \nonfillfinish}%
3645 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
3646 \ifx\nonarrowing\relax
3647 \advance\leftskip by \lispnarrowing
3648 \advance\rightskip by \lispnarrowing
3649 \exdentamount = \lispnarrowing
3650 \let\nonarrowing = \relax
3655 % Define formatter for defuns
3656 % First, allow user to change definition object font (\df) internally
3657 \def\setdeffont #1 {\csname DEF#1\endcsname}
3659 \newskip\defbodyindent \defbodyindent=.4in
3660 \newskip\defargsindent \defargsindent=50pt
3661 \newskip\deftypemargin \deftypemargin=12pt
3662 \newskip\deflastargmargin \deflastargmargin=18pt
3664 \newcount\parencount
3665 % define \functionparens, which makes ( and ) and & do special things.
3666 % \functionparens affects the group it is contained in.
3668 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
3669 \catcode`\[=\active \catcode`\]=\active}
3671 % Make control sequences which act like normal parenthesis chars.
3672 \let\lparen = ( \let\rparen = )
3674 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
3676 % Be sure that we always have a definition for `(', etc. For example,
3677 % if the fn name has parens in it, \boldbrax will not be in effect yet,
3678 % so TeX would otherwise complain about undefined control sequence.
3679 \global\let(=\lparen \global\let)=\rparen
3680 \global\let[=\lbrack \global\let]=\rbrack
3682 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
3683 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
3684 % This is used to turn on special parens
3685 % but make & act ordinary (given that it's active).
3686 \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
3688 % Definitions of (, ) and & used in args for functions.
3689 % This is the definition of ( outside of all parentheses.
3690 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
3691 \global\advance\parencount by 1
3694 % This is the definition of ( when already inside a level of parens.
3695 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
3697 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
3698 % also in that case restore the outer-level definition of (.
3699 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
3700 \global\advance \parencount by -1 }
3701 % If we encounter &foo, then turn on ()-hacking afterwards
3702 \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
3704 \gdef\normalparens{\boldbrax\let&=\ampnr}
3705 } % End of definition inside \activeparens
3706 %% These parens (in \boldbrax) actually are a little bolder than the
3707 %% contained text. This is especially needed for [ and ]
3708 \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
3709 \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
3711 \def\lbrb{{\bf\char`\[}}
3712 \def\rbrb{{\bf\char`\]}}
3714 % First, defname, which formats the header line itself.
3715 % #1 should be the function name.
3716 % #2 should be the type of definition, such as "Function".
3719 % Get the values of \leftskip and \rightskip as they were
3720 % outside the @def...
3722 \advance\dimen2 by -\defbodyindent
3724 \advance\dimen3 by -\defbodyindent
3726 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
3727 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
3728 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
3729 \parshape 2 0in \dimen0 \defargsindent \dimen1 %
3730 % Now output arg 2 ("Function" or some such)
3731 % ending at \deftypemargin from the right margin,
3732 % but stuck inside a box of width 0 so it does not interfere with linebreaking
3733 {% Adjust \hsize to exclude the ambient margins,
3734 % so that \rightline will obey them.
3735 \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
3736 \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
3737 % Make all lines underfull and no complaints:
3738 \tolerance=10000 \hbadness=10000
3739 \advance\leftskip by -\defbodyindent
3740 \exdentamount=\defbodyindent
3741 {\df #1}\enskip % Generate function name
3744 % Actually process the body of a definition
3745 % #1 should be the terminating control sequence, such as \Edefun.
3746 % #2 should be the "another name" control sequence, such as \defunx.
3747 % #3 should be the control sequence that actually processes the header,
3748 % such as \defunheader.
3750 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3752 % Define the end token that this defining construct specifies
3753 % so that it will exit this group.
3754 \def#1{\endgraf\endgroup\medbreak}%
3755 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
3757 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3758 \exdentamount=\defbodyindent
3760 \catcode 61=\active % 61 is `='
3761 \obeylines\activeparens\spacesplit#3}
3763 \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
3765 % Define the end token that this defining construct specifies
3766 % so that it will exit this group.
3767 \def#1{\endgraf\endgroup\medbreak}%
3768 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
3770 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3771 \exdentamount=\defbodyindent
3772 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
3774 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
3776 % Define the end token that this defining construct specifies
3777 % so that it will exit this group.
3778 \def#1{\endgraf\endgroup\medbreak}%
3779 \def#2##1 ##2 {\def#4{##1}%
3780 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
3782 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3783 \exdentamount=\defbodyindent
3784 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
3786 % These parsing functions are similar to the preceding ones
3787 % except that they do not make parens into active characters.
3788 % These are used for "variables" since they have no arguments.
3790 \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3792 % Define the end token that this defining construct specifies
3793 % so that it will exit this group.
3794 \def#1{\endgraf\endgroup\medbreak}%
3795 \def#2{\begingroup\obeylines\spacesplit#3}%
3797 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3798 \exdentamount=\defbodyindent
3800 \catcode 61=\active %
3801 \obeylines\spacesplit#3}
3803 % This is used for \def{tp,vr}parsebody. It could probably be used for
3804 % some of the others, too, with some judicious conditionals.
3806 \def\parsebodycommon#1#2#3{%
3809 % Define the end token that this defining construct specifies
3810 % so that it will exit this group.
3811 \def#1{\endgraf\endgroup\medbreak}%
3812 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
3814 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3815 \exdentamount=\defbodyindent
3816 \begingroup\obeylines
3819 \def\defvrparsebody#1#2#3#4 {%
3820 \parsebodycommon{#1}{#2}{#3}%
3821 \spacesplit{#3{#4}}%
3824 % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
3825 % type is just `struct', because we lose the braces in `{struct
3826 % termios}' when \spacesplit reads its undelimited argument. Sigh.
3827 % \let\deftpparsebody=\defvrparsebody
3829 % So, to get around this, we put \empty in with the type name. That
3830 % way, TeX won't find exactly `{...}' as an undelimited argument, and
3831 % won't strip off the braces.
3833 \def\deftpparsebody #1#2#3#4 {%
3834 \parsebodycommon{#1}{#2}{#3}%
3835 \spacesplit{\parsetpheaderline{#3{#4}}}\empty
3838 % Fine, but then we have to eventually remove the \empty *and* the
3839 % braces (if any). That's what this does.
3841 \def\removeemptybraces\empty#1\relax{#1}
3843 % After \spacesplit has done its work, this is called -- #1 is the final
3844 % thing to call, #2 the type name (which starts with \empty), and #3
3845 % (which might be empty) the arguments.
3847 \def\parsetpheaderline#1#2#3{%
3848 #1{\removeemptybraces#2\relax}{#3}%
3851 \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
3853 % Define the end token that this defining construct specifies
3854 % so that it will exit this group.
3855 \def#1{\endgraf\endgroup\medbreak}%
3856 \def#2##1 ##2 {\def#4{##1}%
3857 \begingroup\obeylines\spacesplit{#3{##2}}}%
3859 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3860 \exdentamount=\defbodyindent
3861 \begingroup\obeylines\spacesplit{#3{#5}}}
3863 % Split up #2 at the first space token.
3864 % call #1 with two arguments:
3865 % the first is all of #2 before the space token,
3866 % the second is all of #2 after that space token.
3867 % If #2 contains no space token, all of it is passed as the first arg
3868 % and the second is passed as empty.
3871 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
3872 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
3874 #1{#2}{}\else #1{#2}{#3#4}\fi}}
3876 % So much for the things common to all kinds of definitions.
3880 % First, define the processing that is wanted for arguments of \defun
3881 % Use this to expand the args and terminate the paragraph they make up
3883 \def\defunargs #1{\functionparens \sl
3884 % Expand, preventing hyphenation at `-' chars.
3885 % Note that groups don't affect changes in \hyphenchar.
3888 \hyphenchar\tensl=45
3889 \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
3890 \interlinepenalty=10000
3891 \advance\rightskip by 0pt plus 1fil
3892 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
3895 \def\deftypefunargs #1{%
3896 % Expand, preventing hyphenation at `-' chars.
3897 % Note that groups don't affect changes in \hyphenchar.
3898 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
3900 \tclose{#1}% avoid \code because of side effects on active chars
3901 \interlinepenalty=10000
3902 \advance\rightskip by 0pt plus 1fil
3903 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
3906 % Do complete processing of one @defun or @defunx line already parsed.
3908 % @deffn Command forward-char nchars
3910 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
3912 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
3913 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
3914 \catcode 61=\other % Turn off change made in \defparsebody
3917 % @defun == @deffn Function
3919 \def\defun{\defparsebody\Edefun\defunx\defunheader}
3921 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3922 \begingroup\defname {#1}{Function}%
3923 \defunargs {#2}\endgroup %
3924 \catcode 61=\other % Turn off change made in \defparsebody
3927 % @deftypefun int foobar (int @var{foo}, float @var{bar})
3929 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
3931 % #1 is the data type. #2 is the name and args.
3932 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
3933 % #1 is the data type, #2 the name, #3 the args.
3934 \def\deftypefunheaderx #1#2 #3\relax{%
3935 \doind {fn}{\code{#2}}% Make entry in function index
3936 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
3937 \deftypefunargs {#3}\endgroup %
3938 \catcode 61=\other % Turn off change made in \defparsebody
3941 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
3943 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
3945 % \defheaderxcond#1\relax$$$
3946 % puts #1 in @code, followed by a space, but does nothing if #1 is null.
3947 \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
3949 % #1 is the classification. #2 is the data type. #3 is the name and args.
3950 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
3951 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
3952 \def\deftypefnheaderx #1#2#3 #4\relax{%
3953 \doind {fn}{\code{#3}}% Make entry in function index
3955 \normalparens % notably, turn off `&' magic, which prevents
3956 % at least some C++ text from working
3957 \defname {\defheaderxcond#2\relax$$$#3}{#1}%
3958 \deftypefunargs {#4}\endgroup %
3959 \catcode 61=\other % Turn off change made in \defparsebody
3962 % @defmac == @deffn Macro
3964 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
3966 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3967 \begingroup\defname {#1}{Macro}%
3968 \defunargs {#2}\endgroup %
3969 \catcode 61=\other % Turn off change made in \defparsebody
3972 % @defspec == @deffn Special Form
3974 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
3976 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3977 \begingroup\defname {#1}{Special Form}%
3978 \defunargs {#2}\endgroup %
3979 \catcode 61=\other % Turn off change made in \defparsebody
3982 % This definition is run if you use @defunx
3983 % anywhere other than immediately after a @defun or @defunx.
3985 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
3986 \def\defunx #1 {\errmessage{@defunx in invalid context}}
3987 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
3988 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
3989 \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
3990 \def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}}
3991 \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
3993 % @defmethod, and so on
3995 % @defop {Funny Method} foo-class frobnicate argument
3997 \def\defop #1 {\def\defoptype{#1}%
3998 \defopparsebody\Edefop\defopx\defopheader\defoptype}
4000 \def\defopheader #1#2#3{%
4001 \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
4002 \begingroup\defname {#2}{\defoptype{} on #1}%
4003 \defunargs {#3}\endgroup %
4006 % @deftypemethod foo-class return-type foo-method args
4008 \def\deftypemethod{%
4009 \defmethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
4011 % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
4012 \def\deftypemethodheader#1#2#3#4{%
4013 \deftypefnheaderx{Method on #1}{#2}#3 #4\relax
4016 % @defmethod == @defop Method
4018 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
4020 \def\defmethodheader #1#2#3{%
4021 \dosubind {fn}{\code{#2}}{on #1}% entry in function index
4022 \begingroup\defname {#2}{Method on #1}%
4023 \defunargs {#3}\endgroup %
4026 % @defcv {Class Option} foo-class foo-flag
4028 \def\defcv #1 {\def\defcvtype{#1}%
4029 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
4031 \def\defcvarheader #1#2#3{%
4032 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4033 \begingroup\defname {#2}{\defcvtype{} of #1}%
4034 \defvarargs {#3}\endgroup %
4037 % @defivar == @defcv {Instance Variable}
4039 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
4041 \def\defivarheader #1#2#3{%
4042 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4043 \begingroup\defname {#2}{Instance Variable of #1}%
4044 \defvarargs {#3}\endgroup %
4047 % These definitions are run if you use @defmethodx, etc.,
4048 % anywhere other than immediately after a @defmethod, etc.
4050 \def\defopx #1 {\errmessage{@defopx in invalid context}}
4051 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
4052 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
4053 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
4057 % First, define the processing that is wanted for arguments of @defvar.
4058 % This is actually simple: just print them in roman.
4059 % This must expand the args and terminate the paragraph they make up
4060 \def\defvarargs #1{\normalparens #1%
4061 \interlinepenalty=10000
4062 \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
4064 % @defvr Counter foo-count
4066 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
4068 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
4069 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
4071 % @defvar == @defvr Variable
4073 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
4075 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4076 \begingroup\defname {#1}{Variable}%
4077 \defvarargs {#2}\endgroup %
4080 % @defopt == @defvr {User Option}
4082 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
4084 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4085 \begingroup\defname {#1}{User Option}%
4086 \defvarargs {#2}\endgroup %
4089 % @deftypevar int foobar
4091 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
4093 % #1 is the data type. #2 is the name, perhaps followed by text that
4094 % is actually part of the data type, which should not be put into the index.
4095 \def\deftypevarheader #1#2{%
4096 \dovarind#2 \relax% Make entry in variables index
4097 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
4098 \interlinepenalty=10000
4099 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
4101 \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
4103 % @deftypevr {Global Flag} int enable
4105 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
4107 \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
4108 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
4109 \interlinepenalty=10000
4110 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
4113 % This definition is run if you use @defvarx
4114 % anywhere other than immediately after a @defvar or @defvarx.
4116 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
4117 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
4118 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
4119 \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
4120 \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
4123 % Args are printed in bold, a slight difference from @defvar.
4125 \def\deftpargs #1{\bf \defvarargs{#1}}
4127 % @deftp Class window height width ...
4129 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
4131 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4132 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4134 % This definition is run if you use @deftpx, etc
4135 % anywhere other than immediately after a @deftp, etc.
4137 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
4140 \message{cross reference,}
4141 % Define cross-reference macros
4144 \newif\ifhavexrefs % True if xref values are known.
4145 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
4147 % @inforef is simple.
4148 \def\inforef #1{\inforefzzz #1,,,,**}
4149 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
4150 node \samp{\ignorespaces#1{}}}
4152 % \setref{foo} defines a cross-reference point named foo.
4155 \dosetq{#1-title}{Ytitle}%
4156 \dosetq{#1-pg}{Ypagenumber}%
4157 \dosetq{#1-snt}{Ysectionnumberandtype}}
4159 \def\unnumbsetref#1{%
4160 \dosetq{#1-title}{Ytitle}%
4161 \dosetq{#1-pg}{Ypagenumber}%
4162 \dosetq{#1-snt}{Ynothing}}
4164 \def\appendixsetref#1{%
4165 \dosetq{#1-title}{Ytitle}%
4166 \dosetq{#1-pg}{Ypagenumber}%
4167 \dosetq{#1-snt}{Yappendixletterandtype}}
4169 % \xref, \pxref, and \ref generate cross-references to specified points.
4170 % For \xrefX, #1 is the node name, #2 the name of the Info
4171 % cross-reference, #3 the printed node name, #4 the name of the Info
4172 % file, #5 the name of the printed manual. All but the node name can be
4175 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
4176 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
4177 \def\ref#1{\xrefX[#1,,,,,,,]}
4178 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
4179 \def\printedmanual{\ignorespaces #5}%
4180 \def\printednodename{\ignorespaces #3}%
4181 \setbox1=\hbox{\printedmanual}%
4182 \setbox0=\hbox{\printednodename}%
4184 % No printed node name was explicitly given.
4185 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
4186 % Use the node name inside the square brackets.
4187 \def\printednodename{\ignorespaces #1}%
4189 % Use the actual chapter/section title appear inside
4190 % the square brackets. Use the real section title if we have it.
4192 % It is in another manual, so we don't have it.
4193 \def\printednodename{\ignorespaces #1}%
4196 % We know the real title if we have the xref values.
4197 \def\printednodename{\refx{#1-title}{}}%
4199 % Otherwise just copy the Info node name.
4200 \def\printednodename{\ignorespaces #1}%
4206 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
4207 % insert empty discretionaries after hyphens, which means that it will
4208 % not find a line break at a hyphen in a node names. Since some manuals
4209 % are best written with fairly long node names, containing hyphens, this
4210 % is a loss. Therefore, we give the text of the node name again, so it
4211 % is as if TeX is seeing it for the first time.
4213 \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
4215 % _ (for example) has to be the character _ for the purposes of the
4216 % control sequence corresponding to the node, but it has to expand
4217 % into the usual \leavevmode...\vrule stuff for purposes of
4218 % printing. So we \turnoffactive for the \refx-snt, back on for the
4219 % printing, back off for the \refx-pg.
4220 {\turnoffactive \refx{#1-snt}{}}%
4221 \space [\printednodename],\space
4222 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
4226 % \dosetq is the interface for calls from other macros
4228 % Use \turnoffactive so that punctuation chars such as underscore
4229 % work in node names.
4230 \def\dosetq #1#2{{\let\folio=0 \turnoffactive
4231 \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
4234 % \internalsetq {foo}{page} expands into
4235 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
4236 % When the aux file is read, ' is the escape character
4238 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
4240 % Things to be expanded by \internalsetq
4242 \def\Ypagenumber{\folio}
4244 \def\Ytitle{\thissection}
4248 \def\Ysectionnumberandtype{%
4249 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
4250 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
4251 \else \ifnum \subsubsecno=0 %
4252 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
4254 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
4257 \def\Yappendixletterandtype{%
4258 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
4259 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
4260 \else \ifnum \subsubsecno=0 %
4261 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
4263 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
4268 % Use TeX 3.0's \inputlineno to get the line number, for better error
4269 % messages, but if we're using an old version of TeX, don't do anything.
4271 \ifx\inputlineno\thisisundefined
4272 \let\linenumber = \empty % Non-3.0.
4274 \def\linenumber{\the\inputlineno:\space}
4277 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
4278 % If its value is nonempty, SUFFIX is output afterward.
4281 \expandafter\ifx\csname X#1\endcsname\relax
4282 % If not defined, say something at least.
4283 $\langle$un\-de\-fined$\rangle$%
4285 \message{\linenumber Undefined cross reference `#1'.}%
4288 \global\warnedxrefstrue
4289 \message{Cross reference values unknown; you must run TeX again.}%
4293 % It's defined, so just use it.
4294 \csname X#1\endcsname
4296 #2% Output the suffix in any case.
4299 % This is the macro invoked by entries in the aux file.
4302 \expandafter\gdef\csname X#1\endcsname{#2}%
4305 % Read the last existing aux file, if any. No error if none exists.
4306 \def\readauxfile{\begingroup
4307 \catcode`\^^@=\other
4308 \catcode`\
\ 1=\other
4309 \catcode`\
\ 2=\other
4310 \catcode`\^^C=\other
4311 \catcode`\^^D=\other
4312 \catcode`\^^E=\other
4313 \catcode`\^^F=\other
4314 \catcode`\^^G=\other
4315 \catcode`\^^H=\other
4317 \catcode`\^^L=\other
4318 \catcode`\
\ e=\other
4319 \catcode`\
\ f=\other
4320 \catcode`\
\10=\other
4321 \catcode`\
\11=\other
4322 \catcode`\
\12=\other
4323 \catcode`\
\13=\other
4324 \catcode`\
\14=\other
4325 \catcode`\
\15=\other
4326 \catcode`\
\16=\other
4327 \catcode`\
\17=\other
4328 \catcode`\
\18=\other
4329 \catcode`\
\19=\other
4331 \catcode`\^^[=\other
4332 \catcode`\^^\=\other
4333 \catcode`\^^]=\other
4334 \catcode`\^^^=\other
4335 \catcode`\^^_=\other
4338 % It was suggested to define this as 7, which would allow ^^e4 etc.
4339 % in xref tags, i.e., node names. But since ^^e4 notation isn't
4340 % supported in the main text, it doesn't seem desirable. Furthermore,
4341 % that is not enough: for node names that actually contain a ^
4342 % character, we would end up writing a line like this: 'xrdef {'hat
4343 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
4344 % argument, and \hat is not an expandable control sequence. It could
4345 % all be worked out, but why? Either we support ^^ or we don't.
4347 % The other change necessary for this was to define \auxhat:
4348 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
4349 % and then to call \auxhat in \setq.
4362 % `\+ does not work, so use 43.
4364 % Make the characters 128-255 be printing characters
4368 \catcode\count 1=\other
4369 \advance\count 1 by 1
4370 \ifnum \count 1<256 \loop \fi
4373 % The aux file uses ' as the escape (for now).
4374 % Turn off \ as an escape so we do not lose on
4375 % entries which were dumped with control sequences in their names.
4376 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
4377 % Reference to such entries still does not work the way one would wish,
4378 % but at least they do not bomb out when the aux file is read in.
4385 \openin 1 \jobname.aux
4389 \global\havexrefstrue
4390 \global\warnedobstrue
4392 % Open the new aux file. TeX will close it automatically at exit.
4393 \openout\auxfile=\jobname.aux
4399 \newcount \footnoteno
4401 % The trailing space in the following definition for supereject is
4402 % vital for proper filling; pages come out unaligned when you do a
4403 % pagealignmacro call if that space before the closing brace is
4404 % removed. (Generally, numeric constants should always be followed by a
4405 % space to prevent strange expansion errors.)
4406 \def\supereject{\par\penalty -20000\footnoteno =0 }
4408 % @footnotestyle is meaningful for info output only..
4409 \let\footnotestyle=\comment
4411 \let\ptexfootnote=\footnote
4415 % Auto-number footnotes. Otherwise like plain.
4417 \global\advance\footnoteno by \@ne
4418 \edef\thisfootno{$^{\the\footnoteno}$}%
4420 % In case the footnote comes at the end of a sentence, preserve the
4421 % extra spacing after we do the footnote number.
4423 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
4425 % Remove inadvertent blank space before typesetting the footnote number.
4431 % Don't bother with the trickery in plain.tex to not require the
4432 % footnote text as a parameter. Our footnotes don't need to be so general.
4434 % Oh yes, they do; otherwise, @ifset and anything else that uses
4435 % \parseargline fail inside footnotes because the tokens are fixed when
4436 % the footnote is read. --karl, 16nov96.
4438 \long\gdef\footnotezzz{\insert\footins\bgroup
4439 % We want to typeset this text as a normal paragraph, even if the
4440 % footnote reference occurs in (for example) a display environment.
4441 % So reset some parameters.
4442 \interlinepenalty\interfootnotelinepenalty
4443 \splittopskip\ht\strutbox % top baseline for broken footnotes
4444 \splitmaxdepth\dp\strutbox
4445 \floatingpenalty\@MM
4450 \parindent\defaultparindent
4452 % Hang the footnote text off the number.
4454 \textindent{\thisfootno}%
4456 % Don't crash into the line above the footnote text. Since this
4457 % expands into a box, it must come within the paragraph, lest it
4458 % provide a place where TeX can split the footnote.
4460 \futurelet\next\fo@t
4462 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
4463 \else\let\next\f@t\fi \next}
4464 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
4465 \def\f@t#1{#1\@foot}
4466 \def\@foot{\strut\egroup}
4468 }%end \catcode `\@=11
4470 % Set the baselineskip to #1, and the lineskip and strut size
4471 % correspondingly. There is no deep meaning behind these magic numbers
4472 % used as factors; they just match (closely enough) what Knuth defined.
4474 \def\lineskipfactor{.08333}
4475 \def\strutheightpercent{.70833}
4476 \def\strutdepthpercent {.29167}
4479 \normalbaselineskip = #1\relax
4480 \normallineskip = \lineskipfactor\normalbaselineskip
4482 \setbox\strutbox =\hbox{%
4483 \vrule width0pt height\strutheightpercent\baselineskip
4484 depth \strutdepthpercent \baselineskip
4488 % @| inserts a changebar to the left of the current line. It should
4489 % surround any changed text. This approach does *not* work if the
4490 % change spans more than two lines of output. To handle that, we would
4491 % have adopt a much more difficult approach (putting marks into the main
4492 % vertical list for the beginning and end of each change).
4495 % \vadjust can only be used in horizontal mode.
4498 % Append this vertical mode material after the current line in the output.
4500 % We want to insert a rule with the height and depth of the current
4501 % leading; that is exactly what \strutbox is supposed to record.
4502 \vskip-\baselineskip
4504 % \vadjust-items are inserted at the left edge of the type. So
4505 % the \llap here moves out into the left-hand margin.
4508 % For a thicker or thinner bar, change the `1pt'.
4509 \vrule height\baselineskip width1pt
4511 % This is the space between the bar and the text.
4517 % For a final copy, take out the rectangles
4518 % that mark overfull boxes (in case you have decided
4519 % that the text looks ok even though it passes the margin).
4521 \def\finalout{\overfullrule=0pt}
4524 % End of control word definitions.
4526 \message{and turning on texinfo input format.}
4537 % Set some numeric style parameters, for 8.5 x 11 format.
4541 \newdimen\defaultparindent \defaultparindent = 15pt
4542 \parindent = \defaultparindent
4543 \parskip 3pt plus 2pt minus 1pt
4545 \advance\topskip by 1.2cm
4547 \chapheadingskip = 15pt plus 4pt minus 2pt
4548 \secheadingskip = 12pt plus 3pt minus 2pt
4549 \subsecheadingskip = 9pt plus 2pt minus 2pt
4551 % Prevent underfull vbox error messages.
4554 % Following George Bush, just get rid of widows and orphans.
4558 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
4559 % using an old version of TeX, don't do anything. We want the amount of
4560 % stretch added to depend on the line length, hence the dependence on
4561 % \hsize. This makes it come to about 9pt for the 8.5x11 format.
4563 \ifx\emergencystretch\thisisundefined
4564 % Allow us to assign to \emergencystretch anyway.
4565 \def\emergencystretch{\dimen0}%
4567 \emergencystretch = \hsize
4568 \divide\emergencystretch by 45
4571 % Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25)
4573 \global\chapheadingskip = 15pt plus 4pt minus 2pt
4574 \global\secheadingskip = 12pt plus 3pt minus 2pt
4575 \global\subsecheadingskip = 9pt plus 2pt minus 2pt
4577 \global\lispnarrowing = 0.3in
4579 \advance\topskip by -1cm
4580 \global\parskip 2pt plus 1pt
4583 \global\tolerance=700
4585 \global\contentsrightmargin=0pt
4586 \global\deftypemargin=0pt
4587 \global\defbodyindent=.5cm
4589 \global\pagewidth=\hsize
4590 \global\pageheight=\vsize
4592 \global\let\smalllisp=\smalllispx
4593 \global\let\smallexample=\smalllispx
4594 \global\def\Esmallexample{\Esmalllisp}
4597 % Use @afourpaper to print on European A4 paper.
4599 \global\tolerance=700
4602 \global\parskip 15pt plus 1pt
4604 \global\vsize= 53\baselineskip
4605 \advance\vsize by \topskip
4606 %\global\hsize= 5.85in % A4 wide 10pt
4607 \global\hsize= 6.5in
4608 \global\outerhsize=\hsize
4609 \global\advance\outerhsize by 0.5in
4610 \global\outervsize=\vsize
4611 \global\advance\outervsize by 0.6in
4613 \global\pagewidth=\hsize
4614 \global\pageheight=\vsize
4618 \normaloffset=\hoffset
4622 % Allow control of the text dimensions. Parameters in order: textheight;
4623 % textwidth; voffset; hoffset; binding offset; topskip.
4624 % All require a dimension;
4625 % header is additional; added length extends the bottom of the page.
4627 \def\changepagesizes#1#2#3#4#5#6{
4630 \advance\vsize by \topskip
4633 \global\outerhsize=\hsize
4634 \global\advance\outerhsize by 0.5in
4635 \global\outervsize=\vsize
4636 \global\advance\outervsize by 0.6in
4637 \global\pagewidth=\hsize
4638 \global\pageheight=\vsize
4639 \global\normaloffset= #4
4640 \global\bindingoffset= #5}
4642 % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
4643 % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
4645 {\global\tolerance=700
4648 \global\parskip 15pt plus 1pt
4649 \advance\baselineskip by 1.6pt
4650 \changepagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}
4653 % Use @afourwide to print on European A4 paper in wide format.
4654 \def\afourwide{\afourpaper
4655 \changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}}
4657 % Define macros to output various characters with catcode for normal text.
4666 \def\normaldoublequote{"}
4669 \def\normalunderscore{_}
4670 \def\normalverticalbar{|}
4672 \def\normalgreater{>}
4675 % This macro is used to make a character print one way in ttfont
4676 % where it can probably just be output, and another way in other fonts,
4677 % where something hairier probably needs to be done.
4679 % #1 is what to print if we are indeed using \tt; #2 is what to print
4680 % otherwise. Since all the Computer Modern typewriter fonts have zero
4681 % interword stretch (and shrink), and it is reasonable to expect all
4682 % typewriter fonts to have this, we can check that font parameter.
4684 \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
4686 % Turn off all special characters except @
4687 % (and those which the user can use as if they were ordinary).
4688 % Most of these we simply print from the \tt font, but for some, we can
4689 % use math or other variants that look better in normal text.
4692 \def\activedoublequote{{\tt \char '042}}
4693 \let"=\activedoublequote
4695 \def~{{\tt \char '176}}
4701 \def_{\ifusingtt\normalunderscore\_}
4702 % Subroutine for the previous macro.
4703 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
4706 \def|{{\tt \char '174}}
4714 \def+{{\tt \char 43}}
4715 %\catcode 27=\active
4716 %\def^^[{$\diamondsuit$}
4718 % Set up an active definition for =, but don't enable it most of the time.
4719 {\catcode`\==\active
4720 \global\def={{\tt \char 61}}}
4725 % If a .fmt file is being used, characters that might appear in a file
4726 % name cannot be active until we have parsed the command line.
4727 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
4728 % \otherifyactive is called near the end of this file.
4729 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
4733 % \rawbackslashxx output one backslash character in current font
4734 \global\chardef\rawbackslashxx=`\\
4735 %{\catcode`\\=\other
4736 %@gdef@rawbackslashxx{\}}
4738 % \rawbackslash redefines \ as input to do \rawbackslashxx.
4739 {\catcode`\\=\active
4740 @gdef@rawbackslash{@let\=@rawbackslashxx }}
4742 % \normalbackslash outputs one backslash in fixed width font.
4743 \def\normalbackslash{{\tt\rawbackslashxx}}
4745 % Say @foo, not \foo, in error messages.
4748 % \catcode 17=0 % Define control-q
4751 % Used sometimes to turn off (effectively) the active characters
4752 % even after parsing them.
4753 @def@turnoffactive{@let"=@normaldoublequote
4754 @let\=@realbackslash
4757 @let_=@normalunderscore
4758 @let|=@normalverticalbar
4760 @let>=@normalgreater
4763 @def@normalturnoffactive{@let"=@normaldoublequote
4764 @let\=@normalbackslash
4767 @let_=@normalunderscore
4768 @let|=@normalverticalbar
4770 @let>=@normalgreater
4773 % Make _ and + \other characters, temporarily.
4774 % This is canceled by @fixbackslash.
4777 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
4778 % That is what \eatinput is for; after that, the `\' should revert to printing
4781 @gdef@eatinput input texinfo{@fixbackslash}
4782 @global@let\ = @eatinput
4784 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
4785 % the first `\{ in the file would cause an error. This macro tries to fix
4786 % that, assuming it is called before the first `\' could plausibly occur.
4787 % Also back turn on active characters that might appear in the input
4788 % file name, in case not using a pre-dumped format.
4790 @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
4791 @catcode`+=@active @catcode`@_=@active}
4793 %% These look ok in all fonts, so just make them not special. The @rm below
4794 %% makes sure that the current font starts out as the newly loaded cmr10
4795 @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
4801 @c page-delimiter: "^\\\\message"