Update.
[glibc.git] / manual / texinfo.tex
blob000a8a8707d222edc7925212f2d87b1253387845
1 % texinfo.tex -- TeX macros to handle Texinfo files.
2 \def\texinfoversion{1998-09-30}%
4 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98
5 % Free Software Foundation, Inc.
7 % This texinfo.tex file is free software; you can redistribute it and/or
8 % modify it under the terms of the GNU General Public License as
9 % published by the Free Software Foundation; either version 2, or (at
10 % your option) any later version.
12 % This texinfo.tex file is distributed in the hope that it will be
13 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 % General Public License for more details.
17 % You should have received a copy of the GNU General Public License
18 % along with this texinfo.tex file; see the file COPYING. If not, write
19 % to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 % Boston, MA 02111-1307, USA.
22 % In other words, you are welcome to use, share and improve this program.
23 % You are forbidden to forbid anyone else to use, share and improve
24 % what you give them. Help stamp out software-hoarding!
26 % Please try the latest version of texinfo.tex before submitting bug
27 % reports; you can get the latest version from:
28 % ftp://ftp.gnu.org/pub/gnu/texinfo.tex
29 % /home/gd/gnu/doc/texinfo.tex on the GNU machines.
30 % (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
31 % ftp://tug.org/tex/texinfo.tex
32 % ftp://ctan.org/macros/texinfo/texinfo.tex
33 % (and all CTAN mirrors, finger ctan@ctan.org for a list).
34 % The texinfo.tex in the texinfo distribution itself could well be out
35 % of date, so if that's what you're using, please check.
37 % Send bug reports to bug-texinfo@gnu.org.
38 % Please include a precise test case in each bug report,
39 % including a complete document with which we can reproduce the problem.
41 % To process a Texinfo manual with TeX, it's most reliable to use the
42 % texi2dvi shell script that comes with the distribution. For simple
43 % manuals, however, you can get away with:
44 % tex foo.texi
45 % texindex foo.??
46 % tex foo.texi
47 % tex foo.texi
48 % dvips foo.dvi -o # or whatever, to process the dvi file.
49 % The extra runs of TeX get the cross-reference information correct.
50 % Sometimes one run after texindex suffices, and sometimes you need more
51 % than two; texi2dvi does it as many times as necessary.
54 % Make it possible to create a .fmt file just by loading this file:
55 % if the underlying format is not loaded, start by loading it now.
56 % Added by gildea November 1993.
57 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
59 \message{Loading texinfo [version \texinfoversion]:}
61 % If in a .fmt file, print the version number
62 % and turn on active characters that we couldn't do earlier because
63 % they might have appeared in the input file name.
64 \everyjob{\message{[Texinfo version \texinfoversion]}%
65 \catcode`+=\active \catcode`\_=\active}
67 % Save some parts of plain tex whose names we will redefine.
69 \let\ptexb=\b
70 \let\ptexbullet=\bullet
71 \let\ptexc=\c
72 \let\ptexcomma=\,
73 \let\ptexdot=\.
74 \let\ptexdots=\dots
75 \let\ptexend=\end
76 \let\ptexequiv=\equiv
77 \let\ptexexclam=\!
78 \let\ptexi=\i
79 \let\ptexlbrace=\{
80 \let\ptexrbrace=\}
81 \let\ptexstar=\*
82 \let\ptext=\t
84 % We never want plain's outer \+ definition in Texinfo.
85 % For @tex, we can use \tabalign.
86 \let\+ = \relax
89 \message{Basics,}
90 \chardef\other=12
92 % If this character appears in an error message or help string, it
93 % starts a new line in the output.
94 \newlinechar = `^^J
96 % Set up fixed words for English if not already set.
97 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
98 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
99 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
100 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
101 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
102 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
103 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
104 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
105 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
106 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
107 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
108 \ifx\putwordShortContents\undefined \gdef\putwordShortContents{Short Contents}\fi
109 \ifx\putwordTableofContents\undefined\gdef\putwordTableofContents{Table of Contents}\fi
111 % Ignore a token.
113 \def\gobble#1{}
115 \hyphenation{ap-pen-dix}
116 \hyphenation{mini-buf-fer mini-buf-fers}
117 \hyphenation{eshell}
118 \hyphenation{white-space}
120 % Margin to add to right of even pages, to left of odd pages.
121 \newdimen \bindingoffset
122 \newdimen \normaloffset
123 \newdimen\pagewidth \newdimen\pageheight
125 % Sometimes it is convenient to have everything in the transcript file
126 % and nothing on the terminal. We don't just call \tracingall here,
127 % since that produces some useless output on the terminal.
129 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
130 \ifx\eTeXversion\undefined
131 \def\loggingall{\tracingcommands2 \tracingstats2
132 \tracingpages1 \tracingoutput1 \tracinglostchars1
133 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
134 \showboxbreadth\maxdimen\showboxdepth\maxdimen
136 \else
137 \def\loggingall{\tracingcommands3 \tracingstats2
138 \tracingpages1 \tracingoutput1 \tracinglostchars1
139 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
140 \tracingscantokens1 \tracingassigns1 \tracingifs1
141 \tracinggroups1 \tracingnesting2
142 \showboxbreadth\maxdimen\showboxdepth\maxdimen
146 % For @cropmarks command.
147 % Do @cropmarks to get crop marks.
149 \newif\ifcropmarks
150 \let\cropmarks = \cropmarkstrue
152 % Dimensions to add cropmarks at corners.
153 % Added by P. A. MacKay, 12 Nov. 1986
155 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
156 \newdimen\cornerlong \cornerlong=1pc
157 \newdimen\cornerthick \cornerthick=.3pt
158 \newdimen\topandbottommargin \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; press 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{Press 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\nobreak
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{%
609 \leavevmode
610 \hbox to 1.5em{%
611 \hskip 0pt plus 0.25fil minus 0.25fil
612 .\hss.\hss.%
613 \hskip 0pt plus 0.5fil minus 0.5fil
617 % @enddots{} is an end-of-sentence ellipsis.
619 \def\enddots{%
620 \leavevmode
621 \hbox to 2em{%
622 \hskip 0pt plus 0.25fil minus 0.25fil
623 .\hss.\hss.\hss.%
624 \hskip 0pt plus 0.5fil minus 0.5fil
626 \spacefactor=3000
630 % @page forces the start of a new page
632 \def\page{\par\vfill\supereject}
634 % @exdent text....
635 % outputs text on separate line in roman font, starting at standard page margin
637 % This records the amount of indent in the innermost environment.
638 % That's how much \exdent should take out.
639 \newskip\exdentamount
641 % This defn is used inside fill environments such as @defun.
642 \def\exdent{\parsearg\exdentyyy}
643 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
645 % This defn is used inside nofill environments such as @example.
646 \def\nofillexdent{\parsearg\nofillexdentyyy}
647 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
648 \leftline{\hskip\leftskip{\rm#1}}}}
650 % @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
652 \def\inmargin#1{%
653 \strut\vadjust{\nobreak\kern-\strutdepth
654 \vtop to \strutdepth{\baselineskip\strutdepth\vss
655 \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
656 \newskip\inmarginspacing \inmarginspacing=1cm
657 \def\strutdepth{\dp\strutbox}
659 %\hbox{{\rm#1}}\hfil\break}}
661 % @include file insert text of that file as input.
662 % Allow normal characters that we make active in the argument (a file name).
663 \def\include{\begingroup
664 \catcode`\\=12
665 \catcode`~=12
666 \catcode`^=12
667 \catcode`_=12
668 \catcode`|=12
669 \catcode`<=12
670 \catcode`>=12
671 \catcode`+=12
672 \parsearg\includezzz}
673 % Restore active chars for included file.
674 \def\includezzz#1{\endgroup\begingroup
675 % Read the included file in a group so nested @include's work.
676 \def\thisfile{#1}%
677 \input\thisfile
678 \endgroup}
680 \def\thisfile{}
682 % @center line outputs that line, centered
684 \def\center{\parsearg\centerzzz}
685 \def\centerzzz #1{{\advance\hsize by -\leftskip
686 \advance\hsize by -\rightskip
687 \centerline{#1}}}
689 % @sp n outputs n lines of vertical space
691 \def\sp{\parsearg\spxxx}
692 \def\spxxx #1{\vskip #1\baselineskip}
694 % @comment ...line which is ignored...
695 % @c is the same as @comment
696 % @ignore ... @end ignore is another way to write a comment
698 \def\comment{\begingroup \catcode`\^^M=\other%
699 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
700 \commentxxx}
701 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
703 \let\c=\comment
705 % @paragraphindent is defined for the Info formatting commands only.
706 \let\paragraphindent=\comment
708 % Prevent errors for section commands.
709 % Used in @ignore and in failing conditionals.
710 \def\ignoresections{%
711 \let\chapter=\relax
712 \let\unnumbered=\relax
713 \let\top=\relax
714 \let\unnumberedsec=\relax
715 \let\unnumberedsection=\relax
716 \let\unnumberedsubsec=\relax
717 \let\unnumberedsubsection=\relax
718 \let\unnumberedsubsubsec=\relax
719 \let\unnumberedsubsubsection=\relax
720 \let\section=\relax
721 \let\subsec=\relax
722 \let\subsubsec=\relax
723 \let\subsection=\relax
724 \let\subsubsection=\relax
725 \let\appendix=\relax
726 \let\appendixsec=\relax
727 \let\appendixsection=\relax
728 \let\appendixsubsec=\relax
729 \let\appendixsubsection=\relax
730 \let\appendixsubsubsec=\relax
731 \let\appendixsubsubsection=\relax
732 \let\contents=\relax
733 \let\smallbook=\relax
734 \let\titlepage=\relax
737 % Used in nested conditionals, where we have to parse the Texinfo source
738 % and so want to turn off most commands, in case they are used
739 % incorrectly.
741 \def\ignoremorecommands{%
742 \let\defcodeindex = \relax
743 \let\defcv = \relax
744 \let\deffn = \relax
745 \let\deffnx = \relax
746 \let\defindex = \relax
747 \let\defivar = \relax
748 \let\defmac = \relax
749 \let\defmethod = \relax
750 \let\defop = \relax
751 \let\defopt = \relax
752 \let\defspec = \relax
753 \let\deftp = \relax
754 \let\deftypefn = \relax
755 \let\deftypefun = \relax
756 \let\deftypevar = \relax
757 \let\deftypevr = \relax
758 \let\defun = \relax
759 \let\defvar = \relax
760 \let\defvr = \relax
761 \let\ref = \relax
762 \let\xref = \relax
763 \let\printindex = \relax
764 \let\pxref = \relax
765 \let\settitle = \relax
766 \let\setchapternewpage = \relax
767 \let\setchapterstyle = \relax
768 \let\everyheading = \relax
769 \let\evenheading = \relax
770 \let\oddheading = \relax
771 \let\everyfooting = \relax
772 \let\evenfooting = \relax
773 \let\oddfooting = \relax
774 \let\headings = \relax
775 \let\include = \relax
776 \let\lowersections = \relax
777 \let\down = \relax
778 \let\raisesections = \relax
779 \let\up = \relax
780 \let\set = \relax
781 \let\clear = \relax
782 \let\item = \relax
785 % Ignore @ignore ... @end ignore.
787 \def\ignore{\doignore{ignore}}
789 % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
791 \def\ifinfo{\doignore{ifinfo}}
792 \def\ifhtml{\doignore{ifhtml}}
793 \def\ifnottex{\doignore{ifnottex}}
794 \def\html{\doignore{html}}
795 \def\menu{\doignore{menu}}
796 \def\direntry{\doignore{direntry}}
798 % @dircategory CATEGORY -- specify a category of the dir file
799 % which this file should belong to. Ignore this in TeX.
800 \let\dircategory = \comment
802 % Ignore text until a line `@end #1'.
804 \def\doignore#1{\begingroup
805 % Don't complain about control sequences we have declared \outer.
806 \ignoresections
808 % Define a command to swallow text until we reach `@end #1'.
809 % This @ is a catcode 12 token (that is the normal catcode of @ in
810 % this texinfo.tex file). We change the catcode of @ below to match.
811 \long\def\doignoretext##1@end #1{\enddoignore}%
813 % Make sure that spaces turn into tokens that match what \doignoretext wants.
814 \catcode32 = 10
816 % Ignore braces, too, so mismatched braces don't cause trouble.
817 \catcode`\{ = 9
818 \catcode`\} = 9
820 % We must not have @c interpreted as a control sequence.
821 \catcode`\@ = 12
823 % Make the letter c a comment character so that the rest of the line
824 % will be ignored. This way, the document can have (for example)
825 % @c @end ifinfo
826 % and the @end ifinfo will be properly ignored.
827 % (We've just changed @ to catcode 12.)
828 \catcode`\c = 14
830 % And now expand that command.
831 \doignoretext
834 % What we do to finish off ignored text.
836 \def\enddoignore{\endgroup\ignorespaces}%
838 \newif\ifwarnedobs\warnedobsfalse
839 \def\obstexwarn{%
840 \ifwarnedobs\relax\else
841 % We need to warn folks that they may have trouble with TeX 3.0.
842 % This uses \immediate\write16 rather than \message to get newlines.
843 \immediate\write16{}
844 \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
845 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
846 \immediate\write16{If you are running another version of TeX, relax.}
847 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
848 \immediate\write16{ Then upgrade your TeX installation if you can.}
849 \immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
850 \immediate\write16{If you are stuck with version 3.0, run the}
851 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
852 \immediate\write16{ to use a workaround.}
853 \immediate\write16{}
854 \global\warnedobstrue
858 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
859 % workaround (which requires the file ``dummy.tfm'' to be installed),
860 % uncomment the following line:
861 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
863 % Ignore text, except that we keep track of conditional commands for
864 % purposes of nesting, up to an `@end #1' command.
866 \def\nestedignore#1{%
867 \obstexwarn
868 % We must actually expand the ignored text to look for the @end
869 % command, so that nested ignore constructs work. Thus, we put the
870 % text into a \vbox and then do nothing with the result. To minimize
871 % the change of memory overflow, we follow the approach outlined on
872 % page 401 of the TeXbook: make the current font be a dummy font.
874 \setbox0 = \vbox\bgroup
875 % Don't complain about control sequences we have declared \outer.
876 \ignoresections
878 % Define `@end #1' to end the box, which will in turn undefine the
879 % @end command again.
880 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
882 % We are going to be parsing Texinfo commands. Most cause no
883 % trouble when they are used incorrectly, but some commands do
884 % complicated argument parsing or otherwise get confused, so we
885 % undefine them.
887 % We can't do anything about stray @-signs, unfortunately;
888 % they'll produce `undefined control sequence' errors.
889 \ignoremorecommands
891 % Set the current font to be \nullfont, a TeX primitive, and define
892 % all the font commands to also use \nullfont. We don't use
893 % dummy.tfm, as suggested in the TeXbook, because not all sites
894 % might have that installed. Therefore, math mode will still
895 % produce output, but that should be an extremely small amount of
896 % stuff compared to the main input.
898 \nullfont
899 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
900 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
901 \let\tensf = \nullfont
902 % Similarly for index fonts (mostly for their use in
903 % smallexample)
904 \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
905 \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
906 \let\indsf = \nullfont
908 % Don't complain when characters are missing from the fonts.
909 \tracinglostchars = 0
911 % Don't bother to do space factor calculations.
912 \frenchspacing
914 % Don't report underfull hboxes.
915 \hbadness = 10000
917 % Do minimal line-breaking.
918 \pretolerance = 10000
920 % Do not execute instructions in @tex
921 \def\tex{\doignore{tex}}%
922 % Do not execute macro definitions.
923 % `c' is a comment character, so the word `macro' will get cut off.
924 \def\macro{\doignore{ma}}%
927 % @set VAR sets the variable VAR to an empty value.
928 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
930 % Since we want to separate VAR from REST-OF-LINE (which might be
931 % empty), we can't just use \parsearg; we have to insert a space of our
932 % own to delimit the rest of the line, and then take it out again if we
933 % didn't need it. Make sure the catcode of space is correct to avoid
934 % losing inside @example, for instance.
936 \def\set{\begingroup\catcode` =10
937 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
938 \parsearg\setxxx}
939 \def\setxxx#1{\setyyy#1 \endsetyyy}
940 \def\setyyy#1 #2\endsetyyy{%
941 \def\temp{#2}%
942 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
943 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
945 \endgroup
947 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
948 % \next or other control sequences that we've defined might get us into
949 % an infinite loop. Consider `@set foo @cite{bar}'.
950 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
952 % @clear VAR clears (i.e., unsets) the variable VAR.
954 \def\clear{\parsearg\clearxxx}
955 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
957 % @value{foo} gets the text saved in variable foo.
960 \catcode`\_ = \active
962 % We might end up with active _ or - characters in the argument if
963 % we're called from @code, as @code{@value{foo-bar_}}. So \let any
964 % such active characters to their normal equivalents.
965 \gdef\value{\begingroup
966 \catcode`\-=12 \catcode`\_=12
967 \indexbreaks \let_\normalunderscore
968 \valuexxx}
970 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
972 % We have this subroutine so that we can handle at least some @value's
973 % properly in indexes (we \let\value to this in \indexdummies). Ones
974 % whose names contain - or _ still won't work, but we can't do anything
975 % about that. The command has to be fully expandable, since the result
976 % winds up in the index file. This means that if the variable's value
977 % contains other Texinfo commands, it's almost certain it will fail
978 % (although perhaps we could fix that with sufficient work to do a
979 % one-level expansion on the result, instead of complete).
981 \def\expandablevalue#1{%
982 \expandafter\ifx\csname SET#1\endcsname\relax
983 {[No value for ``#1'']v}%
984 \else
985 \csname SET#1\endcsname
989 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
990 % with @set.
992 \def\ifset{\parsearg\ifsetxxx}
993 \def\ifsetxxx #1{%
994 \expandafter\ifx\csname SET#1\endcsname\relax
995 \expandafter\ifsetfail
996 \else
997 \expandafter\ifsetsucceed
1000 \def\ifsetsucceed{\conditionalsucceed{ifset}}
1001 \def\ifsetfail{\nestedignore{ifset}}
1002 \defineunmatchedend{ifset}
1004 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
1005 % defined with @set, or has been undefined with @clear.
1007 \def\ifclear{\parsearg\ifclearxxx}
1008 \def\ifclearxxx #1{%
1009 \expandafter\ifx\csname SET#1\endcsname\relax
1010 \expandafter\ifclearsucceed
1011 \else
1012 \expandafter\ifclearfail
1015 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
1016 \def\ifclearfail{\nestedignore{ifclear}}
1017 \defineunmatchedend{ifclear}
1019 % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
1020 % following, through the first @end iftex (etc.). Make `@end iftex'
1021 % (etc.) valid only after an @iftex.
1023 \def\iftex{\conditionalsucceed{iftex}}
1024 \def\ifnothtml{\conditionalsucceed{ifnothtml}}
1025 \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
1026 \defineunmatchedend{iftex}
1027 \defineunmatchedend{ifnothtml}
1028 \defineunmatchedend{ifnotinfo}
1030 % We can't just want to start a group at @iftex (for example) and end it
1031 % at @end iftex, since then @set commands inside the conditional have no
1032 % effect (they'd get reverted at the end of the group). So we must
1033 % define \Eiftex to redefine itself to be its previous value. (We can't
1034 % just define it to fail again with an ``unmatched end'' error, since
1035 % the @ifset might be nested.)
1037 \def\conditionalsucceed#1{%
1038 \edef\temp{%
1039 % Remember the current value of \E#1.
1040 \let\nece{prevE#1} = \nece{E#1}%
1042 % At the `@end #1', redefine \E#1 to be its previous value.
1043 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
1045 \temp
1048 % We need to expand lots of \csname's, but we don't want to expand the
1049 % control sequences after we've constructed them.
1051 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
1053 % @asis just yields its argument. Used with @table, for example.
1055 \def\asis#1{#1}
1057 % @math means output in math mode.
1058 % We don't use $'s directly in the definition of \math because control
1059 % sequences like \math are expanded when the toc file is written. Then,
1060 % we read the toc file back, the $'s will be normal characters (as they
1061 % should be, according to the definition of Texinfo). So we must use a
1062 % control sequence to switch into and out of math mode.
1064 % This isn't quite enough for @math to work properly in indices, but it
1065 % seems unlikely it will ever be needed there.
1067 \let\implicitmath = $
1068 \def\math#1{\implicitmath #1\implicitmath}
1070 % @bullet and @minus need the same treatment as @math, just above.
1071 \def\bullet{\implicitmath\ptexbullet\implicitmath}
1072 \def\minus{\implicitmath-\implicitmath}
1074 % @refill is a no-op.
1075 \let\refill=\relax
1077 % If working on a large document in chapters, it is convenient to
1078 % be able to disable indexing, cross-referencing, and contents, for test runs.
1079 % This is done with @novalidate (before @setfilename).
1081 \newif\iflinks \linkstrue % by default we want the aux files.
1082 \let\novalidate = \linksfalse
1084 % @setfilename is done at the beginning of every texinfo file.
1085 % So open here the files we need to have open while reading the input.
1086 % This makes it possible to make a .fmt file for texinfo.
1087 \def\setfilename{%
1088 \iflinks
1089 \readauxfile
1090 \fi % \openindices needs to do some work in any case.
1091 \openindices
1092 \fixbackslash % Turn off hack to swallow `\input texinfo'.
1093 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
1095 % If texinfo.cnf is present on the system, read it.
1096 % Useful for site-wide @afourpaper, etc.
1097 % Just to be on the safe side, close the input stream before the \input.
1098 \openin 1 texinfo.cnf
1099 \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
1100 \closein1
1101 \temp
1103 \comment % Ignore the actual filename.
1106 % Called from \setfilename.
1108 \def\openindices{%
1109 \newindex{cp}%
1110 \newcodeindex{fn}%
1111 \newcodeindex{vr}%
1112 \newcodeindex{tp}%
1113 \newcodeindex{ky}%
1114 \newcodeindex{pg}%
1117 % @bye.
1118 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1121 \message{fonts,}
1122 % Font-change commands.
1124 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1125 % So we set up a \sf analogous to plain's \rm, etc.
1126 \newfam\sffam
1127 \def\sf{\fam=\sffam \tensf}
1128 \let\li = \sf % Sometimes we call it \li, not \sf.
1130 % We don't need math for this one.
1131 \def\ttsl{\tenttsl}
1133 % Use Computer Modern fonts at \magstephalf (11pt).
1134 \newcount\mainmagstep
1135 \mainmagstep=\magstephalf
1137 % Set the font macro #1 to the font named #2, adding on the
1138 % specified font prefix (normally `cm').
1139 % #3 is the font's design size, #4 is a scale factor
1140 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1142 % Use cm as the default font prefix.
1143 % To specify the font prefix, you must define \fontprefix
1144 % before you read in texinfo.tex.
1145 \ifx\fontprefix\undefined
1146 \def\fontprefix{cm}
1148 % Support font families that don't use the same naming scheme as CM.
1149 \def\rmshape{r}
1150 \def\rmbshape{bx} %where the normal face is bold
1151 \def\bfshape{b}
1152 \def\bxshape{bx}
1153 \def\ttshape{tt}
1154 \def\ttbshape{tt}
1155 \def\ttslshape{sltt}
1156 \def\itshape{ti}
1157 \def\itbshape{bxti}
1158 \def\slshape{sl}
1159 \def\slbshape{bxsl}
1160 \def\sfshape{ss}
1161 \def\sfbshape{ss}
1162 \def\scshape{csc}
1163 \def\scbshape{csc}
1165 \ifx\bigger\relax
1166 \let\mainmagstep=\magstep1
1167 \setfont\textrm\rmshape{12}{1000}
1168 \setfont\texttt\ttshape{12}{1000}
1169 \else
1170 \setfont\textrm\rmshape{10}{\mainmagstep}
1171 \setfont\texttt\ttshape{10}{\mainmagstep}
1173 % Instead of cmb10, you many want to use cmbx10.
1174 % cmbx10 is a prettier font on its own, but cmb10
1175 % looks better when embedded in a line with cmr10.
1176 \setfont\textbf\bfshape{10}{\mainmagstep}
1177 \setfont\textit\itshape{10}{\mainmagstep}
1178 \setfont\textsl\slshape{10}{\mainmagstep}
1179 \setfont\textsf\sfshape{10}{\mainmagstep}
1180 \setfont\textsc\scshape{10}{\mainmagstep}
1181 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1182 \font\texti=cmmi10 scaled \mainmagstep
1183 \font\textsy=cmsy10 scaled \mainmagstep
1185 % A few fonts for @defun, etc.
1186 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1187 \setfont\deftt\ttshape{10}{\magstep1}
1188 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1190 % Fonts for indices and small examples (9pt).
1191 % We actually use the slanted font rather than the italic,
1192 % because texinfo normally uses the slanted fonts for that.
1193 % Do not make many font distinctions in general in the index, since they
1194 % aren't very useful.
1195 \setfont\ninett\ttshape{9}{1000}
1196 \setfont\ninettsl\ttslshape{10}{900}
1197 \setfont\indrm\rmshape{9}{1000}
1198 \setfont\indit\itshape{9}{1000}
1199 \setfont\indsl\slshape{9}{1000}
1200 \let\indtt=\ninett
1201 \let\indttsl=\ninettsl
1202 \let\indsf=\indrm
1203 \let\indbf=\indrm
1204 \setfont\indsc\scshape{10}{900}
1205 \font\indi=cmmi9
1206 \font\indsy=cmsy9
1208 % Fonts for title page:
1209 \setfont\titlerm\rmbshape{12}{\magstep3}
1210 \setfont\titleit\itbshape{10}{\magstep4}
1211 \setfont\titlesl\slbshape{10}{\magstep4}
1212 \setfont\titlett\ttbshape{12}{\magstep3}
1213 \setfont\titlettsl\ttslshape{10}{\magstep4}
1214 \setfont\titlesf\sfbshape{17}{\magstep1}
1215 \let\titlebf=\titlerm
1216 \setfont\titlesc\scbshape{10}{\magstep4}
1217 \font\titlei=cmmi12 scaled \magstep3
1218 \font\titlesy=cmsy10 scaled \magstep4
1219 \def\authorrm{\secrm}
1221 % Chapter (and unnumbered) fonts (17.28pt).
1222 \setfont\chaprm\rmbshape{12}{\magstep2}
1223 \setfont\chapit\itbshape{10}{\magstep3}
1224 \setfont\chapsl\slbshape{10}{\magstep3}
1225 \setfont\chaptt\ttbshape{12}{\magstep2}
1226 \setfont\chapttsl\ttslshape{10}{\magstep3}
1227 \setfont\chapsf\sfbshape{17}{1000}
1228 \let\chapbf=\chaprm
1229 \setfont\chapsc\scbshape{10}{\magstep3}
1230 \font\chapi=cmmi12 scaled \magstep2
1231 \font\chapsy=cmsy10 scaled \magstep3
1233 % Section fonts (14.4pt).
1234 \setfont\secrm\rmbshape{12}{\magstep1}
1235 \setfont\secit\itbshape{10}{\magstep2}
1236 \setfont\secsl\slbshape{10}{\magstep2}
1237 \setfont\sectt\ttbshape{12}{\magstep1}
1238 \setfont\secttsl\ttslshape{10}{\magstep2}
1239 \setfont\secsf\sfbshape{12}{\magstep1}
1240 \let\secbf\secrm
1241 \setfont\secsc\scbshape{10}{\magstep2}
1242 \font\seci=cmmi12 scaled \magstep1
1243 \font\secsy=cmsy10 scaled \magstep2
1245 % \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
1246 % \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
1247 % \setfont\ssecsl\slshape{10}{\magstep1}
1248 % \setfont\ssectt\ttshape{10}{\magstep1}
1249 % \setfont\ssecsf\sfshape{10}{\magstep1}
1251 %\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
1252 %\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
1253 %\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
1254 %\setfont\ssectt\ttshape{10}{1315}
1255 %\setfont\ssecsf\sfshape{10}{1315}
1257 %\let\ssecbf=\ssecrm
1259 % Subsection fonts (13.15pt).
1260 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1261 \setfont\ssecit\itbshape{10}{1315}
1262 \setfont\ssecsl\slbshape{10}{1315}
1263 \setfont\ssectt\ttbshape{12}{\magstephalf}
1264 \setfont\ssecttsl\ttslshape{10}{1315}
1265 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1266 \let\ssecbf\ssecrm
1267 \setfont\ssecsc\scbshape{10}{\magstep1}
1268 \font\sseci=cmmi12 scaled \magstephalf
1269 \font\ssecsy=cmsy10 scaled 1315
1270 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1271 % but that is not a standard magnification.
1273 % In order for the font changes to affect most math symbols and letters,
1274 % we have to define the \textfont of the standard families. Since
1275 % texinfo doesn't allow for producing subscripts and superscripts, we
1276 % don't bother to reset \scriptfont and \scriptscriptfont (which would
1277 % also require loading a lot more fonts).
1279 \def\resetmathfonts{%
1280 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1281 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1282 \textfont\ttfam = \tentt \textfont\sffam = \tensf
1286 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1287 % of just \STYLE. We do this so that font changes will continue to work
1288 % in math mode, where it is the current \fam that is relevant in most
1289 % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
1290 % \tenbf}, for example. By redefining \tenbf, we obviate the need to
1291 % redefine \bf itself.
1292 \def\textfonts{%
1293 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1294 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1295 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1296 \resetmathfonts}
1297 \def\titlefonts{%
1298 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
1299 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
1300 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
1301 \let\tenttsl=\titlettsl
1302 \resetmathfonts \setleading{25pt}}
1303 \def\titlefont#1{{\titlefonts\rm #1}}
1304 \def\chapfonts{%
1305 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1306 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1307 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1308 \resetmathfonts \setleading{19pt}}
1309 \def\secfonts{%
1310 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1311 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1312 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1313 \resetmathfonts \setleading{16pt}}
1314 \def\subsecfonts{%
1315 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1316 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1317 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1318 \resetmathfonts \setleading{15pt}}
1319 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1320 \def\indexfonts{%
1321 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
1322 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
1323 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
1324 \resetmathfonts \setleading{12pt}}
1326 % Set up the default fonts, so we can use them for creating boxes.
1328 \textfonts
1330 % Define these so they can be easily changed for other fonts.
1331 \def\angleleft{$\langle$}
1332 \def\angleright{$\rangle$}
1334 % Count depth in font-changes, for error checks
1335 \newcount\fontdepth \fontdepth=0
1337 % Fonts for short table of contents.
1338 \setfont\shortcontrm\rmshape{12}{1000}
1339 \setfont\shortcontbf\bxshape{12}{1000}
1340 \setfont\shortcontsl\slshape{12}{1000}
1342 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1343 %% serif) and @ii for TeX italic
1345 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1346 % unless the following character is such as not to need one.
1347 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1348 \def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx}
1349 \def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx}
1351 \let\i=\smartitalic
1352 \let\var=\smartslanted
1353 \let\dfn=\smartslanted
1354 \let\emph=\smartitalic
1355 \let\cite=\smartslanted
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 % @file, @option are the same as @samp.
1386 \let\file=\samp
1387 \let\option=\samp
1389 % @code is a modification of @t,
1390 % which makes spaces the same size as normal in the surrounding text.
1391 \def\tclose#1{%
1393 % Change normal interword space to be same as for the current font.
1394 \spaceskip = \fontdimen2\font
1396 % Switch to typewriter.
1399 % But `\ ' produces the large typewriter interword space.
1400 \def\ {{\spaceskip = 0pt{} }}%
1402 % Turn off hyphenation.
1403 \nohyphenation
1405 \rawbackslash
1406 \frenchspacing
1409 \null
1412 % We *must* turn on hyphenation at `-' and `_' in \code.
1413 % Otherwise, it is too hard to avoid overfull hboxes
1414 % in the Emacs manual, the Library manual, etc.
1416 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1417 % both hyphenation at - and hyphenation within words.
1418 % We must therefore turn them both off (\tclose does that)
1419 % and arrange explicitly to hyphenate at a dash.
1420 % -- rms.
1422 \catcode`\-=\active
1423 \catcode`\_=\active
1425 \global\def\code{\begingroup
1426 \catcode`\-=\active \let-\codedash
1427 \catcode`\_=\active \let_\codeunder
1428 \codex
1431 % If we end up with any active - characters when handling the index,
1432 % just treat them as a normal -.
1433 \global\def\indexbreaks{\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 % For @url, @env, @command quotes seem unnecessary, so use \code.
1475 \let\url=\code
1476 \let\env=\code
1477 \let\command=\code
1479 % @uref (abbreviation for `urlref') takes an optional second argument
1480 % specifying the text to display. First (mandatory) arg is the url.
1481 % Perhaps eventually put in a hypertex \special here.
1483 \def\uref#1{\urefxxx #1,,\finish}
1484 \def\urefxxx#1,#2,#3\finish{%
1485 \setbox0 = \hbox{\ignorespaces #2}%
1486 \ifdim\wd0 > 0pt
1487 \unhbox0\ (\code{#1})%
1488 \else
1489 \code{#1}%
1493 % rms does not like the angle brackets --karl, 17may97.
1494 % So now @email is just like @uref.
1495 %\def\email#1{\angleleft{\tt #1}\angleright}
1496 \let\email=\uref
1498 % Check if we are currently using a typewriter font. Since all the
1499 % Computer Modern typewriter fonts have zero interword stretch (and
1500 % shrink), and it is reasonable to expect all typewriter fonts to have
1501 % this property, we can check that font parameter.
1503 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1505 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1506 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
1508 \def\dmn#1{\thinspace #1}
1510 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1512 % @l was never documented to mean ``switch to the Lisp font'',
1513 % and it is not used as such in any manual I can find. We need it for
1514 % Polish suppressed-l. --karl, 22sep96.
1515 %\def\l#1{{\li #1}\null}
1517 % Explicit font changes: @r, @sc, undocumented @ii.
1518 \def\r#1{{\rm #1}} % roman font
1519 \def\sc#1{{\smallcaps#1}} % smallcaps font
1520 \def\ii#1{{\it #1}} % italic font
1522 % @acronym downcases the argument and prints in smallcaps.
1523 \def\acronym#1{{\smallcaps \lowercase{#1}}}
1525 % @pounds{} is a sterling sign.
1526 \def\pounds{{\it\$}}
1529 \message{page headings,}
1531 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1532 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1534 % First the title page. Must do @settitle before @titlepage.
1535 \newif\ifseenauthor
1536 \newif\iffinishedtitlepage
1538 % Do an implicit @contents or @shortcontents after @end titlepage if the
1539 % user says @contentsaftertitlepage or @shortcontentsaftertitlepage.
1541 \newif\ifsetcontentsaftertitlepage
1542 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
1543 \newif\ifsetshortcontentsaftertitlepage
1544 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
1546 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1547 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1548 \endgroup\page\hbox{}\page}
1550 \def\titlepage{\begingroup \parindent=0pt \textfonts
1551 \let\subtitlerm=\tenrm
1552 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1554 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1556 % Leave some space at the very top of the page.
1557 \vglue\titlepagetopglue
1559 % Now you can print the title using @title.
1560 \def\title{\parsearg\titlezzz}%
1561 \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
1562 % print a rule at the page bottom also.
1563 \finishedtitlepagefalse
1564 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1565 % No rule at page bottom unless we print one at the top with @title.
1566 \finishedtitlepagetrue
1568 % Now you can put text using @subtitle.
1569 \def\subtitle{\parsearg\subtitlezzz}%
1570 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1572 % @author should come last, but may come many times.
1573 \def\author{\parsearg\authorzzz}%
1574 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1575 {\authorfont \leftline{##1}}}%
1577 % Most title ``pages'' are actually two pages long, with space
1578 % at the top of the second. We don't want the ragged left on the second.
1579 \let\oldpage = \page
1580 \def\page{%
1581 \iffinishedtitlepage\else
1582 \finishtitlepage
1584 \oldpage
1585 \let\page = \oldpage
1586 \hbox{}}%
1587 % \def\page{\oldpage \hbox{}}
1590 \def\Etitlepage{%
1591 \iffinishedtitlepage\else
1592 \finishtitlepage
1594 % It is important to do the page break before ending the group,
1595 % because the headline and footline are only empty inside the group.
1596 % If we use the new definition of \page, we always get a blank page
1597 % after the title page, which we certainly don't want.
1598 \oldpage
1599 \endgroup
1601 % If they want short, they certainly want long too.
1602 \ifsetshortcontentsaftertitlepage
1603 \shortcontents
1604 \contents
1605 \global\let\shortcontents = \relax
1606 \global\let\contents = \relax
1609 \ifsetcontentsaftertitlepage
1610 \contents
1611 \global\let\contents = \relax
1612 \global\let\shortcontents = \relax
1615 \HEADINGSon
1618 \def\finishtitlepage{%
1619 \vskip4pt \hrule height 2pt width \hsize
1620 \vskip\titlepagebottomglue
1621 \finishedtitlepagetrue
1624 %%% Set up page headings and footings.
1626 \let\thispage=\folio
1628 \newtoks\evenheadline % headline on even pages
1629 \newtoks\oddheadline % headline on odd pages
1630 \newtoks\evenfootline % footline on even pages
1631 \newtoks\oddfootline % footline on odd pages
1633 % Now make Tex use those variables
1634 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1635 \else \the\evenheadline \fi}}
1636 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1637 \else \the\evenfootline \fi}\HEADINGShook}
1638 \let\HEADINGShook=\relax
1640 % Commands to set those variables.
1641 % For example, this is what @headings on does
1642 % @evenheading @thistitle|@thispage|@thischapter
1643 % @oddheading @thischapter|@thispage|@thistitle
1644 % @evenfooting @thisfile||
1645 % @oddfooting ||@thisfile
1647 \def\evenheading{\parsearg\evenheadingxxx}
1648 \def\oddheading{\parsearg\oddheadingxxx}
1649 \def\everyheading{\parsearg\everyheadingxxx}
1651 \def\evenfooting{\parsearg\evenfootingxxx}
1652 \def\oddfooting{\parsearg\oddfootingxxx}
1653 \def\everyfooting{\parsearg\everyfootingxxx}
1655 {\catcode`\@=0 %
1657 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1658 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1659 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1661 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1662 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1663 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1665 \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
1667 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1668 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1669 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1671 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1672 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1673 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
1675 % Leave some space for the footline. Hopefully ok to assume
1676 % @evenfooting will not be used by itself.
1677 \global\advance\pageheight by -\baselineskip
1678 \global\advance\vsize by -\baselineskip
1681 \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
1683 }% unbind the catcode of @.
1685 % @headings double turns headings on for double-sided printing.
1686 % @headings single turns headings on for single-sided printing.
1687 % @headings off turns them off.
1688 % @headings on same as @headings double, retained for compatibility.
1689 % @headings after turns on double-sided headings after this page.
1690 % @headings doubleafter turns on double-sided headings after this page.
1691 % @headings singleafter turns on single-sided headings after this page.
1692 % By default, they are off at the start of a document,
1693 % and turned `on' after @end titlepage.
1695 \def\headings #1 {\csname HEADINGS#1\endcsname}
1697 \def\HEADINGSoff{
1698 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1699 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1700 \HEADINGSoff
1701 % When we turn headings on, set the page number to 1.
1702 % For double-sided printing, put current file name in lower left corner,
1703 % chapter name on inside top of right hand pages, document
1704 % title on inside top of left hand pages, and page numbers on outside top
1705 % edge of all pages.
1706 \def\HEADINGSdouble{
1707 \global\pageno=1
1708 \global\evenfootline={\hfil}
1709 \global\oddfootline={\hfil}
1710 \global\evenheadline={\line{\folio\hfil\thistitle}}
1711 \global\oddheadline={\line{\thischapter\hfil\folio}}
1712 \global\let\contentsalignmacro = \chapoddpage
1714 \let\contentsalignmacro = \chappager
1716 % For single-sided printing, chapter title goes across top left of page,
1717 % page number on top right.
1718 \def\HEADINGSsingle{
1719 \global\pageno=1
1720 \global\evenfootline={\hfil}
1721 \global\oddfootline={\hfil}
1722 \global\evenheadline={\line{\thischapter\hfil\folio}}
1723 \global\oddheadline={\line{\thischapter\hfil\folio}}
1724 \global\let\contentsalignmacro = \chappager
1726 \def\HEADINGSon{\HEADINGSdouble}
1728 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1729 \let\HEADINGSdoubleafter=\HEADINGSafter
1730 \def\HEADINGSdoublex{%
1731 \global\evenfootline={\hfil}
1732 \global\oddfootline={\hfil}
1733 \global\evenheadline={\line{\folio\hfil\thistitle}}
1734 \global\oddheadline={\line{\thischapter\hfil\folio}}
1735 \global\let\contentsalignmacro = \chapoddpage
1738 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1739 \def\HEADINGSsinglex{%
1740 \global\evenfootline={\hfil}
1741 \global\oddfootline={\hfil}
1742 \global\evenheadline={\line{\thischapter\hfil\folio}}
1743 \global\oddheadline={\line{\thischapter\hfil\folio}}
1744 \global\let\contentsalignmacro = \chappager
1747 % Subroutines used in generating headings
1748 % Produces Day Month Year style of output.
1749 \def\today{\number\day\space
1750 \ifcase\month\or
1751 January\or February\or March\or April\or May\or June\or
1752 July\or August\or September\or October\or November\or December\fi
1753 \space\number\year}
1755 % Use this if you want the Month Day, Year style of output.
1756 %\def\today{\ifcase\month\or
1757 %January\or February\or March\or April\or May\or June\or
1758 %July\or August\or September\or October\or November\or December\fi
1759 %\space\number\day, \number\year}
1761 % @settitle line... specifies the title of the document, for headings
1762 % It generates no output of its own
1764 \def\thistitle{No Title}
1765 \def\settitle{\parsearg\settitlezzz}
1766 \def\settitlezzz #1{\gdef\thistitle{#1}}
1769 \message{tables,}
1770 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1772 % default indentation of table text
1773 \newdimen\tableindent \tableindent=.8in
1774 % default indentation of @itemize and @enumerate text
1775 \newdimen\itemindent \itemindent=.3in
1776 % margin between end of table item and start of table text.
1777 \newdimen\itemmargin \itemmargin=.1in
1779 % used internally for \itemindent minus \itemmargin
1780 \newdimen\itemmax
1782 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1783 % these defs.
1784 % They also define \itemindex
1785 % to index the item name in whatever manner is desired (perhaps none).
1787 \newif\ifitemxneedsnegativevskip
1789 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1791 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1792 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1794 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1795 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1797 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1798 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1800 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1801 \itemzzz {#1}}
1803 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1804 \itemzzz {#1}}
1806 \def\itemzzz #1{\begingroup %
1807 \advance\hsize by -\rightskip
1808 \advance\hsize by -\tableindent
1809 \setbox0=\hbox{\itemfont{#1}}%
1810 \itemindex{#1}%
1811 \nobreak % This prevents a break before @itemx.
1813 % If the item text does not fit in the space we have, put it on a line
1814 % by itself, and do not allow a page break either before or after that
1815 % line. We do not start a paragraph here because then if the next
1816 % command is, e.g., @kindex, the whatsit would get put into the
1817 % horizontal list on a line by itself, resulting in extra blank space.
1818 \ifdim \wd0>\itemmax
1820 % Make this a paragraph so we get the \parskip glue and wrapping,
1821 % but leave it ragged-right.
1822 \begingroup
1823 \advance\leftskip by-\tableindent
1824 \advance\hsize by\tableindent
1825 \advance\rightskip by0pt plus1fil
1826 \leavevmode\unhbox0\par
1827 \endgroup
1829 % We're going to be starting a paragraph, but we don't want the
1830 % \parskip glue -- logically it's part of the @item we just started.
1831 \nobreak \vskip-\parskip
1833 % Stop a page break at the \parskip glue coming up. Unfortunately
1834 % we can't prevent a possible page break at the following
1835 % \baselineskip glue.
1836 \nobreak
1837 \endgroup
1838 \itemxneedsnegativevskipfalse
1839 \else
1840 % The item text fits into the space. Start a paragraph, so that the
1841 % following text (if any) will end up on the same line.
1842 \noindent
1843 % Do this with kerns and \unhbox so that if there is a footnote in
1844 % the item text, it can migrate to the main vertical list and
1845 % eventually be printed.
1846 \nobreak\kern-\tableindent
1847 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
1848 \unhbox0
1849 \nobreak\kern\dimen0
1850 \endgroup
1851 \itemxneedsnegativevskiptrue
1855 \def\item{\errmessage{@item while not in a table}}
1856 \def\itemx{\errmessage{@itemx while not in a table}}
1857 \def\kitem{\errmessage{@kitem while not in a table}}
1858 \def\kitemx{\errmessage{@kitemx while not in a table}}
1859 \def\xitem{\errmessage{@xitem while not in a table}}
1860 \def\xitemx{\errmessage{@xitemx while not in a table}}
1862 % Contains a kludge to get @end[description] to work.
1863 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1865 % @table, @ftable, @vtable.
1866 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1867 {\obeylines\obeyspaces%
1868 \gdef\tablex #1^^M{%
1869 \tabley\dontindex#1 \endtabley}}
1871 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1872 {\obeylines\obeyspaces%
1873 \gdef\ftablex #1^^M{%
1874 \tabley\fnitemindex#1 \endtabley
1875 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1876 \let\Etable=\relax}}
1878 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1879 {\obeylines\obeyspaces%
1880 \gdef\vtablex #1^^M{%
1881 \tabley\vritemindex#1 \endtabley
1882 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1883 \let\Etable=\relax}}
1885 \def\dontindex #1{}
1886 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1887 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1889 {\obeyspaces %
1890 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1891 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1893 \def\tablez #1#2#3#4#5#6{%
1894 \aboveenvbreak %
1895 \begingroup %
1896 \def\Edescription{\Etable}% Necessary kludge.
1897 \let\itemindex=#1%
1898 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1899 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1900 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1901 \def\itemfont{#2}%
1902 \itemmax=\tableindent %
1903 \advance \itemmax by -\itemmargin %
1904 \advance \leftskip by \tableindent %
1905 \exdentamount=\tableindent
1906 \parindent = 0pt
1907 \parskip = \smallskipamount
1908 \ifdim \parskip=0pt \parskip=2pt \fi%
1909 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1910 \let\item = \internalBitem %
1911 \let\itemx = \internalBitemx %
1912 \let\kitem = \internalBkitem %
1913 \let\kitemx = \internalBkitemx %
1914 \let\xitem = \internalBxitem %
1915 \let\xitemx = \internalBxitemx %
1918 % This is the counter used by @enumerate, which is really @itemize
1920 \newcount \itemno
1922 \def\itemize{\parsearg\itemizezzz}
1924 \def\itemizezzz #1{%
1925 \begingroup % ended by the @end itemize
1926 \itemizey {#1}{\Eitemize}
1929 \def\itemizey #1#2{%
1930 \aboveenvbreak %
1931 \itemmax=\itemindent %
1932 \advance \itemmax by -\itemmargin %
1933 \advance \leftskip by \itemindent %
1934 \exdentamount=\itemindent
1935 \parindent = 0pt %
1936 \parskip = \smallskipamount %
1937 \ifdim \parskip=0pt \parskip=2pt \fi%
1938 \def#2{\endgraf\afterenvbreak\endgroup}%
1939 \def\itemcontents{#1}%
1940 \let\item=\itemizeitem}
1942 % Set sfcode to normal for the chars that usually have another value.
1943 % These are `.?!:;,'
1944 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1945 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1947 % \splitoff TOKENS\endmark defines \first to be the first token in
1948 % TOKENS, and \rest to be the remainder.
1950 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1952 % Allow an optional argument of an uppercase letter, lowercase letter,
1953 % or number, to specify the first label in the enumerated list. No
1954 % argument is the same as `1'.
1956 \def\enumerate{\parsearg\enumeratezzz}
1957 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1958 \def\enumeratey #1 #2\endenumeratey{%
1959 \begingroup % ended by the @end enumerate
1961 % If we were given no argument, pretend we were given `1'.
1962 \def\thearg{#1}%
1963 \ifx\thearg\empty \def\thearg{1}\fi
1965 % Detect if the argument is a single token. If so, it might be a
1966 % letter. Otherwise, the only valid thing it can be is a number.
1967 % (We will always have one token, because of the test we just made.
1968 % This is a good thing, since \splitoff doesn't work given nothing at
1969 % all -- the first parameter is undelimited.)
1970 \expandafter\splitoff\thearg\endmark
1971 \ifx\rest\empty
1972 % Only one token in the argument. It could still be anything.
1973 % A ``lowercase letter'' is one whose \lccode is nonzero.
1974 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1975 % not equal to itself.
1976 % Otherwise, we assume it's a number.
1978 % We need the \relax at the end of the \ifnum lines to stop TeX from
1979 % continuing to look for a <number>.
1981 \ifnum\lccode\expandafter`\thearg=0\relax
1982 \numericenumerate % a number (we hope)
1983 \else
1984 % It's a letter.
1985 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1986 \lowercaseenumerate % lowercase letter
1987 \else
1988 \uppercaseenumerate % uppercase letter
1991 \else
1992 % Multiple tokens in the argument. We hope it's a number.
1993 \numericenumerate
1997 % An @enumerate whose labels are integers. The starting integer is
1998 % given in \thearg.
2000 \def\numericenumerate{%
2001 \itemno = \thearg
2002 \startenumeration{\the\itemno}%
2005 % The starting (lowercase) letter is in \thearg.
2006 \def\lowercaseenumerate{%
2007 \itemno = \expandafter`\thearg
2008 \startenumeration{%
2009 % Be sure we're not beyond the end of the alphabet.
2010 \ifnum\itemno=0
2011 \errmessage{No more lowercase letters in @enumerate; get a bigger
2012 alphabet}%
2014 \char\lccode\itemno
2018 % The starting (uppercase) letter is in \thearg.
2019 \def\uppercaseenumerate{%
2020 \itemno = \expandafter`\thearg
2021 \startenumeration{%
2022 % Be sure we're not beyond the end of the alphabet.
2023 \ifnum\itemno=0
2024 \errmessage{No more uppercase letters in @enumerate; get a bigger
2025 alphabet}
2027 \char\uccode\itemno
2031 % Call itemizey, adding a period to the first argument and supplying the
2032 % common last two arguments. Also subtract one from the initial value in
2033 % \itemno, since @item increments \itemno.
2035 \def\startenumeration#1{%
2036 \advance\itemno by -1
2037 \itemizey{#1.}\Eenumerate\flushcr
2040 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
2041 % to @enumerate.
2043 \def\alphaenumerate{\enumerate{a}}
2044 \def\capsenumerate{\enumerate{A}}
2045 \def\Ealphaenumerate{\Eenumerate}
2046 \def\Ecapsenumerate{\Eenumerate}
2048 % Definition of @item while inside @itemize.
2050 \def\itemizeitem{%
2051 \advance\itemno by 1
2052 {\let\par=\endgraf \smallbreak}%
2053 \ifhmode \errmessage{In hmode at itemizeitem}\fi
2054 {\parskip=0in \hskip 0pt
2055 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
2056 \vadjust{\penalty 1200}}%
2057 \flushcr}
2059 % @multitable macros
2060 % Amy Hendrickson, 8/18/94, 3/6/96
2062 % @multitable ... @end multitable will make as many columns as desired.
2063 % Contents of each column will wrap at width given in preamble. Width
2064 % can be specified either with sample text given in a template line,
2065 % or in percent of \hsize, the current width of text on page.
2067 % Table can continue over pages but will only break between lines.
2069 % To make preamble:
2071 % Either define widths of columns in terms of percent of \hsize:
2072 % @multitable @columnfractions .25 .3 .45
2073 % @item ...
2075 % Numbers following @columnfractions are the percent of the total
2076 % current hsize to be used for each column. You may use as many
2077 % columns as desired.
2080 % Or use a template:
2081 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2082 % @item ...
2083 % using the widest term desired in each column.
2085 % For those who want to use more than one line's worth of words in
2086 % the preamble, break the line within one argument and it
2087 % will parse correctly, i.e.,
2089 % @multitable {Column 1 template} {Column 2 template} {Column 3
2090 % template}
2091 % Not:
2092 % @multitable {Column 1 template} {Column 2 template}
2093 % {Column 3 template}
2095 % Each new table line starts with @item, each subsequent new column
2096 % starts with @tab. Empty columns may be produced by supplying @tab's
2097 % with nothing between them for as many times as empty columns are needed,
2098 % ie, @tab@tab@tab will produce two empty columns.
2100 % @item, @tab, @multitable or @end multitable do not need to be on their
2101 % own lines, but it will not hurt if they are.
2103 % Sample multitable:
2105 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2106 % @item first col stuff @tab second col stuff @tab third col
2107 % @item
2108 % first col stuff
2109 % @tab
2110 % second col stuff
2111 % @tab
2112 % third col
2113 % @item first col stuff @tab second col stuff
2114 % @tab Many paragraphs of text may be used in any column.
2116 % They will wrap at the width determined by the template.
2117 % @item@tab@tab This will be in third column.
2118 % @end multitable
2120 % Default dimensions may be reset by user.
2121 % @multitableparskip is vertical space between paragraphs in table.
2122 % @multitableparindent is paragraph indent in table.
2123 % @multitablecolmargin is horizontal space to be left between columns.
2124 % @multitablelinespace is space to leave between table items, baseline
2125 % to baseline.
2126 % 0pt means it depends on current normal line spacing.
2128 \newskip\multitableparskip
2129 \newskip\multitableparindent
2130 \newdimen\multitablecolspace
2131 \newskip\multitablelinespace
2132 \multitableparskip=0pt
2133 \multitableparindent=6pt
2134 \multitablecolspace=12pt
2135 \multitablelinespace=0pt
2137 % Macros used to set up halign preamble:
2139 \let\endsetuptable\relax
2140 \def\xendsetuptable{\endsetuptable}
2141 \let\columnfractions\relax
2142 \def\xcolumnfractions{\columnfractions}
2143 \newif\ifsetpercent
2145 % 2/1/96, to allow fractions to be given with more than one digit.
2146 \def\pickupwholefraction#1 {\global\advance\colcount by1 %
2147 \expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
2148 \setuptable}
2150 \newcount\colcount
2151 \def\setuptable#1{\def\firstarg{#1}%
2152 \ifx\firstarg\xendsetuptable\let\go\relax%
2153 \else
2154 \ifx\firstarg\xcolumnfractions\global\setpercenttrue%
2155 \else
2156 \ifsetpercent
2157 \let\go\pickupwholefraction % In this case arg of setuptable
2158 % is the decimal point before the
2159 % number given in percent of hsize.
2160 % We don't need this so we don't use it.
2161 \else
2162 \global\advance\colcount by1
2163 \setbox0=\hbox{#1 }% Add a normal word space as a separator;
2164 % typically that is always in the input, anyway.
2165 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2166 \fi%
2167 \fi%
2168 \ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
2169 \fi\go}
2171 % multitable syntax
2172 \def\tab{&\hskip1sp\relax} % 2/2/96
2173 % tiny skip here makes sure this column space is
2174 % maintained, even if it is never used.
2176 % @multitable ... @end multitable definitions:
2178 \def\multitable{\parsearg\dotable}
2179 \def\dotable#1{\bgroup
2180 \vskip\parskip
2181 \let\item\crcr
2182 \tolerance=9500
2183 \hbadness=9500
2184 \setmultitablespacing
2185 \parskip=\multitableparskip
2186 \parindent=\multitableparindent
2187 \overfullrule=0pt
2188 \global\colcount=0
2189 \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
2191 % To parse everything between @multitable and @item:
2192 \setuptable#1 \endsetuptable
2194 % \everycr will reset column counter, \colcount, at the end of
2195 % each line. Every column entry will cause \colcount to advance by one.
2196 % The table preamble
2197 % looks at the current \colcount to find the correct column width.
2198 \everycr{\noalign{%
2200 % \filbreak%% keeps underfull box messages off when table breaks over pages.
2201 % Maybe so, but it also creates really weird page breaks when the table
2202 % breaks over pages. Wouldn't \vfil be better? Wait until the problem
2203 % manifests itself, so it can be fixed for real --karl.
2204 \global\colcount=0\relax}}%
2206 % This preamble sets up a generic column definition, which will
2207 % be used as many times as user calls for columns.
2208 % \vtop will set a single line and will also let text wrap and
2209 % continue for many paragraphs if desired.
2210 \halign\bgroup&\global\advance\colcount by 1\relax
2211 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2213 % In order to keep entries from bumping into each other
2214 % we will add a \leftskip of \multitablecolspace to all columns after
2215 % the first one.
2217 % If a template has been used, we will add \multitablecolspace
2218 % to the width of each template entry.
2220 % If the user has set preamble in terms of percent of \hsize we will
2221 % use that dimension as the width of the column, and the \leftskip
2222 % will keep entries from bumping into each other. Table will start at
2223 % left margin and final column will justify at right margin.
2225 % Make sure we don't inherit \rightskip from the outer environment.
2226 \rightskip=0pt
2227 \ifnum\colcount=1
2228 % The first column will be indented with the surrounding text.
2229 \advance\hsize by\leftskip
2230 \else
2231 \ifsetpercent \else
2232 % If user has not set preamble in terms of percent of \hsize
2233 % we will advance \hsize by \multitablecolspace.
2234 \advance\hsize by \multitablecolspace
2236 % In either case we will make \leftskip=\multitablecolspace:
2237 \leftskip=\multitablecolspace
2239 % Ignoring space at the beginning and end avoids an occasional spurious
2240 % blank line, when TeX decides to break the line at the space before the
2241 % box from the multistrut, so the strut ends up on a line by itself.
2242 % For example:
2243 % @multitable @columnfractions .11 .89
2244 % @item @code{#}
2245 % @tab Legal holiday which is valid in major parts of the whole country.
2246 % Is automatically provided with highlighting sequences respectively marking
2247 % characters.
2248 \noindent\ignorespaces##\unskip\multistrut}\cr
2251 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2252 % If so, do nothing. If not, give it an appropriate dimension based on
2253 % current baselineskip.
2254 \ifdim\multitablelinespace=0pt
2255 %% strut to put in table in case some entry doesn't have descenders,
2256 %% to keep lines equally spaced
2257 \let\multistrut = \strut
2258 %% Test to see if parskip is larger than space between lines of
2259 %% table. If not, do nothing.
2260 %% If so, set to same dimension as multitablelinespace.
2261 \else
2262 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2263 width0pt\relax} \fi
2264 \ifdim\multitableparskip>\multitablelinespace
2265 \global\multitableparskip=\multitablelinespace
2266 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2267 %% than skip between lines in the table.
2268 \fi%
2269 \ifdim\multitableparskip=0pt
2270 \global\multitableparskip=\multitablelinespace
2271 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2272 %% than skip between lines in the table.
2273 \fi}
2276 \message{indexing,}
2277 % Index generation facilities
2279 % Define \newwrite to be identical to plain tex's \newwrite
2280 % except not \outer, so it can be used within \newindex.
2281 {\catcode`\@=11
2282 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2284 % \newindex {foo} defines an index named foo.
2285 % It automatically defines \fooindex such that
2286 % \fooindex ...rest of line... puts an entry in the index foo.
2287 % It also defines \fooindfile to be the number of the output channel for
2288 % the file that accumulates this index. The file's extension is foo.
2289 % The name of an index should be no more than 2 characters long
2290 % for the sake of vms.
2292 \def\newindex#1{%
2293 \iflinks
2294 \expandafter\newwrite \csname#1indfile\endcsname
2295 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2297 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
2298 \noexpand\doindex{#1}}
2301 % @defindex foo == \newindex{foo}
2303 \def\defindex{\parsearg\newindex}
2305 % Define @defcodeindex, like @defindex except put all entries in @code.
2307 \def\newcodeindex#1{%
2308 \iflinks
2309 \expandafter\newwrite \csname#1indfile\endcsname
2310 \openout \csname#1indfile\endcsname \jobname.#1
2312 \expandafter\xdef\csname#1index\endcsname{%
2313 \noexpand\docodeindex{#1}}
2316 \def\defcodeindex{\parsearg\newcodeindex}
2318 % @synindex foo bar makes index foo feed into index bar.
2319 % Do this instead of @defindex foo if you don't want it as a separate index.
2320 % The \closeout helps reduce unnecessary open files; the limit on the
2321 % Acorn RISC OS is a mere 16 files.
2322 \def\synindex#1 #2 {%
2323 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2324 \expandafter\closeout\csname#1indfile\endcsname
2325 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2326 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2327 \noexpand\doindex{#2}}%
2330 % @syncodeindex foo bar similar, but put all entries made for index foo
2331 % inside @code.
2332 \def\syncodeindex#1 #2 {%
2333 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2334 \expandafter\closeout\csname#1indfile\endcsname
2335 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2336 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2337 \noexpand\docodeindex{#2}}%
2340 % Define \doindex, the driver for all \fooindex macros.
2341 % Argument #1 is generated by the calling \fooindex macro,
2342 % and it is "foo", the name of the index.
2344 % \doindex just uses \parsearg; it calls \doind for the actual work.
2345 % This is because \doind is more useful to call from other macros.
2347 % There is also \dosubind {index}{topic}{subtopic}
2348 % which makes an entry in a two-level index such as the operation index.
2350 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
2351 \def\singleindexer #1{\doind{\indexname}{#1}}
2353 % like the previous two, but they put @code around the argument.
2354 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2355 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2357 \def\indexdummies{%
2358 \def\ { }%
2359 % Take care of the plain tex accent commands.
2360 \def\"{\realbackslash "}%
2361 \def\`{\realbackslash `}%
2362 \def\'{\realbackslash '}%
2363 \def\^{\realbackslash ^}%
2364 \def\~{\realbackslash ~}%
2365 \def\={\realbackslash =}%
2366 \def\b{\realbackslash b}%
2367 \def\c{\realbackslash c}%
2368 \def\d{\realbackslash d}%
2369 \def\u{\realbackslash u}%
2370 \def\v{\realbackslash v}%
2371 \def\H{\realbackslash H}%
2372 % Take care of the plain tex special European modified letters.
2373 \def\oe{\realbackslash oe}%
2374 \def\ae{\realbackslash ae}%
2375 \def\aa{\realbackslash aa}%
2376 \def\OE{\realbackslash OE}%
2377 \def\AE{\realbackslash AE}%
2378 \def\AA{\realbackslash AA}%
2379 \def\o{\realbackslash o}%
2380 \def\O{\realbackslash O}%
2381 \def\l{\realbackslash l}%
2382 \def\L{\realbackslash L}%
2383 \def\ss{\realbackslash ss}%
2384 % Take care of texinfo commands likely to appear in an index entry.
2385 % (Must be a way to avoid doing expansion at all, and thus not have to
2386 % laboriously list every single command here.)
2387 \def\@{@}% will be @@ when we switch to @ as escape char.
2388 %\let\{ = \lbracecmd
2389 %\let\} = \rbracecmd
2390 \def\_{{\realbackslash _}}%
2391 \def\w{\realbackslash w }%
2392 \def\bf{\realbackslash bf }%
2393 %\def\rm{\realbackslash rm }%
2394 \def\sl{\realbackslash sl }%
2395 \def\sf{\realbackslash sf}%
2396 \def\tt{\realbackslash tt}%
2397 \def\gtr{\realbackslash gtr}%
2398 \def\less{\realbackslash less}%
2399 \def\hat{\realbackslash hat}%
2400 \def\TeX{\realbackslash TeX}%
2401 \def\dots{\realbackslash dots }%
2402 \def\result{\realbackslash result}%
2403 \def\equiv{\realbackslash equiv}%
2404 \def\expansion{\realbackslash expansion}%
2405 \def\print{\realbackslash print}%
2406 \def\error{\realbackslash error}%
2407 \def\point{\realbackslash point}%
2408 \def\copyright{\realbackslash copyright}%
2409 \def\tclose##1{\realbackslash tclose {##1}}%
2410 \def\code##1{\realbackslash code {##1}}%
2411 \def\dotless##1{\realbackslash dotless {##1}}%
2412 \def\samp##1{\realbackslash samp {##1}}%
2413 \def\,##1{\realbackslash ,{##1}}%
2414 \def\t##1{\realbackslash t {##1}}%
2415 \def\r##1{\realbackslash r {##1}}%
2416 \def\i##1{\realbackslash i {##1}}%
2417 \def\b##1{\realbackslash b {##1}}%
2418 \def\sc##1{\realbackslash sc {##1}}%
2419 \def\cite##1{\realbackslash cite {##1}}%
2420 \def\key##1{\realbackslash key {##1}}%
2421 \def\file##1{\realbackslash file {##1}}%
2422 \def\var##1{\realbackslash var {##1}}%
2423 \def\kbd##1{\realbackslash kbd {##1}}%
2424 \def\dfn##1{\realbackslash dfn {##1}}%
2425 \def\emph##1{\realbackslash emph {##1}}%
2427 % Handle some cases of @value -- where the variable name does not
2428 % contain - or _, and the value does not contain any
2429 % (non-fully-expandable) commands.
2430 \let\value = \expandablevalue
2432 \unsepspaces
2435 % If an index command is used in an @example environment, any spaces
2436 % therein should become regular spaces in the raw index file, not the
2437 % expansion of \tie (\\leavevmode \penalty \@M \ ).
2438 {\obeyspaces
2439 \gdef\unsepspaces{\obeyspaces\let =\space}}
2441 % \indexnofonts no-ops all font-change commands.
2442 % This is used when outputting the strings to sort the index by.
2443 \def\indexdummyfont#1{#1}
2444 \def\indexdummytex{TeX}
2445 \def\indexdummydots{...}
2447 \def\indexnofonts{%
2448 % Just ignore accents.
2449 \let\,=\indexdummyfont
2450 \let\"=\indexdummyfont
2451 \let\`=\indexdummyfont
2452 \let\'=\indexdummyfont
2453 \let\^=\indexdummyfont
2454 \let\~=\indexdummyfont
2455 \let\==\indexdummyfont
2456 \let\b=\indexdummyfont
2457 \let\c=\indexdummyfont
2458 \let\d=\indexdummyfont
2459 \let\u=\indexdummyfont
2460 \let\v=\indexdummyfont
2461 \let\H=\indexdummyfont
2462 \let\dotless=\indexdummyfont
2463 % Take care of the plain tex special European modified letters.
2464 \def\oe{oe}%
2465 \def\ae{ae}%
2466 \def\aa{aa}%
2467 \def\OE{OE}%
2468 \def\AE{AE}%
2469 \def\AA{AA}%
2470 \def\o{o}%
2471 \def\O{O}%
2472 \def\l{l}%
2473 \def\L{L}%
2474 \def\ss{ss}%
2475 \let\w=\indexdummyfont
2476 \let\t=\indexdummyfont
2477 \let\r=\indexdummyfont
2478 \let\i=\indexdummyfont
2479 \let\b=\indexdummyfont
2480 \let\emph=\indexdummyfont
2481 \let\strong=\indexdummyfont
2482 \let\cite=\indexdummyfont
2483 \let\sc=\indexdummyfont
2484 %Don't no-op \tt, since it isn't a user-level command
2485 % and is used in the definitions of the active chars like <, >, |...
2486 %\let\tt=\indexdummyfont
2487 \let\tclose=\indexdummyfont
2488 \let\code=\indexdummyfont
2489 \let\file=\indexdummyfont
2490 \let\samp=\indexdummyfont
2491 \let\kbd=\indexdummyfont
2492 \let\key=\indexdummyfont
2493 \let\var=\indexdummyfont
2494 \let\TeX=\indexdummytex
2495 \let\dots=\indexdummydots
2496 \def\@{@}%
2499 % To define \realbackslash, we must make \ not be an escape.
2500 % We must first make another character (@) an escape
2501 % so we do not become unable to do a definition.
2503 {\catcode`\@=0 \catcode`\\=\other
2504 @gdef@realbackslash{\}}
2506 \let\indexbackslash=0 %overridden during \printindex.
2507 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
2509 % For \ifx comparisons.
2510 \def\emptymacro{\empty}
2512 % Most index entries go through here, but \dosubind is the general case.
2514 \def\doind#1#2{\dosubind{#1}{#2}\empty}
2516 % Workhorse for all \fooindexes.
2517 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
2518 % \empty if called from \doind, as we usually are. The main exception
2519 % is with defuns, which call us directly.
2521 \def\dosubind#1#2#3{%
2522 % Put the index entry in the margin if desired.
2523 \ifx\SETmarginindex\relax\else
2524 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2527 \count255=\lastpenalty
2529 \indexdummies % Must do this here, since \bf, etc expand at this stage
2530 \escapechar=`\\
2532 \let\folio = 0% We will expand all macros now EXCEPT \folio.
2533 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2534 % so it will be output as is; and it will print as backslash.
2536 \def\thirdarg{#3}%
2538 % If third arg is present, precede it with space in sort key.
2539 \ifx\thirdarg\emptymacro
2540 \let\subentry = \empty
2541 \else
2542 \def\subentry{ #3}%
2545 % First process the index-string with all font commands turned off
2546 % to get the string to sort by.
2547 {\indexnofonts \xdef\indexsorttmp{#2\subentry}}%
2549 % Now produce the complete index entry, with both the sort key and the
2550 % original text, including any font commands.
2551 \toks0 = {#2}%
2552 \edef\temp{%
2553 \write\csname#1indfile\endcsname{%
2554 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
2557 % If third (subentry) arg is present, add it to the index string.
2558 \ifx\thirdarg\emptymacro \else
2559 \toks0 = {#3}%
2560 \edef\temp{\temp{\the\toks0}}%
2563 % If a skip is the last thing on the list now, preserve it
2564 % by backing up by \lastskip, doing the \write, then inserting
2565 % the skip again. Otherwise, the whatsit generated by the
2566 % \write will make \lastskip zero. The result is that sequences
2567 % like this:
2568 % @end defun
2569 % @tindex whatever
2570 % @defun ...
2571 % will have extra space inserted, because the \medbreak in the
2572 % start of the @defun won't see the skip inserted by the @end of
2573 % the previous defun.
2575 % But don't do any of this if we're not in vertical mode. We
2576 % don't want to do a \vskip and prematurely end a paragraph.
2578 % Avoid page breaks due to these extra skips, too.
2580 \iflinks
2581 \ifvmode
2582 \skip0 = \lastskip
2583 \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi
2586 \temp % do the write
2589 \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
2593 \penalty\count255
2597 % The index entry written in the file actually looks like
2598 % \entry {sortstring}{page}{topic}
2599 % or
2600 % \entry {sortstring}{page}{topic}{subtopic}
2601 % The texindex program reads in these files and writes files
2602 % containing these kinds of lines:
2603 % \initial {c}
2604 % before the first topic whose initial is c
2605 % \entry {topic}{pagelist}
2606 % for a topic that is used without subtopics
2607 % \primary {topic}
2608 % for the beginning of a topic that is used with subtopics
2609 % \secondary {subtopic}{pagelist}
2610 % for each subtopic.
2612 % Define the user-accessible indexing commands
2613 % @findex, @vindex, @kindex, @cindex.
2615 \def\findex {\fnindex}
2616 \def\kindex {\kyindex}
2617 \def\cindex {\cpindex}
2618 \def\vindex {\vrindex}
2619 \def\tindex {\tpindex}
2620 \def\pindex {\pgindex}
2622 \def\cindexsub {\begingroup\obeylines\cindexsub}
2623 {\obeylines %
2624 \gdef\cindexsub "#1" #2^^M{\endgroup %
2625 \dosubind{cp}{#2}{#1}}}
2627 % Define the macros used in formatting output of the sorted index material.
2629 % @printindex causes a particular index (the ??s file) to get printed.
2630 % It does not print any chapter heading (usually an @unnumbered).
2632 \def\printindex{\parsearg\doprintindex}
2633 \def\doprintindex#1{\begingroup
2634 \dobreak \chapheadingskip{10000}%
2636 \indexfonts \rm
2637 \tolerance = 9500
2638 \indexbreaks
2640 % See if the index file exists and is nonempty.
2641 % Change catcode of @ here so that if the index file contains
2642 % \initial {@}
2643 % as its first line, TeX doesn't complain about mismatched braces
2644 % (because it thinks @} is a control sequence).
2645 \catcode`\@ = 11
2646 \openin 1 \jobname.#1s
2647 \ifeof 1
2648 % \enddoublecolumns gets confused if there is no text in the index,
2649 % and it loses the chapter title and the aux file entries for the
2650 % index. The easiest way to prevent this problem is to make sure
2651 % there is some text.
2652 (Index is nonexistent)
2653 \else
2655 % If the index file exists but is empty, then \openin leaves \ifeof
2656 % false. We have to make TeX try to read something from the file, so
2657 % it can discover if there is anything in it.
2658 \read 1 to \temp
2659 \ifeof 1
2660 (Index is empty)
2661 \else
2662 % Index files are almost Texinfo source, but we use \ as the escape
2663 % character. It would be better to use @, but that's too big a change
2664 % to make right now.
2665 \def\indexbackslash{\rawbackslashxx}%
2666 \catcode`\\ = 0
2667 \escapechar = `\\
2668 \begindoublecolumns
2669 \input \jobname.#1s
2670 \enddoublecolumns
2673 \closein 1
2674 \endgroup}
2676 % These macros are used by the sorted index file itself.
2677 % Change them to control the appearance of the index.
2679 \def\initial#1{{%
2680 % Some minor font changes for the special characters.
2681 \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2683 % Remove any glue we may have, we'll be inserting our own.
2684 \removelastskip
2686 % We like breaks before the index initials, so insert a bonus.
2687 \penalty -300
2689 % Typeset the initial. Making this add up to a whole number of
2690 % baselineskips increases the chance of the dots lining up from column
2691 % to column. It still won't often be perfect, because of the stretch
2692 % we need before each entry, but it's better.
2694 % No shrink because it confuses \balancecolumns.
2695 \vskip 1.67\baselineskip plus .5\baselineskip
2696 \leftline{\secbf #1}%
2697 \vskip .33\baselineskip plus .1\baselineskip
2699 % Do our best not to break after the initial.
2700 \nobreak
2703 % This typesets a paragraph consisting of #1, dot leaders, and then #2
2704 % flush to the right margin. It is used for index and table of contents
2705 % entries. The paragraph is indented by \leftskip.
2707 \def\entry#1#2{\begingroup
2709 % Start a new paragraph if necessary, so our assignments below can't
2710 % affect previous text.
2711 \par
2713 % Do not fill out the last line with white space.
2714 \parfillskip = 0in
2716 % No extra space above this paragraph.
2717 \parskip = 0in
2719 % Do not prefer a separate line ending with a hyphen to fewer lines.
2720 \finalhyphendemerits = 0
2722 % \hangindent is only relevant when the entry text and page number
2723 % don't both fit on one line. In that case, bob suggests starting the
2724 % dots pretty far over on the line. Unfortunately, a large
2725 % indentation looks wrong when the entry text itself is broken across
2726 % lines. So we use a small indentation and put up with long leaders.
2728 % \hangafter is reset to 1 (which is the value we want) at the start
2729 % of each paragraph, so we need not do anything with that.
2730 \hangindent = 2em
2732 % When the entry text needs to be broken, just fill out the first line
2733 % with blank space.
2734 \rightskip = 0pt plus1fil
2736 % A bit of stretch before each entry for the benefit of balancing columns.
2737 \vskip 0pt plus1pt
2739 % Start a ``paragraph'' for the index entry so the line breaking
2740 % parameters we've set above will have an effect.
2741 \noindent
2743 % Insert the text of the index entry. TeX will do line-breaking on it.
2745 % The following is kludged to not output a line of dots in the index if
2746 % there are no page numbers. The next person who breaks this will be
2747 % cursed by a Unix daemon.
2748 \def\tempa{{\rm }}%
2749 \def\tempb{#2}%
2750 \edef\tempc{\tempa}%
2751 \edef\tempd{\tempb}%
2752 \ifx\tempc\tempd\ \else%
2754 % If we must, put the page number on a line of its own, and fill out
2755 % this line with blank space. (The \hfil is overwhelmed with the
2756 % fill leaders glue in \indexdotfill if the page number does fit.)
2757 \hfil\penalty50
2758 \null\nobreak\indexdotfill % Have leaders before the page number.
2760 % The `\ ' here is removed by the implicit \unskip that TeX does as
2761 % part of (the primitive) \par. Without it, a spurious underfull
2762 % \hbox ensues.
2763 \ #2% The page number ends the paragraph.
2764 \fi%
2765 \par
2766 \endgroup}
2768 % Like \dotfill except takes at least 1 em.
2769 \def\indexdotfill{\cleaders
2770 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
2772 \def\primary #1{\line{#1\hfil}}
2774 \newskip\secondaryindent \secondaryindent=0.5cm
2776 \def\secondary #1#2{
2777 {\parfillskip=0in \parskip=0in
2778 \hangindent =1in \hangafter=1
2779 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
2782 % Define two-column mode, which we use to typeset indexes.
2783 % Adapted from the TeXbook, page 416, which is to say,
2784 % the manmac.tex format used to print the TeXbook itself.
2785 \catcode`\@=11
2787 \newbox\partialpage
2788 \newdimen\doublecolumnhsize
2790 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
2791 % Grab any single-column material above us.
2792 \output = {\global\setbox\partialpage = \vbox{%
2794 % Here is a possibility not foreseen in manmac: if we accumulate a
2795 % whole lot of material, we might end up calling this \output
2796 % routine twice in a row (see the doublecol-lose test, which is
2797 % essentially a couple of indexes with @setchapternewpage off). In
2798 % that case, we must prevent the second \partialpage from
2799 % simply overwriting the first, causing us to lose the page.
2800 % This will preserve it until a real output routine can ship it
2801 % out. Generally, \partialpage will be empty when this runs and
2802 % this will be a no-op.
2803 \unvbox\partialpage
2805 % Unvbox the main output page.
2806 \unvbox255
2807 \kern-\topskip \kern\baselineskip
2809 \eject
2811 % Use the double-column output routine for subsequent pages.
2812 \output = {\doublecolumnout}%
2814 % Change the page size parameters. We could do this once outside this
2815 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
2816 % format, but then we repeat the same computation. Repeating a couple
2817 % of assignments once per index is clearly meaningless for the
2818 % execution time, so we may as well do it in one place.
2820 % First we halve the line length, less a little for the gutter between
2821 % the columns. We compute the gutter based on the line length, so it
2822 % changes automatically with the paper format. The magic constant
2823 % below is chosen so that the gutter has the same value (well, +-<1pt)
2824 % as it did when we hard-coded it.
2826 % We put the result in a separate register, \doublecolumhsize, so we
2827 % can restore it in \pagesofar, after \hsize itself has (potentially)
2828 % been clobbered.
2830 \doublecolumnhsize = \hsize
2831 \advance\doublecolumnhsize by -.04154\hsize
2832 \divide\doublecolumnhsize by 2
2833 \hsize = \doublecolumnhsize
2835 % Double the \vsize as well. (We don't need a separate register here,
2836 % since nobody clobbers \vsize.)
2837 \advance\vsize by -\ht\partialpage
2838 \vsize = 2\vsize
2841 % The double-column output routine for all double-column pages except
2842 % the last.
2844 \def\doublecolumnout{%
2845 \splittopskip=\topskip \splitmaxdepth=\maxdepth
2846 % Get the available space for the double columns -- the normal
2847 % (undoubled) page height minus any material left over from the
2848 % previous page.
2849 \dimen@ = \vsize
2850 \divide\dimen@ by 2
2852 % box0 will be the left-hand column, box2 the right.
2853 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
2854 \onepageout\pagesofar
2855 \unvbox255
2856 \penalty\outputpenalty
2858 \def\pagesofar{%
2859 % Re-output the contents of the output page -- any previous material,
2860 % followed by the two boxes we just split, in box0 and box2.
2861 \advance\vsize by \ht\partialpage
2862 \unvbox\partialpage
2864 \hsize = \doublecolumnhsize
2865 \wd0=\hsize \wd2=\hsize
2866 \hbox to\pagewidth{\box0\hfil\box2}%
2868 \def\enddoublecolumns{%
2869 \output = {%
2870 % Split the last of the double-column material. Leave on the
2871 % current page, no automatic page break.
2872 \balancecolumns
2874 % If we end up splitting too much material for the current page,
2875 % though, there will be another page break right after this \output
2876 % invocation ends. Having called \balancecolumns once, we do not
2877 % want to call it again. Therefore, reset \output to its normal
2878 % definition right away. (We hope \balancecolumns will never be
2879 % called on to balance too much material, but if it is, this makes
2880 % the output somewhat more palatable.)
2881 \global\output = {\onepageout{\pagecontents\PAGE}}%
2883 % \pagegoal was set to the doubled \vsize above, since we restarted
2884 % the current page. We're now back to normal single-column
2885 % typesetting, so reset \pagegoal to the normal \vsize.
2886 \pagegoal = \vsize
2888 \eject
2889 \endgroup % started in \begindoublecolumns
2891 \def\balancecolumns{%
2892 % Called at the end of the double column material.
2893 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
2894 \dimen@ = \ht0
2895 \advance\dimen@ by \topskip
2896 \advance\dimen@ by-\baselineskip
2897 \divide\dimen@ by 2 % target to split to
2898 %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
2899 \splittopskip = \topskip
2900 % Loop until we get a decent breakpoint.
2902 \vbadness = 10000
2903 \loop
2904 \global\setbox3 = \copy0
2905 \global\setbox1 = \vsplit3 to \dimen@
2906 \ifdim\ht3>\dimen@
2907 \global\advance\dimen@ by 1pt
2908 \repeat
2910 %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
2911 \setbox0=\vbox to\dimen@{\unvbox1}%
2912 \setbox2=\vbox to\dimen@{\unvbox3}%
2914 \pagesofar
2916 \catcode`\@ = \other
2919 \message{sectioning,}
2920 % Define chapters, sections, etc.
2922 \newcount\chapno
2923 \newcount\secno \secno=0
2924 \newcount\subsecno \subsecno=0
2925 \newcount\subsubsecno \subsubsecno=0
2927 % This counter is funny since it counts through charcodes of letters A, B, ...
2928 \newcount\appendixno \appendixno = `\@
2929 \def\appendixletter{\char\the\appendixno}
2931 % Each @chapter defines this as the name of the chapter.
2932 % page headings and footings can use it. @section does likewise.
2933 \def\thischapter{}
2934 \def\thissection{}
2936 \newcount\absseclevel % used to calculate proper heading level
2937 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
2939 % @raisesections: treat @section as chapter, @subsection as section, etc.
2940 \def\raisesections{\global\advance\secbase by -1}
2941 \let\up=\raisesections % original BFox name
2943 % @lowersections: treat @chapter as section, @section as subsection, etc.
2944 \def\lowersections{\global\advance\secbase by 1}
2945 \let\down=\lowersections % original BFox name
2947 % Choose a numbered-heading macro
2948 % #1 is heading level if unmodified by @raisesections or @lowersections
2949 % #2 is text for heading
2950 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2951 \ifcase\absseclevel
2952 \chapterzzz{#2}
2954 \seczzz{#2}
2956 \numberedsubseczzz{#2}
2958 \numberedsubsubseczzz{#2}
2959 \else
2960 \ifnum \absseclevel<0
2961 \chapterzzz{#2}
2962 \else
2963 \numberedsubsubseczzz{#2}
2968 % like \numhead, but chooses appendix heading levels
2969 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2970 \ifcase\absseclevel
2971 \appendixzzz{#2}
2973 \appendixsectionzzz{#2}
2975 \appendixsubseczzz{#2}
2977 \appendixsubsubseczzz{#2}
2978 \else
2979 \ifnum \absseclevel<0
2980 \appendixzzz{#2}
2981 \else
2982 \appendixsubsubseczzz{#2}
2987 % like \numhead, but chooses numberless heading levels
2988 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2989 \ifcase\absseclevel
2990 \unnumberedzzz{#2}
2992 \unnumberedseczzz{#2}
2994 \unnumberedsubseczzz{#2}
2996 \unnumberedsubsubseczzz{#2}
2997 \else
2998 \ifnum \absseclevel<0
2999 \unnumberedzzz{#2}
3000 \else
3001 \unnumberedsubsubseczzz{#2}
3006 % @chapter, @appendix, @unnumbered.
3007 \def\thischaptername{No Chapter Title}
3008 \outer\def\chapter{\parsearg\chapteryyy}
3009 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
3010 \def\chapterzzz #1{%
3011 \secno=0 \subsecno=0 \subsubsecno=0
3012 \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
3013 \chapmacro {#1}{\the\chapno}%
3014 \gdef\thissection{#1}%
3015 \gdef\thischaptername{#1}%
3016 % We don't substitute the actual chapter name into \thischapter
3017 % because we don't want its macros evaluated now.
3018 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
3019 \toks0 = {#1}%
3020 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
3021 {\the\chapno}}}%
3022 \temp
3023 \donoderef
3024 \global\let\section = \numberedsec
3025 \global\let\subsection = \numberedsubsec
3026 \global\let\subsubsection = \numberedsubsubsec
3029 \outer\def\appendix{\parsearg\appendixyyy}
3030 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
3031 \def\appendixzzz #1{%
3032 \secno=0 \subsecno=0 \subsubsecno=0
3033 \global\advance \appendixno by 1
3034 \message{\putwordAppendix\space \appendixletter}%
3035 \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
3036 \gdef\thissection{#1}%
3037 \gdef\thischaptername{#1}%
3038 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
3039 \toks0 = {#1}%
3040 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
3041 {\putwordAppendix{} \appendixletter}}}%
3042 \temp
3043 \appendixnoderef
3044 \global\let\section = \appendixsec
3045 \global\let\subsection = \appendixsubsec
3046 \global\let\subsubsection = \appendixsubsubsec
3049 % @centerchap is like @unnumbered, but the heading is centered.
3050 \outer\def\centerchap{\parsearg\centerchapyyy}
3051 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
3053 % @top is like @unnumbered.
3054 \outer\def\top{\parsearg\unnumberedyyy}
3056 \outer\def\unnumbered{\parsearg\unnumberedyyy}
3057 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
3058 \def\unnumberedzzz #1{%
3059 \secno=0 \subsecno=0 \subsubsecno=0
3061 % This used to be simply \message{#1}, but TeX fully expands the
3062 % argument to \message. Therefore, if #1 contained @-commands, TeX
3063 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
3064 % expanded @cite (which turns out to cause errors because \cite is meant
3065 % to be executed, not expanded).
3067 % Anyway, we don't want the fully-expanded definition of @cite to appear
3068 % as a result of the \message, we just want `@cite' itself. We use
3069 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
3070 % simply yielding the contents of <toks register>. (We also do this for
3071 % the toc entries.)
3072 \toks0 = {#1}\message{(\the\toks0)}%
3074 \unnumbchapmacro {#1}%
3075 \gdef\thischapter{#1}\gdef\thissection{#1}%
3076 \toks0 = {#1}%
3077 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}%
3078 \temp
3079 \unnumbnoderef
3080 \global\let\section = \unnumberedsec
3081 \global\let\subsection = \unnumberedsubsec
3082 \global\let\subsubsection = \unnumberedsubsubsec
3085 % Sections.
3086 \outer\def\numberedsec{\parsearg\secyyy}
3087 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
3088 \def\seczzz #1{%
3089 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3090 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
3091 \toks0 = {#1}%
3092 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3093 {\the\chapno}{\the\secno}}}%
3094 \temp
3095 \donoderef
3096 \nobreak
3099 \outer\def\appendixsection{\parsearg\appendixsecyyy}
3100 \outer\def\appendixsec{\parsearg\appendixsecyyy}
3101 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
3102 \def\appendixsectionzzz #1{%
3103 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3104 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
3105 \toks0 = {#1}%
3106 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3107 {\appendixletter}{\the\secno}}}%
3108 \temp
3109 \appendixnoderef
3110 \nobreak
3113 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
3114 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
3115 \def\unnumberedseczzz #1{%
3116 \plainsecheading {#1}\gdef\thissection{#1}%
3117 \toks0 = {#1}%
3118 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}%
3119 \temp
3120 \unnumbnoderef
3121 \nobreak
3124 % Subsections.
3125 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
3126 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
3127 \def\numberedsubseczzz #1{%
3128 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3129 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
3130 \toks0 = {#1}%
3131 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3132 {\the\chapno}{\the\secno}{\the\subsecno}}}%
3133 \temp
3134 \donoderef
3135 \nobreak
3138 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
3139 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
3140 \def\appendixsubseczzz #1{%
3141 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3142 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
3143 \toks0 = {#1}%
3144 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3145 {\appendixletter}{\the\secno}{\the\subsecno}}}%
3146 \temp
3147 \appendixnoderef
3148 \nobreak
3151 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
3152 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
3153 \def\unnumberedsubseczzz #1{%
3154 \plainsubsecheading {#1}\gdef\thissection{#1}%
3155 \toks0 = {#1}%
3156 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry%
3157 {\the\toks0}}}%
3158 \temp
3159 \unnumbnoderef
3160 \nobreak
3163 % Subsubsections.
3164 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
3165 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
3166 \def\numberedsubsubseczzz #1{%
3167 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3168 \subsubsecheading {#1}
3169 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3170 \toks0 = {#1}%
3171 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3172 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3173 \temp
3174 \donoderef
3175 \nobreak
3178 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
3179 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
3180 \def\appendixsubsubseczzz #1{%
3181 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3182 \subsubsecheading {#1}
3183 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3184 \toks0 = {#1}%
3185 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3186 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3187 \temp
3188 \appendixnoderef
3189 \nobreak
3192 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
3193 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
3194 \def\unnumberedsubsubseczzz #1{%
3195 \plainsubsubsecheading {#1}\gdef\thissection{#1}%
3196 \toks0 = {#1}%
3197 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry%
3198 {\the\toks0}}}%
3199 \temp
3200 \unnumbnoderef
3201 \nobreak
3204 % These are variants which are not "outer", so they can appear in @ifinfo.
3205 % Actually, they should now be obsolete; ordinary section commands should work.
3206 \def\infotop{\parsearg\unnumberedzzz}
3207 \def\infounnumbered{\parsearg\unnumberedzzz}
3208 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
3209 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
3210 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
3212 \def\infoappendix{\parsearg\appendixzzz}
3213 \def\infoappendixsec{\parsearg\appendixseczzz}
3214 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
3215 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
3217 \def\infochapter{\parsearg\chapterzzz}
3218 \def\infosection{\parsearg\sectionzzz}
3219 \def\infosubsection{\parsearg\subsectionzzz}
3220 \def\infosubsubsection{\parsearg\subsubsectionzzz}
3222 % These macros control what the section commands do, according
3223 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
3224 % Define them by default for a numbered chapter.
3225 \global\let\section = \numberedsec
3226 \global\let\subsection = \numberedsubsec
3227 \global\let\subsubsection = \numberedsubsubsec
3229 % Define @majorheading, @heading and @subheading
3231 % NOTE on use of \vbox for chapter headings, section headings, and such:
3232 % 1) We use \vbox rather than the earlier \line to permit
3233 % overlong headings to fold.
3234 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
3235 % heading is obnoxious; this forbids it.
3236 % 3) Likewise, headings look best if no \parindent is used, and
3237 % if justification is not attempted. Hence \raggedright.
3240 \def\majorheading{\parsearg\majorheadingzzz}
3241 \def\majorheadingzzz #1{%
3242 {\advance\chapheadingskip by 10pt \chapbreak }%
3243 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3244 \parindent=0pt\raggedright
3245 \rm #1\hfill}}\bigskip \par\penalty 200}
3247 \def\chapheading{\parsearg\chapheadingzzz}
3248 \def\chapheadingzzz #1{\chapbreak %
3249 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3250 \parindent=0pt\raggedright
3251 \rm #1\hfill}}\bigskip \par\penalty 200}
3253 % @heading, @subheading, @subsubheading.
3254 \def\heading{\parsearg\plainsecheading}
3255 \def\subheading{\parsearg\plainsubsecheading}
3256 \def\subsubheading{\parsearg\plainsubsubsecheading}
3258 % These macros generate a chapter, section, etc. heading only
3259 % (including whitespace, linebreaking, etc. around it),
3260 % given all the information in convenient, parsed form.
3262 %%% Args are the skip and penalty (usually negative)
3263 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
3265 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
3267 %%% Define plain chapter starts, and page on/off switching for it
3268 % Parameter controlling skip before chapter headings (if needed)
3270 \newskip\chapheadingskip
3272 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
3273 \def\chappager{\par\vfill\supereject}
3274 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
3276 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
3278 \def\CHAPPAGoff{%
3279 \global\let\contentsalignmacro = \chappager
3280 \global\let\pchapsepmacro=\chapbreak
3281 \global\let\pagealignmacro=\chappager}
3283 \def\CHAPPAGon{%
3284 \global\let\contentsalignmacro = \chappager
3285 \global\let\pchapsepmacro=\chappager
3286 \global\let\pagealignmacro=\chappager
3287 \global\def\HEADINGSon{\HEADINGSsingle}}
3289 \def\CHAPPAGodd{
3290 \global\let\contentsalignmacro = \chapoddpage
3291 \global\let\pchapsepmacro=\chapoddpage
3292 \global\let\pagealignmacro=\chapoddpage
3293 \global\def\HEADINGSon{\HEADINGSdouble}}
3295 \CHAPPAGon
3297 \def\CHAPFplain{
3298 \global\let\chapmacro=\chfplain
3299 \global\let\unnumbchapmacro=\unnchfplain
3300 \global\let\centerchapmacro=\centerchfplain}
3302 % Plain chapter opening.
3303 % #1 is the text, #2 the chapter number or empty if unnumbered.
3304 \def\chfplain#1#2{%
3305 \pchapsepmacro
3307 \chapfonts \rm
3308 \def\chapnum{#2}%
3309 \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
3310 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3311 \hangindent = \wd0 \centerparametersmaybe
3312 \unhbox0 #1\par}%
3314 \nobreak\bigskip % no page break after a chapter title
3315 \nobreak
3318 % Plain opening for unnumbered.
3319 \def\unnchfplain#1{\chfplain{#1}{}}
3321 % @centerchap -- centered and unnumbered.
3322 \let\centerparametersmaybe = \relax
3323 \def\centerchfplain#1{{%
3324 \def\centerparametersmaybe{%
3325 \advance\rightskip by 3\rightskip
3326 \leftskip = \rightskip
3327 \parfillskip = 0pt
3329 \chfplain{#1}{}%
3332 \CHAPFplain % The default
3334 \def\unnchfopen #1{%
3335 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3336 \parindent=0pt\raggedright
3337 \rm #1\hfill}}\bigskip \par\nobreak
3340 \def\chfopen #1#2{\chapoddpage {\chapfonts
3341 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
3342 \par\penalty 5000 %
3345 \def\centerchfopen #1{%
3346 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3347 \parindent=0pt
3348 \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
3351 \def\CHAPFopen{
3352 \global\let\chapmacro=\chfopen
3353 \global\let\unnumbchapmacro=\unnchfopen
3354 \global\let\centerchapmacro=\centerchfopen}
3357 % Section titles.
3358 \newskip\secheadingskip
3359 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
3360 \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
3361 \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
3363 % Subsection titles.
3364 \newskip \subsecheadingskip
3365 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
3366 \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
3367 \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
3369 % Subsubsection titles.
3370 \let\subsubsecheadingskip = \subsecheadingskip
3371 \let\subsubsecheadingbreak = \subsecheadingbreak
3372 \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
3373 \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
3376 % Print any size section title.
3378 % #1 is the section type (sec/subsec/subsubsec), #2 is the section
3379 % number (maybe empty), #3 the text.
3380 \def\sectionheading#1#2#3{%
3382 \expandafter\advance\csname #1headingskip\endcsname by \parskip
3383 \csname #1headingbreak\endcsname
3386 % Switch to the right set of fonts.
3387 \csname #1fonts\endcsname \rm
3389 % Only insert the separating space if we have a section number.
3390 \def\secnum{#2}%
3391 \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
3393 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3394 \hangindent = \wd0 % zero if no section number
3395 \unhbox0 #3}%
3397 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
3401 \message{toc,}
3402 \newwrite\tocfile
3404 % Write an entry to the toc file, opening it if necessary.
3405 % Called from @chapter, etc. We supply {\folio} at the end of the
3406 % argument, which will end up as the last argument to the \...entry macro.
3408 % We open the .toc file here instead of at @setfilename or any other
3409 % given time so that @contents can be put in the document anywhere.
3411 \newif\iftocfileopened
3412 \def\writetocentry#1{%
3413 \iftocfileopened\else
3414 \immediate\openout\tocfile = \jobname.toc
3415 \global\tocfileopenedtrue
3417 \iflinks \write\tocfile{#1{\folio}}\fi
3420 \newskip\contentsrightmargin \contentsrightmargin=1in
3421 \newcount\savepageno
3422 \newcount\lastnegativepageno \lastnegativepageno = -1
3424 % Finish up the main text and prepare to read what we've written
3425 % to \tocfile.
3427 \def\startcontents#1{%
3428 % If @setchapternewpage on, and @headings double, the contents should
3429 % start on an odd page, unlike chapters. Thus, we maintain
3430 % \contentsalignmacro in parallel with \pagealignmacro.
3431 % From: Torbjorn Granlund <tege@matematik.su.se>
3432 \contentsalignmacro
3433 \immediate\closeout\tocfile
3435 % Don't need to put `Contents' or `Short Contents' in the headline.
3436 % It is abundantly clear what they are.
3437 \unnumbchapmacro{#1}\def\thischapter{}%
3438 \savepageno = \pageno
3439 \begingroup % Set up to handle contents files properly.
3440 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
3441 % We can't do this, because then an actual ^ in a section
3442 % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
3443 %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3444 \raggedbottom % Worry more about breakpoints than the bottom.
3445 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3447 % Roman numerals for page numbers.
3448 \ifnum \pageno>0 \pageno = \lastnegativepageno \fi
3452 % Normal (long) toc.
3453 \def\contents{%
3454 \startcontents{\putwordTableofContents}%
3455 \openin 1 \jobname.toc
3456 \ifeof 1 \else
3457 \closein 1
3458 \input \jobname.toc
3460 \vfill \eject
3461 \endgroup
3462 \lastnegativepageno = \pageno
3463 \pageno = \savepageno
3466 % And just the chapters.
3467 \def\summarycontents{%
3468 \startcontents{\putwordShortContents}%
3470 \let\chapentry = \shortchapentry
3471 \let\unnumbchapentry = \shortunnumberedentry
3472 % We want a true roman here for the page numbers.
3473 \secfonts
3474 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
3476 \hyphenpenalty = 10000
3477 \advance\baselineskip by 1pt % Open it up a little.
3478 \def\secentry ##1##2##3##4{}
3479 \def\unnumbsecentry ##1##2{}
3480 \def\subsecentry ##1##2##3##4##5{}
3481 \def\unnumbsubsecentry ##1##2{}
3482 \def\subsubsecentry ##1##2##3##4##5##6{}
3483 \def\unnumbsubsubsecentry ##1##2{}
3484 \openin 1 \jobname.toc
3485 \ifeof 1 \else
3486 \closein 1
3487 \input \jobname.toc
3489 \vfill \eject
3490 \endgroup
3491 \lastnegativepageno = \pageno
3492 \pageno = \savepageno
3494 \let\shortcontents = \summarycontents
3496 % These macros generate individual entries in the table of contents.
3497 % The first argument is the chapter or section name.
3498 % The last argument is the page number.
3499 % The arguments in between are the chapter number, section number, ...
3501 % Chapter-level things, for both the long and short contents.
3502 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3504 % See comments in \dochapentry re vbox and related settings
3505 \def\shortchapentry#1#2#3{%
3506 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
3509 % Typeset the label for a chapter or appendix for the short contents.
3510 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
3511 % We could simplify the code here by writing out an \appendixentry
3512 % command in the toc file for appendices, instead of using \chapentry
3513 % for both, but it doesn't seem worth it.
3514 \setbox0 = \hbox{\shortcontrm \putwordAppendix }
3515 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
3517 \def\shortchaplabel#1{%
3518 % We typeset #1 in a box of constant width, regardless of the text of
3519 % #1, so the chapter titles will come out aligned.
3520 \setbox0 = \hbox{#1}%
3521 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3523 % This space should be plenty, since a single number is .5em, and the
3524 % widest letter (M) is 1em, at least in the Computer Modern fonts.
3525 % (This space doesn't include the extra space that gets added after
3526 % the label; that gets put in by \shortchapentry above.)
3527 \advance\dimen0 by 1.1em
3528 \hbox to \dimen0{#1\hfil}%
3531 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3532 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
3534 % Sections.
3535 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3536 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
3538 % Subsections.
3539 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
3540 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
3542 % And subsubsections.
3543 \def\subsubsecentry#1#2#3#4#5#6{%
3544 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
3545 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
3547 % This parameter controls the indentation of the various levels.
3548 \newdimen\tocindent \tocindent = 3pc
3550 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
3551 % page number.
3553 % If the toc has to be broken over pages, we want it to be at chapters
3554 % if at all possible; hence the \penalty.
3555 \def\dochapentry#1#2{%
3556 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
3557 \begingroup
3558 \chapentryfonts
3559 \tocentry{#1}{\dopageno{#2}}%
3560 \endgroup
3561 \nobreak\vskip .25\baselineskip plus.1\baselineskip
3564 \def\dosecentry#1#2{\begingroup
3565 \secentryfonts \leftskip=\tocindent
3566 \tocentry{#1}{\dopageno{#2}}%
3567 \endgroup}
3569 \def\dosubsecentry#1#2{\begingroup
3570 \subsecentryfonts \leftskip=2\tocindent
3571 \tocentry{#1}{\dopageno{#2}}%
3572 \endgroup}
3574 \def\dosubsubsecentry#1#2{\begingroup
3575 \subsubsecentryfonts \leftskip=3\tocindent
3576 \tocentry{#1}{\dopageno{#2}}%
3577 \endgroup}
3579 % Final typesetting of a toc entry; we use the same \entry macro as for
3580 % the index entries, but we want to suppress hyphenation here. (We
3581 % can't do that in the \entry macro, since index entries might consist
3582 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
3583 \def\tocentry#1#2{\begingroup
3584 \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
3585 % Do not use \turnoffactive in these arguments. Since the toc is
3586 % typeset in cmr, so characters such as _ would come out wrong; we
3587 % have to do the usual translation tricks.
3588 \entry{#1}{#2}%
3589 \endgroup}
3591 % Space between chapter (or whatever) number and the title.
3592 \def\labelspace{\hskip1em \relax}
3594 \def\dopageno#1{{\rm #1}}
3595 \def\doshortpageno#1{{\rm #1}}
3597 \def\chapentryfonts{\secfonts \rm}
3598 \def\secentryfonts{\textfonts}
3599 \let\subsecentryfonts = \textfonts
3600 \let\subsubsecentryfonts = \textfonts
3603 \message{environments,}
3605 % Since these characters are used in examples, it should be an even number of
3606 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3607 % Furthermore, these definitions must come after we define our fonts.
3608 \newbox\dblarrowbox \newbox\longdblarrowbox
3609 \newbox\pushcharbox \newbox\bullbox
3610 \newbox\equivbox \newbox\errorbox
3612 %{\tentt
3613 %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
3614 %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
3615 %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
3616 %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
3617 % Adapted from the manmac format (p.420 of TeXbook)
3618 %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
3619 % depth .1ex\hfil}
3622 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3623 \def\point{$\star$}
3624 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3625 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
3626 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3627 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3629 % Adapted from the TeXbook's \boxit.
3630 {\tentt \global\dimen0 = 3em}% Width of the box.
3631 \dimen2 = .55pt % Thickness of rules
3632 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3633 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
3635 \global\setbox\errorbox=\hbox to \dimen0{\hfil
3636 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3637 \advance\hsize by -2\dimen2 % Rules.
3638 \vbox{
3639 \hrule height\dimen2
3640 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3641 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3642 \kern3pt\vrule width\dimen2}% Space to right.
3643 \hrule height\dimen2}
3644 \hfil}
3646 % The @error{} command.
3647 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3649 % @tex ... @end tex escapes into raw Tex temporarily.
3650 % One exception: @ is still an escape character, so that @end tex works.
3651 % But \@ or @@ will get a plain tex @ character.
3653 \def\tex{\begingroup
3654 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
3655 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
3656 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
3657 \catcode `\%=14
3658 \catcode 43=12 % plus
3659 \catcode`\"=12
3660 \catcode`\==12
3661 \catcode`\|=12
3662 \catcode`\<=12
3663 \catcode`\>=12
3664 \escapechar=`\\
3666 \let\b=\ptexb
3667 \let\bullet=\ptexbullet
3668 \let\c=\ptexc
3669 \let\,=\ptexcomma
3670 \let\.=\ptexdot
3671 \let\dots=\ptexdots
3672 \let\equiv=\ptexequiv
3673 \let\!=\ptexexclam
3674 \let\i=\ptexi
3675 \let\{=\ptexlbrace
3676 \let\+=\tabalign
3677 \let\}=\ptexrbrace
3678 \let\*=\ptexstar
3679 \let\t=\ptext
3681 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
3682 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
3683 \def\@{@}%
3684 \let\Etex=\endgroup}
3686 % Define @lisp ... @endlisp.
3687 % @lisp does a \begingroup so it can rebind things,
3688 % including the definition of @endlisp (which normally is erroneous).
3690 % Amount to narrow the margins by for @lisp.
3691 \newskip\lispnarrowing \lispnarrowing=0.4in
3693 % This is the definition that ^^M gets inside @lisp, @example, and other
3694 % such environments. \null is better than a space, since it doesn't
3695 % have any width.
3696 \def\lisppar{\null\endgraf}
3698 % Make each space character in the input produce a normal interword
3699 % space in the output. Don't allow a line break at this space, as this
3700 % is used only in environments like @example, where each line of input
3701 % should produce a line of output anyway.
3703 {\obeyspaces %
3704 \gdef\sepspaces{\obeyspaces\let =\tie}}
3706 % Define \obeyedspace to be our active space, whatever it is. This is
3707 % for use in \parsearg.
3708 {\sepspaces%
3709 \global\let\obeyedspace= }
3711 % This space is always present above and below environments.
3712 \newskip\envskipamount \envskipamount = 0pt
3714 % Make spacing and below environment symmetrical. We use \parskip here
3715 % to help in doing that, since in @example-like environments \parskip
3716 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
3717 % start of the next paragraph will insert \parskip
3719 \def\aboveenvbreak{{\advance\envskipamount by \parskip
3720 \endgraf \ifdim\lastskip<\envskipamount
3721 \removelastskip \penalty-50 \vskip\envskipamount \fi}}
3723 \let\afterenvbreak = \aboveenvbreak
3725 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
3726 \let\nonarrowing=\relax
3728 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
3729 % environment contents.
3730 \font\circle=lcircle10
3731 \newdimen\circthick
3732 \newdimen\cartouter\newdimen\cartinner
3733 \newskip\normbskip\newskip\normpskip\newskip\normlskip
3734 \circthick=\fontdimen8\circle
3736 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
3737 \def\ctr{{\hskip 6pt\circle\char'010}}
3738 \def\cbl{{\circle\char'012\hskip -6pt}}
3739 \def\cbr{{\hskip 6pt\circle\char'011}}
3740 \def\carttop{\hbox to \cartouter{\hskip\lskip
3741 \ctl\leaders\hrule height\circthick\hfil\ctr
3742 \hskip\rskip}}
3743 \def\cartbot{\hbox to \cartouter{\hskip\lskip
3744 \cbl\leaders\hrule height\circthick\hfil\cbr
3745 \hskip\rskip}}
3747 \newskip\lskip\newskip\rskip
3749 \long\def\cartouche{%
3750 \begingroup
3751 \lskip=\leftskip \rskip=\rightskip
3752 \leftskip=0pt\rightskip=0pt %we want these *outside*.
3753 \cartinner=\hsize \advance\cartinner by-\lskip
3754 \advance\cartinner by-\rskip
3755 \cartouter=\hsize
3756 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
3757 % side, and for 6pt waste from
3758 % each corner char, and rule thickness
3759 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
3760 % Flag to tell @lisp, etc., not to narrow margin.
3761 \let\nonarrowing=\comment
3762 \vbox\bgroup
3763 \baselineskip=0pt\parskip=0pt\lineskip=0pt
3764 \carttop
3765 \hbox\bgroup
3766 \hskip\lskip
3767 \vrule\kern3pt
3768 \vbox\bgroup
3769 \hsize=\cartinner
3770 \kern3pt
3771 \begingroup
3772 \baselineskip=\normbskip
3773 \lineskip=\normlskip
3774 \parskip=\normpskip
3775 \vskip -\parskip
3776 \def\Ecartouche{%
3777 \endgroup
3778 \kern3pt
3779 \egroup
3780 \kern3pt\vrule
3781 \hskip\rskip
3782 \egroup
3783 \cartbot
3784 \egroup
3785 \endgroup
3789 % This macro is called at the beginning of all the @example variants,
3790 % inside a group.
3791 \def\nonfillstart{%
3792 \aboveenvbreak
3793 \inENV % This group ends at the end of the body
3794 \hfuzz = 12pt % Don't be fussy
3795 \sepspaces % Make spaces be word-separators rather than space tokens.
3796 \singlespace
3797 \let\par = \lisppar % don't ignore blank lines
3798 \obeylines % each line of input is a line of output
3799 \parskip = 0pt
3800 \parindent = 0pt
3801 \emergencystretch = 0pt % don't try to avoid overfull boxes
3802 % @cartouche defines \nonarrowing to inhibit narrowing
3803 % at next level down.
3804 \ifx\nonarrowing\relax
3805 \advance \leftskip by \lispnarrowing
3806 \exdentamount=\lispnarrowing
3807 \let\exdent=\nofillexdent
3808 \let\nonarrowing=\relax
3812 % Define the \E... control sequence only if we are inside the particular
3813 % environment, so the error checking in \end will work.
3815 % To end an @example-like environment, we first end the paragraph (via
3816 % \afterenvbreak's vertical glue), and then the group. That way we keep
3817 % the zero \parskip that the environments set -- \parskip glue will be
3818 % inserted at the beginning of the next paragraph in the document, after
3819 % the environment.
3821 \def\nonfillfinish{\afterenvbreak\endgroup}
3823 % @lisp: indented, narrowed, typewriter font.
3824 \def\lisp{\begingroup
3825 \nonfillstart
3826 \let\Elisp = \nonfillfinish
3828 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
3829 \gobble % eat return
3832 % @example: Same as @lisp.
3833 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
3835 % @small... is usually equivalent to the non-small (@smallbook
3836 % redefines). We must call \example (or whatever) last in the
3837 % definition, since it reads the return following the @example (or
3838 % whatever) command.
3840 % This actually allows (for example) @end display inside an
3841 % @smalldisplay. Too bad, but makeinfo will catch the error anyway.
3843 \def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display}
3844 \def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp}
3845 \def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format}
3846 \def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
3848 % Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
3849 % Originally contributed by Pavel@xerox.
3850 \def\smalllispx{\begingroup
3851 \def\Esmalllisp{\nonfillfinish\endgroup}%
3852 \def\Esmallexample{\nonfillfinish\endgroup}%
3853 \indexfonts
3854 \lisp
3857 % @display: same as @lisp except keep current font.
3859 \def\display{\begingroup
3860 \nonfillstart
3861 \let\Edisplay = \nonfillfinish
3862 \gobble
3865 % @smalldisplay (when @smallbook): @display plus smaller fonts.
3867 \def\smalldisplayx{\begingroup
3868 \def\Esmalldisplay{\nonfillfinish\endgroup}%
3869 \indexfonts \rm
3870 \display
3873 % @format: same as @display except don't narrow margins.
3875 \def\format{\begingroup
3876 \let\nonarrowing = t
3877 \nonfillstart
3878 \let\Eformat = \nonfillfinish
3879 \gobble
3882 % @smallformat (when @smallbook): @format plus smaller fonts.
3884 \def\smallformatx{\begingroup
3885 \def\Esmallformat{\nonfillfinish\endgroup}%
3886 \indexfonts \rm
3887 \format
3890 % @flushleft (same as @format).
3892 \def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
3894 % @flushright.
3896 \def\flushright{\begingroup
3897 \let\nonarrowing = t
3898 \nonfillstart
3899 \let\Eflushright = \nonfillfinish
3900 \advance\leftskip by 0pt plus 1fill
3901 \gobble
3904 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
3905 % and narrows the margins.
3907 \def\quotation{%
3908 \begingroup\inENV %This group ends at the end of the @quotation body
3909 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
3910 \singlespace
3911 \parindent=0pt
3912 % We have retained a nonzero parskip for the environment, since we're
3913 % doing normal filling. So to avoid extra space below the environment...
3914 \def\Equotation{\parskip = 0pt \nonfillfinish}%
3916 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
3917 \ifx\nonarrowing\relax
3918 \advance\leftskip by \lispnarrowing
3919 \advance\rightskip by \lispnarrowing
3920 \exdentamount = \lispnarrowing
3921 \let\nonarrowing = \relax
3926 \message{defuns,}
3927 % Define formatter for defuns
3928 % First, allow user to change definition object font (\df) internally
3929 \def\setdeffont #1 {\csname DEF#1\endcsname}
3931 \newskip\defbodyindent \defbodyindent=.4in
3932 \newskip\defargsindent \defargsindent=50pt
3933 \newskip\deftypemargin \deftypemargin=12pt
3934 \newskip\deflastargmargin \deflastargmargin=18pt
3936 \newcount\parencount
3937 % define \functionparens, which makes ( and ) and & do special things.
3938 % \functionparens affects the group it is contained in.
3939 \def\activeparens{%
3940 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
3941 \catcode`\[=\active \catcode`\]=\active}
3943 % Make control sequences which act like normal parenthesis chars.
3944 \let\lparen = ( \let\rparen = )
3946 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
3948 % Be sure that we always have a definition for `(', etc. For example,
3949 % if the fn name has parens in it, \boldbrax will not be in effect yet,
3950 % so TeX would otherwise complain about undefined control sequence.
3951 \global\let(=\lparen \global\let)=\rparen
3952 \global\let[=\lbrack \global\let]=\rbrack
3954 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
3955 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
3956 % This is used to turn on special parens
3957 % but make & act ordinary (given that it's active).
3958 \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
3960 % Definitions of (, ) and & used in args for functions.
3961 % This is the definition of ( outside of all parentheses.
3962 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
3963 \global\advance\parencount by 1
3966 % This is the definition of ( when already inside a level of parens.
3967 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
3969 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
3970 % also in that case restore the outer-level definition of (.
3971 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
3972 \global\advance \parencount by -1 }
3973 % If we encounter &foo, then turn on ()-hacking afterwards
3974 \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
3976 \gdef\normalparens{\boldbrax\let&=\ampnr}
3977 } % End of definition inside \activeparens
3978 %% These parens (in \boldbrax) actually are a little bolder than the
3979 %% contained text. This is especially needed for [ and ]
3980 \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
3981 \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
3982 \def\ampnr{\&}
3983 \def\lbrb{{\bf\char`\[}}
3984 \def\rbrb{{\bf\char`\]}}
3986 % First, defname, which formats the header line itself.
3987 % #1 should be the function name.
3988 % #2 should be the type of definition, such as "Function".
3990 \def\defname #1#2{%
3991 % Get the values of \leftskip and \rightskip as they were
3992 % outside the @def...
3993 \dimen2=\leftskip
3994 \advance\dimen2 by -\defbodyindent
3995 \noindent
3996 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
3997 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
3998 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
3999 \parshape 2 0in \dimen0 \defargsindent \dimen1
4000 % Now output arg 2 ("Function" or some such)
4001 % ending at \deftypemargin from the right margin,
4002 % but stuck inside a box of width 0 so it does not interfere with linebreaking
4003 {% Adjust \hsize to exclude the ambient margins,
4004 % so that \rightline will obey them.
4005 \advance \hsize by -\dimen2
4006 \rlap{\rightline{{\rm #2}\hskip -1.25pc }}}%
4007 % Make all lines underfull and no complaints:
4008 \tolerance=10000 \hbadness=10000
4009 \advance\leftskip by -\defbodyindent
4010 \exdentamount=\defbodyindent
4011 {\df #1}\enskip % Generate function name
4014 % Actually process the body of a definition
4015 % #1 should be the terminating control sequence, such as \Edefun.
4016 % #2 should be the "another name" control sequence, such as \defunx.
4017 % #3 should be the control sequence that actually processes the header,
4018 % such as \defunheader.
4020 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4021 \medbreak %
4022 % Define the end token that this defining construct specifies
4023 % so that it will exit this group.
4024 \def#1{\endgraf\endgroup\medbreak}%
4025 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
4026 \parindent=0in
4027 \advance\leftskip by \defbodyindent
4028 \exdentamount=\defbodyindent
4029 \begingroup %
4030 \catcode 61=\active % 61 is `='
4031 \obeylines\activeparens\spacesplit#3}
4033 % #1 is the \E... control sequence to end the definition (which we define).
4034 % #2 is the \...x control sequence for consecutive fns (which we define).
4035 % #3 is the control sequence to call to resume processing.
4036 % #4, delimited by the space, is the class name.
4038 \def\defmethparsebody#1#2#3#4 {\begingroup\inENV %
4039 \medbreak %
4040 % Define the end token that this defining construct specifies
4041 % so that it will exit this group.
4042 \def#1{\endgraf\endgroup\medbreak}%
4043 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
4044 \parindent=0in
4045 \advance\leftskip by \defbodyindent
4046 \exdentamount=\defbodyindent
4047 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
4049 % @deftypemethod has an extra argument that nothing else does. Sigh.
4050 % #1 is the \E... control sequence to end the definition (which we define).
4051 % #2 is the \...x control sequence for consecutive fns (which we define).
4052 % #3 is the control sequence to call to resume processing.
4053 % #4, delimited by the space, is the class name.
4054 % #5 is the method's return type.
4056 \def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV %
4057 \medbreak %
4058 % Define the end token that this defining construct specifies
4059 % so that it will exit this group.
4060 \def#1{\endgraf\endgroup\medbreak}%
4061 \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}%
4062 \parindent=0in
4063 \advance\leftskip by \defbodyindent
4064 \exdentamount=\defbodyindent
4065 \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}}
4067 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
4068 \medbreak %
4069 % Define the end token that this defining construct specifies
4070 % so that it will exit this group.
4071 \def#1{\endgraf\endgroup\medbreak}%
4072 \def#2##1 ##2 {\def#4{##1}%
4073 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
4074 \parindent=0in
4075 \advance\leftskip by \defbodyindent
4076 \exdentamount=\defbodyindent
4077 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
4079 % These parsing functions are similar to the preceding ones
4080 % except that they do not make parens into active characters.
4081 % These are used for "variables" since they have no arguments.
4083 \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4084 \medbreak %
4085 % Define the end token that this defining construct specifies
4086 % so that it will exit this group.
4087 \def#1{\endgraf\endgroup\medbreak}%
4088 \def#2{\begingroup\obeylines\spacesplit#3}%
4089 \parindent=0in
4090 \advance\leftskip by \defbodyindent
4091 \exdentamount=\defbodyindent
4092 \begingroup %
4093 \catcode 61=\active %
4094 \obeylines\spacesplit#3}
4096 % This is used for \def{tp,vr}parsebody. It could probably be used for
4097 % some of the others, too, with some judicious conditionals.
4099 \def\parsebodycommon#1#2#3{%
4100 \begingroup\inENV %
4101 \medbreak %
4102 % Define the end token that this defining construct specifies
4103 % so that it will exit this group.
4104 \def#1{\endgraf\endgroup\medbreak}%
4105 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
4106 \parindent=0in
4107 \advance\leftskip by \defbodyindent
4108 \exdentamount=\defbodyindent
4109 \begingroup\obeylines
4112 \def\defvrparsebody#1#2#3#4 {%
4113 \parsebodycommon{#1}{#2}{#3}%
4114 \spacesplit{#3{#4}}%
4117 % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
4118 % type is just `struct', because we lose the braces in `{struct
4119 % termios}' when \spacesplit reads its undelimited argument. Sigh.
4120 % \let\deftpparsebody=\defvrparsebody
4122 % So, to get around this, we put \empty in with the type name. That
4123 % way, TeX won't find exactly `{...}' as an undelimited argument, and
4124 % won't strip off the braces.
4126 \def\deftpparsebody #1#2#3#4 {%
4127 \parsebodycommon{#1}{#2}{#3}%
4128 \spacesplit{\parsetpheaderline{#3{#4}}}\empty
4131 % Fine, but then we have to eventually remove the \empty *and* the
4132 % braces (if any). That's what this does.
4134 \def\removeemptybraces\empty#1\relax{#1}
4136 % After \spacesplit has done its work, this is called -- #1 is the final
4137 % thing to call, #2 the type name (which starts with \empty), and #3
4138 % (which might be empty) the arguments.
4140 \def\parsetpheaderline#1#2#3{%
4141 #1{\removeemptybraces#2\relax}{#3}%
4144 \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
4145 \medbreak %
4146 % Define the end token that this defining construct specifies
4147 % so that it will exit this group.
4148 \def#1{\endgraf\endgroup\medbreak}%
4149 \def#2##1 ##2 {\def#4{##1}%
4150 \begingroup\obeylines\spacesplit{#3{##2}}}%
4151 \parindent=0in
4152 \advance\leftskip by \defbodyindent
4153 \exdentamount=\defbodyindent
4154 \begingroup\obeylines\spacesplit{#3{#5}}}
4156 % Split up #2 at the first space token.
4157 % call #1 with two arguments:
4158 % the first is all of #2 before the space token,
4159 % the second is all of #2 after that space token.
4160 % If #2 contains no space token, all of it is passed as the first arg
4161 % and the second is passed as empty.
4163 {\obeylines
4164 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
4165 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
4166 \ifx\relax #3%
4167 #1{#2}{}\else #1{#2}{#3#4}\fi}}
4169 % So much for the things common to all kinds of definitions.
4171 % Define @defun.
4173 % First, define the processing that is wanted for arguments of \defun
4174 % Use this to expand the args and terminate the paragraph they make up
4176 \def\defunargs #1{\functionparens \sl
4177 % Expand, preventing hyphenation at `-' chars.
4178 % Note that groups don't affect changes in \hyphenchar.
4179 \hyphenchar\tensl=0
4181 \hyphenchar\tensl=45
4182 \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
4183 \interlinepenalty=10000
4184 \advance\rightskip by 0pt plus 1fil
4185 \endgraf\nobreak\vskip -\parskip\nobreak
4188 \def\deftypefunargs #1{%
4189 % Expand, preventing hyphenation at `-' chars.
4190 % Note that groups don't affect changes in \hyphenchar.
4191 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
4192 \boldbraxnoamp
4193 \tclose{#1}% avoid \code because of side effects on active chars
4194 \interlinepenalty=10000
4195 \advance\rightskip by 0pt plus 1fil
4196 \endgraf\nobreak\vskip -\parskip\nobreak
4199 % Do complete processing of one @defun or @defunx line already parsed.
4201 % @deffn Command forward-char nchars
4203 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
4205 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
4206 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
4207 \catcode 61=\other % Turn off change made in \defparsebody
4210 % @defun == @deffn Function
4212 \def\defun{\defparsebody\Edefun\defunx\defunheader}
4214 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4215 \begingroup\defname {#1}{Function}%
4216 \defunargs {#2}\endgroup %
4217 \catcode 61=\other % Turn off change made in \defparsebody
4220 % @deftypefun int foobar (int @var{foo}, float @var{bar})
4222 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
4224 % #1 is the data type. #2 is the name and args.
4225 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
4226 % #1 is the data type, #2 the name, #3 the args.
4227 \def\deftypefunheaderx #1#2 #3\relax{%
4228 \doind {fn}{\code{#2}}% Make entry in function index
4229 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
4230 \deftypefunargs {#3}\endgroup %
4231 \catcode 61=\other % Turn off change made in \defparsebody
4234 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
4236 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
4238 % \defheaderxcond#1\relax$$$
4239 % puts #1 in @code, followed by a space, but does nothing if #1 is null.
4240 \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
4242 % #1 is the classification. #2 is the data type. #3 is the name and args.
4243 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
4244 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
4245 \def\deftypefnheaderx #1#2#3 #4\relax{%
4246 \doind {fn}{\code{#3}}% Make entry in function index
4247 \begingroup
4248 \normalparens % notably, turn off `&' magic, which prevents
4249 % at least some C++ text from working
4250 \defname {\defheaderxcond#2\relax$$$#3}{#1}%
4251 \deftypefunargs {#4}\endgroup %
4252 \catcode 61=\other % Turn off change made in \defparsebody
4255 % @defmac == @deffn Macro
4257 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
4259 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4260 \begingroup\defname {#1}{Macro}%
4261 \defunargs {#2}\endgroup %
4262 \catcode 61=\other % Turn off change made in \defparsebody
4265 % @defspec == @deffn Special Form
4267 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
4269 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4270 \begingroup\defname {#1}{Special Form}%
4271 \defunargs {#2}\endgroup %
4272 \catcode 61=\other % Turn off change made in \defparsebody
4275 % This definition is run if you use @defunx
4276 % anywhere other than immediately after a @defun or @defunx.
4278 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
4279 \def\defunx #1 {\errmessage{@defunx in invalid context}}
4280 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
4281 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
4282 \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
4283 \def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}}
4284 \def\deftypefunx #1 {\errmessage{@deftypefunx in invalid context}}
4286 % @defmethod, and so on
4288 % @defop CATEGORY CLASS OPERATION ARG...
4290 \def\defop #1 {\def\defoptype{#1}%
4291 \defopparsebody\Edefop\defopx\defopheader\defoptype}
4293 \def\defopheader #1#2#3{%
4294 \dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index
4295 \begingroup\defname {#2}{\defoptype{} on #1}%
4296 \defunargs {#3}\endgroup %
4299 % @deftypemethod CLASS RETURN-TYPE METHOD ARG...
4301 \def\deftypemethod{%
4302 \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
4304 % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
4305 \def\deftypemethodheader#1#2#3#4{%
4306 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
4307 \begingroup
4308 \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}%
4309 \deftypefunargs{#4}%
4310 \endgroup
4313 % @defmethod == @defop Method
4315 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
4317 % #1 is the class name, #2 the method name, #3 the args.
4318 \def\defmethodheader#1#2#3{%
4319 \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
4320 \begingroup
4321 \defname{#2}{\putwordMethodon\ \code{#1}}%
4322 \defunargs{#3}%
4323 \endgroup
4326 % @defcv {Class Option} foo-class foo-flag
4328 \def\defcv #1 {\def\defcvtype{#1}%
4329 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
4331 \def\defcvarheader #1#2#3{%
4332 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4333 \begingroup\defname {#2}{\defcvtype{} of #1}%
4334 \defvarargs {#3}\endgroup %
4337 % @defivar == @defcv {Instance Variable}
4339 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
4341 \def\defivarheader #1#2#3{%
4342 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4343 \begingroup\defname {#2}{Instance Variable of #1}%
4344 \defvarargs {#3}\endgroup %
4347 % These definitions are run if you use @defmethodx, etc.,
4348 % anywhere other than immediately after a @defmethod, etc.
4350 \def\defopx #1 {\errmessage{@defopx in invalid context}}
4351 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
4352 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
4353 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
4355 % Now @defvar
4357 % First, define the processing that is wanted for arguments of @defvar.
4358 % This is actually simple: just print them in roman.
4359 % This must expand the args and terminate the paragraph they make up
4360 \def\defvarargs #1{\normalparens #1%
4361 \interlinepenalty=10000
4362 \endgraf\nobreak\vskip -\parskip\nobreak}
4364 % @defvr Counter foo-count
4366 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
4368 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
4369 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
4371 % @defvar == @defvr Variable
4373 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
4375 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4376 \begingroup\defname {#1}{Variable}%
4377 \defvarargs {#2}\endgroup %
4380 % @defopt == @defvr {User Option}
4382 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
4384 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4385 \begingroup\defname {#1}{User Option}%
4386 \defvarargs {#2}\endgroup %
4389 % @deftypevar int foobar
4391 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
4393 % #1 is the data type. #2 is the name, perhaps followed by text that
4394 % is actually part of the data type, which should not be put into the index.
4395 \def\deftypevarheader #1#2{%
4396 \dovarind#2 \relax% Make entry in variables index
4397 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
4398 \interlinepenalty=10000
4399 \endgraf\nobreak\vskip -\parskip\nobreak
4400 \endgroup}
4401 \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
4403 % @deftypevr {Global Flag} int enable
4405 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
4407 \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
4408 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
4409 \interlinepenalty=10000
4410 \endgraf\nobreak\vskip -\parskip\nobreak
4411 \endgroup}
4413 % This definition is run if you use @defvarx
4414 % anywhere other than immediately after a @defvar or @defvarx.
4416 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
4417 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
4418 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
4419 \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
4420 \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
4422 % Now define @deftp
4423 % Args are printed in bold, a slight difference from @defvar.
4425 \def\deftpargs #1{\bf \defvarargs{#1}}
4427 % @deftp Class window height width ...
4429 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
4431 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4432 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4434 % This definition is run if you use @deftpx, etc
4435 % anywhere other than immediately after a @deftp, etc.
4437 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
4440 \message{macros,}
4441 % @macro.
4443 % To do this right we need a feature of e-TeX, \scantokens,
4444 % which we arrange to emulate with a temporary file in ordinary TeX.
4445 \ifx\eTeXversion\undefined
4446 \newwrite\macscribble
4447 \def\scanmacro#1{%
4448 \begingroup \newlinechar`\^^M
4449 \immediate\openout\macscribble=\jobname.tmp
4450 \immediate\write\macscribble{#1}%
4451 \immediate\closeout\macscribble
4452 \let\xeatspaces\eatspaces
4453 \input \jobname.tmp
4454 \endgroup
4456 \else
4457 \def\scanmacro#1{%
4458 \begingroup \newlinechar`\^^M
4459 \let\xeatspaces\eatspaces\scantokens{#1}\endgroup}
4462 \newcount\paramno % Count of parameters
4463 \newtoks\macname % Macro name
4464 \newif\ifrecursive % Is it recursive?
4466 % Utility routines.
4467 % Thisdoes \let #1 = #2, except with \csnames.
4468 \def\cslet#1#2{%
4469 \expandafter\expandafter
4470 \expandafter\let
4471 \expandafter\expandafter
4472 \csname#1\endcsname
4473 \csname#2\endcsname}
4475 % Trim leading and trailing spaces off a string.
4476 % Concepts from aro-bend problem 15 (see CTAN).
4477 {\catcode`\@=11
4478 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
4479 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
4480 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
4481 \def\unbrace#1{#1}
4482 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
4485 % Trim a single trailing ^^M off a string.
4486 {\catcode`\^^M=12\catcode`\Q=3%
4487 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
4488 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
4489 \gdef\eatcrb#1Q#2Q{#1}%
4492 % Macro bodies are absorbed as an argument in a context where
4493 % all characters are catcode 10, 11 or 12, except \ which is active
4494 % (as in normal texinfo). It is necessary to change the definition of \.
4496 % It's necessary to have hard CRs when the macro is executed. This is
4497 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
4498 % body, and then making it the \newlinechar in \scanmacro.
4500 \def\macrobodyctxt{%
4501 \catcode`\~=12
4502 \catcode`\^=12
4503 \catcode`\_=12
4504 \catcode`\|=12
4505 \catcode`\<=12
4506 \catcode`\>=12
4507 \catcode`\+=12
4508 \catcode`\{=12
4509 \catcode`\}=12
4510 \catcode`\@=12
4511 \catcode`\^^M=12
4512 \usembodybackslash}
4514 \def\macroargctxt{%
4515 \catcode`\~=12
4516 \catcode`\^=12
4517 \catcode`\_=12
4518 \catcode`\|=12
4519 \catcode`\<=12
4520 \catcode`\>=12
4521 \catcode`\+=12
4522 \catcode`\@=12
4523 \catcode`\\=12}
4525 % \mbodybackslash is the definition of \ in @macro bodies.
4526 % It maps \foo\ => \csname macarg.foo\endcsname => #N
4527 % where N is the macro parameter number.
4528 % We define \csname macarg.\endcsname to be \realbackslash, so
4529 % \\ in macro replacement text gets you a backslash.
4531 {\catcode`@=0 @catcode`@\=@active
4532 @gdef@usembodybackslash{@let\=@mbodybackslash}
4533 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
4535 \expandafter\def\csname macarg.\endcsname{\realbackslash}
4537 \def\macro{\recursivefalse\parsearg\macroxxx}
4538 \def\rmacro{\recursivetrue\parsearg\macroxxx}
4540 \def\macroxxx#1{%
4541 \getargs{#1}% now \macname is the macname and \argl the arglist
4542 \ifx\argl\empty % no arguments
4543 \paramno=0%
4544 \else
4545 \expandafter\parsemargdef \argl;%
4547 \expandafter\ifx \csname macsave.\the\macname\endcsname \relax
4548 \cslet{macsave.\the\macname}{\the\macname}%
4549 \else
4550 \message{Warning: redefining \the\macname}%
4552 \begingroup \macrobodyctxt
4553 \ifrecursive \expandafter\parsermacbody
4554 \else \expandafter\parsemacbody
4555 \fi}
4557 \def\unmacro{\parsearg\unmacroxxx}
4558 \def\unmacroxxx#1{%
4559 \expandafter\ifx \csname macsave.\the\macname\endcsname \relax
4560 \errmessage{Macro \the\macname\ not defined.}%
4561 \else
4562 \cslet{#1}{macsave.#1}%
4563 \expandafter\let \csname macsave.\the\macname\endcsname \undefined
4567 % This makes use of the obscure feature that if the last token of a
4568 % <parameter list> is #, then the preceding argument is delimited by
4569 % an opening brace, and that opening brace is not consumed.
4570 \def\getargs#1{\getargsxxx#1{}}
4571 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
4572 \def\getmacname #1 #2\relax{\macname={#1}}
4573 \def\getmacargs#1{\def\argl{#1}}
4575 % Parse the optional {params} list. Set up \paramno and \paramlist
4576 % so \defmacro knows what to do. Define \macarg.blah for each blah
4577 % in the params list, to be ##N where N is the position in that list.
4578 % That gets used by \mbodybackslash (above).
4580 % We need to get `macro parameter char #' into several definitions.
4581 % The technique used is stolen from LaTeX: let \hash be something
4582 % unexpandable, insert that wherever you need a #, and then redefine
4583 % it to # just before using the token list produced.
4585 % The same technique is used to protect \eatspaces till just before
4586 % the macro is used.
4588 \def\parsemargdef#1;{\paramno=0\def\paramlist{}%
4589 \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
4590 \def\parsemargdefxxx#1,{%
4591 \if#1;\let\next=\relax
4592 \else \let\next=\parsemargdefxxx
4593 \advance\paramno by 1%
4594 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
4595 {\xeatspaces{\hash\the\paramno}}%
4596 \edef\paramlist{\paramlist\hash\the\paramno,}%
4597 \fi\next}
4599 % These two commands read recursive and nonrecursive macro bodies.
4600 % (They're different since rec and nonrec macros end differently.)
4602 \long\def\parsemacbody#1@end macro%
4603 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
4604 \long\def\parsermacbody#1@end rmacro%
4605 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
4607 % This defines the macro itself. There are six cases: recursive and
4608 % nonrecursive macros of zero, one, and many arguments.
4609 % Much magic with \expandafter here.
4610 % \xdef is used so that macro definitions will survive the file
4611 % they're defined in; @include reads the file inside a group.
4612 \def\defmacro{%
4613 \let\hash=##% convert placeholders to macro parameter chars
4614 \ifrecursive
4615 \ifcase\paramno
4617 \expandafter\xdef\csname\the\macname\endcsname{%
4618 \noexpand\scanmacro{\temp}}%
4619 \or % 1
4620 \expandafter\xdef\csname\the\macname\endcsname{%
4621 \bgroup\noexpand\macroargctxt
4622 \noexpand\braceorline\csname\the\macname xxx\endcsname}%
4623 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
4624 \egroup\noexpand\scanmacro{\temp}}%
4625 \else % many
4626 \expandafter\xdef\csname\the\macname\endcsname{%
4627 \bgroup\noexpand\macroargctxt
4628 \noexpand\csname\the\macname xx\endcsname}
4629 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
4630 \csname\the\macname xxx\endcsname ##1,}%
4631 \expandafter\expandafter
4632 \expandafter\xdef
4633 \expandafter\expandafter
4634 \csname\the\macname xxx\endcsname
4635 \paramlist{\egroup\noexpand\scanmacro{\temp}}%
4637 \else
4638 \ifcase\paramno
4640 \expandafter\xdef\csname\the\macname\endcsname{%
4641 \noexpand\norecurse{\the\macname}%
4642 \noexpand\scanmacro{\temp}\egroup}%
4643 \or % 1
4644 \expandafter\xdef\csname\the\macname\endcsname{%
4645 \bgroup\noexpand\macroargctxt
4646 \noexpand\braceorline\csname\the\macname xxx\endcsname}%
4647 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
4648 \egroup
4649 \noexpand\norecurse{\the\macname}%
4650 \noexpand\scanmacro{\temp}\egroup}%
4651 \else % many
4652 \expandafter\xdef\csname\the\macname\endcsname{%
4653 \bgroup\noexpand\macroargctxt
4654 \noexpand\csname\the\macname xx\endcsname}
4655 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
4656 \csname\the\macname xxx\endcsname ##1,}%
4657 \expandafter\expandafter
4658 \expandafter\xdef
4659 \expandafter\expandafter
4660 \csname\the\macname xxx\endcsname
4661 \paramlist{%
4662 \egroup
4663 \noexpand\norecurse{\the\macname}%
4664 \noexpand\scanmacro{\temp}\egroup}%
4666 \fi}
4668 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
4670 % \braceorline decides whether the next nonwhitespace character is a
4671 % {. If so it reads up to the closing }, if not, it reads the whole
4672 % line. Whatever was read is then fed to the next control sequence
4673 % as an argument (by \parsebrace or \parsearg)
4674 \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
4675 \def\braceorlinexxx{%
4676 \ifx\nchar\bgroup\else
4677 \expandafter\parsearg
4678 \fi \next}
4681 \message{cross references,}
4682 \newwrite\auxfile
4684 \newif\ifhavexrefs % True if xref values are known.
4685 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
4687 % @inforef is relatively simple.
4688 \def\inforef #1{\inforefzzz #1,,,,**}
4689 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
4690 node \samp{\ignorespaces#1{}}}
4692 % @node's job is to define \lastnode.
4693 \def\node{\ENVcheck\parsearg\nodezzz}
4694 \def\nodezzz#1{\nodexxx [#1,]}
4695 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
4696 \let\nwnode=\node
4697 \let\lastnode=\relax
4699 % The sectioning commands (@chapter, etc.) call these.
4700 \def\donoderef{%
4701 \ifx\lastnode\relax\else
4702 \expandafter\expandafter\expandafter\setref{\lastnode}%
4703 {Ysectionnumberandtype}%
4704 \global\let\lastnode=\relax
4707 \def\unnumbnoderef{%
4708 \ifx\lastnode\relax\else
4709 \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
4710 \global\let\lastnode=\relax
4713 \def\appendixnoderef{%
4714 \ifx\lastnode\relax\else
4715 \expandafter\expandafter\expandafter\setref{\lastnode}%
4716 {Yappendixletterandtype}%
4717 \global\let\lastnode=\relax
4722 % @anchor{NAME} -- define xref target at arbitrary point.
4724 \def\anchor#1{\setref{#1}{Ynothing}}
4727 % \setref{NAME}{SNT} defines a cross-reference point NAME, namely
4728 % NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have
4729 % to set \indexdummies so commands such as @code in a section title
4730 % aren't expanded. It would be nicer not to expand the titles in the
4731 % first place, but there's so many layers that that is hard to do.
4733 \def\setref#1#2{{%
4734 \indexdummies
4735 \dosetq{#1-title}{Ytitle}%
4736 \dosetq{#1-pg}{Ypagenumber}%
4737 \dosetq{#1-snt}{#2}
4740 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
4741 % the node name, #2 the name of the Info cross-reference, #3 the printed
4742 % node name, #4 the name of the Info file, #5 the name of the printed
4743 % manual. All but the node name can be omitted.
4745 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
4746 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
4747 \def\ref#1{\xrefX[#1,,,,,,,]}
4748 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
4749 \def\printedmanual{\ignorespaces #5}%
4750 \def\printednodename{\ignorespaces #3}%
4751 \setbox1=\hbox{\printedmanual}%
4752 \setbox0=\hbox{\printednodename}%
4753 \ifdim \wd0 = 0pt
4754 % No printed node name was explicitly given.
4755 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
4756 % Use the node name inside the square brackets.
4757 \def\printednodename{\ignorespaces #1}%
4758 \else
4759 % Use the actual chapter/section title appear inside
4760 % the square brackets. Use the real section title if we have it.
4761 \ifdim \wd1 > 0pt
4762 % It is in another manual, so we don't have it.
4763 \def\printednodename{\ignorespaces #1}%
4764 \else
4765 \ifhavexrefs
4766 % We know the real title if we have the xref values.
4767 \def\printednodename{\refx{#1-title}{}}%
4768 \else
4769 % Otherwise just copy the Info node name.
4770 \def\printednodename{\ignorespaces #1}%
4771 \fi%
4776 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
4777 % insert empty discretionaries after hyphens, which means that it will
4778 % not find a line break at a hyphen in a node names. Since some manuals
4779 % are best written with fairly long node names, containing hyphens, this
4780 % is a loss. Therefore, we give the text of the node name again, so it
4781 % is as if TeX is seeing it for the first time.
4782 \ifdim \wd1 > 0pt
4783 \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
4784 \else
4785 % _ (for example) has to be the character _ for the purposes of the
4786 % control sequence corresponding to the node, but it has to expand
4787 % into the usual \leavevmode...\vrule stuff for purposes of
4788 % printing. So we \turnoffactive for the \refx-snt, back on for the
4789 % printing, back off for the \refx-pg.
4790 {\normalturnoffactive
4791 % Only output a following space if the -snt ref is nonempty; for
4792 % @unnumbered and @anchor, it won't be.
4793 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
4794 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
4796 % [mynode],
4797 [\printednodename],\space
4798 % page 3
4799 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
4801 \endgroup}
4803 % \dosetq is the interface for calls from other macros
4805 % Use \normalturnoffactive so that punctuation chars such as underscore
4806 % and backslash work in node names. (\turnoffactive doesn't do \.)
4807 \def\dosetq#1#2{%
4808 {\let\folio=0
4809 \normalturnoffactive
4810 \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
4811 \iflinks
4812 \next
4817 % \internalsetq {foo}{page} expands into
4818 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
4819 % When the aux file is read, ' is the escape character
4821 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
4823 % Things to be expanded by \internalsetq
4825 \def\Ypagenumber{\folio}
4827 \def\Ytitle{\thissection}
4829 \def\Ynothing{}
4831 \def\Ysectionnumberandtype{%
4832 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
4833 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
4834 \else \ifnum \subsubsecno=0 %
4835 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
4836 \else %
4837 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
4838 \fi \fi \fi }
4840 \def\Yappendixletterandtype{%
4841 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
4842 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
4843 \else \ifnum \subsubsecno=0 %
4844 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
4845 \else %
4846 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
4847 \fi \fi \fi }
4849 \gdef\xreftie{'tie}
4851 % Use TeX 3.0's \inputlineno to get the line number, for better error
4852 % messages, but if we're using an old version of TeX, don't do anything.
4854 \ifx\inputlineno\thisisundefined
4855 \let\linenumber = \empty % Non-3.0.
4856 \else
4857 \def\linenumber{\the\inputlineno:\space}
4860 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
4861 % If its value is nonempty, SUFFIX is output afterward.
4863 \def\refx#1#2{%
4864 \expandafter\ifx\csname X#1\endcsname\relax
4865 % If not defined, say something at least.
4866 \angleleft un\-de\-fined\angleright
4867 \iflinks
4868 \ifhavexrefs
4869 \message{\linenumber Undefined cross reference `#1'.}%
4870 \else
4871 \ifwarnedxrefs\else
4872 \global\warnedxrefstrue
4873 \message{Cross reference values unknown; you must run TeX again.}%
4877 \else
4878 % It's defined, so just use it.
4879 \csname X#1\endcsname
4881 #2% Output the suffix in any case.
4884 % This is the macro invoked by entries in the aux file.
4886 \def\xrdef#1{\begingroup
4887 % Reenable \ as an escape while reading the second argument.
4888 \catcode`\\ = 0
4889 \afterassignment\endgroup
4890 \expandafter\gdef\csname X#1\endcsname
4893 % Read the last existing aux file, if any. No error if none exists.
4894 \def\readauxfile{\begingroup
4895 \catcode`\^^@=\other
4896 \catcode`\^^A=\other
4897 \catcode`\^^B=\other
4898 \catcode`\^^C=\other
4899 \catcode`\^^D=\other
4900 \catcode`\^^E=\other
4901 \catcode`\^^F=\other
4902 \catcode`\^^G=\other
4903 \catcode`\^^H=\other
4904 \catcode`\^^K=\other
4905 \catcode`\^^L=\other
4906 \catcode`\^^N=\other
4907 \catcode`\^^P=\other
4908 \catcode`\^^Q=\other
4909 \catcode`\^^R=\other
4910 \catcode`\^^S=\other
4911 \catcode`\^^T=\other
4912 \catcode`\^^U=\other
4913 \catcode`\^^V=\other
4914 \catcode`\^^W=\other
4915 \catcode`\^^X=\other
4916 \catcode`\^^Z=\other
4917 \catcode`\^^[=\other
4918 \catcode`\^^\=\other
4919 \catcode`\^^]=\other
4920 \catcode`\^^^=\other
4921 \catcode`\^^_=\other
4922 \catcode`\@=\other
4923 \catcode`\^=\other
4924 % It was suggested to define this as 7, which would allow ^^e4 etc.
4925 % in xref tags, i.e., node names. But since ^^e4 notation isn't
4926 % supported in the main text, it doesn't seem desirable. Furthermore,
4927 % that is not enough: for node names that actually contain a ^
4928 % character, we would end up writing a line like this: 'xrdef {'hat
4929 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
4930 % argument, and \hat is not an expandable control sequence. It could
4931 % all be worked out, but why? Either we support ^^ or we don't.
4933 % The other change necessary for this was to define \auxhat:
4934 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
4935 % and then to call \auxhat in \setq.
4937 \catcode`\~=\other
4938 \catcode`\[=\other
4939 \catcode`\]=\other
4940 \catcode`\"=\other
4941 \catcode`\_=\other
4942 \catcode`\|=\other
4943 \catcode`\<=\other
4944 \catcode`\>=\other
4945 \catcode`\$=\other
4946 \catcode`\#=\other
4947 \catcode`\&=\other
4948 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
4949 % Make the characters 128-255 be printing characters
4951 \count 1=128
4952 \def\loop{%
4953 \catcode\count 1=\other
4954 \advance\count 1 by 1
4955 \ifnum \count 1<256 \loop \fi
4958 % The aux file uses ' as the escape (for now).
4959 % Turn off \ as an escape so we do not lose on
4960 % entries which were dumped with control sequences in their names.
4961 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
4962 % Reference to such entries still does not work the way one would wish,
4963 % but at least they do not bomb out when the aux file is read in.
4964 \catcode`\{=1
4965 \catcode`\}=2
4966 \catcode`\%=\other
4967 \catcode`\'=0
4968 \catcode`\\=\other
4970 \openin 1 \jobname.aux
4971 \ifeof 1 \else
4972 \closein 1
4973 \input \jobname.aux
4974 \global\havexrefstrue
4975 \global\warnedobstrue
4977 % Open the new aux file. TeX will close it automatically at exit.
4978 \openout\auxfile=\jobname.aux
4979 \endgroup}
4982 % Footnotes.
4984 \newcount \footnoteno
4986 % The trailing space in the following definition for supereject is
4987 % vital for proper filling; pages come out unaligned when you do a
4988 % pagealignmacro call if that space before the closing brace is
4989 % removed. (Generally, numeric constants should always be followed by a
4990 % space to prevent strange expansion errors.)
4991 \def\supereject{\par\penalty -20000\footnoteno =0 }
4993 % @footnotestyle is meaningful for info output only.
4994 \let\footnotestyle=\comment
4996 \let\ptexfootnote=\footnote
4998 {\catcode `\@=11
5000 % Auto-number footnotes. Otherwise like plain.
5001 \gdef\footnote{%
5002 \global\advance\footnoteno by \@ne
5003 \edef\thisfootno{$^{\the\footnoteno}$}%
5005 % In case the footnote comes at the end of a sentence, preserve the
5006 % extra spacing after we do the footnote number.
5007 \let\@sf\empty
5008 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
5010 % Remove inadvertent blank space before typesetting the footnote number.
5011 \unskip
5012 \thisfootno\@sf
5013 \footnotezzz
5016 % Don't bother with the trickery in plain.tex to not require the
5017 % footnote text as a parameter. Our footnotes don't need to be so general.
5019 % Oh yes, they do; otherwise, @ifset and anything else that uses
5020 % \parseargline fail inside footnotes because the tokens are fixed when
5021 % the footnote is read. --karl, 16nov96.
5023 \long\gdef\footnotezzz{\insert\footins\bgroup
5024 % We want to typeset this text as a normal paragraph, even if the
5025 % footnote reference occurs in (for example) a display environment.
5026 % So reset some parameters.
5027 \interlinepenalty\interfootnotelinepenalty
5028 \splittopskip\ht\strutbox % top baseline for broken footnotes
5029 \splitmaxdepth\dp\strutbox
5030 \floatingpenalty\@MM
5031 \leftskip\z@skip
5032 \rightskip\z@skip
5033 \spaceskip\z@skip
5034 \xspaceskip\z@skip
5035 \parindent\defaultparindent
5037 % Hang the footnote text off the number.
5038 \hang
5039 \textindent{\thisfootno}%
5041 % Don't crash into the line above the footnote text. Since this
5042 % expands into a box, it must come within the paragraph, lest it
5043 % provide a place where TeX can split the footnote.
5044 \footstrut
5045 \futurelet\next\fo@t
5047 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
5048 \else\let\next\f@t\fi \next}
5049 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
5050 \def\f@t#1{#1\@foot}
5051 \def\@foot{\strut\egroup}
5053 }%end \catcode `\@=11
5055 % Set the baselineskip to #1, and the lineskip and strut size
5056 % correspondingly. There is no deep meaning behind these magic numbers
5057 % used as factors; they just match (closely enough) what Knuth defined.
5059 \def\lineskipfactor{.08333}
5060 \def\strutheightpercent{.70833}
5061 \def\strutdepthpercent {.29167}
5063 \def\setleading#1{%
5064 \normalbaselineskip = #1\relax
5065 \normallineskip = \lineskipfactor\normalbaselineskip
5066 \normalbaselines
5067 \setbox\strutbox =\hbox{%
5068 \vrule width0pt height\strutheightpercent\baselineskip
5069 depth \strutdepthpercent \baselineskip
5073 % @| inserts a changebar to the left of the current line. It should
5074 % surround any changed text. This approach does *not* work if the
5075 % change spans more than two lines of output. To handle that, we would
5076 % have adopt a much more difficult approach (putting marks into the main
5077 % vertical list for the beginning and end of each change).
5079 \def\|{%
5080 % \vadjust can only be used in horizontal mode.
5081 \leavevmode
5083 % Append this vertical mode material after the current line in the output.
5084 \vadjust{%
5085 % We want to insert a rule with the height and depth of the current
5086 % leading; that is exactly what \strutbox is supposed to record.
5087 \vskip-\baselineskip
5089 % \vadjust-items are inserted at the left edge of the type. So
5090 % the \llap here moves out into the left-hand margin.
5091 \llap{%
5093 % For a thicker or thinner bar, change the `1pt'.
5094 \vrule height\baselineskip width1pt
5096 % This is the space between the bar and the text.
5097 \hskip 12pt
5102 % For a final copy, take out the rectangles
5103 % that mark overfull boxes (in case you have decided
5104 % that the text looks ok even though it passes the margin).
5106 \def\finalout{\overfullrule=0pt}
5108 % @image. We use the macros from epsf.tex to support this.
5109 % If epsf.tex is not installed and @image is used, we complain.
5111 % Check for and read epsf.tex up front. If we read it only at @image
5112 % time, we might be inside a group, and then its definitions would get
5113 % undone and the next image would fail.
5114 \openin 1 = epsf.tex
5115 \ifeof 1 \else
5116 \closein 1
5117 % Do not bother showing banner with post-v2.7 epsf.tex (available in
5118 % doc/epsf.tex until it shows up on ctan).
5119 \def\epsfannounce{\toks0 = }%
5120 \input epsf.tex
5123 \newif\ifwarnednoepsf
5124 \newhelp\noepsfhelp{epsf.tex must be installed for images to
5125 work. It is also included in the Texinfo distribution, or you can get
5126 it from ftp://ftp.tug.org/tex/epsf.tex.}
5128 % Only complain once about lack of epsf.tex.
5129 \def\image#1{%
5130 \ifx\epsfbox\undefined
5131 \ifwarnednoepsf \else
5132 \errhelp = \noepsfhelp
5133 \errmessage{epsf.tex not found, images will be ignored}%
5134 \global\warnednoepsftrue
5136 \else
5137 \imagexxx #1,,,\finish
5141 % Arguments to @image:
5142 % #1 is (mandatory) image filename; we tack on .eps extension.
5143 % #2 is (optional) width, #3 is (optional) height.
5144 % #4 is just the usual extra ignored arg for parsing this stuff.
5145 \def\imagexxx#1,#2,#3,#4\finish{%
5146 % \epsfbox itself resets \epsf?size at each figure.
5147 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
5148 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
5149 % If the image is by itself, center it.
5150 \ifvmode
5151 \nobreak\medskip
5152 \nobreak
5153 \centerline{\epsfbox{#1.eps}}%
5154 \bigbreak
5155 \else
5156 \epsfbox{#1.eps}%
5161 \message{paper sizes,}
5162 % And other related parameters.
5164 \newdimen\defaultparindent \defaultparindent = 15pt
5166 \chapheadingskip = 15pt plus 4pt minus 2pt
5167 \secheadingskip = 12pt plus 3pt minus 2pt
5168 \subsecheadingskip = 9pt plus 2pt minus 2pt
5170 % Prevent underfull vbox error messages.
5171 \vbadness = 10000
5173 % Don't be so finicky about underfull hboxes, either.
5174 \hbadness = 2000
5176 % Following George Bush, just get rid of widows and orphans.
5177 \widowpenalty=10000
5178 \clubpenalty=10000
5180 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
5181 % using an old version of TeX, don't do anything. We want the amount of
5182 % stretch added to depend on the line length, hence the dependence on
5183 % \hsize. This makes it come to about 9pt for the 8.5x11 format. We
5184 % call this whenever the paper size is set.
5186 \def\setemergencystretch{%
5187 \ifx\emergencystretch\thisisundefined
5188 % Allow us to assign to \emergencystretch anyway.
5189 \def\emergencystretch{\dimen0}%
5190 \else
5191 \emergencystretch = \hsize
5192 \divide\emergencystretch by 45
5196 % Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
5197 % 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can
5198 % set \parskip and call \setleading for \baselineskip.
5200 \def\internalpagesizes#1#2#3#4#5#6{%
5201 \voffset = #3\relax
5202 \topskip = #6\relax
5203 \splittopskip = \topskip
5205 \vsize = #1\relax
5206 \advance\vsize by \topskip
5207 \outervsize = \vsize
5208 \advance\outervsize by 0.6in
5209 \pageheight = \vsize
5211 \hsize = #2\relax
5212 \outerhsize = \hsize
5213 \advance\outerhsize by 0.5in
5214 \pagewidth = \hsize
5216 \normaloffset = #4\relax
5217 \bindingoffset = #5\relax
5219 \parindent = \defaultparindent
5220 \setemergencystretch
5223 % @letterpaper (the default).
5224 \def\letterpaper{{\globaldefs = 1
5225 \parskip = 3pt plus 2pt minus 1pt
5226 \setleading{13.2pt}%
5228 % If page is nothing but text, make it come out even.
5229 \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}%
5232 % Use @smallbook to reset parameters for 7x9.5 (or so) format.
5233 \def\smallbook{{\globaldefs = 1
5234 \parskip = 2pt plus 1pt
5235 \setleading{12pt}%
5237 \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}%
5239 \lispnarrowing = 0.3in
5240 \tolerance = 700
5241 \hfuzz = 1pt
5242 \contentsrightmargin = 0pt
5243 \deftypemargin = 0pt
5244 \defbodyindent = .5cm
5246 \let\smalldisplay = \smalldisplayx
5247 \let\smallexample = \smalllispx
5248 \let\smallformat = \smallformatx
5249 \let\smalllisp = \smalllispx
5252 % Use @afourpaper to print on European A4 paper.
5253 \def\afourpaper{{\globaldefs = 1
5254 \setleading{12pt}%
5255 \parskip = 3pt plus 2pt minus 1pt
5257 \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}%
5259 \tolerance = 700
5260 \hfuzz = 1pt
5263 % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
5264 % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
5265 \def\afourlatex{{\globaldefs = 1
5266 \setleading{13.6pt}%
5268 \afourpaper
5269 \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}%
5271 \globaldefs = 0
5274 % Use @afourwide to print on European A4 paper in wide format.
5275 \def\afourwide{%
5276 \afourpaper
5277 \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
5279 \globaldefs = 0
5282 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
5283 % Perhaps we should allow setting the margins, \topskip, \parskip,
5284 % and/or leading, also. Or perhaps we should compute them somehow.
5286 \def\pagesizes{\parsearg\pagesizesxxx}
5287 \def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
5288 \def\pagesizesyyy#1,#2,#3\finish{{%
5289 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
5290 \globaldefs = 1
5292 \parskip = 3pt plus 2pt minus 1pt
5293 \setleading{13.2pt}%
5295 \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}%
5298 % Set default to letter.
5300 \letterpaper
5302 \message{and turning on texinfo input format.}
5304 % Define macros to output various characters with catcode for normal text.
5305 \catcode`\"=\other
5306 \catcode`\~=\other
5307 \catcode`\^=\other
5308 \catcode`\_=\other
5309 \catcode`\|=\other
5310 \catcode`\<=\other
5311 \catcode`\>=\other
5312 \catcode`\+=\other
5313 \def\normaldoublequote{"}
5314 \def\normaltilde{~}
5315 \def\normalcaret{^}
5316 \def\normalunderscore{_}
5317 \def\normalverticalbar{|}
5318 \def\normalless{<}
5319 \def\normalgreater{>}
5320 \def\normalplus{+}
5322 % This macro is used to make a character print one way in ttfont
5323 % where it can probably just be output, and another way in other fonts,
5324 % where something hairier probably needs to be done.
5326 % #1 is what to print if we are indeed using \tt; #2 is what to print
5327 % otherwise. Since all the Computer Modern typewriter fonts have zero
5328 % interword stretch (and shrink), and it is reasonable to expect all
5329 % typewriter fonts to have this, we can check that font parameter.
5331 \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
5333 % Turn off all special characters except @
5334 % (and those which the user can use as if they were ordinary).
5335 % Most of these we simply print from the \tt font, but for some, we can
5336 % use math or other variants that look better in normal text.
5338 \catcode`\"=\active
5339 \def\activedoublequote{{\tt\char34}}
5340 \let"=\activedoublequote
5341 \catcode`\~=\active
5342 \def~{{\tt\char126}}
5343 \chardef\hat=`\^
5344 \catcode`\^=\active
5345 \def^{{\tt \hat}}
5347 \catcode`\_=\active
5348 \def_{\ifusingtt\normalunderscore\_}
5349 % Subroutine for the previous macro.
5350 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
5352 \catcode`\|=\active
5353 \def|{{\tt\char124}}
5354 \chardef \less=`\<
5355 \catcode`\<=\active
5356 \def<{{\tt \less}}
5357 \chardef \gtr=`\>
5358 \catcode`\>=\active
5359 \def>{{\tt \gtr}}
5360 \catcode`\+=\active
5361 \def+{{\tt \char 43}}
5362 %\catcode 27=\active
5363 %\def^^[{$\diamondsuit$}
5365 % Set up an active definition for =, but don't enable it most of the time.
5366 {\catcode`\==\active
5367 \global\def={{\tt \char 61}}}
5369 \catcode`+=\active
5370 \catcode`\_=\active
5372 % If a .fmt file is being used, characters that might appear in a file
5373 % name cannot be active until we have parsed the command line.
5374 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
5375 % \otherifyactive is called near the end of this file.
5376 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
5378 \catcode`\@=0
5380 % \rawbackslashxx output one backslash character in current font
5381 \global\chardef\rawbackslashxx=`\\
5382 %{\catcode`\\=\other
5383 %@gdef@rawbackslashxx{\}}
5385 % \rawbackslash redefines \ as input to do \rawbackslashxx.
5386 {\catcode`\\=\active
5387 @gdef@rawbackslash{@let\=@rawbackslashxx }}
5389 % \normalbackslash outputs one backslash in fixed width font.
5390 \def\normalbackslash{{\tt\rawbackslashxx}}
5392 % Say @foo, not \foo, in error messages.
5393 \escapechar=`\@
5395 % \catcode 17=0 % Define control-q
5396 \catcode`\\=\active
5398 % Used sometimes to turn off (effectively) the active characters
5399 % even after parsing them.
5400 @def@turnoffactive{@let"=@normaldoublequote
5401 @let\=@realbackslash
5402 @let~=@normaltilde
5403 @let^=@normalcaret
5404 @let_=@normalunderscore
5405 @let|=@normalverticalbar
5406 @let<=@normalless
5407 @let>=@normalgreater
5408 @let+=@normalplus}
5410 @def@normalturnoffactive{@let"=@normaldoublequote
5411 @let\=@normalbackslash
5412 @let~=@normaltilde
5413 @let^=@normalcaret
5414 @let_=@normalunderscore
5415 @let|=@normalverticalbar
5416 @let<=@normalless
5417 @let>=@normalgreater
5418 @let+=@normalplus}
5420 % Make _ and + \other characters, temporarily.
5421 % This is canceled by @fixbackslash.
5422 @otherifyactive
5424 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
5425 % That is what \eatinput is for; after that, the `\' should revert to printing
5426 % a backslash.
5428 @gdef@eatinput input texinfo{@fixbackslash}
5429 @global@let\ = @eatinput
5431 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
5432 % the first `\{ in the file would cause an error. This macro tries to fix
5433 % that, assuming it is called before the first `\' could plausibly occur.
5434 % Also back turn on active characters that might appear in the input
5435 % file name, in case not using a pre-dumped format.
5437 @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
5438 @catcode`+=@active @catcode`@_=@active}
5440 % These look ok in all fonts, so just make them not special. The @rm below
5441 % makes sure that the current font starts out as the newly loaded cmr10
5442 @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
5444 @textfonts
5447 @c Local variables:
5448 @c page-delimiter: "^\\\\message"
5449 @c update-date-leading-regexp: "def\\texinfoversion{"
5450 @c update-date-date-regexp: "[-0-9.]+"
5451 @c update-date-format-string: "%Y-%m-%d"
5452 @c update-date-trailing-regexp: "}"
5453 @c eval: (and(load "update-date" t t)(add-hook 'write-file-hooks 'update-date))
5454 @c End: