Undo June 11th change
[official-gcc.git] / gcc / texinfo.tex
blob44ea22c38aeb60fb0106252ec05d17eaec00485c
1 % texinfo.tex -- TeX macros to handle Texinfo files.
2 % $Id: texinfo.tex,v 1.5 1998/06/29 21:40:12 law Exp $
4 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98
5 % Free Software Foundation, Inc.
7 % This texinfo.tex file is free software; you can redistribute it and/or
8 % modify it under the terms of the GNU General Public License as
9 % published by the Free Software Foundation; either version 2, or (at
10 % your option) any later version.
12 % This texinfo.tex file is distributed in the hope that it will be
13 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 % General Public License for more details.
17 % You should have received a copy of the GNU General Public License
18 % along with this texinfo.tex file; see the file COPYING. If not, write
19 % to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 % Boston, MA 02111-1307, USA.
22 % In other words, you are welcome to use, share and improve this program.
23 % You are forbidden to forbid anyone else to use, share and improve
24 % what you give them. Help stamp out software-hoarding!
26 % Please try the latest version of texinfo.tex before submitting bug
27 % reports; you can get the latest version from:
28 % /home/gd/gnu/doc/texinfo.tex on the GNU machines.
29 % ftp://ftp.gnu.org/pub/gnu/texinfo.tex
30 % (and all GNU mirrors)
31 % ftp://tug.org/tex/texinfo.tex
32 % ftp://ctan.org/macros/texinfo/texinfo.tex
33 % (and all CTAN mirrors, finger ctan@tug.org for a list).
35 % Send bug reports to bug-texinfo@gnu.org.
36 % Please include a precise test case in each bug report,
37 % including a complete document with which we can reproduce the problem.
39 % Texinfo macros (with @macro) are *not* supported by texinfo.tex. You
40 % have to run makeinfo -E to expand macros first; the texi2dvi script
41 % does this.
43 % To process a Texinfo manual with TeX, it's most reliable to use the
44 % texi2dvi shell script that comes with the distribution. For simple
45 % manuals, you can get away with:
46 % tex foo.texi
47 % texindex foo.??
48 % tex foo.texi
49 % tex foo.texi
50 % dvips foo.dvi -o # or whatever, to process the dvi file.
51 % The extra runs of TeX get the cross-reference information correct.
52 % Sometimes one run after texindex suffices, and sometimes you need more
53 % than two; texi2dvi does it as many times as necessary.
56 % Make it possible to create a .fmt file just by loading this file:
57 % if the underlying format is not loaded, start by loading it now.
58 % Added by gildea November 1993.
59 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
61 % This automatically updates the version number based on RCS.
62 \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
63 \deftexinfoversion$Revision: 1.5 $
64 \message{Loading texinfo package [Version \texinfoversion]:}
66 % If in a .fmt file, print the version number
67 % and turn on active characters that we couldn't do earlier because
68 % they might have appeared in the input file name.
69 \everyjob{\message{[Texinfo version \texinfoversion]}\message{}
70 \catcode`+=\active \catcode`\_=\active}
72 % Save some parts of plain tex whose names we will redefine.
74 \let\ptexb=\b
75 \let\ptexbullet=\bullet
76 \let\ptexc=\c
77 \let\ptexcomma=\,
78 \let\ptexdot=\.
79 \let\ptexdots=\dots
80 \let\ptexend=\end
81 \let\ptexequiv=\equiv
82 \let\ptexexclam=\!
83 \let\ptexi=\i
84 \let\ptexlbrace=\{
85 \let\ptexrbrace=\}
86 \let\ptexstar=\*
87 \let\ptext=\t
89 % We never want plain's outer \+ definition in Texinfo.
90 % For @tex, we can use \tabalign.
91 \let\+ = \relax
94 \message{Basics,}
95 \chardef\other=12
97 % If this character appears in an error message or help string, it
98 % starts a new line in the output.
99 \newlinechar = `^^J
101 % Set up fixed words for English if not already set.
102 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
103 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
104 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
105 \ifx\putwordInfo\undefined \gdef\putwordfile{Info}\fi
106 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
107 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
108 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
109 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
110 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
111 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
112 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
113 \ifx\putwordShortContents\undefined \gdef\putwordShortContents{Short Contents}\fi
114 \ifx\putwordTableofContents\undefined\gdef\putwordTableofContents{Table of Contents}\fi
116 % Ignore a token.
118 \def\gobble#1{}
120 \hyphenation{ap-pen-dix}
121 \hyphenation{mini-buf-fer mini-buf-fers}
122 \hyphenation{eshell}
123 \hyphenation{white-space}
125 % Margin to add to right of even pages, to left of odd pages.
126 \newdimen \bindingoffset
127 \newdimen \normaloffset
128 \newdimen\pagewidth \newdimen\pageheight
130 % Sometimes it is convenient to have everything in the transcript file
131 % and nothing on the terminal. We don't just call \tracingall here,
132 % since that produces some useless output on the terminal.
134 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
135 \def\loggingall{\tracingcommands2 \tracingstats2
136 \tracingpages1 \tracingoutput1 \tracinglostchars1
137 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
138 \showboxbreadth\maxdimen\showboxdepth\maxdimen
141 % For @cropmarks command.
142 % Do @cropmarks to get crop marks.
144 \newif\ifcropmarks
145 \let\cropmarks = \cropmarkstrue
147 % Dimensions to add cropmarks at corners.
148 % Added by P. A. MacKay, 12 Nov. 1986
150 \newdimen\cornerlong \newdimen\cornerthick
151 \newdimen\topandbottommargin
152 \newdimen\outerhsize \newdimen\outervsize
153 \cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks
154 \outerhsize=7in
155 %\outervsize=9.5in
156 % Alternative @smallbook page size is 9.25in
157 \outervsize=9.25in
158 \topandbottommargin=.75in
160 % Main output routine.
161 \chardef\PAGE = 255
162 \output = {\onepageout{\pagecontents\PAGE}}
164 \newbox\headlinebox
165 \newbox\footlinebox
167 % \onepageout takes a vbox as an argument. Note that \pagecontents
168 % does insertions, but you have to call it yourself.
169 \def\onepageout#1{%
170 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
172 \ifodd\pageno \advance\hoffset by \bindingoffset
173 \else \advance\hoffset by -\bindingoffset\fi
175 % Do this outside of the \shipout so @code etc. will be expanded in
176 % the headline as they should be, not taken literally (outputting ''code).
177 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
178 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
181 % Have to do this stuff outside the \shipout because we want it to
182 % take effect in \write's, yet the group defined by the \vbox ends
183 % before the \shipout runs.
185 \escapechar = `\\ % use backslash in output files.
186 \indexdummies % don't expand commands in the output.
187 \normalturnoffactive % \ in index entries must not stay \, e.g., if
188 % the page break happens to be in the middle of an example.
189 \shipout\vbox{%
190 \ifcropmarks \vbox to \outervsize\bgroup
191 \hsize = \outerhsize
192 \line{\ewtop\hfil\ewtop}%
193 \nointerlineskip
194 \line{%
195 \vbox{\moveleft\cornerthick\nstop}%
196 \hfill
197 \vbox{\moveright\cornerthick\nstop}%
199 \vskip\topandbottommargin
200 \line\bgroup
201 \hfil % center the page within the outer (page) hsize.
202 \ifodd\pageno\hskip\bindingoffset\fi
203 \vbox\bgroup
206 \unvbox\headlinebox
207 \pagebody{#1}%
208 \ifdim\ht\footlinebox > 0pt
209 % Only leave this space if the footline is nonempty.
210 % (We lessened \vsize for it in \oddfootingxxx.)
211 % The \baselineskip=24pt in plain's \makefootline has no effect.
212 \vskip 2\baselineskip
213 \unvbox\footlinebox
216 \ifcropmarks
217 \egroup % end of \vbox\bgroup
218 \hfil\egroup % end of (centering) \line\bgroup
219 \vskip\topandbottommargin plus1fill minus1fill
220 \boxmaxdepth = \cornerthick
221 \line{%
222 \vbox{\moveleft\cornerthick\nsbot}%
223 \hfill
224 \vbox{\moveright\cornerthick\nsbot}%
226 \nointerlineskip
227 \line{\ewbot\hfil\ewbot}%
228 \egroup % \vbox from first cropmarks clause
230 }% end of \shipout\vbox
231 }% end of group with \turnoffactive
232 \advancepageno
233 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
236 \newinsert\margin \dimen\margin=\maxdimen
238 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
239 {\catcode`\@ =11
240 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
241 % marginal hacks, juha@viisa.uucp (Juha Takala)
242 \ifvoid\margin\else % marginal info is present
243 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
244 \dimen@=\dp#1 \unvbox#1
245 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
246 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
249 % Here are the rules for the cropmarks. Note that they are
250 % offset so that the space between them is truly \outerhsize or \outervsize
251 % (P. A. MacKay, 12 November, 1986)
253 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
254 \def\nstop{\vbox
255 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
256 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
257 \def\nsbot{\vbox
258 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
260 % Parse an argument, then pass it to #1. The argument is the rest of
261 % the input line (except we remove a trailing comment). #1 should be a
262 % macro which expects an ordinary undelimited TeX argument.
264 \def\parsearg#1{%
265 \let\next = #1%
266 \begingroup
267 \obeylines
268 \futurelet\temp\parseargx
271 % If the next token is an obeyed space (from an @example environment or
272 % the like), remove it and recurse. Otherwise, we're done.
273 \def\parseargx{%
274 % \obeyedspace is defined far below, after the definition of \sepspaces.
275 \ifx\obeyedspace\temp
276 \expandafter\parseargdiscardspace
277 \else
278 \expandafter\parseargline
282 % Remove a single space (as the delimiter token to the macro call).
283 {\obeyspaces %
284 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
286 {\obeylines %
287 \gdef\parseargline#1^^M{%
288 \endgroup % End of the group started in \parsearg.
290 % First remove any @c comment, then any @comment.
291 % Result of each macro is put in \toks0.
292 \argremovec #1\c\relax %
293 \expandafter\argremovecomment \the\toks0 \comment\relax %
295 % Call the caller's macro, saved as \next in \parsearg.
296 \expandafter\next\expandafter{\the\toks0}%
300 % Since all \c{,omment} does is throw away the argument, we can let TeX
301 % do that for us. The \relax here is matched by the \relax in the call
302 % in \parseargline; it could be more or less anything, its purpose is
303 % just to delimit the argument to the \c.
304 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
305 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
307 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
308 % @end itemize @c foo
309 % will have two active spaces as part of the argument with the
310 % `itemize'. Here we remove all active spaces from #1, and assign the
311 % result to \toks0.
313 % This loses if there are any *other* active characters besides spaces
314 % in the argument -- _ ^ +, for example -- since they get expanded.
315 % Fortunately, Texinfo does not define any such commands. (If it ever
316 % does, the catcode of the characters in questionwill have to be changed
317 % here.) But this means we cannot call \removeactivespaces as part of
318 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
319 % that \parsearg gets might well have any character at all in it.
321 \def\removeactivespaces#1{%
322 \begingroup
323 \ignoreactivespaces
324 \edef\temp{#1}%
325 \global\toks0 = \expandafter{\temp}%
326 \endgroup
329 % Change the active space to expand to nothing.
331 \begingroup
332 \obeyspaces
333 \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
334 \endgroup
337 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
339 %% These are used to keep @begin/@end levels from running away
340 %% Call \inENV within environments (after a \begingroup)
341 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
342 \def\ENVcheck{%
343 \ifENV\errmessage{Still within an environment. Type Return to continue.}
344 \endgroup\fi} % This is not perfect, but it should reduce lossage
346 % @begin foo is the same as @foo, for now.
347 \newhelp\EMsimple{Type <Return> to continue.}
349 \outer\def\begin{\parsearg\beginxxx}
351 \def\beginxxx #1{%
352 \expandafter\ifx\csname #1\endcsname\relax
353 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
354 \csname #1\endcsname\fi}
356 % @end foo executes the definition of \Efoo.
358 \def\end{\parsearg\endxxx}
359 \def\endxxx #1{%
360 \removeactivespaces{#1}%
361 \edef\endthing{\the\toks0}%
363 \expandafter\ifx\csname E\endthing\endcsname\relax
364 \expandafter\ifx\csname \endthing\endcsname\relax
365 % There's no \foo, i.e., no ``environment'' foo.
366 \errhelp = \EMsimple
367 \errmessage{Undefined command `@end \endthing'}%
368 \else
369 \unmatchedenderror\endthing
371 \else
372 % Everything's ok; the right environment has been started.
373 \csname E\endthing\endcsname
377 % There is an environment #1, but it hasn't been started. Give an error.
379 \def\unmatchedenderror#1{%
380 \errhelp = \EMsimple
381 \errmessage{This `@end #1' doesn't have a matching `@#1'}%
384 % Define the control sequence \E#1 to give an unmatched @end error.
386 \def\defineunmatchedend#1{%
387 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
391 % Single-spacing is done by various environments (specifically, in
392 % \nonfillstart and \quotations).
393 \newskip\singlespaceskip \singlespaceskip = 12.5pt
394 \def\singlespace{%
395 % Why was this kern here? It messes up equalizing space above and below
396 % environments. --karl, 6may93
397 %{\advance \baselineskip by -\singlespaceskip
398 %\kern \baselineskip}%
399 \setleading \singlespaceskip
402 %% Simple single-character @ commands
404 % @@ prints an @
405 % Kludge this until the fonts are right (grr).
406 \def\@{{\tt\char64}}
408 % This is turned off because it was never documented
409 % and you can use @w{...} around a quote to suppress ligatures.
410 %% Define @` and @' to be the same as ` and '
411 %% but suppressing ligatures.
412 %\def\`{{`}}
413 %\def\'{{'}}
415 % Used to generate quoted braces.
416 \def\mylbrace {{\tt\char123}}
417 \def\myrbrace {{\tt\char125}}
418 \let\{=\mylbrace
419 \let\}=\myrbrace
420 \begingroup
421 % Definitions to produce actual \{ & \} command in an index.
422 \catcode`\{ = 12 \catcode`\} = 12
423 \catcode`\[ = 1 \catcode`\] = 2
424 \catcode`\@ = 0 \catcode`\\ = 12
425 @gdef@lbracecmd[\{]%
426 @gdef@rbracecmd[\}]%
427 @endgroup
429 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
430 % Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
431 \let\, = \c
432 \let\dotaccent = \.
433 \def\ringaccent#1{{\accent23 #1}}
434 \let\tieaccent = \t
435 \let\ubaraccent = \b
436 \let\udotaccent = \d
438 % Other special characters: @questiondown @exclamdown
439 % Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
440 \def\questiondown{?`}
441 \def\exclamdown{!`}
443 % Dotless i and dotless j, used for accents.
444 \def\imacro{i}
445 \def\jmacro{j}
446 \def\dotless#1{%
447 \def\temp{#1}%
448 \ifx\temp\imacro \ptexi
449 \else\ifx\temp\jmacro \j
450 \else \errmessage{@dotless can be used only with i or j}%
451 \fi\fi
454 % Be sure we're in horizontal mode when doing a tie, since we make space
455 % equivalent to this in @example-like environments. Otherwise, a space
456 % at the beginning of a line will start with \penalty -- and
457 % since \penalty is valid in vertical mode, we'd end up putting the
458 % penalty on the vertical list instead of in the new paragraph.
459 {\catcode`@ = 11
460 % Avoid using \@M directly, because that causes trouble
461 % if the definition is written into an index file.
462 \global\let\tiepenalty = \@M
463 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
466 % @: forces normal size whitespace following.
467 \def\:{\spacefactor=1000 }
469 % @* forces a line break.
470 \def\*{\hfil\break\hbox{}\ignorespaces}
472 % @. is an end-of-sentence period.
473 \def\.{.\spacefactor=3000 }
475 % @! is an end-of-sentence bang.
476 \def\!{!\spacefactor=3000 }
478 % @? is an end-of-sentence query.
479 \def\?{?\spacefactor=3000 }
481 % @w prevents a word break. Without the \leavevmode, @w at the
482 % beginning of a paragraph, when TeX is still in vertical mode, would
483 % produce a whole line of output instead of starting the paragraph.
484 \def\w#1{\leavevmode\hbox{#1}}
486 % @group ... @end group forces ... to be all on one page, by enclosing
487 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
488 % to keep its height that of a normal line. According to the rules for
489 % \topskip (p.114 of the TeXbook), the glue inserted is
490 % max (\topskip - \ht (first item), 0). If that height is large,
491 % therefore, no glue is inserted, and the space between the headline and
492 % the text is small, which looks bad.
494 \def\group{\begingroup
495 \ifnum\catcode13=\active \else
496 \errhelp = \groupinvalidhelp
497 \errmessage{@group invalid in context where filling is enabled}%
500 % The \vtop we start below produces a box with normal height and large
501 % depth; thus, TeX puts \baselineskip glue before it, and (when the
502 % next line of text is done) \lineskip glue after it. (See p.82 of
503 % the TeXbook.) Thus, space below is not quite equal to space
504 % above. But it's pretty close.
505 \def\Egroup{%
506 \egroup % End the \vtop.
507 \endgroup % End the \group.
510 \vtop\bgroup
511 % We have to put a strut on the last line in case the @group is in
512 % the midst of an example, rather than completely enclosing it.
513 % Otherwise, the interline space between the last line of the group
514 % and the first line afterwards is too small. But we can't put the
515 % strut in \Egroup, since there it would be on a line by itself.
516 % Hence this just inserts a strut at the beginning of each line.
517 \everypar = {\strut}%
519 % Since we have a strut on every line, we don't need any of TeX's
520 % normal interline spacing.
521 \offinterlineskip
523 % OK, but now we have to do something about blank
524 % lines in the input in @example-like environments, which normally
525 % just turn into \lisppar, which will insert no space now that we've
526 % turned off the interline space. Simplest is to make them be an
527 % empty paragraph.
528 \ifx\par\lisppar
529 \edef\par{\leavevmode \par}%
531 % Reset ^^M's definition to new definition of \par.
532 \obeylines
535 % Do @comment since we are called inside an environment such as
536 % @example, where each end-of-line in the input causes an
537 % end-of-line in the output. We don't want the end-of-line after
538 % the `@group' to put extra space in the output. Since @group
539 % should appear on a line by itself (according to the Texinfo
540 % manual), we don't worry about eating any user text.
541 \comment
544 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
545 % message, so this ends up printing `@group can only ...'.
547 \newhelp\groupinvalidhelp{%
548 group can only be used in environments such as @example,^^J%
549 where each line of input produces a line of output.}
551 % @need space-in-mils
552 % forces a page break if there is not space-in-mils remaining.
554 \newdimen\mil \mil=0.001in
556 \def\need{\parsearg\needx}
558 % Old definition--didn't work.
559 %\def\needx #1{\par %
560 %% This method tries to make TeX break the page naturally
561 %% if the depth of the box does not fit.
562 %{\baselineskip=0pt%
563 %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
564 %\prevdepth=-1000pt
567 \def\needx#1{%
568 % Go into vertical mode, so we don't make a big box in the middle of a
569 % paragraph.
570 \par
572 % Don't add any leading before our big empty box, but allow a page
573 % break, since the best break might be right here.
574 \allowbreak
575 \nointerlineskip
576 \vtop to #1\mil{\vfil}%
578 % TeX does not even consider page breaks if a penalty added to the
579 % main vertical list is 10000 or more. But in order to see if the
580 % empty box we just added fits on the page, we must make it consider
581 % page breaks. On the other hand, we don't want to actually break the
582 % page after the empty box. So we use a penalty of 9999.
584 % There is an extremely small chance that TeX will actually break the
585 % page at this \penalty, if there are no other feasible breakpoints in
586 % sight. (If the user is using lots of big @group commands, which
587 % almost-but-not-quite fill up a page, TeX will have a hard time doing
588 % good page breaking, for example.) However, I could not construct an
589 % example where a page broke at this \penalty; if it happens in a real
590 % document, then we can reconsider our strategy.
591 \penalty9999
593 % Back up by the size of the box, whether we did a page break or not.
594 \kern -#1\mil
596 % Do not allow a page break right after this kern.
597 \nobreak
600 % @br forces paragraph break
602 \let\br = \par
604 % @dots{} output an ellipsis using the current font.
605 % We do .5em per period so that it has the same spacing in a typewriter
606 % font as three actual period characters.
608 \def\dots{\hbox to 1.5em{%
609 \hskip 0pt plus 0.25fil minus 0.25fil
610 .\hss.\hss.%
611 \hskip 0pt plus 0.5fil minus 0.5fil
614 % @enddots{} is an end-of-sentence ellipsis.
616 \def\enddots{%
617 \hbox to 2em{%
618 \hskip 0pt plus 0.25fil minus 0.25fil
619 .\hss.\hss.\hss.%
620 \hskip 0pt plus 0.5fil minus 0.5fil
622 \spacefactor=3000
626 % @page forces the start of a new page
628 \def\page{\par\vfill\supereject}
630 % @exdent text....
631 % outputs text on separate line in roman font, starting at standard page margin
633 % This records the amount of indent in the innermost environment.
634 % That's how much \exdent should take out.
635 \newskip\exdentamount
637 % This defn is used inside fill environments such as @defun.
638 \def\exdent{\parsearg\exdentyyy}
639 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
641 % This defn is used inside nofill environments such as @example.
642 \def\nofillexdent{\parsearg\nofillexdentyyy}
643 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
644 \leftline{\hskip\leftskip{\rm#1}}}}
646 % @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
648 \def\inmargin#1{%
649 \strut\vadjust{\nobreak\kern-\strutdepth
650 \vtop to \strutdepth{\baselineskip\strutdepth\vss
651 \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
652 \newskip\inmarginspacing \inmarginspacing=1cm
653 \def\strutdepth{\dp\strutbox}
655 %\hbox{{\rm#1}}\hfil\break}}
657 % @include file insert text of that file as input.
658 % Allow normal characters that we make active in the argument (a file name).
659 \def\include{\begingroup
660 \catcode`\\=12
661 \catcode`~=12
662 \catcode`^=12
663 \catcode`_=12
664 \catcode`|=12
665 \catcode`<=12
666 \catcode`>=12
667 \catcode`+=12
668 \parsearg\includezzz}
669 % Restore active chars for included file.
670 \def\includezzz#1{\endgroup\begingroup
671 % Read the included file in a group so nested @include's work.
672 \def\thisfile{#1}%
673 \input\thisfile
674 \endgroup}
676 \def\thisfile{}
678 % @center line outputs that line, centered
680 \def\center{\parsearg\centerzzz}
681 \def\centerzzz #1{{\advance\hsize by -\leftskip
682 \advance\hsize by -\rightskip
683 \centerline{#1}}}
685 % @sp n outputs n lines of vertical space
687 \def\sp{\parsearg\spxxx}
688 \def\spxxx #1{\vskip #1\baselineskip}
690 % @comment ...line which is ignored...
691 % @c is the same as @comment
692 % @ignore ... @end ignore is another way to write a comment
694 \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
695 \parsearg \commentxxx}
697 \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
699 \let\c=\comment
701 % @paragraphindent is defined for the Info formatting commands only.
702 \let\paragraphindent=\comment
704 % Prevent errors for section commands.
705 % Used in @ignore and in failing conditionals.
706 \def\ignoresections{%
707 \let\chapter=\relax
708 \let\unnumbered=\relax
709 \let\top=\relax
710 \let\unnumberedsec=\relax
711 \let\unnumberedsection=\relax
712 \let\unnumberedsubsec=\relax
713 \let\unnumberedsubsection=\relax
714 \let\unnumberedsubsubsec=\relax
715 \let\unnumberedsubsubsection=\relax
716 \let\section=\relax
717 \let\subsec=\relax
718 \let\subsubsec=\relax
719 \let\subsection=\relax
720 \let\subsubsection=\relax
721 \let\appendix=\relax
722 \let\appendixsec=\relax
723 \let\appendixsection=\relax
724 \let\appendixsubsec=\relax
725 \let\appendixsubsection=\relax
726 \let\appendixsubsubsec=\relax
727 \let\appendixsubsubsection=\relax
728 \let\contents=\relax
729 \let\smallbook=\relax
730 \let\titlepage=\relax
733 % Used in nested conditionals, where we have to parse the Texinfo source
734 % and so want to turn off most commands, in case they are used
735 % incorrectly.
737 \def\ignoremorecommands{%
738 \let\defcodeindex = \relax
739 \let\defcv = \relax
740 \let\deffn = \relax
741 \let\deffnx = \relax
742 \let\defindex = \relax
743 \let\defivar = \relax
744 \let\defmac = \relax
745 \let\defmethod = \relax
746 \let\defop = \relax
747 \let\defopt = \relax
748 \let\defspec = \relax
749 \let\deftp = \relax
750 \let\deftypefn = \relax
751 \let\deftypefun = \relax
752 \let\deftypevar = \relax
753 \let\deftypevr = \relax
754 \let\defun = \relax
755 \let\defvar = \relax
756 \let\defvr = \relax
757 \let\ref = \relax
758 \let\xref = \relax
759 \let\printindex = \relax
760 \let\pxref = \relax
761 \let\settitle = \relax
762 \let\setchapternewpage = \relax
763 \let\setchapterstyle = \relax
764 \let\everyheading = \relax
765 \let\evenheading = \relax
766 \let\oddheading = \relax
767 \let\everyfooting = \relax
768 \let\evenfooting = \relax
769 \let\oddfooting = \relax
770 \let\headings = \relax
771 \let\include = \relax
772 \let\lowersections = \relax
773 \let\down = \relax
774 \let\raisesections = \relax
775 \let\up = \relax
776 \let\set = \relax
777 \let\clear = \relax
778 \let\item = \relax
781 % Ignore @ignore ... @end ignore.
783 \def\ignore{\doignore{ignore}}
785 % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
787 \def\ifinfo{\doignore{ifinfo}}
788 \def\ifhtml{\doignore{ifhtml}}
789 \def\ifnottex{\doignore{ifnottex}}
790 \def\html{\doignore{html}}
791 \def\menu{\doignore{menu}}
792 \def\direntry{\doignore{direntry}}
794 % Also ignore @macro ... @end macro. The user must run texi2dvi,
795 % which runs makeinfo to do macro expansion. Ignore @unmacro, too.
796 \def\macro{\doignore{macro}}
797 \def\macrocsname{macro}
798 \let\unmacro = \comment
801 % @dircategory CATEGORY -- specify a category of the dir file
802 % which this file should belong to. Ignore this in TeX.
803 \let\dircategory = \comment
805 % Ignore text until a line `@end #1'.
807 \def\doignore#1{\begingroup
808 % Don't complain about control sequences we have declared \outer.
809 \ignoresections
811 % Define a command to swallow text until we reach `@end #1'.
812 % This @ is a catcode 12 token (that is the normal catcode of @ in
813 % this texinfo.tex file). We change the catcode of @ below to match.
814 \long\def\doignoretext##1@end #1{\enddoignore}%
816 % Make sure that spaces turn into tokens that match what \doignoretext wants.
817 \catcode32 = 10
819 % Ignore braces, too, so mismatched braces don't cause trouble.
820 \catcode`\{ = 9
821 \catcode`\} = 9
823 % We must not have @c interpreted as a control sequence.
824 \catcode`\@ = 12
826 % Make the letter c a comment character so that the rest of the line
827 % will be ignored. This way, the document can have (for example)
828 % @c @end ifinfo
829 % and the @end ifinfo will be properly ignored.
830 % (We've just changed @ to catcode 12.)
832 % But we can't do this if #1 is `macro', since that actually contains a c.
833 % Happily, none of the other conditionals have the letter `c' in their names!
834 \def\temp{#1}%
835 \ifx\temp\macrocsname \else
836 \catcode`\c = 14
839 % And now expand that command.
840 \doignoretext
843 % What we do to finish off ignored text.
845 \def\enddoignore{\endgroup\ignorespaces}%
847 \newif\ifwarnedobs\warnedobsfalse
848 \def\obstexwarn{%
849 \ifwarnedobs\relax\else
850 % We need to warn folks that they may have trouble with TeX 3.0.
851 % This uses \immediate\write16 rather than \message to get newlines.
852 \immediate\write16{}
853 \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
854 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
855 \immediate\write16{If you are running another version of TeX, relax.}
856 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
857 \immediate\write16{ Then upgrade your TeX installation if you can.}
858 \immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
859 \immediate\write16{If you are stuck with version 3.0, run the}
860 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
861 \immediate\write16{ to use a workaround.}
862 \immediate\write16{}
863 \global\warnedobstrue
867 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
868 % workaround (which requires the file ``dummy.tfm'' to be installed),
869 % uncomment the following line:
870 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
872 % Ignore text, except that we keep track of conditional commands for
873 % purposes of nesting, up to an `@end #1' command.
875 \def\nestedignore#1{%
876 \obstexwarn
877 % We must actually expand the ignored text to look for the @end
878 % command, so that nested ignore constructs work. Thus, we put the
879 % text into a \vbox and then do nothing with the result. To minimize
880 % the change of memory overflow, we follow the approach outlined on
881 % page 401 of the TeXbook: make the current font be a dummy font.
883 \setbox0 = \vbox\bgroup
884 % Don't complain about control sequences we have declared \outer.
885 \ignoresections
887 % Define `@end #1' to end the box, which will in turn undefine the
888 % @end command again.
889 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
891 % We are going to be parsing Texinfo commands. Most cause no
892 % trouble when they are used incorrectly, but some commands do
893 % complicated argument parsing or otherwise get confused, so we
894 % undefine them.
896 % We can't do anything about stray @-signs, unfortunately;
897 % they'll produce `undefined control sequence' errors.
898 \ignoremorecommands
900 % Set the current font to be \nullfont, a TeX primitive, and define
901 % all the font commands to also use \nullfont. We don't use
902 % dummy.tfm, as suggested in the TeXbook, because not all sites
903 % might have that installed. Therefore, math mode will still
904 % produce output, but that should be an extremely small amount of
905 % stuff compared to the main input.
907 \nullfont
908 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
909 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
910 \let\tensf = \nullfont
911 % Similarly for index fonts (mostly for their use in
912 % smallexample)
913 \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
914 \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
915 \let\indsf = \nullfont
917 % Don't complain when characters are missing from the fonts.
918 \tracinglostchars = 0
920 % Don't bother to do space factor calculations.
921 \frenchspacing
923 % Don't report underfull hboxes.
924 \hbadness = 10000
926 % Do minimal line-breaking.
927 \pretolerance = 10000
929 % Do not execute instructions in @tex
930 \def\tex{\doignore{tex}}%
933 % @set VAR sets the variable VAR to an empty value.
934 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
936 % Since we want to separate VAR from REST-OF-LINE (which might be
937 % empty), we can't just use \parsearg; we have to insert a space of our
938 % own to delimit the rest of the line, and then take it out again if we
939 % didn't need it. Make sure the catcode of space is correct to avoid
940 % losing inside @example, for instance.
942 \def\set{\begingroup\catcode` =10
943 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
944 \parsearg\setxxx}
945 \def\setxxx#1{\setyyy#1 \endsetyyy}
946 \def\setyyy#1 #2\endsetyyy{%
947 \def\temp{#2}%
948 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
949 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
951 \endgroup
953 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
954 % \next or other control sequences that we've defined might get us into
955 % an infinite loop. Consider `@set foo @cite{bar}'.
956 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
958 % @clear VAR clears (i.e., unsets) the variable VAR.
960 \def\clear{\parsearg\clearxxx}
961 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
963 % @value{foo} gets the text saved in variable foo.
965 \def\value{\begingroup
966 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
967 \valuexxx}
968 \def\valuexxx#1{%
969 \expandafter\ifx\csname SET#1\endcsname\relax
970 {\{No value for ``#1''\}}%
971 \else
972 \csname SET#1\endcsname
974 \endgroup}
976 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
977 % with @set.
979 \def\ifset{\parsearg\ifsetxxx}
980 \def\ifsetxxx #1{%
981 \expandafter\ifx\csname SET#1\endcsname\relax
982 \expandafter\ifsetfail
983 \else
984 \expandafter\ifsetsucceed
987 \def\ifsetsucceed{\conditionalsucceed{ifset}}
988 \def\ifsetfail{\nestedignore{ifset}}
989 \defineunmatchedend{ifset}
991 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
992 % defined with @set, or has been undefined with @clear.
994 \def\ifclear{\parsearg\ifclearxxx}
995 \def\ifclearxxx #1{%
996 \expandafter\ifx\csname SET#1\endcsname\relax
997 \expandafter\ifclearsucceed
998 \else
999 \expandafter\ifclearfail
1002 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
1003 \def\ifclearfail{\nestedignore{ifclear}}
1004 \defineunmatchedend{ifclear}
1006 % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
1007 % following, through the first @end iftex (etc.). Make `@end iftex'
1008 % (etc.) valid only after an @iftex.
1010 \def\iftex{\conditionalsucceed{iftex}}
1011 \def\ifnothtml{\conditionalsucceed{ifnothtml}}
1012 \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
1013 \defineunmatchedend{iftex}
1014 \defineunmatchedend{ifnothtml}
1015 \defineunmatchedend{ifnotinfo}
1017 % We can't just want to start a group at @iftex (for example) and end it
1018 % at @end iftex, since then @set commands inside the conditional have no
1019 % effect (they'd get reverted at the end of the group). So we must
1020 % define \Eiftex to redefine itself to be its previous value. (We can't
1021 % just define it to fail again with an ``unmatched end'' error, since
1022 % the @ifset might be nested.)
1024 \def\conditionalsucceed#1{%
1025 \edef\temp{%
1026 % Remember the current value of \E#1.
1027 \let\nece{prevE#1} = \nece{E#1}%
1029 % At the `@end #1', redefine \E#1 to be its previous value.
1030 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
1032 \temp
1035 % We need to expand lots of \csname's, but we don't want to expand the
1036 % control sequences after we've constructed them.
1038 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
1040 % @asis just yields its argument. Used with @table, for example.
1042 \def\asis#1{#1}
1044 % @math means output in math mode.
1045 % We don't use $'s directly in the definition of \math because control
1046 % sequences like \math are expanded when the toc file is written. Then,
1047 % we read the toc file back, the $'s will be normal characters (as they
1048 % should be, according to the definition of Texinfo). So we must use a
1049 % control sequence to switch into and out of math mode.
1051 % This isn't quite enough for @math to work properly in indices, but it
1052 % seems unlikely it will ever be needed there.
1054 \let\implicitmath = $
1055 \def\math#1{\implicitmath #1\implicitmath}
1057 % @bullet and @minus need the same treatment as @math, just above.
1058 \def\bullet{\implicitmath\ptexbullet\implicitmath}
1059 \def\minus{\implicitmath-\implicitmath}
1061 \def\node{\ENVcheck\parsearg\nodezzz}
1062 \def\nodezzz#1{\nodexxx [#1,]}
1063 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
1064 \let\nwnode=\node
1065 \let\lastnode=\relax
1067 \def\donoderef{\ifx\lastnode\relax\else
1068 \expandafter\expandafter\expandafter\setref{\lastnode}\fi
1069 \global\let\lastnode=\relax}
1071 \def\unnumbnoderef{\ifx\lastnode\relax\else
1072 \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
1073 \global\let\lastnode=\relax}
1075 \def\appendixnoderef{\ifx\lastnode\relax\else
1076 \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
1077 \global\let\lastnode=\relax}
1079 % @refill is a no-op.
1080 \let\refill=\relax
1082 % @setfilename is done at the beginning of every texinfo file.
1083 % So open here the files we need to have open while reading the input.
1084 % This makes it possible to make a .fmt file for texinfo.
1085 \def\setfilename{%
1086 \readauxfile
1087 \opencontents
1088 \openindices
1089 \fixbackslash % Turn off hack to swallow `\input texinfo'.
1090 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
1092 % If texinfo.cnf is present on the system, read it.
1093 % Useful for site-wide @afourpaper, etc.
1094 % Just to be on the safe side, close the input stream before the \input.
1095 \openin 1 texinfo.cnf
1096 \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
1097 \closein1
1098 \temp
1100 \comment % Ignore the actual filename.
1103 % @bye.
1104 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1106 % \def\macro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\macroxxx}
1107 % \def\macroxxx#1#2 \end macro{%
1108 % \expandafter\gdef\macrotemp#1{#2}%
1109 % \endgroup}
1111 %\def\linemacro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\linemacroxxx}
1112 %\def\linemacroxxx#1#2 \end linemacro{%
1113 %\let\parsearg=\relax
1114 %\edef\macrotempx{\csname M\butfirst\expandafter\string\macrotemp\endcsname}%
1115 %\expandafter\xdef\macrotemp{\parsearg\macrotempx}%
1116 %\expandafter\gdef\macrotempx#1{#2}%
1117 %\endgroup}
1119 %\def\butfirst#1{}
1122 \message{fonts,}
1124 % Font-change commands.
1126 % Texinfo supports the sans serif font style, which plain TeX does not.
1127 % So we set up a \sf analogous to plain's \rm, etc.
1128 \newfam\sffam
1129 \def\sf{\fam=\sffam \tensf}
1130 \let\li = \sf % Sometimes we call it \li, not \sf.
1132 % We don't need math for this one.
1133 \def\ttsl{\tenttsl}
1135 % Use Computer Modern fonts at \magstephalf (11pt).
1136 \newcount\mainmagstep
1137 \mainmagstep=\magstephalf
1139 % Set the font macro #1 to the font named #2, adding on the
1140 % specified font prefix (normally `cm').
1141 % #3 is the font's design size, #4 is a scale factor
1142 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1144 % Use cm as the default font prefix.
1145 % To specify the font prefix, you must define \fontprefix
1146 % before you read in texinfo.tex.
1147 \ifx\fontprefix\undefined
1148 \def\fontprefix{cm}
1150 % Support font families that don't use the same naming scheme as CM.
1151 \def\rmshape{r}
1152 \def\rmbshape{bx} %where the normal face is bold
1153 \def\bfshape{b}
1154 \def\bxshape{bx}
1155 \def\ttshape{tt}
1156 \def\ttbshape{tt}
1157 \def\ttslshape{sltt}
1158 \def\itshape{ti}
1159 \def\itbshape{bxti}
1160 \def\slshape{sl}
1161 \def\slbshape{bxsl}
1162 \def\sfshape{ss}
1163 \def\sfbshape{ss}
1164 \def\scshape{csc}
1165 \def\scbshape{csc}
1167 \ifx\bigger\relax
1168 \let\mainmagstep=\magstep1
1169 \setfont\textrm\rmshape{12}{1000}
1170 \setfont\texttt\ttshape{12}{1000}
1171 \else
1172 \setfont\textrm\rmshape{10}{\mainmagstep}
1173 \setfont\texttt\ttshape{10}{\mainmagstep}
1175 % Instead of cmb10, you many want to use cmbx10.
1176 % cmbx10 is a prettier font on its own, but cmb10
1177 % looks better when embedded in a line with cmr10.
1178 \setfont\textbf\bfshape{10}{\mainmagstep}
1179 \setfont\textit\itshape{10}{\mainmagstep}
1180 \setfont\textsl\slshape{10}{\mainmagstep}
1181 \setfont\textsf\sfshape{10}{\mainmagstep}
1182 \setfont\textsc\scshape{10}{\mainmagstep}
1183 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1184 \font\texti=cmmi10 scaled \mainmagstep
1185 \font\textsy=cmsy10 scaled \mainmagstep
1187 % A few fonts for @defun, etc.
1188 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1189 \setfont\deftt\ttshape{10}{\magstep1}
1190 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1192 % Fonts for indices and small examples (9pt).
1193 % We actually use the slanted font rather than the italic,
1194 % because texinfo normally uses the slanted fonts for that.
1195 % Do not make many font distinctions in general in the index, since they
1196 % aren't very useful.
1197 \setfont\ninett\ttshape{9}{1000}
1198 \setfont\indrm\rmshape{9}{1000}
1199 \setfont\indit\slshape{9}{1000}
1200 \let\indsl=\indit
1201 \let\indtt=\ninett
1202 \let\indttsl=\ninett
1203 \let\indsf=\indrm
1204 \let\indbf=\indrm
1205 \setfont\indsc\scshape{10}{900}
1206 \font\indi=cmmi9
1207 \font\indsy=cmsy9
1209 % Fonts for title page:
1210 \setfont\titlerm\rmbshape{12}{\magstep3}
1211 \setfont\titleit\itbshape{10}{\magstep4}
1212 \setfont\titlesl\slbshape{10}{\magstep4}
1213 \setfont\titlett\ttbshape{12}{\magstep3}
1214 \setfont\titlettsl\ttslshape{10}{\magstep4}
1215 \setfont\titlesf\sfbshape{17}{\magstep1}
1216 \let\titlebf=\titlerm
1217 \setfont\titlesc\scbshape{10}{\magstep4}
1218 \font\titlei=cmmi12 scaled \magstep3
1219 \font\titlesy=cmsy10 scaled \magstep4
1220 \def\authorrm{\secrm}
1222 % Chapter (and unnumbered) fonts (17.28pt).
1223 \setfont\chaprm\rmbshape{12}{\magstep2}
1224 \setfont\chapit\itbshape{10}{\magstep3}
1225 \setfont\chapsl\slbshape{10}{\magstep3}
1226 \setfont\chaptt\ttbshape{12}{\magstep2}
1227 \setfont\chapttsl\ttslshape{10}{\magstep3}
1228 \setfont\chapsf\sfbshape{17}{1000}
1229 \let\chapbf=\chaprm
1230 \setfont\chapsc\scbshape{10}{\magstep3}
1231 \font\chapi=cmmi12 scaled \magstep2
1232 \font\chapsy=cmsy10 scaled \magstep3
1234 % Section fonts (14.4pt).
1235 \setfont\secrm\rmbshape{12}{\magstep1}
1236 \setfont\secit\itbshape{10}{\magstep2}
1237 \setfont\secsl\slbshape{10}{\magstep2}
1238 \setfont\sectt\ttbshape{12}{\magstep1}
1239 \setfont\secttsl\ttslshape{10}{\magstep2}
1240 \setfont\secsf\sfbshape{12}{\magstep1}
1241 \let\secbf\secrm
1242 \setfont\secsc\scbshape{10}{\magstep2}
1243 \font\seci=cmmi12 scaled \magstep1
1244 \font\secsy=cmsy10 scaled \magstep2
1246 % \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
1247 % \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
1248 % \setfont\ssecsl\slshape{10}{\magstep1}
1249 % \setfont\ssectt\ttshape{10}{\magstep1}
1250 % \setfont\ssecsf\sfshape{10}{\magstep1}
1252 %\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
1253 %\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
1254 %\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
1255 %\setfont\ssectt\ttshape{10}{1315}
1256 %\setfont\ssecsf\sfshape{10}{1315}
1258 %\let\ssecbf=\ssecrm
1260 % Subsection fonts (13.15pt).
1261 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1262 \setfont\ssecit\itbshape{10}{1315}
1263 \setfont\ssecsl\slbshape{10}{1315}
1264 \setfont\ssectt\ttbshape{12}{\magstephalf}
1265 \setfont\ssecttsl\ttslshape{10}{1315}
1266 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1267 \let\ssecbf\ssecrm
1268 \setfont\ssecsc\scbshape{10}{\magstep1}
1269 \font\sseci=cmmi12 scaled \magstephalf
1270 \font\ssecsy=cmsy10 scaled 1315
1271 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1272 % but that is not a standard magnification.
1274 % In order for the font changes to affect most math symbols and letters,
1275 % we have to define the \textfont of the standard families. Since
1276 % texinfo doesn't allow for producing subscripts and superscripts, we
1277 % don't bother to reset \scriptfont and \scriptscriptfont (which would
1278 % also require loading a lot more fonts).
1280 \def\resetmathfonts{%
1281 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1282 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1283 \textfont\ttfam = \tentt \textfont\sffam = \tensf
1287 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1288 % of just \STYLE. We do this so that font changes will continue to work
1289 % in math mode, where it is the current \fam that is relevant in most
1290 % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
1291 % \tenbf}, for example. By redefining \tenbf, we obviate the need to
1292 % redefine \bf itself.
1293 \def\textfonts{%
1294 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1295 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1296 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1297 \resetmathfonts}
1298 \def\titlefonts{%
1299 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
1300 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
1301 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
1302 \let\tenttsl=\titlettsl
1303 \resetmathfonts \setleading{25pt}}
1304 \def\titlefont#1{{\titlefonts\rm #1}}
1305 \def\chapfonts{%
1306 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1307 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1308 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1309 \resetmathfonts \setleading{19pt}}
1310 \def\secfonts{%
1311 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1312 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1313 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1314 \resetmathfonts \setleading{16pt}}
1315 \def\subsecfonts{%
1316 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1317 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1318 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1319 \resetmathfonts \setleading{15pt}}
1320 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1321 \def\indexfonts{%
1322 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
1323 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
1324 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
1325 \resetmathfonts \setleading{12pt}}
1327 % Set up the default fonts, so we can use them for creating boxes.
1329 \textfonts
1331 % Define these so they can be easily changed for other fonts.
1332 \def\angleleft{$\langle$}
1333 \def\angleright{$\rangle$}
1335 % Count depth in font-changes, for error checks
1336 \newcount\fontdepth \fontdepth=0
1338 % Fonts for short table of contents.
1339 \setfont\shortcontrm\rmshape{12}{1000}
1340 \setfont\shortcontbf\bxshape{12}{1000}
1341 \setfont\shortcontsl\slshape{12}{1000}
1343 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1344 %% serif) and @ii for TeX italic
1346 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1347 % unless the following character is such as not to need one.
1348 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1349 \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
1351 \let\i=\smartitalic
1352 \let\var=\smartitalic
1353 \let\dfn=\smartitalic
1354 \let\emph=\smartitalic
1355 \let\cite=\smartitalic
1357 \def\b#1{{\bf #1}}
1358 \let\strong=\b
1360 % We can't just use \exhyphenpenalty, because that only has effect at
1361 % the end of a paragraph. Restore normal hyphenation at the end of the
1362 % group within which \nohyphenation is presumably called.
1364 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1365 \def\restorehyphenation{\hyphenchar\font = `- }
1367 \def\t#1{%
1368 {\tt \rawbackslash \frenchspacing #1}%
1369 \null
1371 \let\ttfont=\t
1372 \def\samp#1{`\tclose{#1}'\null}
1373 \setfont\smallrm\rmshape{8}{1000}
1374 \font\smallsy=cmsy9
1375 \def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
1376 \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
1377 \vbox{\hrule\kern-0.4pt
1378 \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
1379 \kern-0.4pt\hrule}%
1380 \kern-.06em\raise0.4pt\hbox{\angleright}}}}
1381 % The old definition, with no lozenge:
1382 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1383 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1385 \let\file=\samp
1387 % @code is a modification of @t,
1388 % which makes spaces the same size as normal in the surrounding text.
1389 \def\tclose#1{%
1391 % Change normal interword space to be same as for the current font.
1392 \spaceskip = \fontdimen2\font
1394 % Switch to typewriter.
1397 % But `\ ' produces the large typewriter interword space.
1398 \def\ {{\spaceskip = 0pt{} }}%
1400 % Turn off hyphenation.
1401 \nohyphenation
1403 \rawbackslash
1404 \frenchspacing
1407 \null
1410 % We *must* turn on hyphenation at `-' and `_' in \code.
1411 % Otherwise, it is too hard to avoid overfull hboxes
1412 % in the Emacs manual, the Library manual, etc.
1414 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1415 % both hyphenation at - and hyphenation within words.
1416 % We must therefore turn them both off (\tclose does that)
1417 % and arrange explicitly to hyphenate at a dash.
1418 % -- rms.
1420 \catcode`\-=\active
1421 \catcode`\_=\active
1422 \catcode`\|=\active
1423 \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
1424 % The following is used by \doprintindex to insure that long function names
1425 % wrap around. It is necessary for - and _ to be active before the index is
1426 % read from the file, as \entry parses the arguments long before \code is
1427 % ever called. -- mycroft
1428 % _ is always active; and it shouldn't be \let = to an _ that is a
1429 % subscript character anyway. Then, @cindex @samp{_} (for example)
1430 % fails. --karl
1431 \global\def\indexbreaks{%
1432 \catcode`\-=\active \let-\realdash
1436 \def\realdash{-}
1437 \def\codedash{-\discretionary{}{}{}}
1438 \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
1439 \def\codex #1{\tclose{#1}\endgroup}
1441 %\let\exp=\tclose %Was temporary
1443 % @kbd is like @code, except that if the argument is just one @key command,
1444 % then @kbd has no effect.
1446 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
1447 % `example' (@kbd uses ttsl only inside of @example and friends),
1448 % or `code' (@kbd uses normal tty font always).
1449 \def\kbdinputstyle{\parsearg\kbdinputstylexxx}
1450 \def\kbdinputstylexxx#1{%
1451 \def\arg{#1}%
1452 \ifx\arg\worddistinct
1453 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
1454 \else\ifx\arg\wordexample
1455 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
1456 \else\ifx\arg\wordcode
1457 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
1458 \fi\fi\fi
1460 \def\worddistinct{distinct}
1461 \def\wordexample{example}
1462 \def\wordcode{code}
1464 % Default is kbdinputdistinct. (Too much of a hassle to call the macro,
1465 % the catcodes are wrong for parsearg to work.)
1466 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
1468 \def\xkey{\key}
1469 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1470 \ifx\one\xkey\ifx\threex\three \key{#2}%
1471 \else{\tclose{\kbdfont\look}}\fi
1472 \else{\tclose{\kbdfont\look}}\fi}
1474 % @url. Quotes do not seem necessary, so use \code.
1475 \let\url=\code
1477 % @uref (abbreviation for `urlref') takes an optional second argument
1478 % specifying the text to display. First (mandatory) arg is the url.
1479 % Perhaps eventually put in a hypertex \special here.
1481 \def\uref#1{\urefxxx #1,,\finish}
1482 \def\urefxxx#1,#2,#3\finish{%
1483 \setbox0 = \hbox{\ignorespaces #2}%
1484 \ifdim\wd0 > 0pt
1485 \unhbox0\ (\code{#1})%
1486 \else
1487 \code{#1}%
1491 % rms does not like the angle brackets --karl, 17may97.
1492 % So now @email is just like @uref.
1493 %\def\email#1{\angleleft{\tt #1}\angleright}
1494 \let\email=\uref
1496 % Check if we are currently using a typewriter font. Since all the
1497 % Computer Modern typewriter fonts have zero interword stretch (and
1498 % shrink), and it is reasonable to expect all typewriter fonts to have
1499 % this property, we can check that font parameter.
1501 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1503 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1504 % argument is to make the input look right: @dmn{pt} instead of
1505 % @dmn{}pt.
1507 \def\dmn#1{\thinspace #1}
1509 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1511 % @l was never documented to mean ``switch to the Lisp font'',
1512 % and it is not used as such in any manual I can find. We need it for
1513 % Polish suppressed-l. --karl, 22sep96.
1514 %\def\l#1{{\li #1}\null}
1516 \def\r#1{{\rm #1}} % roman font
1517 % Use of \lowercase was suggested.
1518 \def\sc#1{{\smallcaps#1}} % smallcaps font
1519 \def\ii#1{{\it #1}} % italic font
1521 % @pounds{} is a sterling sign.
1522 \def\pounds{{\it\$}}
1525 \message{page headings,}
1527 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1528 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1530 % First the title page. Must do @settitle before @titlepage.
1531 \newif\ifseenauthor
1532 \newif\iffinishedtitlepage
1534 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1535 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1536 \endgroup\page\hbox{}\page}
1538 \def\titlepage{\begingroup \parindent=0pt \textfonts
1539 \let\subtitlerm=\tenrm
1540 % I deinstalled the following change because \cmr12 is undefined.
1541 % This change was not in the ChangeLog anyway. --rms.
1542 % \let\subtitlerm=\cmr12
1543 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1545 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1547 % Leave some space at the very top of the page.
1548 \vglue\titlepagetopglue
1550 % Now you can print the title using @title.
1551 \def\title{\parsearg\titlezzz}%
1552 \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
1553 % print a rule at the page bottom also.
1554 \finishedtitlepagefalse
1555 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1556 % No rule at page bottom unless we print one at the top with @title.
1557 \finishedtitlepagetrue
1559 % Now you can put text using @subtitle.
1560 \def\subtitle{\parsearg\subtitlezzz}%
1561 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1563 % @author should come last, but may come many times.
1564 \def\author{\parsearg\authorzzz}%
1565 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1566 {\authorfont \leftline{##1}}}%
1568 % Most title ``pages'' are actually two pages long, with space
1569 % at the top of the second. We don't want the ragged left on the second.
1570 \let\oldpage = \page
1571 \def\page{%
1572 \iffinishedtitlepage\else
1573 \finishtitlepage
1575 \oldpage
1576 \let\page = \oldpage
1577 \hbox{}}%
1578 % \def\page{\oldpage \hbox{}}
1581 \def\Etitlepage{%
1582 \iffinishedtitlepage\else
1583 \finishtitlepage
1585 % It is important to do the page break before ending the group,
1586 % because the headline and footline are only empty inside the group.
1587 % If we use the new definition of \page, we always get a blank page
1588 % after the title page, which we certainly don't want.
1589 \oldpage
1590 \endgroup
1591 \HEADINGSon
1594 \def\finishtitlepage{%
1595 \vskip4pt \hrule height 2pt width \hsize
1596 \vskip\titlepagebottomglue
1597 \finishedtitlepagetrue
1600 %%% Set up page headings and footings.
1602 \let\thispage=\folio
1604 \newtoks \evenheadline % Token sequence for heading line of even pages
1605 \newtoks \oddheadline % Token sequence for heading line of odd pages
1606 \newtoks \evenfootline % Token sequence for footing line of even pages
1607 \newtoks \oddfootline % Token sequence for footing line of odd pages
1609 % Now make Tex use those variables
1610 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1611 \else \the\evenheadline \fi}}
1612 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1613 \else \the\evenfootline \fi}\HEADINGShook}
1614 \let\HEADINGShook=\relax
1616 % Commands to set those variables.
1617 % For example, this is what @headings on does
1618 % @evenheading @thistitle|@thispage|@thischapter
1619 % @oddheading @thischapter|@thispage|@thistitle
1620 % @evenfooting @thisfile||
1621 % @oddfooting ||@thisfile
1623 \def\evenheading{\parsearg\evenheadingxxx}
1624 \def\oddheading{\parsearg\oddheadingxxx}
1625 \def\everyheading{\parsearg\everyheadingxxx}
1627 \def\evenfooting{\parsearg\evenfootingxxx}
1628 \def\oddfooting{\parsearg\oddfootingxxx}
1629 \def\everyfooting{\parsearg\everyfootingxxx}
1631 {\catcode`\@=0 %
1633 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1634 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1635 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1637 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1638 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1639 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1641 \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
1643 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1644 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1645 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1647 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1648 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1649 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
1651 % Leave some space for the footline. Hopefully ok to assume
1652 % @evenfooting will not be used by itself.
1653 \global\advance\pageheight by -\baselineskip
1654 \global\advance\vsize by -\baselineskip
1657 \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
1659 }% unbind the catcode of @.
1661 % @headings double turns headings on for double-sided printing.
1662 % @headings single turns headings on for single-sided printing.
1663 % @headings off turns them off.
1664 % @headings on same as @headings double, retained for compatibility.
1665 % @headings after turns on double-sided headings after this page.
1666 % @headings doubleafter turns on double-sided headings after this page.
1667 % @headings singleafter turns on single-sided headings after this page.
1668 % By default, they are off at the start of a document,
1669 % and turned `on' after @end titlepage.
1671 \def\headings #1 {\csname HEADINGS#1\endcsname}
1673 \def\HEADINGSoff{
1674 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1675 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1676 \HEADINGSoff
1677 % When we turn headings on, set the page number to 1.
1678 % For double-sided printing, put current file name in lower left corner,
1679 % chapter name on inside top of right hand pages, document
1680 % title on inside top of left hand pages, and page numbers on outside top
1681 % edge of all pages.
1682 \def\HEADINGSdouble{
1683 \global\pageno=1
1684 \global\evenfootline={\hfil}
1685 \global\oddfootline={\hfil}
1686 \global\evenheadline={\line{\folio\hfil\thistitle}}
1687 \global\oddheadline={\line{\thischapter\hfil\folio}}
1688 \global\let\contentsalignmacro = \chapoddpage
1690 \let\contentsalignmacro = \chappager
1692 % For single-sided printing, chapter title goes across top left of page,
1693 % page number on top right.
1694 \def\HEADINGSsingle{
1695 \global\pageno=1
1696 \global\evenfootline={\hfil}
1697 \global\oddfootline={\hfil}
1698 \global\evenheadline={\line{\thischapter\hfil\folio}}
1699 \global\oddheadline={\line{\thischapter\hfil\folio}}
1700 \global\let\contentsalignmacro = \chappager
1702 \def\HEADINGSon{\HEADINGSdouble}
1704 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1705 \let\HEADINGSdoubleafter=\HEADINGSafter
1706 \def\HEADINGSdoublex{%
1707 \global\evenfootline={\hfil}
1708 \global\oddfootline={\hfil}
1709 \global\evenheadline={\line{\folio\hfil\thistitle}}
1710 \global\oddheadline={\line{\thischapter\hfil\folio}}
1711 \global\let\contentsalignmacro = \chapoddpage
1714 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1715 \def\HEADINGSsinglex{%
1716 \global\evenfootline={\hfil}
1717 \global\oddfootline={\hfil}
1718 \global\evenheadline={\line{\thischapter\hfil\folio}}
1719 \global\oddheadline={\line{\thischapter\hfil\folio}}
1720 \global\let\contentsalignmacro = \chappager
1723 % Subroutines used in generating headings
1724 % Produces Day Month Year style of output.
1725 \def\today{\number\day\space
1726 \ifcase\month\or
1727 January\or February\or March\or April\or May\or June\or
1728 July\or August\or September\or October\or November\or December\fi
1729 \space\number\year}
1731 % Use this if you want the Month Day, Year style of output.
1732 %\def\today{\ifcase\month\or
1733 %January\or February\or March\or April\or May\or June\or
1734 %July\or August\or September\or October\or November\or December\fi
1735 %\space\number\day, \number\year}
1737 % @settitle line... specifies the title of the document, for headings
1738 % It generates no output of its own
1740 \def\thistitle{No Title}
1741 \def\settitle{\parsearg\settitlezzz}
1742 \def\settitlezzz #1{\gdef\thistitle{#1}}
1745 \message{tables,}
1746 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1748 % default indentation of table text
1749 \newdimen\tableindent \tableindent=.8in
1750 % default indentation of @itemize and @enumerate text
1751 \newdimen\itemindent \itemindent=.3in
1752 % margin between end of table item and start of table text.
1753 \newdimen\itemmargin \itemmargin=.1in
1755 % used internally for \itemindent minus \itemmargin
1756 \newdimen\itemmax
1758 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1759 % these defs.
1760 % They also define \itemindex
1761 % to index the item name in whatever manner is desired (perhaps none).
1763 \newif\ifitemxneedsnegativevskip
1765 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1767 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1768 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1770 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1771 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1773 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1774 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1776 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1777 \itemzzz {#1}}
1779 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1780 \itemzzz {#1}}
1782 \def\itemzzz #1{\begingroup %
1783 \advance\hsize by -\rightskip
1784 \advance\hsize by -\tableindent
1785 \setbox0=\hbox{\itemfont{#1}}%
1786 \itemindex{#1}%
1787 \nobreak % This prevents a break before @itemx.
1789 % Be sure we are not still in the middle of a paragraph.
1790 %{\parskip = 0in
1791 %\par
1794 % If the item text does not fit in the space we have, put it on a line
1795 % by itself, and do not allow a page break either before or after that
1796 % line. We do not start a paragraph here because then if the next
1797 % command is, e.g., @kindex, the whatsit would get put into the
1798 % horizontal list on a line by itself, resulting in extra blank space.
1799 \ifdim \wd0>\itemmax
1801 % Make this a paragraph so we get the \parskip glue and wrapping,
1802 % but leave it ragged-right.
1803 \begingroup
1804 \advance\leftskip by-\tableindent
1805 \advance\hsize by\tableindent
1806 \advance\rightskip by0pt plus1fil
1807 \leavevmode\unhbox0\par
1808 \endgroup
1810 % We're going to be starting a paragraph, but we don't want the
1811 % \parskip glue -- logically it's part of the @item we just started.
1812 \nobreak \vskip-\parskip
1814 % Stop a page break at the \parskip glue coming up. Unfortunately
1815 % we can't prevent a possible page break at the following
1816 % \baselineskip glue.
1817 \nobreak
1818 \endgroup
1819 \itemxneedsnegativevskipfalse
1820 \else
1821 % The item text fits into the space. Start a paragraph, so that the
1822 % following text (if any) will end up on the same line. Since that
1823 % text will be indented by \tableindent, we make the item text be in
1824 % a zero-width box.
1825 \noindent
1826 \rlap{\hskip -\tableindent\box0}\ignorespaces%
1827 \endgroup%
1828 \itemxneedsnegativevskiptrue%
1832 \def\item{\errmessage{@item while not in a table}}
1833 \def\itemx{\errmessage{@itemx while not in a table}}
1834 \def\kitem{\errmessage{@kitem while not in a table}}
1835 \def\kitemx{\errmessage{@kitemx while not in a table}}
1836 \def\xitem{\errmessage{@xitem while not in a table}}
1837 \def\xitemx{\errmessage{@xitemx while not in a table}}
1839 %% Contains a kludge to get @end[description] to work
1840 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1842 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1843 {\obeylines\obeyspaces%
1844 \gdef\tablex #1^^M{%
1845 \tabley\dontindex#1 \endtabley}}
1847 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1848 {\obeylines\obeyspaces%
1849 \gdef\ftablex #1^^M{%
1850 \tabley\fnitemindex#1 \endtabley
1851 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1852 \let\Etable=\relax}}
1854 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1855 {\obeylines\obeyspaces%
1856 \gdef\vtablex #1^^M{%
1857 \tabley\vritemindex#1 \endtabley
1858 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1859 \let\Etable=\relax}}
1861 \def\dontindex #1{}
1862 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1863 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1865 {\obeyspaces %
1866 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1867 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1869 \def\tablez #1#2#3#4#5#6{%
1870 \aboveenvbreak %
1871 \begingroup %
1872 \def\Edescription{\Etable}% Necessary kludge.
1873 \let\itemindex=#1%
1874 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1875 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1876 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1877 \def\itemfont{#2}%
1878 \itemmax=\tableindent %
1879 \advance \itemmax by -\itemmargin %
1880 \advance \leftskip by \tableindent %
1881 \exdentamount=\tableindent
1882 \parindent = 0pt
1883 \parskip = \smallskipamount
1884 \ifdim \parskip=0pt \parskip=2pt \fi%
1885 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1886 \let\item = \internalBitem %
1887 \let\itemx = \internalBitemx %
1888 \let\kitem = \internalBkitem %
1889 \let\kitemx = \internalBkitemx %
1890 \let\xitem = \internalBxitem %
1891 \let\xitemx = \internalBxitemx %
1894 % This is the counter used by @enumerate, which is really @itemize
1896 \newcount \itemno
1898 \def\itemize{\parsearg\itemizezzz}
1900 \def\itemizezzz #1{%
1901 \begingroup % ended by the @end itemsize
1902 \itemizey {#1}{\Eitemize}
1905 \def\itemizey #1#2{%
1906 \aboveenvbreak %
1907 \itemmax=\itemindent %
1908 \advance \itemmax by -\itemmargin %
1909 \advance \leftskip by \itemindent %
1910 \exdentamount=\itemindent
1911 \parindent = 0pt %
1912 \parskip = \smallskipamount %
1913 \ifdim \parskip=0pt \parskip=2pt \fi%
1914 \def#2{\endgraf\afterenvbreak\endgroup}%
1915 \def\itemcontents{#1}%
1916 \let\item=\itemizeitem}
1918 % Set sfcode to normal for the chars that usually have another value.
1919 % These are `.?!:;,'
1920 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1921 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1923 % \splitoff TOKENS\endmark defines \first to be the first token in
1924 % TOKENS, and \rest to be the remainder.
1926 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1928 % Allow an optional argument of an uppercase letter, lowercase letter,
1929 % or number, to specify the first label in the enumerated list. No
1930 % argument is the same as `1'.
1932 \def\enumerate{\parsearg\enumeratezzz}
1933 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1934 \def\enumeratey #1 #2\endenumeratey{%
1935 \begingroup % ended by the @end enumerate
1937 % If we were given no argument, pretend we were given `1'.
1938 \def\thearg{#1}%
1939 \ifx\thearg\empty \def\thearg{1}\fi
1941 % Detect if the argument is a single token. If so, it might be a
1942 % letter. Otherwise, the only valid thing it can be is a number.
1943 % (We will always have one token, because of the test we just made.
1944 % This is a good thing, since \splitoff doesn't work given nothing at
1945 % all -- the first parameter is undelimited.)
1946 \expandafter\splitoff\thearg\endmark
1947 \ifx\rest\empty
1948 % Only one token in the argument. It could still be anything.
1949 % A ``lowercase letter'' is one whose \lccode is nonzero.
1950 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1951 % not equal to itself.
1952 % Otherwise, we assume it's a number.
1954 % We need the \relax at the end of the \ifnum lines to stop TeX from
1955 % continuing to look for a <number>.
1957 \ifnum\lccode\expandafter`\thearg=0\relax
1958 \numericenumerate % a number (we hope)
1959 \else
1960 % It's a letter.
1961 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1962 \lowercaseenumerate % lowercase letter
1963 \else
1964 \uppercaseenumerate % uppercase letter
1967 \else
1968 % Multiple tokens in the argument. We hope it's a number.
1969 \numericenumerate
1973 % An @enumerate whose labels are integers. The starting integer is
1974 % given in \thearg.
1976 \def\numericenumerate{%
1977 \itemno = \thearg
1978 \startenumeration{\the\itemno}%
1981 % The starting (lowercase) letter is in \thearg.
1982 \def\lowercaseenumerate{%
1983 \itemno = \expandafter`\thearg
1984 \startenumeration{%
1985 % Be sure we're not beyond the end of the alphabet.
1986 \ifnum\itemno=0
1987 \errmessage{No more lowercase letters in @enumerate; get a bigger
1988 alphabet}%
1990 \char\lccode\itemno
1994 % The starting (uppercase) letter is in \thearg.
1995 \def\uppercaseenumerate{%
1996 \itemno = \expandafter`\thearg
1997 \startenumeration{%
1998 % Be sure we're not beyond the end of the alphabet.
1999 \ifnum\itemno=0
2000 \errmessage{No more uppercase letters in @enumerate; get a bigger
2001 alphabet}
2003 \char\uccode\itemno
2007 % Call itemizey, adding a period to the first argument and supplying the
2008 % common last two arguments. Also subtract one from the initial value in
2009 % \itemno, since @item increments \itemno.
2011 \def\startenumeration#1{%
2012 \advance\itemno by -1
2013 \itemizey{#1.}\Eenumerate\flushcr
2016 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
2017 % to @enumerate.
2019 \def\alphaenumerate{\enumerate{a}}
2020 \def\capsenumerate{\enumerate{A}}
2021 \def\Ealphaenumerate{\Eenumerate}
2022 \def\Ecapsenumerate{\Eenumerate}
2024 % Definition of @item while inside @itemize.
2026 \def\itemizeitem{%
2027 \advance\itemno by 1
2028 {\let\par=\endgraf \smallbreak}%
2029 \ifhmode \errmessage{In hmode at itemizeitem}\fi
2030 {\parskip=0in \hskip 0pt
2031 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
2032 \vadjust{\penalty 1200}}%
2033 \flushcr}
2035 % @multitable macros
2036 % Amy Hendrickson, 8/18/94, 3/6/96
2038 % @multitable ... @end multitable will make as many columns as desired.
2039 % Contents of each column will wrap at width given in preamble. Width
2040 % can be specified either with sample text given in a template line,
2041 % or in percent of \hsize, the current width of text on page.
2043 % Table can continue over pages but will only break between lines.
2045 % To make preamble:
2047 % Either define widths of columns in terms of percent of \hsize:
2048 % @multitable @columnfractions .25 .3 .45
2049 % @item ...
2051 % Numbers following @columnfractions are the percent of the total
2052 % current hsize to be used for each column. You may use as many
2053 % columns as desired.
2056 % Or use a template:
2057 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2058 % @item ...
2059 % using the widest term desired in each column.
2061 % For those who want to use more than one line's worth of words in
2062 % the preamble, break the line within one argument and it
2063 % will parse correctly, i.e.,
2065 % @multitable {Column 1 template} {Column 2 template} {Column 3
2066 % template}
2067 % Not:
2068 % @multitable {Column 1 template} {Column 2 template}
2069 % {Column 3 template}
2071 % Each new table line starts with @item, each subsequent new column
2072 % starts with @tab. Empty columns may be produced by supplying @tab's
2073 % with nothing between them for as many times as empty columns are needed,
2074 % ie, @tab@tab@tab will produce two empty columns.
2076 % @item, @tab, @multitable or @end multitable do not need to be on their
2077 % own lines, but it will not hurt if they are.
2079 % Sample multitable:
2081 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2082 % @item first col stuff @tab second col stuff @tab third col
2083 % @item
2084 % first col stuff
2085 % @tab
2086 % second col stuff
2087 % @tab
2088 % third col
2089 % @item first col stuff @tab second col stuff
2090 % @tab Many paragraphs of text may be used in any column.
2092 % They will wrap at the width determined by the template.
2093 % @item@tab@tab This will be in third column.
2094 % @end multitable
2096 % Default dimensions may be reset by user.
2097 % @multitableparskip is vertical space between paragraphs in table.
2098 % @multitableparindent is paragraph indent in table.
2099 % @multitablecolmargin is horizontal space to be left between columns.
2100 % @multitablelinespace is space to leave between table items, baseline
2101 % to baseline.
2102 % 0pt means it depends on current normal line spacing.
2104 \newskip\multitableparskip
2105 \newskip\multitableparindent
2106 \newdimen\multitablecolspace
2107 \newskip\multitablelinespace
2108 \multitableparskip=0pt
2109 \multitableparindent=6pt
2110 \multitablecolspace=12pt
2111 \multitablelinespace=0pt
2113 % Macros used to set up halign preamble:
2115 \let\endsetuptable\relax
2116 \def\xendsetuptable{\endsetuptable}
2117 \let\columnfractions\relax
2118 \def\xcolumnfractions{\columnfractions}
2119 \newif\ifsetpercent
2121 % 2/1/96, to allow fractions to be given with more than one digit.
2122 \def\pickupwholefraction#1 {\global\advance\colcount by1 %
2123 \expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
2124 \setuptable}
2126 \newcount\colcount
2127 \def\setuptable#1{\def\firstarg{#1}%
2128 \ifx\firstarg\xendsetuptable\let\go\relax%
2129 \else
2130 \ifx\firstarg\xcolumnfractions\global\setpercenttrue%
2131 \else
2132 \ifsetpercent
2133 \let\go\pickupwholefraction % In this case arg of setuptable
2134 % is the decimal point before the
2135 % number given in percent of hsize.
2136 % We don't need this so we don't use it.
2137 \else
2138 \global\advance\colcount by1
2139 \setbox0=\hbox{#1 }% Add a normal word space as a separator;
2140 % typically that is always in the input, anyway.
2141 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2142 \fi%
2143 \fi%
2144 \ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
2145 \fi\go}
2147 % multitable syntax
2148 \def\tab{&\hskip1sp\relax} % 2/2/96
2149 % tiny skip here makes sure this column space is
2150 % maintained, even if it is never used.
2152 % @multitable ... @end multitable definitions:
2154 \def\multitable{\parsearg\dotable}
2155 \def\dotable#1{\bgroup
2156 \vskip\parskip
2157 \let\item\crcr
2158 \tolerance=9500
2159 \hbadness=9500
2160 \setmultitablespacing
2161 \parskip=\multitableparskip
2162 \parindent=\multitableparindent
2163 \overfullrule=0pt
2164 \global\colcount=0
2165 \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
2167 % To parse everything between @multitable and @item:
2168 \setuptable#1 \endsetuptable
2170 % \everycr will reset column counter, \colcount, at the end of
2171 % each line. Every column entry will cause \colcount to advance by one.
2172 % The table preamble
2173 % looks at the current \colcount to find the correct column width.
2174 \everycr{\noalign{%
2176 % \filbreak%% keeps underfull box messages off when table breaks over pages.
2177 % Maybe so, but it also creates really weird page breaks when the table
2178 % breaks over pages. Wouldn't \vfil be better? Wait until the problem
2179 % manifests itself, so it can be fixed for real --karl.
2180 \global\colcount=0\relax}}%
2182 % This preamble sets up a generic column definition, which will
2183 % be used as many times as user calls for columns.
2184 % \vtop will set a single line and will also let text wrap and
2185 % continue for many paragraphs if desired.
2186 \halign\bgroup&\global\advance\colcount by 1\relax
2187 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2189 % In order to keep entries from bumping into each other
2190 % we will add a \leftskip of \multitablecolspace to all columns after
2191 % the first one.
2193 % If a template has been used, we will add \multitablecolspace
2194 % to the width of each template entry.
2196 % If the user has set preamble in terms of percent of \hsize we will
2197 % use that dimension as the width of the column, and the \leftskip
2198 % will keep entries from bumping into each other. Table will start at
2199 % left margin and final column will justify at right margin.
2201 % Make sure we don't inherit \rightskip from the outer environment.
2202 \rightskip=0pt
2203 \ifnum\colcount=1
2204 % The first column will be indented with the surrounding text.
2205 \advance\hsize by\leftskip
2206 \else
2207 \ifsetpercent \else
2208 % If user has not set preamble in terms of percent of \hsize
2209 % we will advance \hsize by \multitablecolspace.
2210 \advance\hsize by \multitablecolspace
2212 % In either case we will make \leftskip=\multitablecolspace:
2213 \leftskip=\multitablecolspace
2215 % Ignoring space at the beginning and end avoids an occasional spurious
2216 % blank line, when TeX decides to break the line at the space before the
2217 % box from the multistrut, so the strut ends up on a line by itself.
2218 % For example:
2219 % @multitable @columnfractions .11 .89
2220 % @item @code{#}
2221 % @tab Legal holiday which is valid in major parts of the whole country.
2222 % Is automatically provided with highlighting sequences respectively marking
2223 % characters.
2224 \noindent\ignorespaces##\unskip\multistrut}\cr
2227 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2228 % If so, do nothing. If not, give it an appropriate dimension based on
2229 % current baselineskip.
2230 \ifdim\multitablelinespace=0pt
2231 %% strut to put in table in case some entry doesn't have descenders,
2232 %% to keep lines equally spaced
2233 \let\multistrut = \strut
2234 %% Test to see if parskip is larger than space between lines of
2235 %% table. If not, do nothing.
2236 %% If so, set to same dimension as multitablelinespace.
2237 \else
2238 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2239 width0pt\relax} \fi
2240 \ifdim\multitableparskip>\multitablelinespace
2241 \global\multitableparskip=\multitablelinespace
2242 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2243 %% than skip between lines in the table.
2244 \fi%
2245 \ifdim\multitableparskip=0pt
2246 \global\multitableparskip=\multitablelinespace
2247 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2248 %% than skip between lines in the table.
2249 \fi}
2252 \message{indexing,}
2253 % Index generation facilities
2255 % Define \newwrite to be identical to plain tex's \newwrite
2256 % except not \outer, so it can be used within \newindex.
2257 {\catcode`\@=11
2258 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2260 % \newindex {foo} defines an index named foo.
2261 % It automatically defines \fooindex such that
2262 % \fooindex ...rest of line... puts an entry in the index foo.
2263 % It also defines \fooindfile to be the number of the output channel for
2264 % the file that accumulates this index. The file's extension is foo.
2265 % The name of an index should be no more than 2 characters long
2266 % for the sake of vms.
2268 \def\newindex #1{
2269 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
2270 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2271 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2272 \noexpand\doindex {#1}}
2275 % @defindex foo == \newindex{foo}
2277 \def\defindex{\parsearg\newindex}
2279 % Define @defcodeindex, like @defindex except put all entries in @code.
2281 \def\newcodeindex #1{
2282 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
2283 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2284 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2285 \noexpand\docodeindex {#1}}
2288 \def\defcodeindex{\parsearg\newcodeindex}
2290 % @synindex foo bar makes index foo feed into index bar.
2291 % Do this instead of @defindex foo if you don't want it as a separate index.
2292 % The \closeout helps reduce unnecessary open files; the limit on the
2293 % Acorn RISC OS is a mere 16 files.
2294 \def\synindex#1 #2 {%
2295 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2296 \expandafter\closeout\csname#1indfile\endcsname
2297 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2298 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2299 \noexpand\doindex{#2}}%
2302 % @syncodeindex foo bar similar, but put all entries made for index foo
2303 % inside @code.
2304 \def\syncodeindex#1 #2 {%
2305 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2306 \expandafter\closeout\csname#1indfile\endcsname
2307 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2308 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2309 \noexpand\docodeindex{#2}}%
2312 % Define \doindex, the driver for all \fooindex macros.
2313 % Argument #1 is generated by the calling \fooindex macro,
2314 % and it is "foo", the name of the index.
2316 % \doindex just uses \parsearg; it calls \doind for the actual work.
2317 % This is because \doind is more useful to call from other macros.
2319 % There is also \dosubind {index}{topic}{subtopic}
2320 % which makes an entry in a two-level index such as the operation index.
2322 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
2323 \def\singleindexer #1{\doind{\indexname}{#1}}
2325 % like the previous two, but they put @code around the argument.
2326 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2327 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2329 \def\indexdummies{%
2330 \def\ { }%
2331 % Take care of the plain tex accent commands.
2332 \def\"{\realbackslash "}%
2333 \def\`{\realbackslash `}%
2334 \def\'{\realbackslash '}%
2335 \def\^{\realbackslash ^}%
2336 \def\~{\realbackslash ~}%
2337 \def\={\realbackslash =}%
2338 \def\b{\realbackslash b}%
2339 \def\c{\realbackslash c}%
2340 \def\d{\realbackslash d}%
2341 \def\u{\realbackslash u}%
2342 \def\v{\realbackslash v}%
2343 \def\H{\realbackslash H}%
2344 % Take care of the plain tex special European modified letters.
2345 \def\oe{\realbackslash oe}%
2346 \def\ae{\realbackslash ae}%
2347 \def\aa{\realbackslash aa}%
2348 \def\OE{\realbackslash OE}%
2349 \def\AE{\realbackslash AE}%
2350 \def\AA{\realbackslash AA}%
2351 \def\o{\realbackslash o}%
2352 \def\O{\realbackslash O}%
2353 \def\l{\realbackslash l}%
2354 \def\L{\realbackslash L}%
2355 \def\ss{\realbackslash ss}%
2356 % Take care of texinfo commands likely to appear in an index entry.
2357 % (Must be a way to avoid doing expansion at all, and thus not have to
2358 % laboriously list every single command here.)
2359 \def\@{@}% will be @@ when we switch to @ as escape char.
2360 %\let\{ = \lbracecmd
2361 %\let\} = \rbracecmd
2362 \def\_{{\realbackslash _}}%
2363 \def\w{\realbackslash w }%
2364 \def\bf{\realbackslash bf }%
2365 %\def\rm{\realbackslash rm }%
2366 \def\sl{\realbackslash sl }%
2367 \def\sf{\realbackslash sf}%
2368 \def\tt{\realbackslash tt}%
2369 \def\gtr{\realbackslash gtr}%
2370 \def\less{\realbackslash less}%
2371 \def\hat{\realbackslash hat}%
2372 %\def\char{\realbackslash char}%
2373 \def\TeX{\realbackslash TeX}%
2374 \def\dots{\realbackslash dots }%
2375 \def\result{\realbackslash result}%
2376 \def\equiv{\realbackslash equiv}%
2377 \def\expansion{\realbackslash expansion}%
2378 \def\print{\realbackslash print}%
2379 \def\error{\realbackslash error}%
2380 \def\point{\realbackslash point}%
2381 \def\copyright{\realbackslash copyright}%
2382 \def\tclose##1{\realbackslash tclose {##1}}%
2383 \def\code##1{\realbackslash code {##1}}%
2384 \def\dotless##1{\realbackslash dotless {##1}}%
2385 \def\samp##1{\realbackslash samp {##1}}%
2386 \def\,##1{\realbackslash ,{##1}}%
2387 \def\t##1{\realbackslash t {##1}}%
2388 \def\r##1{\realbackslash r {##1}}%
2389 \def\i##1{\realbackslash i {##1}}%
2390 \def\b##1{\realbackslash b {##1}}%
2391 \def\sc##1{\realbackslash sc {##1}}%
2392 \def\cite##1{\realbackslash cite {##1}}%
2393 \def\key##1{\realbackslash key {##1}}%
2394 \def\file##1{\realbackslash file {##1}}%
2395 \def\var##1{\realbackslash var {##1}}%
2396 \def\kbd##1{\realbackslash kbd {##1}}%
2397 \def\dfn##1{\realbackslash dfn {##1}}%
2398 \def\emph##1{\realbackslash emph {##1}}%
2399 \def\value##1{\realbackslash value {##1}}%
2400 \unsepspaces
2403 % If an index command is used in an @example environment, any spaces
2404 % therein should become regular spaces in the raw index file, not the
2405 % expansion of \tie (\\leavevmode \penalty \@M \ ).
2406 {\obeyspaces
2407 \gdef\unsepspaces{\obeyspaces\let =\space}}
2409 % \indexnofonts no-ops all font-change commands.
2410 % This is used when outputting the strings to sort the index by.
2411 \def\indexdummyfont#1{#1}
2412 \def\indexdummytex{TeX}
2413 \def\indexdummydots{...}
2415 \def\indexnofonts{%
2416 % Just ignore accents.
2417 \let\,=\indexdummyfont
2418 \let\"=\indexdummyfont
2419 \let\`=\indexdummyfont
2420 \let\'=\indexdummyfont
2421 \let\^=\indexdummyfont
2422 \let\~=\indexdummyfont
2423 \let\==\indexdummyfont
2424 \let\b=\indexdummyfont
2425 \let\c=\indexdummyfont
2426 \let\d=\indexdummyfont
2427 \let\u=\indexdummyfont
2428 \let\v=\indexdummyfont
2429 \let\H=\indexdummyfont
2430 \let\dotless=\indexdummyfont
2431 % Take care of the plain tex special European modified letters.
2432 \def\oe{oe}%
2433 \def\ae{ae}%
2434 \def\aa{aa}%
2435 \def\OE{OE}%
2436 \def\AE{AE}%
2437 \def\AA{AA}%
2438 \def\o{o}%
2439 \def\O{O}%
2440 \def\l{l}%
2441 \def\L{L}%
2442 \def\ss{ss}%
2443 \let\w=\indexdummyfont
2444 \let\t=\indexdummyfont
2445 \let\r=\indexdummyfont
2446 \let\i=\indexdummyfont
2447 \let\b=\indexdummyfont
2448 \let\emph=\indexdummyfont
2449 \let\strong=\indexdummyfont
2450 \let\cite=\indexdummyfont
2451 \let\sc=\indexdummyfont
2452 %Don't no-op \tt, since it isn't a user-level command
2453 % and is used in the definitions of the active chars like <, >, |...
2454 %\let\tt=\indexdummyfont
2455 \let\tclose=\indexdummyfont
2456 \let\code=\indexdummyfont
2457 \let\file=\indexdummyfont
2458 \let\samp=\indexdummyfont
2459 \let\kbd=\indexdummyfont
2460 \let\key=\indexdummyfont
2461 \let\var=\indexdummyfont
2462 \let\TeX=\indexdummytex
2463 \let\dots=\indexdummydots
2464 \def\@{@}%
2467 % To define \realbackslash, we must make \ not be an escape.
2468 % We must first make another character (@) an escape
2469 % so we do not become unable to do a definition.
2471 {\catcode`\@=0 \catcode`\\=\other
2472 @gdef@realbackslash{\}}
2474 \let\indexbackslash=0 %overridden during \printindex.
2476 \let\SETmarginindex=\relax %initialize!
2477 % workhorse for all \fooindexes
2478 % #1 is name of index, #2 is stuff to put there
2479 \def\doind #1#2{%
2480 % Put the index entry in the margin if desired.
2481 \ifx\SETmarginindex\relax\else
2482 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2485 \count255=\lastpenalty
2487 \indexdummies % Must do this here, since \bf, etc expand at this stage
2488 \escapechar=`\\
2490 \let\folio=0% We will expand all macros now EXCEPT \folio.
2491 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2492 % so it will be output as is; and it will print as backslash.
2494 % First process the index-string with all font commands turned off
2495 % to get the string to sort by.
2496 {\indexnofonts \xdef\indexsorttmp{#2}}%
2498 % Now produce the complete index entry, with both the sort key and the
2499 % original text, including any font commands.
2500 \toks0 = {#2}%
2501 \edef\temp{%
2502 \write\csname#1indfile\endcsname{%
2503 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
2505 \temp
2508 \penalty\count255
2512 \def\dosubind #1#2#3{%
2513 {\count10=\lastpenalty %
2514 {\indexdummies % Must do this here, since \bf, etc expand at this stage
2515 \escapechar=`\\%
2516 {\let\folio=0%
2517 \def\rawbackslashxx{\indexbackslash}%
2519 % Now process the index-string once, with all font commands turned off,
2520 % to get the string to sort the index by.
2521 {\indexnofonts
2522 \xdef\temp1{#2 #3}%
2524 % Now produce the complete index entry. We process the index-string again,
2525 % this time with font commands expanded, to get what to print in the index.
2526 \edef\temp{%
2527 \write \csname#1indfile\endcsname{%
2528 \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
2529 \temp }%
2530 }\penalty\count10}}
2532 % The index entry written in the file actually looks like
2533 % \entry {sortstring}{page}{topic}
2534 % or
2535 % \entry {sortstring}{page}{topic}{subtopic}
2536 % The texindex program reads in these files and writes files
2537 % containing these kinds of lines:
2538 % \initial {c}
2539 % before the first topic whose initial is c
2540 % \entry {topic}{pagelist}
2541 % for a topic that is used without subtopics
2542 % \primary {topic}
2543 % for the beginning of a topic that is used with subtopics
2544 % \secondary {subtopic}{pagelist}
2545 % for each subtopic.
2547 % Define the user-accessible indexing commands
2548 % @findex, @vindex, @kindex, @cindex.
2550 \def\findex {\fnindex}
2551 \def\kindex {\kyindex}
2552 \def\cindex {\cpindex}
2553 \def\vindex {\vrindex}
2554 \def\tindex {\tpindex}
2555 \def\pindex {\pgindex}
2557 \def\cindexsub {\begingroup\obeylines\cindexsub}
2558 {\obeylines %
2559 \gdef\cindexsub "#1" #2^^M{\endgroup %
2560 \dosubind{cp}{#2}{#1}}}
2562 % Define the macros used in formatting output of the sorted index material.
2564 % @printindex causes a particular index (the ??s file) to get printed.
2565 % It does not print any chapter heading (usually an @unnumbered).
2567 \def\printindex{\parsearg\doprintindex}
2568 \def\doprintindex#1{\begingroup
2569 \dobreak \chapheadingskip{10000}%
2571 \indexfonts \rm
2572 \tolerance = 9500
2573 \indexbreaks
2575 % See if the index file exists and is nonempty.
2576 % Change catcode of @ here so that if the index file contains
2577 % \initial {@}
2578 % as its first line, TeX doesn't complain about mismatched braces
2579 % (because it thinks @} is a control sequence).
2580 \catcode`\@ = 11
2581 \openin 1 \jobname.#1s
2582 \ifeof 1
2583 % \enddoublecolumns gets confused if there is no text in the index,
2584 % and it loses the chapter title and the aux file entries for the
2585 % index. The easiest way to prevent this problem is to make sure
2586 % there is some text.
2587 (Index is nonexistent)
2588 \else
2590 % If the index file exists but is empty, then \openin leaves \ifeof
2591 % false. We have to make TeX try to read something from the file, so
2592 % it can discover if there is anything in it.
2593 \read 1 to \temp
2594 \ifeof 1
2595 (Index is empty)
2596 \else
2597 % Index files are almost Texinfo source, but we use \ as the escape
2598 % character. It would be better to use @, but that's too big a change
2599 % to make right now.
2600 \def\indexbackslash{\rawbackslashxx}%
2601 \catcode`\\ = 0
2602 \escapechar = `\\
2603 \begindoublecolumns
2604 \input \jobname.#1s
2605 \enddoublecolumns
2608 \closein 1
2609 \endgroup}
2611 % These macros are used by the sorted index file itself.
2612 % Change them to control the appearance of the index.
2614 % Same as \bigskipamount except no shrink.
2615 % \balancecolumns gets confused if there is any shrink.
2616 \newskip\initialskipamount \initialskipamount 12pt plus4pt
2618 \def\initial #1{%
2619 {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2620 \ifdim\lastskip<\initialskipamount
2621 \removelastskip \penalty-200 \vskip \initialskipamount\fi
2622 \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
2624 % This typesets a paragraph consisting of #1, dot leaders, and then #2
2625 % flush to the right margin. It is used for index and table of contents
2626 % entries. The paragraph is indented by \leftskip.
2628 \def\entry #1#2{\begingroup
2630 % Start a new paragraph if necessary, so our assignments below can't
2631 % affect previous text.
2632 \par
2634 % Do not fill out the last line with white space.
2635 \parfillskip = 0in
2637 % No extra space above this paragraph.
2638 \parskip = 0in
2640 % Do not prefer a separate line ending with a hyphen to fewer lines.
2641 \finalhyphendemerits = 0
2643 % \hangindent is only relevant when the entry text and page number
2644 % don't both fit on one line. In that case, bob suggests starting the
2645 % dots pretty far over on the line. Unfortunately, a large
2646 % indentation looks wrong when the entry text itself is broken across
2647 % lines. So we use a small indentation and put up with long leaders.
2649 % \hangafter is reset to 1 (which is the value we want) at the start
2650 % of each paragraph, so we need not do anything with that.
2651 \hangindent=2em
2653 % When the entry text needs to be broken, just fill out the first line
2654 % with blank space.
2655 \rightskip = 0pt plus1fil
2657 % Start a ``paragraph'' for the index entry so the line breaking
2658 % parameters we've set above will have an effect.
2659 \noindent
2661 % Insert the text of the index entry. TeX will do line-breaking on it.
2663 % The following is kludged to not output a line of dots in the index if
2664 % there are no page numbers. The next person who breaks this will be
2665 % cursed by a Unix daemon.
2666 \def\tempa{{\rm }}%
2667 \def\tempb{#2}%
2668 \edef\tempc{\tempa}%
2669 \edef\tempd{\tempb}%
2670 \ifx\tempc\tempd\ \else%
2672 % If we must, put the page number on a line of its own, and fill out
2673 % this line with blank space. (The \hfil is overwhelmed with the
2674 % fill leaders glue in \indexdotfill if the page number does fit.)
2675 \hfil\penalty50
2676 \null\nobreak\indexdotfill % Have leaders before the page number.
2678 % The `\ ' here is removed by the implicit \unskip that TeX does as
2679 % part of (the primitive) \par. Without it, a spurious underfull
2680 % \hbox ensues.
2681 \ #2% The page number ends the paragraph.
2682 \fi%
2683 \par
2684 \endgroup}
2686 % Like \dotfill except takes at least 1 em.
2687 \def\indexdotfill{\cleaders
2688 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
2690 \def\primary #1{\line{#1\hfil}}
2692 \newskip\secondaryindent \secondaryindent=0.5cm
2694 \def\secondary #1#2{
2695 {\parfillskip=0in \parskip=0in
2696 \hangindent =1in \hangafter=1
2697 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
2700 % Define two-column mode, which we use to typeset indexes.
2701 % Adapted from the TeXbook, page 416, which is to say,
2702 % the manmac.tex format used to print the TeXbook itself.
2703 \catcode`\@=11
2705 \newbox\partialpage
2706 \newdimen\doublecolumnhsize
2708 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
2709 % Grab any single-column material above us.
2710 \output = {\global\setbox\partialpage = \vbox{%
2712 % Here is a possibility not foreseen in manmac: if we accumulate a
2713 % whole lot of material, we might end up calling this \output
2714 % routine twice in a row (see the doublecol-lose test, which is
2715 % essentially a couple of indexes with @setchapternewpage off). In
2716 % that case, we must prevent the second \partialpage from
2717 % simply overwriting the first, causing us to lose the page.
2718 % This will preserve it until a real output routine can ship it
2719 % out. Generally, \partialpage will be empty when this runs and
2720 % this will be a no-op.
2721 \unvbox\partialpage
2723 % Unvbox the main output page.
2724 \unvbox255
2725 \kern-\topskip \kern\baselineskip
2727 \eject
2729 % Use the double-column output routine for subsequent pages.
2730 \output = {\doublecolumnout}%
2732 % Change the page size parameters. We could do this once outside this
2733 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
2734 % format, but then we repeat the same computation. Repeating a couple
2735 % of assignments once per index is clearly meaningless for the
2736 % execution time, so we may as well do it in one place.
2738 % First we halve the line length, less a little for the gutter between
2739 % the columns. We compute the gutter based on the line length, so it
2740 % changes automatically with the paper format. The magic constant
2741 % below is chosen so that the gutter has the same value (well, +-<1pt)
2742 % as it did when we hard-coded it.
2744 % We put the result in a separate register, \doublecolumhsize, so we
2745 % can restore it in \pagesofar, after \hsize itself has (potentially)
2746 % been clobbered.
2748 \doublecolumnhsize = \hsize
2749 \advance\doublecolumnhsize by -.04154\hsize
2750 \divide\doublecolumnhsize by 2
2751 \hsize = \doublecolumnhsize
2753 % Double the \vsize as well. (We don't need a separate register here,
2754 % since nobody clobbers \vsize.)
2755 \vsize = 2\vsize
2757 \def\doublecolumnout{%
2758 \splittopskip=\topskip \splitmaxdepth=\maxdepth
2759 % Get the available space for the double columns -- the normal
2760 % (undoubled) page height minus any material left over from the
2761 % previous page.
2762 \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
2763 % box0 will be the left-hand column, box2 the right.
2764 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
2765 \onepageout\pagesofar
2766 \unvbox255
2767 \penalty\outputpenalty
2769 \def\pagesofar{%
2770 % Re-output the contents of the output page -- any previous material,
2771 % followed by the two boxes we just split.
2772 \unvbox\partialpage
2773 \hsize = \doublecolumnhsize
2774 \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}%
2776 \def\enddoublecolumns{%
2777 \output = {\balancecolumns}\eject % split what we have
2778 \endgroup % started in \begindoublecolumns
2780 % Back to normal single-column typesetting, but take account of the
2781 % fact that we just accumulated some stuff on the output page.
2782 \pagegoal = \vsize
2784 \def\balancecolumns{%
2785 % Called at the end of the double column material.
2786 \setbox0 = \vbox{\unvbox255}%
2787 \dimen@ = \ht0
2788 \advance\dimen@ by \topskip
2789 \advance\dimen@ by-\baselineskip
2790 \divide\dimen@ by 2
2791 \splittopskip = \topskip
2792 % Loop until we get a decent breakpoint.
2793 {\vbadness=10000 \loop
2794 \global\setbox3=\copy0
2795 \global\setbox1=\vsplit3 to\dimen@
2796 \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt
2797 \repeat}%
2798 \setbox0=\vbox to\dimen@{\unvbox1}%
2799 \setbox2=\vbox to\dimen@{\unvbox3}%
2800 \pagesofar
2802 \catcode`\@ = \other
2805 \message{sectioning,}
2806 % Define chapters, sections, etc.
2808 \newcount\chapno
2809 \newcount\secno \secno=0
2810 \newcount\subsecno \subsecno=0
2811 \newcount\subsubsecno \subsubsecno=0
2813 % This counter is funny since it counts through charcodes of letters A, B, ...
2814 \newcount\appendixno \appendixno = `\@
2815 \def\appendixletter{\char\the\appendixno}
2817 \newwrite\contentsfile
2818 % This is called from \setfilename.
2819 \def\opencontents{\openout\contentsfile = \jobname.toc }
2821 % Each @chapter defines this as the name of the chapter.
2822 % page headings and footings can use it. @section does likewise
2824 \def\thischapter{} \def\thissection{}
2825 \def\seccheck#1{\ifnum \pageno<0
2826 \errmessage{@#1 not allowed after generating table of contents}%
2827 \fi}
2829 \def\chapternofonts{%
2830 \let\rawbackslash=\relax
2831 \let\frenchspacing=\relax
2832 \def\result{\realbackslash result}%
2833 \def\equiv{\realbackslash equiv}%
2834 \def\expansion{\realbackslash expansion}%
2835 \def\print{\realbackslash print}%
2836 \def\TeX{\realbackslash TeX}%
2837 \def\dots{\realbackslash dots}%
2838 \def\result{\realbackslash result}%
2839 \def\equiv{\realbackslash equiv}%
2840 \def\expansion{\realbackslash expansion}%
2841 \def\print{\realbackslash print}%
2842 \def\error{\realbackslash error}%
2843 \def\point{\realbackslash point}%
2844 \def\copyright{\realbackslash copyright}%
2845 \def\tt{\realbackslash tt}%
2846 \def\bf{\realbackslash bf}%
2847 \def\w{\realbackslash w}%
2848 \def\less{\realbackslash less}%
2849 \def\gtr{\realbackslash gtr}%
2850 \def\hat{\realbackslash hat}%
2851 \def\char{\realbackslash char}%
2852 \def\tclose##1{\realbackslash tclose{##1}}%
2853 \def\code##1{\realbackslash code{##1}}%
2854 \def\samp##1{\realbackslash samp{##1}}%
2855 \def\r##1{\realbackslash r{##1}}%
2856 \def\b##1{\realbackslash b{##1}}%
2857 \def\key##1{\realbackslash key{##1}}%
2858 \def\file##1{\realbackslash file{##1}}%
2859 \def\kbd##1{\realbackslash kbd{##1}}%
2860 % These are redefined because @smartitalic wouldn't work inside xdef.
2861 \def\i##1{\realbackslash i{##1}}%
2862 \def\cite##1{\realbackslash cite{##1}}%
2863 \def\var##1{\realbackslash var{##1}}%
2864 \def\emph##1{\realbackslash emph{##1}}%
2865 \def\dfn##1{\realbackslash dfn{##1}}%
2868 \newcount\absseclevel % used to calculate proper heading level
2869 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
2871 % @raisesections: treat @section as chapter, @subsection as section, etc.
2872 \def\raisesections{\global\advance\secbase by -1}
2873 \let\up=\raisesections % original BFox name
2875 % @lowersections: treat @chapter as section, @section as subsection, etc.
2876 \def\lowersections{\global\advance\secbase by 1}
2877 \let\down=\lowersections % original BFox name
2879 % Choose a numbered-heading macro
2880 % #1 is heading level if unmodified by @raisesections or @lowersections
2881 % #2 is text for heading
2882 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2883 \ifcase\absseclevel
2884 \chapterzzz{#2}
2886 \seczzz{#2}
2888 \numberedsubseczzz{#2}
2890 \numberedsubsubseczzz{#2}
2891 \else
2892 \ifnum \absseclevel<0
2893 \chapterzzz{#2}
2894 \else
2895 \numberedsubsubseczzz{#2}
2900 % like \numhead, but chooses appendix heading levels
2901 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2902 \ifcase\absseclevel
2903 \appendixzzz{#2}
2905 \appendixsectionzzz{#2}
2907 \appendixsubseczzz{#2}
2909 \appendixsubsubseczzz{#2}
2910 \else
2911 \ifnum \absseclevel<0
2912 \appendixzzz{#2}
2913 \else
2914 \appendixsubsubseczzz{#2}
2919 % like \numhead, but chooses numberless heading levels
2920 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2921 \ifcase\absseclevel
2922 \unnumberedzzz{#2}
2924 \unnumberedseczzz{#2}
2926 \unnumberedsubseczzz{#2}
2928 \unnumberedsubsubseczzz{#2}
2929 \else
2930 \ifnum \absseclevel<0
2931 \unnumberedzzz{#2}
2932 \else
2933 \unnumberedsubsubseczzz{#2}
2939 \def\thischaptername{No Chapter Title}
2940 \outer\def\chapter{\parsearg\chapteryyy}
2941 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
2942 \def\chapterzzz #1{\seccheck{chapter}%
2943 \secno=0 \subsecno=0 \subsubsecno=0
2944 \global\advance \chapno by 1 \message{\putwordChapter \the\chapno}%
2945 \chapmacro {#1}{\the\chapno}%
2946 \gdef\thissection{#1}%
2947 \gdef\thischaptername{#1}%
2948 % We don't substitute the actual chapter name into \thischapter
2949 % because we don't want its macros evaluated now.
2950 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
2951 {\chapternofonts%
2952 \toks0 = {#1}%
2953 \edef\temp{{\realbackslash chapentry{\the\toks0}{\the\chapno}{\noexpand\folio}}}%
2954 \escapechar=`\\%
2955 \write \contentsfile \temp %
2956 \donoderef %
2957 \global\let\section = \numberedsec
2958 \global\let\subsection = \numberedsubsec
2959 \global\let\subsubsection = \numberedsubsubsec
2962 \outer\def\appendix{\parsearg\appendixyyy}
2963 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
2964 \def\appendixzzz #1{\seccheck{appendix}%
2965 \secno=0 \subsecno=0 \subsubsecno=0
2966 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
2967 \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
2968 \gdef\thissection{#1}%
2969 \gdef\thischaptername{#1}%
2970 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
2971 {\chapternofonts%
2972 \toks0 = {#1}%
2973 \edef\temp{{\realbackslash chapentry{\the\toks0}%
2974 {\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
2975 \escapechar=`\\%
2976 \write \contentsfile \temp %
2977 \appendixnoderef %
2978 \global\let\section = \appendixsec
2979 \global\let\subsection = \appendixsubsec
2980 \global\let\subsubsection = \appendixsubsubsec
2983 % @centerchap is like @unnumbered, but the heading is centered.
2984 \outer\def\centerchap{\parsearg\centerchapyyy}
2985 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
2987 \outer\def\top{\parsearg\unnumberedyyy}
2988 \outer\def\unnumbered{\parsearg\unnumberedyyy}
2989 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
2990 \def\unnumberedzzz #1{\seccheck{unnumbered}%
2991 \secno=0 \subsecno=0 \subsubsecno=0
2993 % This used to be simply \message{#1}, but TeX fully expands the
2994 % argument to \message. Therefore, if #1 contained @-commands, TeX
2995 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
2996 % expanded @cite (which turns out to cause errors because \cite is meant
2997 % to be executed, not expanded).
2999 % Anyway, we don't want the fully-expanded definition of @cite to appear
3000 % as a result of the \message, we just want `@cite' itself. We use
3001 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
3002 % simply yielding the contents of the <toks register>.
3003 \toks0 = {#1}\message{(\the\toks0)}%
3005 \unnumbchapmacro {#1}%
3006 \gdef\thischapter{#1}\gdef\thissection{#1}%
3007 {\chapternofonts%
3008 \toks0 = {#1}%
3009 \edef\temp{{\realbackslash unnumbchapentry{\the\toks0}{\noexpand\folio}}}%
3010 \escapechar=`\\%
3011 \write \contentsfile \temp %
3012 \unnumbnoderef %
3013 \global\let\section = \unnumberedsec
3014 \global\let\subsection = \unnumberedsubsec
3015 \global\let\subsubsection = \unnumberedsubsubsec
3018 \outer\def\numberedsec{\parsearg\secyyy}
3019 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
3020 \def\seczzz #1{\seccheck{section}%
3021 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3022 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
3023 {\chapternofonts%
3024 \toks0 = {#1}%
3025 \edef\temp{{\realbackslash secentry %
3026 {\the\toks0}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
3027 \escapechar=`\\%
3028 \write \contentsfile \temp %
3029 \donoderef %
3030 \penalty 10000 %
3033 \outer\def\appendixsection{\parsearg\appendixsecyyy}
3034 \outer\def\appendixsec{\parsearg\appendixsecyyy}
3035 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
3036 \def\appendixsectionzzz #1{\seccheck{appendixsection}%
3037 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3038 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
3039 {\chapternofonts%
3040 \toks0 = {#1}%
3041 \edef\temp{{\realbackslash secentry %
3042 {\the\toks0}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
3043 \escapechar=`\\%
3044 \write \contentsfile \temp %
3045 \appendixnoderef %
3046 \penalty 10000 %
3049 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
3050 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
3051 \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
3052 \plainsecheading {#1}\gdef\thissection{#1}%
3053 {\chapternofonts%
3054 \toks0 = {#1}%
3055 \edef\temp{{\realbackslash unnumbsecentry{\the\toks0}{\noexpand\folio}}}%
3056 \escapechar=`\\%
3057 \write \contentsfile \temp %
3058 \unnumbnoderef %
3059 \penalty 10000 %
3062 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
3063 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
3064 \def\numberedsubseczzz #1{\seccheck{subsection}%
3065 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3066 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
3067 {\chapternofonts%
3068 \toks0 = {#1}%
3069 \edef\temp{{\realbackslash subsecentry %
3070 {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
3071 \escapechar=`\\%
3072 \write \contentsfile \temp %
3073 \donoderef %
3074 \penalty 10000 %
3077 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
3078 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
3079 \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
3080 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3081 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
3082 {\chapternofonts%
3083 \toks0 = {#1}%
3084 \edef\temp{{\realbackslash subsecentry %
3085 {\the\toks0}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
3086 \escapechar=`\\%
3087 \write \contentsfile \temp %
3088 \appendixnoderef %
3089 \penalty 10000 %
3092 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
3093 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
3094 \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
3095 \plainsubsecheading {#1}\gdef\thissection{#1}%
3096 {\chapternofonts%
3097 \toks0 = {#1}%
3098 \edef\temp{{\realbackslash unnumbsubsecentry{\the\toks0}{\noexpand\folio}}}%
3099 \escapechar=`\\%
3100 \write \contentsfile \temp %
3101 \unnumbnoderef %
3102 \penalty 10000 %
3105 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
3106 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
3107 \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
3108 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3109 \subsubsecheading {#1}
3110 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3111 {\chapternofonts%
3112 \toks0 = {#1}%
3113 \edef\temp{{\realbackslash subsubsecentry{\the\toks0}
3114 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
3115 {\noexpand\folio}}}%
3116 \escapechar=`\\%
3117 \write \contentsfile \temp %
3118 \donoderef %
3119 \penalty 10000 %
3122 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
3123 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
3124 \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
3125 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3126 \subsubsecheading {#1}
3127 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3128 {\chapternofonts%
3129 \toks0 = {#1}%
3130 \edef\temp{{\realbackslash subsubsecentry{\the\toks0}%
3131 {\appendixletter}
3132 {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
3133 \escapechar=`\\%
3134 \write \contentsfile \temp %
3135 \appendixnoderef %
3136 \penalty 10000 %
3139 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
3140 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
3141 \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
3142 \plainsubsubsecheading {#1}\gdef\thissection{#1}%
3143 {\chapternofonts%
3144 \toks0 = {#1}%
3145 \edef\temp{{\realbackslash unnumbsubsubsecentry{\the\toks0}{\noexpand\folio}}}%
3146 \escapechar=`\\%
3147 \write \contentsfile \temp %
3148 \unnumbnoderef %
3149 \penalty 10000 %
3152 % These are variants which are not "outer", so they can appear in @ifinfo.
3153 % Actually, they should now be obsolete; ordinary section commands should work.
3154 \def\infotop{\parsearg\unnumberedzzz}
3155 \def\infounnumbered{\parsearg\unnumberedzzz}
3156 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
3157 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
3158 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
3160 \def\infoappendix{\parsearg\appendixzzz}
3161 \def\infoappendixsec{\parsearg\appendixseczzz}
3162 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
3163 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
3165 \def\infochapter{\parsearg\chapterzzz}
3166 \def\infosection{\parsearg\sectionzzz}
3167 \def\infosubsection{\parsearg\subsectionzzz}
3168 \def\infosubsubsection{\parsearg\subsubsectionzzz}
3170 % These macros control what the section commands do, according
3171 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
3172 % Define them by default for a numbered chapter.
3173 \global\let\section = \numberedsec
3174 \global\let\subsection = \numberedsubsec
3175 \global\let\subsubsection = \numberedsubsubsec
3177 % Define @majorheading, @heading and @subheading
3179 % NOTE on use of \vbox for chapter headings, section headings, and
3180 % such:
3181 % 1) We use \vbox rather than the earlier \line to permit
3182 % overlong headings to fold.
3183 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
3184 % heading is obnoxious; this forbids it.
3185 % 3) Likewise, headings look best if no \parindent is used, and
3186 % if justification is not attempted. Hence \raggedright.
3189 \def\majorheading{\parsearg\majorheadingzzz}
3190 \def\majorheadingzzz #1{%
3191 {\advance\chapheadingskip by 10pt \chapbreak }%
3192 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3193 \parindent=0pt\raggedright
3194 \rm #1\hfill}}\bigskip \par\penalty 200}
3196 \def\chapheading{\parsearg\chapheadingzzz}
3197 \def\chapheadingzzz #1{\chapbreak %
3198 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3199 \parindent=0pt\raggedright
3200 \rm #1\hfill}}\bigskip \par\penalty 200}
3202 % @heading, @subheading, @subsubheading.
3203 \def\heading{\parsearg\plainsecheading}
3204 \def\subheading{\parsearg\plainsubsecheading}
3205 \def\subsubheading{\parsearg\plainsubsubsecheading}
3207 % These macros generate a chapter, section, etc. heading only
3208 % (including whitespace, linebreaking, etc. around it),
3209 % given all the information in convenient, parsed form.
3211 %%% Args are the skip and penalty (usually negative)
3212 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
3214 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
3216 %%% Define plain chapter starts, and page on/off switching for it
3217 % Parameter controlling skip before chapter headings (if needed)
3219 \newskip\chapheadingskip
3221 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
3222 \def\chappager{\par\vfill\supereject}
3223 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
3225 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
3227 \def\CHAPPAGoff{
3228 \global\let\contentsalignmacro = \chappager
3229 \global\let\pchapsepmacro=\chapbreak
3230 \global\let\pagealignmacro=\chappager}
3232 \def\CHAPPAGon{
3233 \global\let\contentsalignmacro = \chappager
3234 \global\let\pchapsepmacro=\chappager
3235 \global\let\pagealignmacro=\chappager
3236 \global\def\HEADINGSon{\HEADINGSsingle}}
3238 \def\CHAPPAGodd{
3239 \global\let\contentsalignmacro = \chapoddpage
3240 \global\let\pchapsepmacro=\chapoddpage
3241 \global\let\pagealignmacro=\chapoddpage
3242 \global\def\HEADINGSon{\HEADINGSdouble}}
3244 \CHAPPAGon
3246 \def\CHAPFplain{
3247 \global\let\chapmacro=\chfplain
3248 \global\let\unnumbchapmacro=\unnchfplain
3249 \global\let\centerchapmacro=\centerchfplain}
3251 % Plain chapter opening.
3252 % #1 is the text, #2 the chapter number or empty if unnumbered.
3253 \def\chfplain#1#2{%
3254 \pchapsepmacro
3256 \chapfonts \rm
3257 \def\chapnum{#2}%
3258 \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
3259 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3260 \hangindent = \wd0 \centerparametersmaybe
3261 \unhbox0 #1\par}%
3263 \nobreak\bigskip % no page break after a chapter title
3264 \nobreak
3267 % Plain opening for unnumbered.
3268 \def\unnchfplain#1{\chfplain{#1}{}}
3270 % @centerchap -- centered and unnumbered.
3271 \let\centerparametersmaybe = \relax
3272 \def\centerchfplain#1{{%
3273 \def\centerparametersmaybe{%
3274 \advance\rightskip by 3\rightskip
3275 \leftskip = \rightskip
3276 \parfillskip = 0pt
3278 \chfplain{#1}{}%
3281 \CHAPFplain % The default
3283 \def\unnchfopen #1{%
3284 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3285 \parindent=0pt\raggedright
3286 \rm #1\hfill}}\bigskip \par\penalty 10000 %
3289 \def\chfopen #1#2{\chapoddpage {\chapfonts
3290 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
3291 \par\penalty 5000 %
3294 \def\centerchfopen #1{%
3295 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3296 \parindent=0pt
3297 \hfill {\rm #1}\hfill}}\bigskip \par\penalty 10000 %
3300 \def\CHAPFopen{
3301 \global\let\chapmacro=\chfopen
3302 \global\let\unnumbchapmacro=\unnchfopen
3303 \global\let\centerchapmacro=\centerchfopen}
3306 % Section titles.
3307 \newskip\secheadingskip
3308 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
3309 \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
3310 \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
3312 % Subsection titles.
3313 \newskip \subsecheadingskip
3314 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
3315 \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
3316 \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
3318 % Subsubsection titles.
3319 \let\subsubsecheadingskip = \subsecheadingskip
3320 \let\subsubsecheadingbreak = \subsecheadingbreak
3321 \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
3322 \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
3325 % Print any size section title.
3327 % #1 is the section type (sec/subsec/subsubsec), #2 is the section
3328 % number (maybe empty), #3 the text.
3329 \def\sectionheading#1#2#3{%
3331 \expandafter\advance\csname #1headingskip\endcsname by \parskip
3332 \csname #1headingbreak\endcsname
3335 % Switch to the right set of fonts.
3336 \csname #1fonts\endcsname \rm
3338 % Only insert the separating space if we have a section number.
3339 \def\secnum{#2}%
3340 \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
3342 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3343 \hangindent = \wd0 % zero if no section number
3344 \unhbox0 #3}%
3346 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
3350 \message{toc printing,}
3351 % Finish up the main text and prepare to read what we've written
3352 % to \contentsfile.
3354 \newskip\contentsrightmargin \contentsrightmargin=1in
3355 \def\startcontents#1{%
3356 % If @setchapternewpage on, and @headings double, the contents should
3357 % start on an odd page, unlike chapters. Thus, we maintain
3358 % \contentsalignmacro in parallel with \pagealignmacro.
3359 % From: Torbjorn Granlund <tege@matematik.su.se>
3360 \contentsalignmacro
3361 \immediate\closeout \contentsfile
3362 \ifnum \pageno>0
3363 \pageno = -1 % Request roman numbered pages.
3365 % Don't need to put `Contents' or `Short Contents' in the headline.
3366 % It is abundantly clear what they are.
3367 \unnumbchapmacro{#1}\def\thischapter{}%
3368 \begingroup % Set up to handle contents files properly.
3369 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
3370 % We can't do this, because then an actual ^ in a section
3371 % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
3372 %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3373 \raggedbottom % Worry more about breakpoints than the bottom.
3374 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3378 % Normal (long) toc.
3379 \outer\def\contents{%
3380 \startcontents{\putwordTableofContents}%
3381 \input \jobname.toc
3382 \endgroup
3383 \vfill \eject
3386 % And just the chapters.
3387 \outer\def\summarycontents{%
3388 \startcontents{\putwordShortContents}%
3390 \let\chapentry = \shortchapentry
3391 \let\unnumbchapentry = \shortunnumberedentry
3392 % We want a true roman here for the page numbers.
3393 \secfonts
3394 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
3396 \hyphenpenalty = 10000
3397 \advance\baselineskip by 1pt % Open it up a little.
3398 \def\secentry ##1##2##3##4{}
3399 \def\unnumbsecentry ##1##2{}
3400 \def\subsecentry ##1##2##3##4##5{}
3401 \def\unnumbsubsecentry ##1##2{}
3402 \def\subsubsecentry ##1##2##3##4##5##6{}
3403 \def\unnumbsubsubsecentry ##1##2{}
3404 \input \jobname.toc
3405 \endgroup
3406 \vfill \eject
3408 \let\shortcontents = \summarycontents
3410 % These macros generate individual entries in the table of contents.
3411 % The first argument is the chapter or section name.
3412 % The last argument is the page number.
3413 % The arguments in between are the chapter number, section number, ...
3415 % Chapter-level things, for both the long and short contents.
3416 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3418 % See comments in \dochapentry re vbox and related settings
3419 \def\shortchapentry#1#2#3{%
3420 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
3423 % Typeset the label for a chapter or appendix for the short contents.
3424 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
3425 % We could simplify the code here by writing out an \appendixentry
3426 % command in the toc file for appendices, instead of using \chapentry
3427 % for both, but it doesn't seem worth it.
3428 \setbox0 = \hbox{\shortcontrm \putwordAppendix }
3429 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
3431 \def\shortchaplabel#1{%
3432 % We typeset #1 in a box of constant width, regardless of the text of
3433 % #1, so the chapter titles will come out aligned.
3434 \setbox0 = \hbox{#1}%
3435 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3437 % This space should be plenty, since a single number is .5em, and the
3438 % widest letter (M) is 1em, at least in the Computer Modern fonts.
3439 % (This space doesn't include the extra space that gets added after
3440 % the label; that gets put in by \shortchapentry above.)
3441 \advance\dimen0 by 1.1em
3442 \hbox to \dimen0{#1\hfil}%
3445 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3446 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
3448 % Sections.
3449 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3450 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
3452 % Subsections.
3453 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
3454 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
3456 % And subsubsections.
3457 \def\subsubsecentry#1#2#3#4#5#6{%
3458 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
3459 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
3461 % This parameter controls the indentation of the various levels.
3462 \newdimen\tocindent \tocindent = 3pc
3464 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
3465 % page number.
3467 % If the toc has to be broken over pages, we want it to be at chapters
3468 % if at all possible; hence the \penalty.
3469 \def\dochapentry#1#2{%
3470 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
3471 \begingroup
3472 \chapentryfonts
3473 \tocentry{#1}{\dopageno{#2}}%
3474 \endgroup
3475 \nobreak\vskip .25\baselineskip plus.1\baselineskip
3478 \def\dosecentry#1#2{\begingroup
3479 \secentryfonts \leftskip=\tocindent
3480 \tocentry{#1}{\dopageno{#2}}%
3481 \endgroup}
3483 \def\dosubsecentry#1#2{\begingroup
3484 \subsecentryfonts \leftskip=2\tocindent
3485 \tocentry{#1}{\dopageno{#2}}%
3486 \endgroup}
3488 \def\dosubsubsecentry#1#2{\begingroup
3489 \subsubsecentryfonts \leftskip=3\tocindent
3490 \tocentry{#1}{\dopageno{#2}}%
3491 \endgroup}
3493 % Final typesetting of a toc entry; we use the same \entry macro as for
3494 % the index entries, but we want to suppress hyphenation here. (We
3495 % can't do that in the \entry macro, since index entries might consist
3496 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
3497 \def\tocentry#1#2{\begingroup
3498 \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
3499 % Do not use \turnoffactive in these arguments. Since the toc is
3500 % typeset in cmr, so characters such as _ would come out wrong; we
3501 % have to do the usual translation tricks.
3502 \entry{#1}{#2}%
3503 \endgroup}
3505 % Space between chapter (or whatever) number and the title.
3506 \def\labelspace{\hskip1em \relax}
3508 \def\dopageno#1{{\rm #1}}
3509 \def\doshortpageno#1{{\rm #1}}
3511 \def\chapentryfonts{\secfonts \rm}
3512 \def\secentryfonts{\textfonts}
3513 \let\subsecentryfonts = \textfonts
3514 \let\subsubsecentryfonts = \textfonts
3517 \message{environments,}
3519 % Since these characters are used in examples, it should be an even number of
3520 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3521 % Furthermore, these definitions must come after we define our fonts.
3522 \newbox\dblarrowbox \newbox\longdblarrowbox
3523 \newbox\pushcharbox \newbox\bullbox
3524 \newbox\equivbox \newbox\errorbox
3526 %{\tentt
3527 %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
3528 %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
3529 %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
3530 %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
3531 % Adapted from the manmac format (p.420 of TeXbook)
3532 %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
3533 % depth .1ex\hfil}
3536 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3537 \def\point{$\star$}
3538 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3539 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
3540 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3541 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3543 % Adapted from the TeXbook's \boxit.
3544 {\tentt \global\dimen0 = 3em}% Width of the box.
3545 \dimen2 = .55pt % Thickness of rules
3546 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3547 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
3549 \global\setbox\errorbox=\hbox to \dimen0{\hfil
3550 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3551 \advance\hsize by -2\dimen2 % Rules.
3552 \vbox{
3553 \hrule height\dimen2
3554 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3555 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3556 \kern3pt\vrule width\dimen2}% Space to right.
3557 \hrule height\dimen2}
3558 \hfil}
3560 % The @error{} command.
3561 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3563 % @tex ... @end tex escapes into raw Tex temporarily.
3564 % One exception: @ is still an escape character, so that @end tex works.
3565 % But \@ or @@ will get a plain tex @ character.
3567 \def\tex{\begingroup
3568 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
3569 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
3570 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
3571 \catcode `\%=14
3572 \catcode 43=12 % plus
3573 \catcode`\"=12
3574 \catcode`\==12
3575 \catcode`\|=12
3576 \catcode`\<=12
3577 \catcode`\>=12
3578 \escapechar=`\\
3580 \let\b=\ptexb
3581 \let\bullet=\ptexbullet
3582 \let\c=\ptexc
3583 \let\,=\ptexcomma
3584 \let\.=\ptexdot
3585 \let\dots=\ptexdots
3586 \let\equiv=\ptexequiv
3587 \let\!=\ptexexclam
3588 \let\i=\ptexi
3589 \let\{=\ptexlbrace
3590 \let\+=\tabalign
3591 \let\}=\ptexrbrace
3592 \let\*=\ptexstar
3593 \let\t=\ptext
3595 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
3596 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
3597 \def\@{@}%
3598 \let\Etex=\endgroup}
3600 % Define @lisp ... @endlisp.
3601 % @lisp does a \begingroup so it can rebind things,
3602 % including the definition of @endlisp (which normally is erroneous).
3604 % Amount to narrow the margins by for @lisp.
3605 \newskip\lispnarrowing \lispnarrowing=0.4in
3607 % This is the definition that ^^M gets inside @lisp, @example, and other
3608 % such environments. \null is better than a space, since it doesn't
3609 % have any width.
3610 \def\lisppar{\null\endgraf}
3612 % Make each space character in the input produce a normal interword
3613 % space in the output. Don't allow a line break at this space, as this
3614 % is used only in environments like @example, where each line of input
3615 % should produce a line of output anyway.
3617 {\obeyspaces %
3618 \gdef\sepspaces{\obeyspaces\let =\tie}}
3620 % Define \obeyedspace to be our active space, whatever it is. This is
3621 % for use in \parsearg.
3622 {\sepspaces%
3623 \global\let\obeyedspace= }
3625 % This space is always present above and below environments.
3626 \newskip\envskipamount \envskipamount = 0pt
3628 % Make spacing and below environment symmetrical. We use \parskip here
3629 % to help in doing that, since in @example-like environments \parskip
3630 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
3631 % start of the next paragraph will insert \parskip
3633 \def\aboveenvbreak{{\advance\envskipamount by \parskip
3634 \endgraf \ifdim\lastskip<\envskipamount
3635 \removelastskip \penalty-50 \vskip\envskipamount \fi}}
3637 \let\afterenvbreak = \aboveenvbreak
3639 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
3640 \let\nonarrowing=\relax
3642 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
3643 % environment contents.
3644 \font\circle=lcircle10
3645 \newdimen\circthick
3646 \newdimen\cartouter\newdimen\cartinner
3647 \newskip\normbskip\newskip\normpskip\newskip\normlskip
3648 \circthick=\fontdimen8\circle
3650 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
3651 \def\ctr{{\hskip 6pt\circle\char'010}}
3652 \def\cbl{{\circle\char'012\hskip -6pt}}
3653 \def\cbr{{\hskip 6pt\circle\char'011}}
3654 \def\carttop{\hbox to \cartouter{\hskip\lskip
3655 \ctl\leaders\hrule height\circthick\hfil\ctr
3656 \hskip\rskip}}
3657 \def\cartbot{\hbox to \cartouter{\hskip\lskip
3658 \cbl\leaders\hrule height\circthick\hfil\cbr
3659 \hskip\rskip}}
3661 \newskip\lskip\newskip\rskip
3663 \long\def\cartouche{%
3664 \begingroup
3665 \lskip=\leftskip \rskip=\rightskip
3666 \leftskip=0pt\rightskip=0pt %we want these *outside*.
3667 \cartinner=\hsize \advance\cartinner by-\lskip
3668 \advance\cartinner by-\rskip
3669 \cartouter=\hsize
3670 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
3671 % side, and for 6pt waste from
3672 % each corner char, and rule thickness
3673 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
3674 % Flag to tell @lisp, etc., not to narrow margin.
3675 \let\nonarrowing=\comment
3676 \vbox\bgroup
3677 \baselineskip=0pt\parskip=0pt\lineskip=0pt
3678 \carttop
3679 \hbox\bgroup
3680 \hskip\lskip
3681 \vrule\kern3pt
3682 \vbox\bgroup
3683 \hsize=\cartinner
3684 \kern3pt
3685 \begingroup
3686 \baselineskip=\normbskip
3687 \lineskip=\normlskip
3688 \parskip=\normpskip
3689 \vskip -\parskip
3690 \def\Ecartouche{%
3691 \endgroup
3692 \kern3pt
3693 \egroup
3694 \kern3pt\vrule
3695 \hskip\rskip
3696 \egroup
3697 \cartbot
3698 \egroup
3699 \endgroup
3703 % This macro is called at the beginning of all the @example variants,
3704 % inside a group.
3705 \def\nonfillstart{%
3706 \aboveenvbreak
3707 \inENV % This group ends at the end of the body
3708 \hfuzz = 12pt % Don't be fussy
3709 \sepspaces % Make spaces be word-separators rather than space tokens.
3710 \singlespace
3711 \let\par = \lisppar % don't ignore blank lines
3712 \obeylines % each line of input is a line of output
3713 \parskip = 0pt
3714 \parindent = 0pt
3715 \emergencystretch = 0pt % don't try to avoid overfull boxes
3716 % @cartouche defines \nonarrowing to inhibit narrowing
3717 % at next level down.
3718 \ifx\nonarrowing\relax
3719 \advance \leftskip by \lispnarrowing
3720 \exdentamount=\lispnarrowing
3721 \let\exdent=\nofillexdent
3722 \let\nonarrowing=\relax
3726 % To ending an @example-like environment, we first end the paragraph
3727 % (via \afterenvbreak's vertical glue), and then the group. That way we
3728 % keep the zero \parskip that the environments set -- \parskip glue
3729 % will be inserted at the beginning of the next paragraph in the
3730 % document, after the environment.
3732 \def\nonfillfinish{\afterenvbreak\endgroup}%
3734 \def\lisp{\begingroup
3735 \nonfillstart
3736 \let\Elisp = \nonfillfinish
3738 % Make @kbd do something special, if requested.
3739 \let\kbdfont\kbdexamplefont
3740 \rawbackslash % have \ input char produce \ char from current font
3741 \gobble
3744 % Define the \E... control sequence only if we are inside the
3745 % environment, so the error checking in \end will work.
3747 % We must call \lisp last in the definition, since it reads the
3748 % return following the @example (or whatever) command.
3750 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
3751 \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
3752 \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
3754 % @smallexample and @smalllisp. This is not used unless the @smallbook
3755 % command is given. Originally contributed by Pavel@xerox.
3757 \def\smalllispx{\begingroup
3758 \nonfillstart
3759 \let\Esmalllisp = \nonfillfinish
3760 \let\Esmallexample = \nonfillfinish
3762 % Smaller fonts for small examples.
3763 \indexfonts \tt
3764 \rawbackslash % make \ output the \ character from the current font (tt)
3765 \gobble
3768 % This is @display; same as @lisp except use roman font.
3770 \def\display{\begingroup
3771 \nonfillstart
3772 \let\Edisplay = \nonfillfinish
3773 \gobble
3776 % This is @format; same as @display except don't narrow margins.
3778 \def\format{\begingroup
3779 \let\nonarrowing = t
3780 \nonfillstart
3781 \let\Eformat = \nonfillfinish
3782 \gobble
3785 % @flushleft (same as @format) and @flushright.
3787 \def\flushleft{\begingroup
3788 \let\nonarrowing = t
3789 \nonfillstart
3790 \let\Eflushleft = \nonfillfinish
3791 \gobble
3793 \def\flushright{\begingroup
3794 \let\nonarrowing = t
3795 \nonfillstart
3796 \let\Eflushright = \nonfillfinish
3797 \advance\leftskip by 0pt plus 1fill
3798 \gobble}
3800 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
3801 % and narrows the margins.
3803 \def\quotation{%
3804 \begingroup\inENV %This group ends at the end of the @quotation body
3805 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
3806 \singlespace
3807 \parindent=0pt
3808 % We have retained a nonzero parskip for the environment, since we're
3809 % doing normal filling. So to avoid extra space below the environment...
3810 \def\Equotation{\parskip = 0pt \nonfillfinish}%
3812 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
3813 \ifx\nonarrowing\relax
3814 \advance\leftskip by \lispnarrowing
3815 \advance\rightskip by \lispnarrowing
3816 \exdentamount = \lispnarrowing
3817 \let\nonarrowing = \relax
3821 \message{defuns,}
3822 % Define formatter for defuns
3823 % First, allow user to change definition object font (\df) internally
3824 \def\setdeffont #1 {\csname DEF#1\endcsname}
3826 \newskip\defbodyindent \defbodyindent=.4in
3827 \newskip\defargsindent \defargsindent=50pt
3828 \newskip\deftypemargin \deftypemargin=12pt
3829 \newskip\deflastargmargin \deflastargmargin=18pt
3831 \newcount\parencount
3832 % define \functionparens, which makes ( and ) and & do special things.
3833 % \functionparens affects the group it is contained in.
3834 \def\activeparens{%
3835 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
3836 \catcode`\[=\active \catcode`\]=\active}
3838 % Make control sequences which act like normal parenthesis chars.
3839 \let\lparen = ( \let\rparen = )
3841 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
3843 % Be sure that we always have a definition for `(', etc. For example,
3844 % if the fn name has parens in it, \boldbrax will not be in effect yet,
3845 % so TeX would otherwise complain about undefined control sequence.
3846 \global\let(=\lparen \global\let)=\rparen
3847 \global\let[=\lbrack \global\let]=\rbrack
3849 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
3850 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
3851 % This is used to turn on special parens
3852 % but make & act ordinary (given that it's active).
3853 \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
3855 % Definitions of (, ) and & used in args for functions.
3856 % This is the definition of ( outside of all parentheses.
3857 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
3858 \global\advance\parencount by 1
3861 % This is the definition of ( when already inside a level of parens.
3862 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
3864 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
3865 % also in that case restore the outer-level definition of (.
3866 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
3867 \global\advance \parencount by -1 }
3868 % If we encounter &foo, then turn on ()-hacking afterwards
3869 \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
3871 \gdef\normalparens{\boldbrax\let&=\ampnr}
3872 } % End of definition inside \activeparens
3873 %% These parens (in \boldbrax) actually are a little bolder than the
3874 %% contained text. This is especially needed for [ and ]
3875 \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
3876 \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
3877 \def\ampnr{\&}
3878 \def\lbrb{{\bf\char`\[}}
3879 \def\rbrb{{\bf\char`\]}}
3881 % First, defname, which formats the header line itself.
3882 % #1 should be the function name.
3883 % #2 should be the type of definition, such as "Function".
3885 \def\defname #1#2{%
3886 % Get the values of \leftskip and \rightskip as they were
3887 % outside the @def...
3888 \dimen2=\leftskip
3889 \advance\dimen2 by -\defbodyindent
3890 \dimen3=\rightskip
3891 \advance\dimen3 by -\defbodyindent
3892 \noindent %
3893 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
3894 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
3895 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
3896 \parshape 2 0in \dimen0 \defargsindent \dimen1 %
3897 % Now output arg 2 ("Function" or some such)
3898 % ending at \deftypemargin from the right margin,
3899 % but stuck inside a box of width 0 so it does not interfere with linebreaking
3900 {% Adjust \hsize to exclude the ambient margins,
3901 % so that \rightline will obey them.
3902 \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
3903 \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
3904 % Make all lines underfull and no complaints:
3905 \tolerance=10000 \hbadness=10000
3906 \advance\leftskip by -\defbodyindent
3907 \exdentamount=\defbodyindent
3908 {\df #1}\enskip % Generate function name
3911 % Actually process the body of a definition
3912 % #1 should be the terminating control sequence, such as \Edefun.
3913 % #2 should be the "another name" control sequence, such as \defunx.
3914 % #3 should be the control sequence that actually processes the header,
3915 % such as \defunheader.
3917 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3918 \medbreak %
3919 % Define the end token that this defining construct specifies
3920 % so that it will exit this group.
3921 \def#1{\endgraf\endgroup\medbreak}%
3922 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
3923 \parindent=0in
3924 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3925 \exdentamount=\defbodyindent
3926 \begingroup %
3927 \catcode 61=\active % 61 is `='
3928 \obeylines\activeparens\spacesplit#3}
3930 % #1 is the \E... control sequence to end the definition (which we define).
3931 % #2 is the \...x control sequence for consecutive fns (which we define).
3932 % #3 is the control sequence to call to resume processing.
3933 % #4, delimited by the space, is the class name.
3935 \def\defmethparsebody#1#2#3#4 {\begingroup\inENV %
3936 \medbreak %
3937 % Define the end token that this defining construct specifies
3938 % so that it will exit this group.
3939 \def#1{\endgraf\endgroup\medbreak}%
3940 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
3941 \parindent=0in
3942 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3943 \exdentamount=\defbodyindent
3944 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
3946 % @deftypemethod has an extra argument that nothing else does. Sigh.
3948 \def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV %
3949 \medbreak %
3950 % Define the end token that this defining construct specifies
3951 % so that it will exit this group.
3952 \def#1{\endgraf\endgroup\medbreak}%
3953 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
3954 \parindent=0in
3955 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3956 \exdentamount=\defbodyindent
3957 \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}}
3959 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
3960 \medbreak %
3961 % Define the end token that this defining construct specifies
3962 % so that it will exit this group.
3963 \def#1{\endgraf\endgroup\medbreak}%
3964 \def#2##1 ##2 {\def#4{##1}%
3965 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
3966 \parindent=0in
3967 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3968 \exdentamount=\defbodyindent
3969 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
3971 % These parsing functions are similar to the preceding ones
3972 % except that they do not make parens into active characters.
3973 % These are used for "variables" since they have no arguments.
3975 \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3976 \medbreak %
3977 % Define the end token that this defining construct specifies
3978 % so that it will exit this group.
3979 \def#1{\endgraf\endgroup\medbreak}%
3980 \def#2{\begingroup\obeylines\spacesplit#3}%
3981 \parindent=0in
3982 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3983 \exdentamount=\defbodyindent
3984 \begingroup %
3985 \catcode 61=\active %
3986 \obeylines\spacesplit#3}
3988 % This is used for \def{tp,vr}parsebody. It could probably be used for
3989 % some of the others, too, with some judicious conditionals.
3991 \def\parsebodycommon#1#2#3{%
3992 \begingroup\inENV %
3993 \medbreak %
3994 % Define the end token that this defining construct specifies
3995 % so that it will exit this group.
3996 \def#1{\endgraf\endgroup\medbreak}%
3997 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
3998 \parindent=0in
3999 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4000 \exdentamount=\defbodyindent
4001 \begingroup\obeylines
4004 \def\defvrparsebody#1#2#3#4 {%
4005 \parsebodycommon{#1}{#2}{#3}%
4006 \spacesplit{#3{#4}}%
4009 % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
4010 % type is just `struct', because we lose the braces in `{struct
4011 % termios}' when \spacesplit reads its undelimited argument. Sigh.
4012 % \let\deftpparsebody=\defvrparsebody
4014 % So, to get around this, we put \empty in with the type name. That
4015 % way, TeX won't find exactly `{...}' as an undelimited argument, and
4016 % won't strip off the braces.
4018 \def\deftpparsebody #1#2#3#4 {%
4019 \parsebodycommon{#1}{#2}{#3}%
4020 \spacesplit{\parsetpheaderline{#3{#4}}}\empty
4023 % Fine, but then we have to eventually remove the \empty *and* the
4024 % braces (if any). That's what this does.
4026 \def\removeemptybraces\empty#1\relax{#1}
4028 % After \spacesplit has done its work, this is called -- #1 is the final
4029 % thing to call, #2 the type name (which starts with \empty), and #3
4030 % (which might be empty) the arguments.
4032 \def\parsetpheaderline#1#2#3{%
4033 #1{\removeemptybraces#2\relax}{#3}%
4036 \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
4037 \medbreak %
4038 % Define the end token that this defining construct specifies
4039 % so that it will exit this group.
4040 \def#1{\endgraf\endgroup\medbreak}%
4041 \def#2##1 ##2 {\def#4{##1}%
4042 \begingroup\obeylines\spacesplit{#3{##2}}}%
4043 \parindent=0in
4044 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4045 \exdentamount=\defbodyindent
4046 \begingroup\obeylines\spacesplit{#3{#5}}}
4048 % Split up #2 at the first space token.
4049 % call #1 with two arguments:
4050 % the first is all of #2 before the space token,
4051 % the second is all of #2 after that space token.
4052 % If #2 contains no space token, all of it is passed as the first arg
4053 % and the second is passed as empty.
4055 {\obeylines
4056 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
4057 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
4058 \ifx\relax #3%
4059 #1{#2}{}\else #1{#2}{#3#4}\fi}}
4061 % So much for the things common to all kinds of definitions.
4063 % Define @defun.
4065 % First, define the processing that is wanted for arguments of \defun
4066 % Use this to expand the args and terminate the paragraph they make up
4068 \def\defunargs #1{\functionparens \sl
4069 % Expand, preventing hyphenation at `-' chars.
4070 % Note that groups don't affect changes in \hyphenchar.
4071 \hyphenchar\tensl=0
4073 \hyphenchar\tensl=45
4074 \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
4075 \interlinepenalty=10000
4076 \advance\rightskip by 0pt plus 1fil
4077 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
4080 \def\deftypefunargs #1{%
4081 % Expand, preventing hyphenation at `-' chars.
4082 % Note that groups don't affect changes in \hyphenchar.
4083 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
4084 \boldbraxnoamp
4085 \tclose{#1}% avoid \code because of side effects on active chars
4086 \interlinepenalty=10000
4087 \advance\rightskip by 0pt plus 1fil
4088 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
4091 % Do complete processing of one @defun or @defunx line already parsed.
4093 % @deffn Command forward-char nchars
4095 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
4097 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
4098 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
4099 \catcode 61=\other % Turn off change made in \defparsebody
4102 % @defun == @deffn Function
4104 \def\defun{\defparsebody\Edefun\defunx\defunheader}
4106 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4107 \begingroup\defname {#1}{Function}%
4108 \defunargs {#2}\endgroup %
4109 \catcode 61=\other % Turn off change made in \defparsebody
4112 % @deftypefun int foobar (int @var{foo}, float @var{bar})
4114 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
4116 % #1 is the data type. #2 is the name and args.
4117 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
4118 % #1 is the data type, #2 the name, #3 the args.
4119 \def\deftypefunheaderx #1#2 #3\relax{%
4120 \doind {fn}{\code{#2}}% Make entry in function index
4121 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
4122 \deftypefunargs {#3}\endgroup %
4123 \catcode 61=\other % Turn off change made in \defparsebody
4126 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
4128 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
4130 % \defheaderxcond#1\relax$$$
4131 % puts #1 in @code, followed by a space, but does nothing if #1 is null.
4132 \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
4134 % #1 is the classification. #2 is the data type. #3 is the name and args.
4135 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
4136 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
4137 \def\deftypefnheaderx #1#2#3 #4\relax{%
4138 \doind {fn}{\code{#3}}% Make entry in function index
4139 \begingroup
4140 \normalparens % notably, turn off `&' magic, which prevents
4141 % at least some C++ text from working
4142 \defname {\defheaderxcond#2\relax$$$#3}{#1}%
4143 \deftypefunargs {#4}\endgroup %
4144 \catcode 61=\other % Turn off change made in \defparsebody
4147 % @defmac == @deffn Macro
4149 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
4151 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4152 \begingroup\defname {#1}{Macro}%
4153 \defunargs {#2}\endgroup %
4154 \catcode 61=\other % Turn off change made in \defparsebody
4157 % @defspec == @deffn Special Form
4159 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
4161 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4162 \begingroup\defname {#1}{Special Form}%
4163 \defunargs {#2}\endgroup %
4164 \catcode 61=\other % Turn off change made in \defparsebody
4167 % This definition is run if you use @defunx
4168 % anywhere other than immediately after a @defun or @defunx.
4170 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
4171 \def\defunx #1 {\errmessage{@defunx in invalid context}}
4172 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
4173 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
4174 \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
4175 \def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}}
4176 \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
4178 % @defmethod, and so on
4180 % @defop CATEGORY CLASS OPERATION ARG...
4182 \def\defop #1 {\def\defoptype{#1}%
4183 \defopparsebody\Edefop\defopx\defopheader\defoptype}
4185 \def\defopheader #1#2#3{%
4186 \dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index
4187 \begingroup\defname {#2}{\defoptype{} on #1}%
4188 \defunargs {#3}\endgroup %
4191 % @deftypemethod CLASS RETURN-TYPE METHOD ARG...
4193 \def\deftypemethod{%
4194 \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
4196 % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
4197 \def\deftypemethodheader#1#2#3#4{%
4198 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
4199 \begingroup
4200 \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}%
4201 \deftypefunargs{#4}%
4202 \endgroup
4205 % @defmethod == @defop Method
4207 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
4209 % #1 is the class name, #2 the method name, #3 the args.
4210 \def\defmethodheader#1#2#3{%
4211 \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
4212 \begingroup
4213 \defname{#2}{\putwordMethodon\ \code{#1}}%
4214 \defunargs{#3}%
4215 \endgroup
4218 % @defcv {Class Option} foo-class foo-flag
4220 \def\defcv #1 {\def\defcvtype{#1}%
4221 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
4223 \def\defcvarheader #1#2#3{%
4224 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4225 \begingroup\defname {#2}{\defcvtype{} of #1}%
4226 \defvarargs {#3}\endgroup %
4229 % @defivar == @defcv {Instance Variable}
4231 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
4233 \def\defivarheader #1#2#3{%
4234 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4235 \begingroup\defname {#2}{Instance Variable of #1}%
4236 \defvarargs {#3}\endgroup %
4239 % These definitions are run if you use @defmethodx, etc.,
4240 % anywhere other than immediately after a @defmethod, etc.
4242 \def\defopx #1 {\errmessage{@defopx in invalid context}}
4243 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
4244 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
4245 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
4247 % Now @defvar
4249 % First, define the processing that is wanted for arguments of @defvar.
4250 % This is actually simple: just print them in roman.
4251 % This must expand the args and terminate the paragraph they make up
4252 \def\defvarargs #1{\normalparens #1%
4253 \interlinepenalty=10000
4254 \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
4256 % @defvr Counter foo-count
4258 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
4260 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
4261 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
4263 % @defvar == @defvr Variable
4265 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
4267 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4268 \begingroup\defname {#1}{Variable}%
4269 \defvarargs {#2}\endgroup %
4272 % @defopt == @defvr {User Option}
4274 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
4276 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4277 \begingroup\defname {#1}{User Option}%
4278 \defvarargs {#2}\endgroup %
4281 % @deftypevar int foobar
4283 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
4285 % #1 is the data type. #2 is the name, perhaps followed by text that
4286 % is actually part of the data type, which should not be put into the index.
4287 \def\deftypevarheader #1#2{%
4288 \dovarind#2 \relax% Make entry in variables index
4289 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
4290 \interlinepenalty=10000
4291 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
4292 \endgroup}
4293 \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
4295 % @deftypevr {Global Flag} int enable
4297 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
4299 \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
4300 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
4301 \interlinepenalty=10000
4302 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
4303 \endgroup}
4305 % This definition is run if you use @defvarx
4306 % anywhere other than immediately after a @defvar or @defvarx.
4308 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
4309 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
4310 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
4311 \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
4312 \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
4314 % Now define @deftp
4315 % Args are printed in bold, a slight difference from @defvar.
4317 \def\deftpargs #1{\bf \defvarargs{#1}}
4319 % @deftp Class window height width ...
4321 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
4323 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4324 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4326 % This definition is run if you use @deftpx, etc
4327 % anywhere other than immediately after a @deftp, etc.
4329 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
4332 \message{cross reference,}
4333 \newwrite\auxfile
4335 \newif\ifhavexrefs % True if xref values are known.
4336 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
4338 % @inforef is relatively simple.
4339 \def\inforef #1{\inforefzzz #1,,,,**}
4340 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
4341 node \samp{\ignorespaces#1{}}}
4343 % @setref{foo} defines a cross-reference point named foo.
4345 \def\setref#1{%
4346 \dosetq{#1-title}{Ytitle}%
4347 \dosetq{#1-pg}{Ypagenumber}%
4348 \dosetq{#1-snt}{Ysectionnumberandtype}}
4350 \def\unnumbsetref#1{%
4351 \dosetq{#1-title}{Ytitle}%
4352 \dosetq{#1-pg}{Ypagenumber}%
4353 \dosetq{#1-snt}{Ynothing}}
4355 \def\appendixsetref#1{%
4356 \dosetq{#1-title}{Ytitle}%
4357 \dosetq{#1-pg}{Ypagenumber}%
4358 \dosetq{#1-snt}{Yappendixletterandtype}}
4360 % \xref, \pxref, and \ref generate cross-references to specified points.
4361 % For \xrefX, #1 is the node name, #2 the name of the Info
4362 % cross-reference, #3 the printed node name, #4 the name of the Info
4363 % file, #5 the name of the printed manual. All but the node name can be
4364 % omitted.
4366 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
4367 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
4368 \def\ref#1{\xrefX[#1,,,,,,,]}
4369 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
4370 \def\printedmanual{\ignorespaces #5}%
4371 \def\printednodename{\ignorespaces #3}%
4372 \setbox1=\hbox{\printedmanual}%
4373 \setbox0=\hbox{\printednodename}%
4374 \ifdim \wd0 = 0pt
4375 % No printed node name was explicitly given.
4376 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
4377 % Use the node name inside the square brackets.
4378 \def\printednodename{\ignorespaces #1}%
4379 \else
4380 % Use the actual chapter/section title appear inside
4381 % the square brackets. Use the real section title if we have it.
4382 \ifdim \wd1>0pt%
4383 % It is in another manual, so we don't have it.
4384 \def\printednodename{\ignorespaces #1}%
4385 \else
4386 \ifhavexrefs
4387 % We know the real title if we have the xref values.
4388 \def\printednodename{\refx{#1-title}{}}%
4389 \else
4390 % Otherwise just copy the Info node name.
4391 \def\printednodename{\ignorespaces #1}%
4392 \fi%
4397 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
4398 % insert empty discretionaries after hyphens, which means that it will
4399 % not find a line break at a hyphen in a node names. Since some manuals
4400 % are best written with fairly long node names, containing hyphens, this
4401 % is a loss. Therefore, we give the text of the node name again, so it
4402 % is as if TeX is seeing it for the first time.
4403 \ifdim \wd1 > 0pt
4404 \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
4405 \else
4406 % _ (for example) has to be the character _ for the purposes of the
4407 % control sequence corresponding to the node, but it has to expand
4408 % into the usual \leavevmode...\vrule stuff for purposes of
4409 % printing. So we \turnoffactive for the \refx-snt, back on for the
4410 % printing, back off for the \refx-pg.
4411 {\normalturnoffactive \refx{#1-snt}{}}%
4412 \space [\printednodename],\space
4413 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
4415 \endgroup}
4417 % \dosetq is the interface for calls from other macros
4419 % Use \normalturnoffactive so that punctuation chars such as underscore
4420 % and backslash work in node names. (\turnoffactive doesn't do \.)
4421 \def\dosetq#1#2{%
4422 {\let\folio=0
4423 \normalturnoffactive
4424 \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
4425 \next
4429 % \internalsetq {foo}{page} expands into
4430 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
4431 % When the aux file is read, ' is the escape character
4433 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
4435 % Things to be expanded by \internalsetq
4437 \def\Ypagenumber{\folio}
4439 \def\Ytitle{\thissection}
4441 \def\Ynothing{}
4443 \def\Ysectionnumberandtype{%
4444 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
4445 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
4446 \else \ifnum \subsubsecno=0 %
4447 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
4448 \else %
4449 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
4450 \fi \fi \fi }
4452 \def\Yappendixletterandtype{%
4453 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
4454 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
4455 \else \ifnum \subsubsecno=0 %
4456 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
4457 \else %
4458 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
4459 \fi \fi \fi }
4461 \gdef\xreftie{'tie}
4463 % Use TeX 3.0's \inputlineno to get the line number, for better error
4464 % messages, but if we're using an old version of TeX, don't do anything.
4466 \ifx\inputlineno\thisisundefined
4467 \let\linenumber = \empty % Non-3.0.
4468 \else
4469 \def\linenumber{\the\inputlineno:\space}
4472 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
4473 % If its value is nonempty, SUFFIX is output afterward.
4475 \def\refx#1#2{%
4476 \expandafter\ifx\csname X#1\endcsname\relax
4477 % If not defined, say something at least.
4478 \angleleft un\-de\-fined\angleright
4479 \ifhavexrefs
4480 \message{\linenumber Undefined cross reference `#1'.}%
4481 \else
4482 \ifwarnedxrefs\else
4483 \global\warnedxrefstrue
4484 \message{Cross reference values unknown; you must run TeX again.}%
4487 \else
4488 % It's defined, so just use it.
4489 \csname X#1\endcsname
4491 #2% Output the suffix in any case.
4494 % This is the macro invoked by entries in the aux file.
4496 \def\xrdef#1{\begingroup
4497 % Reenable \ as an escape while reading the second argument.
4498 \catcode`\\ = 0
4499 \afterassignment\endgroup
4500 \expandafter\gdef\csname X#1\endcsname
4503 % Read the last existing aux file, if any. No error if none exists.
4504 \def\readauxfile{\begingroup
4505 \catcode`\^^@=\other
4506 \catcode`\^^A=\other
4507 \catcode`\^^B=\other
4508 \catcode`\^^C=\other
4509 \catcode`\^^D=\other
4510 \catcode`\^^E=\other
4511 \catcode`\^^F=\other
4512 \catcode`\^^G=\other
4513 \catcode`\^^H=\other
4514 \catcode`\^^K=\other
4515 \catcode`\^^L=\other
4516 \catcode`\^^N=\other
4517 \catcode`\^^P=\other
4518 \catcode`\^^Q=\other
4519 \catcode`\^^R=\other
4520 \catcode`\^^S=\other
4521 \catcode`\^^T=\other
4522 \catcode`\^^U=\other
4523 \catcode`\^^V=\other
4524 \catcode`\^^W=\other
4525 \catcode`\^^X=\other
4526 \catcode`\^^Z=\other
4527 \catcode`\^^[=\other
4528 \catcode`\^^\=\other
4529 \catcode`\^^]=\other
4530 \catcode`\^^^=\other
4531 \catcode`\^^_=\other
4532 \catcode`\@=\other
4533 \catcode`\^=\other
4534 % It was suggested to define this as 7, which would allow ^^e4 etc.
4535 % in xref tags, i.e., node names. But since ^^e4 notation isn't
4536 % supported in the main text, it doesn't seem desirable. Furthermore,
4537 % that is not enough: for node names that actually contain a ^
4538 % character, we would end up writing a line like this: 'xrdef {'hat
4539 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
4540 % argument, and \hat is not an expandable control sequence. It could
4541 % all be worked out, but why? Either we support ^^ or we don't.
4543 % The other change necessary for this was to define \auxhat:
4544 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
4545 % and then to call \auxhat in \setq.
4547 \catcode`\~=\other
4548 \catcode`\[=\other
4549 \catcode`\]=\other
4550 \catcode`\"=\other
4551 \catcode`\_=\other
4552 \catcode`\|=\other
4553 \catcode`\<=\other
4554 \catcode`\>=\other
4555 \catcode`\$=\other
4556 \catcode`\#=\other
4557 \catcode`\&=\other
4558 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
4559 % Make the characters 128-255 be printing characters
4561 \count 1=128
4562 \def\loop{%
4563 \catcode\count 1=\other
4564 \advance\count 1 by 1
4565 \ifnum \count 1<256 \loop \fi
4568 % The aux file uses ' as the escape (for now).
4569 % Turn off \ as an escape so we do not lose on
4570 % entries which were dumped with control sequences in their names.
4571 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
4572 % Reference to such entries still does not work the way one would wish,
4573 % but at least they do not bomb out when the aux file is read in.
4574 \catcode`\{=1
4575 \catcode`\}=2
4576 \catcode`\%=\other
4577 \catcode`\'=0
4578 \catcode`\\=\other
4580 \openin 1 \jobname.aux
4581 \ifeof 1 \else
4582 \closein 1
4583 \input \jobname.aux
4584 \global\havexrefstrue
4585 \global\warnedobstrue
4587 % Open the new aux file. TeX will close it automatically at exit.
4588 \openout\auxfile=\jobname.aux
4589 \endgroup}
4592 % Footnotes.
4594 \newcount \footnoteno
4596 % The trailing space in the following definition for supereject is
4597 % vital for proper filling; pages come out unaligned when you do a
4598 % pagealignmacro call if that space before the closing brace is
4599 % removed. (Generally, numeric constants should always be followed by a
4600 % space to prevent strange expansion errors.)
4601 \def\supereject{\par\penalty -20000\footnoteno =0 }
4603 % @footnotestyle is meaningful for info output only.
4604 \let\footnotestyle=\comment
4606 \let\ptexfootnote=\footnote
4608 {\catcode `\@=11
4610 % Auto-number footnotes. Otherwise like plain.
4611 \gdef\footnote{%
4612 \global\advance\footnoteno by \@ne
4613 \edef\thisfootno{$^{\the\footnoteno}$}%
4615 % In case the footnote comes at the end of a sentence, preserve the
4616 % extra spacing after we do the footnote number.
4617 \let\@sf\empty
4618 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
4620 % Remove inadvertent blank space before typesetting the footnote number.
4621 \unskip
4622 \thisfootno\@sf
4623 \footnotezzz
4626 % Don't bother with the trickery in plain.tex to not require the
4627 % footnote text as a parameter. Our footnotes don't need to be so general.
4629 % Oh yes, they do; otherwise, @ifset and anything else that uses
4630 % \parseargline fail inside footnotes because the tokens are fixed when
4631 % the footnote is read. --karl, 16nov96.
4633 \long\gdef\footnotezzz{\insert\footins\bgroup
4634 % We want to typeset this text as a normal paragraph, even if the
4635 % footnote reference occurs in (for example) a display environment.
4636 % So reset some parameters.
4637 \interlinepenalty\interfootnotelinepenalty
4638 \splittopskip\ht\strutbox % top baseline for broken footnotes
4639 \splitmaxdepth\dp\strutbox
4640 \floatingpenalty\@MM
4641 \leftskip\z@skip
4642 \rightskip\z@skip
4643 \spaceskip\z@skip
4644 \xspaceskip\z@skip
4645 \parindent\defaultparindent
4647 % Hang the footnote text off the number.
4648 \hang
4649 \textindent{\thisfootno}%
4651 % Don't crash into the line above the footnote text. Since this
4652 % expands into a box, it must come within the paragraph, lest it
4653 % provide a place where TeX can split the footnote.
4654 \footstrut
4655 \futurelet\next\fo@t
4657 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
4658 \else\let\next\f@t\fi \next}
4659 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
4660 \def\f@t#1{#1\@foot}
4661 \def\@foot{\strut\egroup}
4663 }%end \catcode `\@=11
4665 % Set the baselineskip to #1, and the lineskip and strut size
4666 % correspondingly. There is no deep meaning behind these magic numbers
4667 % used as factors; they just match (closely enough) what Knuth defined.
4669 \def\lineskipfactor{.08333}
4670 \def\strutheightpercent{.70833}
4671 \def\strutdepthpercent {.29167}
4673 \def\setleading#1{%
4674 \normalbaselineskip = #1\relax
4675 \normallineskip = \lineskipfactor\normalbaselineskip
4676 \normalbaselines
4677 \setbox\strutbox =\hbox{%
4678 \vrule width0pt height\strutheightpercent\baselineskip
4679 depth \strutdepthpercent \baselineskip
4683 % @| inserts a changebar to the left of the current line. It should
4684 % surround any changed text. This approach does *not* work if the
4685 % change spans more than two lines of output. To handle that, we would
4686 % have adopt a much more difficult approach (putting marks into the main
4687 % vertical list for the beginning and end of each change).
4689 \def\|{%
4690 % \vadjust can only be used in horizontal mode.
4691 \leavevmode
4693 % Append this vertical mode material after the current line in the output.
4694 \vadjust{%
4695 % We want to insert a rule with the height and depth of the current
4696 % leading; that is exactly what \strutbox is supposed to record.
4697 \vskip-\baselineskip
4699 % \vadjust-items are inserted at the left edge of the type. So
4700 % the \llap here moves out into the left-hand margin.
4701 \llap{%
4703 % For a thicker or thinner bar, change the `1pt'.
4704 \vrule height\baselineskip width1pt
4706 % This is the space between the bar and the text.
4707 \hskip 12pt
4712 % For a final copy, take out the rectangles
4713 % that mark overfull boxes (in case you have decided
4714 % that the text looks ok even though it passes the margin).
4716 \def\finalout{\overfullrule=0pt}
4718 % @image. We use the macros from epsf.tex to support this.
4719 % If epsf.tex is not installed and @image is used, we complain.
4721 % Check for and read epsf.tex up front. If we read it only at @image
4722 % time, we might be inside a group, and then its definitions would get
4723 % undone and the next image would fail.
4724 \openin 1 = epsf.tex
4725 \ifeof 1 \else
4726 \closein 1
4727 \def\epsfannounce{\toks0 = }% do not bother showing banner
4728 \input epsf.tex
4731 \newif\ifwarnednoepsf
4732 \newhelp\noepsfhelp{epsf.tex must be installed for images to
4733 work. It is also included in the Texinfo distribution, or you can get
4734 it from ftp://ftp.tug.org/tex/epsf.tex.}
4736 % Only complain once about lack of epsf.tex.
4737 \def\image#1{%
4738 \ifx\epsfbox\undefined
4739 \ifwarnednoepsf \else
4740 \errhelp = \noepsfhelp
4741 \errmessage{epsf.tex not found, images will be ignored}%
4742 \global\warnednoepsftrue
4744 \else
4745 \imagexxx #1,,,\finish
4749 % Arguments to @image:
4750 % #1 is (mandatory) image filename; we tack on .eps extension.
4751 % #2 is (optional) width, #3 is (optional) height.
4752 % #4 is just the usual extra ignored arg for parsing this stuff.
4753 \def\imagexxx#1,#2,#3,#4\finish{%
4754 % \epsfbox itself resets \epsf?size at each figure.
4755 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
4756 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
4757 \epsfbox{#1.eps}%
4760 % End of control word definitions.
4763 \message{and turning on texinfo input format.}
4765 \def\openindices{%
4766 \newindex{cp}%
4767 \newcodeindex{fn}%
4768 \newcodeindex{vr}%
4769 \newcodeindex{tp}%
4770 \newcodeindex{ky}%
4771 \newcodeindex{pg}%
4774 % Set some numeric style parameters, for 8.5 x 11 format.
4776 \hsize = 6in
4777 \hoffset = .25in
4778 \newdimen\defaultparindent \defaultparindent = 15pt
4779 \parindent = \defaultparindent
4780 \parskip 3pt plus 2pt minus 1pt
4781 \setleading{13.2pt}
4782 \advance\topskip by 1.2cm
4784 \chapheadingskip = 15pt plus 4pt minus 2pt
4785 \secheadingskip = 12pt plus 3pt minus 2pt
4786 \subsecheadingskip = 9pt plus 2pt minus 2pt
4788 % Prevent underfull vbox error messages.
4789 \vbadness=10000
4791 % Following George Bush, just get rid of widows and orphans.
4792 \widowpenalty=10000
4793 \clubpenalty=10000
4795 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
4796 % using an old version of TeX, don't do anything. We want the amount of
4797 % stretch added to depend on the line length, hence the dependence on
4798 % \hsize. This makes it come to about 9pt for the 8.5x11 format.
4800 \ifx\emergencystretch\thisisundefined
4801 % Allow us to assign to \emergencystretch anyway.
4802 \def\emergencystretch{\dimen0}%
4803 \else
4804 \emergencystretch = \hsize
4805 \divide\emergencystretch by 45
4808 % Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25)
4809 \def\smallbook{
4810 \global\chapheadingskip = 15pt plus 4pt minus 2pt
4811 \global\secheadingskip = 12pt plus 3pt minus 2pt
4812 \global\subsecheadingskip = 9pt plus 2pt minus 2pt
4814 \global\lispnarrowing = 0.3in
4815 \setleading{12pt}
4816 \advance\topskip by -1cm
4817 \global\parskip 2pt plus 1pt
4818 \global\hsize = 5in
4819 \global\vsize=7.5in
4820 \global\tolerance=700
4821 \global\hfuzz=1pt
4822 \global\contentsrightmargin=0pt
4823 \global\deftypemargin=0pt
4824 \global\defbodyindent=.5cm
4826 \global\pagewidth=\hsize
4827 \global\pageheight=\vsize
4829 \global\let\smalllisp=\smalllispx
4830 \global\let\smallexample=\smalllispx
4831 \global\def\Esmallexample{\Esmalllisp}
4834 % Use @afourpaper to print on European A4 paper.
4835 \def\afourpaper{
4836 \global\tolerance=700
4837 \global\hfuzz=1pt
4838 \setleading{12pt}
4839 \global\parskip 15pt plus 1pt
4841 \global\vsize= 53\baselineskip
4842 \advance\vsize by \topskip
4843 %\global\hsize= 5.85in % A4 wide 10pt
4844 \global\hsize= 6.5in
4845 \global\outerhsize=\hsize
4846 \global\advance\outerhsize by 0.5in
4847 \global\outervsize=\vsize
4848 \global\advance\outervsize by 0.6in
4850 \global\pagewidth=\hsize
4851 \global\pageheight=\vsize
4854 \bindingoffset=0pt
4855 \normaloffset=\hoffset
4856 \pagewidth=\hsize
4857 \pageheight=\vsize
4859 % Allow control of the text dimensions. Parameters in order: textheight;
4860 % textwidth; voffset; hoffset; binding offset; topskip.
4861 % All require a dimension;
4862 % header is additional; added length extends the bottom of the page.
4864 \def\changepagesizes#1#2#3#4#5#6{
4865 \global\vsize= #1
4866 \global\topskip= #6
4867 \advance\vsize by \topskip
4868 \global\voffset= #3
4869 \global\hsize= #2
4870 \global\outerhsize=\hsize
4871 \global\advance\outerhsize by 0.5in
4872 \global\outervsize=\vsize
4873 \global\advance\outervsize by 0.6in
4874 \global\pagewidth=\hsize
4875 \global\pageheight=\vsize
4876 \global\normaloffset= #4
4877 \global\bindingoffset= #5}
4879 % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
4880 % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
4881 \def\afourlatex
4882 {\global\tolerance=700
4883 \global\hfuzz=1pt
4884 \setleading{12pt}
4885 \global\parskip 15pt plus 1pt
4886 \advance\baselineskip by 1.6pt
4887 \changepagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}
4890 % Use @afourwide to print on European A4 paper in wide format.
4891 \def\afourwide{\afourpaper
4892 \changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}}
4894 % Define macros to output various characters with catcode for normal text.
4895 \catcode`\"=\other
4896 \catcode`\~=\other
4897 \catcode`\^=\other
4898 \catcode`\_=\other
4899 \catcode`\|=\other
4900 \catcode`\<=\other
4901 \catcode`\>=\other
4902 \catcode`\+=\other
4903 \def\normaldoublequote{"}
4904 \def\normaltilde{~}
4905 \def\normalcaret{^}
4906 \def\normalunderscore{_}
4907 \def\normalverticalbar{|}
4908 \def\normalless{<}
4909 \def\normalgreater{>}
4910 \def\normalplus{+}
4912 % This macro is used to make a character print one way in ttfont
4913 % where it can probably just be output, and another way in other fonts,
4914 % where something hairier probably needs to be done.
4916 % #1 is what to print if we are indeed using \tt; #2 is what to print
4917 % otherwise. Since all the Computer Modern typewriter fonts have zero
4918 % interword stretch (and shrink), and it is reasonable to expect all
4919 % typewriter fonts to have this, we can check that font parameter.
4921 \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
4923 % Turn off all special characters except @
4924 % (and those which the user can use as if they were ordinary).
4925 % Most of these we simply print from the \tt font, but for some, we can
4926 % use math or other variants that look better in normal text.
4928 \catcode`\"=\active
4929 \def\activedoublequote{{\tt\char34}}
4930 \let"=\activedoublequote
4931 \catcode`\~=\active
4932 \def~{{\tt\char126}}
4933 \chardef\hat=`\^
4934 \catcode`\^=\active
4935 \def^{{\tt \hat}}
4937 \catcode`\_=\active
4938 \def_{\ifusingtt\normalunderscore\_}
4939 % Subroutine for the previous macro.
4940 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
4942 \catcode`\|=\active
4943 \def|{{\tt\char124}}
4944 \chardef \less=`\<
4945 \catcode`\<=\active
4946 \def<{{\tt \less}}
4947 \chardef \gtr=`\>
4948 \catcode`\>=\active
4949 \def>{{\tt \gtr}}
4950 \catcode`\+=\active
4951 \def+{{\tt \char 43}}
4952 %\catcode 27=\active
4953 %\def^^[{$\diamondsuit$}
4955 % Set up an active definition for =, but don't enable it most of the time.
4956 {\catcode`\==\active
4957 \global\def={{\tt \char 61}}}
4959 \catcode`+=\active
4960 \catcode`\_=\active
4962 % If a .fmt file is being used, characters that might appear in a file
4963 % name cannot be active until we have parsed the command line.
4964 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
4965 % \otherifyactive is called near the end of this file.
4966 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
4968 \catcode`\@=0
4970 % \rawbackslashxx output one backslash character in current font
4971 \global\chardef\rawbackslashxx=`\\
4972 %{\catcode`\\=\other
4973 %@gdef@rawbackslashxx{\}}
4975 % \rawbackslash redefines \ as input to do \rawbackslashxx.
4976 {\catcode`\\=\active
4977 @gdef@rawbackslash{@let\=@rawbackslashxx }}
4979 % \normalbackslash outputs one backslash in fixed width font.
4980 \def\normalbackslash{{\tt\rawbackslashxx}}
4982 % Say @foo, not \foo, in error messages.
4983 \escapechar=`\@
4985 % \catcode 17=0 % Define control-q
4986 \catcode`\\=\active
4988 % Used sometimes to turn off (effectively) the active characters
4989 % even after parsing them.
4990 @def@turnoffactive{@let"=@normaldoublequote
4991 @let\=@realbackslash
4992 @let~=@normaltilde
4993 @let^=@normalcaret
4994 @let_=@normalunderscore
4995 @let|=@normalverticalbar
4996 @let<=@normalless
4997 @let>=@normalgreater
4998 @let+=@normalplus}
5000 @def@normalturnoffactive{@let"=@normaldoublequote
5001 @let\=@normalbackslash
5002 @let~=@normaltilde
5003 @let^=@normalcaret
5004 @let_=@normalunderscore
5005 @let|=@normalverticalbar
5006 @let<=@normalless
5007 @let>=@normalgreater
5008 @let+=@normalplus}
5010 % Make _ and + \other characters, temporarily.
5011 % This is canceled by @fixbackslash.
5012 @otherifyactive
5014 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
5015 % That is what \eatinput is for; after that, the `\' should revert to printing
5016 % a backslash.
5018 @gdef@eatinput input texinfo{@fixbackslash}
5019 @global@let\ = @eatinput
5021 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
5022 % the first `\{ in the file would cause an error. This macro tries to fix
5023 % that, assuming it is called before the first `\' could plausibly occur.
5024 % Also back turn on active characters that might appear in the input
5025 % file name, in case not using a pre-dumped format.
5027 @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
5028 @catcode`+=@active @catcode`@_=@active}
5030 % These look ok in all fonts, so just make them not special. The @rm below
5031 % makes sure that the current font starts out as the newly loaded cmr10
5032 @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
5034 @textfonts
5037 @c Local variables:
5038 @c page-delimiter: "^\\\\message"
5039 @c End: