Update.
[glibc.git] / manual / texinfo.tex
blob2ff84c5d7034d8499eab3f5547bade135241e6ce
1 % texinfo.tex -- TeX macros to handle Texinfo files.
3 % Load plain if necessary, i.e., if running under initex.
4 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
6 \def\texinfoversion{1999-01-24}%
8 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
9 % Free Software Foundation, Inc.
11 % This texinfo.tex file is free software; you can redistribute it and/or
12 % modify it under the terms of the GNU General Public License as
13 % published by the Free Software Foundation; either version 2, or (at
14 % your option) any later version.
16 % This texinfo.tex file is distributed in the hope that it will be
17 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
18 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 % General Public License for more details.
21 % You should have received a copy of the GNU General Public License
22 % along with this texinfo.tex file; see the file COPYING. If not, write
23 % to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 % Boston, MA 02111-1307, USA.
26 % In other words, you are welcome to use, share and improve this program.
27 % You are forbidden to forbid anyone else to use, share and improve
28 % what you give them. Help stamp out software-hoarding!
30 % Please try the latest version of texinfo.tex before submitting bug
31 % reports; you can get the latest version from:
32 % ftp://ftp.gnu.org/pub/gnu/texinfo.tex
33 % /home/gd/gnu/doc/texinfo.tex on the GNU machines.
34 % (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
35 % ftp://tug.org/tex/texinfo.tex
36 % ftp://ctan.org/macros/texinfo/texinfo.tex
37 % (and all CTAN mirrors, finger ctan@ctan.org for a list).
38 % The texinfo.tex in the texinfo distribution itself could well be out
39 % of date, so if that's what you're using, please check.
41 % Send bug reports to bug-texinfo@gnu.org.
42 % Please include a precise test case in each bug report,
43 % including a complete document with which we can reproduce the problem.
45 % To process a Texinfo manual with TeX, it's most reliable to use the
46 % texi2dvi shell script that comes with the distribution. For simple
47 % manuals, however, you can get away with:
48 % tex foo.texi
49 % texindex foo.??
50 % tex foo.texi
51 % tex foo.texi
52 % dvips foo.dvi -o # or whatever, to process the dvi file.
53 % The extra runs of TeX get the cross-reference information correct.
54 % Sometimes one run after texindex suffices, and sometimes you need more
55 % than two; texi2dvi does it as many times as necessary.
57 \message{Loading texinfo [version \texinfoversion]:}
59 % If in a .fmt file, print the version number
60 % and turn on active characters that we couldn't do earlier because
61 % they might have appeared in the input file name.
62 \everyjob{\message{[Texinfo version \texinfoversion]}%
63 \catcode`+=\active \catcode`\_=\active}
65 % Save some parts of plain tex whose names we will redefine.
67 \let\ptexb=\b
68 \let\ptexbullet=\bullet
69 \let\ptexc=\c
70 \let\ptexcomma=\,
71 \let\ptexdot=\.
72 \let\ptexdots=\dots
73 \let\ptexend=\end
74 \let\ptexequiv=\equiv
75 \let\ptexexclam=\!
76 \let\ptexi=\i
77 \let\ptexlbrace=\{
78 \let\ptexrbrace=\}
79 \let\ptexstar=\*
80 \let\ptext=\t
82 % We never want plain's outer \+ definition in Texinfo.
83 % For @tex, we can use \tabalign.
84 \let\+ = \relax
87 \message{Basics,}
88 \chardef\other=12
90 % If this character appears in an error message or help string, it
91 % starts a new line in the output.
92 \newlinechar = `^^J
94 % Set up fixed words for English if not already set.
95 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
96 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
97 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
98 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
99 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
100 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
101 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
102 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
103 \ifx\putwordOf\undefined \gdef\putwordOf{of}\fi
104 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
105 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
106 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
107 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
108 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
109 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
110 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
111 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
113 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
114 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
115 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
116 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
117 \ifx\putwordMMai\undefined \gdef\putwordMMai{May}\fi
118 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
119 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
120 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
121 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
122 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
123 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
124 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
126 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
127 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
128 \ifx\putwordDefivar\undefined \gdef\putwordDefivar{Instance Variable}\fi
129 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
130 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
131 \ifx\putwordDeftypevar\undefined \gdef\putwordDeftypevar{Variable}\fi
132 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
133 \ifx\putwordDeftypefun\undefined \gdef\putwordDeftypefun{Function}\fi
135 % Ignore a token.
137 \def\gobble#1{}
139 \hyphenation{ap-pen-dix}
140 \hyphenation{mini-buf-fer mini-buf-fers}
141 \hyphenation{eshell}
142 \hyphenation{white-space}
144 % Margin to add to right of even pages, to left of odd pages.
145 \newdimen \bindingoffset
146 \newdimen \normaloffset
147 \newdimen\pagewidth \newdimen\pageheight
149 % Sometimes it is convenient to have everything in the transcript file
150 % and nothing on the terminal. We don't just call \tracingall here,
151 % since that produces some useless output on the terminal.
153 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
154 \ifx\eTeXversion\undefined
155 \def\loggingall{\tracingcommands2 \tracingstats2
156 \tracingpages1 \tracingoutput1 \tracinglostchars1
157 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
158 \showboxbreadth\maxdimen\showboxdepth\maxdimen
160 \else
161 \def\loggingall{\tracingcommands3 \tracingstats2
162 \tracingpages1 \tracingoutput1 \tracinglostchars1
163 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
164 \tracingscantokens1 \tracingassigns1 \tracingifs1
165 \tracinggroups1 \tracingnesting2
166 \showboxbreadth\maxdimen\showboxdepth\maxdimen
170 % For @cropmarks command.
171 % Do @cropmarks to get crop marks.
173 \newif\ifcropmarks
174 \let\cropmarks = \cropmarkstrue
176 % Dimensions to add cropmarks at corners.
177 % Added by P. A. MacKay, 12 Nov. 1986
179 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
180 \newdimen\cornerlong \cornerlong=1pc
181 \newdimen\cornerthick \cornerthick=.3pt
182 \newdimen\topandbottommargin \topandbottommargin=.75in
184 % Main output routine.
185 \chardef\PAGE = 255
186 \output = {\onepageout{\pagecontents\PAGE}}
188 \newbox\headlinebox
189 \newbox\footlinebox
191 % \onepageout takes a vbox as an argument. Note that \pagecontents
192 % does insertions, but you have to call it yourself.
193 \def\onepageout#1{%
194 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
196 \ifodd\pageno \advance\hoffset by \bindingoffset
197 \else \advance\hoffset by -\bindingoffset\fi
199 % Do this outside of the \shipout so @code etc. will be expanded in
200 % the headline as they should be, not taken literally (outputting ''code).
201 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
202 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
205 % Have to do this stuff outside the \shipout because we want it to
206 % take effect in \write's, yet the group defined by the \vbox ends
207 % before the \shipout runs.
209 \escapechar = `\\ % use backslash in output files.
210 \indexdummies % don't expand commands in the output.
211 \normalturnoffactive % \ in index entries must not stay \, e.g., if
212 % the page break happens to be in the middle of an example.
213 \shipout\vbox{%
214 \ifcropmarks \vbox to \outervsize\bgroup
215 \hsize = \outerhsize
216 \vskip-\topandbottommargin
217 \vtop to0pt{%
218 \line{\ewtop\hfil\ewtop}%
219 \nointerlineskip
220 \line{%
221 \vbox{\moveleft\cornerthick\nstop}%
222 \hfill
223 \vbox{\moveright\cornerthick\nstop}%
225 \vss}%
226 \vskip\topandbottommargin
227 \line\bgroup
228 \hfil % center the page within the outer (page) hsize.
229 \ifodd\pageno\hskip\bindingoffset\fi
230 \vbox\bgroup
233 \unvbox\headlinebox
234 \pagebody{#1}%
235 \ifdim\ht\footlinebox > 0pt
236 % Only leave this space if the footline is nonempty.
237 % (We lessened \vsize for it in \oddfootingxxx.)
238 % The \baselineskip=24pt in plain's \makefootline has no effect.
239 \vskip 2\baselineskip
240 \unvbox\footlinebox
243 \ifcropmarks
244 \egroup % end of \vbox\bgroup
245 \hfil\egroup % end of (centering) \line\bgroup
246 \vskip\topandbottommargin plus1fill minus1fill
247 \boxmaxdepth = \cornerthick
248 \vbox to0pt{\vss
249 \line{%
250 \vbox{\moveleft\cornerthick\nsbot}%
251 \hfill
252 \vbox{\moveright\cornerthick\nsbot}%
254 \nointerlineskip
255 \line{\ewbot\hfil\ewbot}%
257 \egroup % \vbox from first cropmarks clause
259 }% end of \shipout\vbox
260 }% end of group with \turnoffactive
261 \advancepageno
262 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
265 \newinsert\margin \dimen\margin=\maxdimen
267 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
268 {\catcode`\@ =11
269 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
270 % marginal hacks, juha@viisa.uucp (Juha Takala)
271 \ifvoid\margin\else % marginal info is present
272 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
273 \dimen@=\dp#1 \unvbox#1
274 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
275 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
278 % Here are the rules for the cropmarks. Note that they are
279 % offset so that the space between them is truly \outerhsize or \outervsize
280 % (P. A. MacKay, 12 November, 1986)
282 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
283 \def\nstop{\vbox
284 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
285 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
286 \def\nsbot{\vbox
287 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
289 % Parse an argument, then pass it to #1. The argument is the rest of
290 % the input line (except we remove a trailing comment). #1 should be a
291 % macro which expects an ordinary undelimited TeX argument.
293 \def\parsearg#1{%
294 \let\next = #1%
295 \begingroup
296 \obeylines
297 \futurelet\temp\parseargx
300 % If the next token is an obeyed space (from an @example environment or
301 % the like), remove it and recurse. Otherwise, we're done.
302 \def\parseargx{%
303 % \obeyedspace is defined far below, after the definition of \sepspaces.
304 \ifx\obeyedspace\temp
305 \expandafter\parseargdiscardspace
306 \else
307 \expandafter\parseargline
311 % Remove a single space (as the delimiter token to the macro call).
312 {\obeyspaces %
313 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
315 {\obeylines %
316 \gdef\parseargline#1^^M{%
317 \endgroup % End of the group started in \parsearg.
319 % First remove any @c comment, then any @comment.
320 % Result of each macro is put in \toks0.
321 \argremovec #1\c\relax %
322 \expandafter\argremovecomment \the\toks0 \comment\relax %
324 % Call the caller's macro, saved as \next in \parsearg.
325 \expandafter\next\expandafter{\the\toks0}%
329 % Since all \c{,omment} does is throw away the argument, we can let TeX
330 % do that for us. The \relax here is matched by the \relax in the call
331 % in \parseargline; it could be more or less anything, its purpose is
332 % just to delimit the argument to the \c.
333 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
334 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
336 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
337 % @end itemize @c foo
338 % will have two active spaces as part of the argument with the
339 % `itemize'. Here we remove all active spaces from #1, and assign the
340 % result to \toks0.
342 % This loses if there are any *other* active characters besides spaces
343 % in the argument -- _ ^ +, for example -- since they get expanded.
344 % Fortunately, Texinfo does not define any such commands. (If it ever
345 % does, the catcode of the characters in questionwill have to be changed
346 % here.) But this means we cannot call \removeactivespaces as part of
347 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
348 % that \parsearg gets might well have any character at all in it.
350 \def\removeactivespaces#1{%
351 \begingroup
352 \ignoreactivespaces
353 \edef\temp{#1}%
354 \global\toks0 = \expandafter{\temp}%
355 \endgroup
358 % Change the active space to expand to nothing.
360 \begingroup
361 \obeyspaces
362 \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
363 \endgroup
366 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
368 %% These are used to keep @begin/@end levels from running away
369 %% Call \inENV within environments (after a \begingroup)
370 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
371 \def\ENVcheck{%
372 \ifENV\errmessage{Still within an environment; press RETURN to continue}
373 \endgroup\fi} % This is not perfect, but it should reduce lossage
375 % @begin foo is the same as @foo, for now.
376 \newhelp\EMsimple{Press RETURN to continue.}
378 \outer\def\begin{\parsearg\beginxxx}
380 \def\beginxxx #1{%
381 \expandafter\ifx\csname #1\endcsname\relax
382 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
383 \csname #1\endcsname\fi}
385 % @end foo executes the definition of \Efoo.
387 \def\end{\parsearg\endxxx}
388 \def\endxxx #1{%
389 \removeactivespaces{#1}%
390 \edef\endthing{\the\toks0}%
392 \expandafter\ifx\csname E\endthing\endcsname\relax
393 \expandafter\ifx\csname \endthing\endcsname\relax
394 % There's no \foo, i.e., no ``environment'' foo.
395 \errhelp = \EMsimple
396 \errmessage{Undefined command `@end \endthing'}%
397 \else
398 \unmatchedenderror\endthing
400 \else
401 % Everything's ok; the right environment has been started.
402 \csname E\endthing\endcsname
406 % There is an environment #1, but it hasn't been started. Give an error.
408 \def\unmatchedenderror#1{%
409 \errhelp = \EMsimple
410 \errmessage{This `@end #1' doesn't have a matching `@#1'}%
413 % Define the control sequence \E#1 to give an unmatched @end error.
415 \def\defineunmatchedend#1{%
416 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
420 % Single-spacing is done by various environments (specifically, in
421 % \nonfillstart and \quotations).
422 \newskip\singlespaceskip \singlespaceskip = 12.5pt
423 \def\singlespace{%
424 % Why was this kern here? It messes up equalizing space above and below
425 % environments. --karl, 6may93
426 %{\advance \baselineskip by -\singlespaceskip
427 %\kern \baselineskip}%
428 \setleading \singlespaceskip
431 %% Simple single-character @ commands
433 % @@ prints an @
434 % Kludge this until the fonts are right (grr).
435 \def\@{{\tt\char64}}
437 % This is turned off because it was never documented
438 % and you can use @w{...} around a quote to suppress ligatures.
439 %% Define @` and @' to be the same as ` and '
440 %% but suppressing ligatures.
441 %\def\`{{`}}
442 %\def\'{{'}}
444 % Used to generate quoted braces.
445 \def\mylbrace {{\tt\char123}}
446 \def\myrbrace {{\tt\char125}}
447 \let\{=\mylbrace
448 \let\}=\myrbrace
449 \begingroup
450 % Definitions to produce actual \{ & \} command in an index.
451 \catcode`\{ = 12 \catcode`\} = 12
452 \catcode`\[ = 1 \catcode`\] = 2
453 \catcode`\@ = 0 \catcode`\\ = 12
454 @gdef@lbracecmd[\{]%
455 @gdef@rbracecmd[\}]%
456 @endgroup
458 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
459 % Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
460 \let\, = \c
461 \let\dotaccent = \.
462 \def\ringaccent#1{{\accent23 #1}}
463 \let\tieaccent = \t
464 \let\ubaraccent = \b
465 \let\udotaccent = \d
467 % Other special characters: @questiondown @exclamdown
468 % Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
469 \def\questiondown{?`}
470 \def\exclamdown{!`}
472 % Dotless i and dotless j, used for accents.
473 \def\imacro{i}
474 \def\jmacro{j}
475 \def\dotless#1{%
476 \def\temp{#1}%
477 \ifx\temp\imacro \ptexi
478 \else\ifx\temp\jmacro \j
479 \else \errmessage{@dotless can be used only with i or j}%
480 \fi\fi
483 % Be sure we're in horizontal mode when doing a tie, since we make space
484 % equivalent to this in @example-like environments. Otherwise, a space
485 % at the beginning of a line will start with \penalty -- and
486 % since \penalty is valid in vertical mode, we'd end up putting the
487 % penalty on the vertical list instead of in the new paragraph.
488 {\catcode`@ = 11
489 % Avoid using \@M directly, because that causes trouble
490 % if the definition is written into an index file.
491 \global\let\tiepenalty = \@M
492 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
495 % @: forces normal size whitespace following.
496 \def\:{\spacefactor=1000 }
498 % @* forces a line break.
499 \def\*{\hfil\break\hbox{}\ignorespaces}
501 % @. is an end-of-sentence period.
502 \def\.{.\spacefactor=3000 }
504 % @! is an end-of-sentence bang.
505 \def\!{!\spacefactor=3000 }
507 % @? is an end-of-sentence query.
508 \def\?{?\spacefactor=3000 }
510 % @w prevents a word break. Without the \leavevmode, @w at the
511 % beginning of a paragraph, when TeX is still in vertical mode, would
512 % produce a whole line of output instead of starting the paragraph.
513 \def\w#1{\leavevmode\hbox{#1}}
515 % @group ... @end group forces ... to be all on one page, by enclosing
516 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
517 % to keep its height that of a normal line. According to the rules for
518 % \topskip (p.114 of the TeXbook), the glue inserted is
519 % max (\topskip - \ht (first item), 0). If that height is large,
520 % therefore, no glue is inserted, and the space between the headline and
521 % the text is small, which looks bad.
523 \def\group{\begingroup
524 \ifnum\catcode13=\active \else
525 \errhelp = \groupinvalidhelp
526 \errmessage{@group invalid in context where filling is enabled}%
529 % The \vtop we start below produces a box with normal height and large
530 % depth; thus, TeX puts \baselineskip glue before it, and (when the
531 % next line of text is done) \lineskip glue after it. (See p.82 of
532 % the TeXbook.) Thus, space below is not quite equal to space
533 % above. But it's pretty close.
534 \def\Egroup{%
535 \egroup % End the \vtop.
536 \endgroup % End the \group.
539 \vtop\bgroup
540 % We have to put a strut on the last line in case the @group is in
541 % the midst of an example, rather than completely enclosing it.
542 % Otherwise, the interline space between the last line of the group
543 % and the first line afterwards is too small. But we can't put the
544 % strut in \Egroup, since there it would be on a line by itself.
545 % Hence this just inserts a strut at the beginning of each line.
546 \everypar = {\strut}%
548 % Since we have a strut on every line, we don't need any of TeX's
549 % normal interline spacing.
550 \offinterlineskip
552 % OK, but now we have to do something about blank
553 % lines in the input in @example-like environments, which normally
554 % just turn into \lisppar, which will insert no space now that we've
555 % turned off the interline space. Simplest is to make them be an
556 % empty paragraph.
557 \ifx\par\lisppar
558 \edef\par{\leavevmode \par}%
560 % Reset ^^M's definition to new definition of \par.
561 \obeylines
564 % Do @comment since we are called inside an environment such as
565 % @example, where each end-of-line in the input causes an
566 % end-of-line in the output. We don't want the end-of-line after
567 % the `@group' to put extra space in the output. Since @group
568 % should appear on a line by itself (according to the Texinfo
569 % manual), we don't worry about eating any user text.
570 \comment
573 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
574 % message, so this ends up printing `@group can only ...'.
576 \newhelp\groupinvalidhelp{%
577 group can only be used in environments such as @example,^^J%
578 where each line of input produces a line of output.}
580 % @need space-in-mils
581 % forces a page break if there is not space-in-mils remaining.
583 \newdimen\mil \mil=0.001in
585 \def\need{\parsearg\needx}
587 % Old definition--didn't work.
588 %\def\needx #1{\par %
589 %% This method tries to make TeX break the page naturally
590 %% if the depth of the box does not fit.
591 %{\baselineskip=0pt%
592 %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
593 %\prevdepth=-1000pt
596 \def\needx#1{%
597 % Go into vertical mode, so we don't make a big box in the middle of a
598 % paragraph.
599 \par
601 % Don't add any leading before our big empty box, but allow a page
602 % break, since the best break might be right here.
603 \allowbreak
604 \nointerlineskip
605 \vtop to #1\mil{\vfil}%
607 % TeX does not even consider page breaks if a penalty added to the
608 % main vertical list is 10000 or more. But in order to see if the
609 % empty box we just added fits on the page, we must make it consider
610 % page breaks. On the other hand, we don't want to actually break the
611 % page after the empty box. So we use a penalty of 9999.
613 % There is an extremely small chance that TeX will actually break the
614 % page at this \penalty, if there are no other feasible breakpoints in
615 % sight. (If the user is using lots of big @group commands, which
616 % almost-but-not-quite fill up a page, TeX will have a hard time doing
617 % good page breaking, for example.) However, I could not construct an
618 % example where a page broke at this \penalty; if it happens in a real
619 % document, then we can reconsider our strategy.
620 \penalty9999
622 % Back up by the size of the box, whether we did a page break or not.
623 \kern -#1\mil
625 % Do not allow a page break right after this kern.
626 \nobreak
629 % @br forces paragraph break
631 \let\br = \par
633 % @dots{} output an ellipsis using the current font.
634 % We do .5em per period so that it has the same spacing in a typewriter
635 % font as three actual period characters.
637 \def\dots{%
638 \leavevmode
639 \hbox to 1.5em{%
640 \hskip 0pt plus 0.25fil minus 0.25fil
641 .\hss.\hss.%
642 \hskip 0pt plus 0.5fil minus 0.5fil
646 % @enddots{} is an end-of-sentence ellipsis.
648 \def\enddots{%
649 \leavevmode
650 \hbox to 2em{%
651 \hskip 0pt plus 0.25fil minus 0.25fil
652 .\hss.\hss.\hss.%
653 \hskip 0pt plus 0.5fil minus 0.5fil
655 \spacefactor=3000
659 % @page forces the start of a new page
661 \def\page{\par\vfill\supereject}
663 % @exdent text....
664 % outputs text on separate line in roman font, starting at standard page margin
666 % This records the amount of indent in the innermost environment.
667 % That's how much \exdent should take out.
668 \newskip\exdentamount
670 % This defn is used inside fill environments such as @defun.
671 \def\exdent{\parsearg\exdentyyy}
672 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
674 % This defn is used inside nofill environments such as @example.
675 \def\nofillexdent{\parsearg\nofillexdentyyy}
676 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
677 \leftline{\hskip\leftskip{\rm#1}}}}
679 % @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
681 \def\inmargin#1{%
682 \strut\vadjust{\nobreak\kern-\strutdepth
683 \vtop to \strutdepth{\baselineskip\strutdepth\vss
684 \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
685 \newskip\inmarginspacing \inmarginspacing=1cm
686 \def\strutdepth{\dp\strutbox}
688 %\hbox{{\rm#1}}\hfil\break}}
690 % @include file insert text of that file as input.
691 % Allow normal characters that we make active in the argument (a file name).
692 \def\include{\begingroup
693 \catcode`\\=12
694 \catcode`~=12
695 \catcode`^=12
696 \catcode`_=12
697 \catcode`|=12
698 \catcode`<=12
699 \catcode`>=12
700 \catcode`+=12
701 \parsearg\includezzz}
702 % Restore active chars for included file.
703 \def\includezzz#1{\endgroup\begingroup
704 % Read the included file in a group so nested @include's work.
705 \def\thisfile{#1}%
706 \input\thisfile
707 \endgroup}
709 \def\thisfile{}
711 % @center line outputs that line, centered
713 \def\center{\parsearg\centerzzz}
714 \def\centerzzz #1{{\advance\hsize by -\leftskip
715 \advance\hsize by -\rightskip
716 \centerline{#1}}}
718 % @sp n outputs n lines of vertical space
720 \def\sp{\parsearg\spxxx}
721 \def\spxxx #1{\vskip #1\baselineskip}
723 % @comment ...line which is ignored...
724 % @c is the same as @comment
725 % @ignore ... @end ignore is another way to write a comment
727 \def\comment{\begingroup \catcode`\^^M=\other%
728 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
729 \commentxxx}
730 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
732 \let\c=\comment
734 % @paragraphindent is defined for the Info formatting commands only.
735 \let\paragraphindent=\comment
737 % Prevent errors for section commands.
738 % Used in @ignore and in failing conditionals.
739 \def\ignoresections{%
740 \let\chapter=\relax
741 \let\unnumbered=\relax
742 \let\top=\relax
743 \let\unnumberedsec=\relax
744 \let\unnumberedsection=\relax
745 \let\unnumberedsubsec=\relax
746 \let\unnumberedsubsection=\relax
747 \let\unnumberedsubsubsec=\relax
748 \let\unnumberedsubsubsection=\relax
749 \let\section=\relax
750 \let\subsec=\relax
751 \let\subsubsec=\relax
752 \let\subsection=\relax
753 \let\subsubsection=\relax
754 \let\appendix=\relax
755 \let\appendixsec=\relax
756 \let\appendixsection=\relax
757 \let\appendixsubsec=\relax
758 \let\appendixsubsection=\relax
759 \let\appendixsubsubsec=\relax
760 \let\appendixsubsubsection=\relax
761 \let\contents=\relax
762 \let\smallbook=\relax
763 \let\titlepage=\relax
766 % Used in nested conditionals, where we have to parse the Texinfo source
767 % and so want to turn off most commands, in case they are used
768 % incorrectly.
770 \def\ignoremorecommands{%
771 \let\defcodeindex = \relax
772 \let\defcv = \relax
773 \let\deffn = \relax
774 \let\deffnx = \relax
775 \let\defindex = \relax
776 \let\defivar = \relax
777 \let\defmac = \relax
778 \let\defmethod = \relax
779 \let\defop = \relax
780 \let\defopt = \relax
781 \let\defspec = \relax
782 \let\deftp = \relax
783 \let\deftypefn = \relax
784 \let\deftypefun = \relax
785 \let\deftypevar = \relax
786 \let\deftypevr = \relax
787 \let\defun = \relax
788 \let\defvar = \relax
789 \let\defvr = \relax
790 \let\ref = \relax
791 \let\xref = \relax
792 \let\printindex = \relax
793 \let\pxref = \relax
794 \let\settitle = \relax
795 \let\setchapternewpage = \relax
796 \let\setchapterstyle = \relax
797 \let\everyheading = \relax
798 \let\evenheading = \relax
799 \let\oddheading = \relax
800 \let\everyfooting = \relax
801 \let\evenfooting = \relax
802 \let\oddfooting = \relax
803 \let\headings = \relax
804 \let\include = \relax
805 \let\lowersections = \relax
806 \let\down = \relax
807 \let\raisesections = \relax
808 \let\up = \relax
809 \let\set = \relax
810 \let\clear = \relax
811 \let\item = \relax
814 % Ignore @ignore ... @end ignore.
816 \def\ignore{\doignore{ignore}}
818 % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
820 \def\ifinfo{\doignore{ifinfo}}
821 \def\ifhtml{\doignore{ifhtml}}
822 \def\ifnottex{\doignore{ifnottex}}
823 \def\html{\doignore{html}}
824 \def\menu{\doignore{menu}}
825 \def\direntry{\doignore{direntry}}
827 % @dircategory CATEGORY -- specify a category of the dir file
828 % which this file should belong to. Ignore this in TeX.
829 \let\dircategory = \comment
831 % Ignore text until a line `@end #1'.
833 \def\doignore#1{\begingroup
834 % Don't complain about control sequences we have declared \outer.
835 \ignoresections
837 % Define a command to swallow text until we reach `@end #1'.
838 % This @ is a catcode 12 token (that is the normal catcode of @ in
839 % this texinfo.tex file). We change the catcode of @ below to match.
840 \long\def\doignoretext##1@end #1{\enddoignore}%
842 % Make sure that spaces turn into tokens that match what \doignoretext wants.
843 \catcode32 = 10
845 % Ignore braces, too, so mismatched braces don't cause trouble.
846 \catcode`\{ = 9
847 \catcode`\} = 9
849 % We must not have @c interpreted as a control sequence.
850 \catcode`\@ = 12
852 % Make the letter c a comment character so that the rest of the line
853 % will be ignored. This way, the document can have (for example)
854 % @c @end ifinfo
855 % and the @end ifinfo will be properly ignored.
856 % (We've just changed @ to catcode 12.)
857 \catcode`\c = 14
859 % And now expand that command.
860 \doignoretext
863 % What we do to finish off ignored text.
865 \def\enddoignore{\endgroup\ignorespaces}%
867 \newif\ifwarnedobs\warnedobsfalse
868 \def\obstexwarn{%
869 \ifwarnedobs\relax\else
870 % We need to warn folks that they may have trouble with TeX 3.0.
871 % This uses \immediate\write16 rather than \message to get newlines.
872 \immediate\write16{}
873 \immediate\write16{WARNING: for users of Unix TeX 3.0!}
874 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
875 \immediate\write16{If you are running another version of TeX, relax.}
876 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
877 \immediate\write16{ Then upgrade your TeX installation if you can.}
878 \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
879 \immediate\write16{If you are stuck with version 3.0, run the}
880 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
881 \immediate\write16{ to use a workaround.}
882 \immediate\write16{}
883 \global\warnedobstrue
887 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
888 % workaround (which requires the file ``dummy.tfm'' to be installed),
889 % uncomment the following line:
890 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
892 % Ignore text, except that we keep track of conditional commands for
893 % purposes of nesting, up to an `@end #1' command.
895 \def\nestedignore#1{%
896 \obstexwarn
897 % We must actually expand the ignored text to look for the @end
898 % command, so that nested ignore constructs work. Thus, we put the
899 % text into a \vbox and then do nothing with the result. To minimize
900 % the change of memory overflow, we follow the approach outlined on
901 % page 401 of the TeXbook: make the current font be a dummy font.
903 \setbox0 = \vbox\bgroup
904 % Don't complain about control sequences we have declared \outer.
905 \ignoresections
907 % Define `@end #1' to end the box, which will in turn undefine the
908 % @end command again.
909 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
911 % We are going to be parsing Texinfo commands. Most cause no
912 % trouble when they are used incorrectly, but some commands do
913 % complicated argument parsing or otherwise get confused, so we
914 % undefine them.
916 % We can't do anything about stray @-signs, unfortunately;
917 % they'll produce `undefined control sequence' errors.
918 \ignoremorecommands
920 % Set the current font to be \nullfont, a TeX primitive, and define
921 % all the font commands to also use \nullfont. We don't use
922 % dummy.tfm, as suggested in the TeXbook, because not all sites
923 % might have that installed. Therefore, math mode will still
924 % produce output, but that should be an extremely small amount of
925 % stuff compared to the main input.
927 \nullfont
928 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
929 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
930 \let\tensf = \nullfont
931 % Similarly for index fonts (mostly for their use in
932 % smallexample)
933 \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
934 \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
935 \let\indsf = \nullfont
937 % Don't complain when characters are missing from the fonts.
938 \tracinglostchars = 0
940 % Don't bother to do space factor calculations.
941 \frenchspacing
943 % Don't report underfull hboxes.
944 \hbadness = 10000
946 % Do minimal line-breaking.
947 \pretolerance = 10000
949 % Do not execute instructions in @tex
950 \def\tex{\doignore{tex}}%
951 % Do not execute macro definitions.
952 % `c' is a comment character, so the word `macro' will get cut off.
953 \def\macro{\doignore{ma}}%
956 % @set VAR sets the variable VAR to an empty value.
957 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
959 % Since we want to separate VAR from REST-OF-LINE (which might be
960 % empty), we can't just use \parsearg; we have to insert a space of our
961 % own to delimit the rest of the line, and then take it out again if we
962 % didn't need it. Make sure the catcode of space is correct to avoid
963 % losing inside @example, for instance.
965 \def\set{\begingroup\catcode` =10
966 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
967 \parsearg\setxxx}
968 \def\setxxx#1{\setyyy#1 \endsetyyy}
969 \def\setyyy#1 #2\endsetyyy{%
970 \def\temp{#2}%
971 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
972 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
974 \endgroup
976 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
977 % \next or other control sequences that we've defined might get us into
978 % an infinite loop. Consider `@set foo @cite{bar}'.
979 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
981 % @clear VAR clears (i.e., unsets) the variable VAR.
983 \def\clear{\parsearg\clearxxx}
984 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
986 % @value{foo} gets the text saved in variable foo.
989 \catcode`\_ = \active
991 % We might end up with active _ or - characters in the argument if
992 % we're called from @code, as @code{@value{foo-bar_}}. So \let any
993 % such active characters to their normal equivalents.
994 \gdef\value{\begingroup
995 \catcode`\-=12 \catcode`\_=12
996 \indexbreaks \let_\normalunderscore
997 \valuexxx}
999 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
1001 % We have this subroutine so that we can handle at least some @value's
1002 % properly in indexes (we \let\value to this in \indexdummies). Ones
1003 % whose names contain - or _ still won't work, but we can't do anything
1004 % about that. The command has to be fully expandable, since the result
1005 % winds up in the index file. This means that if the variable's value
1006 % contains other Texinfo commands, it's almost certain it will fail
1007 % (although perhaps we could fix that with sufficient work to do a
1008 % one-level expansion on the result, instead of complete).
1010 \def\expandablevalue#1{%
1011 \expandafter\ifx\csname SET#1\endcsname\relax
1012 {[No value for ``#1'']}%
1013 \else
1014 \csname SET#1\endcsname
1018 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
1019 % with @set.
1021 \def\ifset{\parsearg\ifsetxxx}
1022 \def\ifsetxxx #1{%
1023 \expandafter\ifx\csname SET#1\endcsname\relax
1024 \expandafter\ifsetfail
1025 \else
1026 \expandafter\ifsetsucceed
1029 \def\ifsetsucceed{\conditionalsucceed{ifset}}
1030 \def\ifsetfail{\nestedignore{ifset}}
1031 \defineunmatchedend{ifset}
1033 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
1034 % defined with @set, or has been undefined with @clear.
1036 \def\ifclear{\parsearg\ifclearxxx}
1037 \def\ifclearxxx #1{%
1038 \expandafter\ifx\csname SET#1\endcsname\relax
1039 \expandafter\ifclearsucceed
1040 \else
1041 \expandafter\ifclearfail
1044 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
1045 \def\ifclearfail{\nestedignore{ifclear}}
1046 \defineunmatchedend{ifclear}
1048 % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
1049 % following, through the first @end iftex (etc.). Make `@end iftex'
1050 % (etc.) valid only after an @iftex.
1052 \def\iftex{\conditionalsucceed{iftex}}
1053 \def\ifnothtml{\conditionalsucceed{ifnothtml}}
1054 \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
1055 \defineunmatchedend{iftex}
1056 \defineunmatchedend{ifnothtml}
1057 \defineunmatchedend{ifnotinfo}
1059 % We can't just want to start a group at @iftex (for example) and end it
1060 % at @end iftex, since then @set commands inside the conditional have no
1061 % effect (they'd get reverted at the end of the group). So we must
1062 % define \Eiftex to redefine itself to be its previous value. (We can't
1063 % just define it to fail again with an ``unmatched end'' error, since
1064 % the @ifset might be nested.)
1066 \def\conditionalsucceed#1{%
1067 \edef\temp{%
1068 % Remember the current value of \E#1.
1069 \let\nece{prevE#1} = \nece{E#1}%
1071 % At the `@end #1', redefine \E#1 to be its previous value.
1072 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
1074 \temp
1077 % We need to expand lots of \csname's, but we don't want to expand the
1078 % control sequences after we've constructed them.
1080 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
1082 % @asis just yields its argument. Used with @table, for example.
1084 \def\asis#1{#1}
1086 % @math means output in math mode.
1087 % We don't use $'s directly in the definition of \math because control
1088 % sequences like \math are expanded when the toc file is written. Then,
1089 % we read the toc file back, the $'s will be normal characters (as they
1090 % should be, according to the definition of Texinfo). So we must use a
1091 % control sequence to switch into and out of math mode.
1093 % This isn't quite enough for @math to work properly in indices, but it
1094 % seems unlikely it will ever be needed there.
1096 \let\implicitmath = $
1097 \def\math#1{\implicitmath #1\implicitmath}
1099 % @bullet and @minus need the same treatment as @math, just above.
1100 \def\bullet{\implicitmath\ptexbullet\implicitmath}
1101 \def\minus{\implicitmath-\implicitmath}
1103 % @refill is a no-op.
1104 \let\refill=\relax
1106 % If working on a large document in chapters, it is convenient to
1107 % be able to disable indexing, cross-referencing, and contents, for test runs.
1108 % This is done with @novalidate (before @setfilename).
1110 \newif\iflinks \linkstrue % by default we want the aux files.
1111 \let\novalidate = \linksfalse
1113 % @setfilename is done at the beginning of every texinfo file.
1114 % So open here the files we need to have open while reading the input.
1115 % This makes it possible to make a .fmt file for texinfo.
1116 \def\setfilename{%
1117 \iflinks
1118 \readauxfile
1119 \fi % \openindices needs to do some work in any case.
1120 \openindices
1121 \fixbackslash % Turn off hack to swallow `\input texinfo'.
1122 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
1124 % If texinfo.cnf is present on the system, read it.
1125 % Useful for site-wide @afourpaper, etc.
1126 % Just to be on the safe side, close the input stream before the \input.
1127 \openin 1 texinfo.cnf
1128 \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
1129 \closein1
1130 \temp
1132 \comment % Ignore the actual filename.
1135 % Called from \setfilename.
1137 \def\openindices{%
1138 \newindex{cp}%
1139 \newcodeindex{fn}%
1140 \newcodeindex{vr}%
1141 \newcodeindex{tp}%
1142 \newcodeindex{ky}%
1143 \newcodeindex{pg}%
1146 % @bye.
1147 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1150 \message{fonts,}
1151 % Font-change commands.
1153 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1154 % So we set up a \sf analogous to plain's \rm, etc.
1155 \newfam\sffam
1156 \def\sf{\fam=\sffam \tensf}
1157 \let\li = \sf % Sometimes we call it \li, not \sf.
1159 % We don't need math for this one.
1160 \def\ttsl{\tenttsl}
1162 % Use Computer Modern fonts at \magstephalf (11pt).
1163 \newcount\mainmagstep
1164 \mainmagstep=\magstephalf
1166 % Set the font macro #1 to the font named #2, adding on the
1167 % specified font prefix (normally `cm').
1168 % #3 is the font's design size, #4 is a scale factor
1169 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1171 % Use cm as the default font prefix.
1172 % To specify the font prefix, you must define \fontprefix
1173 % before you read in texinfo.tex.
1174 \ifx\fontprefix\undefined
1175 \def\fontprefix{cm}
1177 % Support font families that don't use the same naming scheme as CM.
1178 \def\rmshape{r}
1179 \def\rmbshape{bx} %where the normal face is bold
1180 \def\bfshape{b}
1181 \def\bxshape{bx}
1182 \def\ttshape{tt}
1183 \def\ttbshape{tt}
1184 \def\ttslshape{sltt}
1185 \def\itshape{ti}
1186 \def\itbshape{bxti}
1187 \def\slshape{sl}
1188 \def\slbshape{bxsl}
1189 \def\sfshape{ss}
1190 \def\sfbshape{ss}
1191 \def\scshape{csc}
1192 \def\scbshape{csc}
1194 \ifx\bigger\relax
1195 \let\mainmagstep=\magstep1
1196 \setfont\textrm\rmshape{12}{1000}
1197 \setfont\texttt\ttshape{12}{1000}
1198 \else
1199 \setfont\textrm\rmshape{10}{\mainmagstep}
1200 \setfont\texttt\ttshape{10}{\mainmagstep}
1202 % Instead of cmb10, you many want to use cmbx10.
1203 % cmbx10 is a prettier font on its own, but cmb10
1204 % looks better when embedded in a line with cmr10.
1205 \setfont\textbf\bfshape{10}{\mainmagstep}
1206 \setfont\textit\itshape{10}{\mainmagstep}
1207 \setfont\textsl\slshape{10}{\mainmagstep}
1208 \setfont\textsf\sfshape{10}{\mainmagstep}
1209 \setfont\textsc\scshape{10}{\mainmagstep}
1210 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1211 \font\texti=cmmi10 scaled \mainmagstep
1212 \font\textsy=cmsy10 scaled \mainmagstep
1214 % A few fonts for @defun, etc.
1215 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1216 \setfont\deftt\ttshape{10}{\magstep1}
1217 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1219 % Fonts for indices and small examples (9pt).
1220 % We actually use the slanted font rather than the italic,
1221 % because texinfo normally uses the slanted fonts for that.
1222 % Do not make many font distinctions in general in the index, since they
1223 % aren't very useful.
1224 \setfont\ninett\ttshape{9}{1000}
1225 \setfont\ninettsl\ttslshape{10}{900}
1226 \setfont\indrm\rmshape{9}{1000}
1227 \setfont\indit\itshape{9}{1000}
1228 \setfont\indsl\slshape{9}{1000}
1229 \let\indtt=\ninett
1230 \let\indttsl=\ninettsl
1231 \let\indsf=\indrm
1232 \let\indbf=\indrm
1233 \setfont\indsc\scshape{10}{900}
1234 \font\indi=cmmi9
1235 \font\indsy=cmsy9
1237 % Fonts for title page:
1238 \setfont\titlerm\rmbshape{12}{\magstep3}
1239 \setfont\titleit\itbshape{10}{\magstep4}
1240 \setfont\titlesl\slbshape{10}{\magstep4}
1241 \setfont\titlett\ttbshape{12}{\magstep3}
1242 \setfont\titlettsl\ttslshape{10}{\magstep4}
1243 \setfont\titlesf\sfbshape{17}{\magstep1}
1244 \let\titlebf=\titlerm
1245 \setfont\titlesc\scbshape{10}{\magstep4}
1246 \font\titlei=cmmi12 scaled \magstep3
1247 \font\titlesy=cmsy10 scaled \magstep4
1248 \def\authorrm{\secrm}
1250 % Chapter (and unnumbered) fonts (17.28pt).
1251 \setfont\chaprm\rmbshape{12}{\magstep2}
1252 \setfont\chapit\itbshape{10}{\magstep3}
1253 \setfont\chapsl\slbshape{10}{\magstep3}
1254 \setfont\chaptt\ttbshape{12}{\magstep2}
1255 \setfont\chapttsl\ttslshape{10}{\magstep3}
1256 \setfont\chapsf\sfbshape{17}{1000}
1257 \let\chapbf=\chaprm
1258 \setfont\chapsc\scbshape{10}{\magstep3}
1259 \font\chapi=cmmi12 scaled \magstep2
1260 \font\chapsy=cmsy10 scaled \magstep3
1262 % Section fonts (14.4pt).
1263 \setfont\secrm\rmbshape{12}{\magstep1}
1264 \setfont\secit\itbshape{10}{\magstep2}
1265 \setfont\secsl\slbshape{10}{\magstep2}
1266 \setfont\sectt\ttbshape{12}{\magstep1}
1267 \setfont\secttsl\ttslshape{10}{\magstep2}
1268 \setfont\secsf\sfbshape{12}{\magstep1}
1269 \let\secbf\secrm
1270 \setfont\secsc\scbshape{10}{\magstep2}
1271 \font\seci=cmmi12 scaled \magstep1
1272 \font\secsy=cmsy10 scaled \magstep2
1274 % \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
1275 % \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
1276 % \setfont\ssecsl\slshape{10}{\magstep1}
1277 % \setfont\ssectt\ttshape{10}{\magstep1}
1278 % \setfont\ssecsf\sfshape{10}{\magstep1}
1280 %\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
1281 %\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
1282 %\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
1283 %\setfont\ssectt\ttshape{10}{1315}
1284 %\setfont\ssecsf\sfshape{10}{1315}
1286 %\let\ssecbf=\ssecrm
1288 % Subsection fonts (13.15pt).
1289 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1290 \setfont\ssecit\itbshape{10}{1315}
1291 \setfont\ssecsl\slbshape{10}{1315}
1292 \setfont\ssectt\ttbshape{12}{\magstephalf}
1293 \setfont\ssecttsl\ttslshape{10}{1315}
1294 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1295 \let\ssecbf\ssecrm
1296 \setfont\ssecsc\scbshape{10}{\magstep1}
1297 \font\sseci=cmmi12 scaled \magstephalf
1298 \font\ssecsy=cmsy10 scaled 1315
1299 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1300 % but that is not a standard magnification.
1302 % In order for the font changes to affect most math symbols and letters,
1303 % we have to define the \textfont of the standard families. Since
1304 % texinfo doesn't allow for producing subscripts and superscripts, we
1305 % don't bother to reset \scriptfont and \scriptscriptfont (which would
1306 % also require loading a lot more fonts).
1308 \def\resetmathfonts{%
1309 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1310 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1311 \textfont\ttfam = \tentt \textfont\sffam = \tensf
1315 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1316 % of just \STYLE. We do this so that font changes will continue to work
1317 % in math mode, where it is the current \fam that is relevant in most
1318 % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
1319 % \tenbf}, for example. By redefining \tenbf, we obviate the need to
1320 % redefine \bf itself.
1321 \def\textfonts{%
1322 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1323 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1324 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1325 \resetmathfonts}
1326 \def\titlefonts{%
1327 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
1328 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
1329 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
1330 \let\tenttsl=\titlettsl
1331 \resetmathfonts \setleading{25pt}}
1332 \def\titlefont#1{{\titlefonts\rm #1}}
1333 \def\chapfonts{%
1334 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1335 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1336 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1337 \resetmathfonts \setleading{19pt}}
1338 \def\secfonts{%
1339 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1340 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1341 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1342 \resetmathfonts \setleading{16pt}}
1343 \def\subsecfonts{%
1344 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1345 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1346 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1347 \resetmathfonts \setleading{15pt}}
1348 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1349 \def\indexfonts{%
1350 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
1351 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
1352 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
1353 \resetmathfonts \setleading{12pt}}
1355 % Set up the default fonts, so we can use them for creating boxes.
1357 \textfonts
1359 % Define these so they can be easily changed for other fonts.
1360 \def\angleleft{$\langle$}
1361 \def\angleright{$\rangle$}
1363 % Count depth in font-changes, for error checks
1364 \newcount\fontdepth \fontdepth=0
1366 % Fonts for short table of contents.
1367 \setfont\shortcontrm\rmshape{12}{1000}
1368 \setfont\shortcontbf\bxshape{12}{1000}
1369 \setfont\shortcontsl\slshape{12}{1000}
1371 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1372 %% serif) and @ii for TeX italic
1374 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1375 % unless the following character is such as not to need one.
1376 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1377 \def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx}
1378 \def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx}
1380 \let\i=\smartitalic
1381 \let\var=\smartslanted
1382 \let\dfn=\smartslanted
1383 \let\emph=\smartitalic
1384 \let\cite=\smartslanted
1386 \def\b#1{{\bf #1}}
1387 \let\strong=\b
1389 % We can't just use \exhyphenpenalty, because that only has effect at
1390 % the end of a paragraph. Restore normal hyphenation at the end of the
1391 % group within which \nohyphenation is presumably called.
1393 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1394 \def\restorehyphenation{\hyphenchar\font = `- }
1396 \def\t#1{%
1397 {\tt \rawbackslash \frenchspacing #1}%
1398 \null
1400 \let\ttfont=\t
1401 \def\samp#1{`\tclose{#1}'\null}
1402 \setfont\smallrm\rmshape{8}{1000}
1403 \font\smallsy=cmsy9
1404 \def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
1405 \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
1406 \vbox{\hrule\kern-0.4pt
1407 \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
1408 \kern-0.4pt\hrule}%
1409 \kern-.06em\raise0.4pt\hbox{\angleright}}}}
1410 % The old definition, with no lozenge:
1411 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1412 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1414 % @file, @option are the same as @samp.
1415 \let\file=\samp
1416 \let\option=\samp
1418 % @code is a modification of @t,
1419 % which makes spaces the same size as normal in the surrounding text.
1420 \def\tclose#1{%
1422 % Change normal interword space to be same as for the current font.
1423 \spaceskip = \fontdimen2\font
1425 % Switch to typewriter.
1428 % But `\ ' produces the large typewriter interword space.
1429 \def\ {{\spaceskip = 0pt{} }}%
1431 % Turn off hyphenation.
1432 \nohyphenation
1434 \rawbackslash
1435 \frenchspacing
1438 \null
1441 % We *must* turn on hyphenation at `-' and `_' in \code.
1442 % Otherwise, it is too hard to avoid overfull hboxes
1443 % in the Emacs manual, the Library manual, etc.
1445 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1446 % both hyphenation at - and hyphenation within words.
1447 % We must therefore turn them both off (\tclose does that)
1448 % and arrange explicitly to hyphenate at a dash.
1449 % -- rms.
1451 \catcode`\-=\active
1452 \catcode`\_=\active
1454 \global\def\code{\begingroup
1455 \catcode`\-=\active \let-\codedash
1456 \catcode`\_=\active \let_\codeunder
1457 \codex
1460 % If we end up with any active - characters when handling the index,
1461 % just treat them as a normal -.
1462 \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
1465 \def\realdash{-}
1466 \def\codedash{-\discretionary{}{}{}}
1467 \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
1468 \def\codex #1{\tclose{#1}\endgroup}
1470 %\let\exp=\tclose %Was temporary
1472 % @kbd is like @code, except that if the argument is just one @key command,
1473 % then @kbd has no effect.
1475 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
1476 % `example' (@kbd uses ttsl only inside of @example and friends),
1477 % or `code' (@kbd uses normal tty font always).
1478 \def\kbdinputstyle{\parsearg\kbdinputstylexxx}
1479 \def\kbdinputstylexxx#1{%
1480 \def\arg{#1}%
1481 \ifx\arg\worddistinct
1482 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
1483 \else\ifx\arg\wordexample
1484 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
1485 \else\ifx\arg\wordcode
1486 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
1487 \fi\fi\fi
1489 \def\worddistinct{distinct}
1490 \def\wordexample{example}
1491 \def\wordcode{code}
1493 % Default is kbdinputdistinct. (Too much of a hassle to call the macro,
1494 % the catcodes are wrong for parsearg to work.)
1495 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
1497 \def\xkey{\key}
1498 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1499 \ifx\one\xkey\ifx\threex\three \key{#2}%
1500 \else{\tclose{\kbdfont\look}}\fi
1501 \else{\tclose{\kbdfont\look}}\fi}
1503 % For @url, @env, @command quotes seem unnecessary, so use \code.
1504 \let\url=\code
1505 \let\env=\code
1506 \let\command=\code
1508 % @uref (abbreviation for `urlref') takes an optional second argument
1509 % specifying the text to display. First (mandatory) arg is the url.
1510 % Perhaps eventually put in a hypertex \special here.
1512 \def\uref#1{\urefxxx #1,,\finish}
1513 \def\urefxxx#1,#2,#3\finish{%
1514 \setbox0 = \hbox{\ignorespaces #2}%
1515 \ifdim\wd0 > 0pt
1516 \unhbox0\ (\code{#1})%
1517 \else
1518 \code{#1}%
1522 % rms does not like the angle brackets --karl, 17may97.
1523 % So now @email is just like @uref.
1524 %\def\email#1{\angleleft{\tt #1}\angleright}
1525 \let\email=\uref
1527 % Check if we are currently using a typewriter font. Since all the
1528 % Computer Modern typewriter fonts have zero interword stretch (and
1529 % shrink), and it is reasonable to expect all typewriter fonts to have
1530 % this property, we can check that font parameter.
1532 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1534 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1535 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
1537 \def\dmn#1{\thinspace #1}
1539 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1541 % @l was never documented to mean ``switch to the Lisp font'',
1542 % and it is not used as such in any manual I can find. We need it for
1543 % Polish suppressed-l. --karl, 22sep96.
1544 %\def\l#1{{\li #1}\null}
1546 % Explicit font changes: @r, @sc, undocumented @ii.
1547 \def\r#1{{\rm #1}} % roman font
1548 \def\sc#1{{\smallcaps#1}} % smallcaps font
1549 \def\ii#1{{\it #1}} % italic font
1551 % @acronym downcases the argument and prints in smallcaps.
1552 \def\acronym#1{{\smallcaps \lowercase{#1}}}
1554 % @pounds{} is a sterling sign.
1555 \def\pounds{{\it\$}}
1558 \message{page headings,}
1560 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1561 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1563 % First the title page. Must do @settitle before @titlepage.
1564 \newif\ifseenauthor
1565 \newif\iffinishedtitlepage
1567 % Do an implicit @contents or @shortcontents after @end titlepage if the
1568 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
1570 \newif\ifsetcontentsaftertitlepage
1571 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
1572 \newif\ifsetshortcontentsaftertitlepage
1573 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
1575 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1576 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1577 \endgroup\page\hbox{}\page}
1579 \def\titlepage{\begingroup \parindent=0pt \textfonts
1580 \let\subtitlerm=\tenrm
1581 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1583 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1585 % Leave some space at the very top of the page.
1586 \vglue\titlepagetopglue
1588 % Now you can print the title using @title.
1589 \def\title{\parsearg\titlezzz}%
1590 \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
1591 % print a rule at the page bottom also.
1592 \finishedtitlepagefalse
1593 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1594 % No rule at page bottom unless we print one at the top with @title.
1595 \finishedtitlepagetrue
1597 % Now you can put text using @subtitle.
1598 \def\subtitle{\parsearg\subtitlezzz}%
1599 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1601 % @author should come last, but may come many times.
1602 \def\author{\parsearg\authorzzz}%
1603 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1604 {\authorfont \leftline{##1}}}%
1606 % Most title ``pages'' are actually two pages long, with space
1607 % at the top of the second. We don't want the ragged left on the second.
1608 \let\oldpage = \page
1609 \def\page{%
1610 \iffinishedtitlepage\else
1611 \finishtitlepage
1613 \oldpage
1614 \let\page = \oldpage
1615 \hbox{}}%
1616 % \def\page{\oldpage \hbox{}}
1619 \def\Etitlepage{%
1620 \iffinishedtitlepage\else
1621 \finishtitlepage
1623 % It is important to do the page break before ending the group,
1624 % because the headline and footline are only empty inside the group.
1625 % If we use the new definition of \page, we always get a blank page
1626 % after the title page, which we certainly don't want.
1627 \oldpage
1628 \endgroup
1630 % If they want short, they certainly want long too.
1631 \ifsetshortcontentsaftertitlepage
1632 \shortcontents
1633 \contents
1634 \global\let\shortcontents = \relax
1635 \global\let\contents = \relax
1638 \ifsetcontentsaftertitlepage
1639 \contents
1640 \global\let\contents = \relax
1641 \global\let\shortcontents = \relax
1644 \HEADINGSon
1647 \def\finishtitlepage{%
1648 \vskip4pt \hrule height 2pt width \hsize
1649 \vskip\titlepagebottomglue
1650 \finishedtitlepagetrue
1653 %%% Set up page headings and footings.
1655 \let\thispage=\folio
1657 \newtoks\evenheadline % headline on even pages
1658 \newtoks\oddheadline % headline on odd pages
1659 \newtoks\evenfootline % footline on even pages
1660 \newtoks\oddfootline % footline on odd pages
1662 % Now make Tex use those variables
1663 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1664 \else \the\evenheadline \fi}}
1665 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1666 \else \the\evenfootline \fi}\HEADINGShook}
1667 \let\HEADINGShook=\relax
1669 % Commands to set those variables.
1670 % For example, this is what @headings on does
1671 % @evenheading @thistitle|@thispage|@thischapter
1672 % @oddheading @thischapter|@thispage|@thistitle
1673 % @evenfooting @thisfile||
1674 % @oddfooting ||@thisfile
1676 \def\evenheading{\parsearg\evenheadingxxx}
1677 \def\oddheading{\parsearg\oddheadingxxx}
1678 \def\everyheading{\parsearg\everyheadingxxx}
1680 \def\evenfooting{\parsearg\evenfootingxxx}
1681 \def\oddfooting{\parsearg\oddfootingxxx}
1682 \def\everyfooting{\parsearg\everyfootingxxx}
1684 {\catcode`\@=0 %
1686 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1687 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1688 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1690 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1691 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1692 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1694 \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
1696 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1697 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1698 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1700 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1701 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1702 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
1704 % Leave some space for the footline. Hopefully ok to assume
1705 % @evenfooting will not be used by itself.
1706 \global\advance\pageheight by -\baselineskip
1707 \global\advance\vsize by -\baselineskip
1710 \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
1712 }% unbind the catcode of @.
1714 % @headings double turns headings on for double-sided printing.
1715 % @headings single turns headings on for single-sided printing.
1716 % @headings off turns them off.
1717 % @headings on same as @headings double, retained for compatibility.
1718 % @headings after turns on double-sided headings after this page.
1719 % @headings doubleafter turns on double-sided headings after this page.
1720 % @headings singleafter turns on single-sided headings after this page.
1721 % By default, they are off at the start of a document,
1722 % and turned `on' after @end titlepage.
1724 \def\headings #1 {\csname HEADINGS#1\endcsname}
1726 \def\HEADINGSoff{
1727 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1728 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1729 \HEADINGSoff
1730 % When we turn headings on, set the page number to 1.
1731 % For double-sided printing, put current file name in lower left corner,
1732 % chapter name on inside top of right hand pages, document
1733 % title on inside top of left hand pages, and page numbers on outside top
1734 % edge of all pages.
1735 \def\HEADINGSdouble{
1736 \global\pageno=1
1737 \global\evenfootline={\hfil}
1738 \global\oddfootline={\hfil}
1739 \global\evenheadline={\line{\folio\hfil\thistitle}}
1740 \global\oddheadline={\line{\thischapter\hfil\folio}}
1741 \global\let\contentsalignmacro = \chapoddpage
1743 \let\contentsalignmacro = \chappager
1745 % For single-sided printing, chapter title goes across top left of page,
1746 % page number on top right.
1747 \def\HEADINGSsingle{
1748 \global\pageno=1
1749 \global\evenfootline={\hfil}
1750 \global\oddfootline={\hfil}
1751 \global\evenheadline={\line{\thischapter\hfil\folio}}
1752 \global\oddheadline={\line{\thischapter\hfil\folio}}
1753 \global\let\contentsalignmacro = \chappager
1755 \def\HEADINGSon{\HEADINGSdouble}
1757 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1758 \let\HEADINGSdoubleafter=\HEADINGSafter
1759 \def\HEADINGSdoublex{%
1760 \global\evenfootline={\hfil}
1761 \global\oddfootline={\hfil}
1762 \global\evenheadline={\line{\folio\hfil\thistitle}}
1763 \global\oddheadline={\line{\thischapter\hfil\folio}}
1764 \global\let\contentsalignmacro = \chapoddpage
1767 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1768 \def\HEADINGSsinglex{%
1769 \global\evenfootline={\hfil}
1770 \global\oddfootline={\hfil}
1771 \global\evenheadline={\line{\thischapter\hfil\folio}}
1772 \global\oddheadline={\line{\thischapter\hfil\folio}}
1773 \global\let\contentsalignmacro = \chappager
1776 % Subroutines used in generating headings
1777 % Produces Day Month Year style of output.
1778 \def\today{%
1779 \number\day\space
1780 \ifcase\month
1781 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
1782 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
1783 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
1785 \space\number\year}
1787 % @settitle line... specifies the title of the document, for headings.
1788 % It generates no output of its own.
1789 \def\thistitle{\putwordNoTitle}
1790 \def\settitle{\parsearg\settitlezzz}
1791 \def\settitlezzz #1{\gdef\thistitle{#1}}
1794 \message{tables,}
1795 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1797 % default indentation of table text
1798 \newdimen\tableindent \tableindent=.8in
1799 % default indentation of @itemize and @enumerate text
1800 \newdimen\itemindent \itemindent=.3in
1801 % margin between end of table item and start of table text.
1802 \newdimen\itemmargin \itemmargin=.1in
1804 % used internally for \itemindent minus \itemmargin
1805 \newdimen\itemmax
1807 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1808 % these defs.
1809 % They also define \itemindex
1810 % to index the item name in whatever manner is desired (perhaps none).
1812 \newif\ifitemxneedsnegativevskip
1814 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1816 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1817 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1819 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1820 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1822 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1823 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1825 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1826 \itemzzz {#1}}
1828 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1829 \itemzzz {#1}}
1831 \def\itemzzz #1{\begingroup %
1832 \advance\hsize by -\rightskip
1833 \advance\hsize by -\tableindent
1834 \setbox0=\hbox{\itemfont{#1}}%
1835 \itemindex{#1}%
1836 \nobreak % This prevents a break before @itemx.
1838 % If the item text does not fit in the space we have, put it on a line
1839 % by itself, and do not allow a page break either before or after that
1840 % line. We do not start a paragraph here because then if the next
1841 % command is, e.g., @kindex, the whatsit would get put into the
1842 % horizontal list on a line by itself, resulting in extra blank space.
1843 \ifdim \wd0>\itemmax
1845 % Make this a paragraph so we get the \parskip glue and wrapping,
1846 % but leave it ragged-right.
1847 \begingroup
1848 \advance\leftskip by-\tableindent
1849 \advance\hsize by\tableindent
1850 \advance\rightskip by0pt plus1fil
1851 \leavevmode\unhbox0\par
1852 \endgroup
1854 % We're going to be starting a paragraph, but we don't want the
1855 % \parskip glue -- logically it's part of the @item we just started.
1856 \nobreak \vskip-\parskip
1858 % Stop a page break at the \parskip glue coming up. Unfortunately
1859 % we can't prevent a possible page break at the following
1860 % \baselineskip glue.
1861 \nobreak
1862 \endgroup
1863 \itemxneedsnegativevskipfalse
1864 \else
1865 % The item text fits into the space. Start a paragraph, so that the
1866 % following text (if any) will end up on the same line.
1867 \noindent
1868 % Do this with kerns and \unhbox so that if there is a footnote in
1869 % the item text, it can migrate to the main vertical list and
1870 % eventually be printed.
1871 \nobreak\kern-\tableindent
1872 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
1873 \unhbox0
1874 \nobreak\kern\dimen0
1875 \endgroup
1876 \itemxneedsnegativevskiptrue
1880 \def\item{\errmessage{@item while not in a table}}
1881 \def\itemx{\errmessage{@itemx while not in a table}}
1882 \def\kitem{\errmessage{@kitem while not in a table}}
1883 \def\kitemx{\errmessage{@kitemx while not in a table}}
1884 \def\xitem{\errmessage{@xitem while not in a table}}
1885 \def\xitemx{\errmessage{@xitemx while not in a table}}
1887 % Contains a kludge to get @end[description] to work.
1888 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1890 % @table, @ftable, @vtable.
1891 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1892 {\obeylines\obeyspaces%
1893 \gdef\tablex #1^^M{%
1894 \tabley\dontindex#1 \endtabley}}
1896 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1897 {\obeylines\obeyspaces%
1898 \gdef\ftablex #1^^M{%
1899 \tabley\fnitemindex#1 \endtabley
1900 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1901 \let\Etable=\relax}}
1903 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1904 {\obeylines\obeyspaces%
1905 \gdef\vtablex #1^^M{%
1906 \tabley\vritemindex#1 \endtabley
1907 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1908 \let\Etable=\relax}}
1910 \def\dontindex #1{}
1911 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1912 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1914 {\obeyspaces %
1915 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1916 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1918 \def\tablez #1#2#3#4#5#6{%
1919 \aboveenvbreak %
1920 \begingroup %
1921 \def\Edescription{\Etable}% Necessary kludge.
1922 \let\itemindex=#1%
1923 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1924 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1925 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1926 \def\itemfont{#2}%
1927 \itemmax=\tableindent %
1928 \advance \itemmax by -\itemmargin %
1929 \advance \leftskip by \tableindent %
1930 \exdentamount=\tableindent
1931 \parindent = 0pt
1932 \parskip = \smallskipamount
1933 \ifdim \parskip=0pt \parskip=2pt \fi%
1934 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1935 \let\item = \internalBitem %
1936 \let\itemx = \internalBitemx %
1937 \let\kitem = \internalBkitem %
1938 \let\kitemx = \internalBkitemx %
1939 \let\xitem = \internalBxitem %
1940 \let\xitemx = \internalBxitemx %
1943 % This is the counter used by @enumerate, which is really @itemize
1945 \newcount \itemno
1947 \def\itemize{\parsearg\itemizezzz}
1949 \def\itemizezzz #1{%
1950 \begingroup % ended by the @end itemize
1951 \itemizey {#1}{\Eitemize}
1954 \def\itemizey #1#2{%
1955 \aboveenvbreak %
1956 \itemmax=\itemindent %
1957 \advance \itemmax by -\itemmargin %
1958 \advance \leftskip by \itemindent %
1959 \exdentamount=\itemindent
1960 \parindent = 0pt %
1961 \parskip = \smallskipamount %
1962 \ifdim \parskip=0pt \parskip=2pt \fi%
1963 \def#2{\endgraf\afterenvbreak\endgroup}%
1964 \def\itemcontents{#1}%
1965 \let\item=\itemizeitem}
1967 % Set sfcode to normal for the chars that usually have another value.
1968 % These are `.?!:;,'
1969 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1970 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1972 % \splitoff TOKENS\endmark defines \first to be the first token in
1973 % TOKENS, and \rest to be the remainder.
1975 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1977 % Allow an optional argument of an uppercase letter, lowercase letter,
1978 % or number, to specify the first label in the enumerated list. No
1979 % argument is the same as `1'.
1981 \def\enumerate{\parsearg\enumeratezzz}
1982 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1983 \def\enumeratey #1 #2\endenumeratey{%
1984 \begingroup % ended by the @end enumerate
1986 % If we were given no argument, pretend we were given `1'.
1987 \def\thearg{#1}%
1988 \ifx\thearg\empty \def\thearg{1}\fi
1990 % Detect if the argument is a single token. If so, it might be a
1991 % letter. Otherwise, the only valid thing it can be is a number.
1992 % (We will always have one token, because of the test we just made.
1993 % This is a good thing, since \splitoff doesn't work given nothing at
1994 % all -- the first parameter is undelimited.)
1995 \expandafter\splitoff\thearg\endmark
1996 \ifx\rest\empty
1997 % Only one token in the argument. It could still be anything.
1998 % A ``lowercase letter'' is one whose \lccode is nonzero.
1999 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
2000 % not equal to itself.
2001 % Otherwise, we assume it's a number.
2003 % We need the \relax at the end of the \ifnum lines to stop TeX from
2004 % continuing to look for a <number>.
2006 \ifnum\lccode\expandafter`\thearg=0\relax
2007 \numericenumerate % a number (we hope)
2008 \else
2009 % It's a letter.
2010 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
2011 \lowercaseenumerate % lowercase letter
2012 \else
2013 \uppercaseenumerate % uppercase letter
2016 \else
2017 % Multiple tokens in the argument. We hope it's a number.
2018 \numericenumerate
2022 % An @enumerate whose labels are integers. The starting integer is
2023 % given in \thearg.
2025 \def\numericenumerate{%
2026 \itemno = \thearg
2027 \startenumeration{\the\itemno}%
2030 % The starting (lowercase) letter is in \thearg.
2031 \def\lowercaseenumerate{%
2032 \itemno = \expandafter`\thearg
2033 \startenumeration{%
2034 % Be sure we're not beyond the end of the alphabet.
2035 \ifnum\itemno=0
2036 \errmessage{No more lowercase letters in @enumerate; get a bigger
2037 alphabet}%
2039 \char\lccode\itemno
2043 % The starting (uppercase) letter is in \thearg.
2044 \def\uppercaseenumerate{%
2045 \itemno = \expandafter`\thearg
2046 \startenumeration{%
2047 % Be sure we're not beyond the end of the alphabet.
2048 \ifnum\itemno=0
2049 \errmessage{No more uppercase letters in @enumerate; get a bigger
2050 alphabet}
2052 \char\uccode\itemno
2056 % Call itemizey, adding a period to the first argument and supplying the
2057 % common last two arguments. Also subtract one from the initial value in
2058 % \itemno, since @item increments \itemno.
2060 \def\startenumeration#1{%
2061 \advance\itemno by -1
2062 \itemizey{#1.}\Eenumerate\flushcr
2065 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
2066 % to @enumerate.
2068 \def\alphaenumerate{\enumerate{a}}
2069 \def\capsenumerate{\enumerate{A}}
2070 \def\Ealphaenumerate{\Eenumerate}
2071 \def\Ecapsenumerate{\Eenumerate}
2073 % Definition of @item while inside @itemize.
2075 \def\itemizeitem{%
2076 \advance\itemno by 1
2077 {\let\par=\endgraf \smallbreak}%
2078 \ifhmode \errmessage{In hmode at itemizeitem}\fi
2079 {\parskip=0in \hskip 0pt
2080 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
2081 \vadjust{\penalty 1200}}%
2082 \flushcr}
2084 % @multitable macros
2085 % Amy Hendrickson, 8/18/94, 3/6/96
2087 % @multitable ... @end multitable will make as many columns as desired.
2088 % Contents of each column will wrap at width given in preamble. Width
2089 % can be specified either with sample text given in a template line,
2090 % or in percent of \hsize, the current width of text on page.
2092 % Table can continue over pages but will only break between lines.
2094 % To make preamble:
2096 % Either define widths of columns in terms of percent of \hsize:
2097 % @multitable @columnfractions .25 .3 .45
2098 % @item ...
2100 % Numbers following @columnfractions are the percent of the total
2101 % current hsize to be used for each column. You may use as many
2102 % columns as desired.
2105 % Or use a template:
2106 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2107 % @item ...
2108 % using the widest term desired in each column.
2110 % For those who want to use more than one line's worth of words in
2111 % the preamble, break the line within one argument and it
2112 % will parse correctly, i.e.,
2114 % @multitable {Column 1 template} {Column 2 template} {Column 3
2115 % template}
2116 % Not:
2117 % @multitable {Column 1 template} {Column 2 template}
2118 % {Column 3 template}
2120 % Each new table line starts with @item, each subsequent new column
2121 % starts with @tab. Empty columns may be produced by supplying @tab's
2122 % with nothing between them for as many times as empty columns are needed,
2123 % ie, @tab@tab@tab will produce two empty columns.
2125 % @item, @tab, @multitable or @end multitable do not need to be on their
2126 % own lines, but it will not hurt if they are.
2128 % Sample multitable:
2130 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2131 % @item first col stuff @tab second col stuff @tab third col
2132 % @item
2133 % first col stuff
2134 % @tab
2135 % second col stuff
2136 % @tab
2137 % third col
2138 % @item first col stuff @tab second col stuff
2139 % @tab Many paragraphs of text may be used in any column.
2141 % They will wrap at the width determined by the template.
2142 % @item@tab@tab This will be in third column.
2143 % @end multitable
2145 % Default dimensions may be reset by user.
2146 % @multitableparskip is vertical space between paragraphs in table.
2147 % @multitableparindent is paragraph indent in table.
2148 % @multitablecolmargin is horizontal space to be left between columns.
2149 % @multitablelinespace is space to leave between table items, baseline
2150 % to baseline.
2151 % 0pt means it depends on current normal line spacing.
2153 \newskip\multitableparskip
2154 \newskip\multitableparindent
2155 \newdimen\multitablecolspace
2156 \newskip\multitablelinespace
2157 \multitableparskip=0pt
2158 \multitableparindent=6pt
2159 \multitablecolspace=12pt
2160 \multitablelinespace=0pt
2162 % Macros used to set up halign preamble:
2164 \let\endsetuptable\relax
2165 \def\xendsetuptable{\endsetuptable}
2166 \let\columnfractions\relax
2167 \def\xcolumnfractions{\columnfractions}
2168 \newif\ifsetpercent
2170 % #1 is the part of the @columnfraction before the decimal point, which
2171 % is presumably either 0 or the empty string (but we don't check, we
2172 % just throw it away). #2 is the decimal part, which we use as the
2173 % percent of \hsize for this column.
2174 \def\pickupwholefraction#1.#2 {%
2175 \global\advance\colcount by 1
2176 \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
2177 \setuptable
2180 \newcount\colcount
2181 \def\setuptable#1{%
2182 \def\firstarg{#1}%
2183 \ifx\firstarg\xendsetuptable
2184 \let\go = \relax
2185 \else
2186 \ifx\firstarg\xcolumnfractions
2187 \global\setpercenttrue
2188 \else
2189 \ifsetpercent
2190 \let\go\pickupwholefraction
2191 \else
2192 \global\advance\colcount by 1
2193 \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator;
2194 % typically that is always in the input, anyway.
2195 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2198 \ifx\go\pickupwholefraction
2199 % Put the argument back for the \pickupwholefraction call, so
2200 % we'll always have a period there to be parsed.
2201 \def\go{\pickupwholefraction#1}%
2202 \else
2203 \let\go = \setuptable
2204 \fi%
2209 % multitable syntax
2210 \def\tab{&\hskip1sp\relax} % 2/2/96
2211 % tiny skip here makes sure this column space is
2212 % maintained, even if it is never used.
2214 % @multitable ... @end multitable definitions:
2216 \def\multitable{\parsearg\dotable}
2217 \def\dotable#1{\bgroup
2218 \vskip\parskip
2219 \let\item\crcr
2220 \tolerance=9500
2221 \hbadness=9500
2222 \setmultitablespacing
2223 \parskip=\multitableparskip
2224 \parindent=\multitableparindent
2225 \overfullrule=0pt
2226 \global\colcount=0
2227 \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
2229 % To parse everything between @multitable and @item:
2230 \setuptable#1 \endsetuptable
2232 % \everycr will reset column counter, \colcount, at the end of
2233 % each line. Every column entry will cause \colcount to advance by one.
2234 % The table preamble
2235 % looks at the current \colcount to find the correct column width.
2236 \everycr{\noalign{%
2238 % \filbreak%% keeps underfull box messages off when table breaks over pages.
2239 % Maybe so, but it also creates really weird page breaks when the table
2240 % breaks over pages. Wouldn't \vfil be better? Wait until the problem
2241 % manifests itself, so it can be fixed for real --karl.
2242 \global\colcount=0\relax}}%
2244 % This preamble sets up a generic column definition, which will
2245 % be used as many times as user calls for columns.
2246 % \vtop will set a single line and will also let text wrap and
2247 % continue for many paragraphs if desired.
2248 \halign\bgroup&\global\advance\colcount by 1\relax
2249 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2251 % In order to keep entries from bumping into each other
2252 % we will add a \leftskip of \multitablecolspace to all columns after
2253 % the first one.
2255 % If a template has been used, we will add \multitablecolspace
2256 % to the width of each template entry.
2258 % If the user has set preamble in terms of percent of \hsize we will
2259 % use that dimension as the width of the column, and the \leftskip
2260 % will keep entries from bumping into each other. Table will start at
2261 % left margin and final column will justify at right margin.
2263 % Make sure we don't inherit \rightskip from the outer environment.
2264 \rightskip=0pt
2265 \ifnum\colcount=1
2266 % The first column will be indented with the surrounding text.
2267 \advance\hsize by\leftskip
2268 \else
2269 \ifsetpercent \else
2270 % If user has not set preamble in terms of percent of \hsize
2271 % we will advance \hsize by \multitablecolspace.
2272 \advance\hsize by \multitablecolspace
2274 % In either case we will make \leftskip=\multitablecolspace:
2275 \leftskip=\multitablecolspace
2277 % Ignoring space at the beginning and end avoids an occasional spurious
2278 % blank line, when TeX decides to break the line at the space before the
2279 % box from the multistrut, so the strut ends up on a line by itself.
2280 % For example:
2281 % @multitable @columnfractions .11 .89
2282 % @item @code{#}
2283 % @tab Legal holiday which is valid in major parts of the whole country.
2284 % Is automatically provided with highlighting sequences respectively marking
2285 % characters.
2286 \noindent\ignorespaces##\unskip\multistrut}\cr
2289 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2290 % If so, do nothing. If not, give it an appropriate dimension based on
2291 % current baselineskip.
2292 \ifdim\multitablelinespace=0pt
2293 %% strut to put in table in case some entry doesn't have descenders,
2294 %% to keep lines equally spaced
2295 \let\multistrut = \strut
2296 %% Test to see if parskip is larger than space between lines of
2297 %% table. If not, do nothing.
2298 %% If so, set to same dimension as multitablelinespace.
2299 \else
2300 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2301 width0pt\relax} \fi
2302 \ifdim\multitableparskip>\multitablelinespace
2303 \global\multitableparskip=\multitablelinespace
2304 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2305 %% than skip between lines in the table.
2306 \fi%
2307 \ifdim\multitableparskip=0pt
2308 \global\multitableparskip=\multitablelinespace
2309 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2310 %% than skip between lines in the table.
2311 \fi}
2314 \message{indexing,}
2315 % Index generation facilities
2317 % Define \newwrite to be identical to plain tex's \newwrite
2318 % except not \outer, so it can be used within \newindex.
2319 {\catcode`\@=11
2320 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2322 % \newindex {foo} defines an index named foo.
2323 % It automatically defines \fooindex such that
2324 % \fooindex ...rest of line... puts an entry in the index foo.
2325 % It also defines \fooindfile to be the number of the output channel for
2326 % the file that accumulates this index. The file's extension is foo.
2327 % The name of an index should be no more than 2 characters long
2328 % for the sake of vms.
2330 \def\newindex#1{%
2331 \iflinks
2332 \expandafter\newwrite \csname#1indfile\endcsname
2333 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2335 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
2336 \noexpand\doindex{#1}}
2339 % @defindex foo == \newindex{foo}
2341 \def\defindex{\parsearg\newindex}
2343 % Define @defcodeindex, like @defindex except put all entries in @code.
2345 \def\newcodeindex#1{%
2346 \iflinks
2347 \expandafter\newwrite \csname#1indfile\endcsname
2348 \openout \csname#1indfile\endcsname \jobname.#1
2350 \expandafter\xdef\csname#1index\endcsname{%
2351 \noexpand\docodeindex{#1}}
2354 \def\defcodeindex{\parsearg\newcodeindex}
2356 % @synindex foo bar makes index foo feed into index bar.
2357 % Do this instead of @defindex foo if you don't want it as a separate index.
2358 % The \closeout helps reduce unnecessary open files; the limit on the
2359 % Acorn RISC OS is a mere 16 files.
2360 \def\synindex#1 #2 {%
2361 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2362 \expandafter\closeout\csname#1indfile\endcsname
2363 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2364 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2365 \noexpand\doindex{#2}}%
2368 % @syncodeindex foo bar similar, but put all entries made for index foo
2369 % inside @code.
2370 \def\syncodeindex#1 #2 {%
2371 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2372 \expandafter\closeout\csname#1indfile\endcsname
2373 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2374 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2375 \noexpand\docodeindex{#2}}%
2378 % Define \doindex, the driver for all \fooindex macros.
2379 % Argument #1 is generated by the calling \fooindex macro,
2380 % and it is "foo", the name of the index.
2382 % \doindex just uses \parsearg; it calls \doind for the actual work.
2383 % This is because \doind is more useful to call from other macros.
2385 % There is also \dosubind {index}{topic}{subtopic}
2386 % which makes an entry in a two-level index such as the operation index.
2388 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
2389 \def\singleindexer #1{\doind{\indexname}{#1}}
2391 % like the previous two, but they put @code around the argument.
2392 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2393 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2395 \def\indexdummies{%
2396 \def\ { }%
2397 % Take care of the plain tex accent commands.
2398 \def\"{\realbackslash "}%
2399 \def\`{\realbackslash `}%
2400 \def\'{\realbackslash '}%
2401 \def\^{\realbackslash ^}%
2402 \def\~{\realbackslash ~}%
2403 \def\={\realbackslash =}%
2404 \def\b{\realbackslash b}%
2405 \def\c{\realbackslash c}%
2406 \def\d{\realbackslash d}%
2407 \def\u{\realbackslash u}%
2408 \def\v{\realbackslash v}%
2409 \def\H{\realbackslash H}%
2410 % Take care of the plain tex special European modified letters.
2411 \def\oe{\realbackslash oe}%
2412 \def\ae{\realbackslash ae}%
2413 \def\aa{\realbackslash aa}%
2414 \def\OE{\realbackslash OE}%
2415 \def\AE{\realbackslash AE}%
2416 \def\AA{\realbackslash AA}%
2417 \def\o{\realbackslash o}%
2418 \def\O{\realbackslash O}%
2419 \def\l{\realbackslash l}%
2420 \def\L{\realbackslash L}%
2421 \def\ss{\realbackslash ss}%
2422 % Take care of texinfo commands likely to appear in an index entry.
2423 % (Must be a way to avoid doing expansion at all, and thus not have to
2424 % laboriously list every single command here.)
2425 \def\@{@}% will be @@ when we switch to @ as escape char.
2426 % Need these in case \tex is in effect and \{ is a \delimiter again.
2427 % But can't use \lbracecmd and \rbracecmd because texindex assumes
2428 % braces and backslashes are used only as delimiters.
2429 \let\{ = \mylbrace
2430 \let\} = \myrbrace
2431 \def\_{{\realbackslash _}}%
2432 \def\w{\realbackslash w }%
2433 \def\bf{\realbackslash bf }%
2434 %\def\rm{\realbackslash rm }%
2435 \def\sl{\realbackslash sl }%
2436 \def\sf{\realbackslash sf}%
2437 \def\tt{\realbackslash tt}%
2438 \def\gtr{\realbackslash gtr}%
2439 \def\less{\realbackslash less}%
2440 \def\hat{\realbackslash hat}%
2441 \def\TeX{\realbackslash TeX}%
2442 \def\dots{\realbackslash dots }%
2443 \def\result{\realbackslash result}%
2444 \def\equiv{\realbackslash equiv}%
2445 \def\expansion{\realbackslash expansion}%
2446 \def\print{\realbackslash print}%
2447 \def\error{\realbackslash error}%
2448 \def\point{\realbackslash point}%
2449 \def\copyright{\realbackslash copyright}%
2450 \def\tclose##1{\realbackslash tclose {##1}}%
2451 \def\code##1{\realbackslash code {##1}}%
2452 \def\uref##1{\realbackslash uref {##1}}%
2453 \def\url##1{\realbackslash url {##1}}%
2454 \def\env##1{\realbackslash env {##1}}%
2455 \def\command##1{\realbackslash command {##1}}%
2456 \def\option##1{\realbackslash option {##1}}%
2457 \def\dotless##1{\realbackslash dotless {##1}}%
2458 \def\samp##1{\realbackslash samp {##1}}%
2459 \def\,##1{\realbackslash ,{##1}}%
2460 \def\t##1{\realbackslash t {##1}}%
2461 \def\r##1{\realbackslash r {##1}}%
2462 \def\i##1{\realbackslash i {##1}}%
2463 \def\b##1{\realbackslash b {##1}}%
2464 \def\sc##1{\realbackslash sc {##1}}%
2465 \def\cite##1{\realbackslash cite {##1}}%
2466 \def\key##1{\realbackslash key {##1}}%
2467 \def\file##1{\realbackslash file {##1}}%
2468 \def\var##1{\realbackslash var {##1}}%
2469 \def\kbd##1{\realbackslash kbd {##1}}%
2470 \def\dfn##1{\realbackslash dfn {##1}}%
2471 \def\emph##1{\realbackslash emph {##1}}%
2472 \def\acronym##1{\realbackslash acronym {##1}}%
2474 % Handle some cases of @value -- where the variable name does not
2475 % contain - or _, and the value does not contain any
2476 % (non-fully-expandable) commands.
2477 \let\value = \expandablevalue
2479 \unsepspaces
2482 % If an index command is used in an @example environment, any spaces
2483 % therein should become regular spaces in the raw index file, not the
2484 % expansion of \tie (\\leavevmode \penalty \@M \ ).
2485 {\obeyspaces
2486 \gdef\unsepspaces{\obeyspaces\let =\space}}
2488 % \indexnofonts no-ops all font-change commands.
2489 % This is used when outputting the strings to sort the index by.
2490 \def\indexdummyfont#1{#1}
2491 \def\indexdummytex{TeX}
2492 \def\indexdummydots{...}
2494 \def\indexnofonts{%
2495 % Just ignore accents.
2496 \let\,=\indexdummyfont
2497 \let\"=\indexdummyfont
2498 \let\`=\indexdummyfont
2499 \let\'=\indexdummyfont
2500 \let\^=\indexdummyfont
2501 \let\~=\indexdummyfont
2502 \let\==\indexdummyfont
2503 \let\b=\indexdummyfont
2504 \let\c=\indexdummyfont
2505 \let\d=\indexdummyfont
2506 \let\u=\indexdummyfont
2507 \let\v=\indexdummyfont
2508 \let\H=\indexdummyfont
2509 \let\dotless=\indexdummyfont
2510 % Take care of the plain tex special European modified letters.
2511 \def\oe{oe}%
2512 \def\ae{ae}%
2513 \def\aa{aa}%
2514 \def\OE{OE}%
2515 \def\AE{AE}%
2516 \def\AA{AA}%
2517 \def\o{o}%
2518 \def\O{O}%
2519 \def\l{l}%
2520 \def\L{L}%
2521 \def\ss{ss}%
2522 \let\w=\indexdummyfont
2523 \let\t=\indexdummyfont
2524 \let\r=\indexdummyfont
2525 \let\i=\indexdummyfont
2526 \let\b=\indexdummyfont
2527 \let\emph=\indexdummyfont
2528 \let\strong=\indexdummyfont
2529 \let\cite=\indexdummyfont
2530 \let\sc=\indexdummyfont
2531 %Don't no-op \tt, since it isn't a user-level command
2532 % and is used in the definitions of the active chars like <, >, |...
2533 %\let\tt=\indexdummyfont
2534 \let\tclose=\indexdummyfont
2535 \let\code=\indexdummyfont
2536 \let\url=\indexdummyfont
2537 \let\uref=\indexdummyfont
2538 \let\env=\indexdummyfont
2539 \let\command=\indexdummyfont
2540 \let\option=\indexdummyfont
2541 \let\file=\indexdummyfont
2542 \let\samp=\indexdummyfont
2543 \let\kbd=\indexdummyfont
2544 \let\key=\indexdummyfont
2545 \let\var=\indexdummyfont
2546 \let\TeX=\indexdummytex
2547 \let\dots=\indexdummydots
2548 \def\@{@}%
2551 % To define \realbackslash, we must make \ not be an escape.
2552 % We must first make another character (@) an escape
2553 % so we do not become unable to do a definition.
2555 {\catcode`\@=0 \catcode`\\=\other
2556 @gdef@realbackslash{\}}
2558 \let\indexbackslash=0 %overridden during \printindex.
2559 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
2561 % For \ifx comparisons.
2562 \def\emptymacro{\empty}
2564 % Most index entries go through here, but \dosubind is the general case.
2566 \def\doind#1#2{\dosubind{#1}{#2}\empty}
2568 % Workhorse for all \fooindexes.
2569 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
2570 % \empty if called from \doind, as we usually are. The main exception
2571 % is with defuns, which call us directly.
2573 \def\dosubind#1#2#3{%
2574 % Put the index entry in the margin if desired.
2575 \ifx\SETmarginindex\relax\else
2576 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2579 \count255=\lastpenalty
2581 \indexdummies % Must do this here, since \bf, etc expand at this stage
2582 \escapechar=`\\
2584 \let\folio = 0% We will expand all macros now EXCEPT \folio.
2585 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2586 % so it will be output as is; and it will print as backslash.
2588 \def\thirdarg{#3}%
2590 % If third arg is present, precede it with space in sort key.
2591 \ifx\thirdarg\emptymacro
2592 \let\subentry = \empty
2593 \else
2594 \def\subentry{ #3}%
2597 % First process the index-string with all font commands turned off
2598 % to get the string to sort by.
2599 {\indexnofonts \xdef\indexsorttmp{#2\subentry}}%
2601 % Now produce the complete index entry, with both the sort key and the
2602 % original text, including any font commands.
2603 \toks0 = {#2}%
2604 \edef\temp{%
2605 \write\csname#1indfile\endcsname{%
2606 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
2609 % If third (subentry) arg is present, add it to the index string.
2610 \ifx\thirdarg\emptymacro \else
2611 \toks0 = {#3}%
2612 \edef\temp{\temp{\the\toks0}}%
2615 % If a skip is the last thing on the list now, preserve it
2616 % by backing up by \lastskip, doing the \write, then inserting
2617 % the skip again. Otherwise, the whatsit generated by the
2618 % \write will make \lastskip zero. The result is that sequences
2619 % like this:
2620 % @end defun
2621 % @tindex whatever
2622 % @defun ...
2623 % will have extra space inserted, because the \medbreak in the
2624 % start of the @defun won't see the skip inserted by the @end of
2625 % the previous defun.
2627 % But don't do any of this if we're not in vertical mode. We
2628 % don't want to do a \vskip and prematurely end a paragraph.
2630 % Avoid page breaks due to these extra skips, too.
2632 \iflinks
2633 \ifvmode
2634 \skip0 = \lastskip
2635 \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi
2638 \temp % do the write
2641 \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
2645 \penalty\count255
2649 % The index entry written in the file actually looks like
2650 % \entry {sortstring}{page}{topic}
2651 % or
2652 % \entry {sortstring}{page}{topic}{subtopic}
2653 % The texindex program reads in these files and writes files
2654 % containing these kinds of lines:
2655 % \initial {c}
2656 % before the first topic whose initial is c
2657 % \entry {topic}{pagelist}
2658 % for a topic that is used without subtopics
2659 % \primary {topic}
2660 % for the beginning of a topic that is used with subtopics
2661 % \secondary {subtopic}{pagelist}
2662 % for each subtopic.
2664 % Define the user-accessible indexing commands
2665 % @findex, @vindex, @kindex, @cindex.
2667 \def\findex {\fnindex}
2668 \def\kindex {\kyindex}
2669 \def\cindex {\cpindex}
2670 \def\vindex {\vrindex}
2671 \def\tindex {\tpindex}
2672 \def\pindex {\pgindex}
2674 \def\cindexsub {\begingroup\obeylines\cindexsub}
2675 {\obeylines %
2676 \gdef\cindexsub "#1" #2^^M{\endgroup %
2677 \dosubind{cp}{#2}{#1}}}
2679 % Define the macros used in formatting output of the sorted index material.
2681 % @printindex causes a particular index (the ??s file) to get printed.
2682 % It does not print any chapter heading (usually an @unnumbered).
2684 \def\printindex{\parsearg\doprintindex}
2685 \def\doprintindex#1{\begingroup
2686 \dobreak \chapheadingskip{10000}%
2688 \indexfonts \rm
2689 \tolerance = 9500
2690 \indexbreaks
2692 % See if the index file exists and is nonempty.
2693 % Change catcode of @ here so that if the index file contains
2694 % \initial {@}
2695 % as its first line, TeX doesn't complain about mismatched braces
2696 % (because it thinks @} is a control sequence).
2697 \catcode`\@ = 11
2698 \openin 1 \jobname.#1s
2699 \ifeof 1
2700 % \enddoublecolumns gets confused if there is no text in the index,
2701 % and it loses the chapter title and the aux file entries for the
2702 % index. The easiest way to prevent this problem is to make sure
2703 % there is some text.
2704 \putwordIndexNonexistent
2705 \else
2707 % If the index file exists but is empty, then \openin leaves \ifeof
2708 % false. We have to make TeX try to read something from the file, so
2709 % it can discover if there is anything in it.
2710 \read 1 to \temp
2711 \ifeof 1
2712 \putwordIndexIsEmpty
2713 \else
2714 % Index files are almost Texinfo source, but we use \ as the escape
2715 % character. It would be better to use @, but that's too big a change
2716 % to make right now.
2717 \def\indexbackslash{\rawbackslashxx}%
2718 \catcode`\\ = 0
2719 \escapechar = `\\
2720 \begindoublecolumns
2721 \input \jobname.#1s
2722 \enddoublecolumns
2725 \closein 1
2726 \endgroup}
2728 % These macros are used by the sorted index file itself.
2729 % Change them to control the appearance of the index.
2731 \def\initial#1{{%
2732 % Some minor font changes for the special characters.
2733 \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2735 % Remove any glue we may have, we'll be inserting our own.
2736 \removelastskip
2738 % We like breaks before the index initials, so insert a bonus.
2739 \penalty -300
2741 % Typeset the initial. Making this add up to a whole number of
2742 % baselineskips increases the chance of the dots lining up from column
2743 % to column. It still won't often be perfect, because of the stretch
2744 % we need before each entry, but it's better.
2746 % No shrink because it confuses \balancecolumns.
2747 \vskip 1.67\baselineskip plus .5\baselineskip
2748 \leftline{\secbf #1}%
2749 \vskip .33\baselineskip plus .1\baselineskip
2751 % Do our best not to break after the initial.
2752 \nobreak
2755 % This typesets a paragraph consisting of #1, dot leaders, and then #2
2756 % flush to the right margin. It is used for index and table of contents
2757 % entries. The paragraph is indented by \leftskip.
2759 \def\entry#1#2{\begingroup
2761 % Start a new paragraph if necessary, so our assignments below can't
2762 % affect previous text.
2763 \par
2765 % Do not fill out the last line with white space.
2766 \parfillskip = 0in
2768 % No extra space above this paragraph.
2769 \parskip = 0in
2771 % Do not prefer a separate line ending with a hyphen to fewer lines.
2772 \finalhyphendemerits = 0
2774 % \hangindent is only relevant when the entry text and page number
2775 % don't both fit on one line. In that case, bob suggests starting the
2776 % dots pretty far over on the line. Unfortunately, a large
2777 % indentation looks wrong when the entry text itself is broken across
2778 % lines. So we use a small indentation and put up with long leaders.
2780 % \hangafter is reset to 1 (which is the value we want) at the start
2781 % of each paragraph, so we need not do anything with that.
2782 \hangindent = 2em
2784 % When the entry text needs to be broken, just fill out the first line
2785 % with blank space.
2786 \rightskip = 0pt plus1fil
2788 % A bit of stretch before each entry for the benefit of balancing columns.
2789 \vskip 0pt plus1pt
2791 % Start a ``paragraph'' for the index entry so the line breaking
2792 % parameters we've set above will have an effect.
2793 \noindent
2795 % Insert the text of the index entry. TeX will do line-breaking on it.
2797 % The following is kludged to not output a line of dots in the index if
2798 % there are no page numbers. The next person who breaks this will be
2799 % cursed by a Unix daemon.
2800 \def\tempa{{\rm }}%
2801 \def\tempb{#2}%
2802 \edef\tempc{\tempa}%
2803 \edef\tempd{\tempb}%
2804 \ifx\tempc\tempd\ \else%
2806 % If we must, put the page number on a line of its own, and fill out
2807 % this line with blank space. (The \hfil is overwhelmed with the
2808 % fill leaders glue in \indexdotfill if the page number does fit.)
2809 \hfil\penalty50
2810 \null\nobreak\indexdotfill % Have leaders before the page number.
2812 % The `\ ' here is removed by the implicit \unskip that TeX does as
2813 % part of (the primitive) \par. Without it, a spurious underfull
2814 % \hbox ensues.
2815 \ #2% The page number ends the paragraph.
2816 \fi%
2817 \par
2818 \endgroup}
2820 % Like \dotfill except takes at least 1 em.
2821 \def\indexdotfill{\cleaders
2822 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
2824 \def\primary #1{\line{#1\hfil}}
2826 \newskip\secondaryindent \secondaryindent=0.5cm
2828 \def\secondary #1#2{
2829 {\parfillskip=0in \parskip=0in
2830 \hangindent =1in \hangafter=1
2831 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
2834 % Define two-column mode, which we use to typeset indexes.
2835 % Adapted from the TeXbook, page 416, which is to say,
2836 % the manmac.tex format used to print the TeXbook itself.
2837 \catcode`\@=11
2839 \newbox\partialpage
2840 \newdimen\doublecolumnhsize
2842 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
2843 % Grab any single-column material above us.
2844 \output = {%
2846 % Here is a possibility not foreseen in manmac: if we accumulate a
2847 % whole lot of material, we might end up calling this \output
2848 % routine twice in a row (see the doublecol-lose test, which is
2849 % essentially a couple of indexes with @setchapternewpage off). In
2850 % that case we just ship out what is in \partialpage with the normal
2851 % output routine. Generally, \partialpage will be empty when this
2852 % runs and this will be a no-op. See the indexspread.tex test case.
2853 \ifvoid\partialpage \else
2854 \onepageout{\pagecontents\partialpage}%
2857 \global\setbox\partialpage = \vbox{%
2858 % Unvbox the main output page.
2859 \unvbox\PAGE
2860 \kern-\topskip \kern\baselineskip
2863 \eject % run that output routine to set \partialpage
2865 % Use the double-column output routine for subsequent pages.
2866 \output = {\doublecolumnout}%
2868 % Change the page size parameters. We could do this once outside this
2869 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
2870 % format, but then we repeat the same computation. Repeating a couple
2871 % of assignments once per index is clearly meaningless for the
2872 % execution time, so we may as well do it in one place.
2874 % First we halve the line length, less a little for the gutter between
2875 % the columns. We compute the gutter based on the line length, so it
2876 % changes automatically with the paper format. The magic constant
2877 % below is chosen so that the gutter has the same value (well, +-<1pt)
2878 % as it did when we hard-coded it.
2880 % We put the result in a separate register, \doublecolumhsize, so we
2881 % can restore it in \pagesofar, after \hsize itself has (potentially)
2882 % been clobbered.
2884 \doublecolumnhsize = \hsize
2885 \advance\doublecolumnhsize by -.04154\hsize
2886 \divide\doublecolumnhsize by 2
2887 \hsize = \doublecolumnhsize
2889 % Double the \vsize as well. (We don't need a separate register here,
2890 % since nobody clobbers \vsize.)
2891 \advance\vsize by -\ht\partialpage
2892 \vsize = 2\vsize
2895 % The double-column output routine for all double-column pages except
2896 % the last.
2898 \def\doublecolumnout{%
2899 \splittopskip=\topskip \splitmaxdepth=\maxdepth
2900 % Get the available space for the double columns -- the normal
2901 % (undoubled) page height minus any material left over from the
2902 % previous page.
2903 \dimen@ = \vsize
2904 \divide\dimen@ by 2
2906 % box0 will be the left-hand column, box2 the right.
2907 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
2908 \onepageout\pagesofar
2909 \unvbox255
2910 \penalty\outputpenalty
2912 \def\pagesofar{%
2913 % Re-output the contents of the output page -- any previous material,
2914 % followed by the two boxes we just split, in box0 and box2.
2915 \unvbox\partialpage
2917 \hsize = \doublecolumnhsize
2918 \wd0=\hsize \wd2=\hsize
2919 \hbox to\pagewidth{\box0\hfil\box2}%
2921 \def\enddoublecolumns{%
2922 \output = {%
2923 % Split the last of the double-column material. Leave it on the
2924 % current page, no automatic page break.
2925 \balancecolumns
2927 % If we end up splitting too much material for the current page,
2928 % though, there will be another page break right after this \output
2929 % invocation ends. Having called \balancecolumns once, we do not
2930 % want to call it again. Therefore, reset \output to its normal
2931 % definition right away. (We hope \balancecolumns will never be
2932 % called on to balance too much material, but if it is, this makes
2933 % the output somewhat more palatable.)
2934 \global\output = {\onepageout{\pagecontents\PAGE}}%
2936 \eject
2937 \endgroup % started in \begindoublecolumns
2939 % \pagegoal was set to the doubled \vsize above, since we restarted
2940 % the current page. We're now back to normal single-column
2941 % typesetting, so reset \pagegoal to the normal \vsize (after the
2942 % \endgroup where \vsize got restored).
2943 \pagegoal = \vsize
2945 \def\balancecolumns{%
2946 % Called at the end of the double column material.
2947 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
2948 \dimen@ = \ht0
2949 \advance\dimen@ by \topskip
2950 \advance\dimen@ by-\baselineskip
2951 \divide\dimen@ by 2 % target to split to
2952 %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
2953 \splittopskip = \topskip
2954 % Loop until we get a decent breakpoint.
2956 \vbadness = 10000
2957 \loop
2958 \global\setbox3 = \copy0
2959 \global\setbox1 = \vsplit3 to \dimen@
2960 \ifdim\ht3>\dimen@
2961 \global\advance\dimen@ by 1pt
2962 \repeat
2964 %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
2965 \setbox0=\vbox to\dimen@{\unvbox1}%
2966 \setbox2=\vbox to\dimen@{\unvbox3}%
2968 \pagesofar
2970 \catcode`\@ = \other
2973 \message{sectioning,}
2974 % Define chapters, sections, etc.
2976 \newcount\chapno
2977 \newcount\secno \secno=0
2978 \newcount\subsecno \subsecno=0
2979 \newcount\subsubsecno \subsubsecno=0
2981 % This counter is funny since it counts through charcodes of letters A, B, ...
2982 \newcount\appendixno \appendixno = `\@
2983 \def\appendixletter{\char\the\appendixno}
2985 % Each @chapter defines this as the name of the chapter.
2986 % page headings and footings can use it. @section does likewise.
2987 \def\thischapter{}
2988 \def\thissection{}
2990 \newcount\absseclevel % used to calculate proper heading level
2991 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
2993 % @raisesections: treat @section as chapter, @subsection as section, etc.
2994 \def\raisesections{\global\advance\secbase by -1}
2995 \let\up=\raisesections % original BFox name
2997 % @lowersections: treat @chapter as section, @section as subsection, etc.
2998 \def\lowersections{\global\advance\secbase by 1}
2999 \let\down=\lowersections % original BFox name
3001 % Choose a numbered-heading macro
3002 % #1 is heading level if unmodified by @raisesections or @lowersections
3003 % #2 is text for heading
3004 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3005 \ifcase\absseclevel
3006 \chapterzzz{#2}
3008 \seczzz{#2}
3010 \numberedsubseczzz{#2}
3012 \numberedsubsubseczzz{#2}
3013 \else
3014 \ifnum \absseclevel<0
3015 \chapterzzz{#2}
3016 \else
3017 \numberedsubsubseczzz{#2}
3022 % like \numhead, but chooses appendix heading levels
3023 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3024 \ifcase\absseclevel
3025 \appendixzzz{#2}
3027 \appendixsectionzzz{#2}
3029 \appendixsubseczzz{#2}
3031 \appendixsubsubseczzz{#2}
3032 \else
3033 \ifnum \absseclevel<0
3034 \appendixzzz{#2}
3035 \else
3036 \appendixsubsubseczzz{#2}
3041 % like \numhead, but chooses numberless heading levels
3042 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3043 \ifcase\absseclevel
3044 \unnumberedzzz{#2}
3046 \unnumberedseczzz{#2}
3048 \unnumberedsubseczzz{#2}
3050 \unnumberedsubsubseczzz{#2}
3051 \else
3052 \ifnum \absseclevel<0
3053 \unnumberedzzz{#2}
3054 \else
3055 \unnumberedsubsubseczzz{#2}
3060 % @chapter, @appendix, @unnumbered.
3061 \def\thischaptername{No Chapter Title}
3062 \outer\def\chapter{\parsearg\chapteryyy}
3063 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
3064 \def\chapterzzz #1{%
3065 \secno=0 \subsecno=0 \subsubsecno=0
3066 \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
3067 \chapmacro {#1}{\the\chapno}%
3068 \gdef\thissection{#1}%
3069 \gdef\thischaptername{#1}%
3070 % We don't substitute the actual chapter name into \thischapter
3071 % because we don't want its macros evaluated now.
3072 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
3073 \toks0 = {#1}%
3074 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
3075 {\the\chapno}}}%
3076 \temp
3077 \donoderef
3078 \global\let\section = \numberedsec
3079 \global\let\subsection = \numberedsubsec
3080 \global\let\subsubsection = \numberedsubsubsec
3083 \outer\def\appendix{\parsearg\appendixyyy}
3084 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
3085 \def\appendixzzz #1{%
3086 \secno=0 \subsecno=0 \subsubsecno=0
3087 \global\advance \appendixno by 1
3088 \message{\putwordAppendix\space \appendixletter}%
3089 \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
3090 \gdef\thissection{#1}%
3091 \gdef\thischaptername{#1}%
3092 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
3093 \toks0 = {#1}%
3094 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
3095 {\putwordAppendix{} \appendixletter}}}%
3096 \temp
3097 \appendixnoderef
3098 \global\let\section = \appendixsec
3099 \global\let\subsection = \appendixsubsec
3100 \global\let\subsubsection = \appendixsubsubsec
3103 % @centerchap is like @unnumbered, but the heading is centered.
3104 \outer\def\centerchap{\parsearg\centerchapyyy}
3105 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
3107 % @top is like @unnumbered.
3108 \outer\def\top{\parsearg\unnumberedyyy}
3110 \outer\def\unnumbered{\parsearg\unnumberedyyy}
3111 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
3112 \def\unnumberedzzz #1{%
3113 \secno=0 \subsecno=0 \subsubsecno=0
3115 % This used to be simply \message{#1}, but TeX fully expands the
3116 % argument to \message. Therefore, if #1 contained @-commands, TeX
3117 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
3118 % expanded @cite (which turns out to cause errors because \cite is meant
3119 % to be executed, not expanded).
3121 % Anyway, we don't want the fully-expanded definition of @cite to appear
3122 % as a result of the \message, we just want `@cite' itself. We use
3123 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
3124 % simply yielding the contents of <toks register>. (We also do this for
3125 % the toc entries.)
3126 \toks0 = {#1}\message{(\the\toks0)}%
3128 \unnumbchapmacro {#1}%
3129 \gdef\thischapter{#1}\gdef\thissection{#1}%
3130 \toks0 = {#1}%
3131 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}%
3132 \temp
3133 \unnumbnoderef
3134 \global\let\section = \unnumberedsec
3135 \global\let\subsection = \unnumberedsubsec
3136 \global\let\subsubsection = \unnumberedsubsubsec
3139 % Sections.
3140 \outer\def\numberedsec{\parsearg\secyyy}
3141 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
3142 \def\seczzz #1{%
3143 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3144 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
3145 \toks0 = {#1}%
3146 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3147 {\the\chapno}{\the\secno}}}%
3148 \temp
3149 \donoderef
3150 \nobreak
3153 \outer\def\appendixsection{\parsearg\appendixsecyyy}
3154 \outer\def\appendixsec{\parsearg\appendixsecyyy}
3155 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
3156 \def\appendixsectionzzz #1{%
3157 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3158 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
3159 \toks0 = {#1}%
3160 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3161 {\appendixletter}{\the\secno}}}%
3162 \temp
3163 \appendixnoderef
3164 \nobreak
3167 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
3168 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
3169 \def\unnumberedseczzz #1{%
3170 \plainsecheading {#1}\gdef\thissection{#1}%
3171 \toks0 = {#1}%
3172 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}%
3173 \temp
3174 \unnumbnoderef
3175 \nobreak
3178 % Subsections.
3179 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
3180 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
3181 \def\numberedsubseczzz #1{%
3182 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3183 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
3184 \toks0 = {#1}%
3185 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3186 {\the\chapno}{\the\secno}{\the\subsecno}}}%
3187 \temp
3188 \donoderef
3189 \nobreak
3192 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
3193 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
3194 \def\appendixsubseczzz #1{%
3195 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3196 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
3197 \toks0 = {#1}%
3198 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3199 {\appendixletter}{\the\secno}{\the\subsecno}}}%
3200 \temp
3201 \appendixnoderef
3202 \nobreak
3205 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
3206 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
3207 \def\unnumberedsubseczzz #1{%
3208 \plainsubsecheading {#1}\gdef\thissection{#1}%
3209 \toks0 = {#1}%
3210 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry%
3211 {\the\toks0}}}%
3212 \temp
3213 \unnumbnoderef
3214 \nobreak
3217 % Subsubsections.
3218 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
3219 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
3220 \def\numberedsubsubseczzz #1{%
3221 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3222 \subsubsecheading {#1}
3223 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3224 \toks0 = {#1}%
3225 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3226 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3227 \temp
3228 \donoderef
3229 \nobreak
3232 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
3233 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
3234 \def\appendixsubsubseczzz #1{%
3235 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3236 \subsubsecheading {#1}
3237 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3238 \toks0 = {#1}%
3239 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3240 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3241 \temp
3242 \appendixnoderef
3243 \nobreak
3246 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
3247 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
3248 \def\unnumberedsubsubseczzz #1{%
3249 \plainsubsubsecheading {#1}\gdef\thissection{#1}%
3250 \toks0 = {#1}%
3251 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry%
3252 {\the\toks0}}}%
3253 \temp
3254 \unnumbnoderef
3255 \nobreak
3258 % These are variants which are not "outer", so they can appear in @ifinfo.
3259 % Actually, they should now be obsolete; ordinary section commands should work.
3260 \def\infotop{\parsearg\unnumberedzzz}
3261 \def\infounnumbered{\parsearg\unnumberedzzz}
3262 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
3263 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
3264 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
3266 \def\infoappendix{\parsearg\appendixzzz}
3267 \def\infoappendixsec{\parsearg\appendixseczzz}
3268 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
3269 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
3271 \def\infochapter{\parsearg\chapterzzz}
3272 \def\infosection{\parsearg\sectionzzz}
3273 \def\infosubsection{\parsearg\subsectionzzz}
3274 \def\infosubsubsection{\parsearg\subsubsectionzzz}
3276 % These macros control what the section commands do, according
3277 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
3278 % Define them by default for a numbered chapter.
3279 \global\let\section = \numberedsec
3280 \global\let\subsection = \numberedsubsec
3281 \global\let\subsubsection = \numberedsubsubsec
3283 % Define @majorheading, @heading and @subheading
3285 % NOTE on use of \vbox for chapter headings, section headings, and such:
3286 % 1) We use \vbox rather than the earlier \line to permit
3287 % overlong headings to fold.
3288 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
3289 % heading is obnoxious; this forbids it.
3290 % 3) Likewise, headings look best if no \parindent is used, and
3291 % if justification is not attempted. Hence \raggedright.
3294 \def\majorheading{\parsearg\majorheadingzzz}
3295 \def\majorheadingzzz #1{%
3296 {\advance\chapheadingskip by 10pt \chapbreak }%
3297 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3298 \parindent=0pt\raggedright
3299 \rm #1\hfill}}\bigskip \par\penalty 200}
3301 \def\chapheading{\parsearg\chapheadingzzz}
3302 \def\chapheadingzzz #1{\chapbreak %
3303 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3304 \parindent=0pt\raggedright
3305 \rm #1\hfill}}\bigskip \par\penalty 200}
3307 % @heading, @subheading, @subsubheading.
3308 \def\heading{\parsearg\plainsecheading}
3309 \def\subheading{\parsearg\plainsubsecheading}
3310 \def\subsubheading{\parsearg\plainsubsubsecheading}
3312 % These macros generate a chapter, section, etc. heading only
3313 % (including whitespace, linebreaking, etc. around it),
3314 % given all the information in convenient, parsed form.
3316 %%% Args are the skip and penalty (usually negative)
3317 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
3319 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
3321 %%% Define plain chapter starts, and page on/off switching for it
3322 % Parameter controlling skip before chapter headings (if needed)
3324 \newskip\chapheadingskip
3326 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
3327 \def\chappager{\par\vfill\supereject}
3328 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
3330 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
3332 \def\CHAPPAGoff{%
3333 \global\let\contentsalignmacro = \chappager
3334 \global\let\pchapsepmacro=\chapbreak
3335 \global\let\pagealignmacro=\chappager}
3337 \def\CHAPPAGon{%
3338 \global\let\contentsalignmacro = \chappager
3339 \global\let\pchapsepmacro=\chappager
3340 \global\let\pagealignmacro=\chappager
3341 \global\def\HEADINGSon{\HEADINGSsingle}}
3343 \def\CHAPPAGodd{
3344 \global\let\contentsalignmacro = \chapoddpage
3345 \global\let\pchapsepmacro=\chapoddpage
3346 \global\let\pagealignmacro=\chapoddpage
3347 \global\def\HEADINGSon{\HEADINGSdouble}}
3349 \CHAPPAGon
3351 \def\CHAPFplain{
3352 \global\let\chapmacro=\chfplain
3353 \global\let\unnumbchapmacro=\unnchfplain
3354 \global\let\centerchapmacro=\centerchfplain}
3356 % Plain chapter opening.
3357 % #1 is the text, #2 the chapter number or empty if unnumbered.
3358 \def\chfplain#1#2{%
3359 \pchapsepmacro
3361 \chapfonts \rm
3362 \def\chapnum{#2}%
3363 \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
3364 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3365 \hangindent = \wd0 \centerparametersmaybe
3366 \unhbox0 #1\par}%
3368 \nobreak\bigskip % no page break after a chapter title
3369 \nobreak
3372 % Plain opening for unnumbered.
3373 \def\unnchfplain#1{\chfplain{#1}{}}
3375 % @centerchap -- centered and unnumbered.
3376 \let\centerparametersmaybe = \relax
3377 \def\centerchfplain#1{{%
3378 \def\centerparametersmaybe{%
3379 \advance\rightskip by 3\rightskip
3380 \leftskip = \rightskip
3381 \parfillskip = 0pt
3383 \chfplain{#1}{}%
3386 \CHAPFplain % The default
3388 \def\unnchfopen #1{%
3389 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3390 \parindent=0pt\raggedright
3391 \rm #1\hfill}}\bigskip \par\nobreak
3394 \def\chfopen #1#2{\chapoddpage {\chapfonts
3395 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
3396 \par\penalty 5000 %
3399 \def\centerchfopen #1{%
3400 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3401 \parindent=0pt
3402 \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
3405 \def\CHAPFopen{
3406 \global\let\chapmacro=\chfopen
3407 \global\let\unnumbchapmacro=\unnchfopen
3408 \global\let\centerchapmacro=\centerchfopen}
3411 % Section titles.
3412 \newskip\secheadingskip
3413 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
3414 \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
3415 \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
3417 % Subsection titles.
3418 \newskip \subsecheadingskip
3419 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
3420 \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
3421 \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
3423 % Subsubsection titles.
3424 \let\subsubsecheadingskip = \subsecheadingskip
3425 \let\subsubsecheadingbreak = \subsecheadingbreak
3426 \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
3427 \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
3430 % Print any size section title.
3432 % #1 is the section type (sec/subsec/subsubsec), #2 is the section
3433 % number (maybe empty), #3 the text.
3434 \def\sectionheading#1#2#3{%
3436 \expandafter\advance\csname #1headingskip\endcsname by \parskip
3437 \csname #1headingbreak\endcsname
3440 % Switch to the right set of fonts.
3441 \csname #1fonts\endcsname \rm
3443 % Only insert the separating space if we have a section number.
3444 \def\secnum{#2}%
3445 \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
3447 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3448 \hangindent = \wd0 % zero if no section number
3449 \unhbox0 #3}%
3451 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
3455 \message{toc,}
3456 \newwrite\tocfile
3458 % Write an entry to the toc file, opening it if necessary.
3459 % Called from @chapter, etc. We supply {\folio} at the end of the
3460 % argument, which will end up as the last argument to the \...entry macro.
3462 % We open the .toc file here instead of at @setfilename or any other
3463 % given time so that @contents can be put in the document anywhere.
3465 \newif\iftocfileopened
3466 \def\writetocentry#1{%
3467 \iftocfileopened\else
3468 \immediate\openout\tocfile = \jobname.toc
3469 \global\tocfileopenedtrue
3471 \iflinks \write\tocfile{#1{\folio}}\fi
3474 \newskip\contentsrightmargin \contentsrightmargin=1in
3475 \newcount\savepageno
3476 \newcount\lastnegativepageno \lastnegativepageno = -1
3478 % Finish up the main text and prepare to read what we've written
3479 % to \tocfile.
3481 \def\startcontents#1{%
3482 % If @setchapternewpage on, and @headings double, the contents should
3483 % start on an odd page, unlike chapters. Thus, we maintain
3484 % \contentsalignmacro in parallel with \pagealignmacro.
3485 % From: Torbjorn Granlund <tege@matematik.su.se>
3486 \contentsalignmacro
3487 \immediate\closeout\tocfile
3489 % Don't need to put `Contents' or `Short Contents' in the headline.
3490 % It is abundantly clear what they are.
3491 \unnumbchapmacro{#1}\def\thischapter{}%
3492 \savepageno = \pageno
3493 \begingroup % Set up to handle contents files properly.
3494 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
3495 % We can't do this, because then an actual ^ in a section
3496 % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
3497 %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3498 \raggedbottom % Worry more about breakpoints than the bottom.
3499 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3501 % Roman numerals for page numbers.
3502 \ifnum \pageno>0 \pageno = \lastnegativepageno \fi
3506 % Normal (long) toc.
3507 \def\contents{%
3508 \startcontents{\putwordTOC}%
3509 \openin 1 \jobname.toc
3510 \ifeof 1 \else
3511 \closein 1
3512 \input \jobname.toc
3514 \vfill \eject
3515 \contentsalignmacro % in case @setchapternewpage odd is in effect
3516 \endgroup
3517 \lastnegativepageno = \pageno
3518 \pageno = \savepageno
3521 % And just the chapters.
3522 \def\summarycontents{%
3523 \startcontents{\putwordShortTOC}%
3525 \let\chapentry = \shortchapentry
3526 \let\unnumbchapentry = \shortunnumberedentry
3527 % We want a true roman here for the page numbers.
3528 \secfonts
3529 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
3531 \hyphenpenalty = 10000
3532 \advance\baselineskip by 1pt % Open it up a little.
3533 \def\secentry ##1##2##3##4{}
3534 \def\unnumbsecentry ##1##2{}
3535 \def\subsecentry ##1##2##3##4##5{}
3536 \def\unnumbsubsecentry ##1##2{}
3537 \def\subsubsecentry ##1##2##3##4##5##6{}
3538 \def\unnumbsubsubsecentry ##1##2{}
3539 \openin 1 \jobname.toc
3540 \ifeof 1 \else
3541 \closein 1
3542 \input \jobname.toc
3544 \vfill \eject
3545 \contentsalignmacro % in case @setchapternewpage odd is in effect
3546 \endgroup
3547 \lastnegativepageno = \pageno
3548 \pageno = \savepageno
3550 \let\shortcontents = \summarycontents
3552 % These macros generate individual entries in the table of contents.
3553 % The first argument is the chapter or section name.
3554 % The last argument is the page number.
3555 % The arguments in between are the chapter number, section number, ...
3557 % Chapter-level things, for both the long and short contents.
3558 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3560 % See comments in \dochapentry re vbox and related settings
3561 \def\shortchapentry#1#2#3{%
3562 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
3565 % Typeset the label for a chapter or appendix for the short contents.
3566 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
3567 % We could simplify the code here by writing out an \appendixentry
3568 % command in the toc file for appendices, instead of using \chapentry
3569 % for both, but it doesn't seem worth it.
3570 \setbox0 = \hbox{\shortcontrm \putwordAppendix }
3571 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
3573 \def\shortchaplabel#1{%
3574 % We typeset #1 in a box of constant width, regardless of the text of
3575 % #1, so the chapter titles will come out aligned.
3576 \setbox0 = \hbox{#1}%
3577 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3579 % This space should be plenty, since a single number is .5em, and the
3580 % widest letter (M) is 1em, at least in the Computer Modern fonts.
3581 % (This space doesn't include the extra space that gets added after
3582 % the label; that gets put in by \shortchapentry above.)
3583 \advance\dimen0 by 1.1em
3584 \hbox to \dimen0{#1\hfil}%
3587 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3588 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
3590 % Sections.
3591 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3592 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
3594 % Subsections.
3595 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
3596 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
3598 % And subsubsections.
3599 \def\subsubsecentry#1#2#3#4#5#6{%
3600 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
3601 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
3603 % This parameter controls the indentation of the various levels.
3604 \newdimen\tocindent \tocindent = 3pc
3606 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
3607 % page number.
3609 % If the toc has to be broken over pages, we want it to be at chapters
3610 % if at all possible; hence the \penalty.
3611 \def\dochapentry#1#2{%
3612 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
3613 \begingroup
3614 \chapentryfonts
3615 \tocentry{#1}{\dopageno{#2}}%
3616 \endgroup
3617 \nobreak\vskip .25\baselineskip plus.1\baselineskip
3620 \def\dosecentry#1#2{\begingroup
3621 \secentryfonts \leftskip=\tocindent
3622 \tocentry{#1}{\dopageno{#2}}%
3623 \endgroup}
3625 \def\dosubsecentry#1#2{\begingroup
3626 \subsecentryfonts \leftskip=2\tocindent
3627 \tocentry{#1}{\dopageno{#2}}%
3628 \endgroup}
3630 \def\dosubsubsecentry#1#2{\begingroup
3631 \subsubsecentryfonts \leftskip=3\tocindent
3632 \tocentry{#1}{\dopageno{#2}}%
3633 \endgroup}
3635 % Final typesetting of a toc entry; we use the same \entry macro as for
3636 % the index entries, but we want to suppress hyphenation here. (We
3637 % can't do that in the \entry macro, since index entries might consist
3638 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
3639 \def\tocentry#1#2{\begingroup
3640 \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
3641 % Do not use \turnoffactive in these arguments. Since the toc is
3642 % typeset in cmr, so characters such as _ would come out wrong; we
3643 % have to do the usual translation tricks.
3644 \entry{#1}{#2}%
3645 \endgroup}
3647 % Space between chapter (or whatever) number and the title.
3648 \def\labelspace{\hskip1em \relax}
3650 \def\dopageno#1{{\rm #1}}
3651 \def\doshortpageno#1{{\rm #1}}
3653 \def\chapentryfonts{\secfonts \rm}
3654 \def\secentryfonts{\textfonts}
3655 \let\subsecentryfonts = \textfonts
3656 \let\subsubsecentryfonts = \textfonts
3659 \message{environments,}
3661 % Since these characters are used in examples, it should be an even number of
3662 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3663 % Furthermore, these definitions must come after we define our fonts.
3664 \newbox\dblarrowbox \newbox\longdblarrowbox
3665 \newbox\pushcharbox \newbox\bullbox
3666 \newbox\equivbox \newbox\errorbox
3668 %{\tentt
3669 %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
3670 %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
3671 %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
3672 %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
3673 % Adapted from the manmac format (p.420 of TeXbook)
3674 %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
3675 % depth .1ex\hfil}
3678 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3679 \def\point{$\star$}
3680 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3681 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
3682 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3683 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3685 % Adapted from the TeXbook's \boxit.
3686 {\tentt \global\dimen0 = 3em}% Width of the box.
3687 \dimen2 = .55pt % Thickness of rules
3688 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3689 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
3691 \global\setbox\errorbox=\hbox to \dimen0{\hfil
3692 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3693 \advance\hsize by -2\dimen2 % Rules.
3694 \vbox{
3695 \hrule height\dimen2
3696 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3697 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3698 \kern3pt\vrule width\dimen2}% Space to right.
3699 \hrule height\dimen2}
3700 \hfil}
3702 % The @error{} command.
3703 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3705 % @tex ... @end tex escapes into raw Tex temporarily.
3706 % One exception: @ is still an escape character, so that @end tex works.
3707 % But \@ or @@ will get a plain tex @ character.
3709 \def\tex{\begingroup
3710 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
3711 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
3712 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
3713 \catcode `\%=14
3714 \catcode 43=12 % plus
3715 \catcode`\"=12
3716 \catcode`\==12
3717 \catcode`\|=12
3718 \catcode`\<=12
3719 \catcode`\>=12
3720 \escapechar=`\\
3722 \let\b=\ptexb
3723 \let\bullet=\ptexbullet
3724 \let\c=\ptexc
3725 \let\,=\ptexcomma
3726 \let\.=\ptexdot
3727 \let\dots=\ptexdots
3728 \let\equiv=\ptexequiv
3729 \let\!=\ptexexclam
3730 \let\i=\ptexi
3731 \let\{=\ptexlbrace
3732 \let\+=\tabalign
3733 \let\}=\ptexrbrace
3734 \let\*=\ptexstar
3735 \let\t=\ptext
3737 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
3738 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
3739 \def\@{@}%
3740 \let\Etex=\endgroup}
3742 % Define @lisp ... @endlisp.
3743 % @lisp does a \begingroup so it can rebind things,
3744 % including the definition of @endlisp (which normally is erroneous).
3746 % Amount to narrow the margins by for @lisp.
3747 \newskip\lispnarrowing \lispnarrowing=0.4in
3749 % This is the definition that ^^M gets inside @lisp, @example, and other
3750 % such environments. \null is better than a space, since it doesn't
3751 % have any width.
3752 \def\lisppar{\null\endgraf}
3754 % Make each space character in the input produce a normal interword
3755 % space in the output. Don't allow a line break at this space, as this
3756 % is used only in environments like @example, where each line of input
3757 % should produce a line of output anyway.
3759 {\obeyspaces %
3760 \gdef\sepspaces{\obeyspaces\let =\tie}}
3762 % Define \obeyedspace to be our active space, whatever it is. This is
3763 % for use in \parsearg.
3764 {\sepspaces%
3765 \global\let\obeyedspace= }
3767 % This space is always present above and below environments.
3768 \newskip\envskipamount \envskipamount = 0pt
3770 % Make spacing and below environment symmetrical. We use \parskip here
3771 % to help in doing that, since in @example-like environments \parskip
3772 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
3773 % start of the next paragraph will insert \parskip
3775 \def\aboveenvbreak{{\advance\envskipamount by \parskip
3776 \endgraf \ifdim\lastskip<\envskipamount
3777 \removelastskip \penalty-50 \vskip\envskipamount \fi}}
3779 \let\afterenvbreak = \aboveenvbreak
3781 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
3782 \let\nonarrowing=\relax
3784 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
3785 % environment contents.
3786 \font\circle=lcircle10
3787 \newdimen\circthick
3788 \newdimen\cartouter\newdimen\cartinner
3789 \newskip\normbskip\newskip\normpskip\newskip\normlskip
3790 \circthick=\fontdimen8\circle
3792 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
3793 \def\ctr{{\hskip 6pt\circle\char'010}}
3794 \def\cbl{{\circle\char'012\hskip -6pt}}
3795 \def\cbr{{\hskip 6pt\circle\char'011}}
3796 \def\carttop{\hbox to \cartouter{\hskip\lskip
3797 \ctl\leaders\hrule height\circthick\hfil\ctr
3798 \hskip\rskip}}
3799 \def\cartbot{\hbox to \cartouter{\hskip\lskip
3800 \cbl\leaders\hrule height\circthick\hfil\cbr
3801 \hskip\rskip}}
3803 \newskip\lskip\newskip\rskip
3805 \long\def\cartouche{%
3806 \begingroup
3807 \lskip=\leftskip \rskip=\rightskip
3808 \leftskip=0pt\rightskip=0pt %we want these *outside*.
3809 \cartinner=\hsize \advance\cartinner by-\lskip
3810 \advance\cartinner by-\rskip
3811 \cartouter=\hsize
3812 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
3813 % side, and for 6pt waste from
3814 % each corner char, and rule thickness
3815 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
3816 % Flag to tell @lisp, etc., not to narrow margin.
3817 \let\nonarrowing=\comment
3818 \vbox\bgroup
3819 \baselineskip=0pt\parskip=0pt\lineskip=0pt
3820 \carttop
3821 \hbox\bgroup
3822 \hskip\lskip
3823 \vrule\kern3pt
3824 \vbox\bgroup
3825 \hsize=\cartinner
3826 \kern3pt
3827 \begingroup
3828 \baselineskip=\normbskip
3829 \lineskip=\normlskip
3830 \parskip=\normpskip
3831 \vskip -\parskip
3832 \def\Ecartouche{%
3833 \endgroup
3834 \kern3pt
3835 \egroup
3836 \kern3pt\vrule
3837 \hskip\rskip
3838 \egroup
3839 \cartbot
3840 \egroup
3841 \endgroup
3845 % This macro is called at the beginning of all the @example variants,
3846 % inside a group.
3847 \def\nonfillstart{%
3848 \aboveenvbreak
3849 \inENV % This group ends at the end of the body
3850 \hfuzz = 12pt % Don't be fussy
3851 \sepspaces % Make spaces be word-separators rather than space tokens.
3852 \singlespace
3853 \let\par = \lisppar % don't ignore blank lines
3854 \obeylines % each line of input is a line of output
3855 \parskip = 0pt
3856 \parindent = 0pt
3857 \emergencystretch = 0pt % don't try to avoid overfull boxes
3858 % @cartouche defines \nonarrowing to inhibit narrowing
3859 % at next level down.
3860 \ifx\nonarrowing\relax
3861 \advance \leftskip by \lispnarrowing
3862 \exdentamount=\lispnarrowing
3863 \let\exdent=\nofillexdent
3864 \let\nonarrowing=\relax
3868 % Define the \E... control sequence only if we are inside the particular
3869 % environment, so the error checking in \end will work.
3871 % To end an @example-like environment, we first end the paragraph (via
3872 % \afterenvbreak's vertical glue), and then the group. That way we keep
3873 % the zero \parskip that the environments set -- \parskip glue will be
3874 % inserted at the beginning of the next paragraph in the document, after
3875 % the environment.
3877 \def\nonfillfinish{\afterenvbreak\endgroup}
3879 % @lisp: indented, narrowed, typewriter font.
3880 \def\lisp{\begingroup
3881 \nonfillstart
3882 \let\Elisp = \nonfillfinish
3884 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
3885 \gobble % eat return
3888 % @example: Same as @lisp.
3889 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
3891 % @small... is usually equivalent to the non-small (@smallbook
3892 % redefines). We must call \example (or whatever) last in the
3893 % definition, since it reads the return following the @example (or
3894 % whatever) command.
3896 % This actually allows (for example) @end display inside an
3897 % @smalldisplay. Too bad, but makeinfo will catch the error anyway.
3899 \def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display}
3900 \def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp}
3901 \def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format}
3902 \def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
3904 % Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
3905 % Originally contributed by Pavel@xerox.
3906 \def\smalllispx{\begingroup
3907 \def\Esmalllisp{\nonfillfinish\endgroup}%
3908 \def\Esmallexample{\nonfillfinish\endgroup}%
3909 \indexfonts
3910 \lisp
3913 % @display: same as @lisp except keep current font.
3915 \def\display{\begingroup
3916 \nonfillstart
3917 \let\Edisplay = \nonfillfinish
3918 \gobble
3921 % @smalldisplay (when @smallbook): @display plus smaller fonts.
3923 \def\smalldisplayx{\begingroup
3924 \def\Esmalldisplay{\nonfillfinish\endgroup}%
3925 \indexfonts \rm
3926 \display
3929 % @format: same as @display except don't narrow margins.
3931 \def\format{\begingroup
3932 \let\nonarrowing = t
3933 \nonfillstart
3934 \let\Eformat = \nonfillfinish
3935 \gobble
3938 % @smallformat (when @smallbook): @format plus smaller fonts.
3940 \def\smallformatx{\begingroup
3941 \def\Esmallformat{\nonfillfinish\endgroup}%
3942 \indexfonts \rm
3943 \format
3946 % @flushleft (same as @format).
3948 \def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
3950 % @flushright.
3952 \def\flushright{\begingroup
3953 \let\nonarrowing = t
3954 \nonfillstart
3955 \let\Eflushright = \nonfillfinish
3956 \advance\leftskip by 0pt plus 1fill
3957 \gobble
3960 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
3961 % and narrows the margins.
3963 \def\quotation{%
3964 \begingroup\inENV %This group ends at the end of the @quotation body
3965 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
3966 \singlespace
3967 \parindent=0pt
3968 % We have retained a nonzero parskip for the environment, since we're
3969 % doing normal filling. So to avoid extra space below the environment...
3970 \def\Equotation{\parskip = 0pt \nonfillfinish}%
3972 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
3973 \ifx\nonarrowing\relax
3974 \advance\leftskip by \lispnarrowing
3975 \advance\rightskip by \lispnarrowing
3976 \exdentamount = \lispnarrowing
3977 \let\nonarrowing = \relax
3982 \message{defuns,}
3983 % Define formatter for defuns
3984 % First, allow user to change definition object font (\df) internally
3985 \def\setdeffont #1 {\csname DEF#1\endcsname}
3987 \newskip\defbodyindent \defbodyindent=.4in
3988 \newskip\defargsindent \defargsindent=50pt
3989 \newskip\deftypemargin \deftypemargin=12pt
3990 \newskip\deflastargmargin \deflastargmargin=18pt
3992 \newcount\parencount
3993 % define \functionparens, which makes ( and ) and & do special things.
3994 % \functionparens affects the group it is contained in.
3995 \def\activeparens{%
3996 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
3997 \catcode`\[=\active \catcode`\]=\active}
3999 % Make control sequences which act like normal parenthesis chars.
4000 \let\lparen = ( \let\rparen = )
4002 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
4004 % Be sure that we always have a definition for `(', etc. For example,
4005 % if the fn name has parens in it, \boldbrax will not be in effect yet,
4006 % so TeX would otherwise complain about undefined control sequence.
4007 \global\let(=\lparen \global\let)=\rparen
4008 \global\let[=\lbrack \global\let]=\rbrack
4010 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
4011 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
4012 % This is used to turn on special parens
4013 % but make & act ordinary (given that it's active).
4014 \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
4016 % Definitions of (, ) and & used in args for functions.
4017 % This is the definition of ( outside of all parentheses.
4018 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
4019 \global\advance\parencount by 1
4022 % This is the definition of ( when already inside a level of parens.
4023 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
4025 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
4026 % also in that case restore the outer-level definition of (.
4027 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
4028 \global\advance \parencount by -1 }
4029 % If we encounter &foo, then turn on ()-hacking afterwards
4030 \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
4032 \gdef\normalparens{\boldbrax\let&=\ampnr}
4033 } % End of definition inside \activeparens
4034 %% These parens (in \boldbrax) actually are a little bolder than the
4035 %% contained text. This is especially needed for [ and ]
4036 \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
4037 \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
4038 \def\ampnr{\&}
4039 \def\lbrb{{\bf\char`\[}}
4040 \def\rbrb{{\bf\char`\]}}
4042 % First, defname, which formats the header line itself.
4043 % #1 should be the function name.
4044 % #2 should be the type of definition, such as "Function".
4046 \def\defname #1#2{%
4047 % Get the values of \leftskip and \rightskip as they were
4048 % outside the @def...
4049 \dimen2=\leftskip
4050 \advance\dimen2 by -\defbodyindent
4051 \noindent
4052 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
4053 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
4054 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
4055 \parshape 2 0in \dimen0 \defargsindent \dimen1
4056 % Now output arg 2 ("Function" or some such)
4057 % ending at \deftypemargin from the right margin,
4058 % but stuck inside a box of width 0 so it does not interfere with linebreaking
4059 {% Adjust \hsize to exclude the ambient margins,
4060 % so that \rightline will obey them.
4061 \advance \hsize by -\dimen2
4062 \rlap{\rightline{{\rm #2}\hskip -1.25pc }}}%
4063 % Make all lines underfull and no complaints:
4064 \tolerance=10000 \hbadness=10000
4065 \advance\leftskip by -\defbodyindent
4066 \exdentamount=\defbodyindent
4067 {\df #1}\enskip % Generate function name
4070 % Actually process the body of a definition
4071 % #1 should be the terminating control sequence, such as \Edefun.
4072 % #2 should be the "another name" control sequence, such as \defunx.
4073 % #3 should be the control sequence that actually processes the header,
4074 % such as \defunheader.
4076 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4077 \medbreak %
4078 % Define the end token that this defining construct specifies
4079 % so that it will exit this group.
4080 \def#1{\endgraf\endgroup\medbreak}%
4081 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
4082 \parindent=0in
4083 \advance\leftskip by \defbodyindent
4084 \exdentamount=\defbodyindent
4085 \begingroup %
4086 \catcode 61=\active % 61 is `='
4087 \obeylines\activeparens\spacesplit#3}
4089 % #1 is the \E... control sequence to end the definition (which we define).
4090 % #2 is the \...x control sequence for consecutive fns (which we define).
4091 % #3 is the control sequence to call to resume processing.
4092 % #4, delimited by the space, is the class name.
4094 \def\defmethparsebody#1#2#3#4 {\begingroup\inENV %
4095 \medbreak %
4096 % Define the end token that this defining construct specifies
4097 % so that it will exit this group.
4098 \def#1{\endgraf\endgroup\medbreak}%
4099 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
4100 \parindent=0in
4101 \advance\leftskip by \defbodyindent
4102 \exdentamount=\defbodyindent
4103 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
4105 % @deftypemethod has an extra argument that nothing else does. Sigh.
4106 % #1 is the \E... control sequence to end the definition (which we define).
4107 % #2 is the \...x control sequence for consecutive fns (which we define).
4108 % #3 is the control sequence to call to resume processing.
4109 % #4, delimited by the space, is the class name.
4110 % #5 is the method's return type.
4112 \def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV %
4113 \medbreak %
4114 % Define the end token that this defining construct specifies
4115 % so that it will exit this group.
4116 \def#1{\endgraf\endgroup\medbreak}%
4117 \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}%
4118 \parindent=0in
4119 \advance\leftskip by \defbodyindent
4120 \exdentamount=\defbodyindent
4121 \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}}
4123 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
4124 \medbreak %
4125 % Define the end token that this defining construct specifies
4126 % so that it will exit this group.
4127 \def#1{\endgraf\endgroup\medbreak}%
4128 \def#2##1 ##2 {\def#4{##1}%
4129 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
4130 \parindent=0in
4131 \advance\leftskip by \defbodyindent
4132 \exdentamount=\defbodyindent
4133 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
4135 % These parsing functions are similar to the preceding ones
4136 % except that they do not make parens into active characters.
4137 % These are used for "variables" since they have no arguments.
4139 \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4140 \medbreak %
4141 % Define the end token that this defining construct specifies
4142 % so that it will exit this group.
4143 \def#1{\endgraf\endgroup\medbreak}%
4144 \def#2{\begingroup\obeylines\spacesplit#3}%
4145 \parindent=0in
4146 \advance\leftskip by \defbodyindent
4147 \exdentamount=\defbodyindent
4148 \begingroup %
4149 \catcode 61=\active %
4150 \obeylines\spacesplit#3}
4152 % This is used for \def{tp,vr}parsebody. It could probably be used for
4153 % some of the others, too, with some judicious conditionals.
4155 \def\parsebodycommon#1#2#3{%
4156 \begingroup\inENV %
4157 \medbreak %
4158 % Define the end token that this defining construct specifies
4159 % so that it will exit this group.
4160 \def#1{\endgraf\endgroup\medbreak}%
4161 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
4162 \parindent=0in
4163 \advance\leftskip by \defbodyindent
4164 \exdentamount=\defbodyindent
4165 \begingroup\obeylines
4168 \def\defvrparsebody#1#2#3#4 {%
4169 \parsebodycommon{#1}{#2}{#3}%
4170 \spacesplit{#3{#4}}%
4173 % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
4174 % type is just `struct', because we lose the braces in `{struct
4175 % termios}' when \spacesplit reads its undelimited argument. Sigh.
4176 % \let\deftpparsebody=\defvrparsebody
4178 % So, to get around this, we put \empty in with the type name. That
4179 % way, TeX won't find exactly `{...}' as an undelimited argument, and
4180 % won't strip off the braces.
4182 \def\deftpparsebody #1#2#3#4 {%
4183 \parsebodycommon{#1}{#2}{#3}%
4184 \spacesplit{\parsetpheaderline{#3{#4}}}\empty
4187 % Fine, but then we have to eventually remove the \empty *and* the
4188 % braces (if any). That's what this does.
4190 \def\removeemptybraces\empty#1\relax{#1}
4192 % After \spacesplit has done its work, this is called -- #1 is the final
4193 % thing to call, #2 the type name (which starts with \empty), and #3
4194 % (which might be empty) the arguments.
4196 \def\parsetpheaderline#1#2#3{%
4197 #1{\removeemptybraces#2\relax}{#3}%
4200 \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
4201 \medbreak %
4202 % Define the end token that this defining construct specifies
4203 % so that it will exit this group.
4204 \def#1{\endgraf\endgroup\medbreak}%
4205 \def#2##1 ##2 {\def#4{##1}%
4206 \begingroup\obeylines\spacesplit{#3{##2}}}%
4207 \parindent=0in
4208 \advance\leftskip by \defbodyindent
4209 \exdentamount=\defbodyindent
4210 \begingroup\obeylines\spacesplit{#3{#5}}}
4212 % Split up #2 at the first space token.
4213 % call #1 with two arguments:
4214 % the first is all of #2 before the space token,
4215 % the second is all of #2 after that space token.
4216 % If #2 contains no space token, all of it is passed as the first arg
4217 % and the second is passed as empty.
4219 {\obeylines
4220 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
4221 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
4222 \ifx\relax #3%
4223 #1{#2}{}\else #1{#2}{#3#4}\fi}}
4225 % So much for the things common to all kinds of definitions.
4227 % Define @defun.
4229 % First, define the processing that is wanted for arguments of \defun
4230 % Use this to expand the args and terminate the paragraph they make up
4232 \def\defunargs #1{\functionparens \sl
4233 % Expand, preventing hyphenation at `-' chars.
4234 % Note that groups don't affect changes in \hyphenchar.
4235 \hyphenchar\tensl=0
4237 \hyphenchar\tensl=45
4238 \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
4239 \interlinepenalty=10000
4240 \advance\rightskip by 0pt plus 1fil
4241 \endgraf\nobreak\vskip -\parskip\nobreak
4244 \def\deftypefunargs #1{%
4245 % Expand, preventing hyphenation at `-' chars.
4246 % Note that groups don't affect changes in \hyphenchar.
4247 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
4248 \boldbraxnoamp
4249 \tclose{#1}% avoid \code because of side effects on active chars
4250 \interlinepenalty=10000
4251 \advance\rightskip by 0pt plus 1fil
4252 \endgraf\nobreak\vskip -\parskip\nobreak
4255 % Do complete processing of one @defun or @defunx line already parsed.
4257 % @deffn Command forward-char nchars
4259 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
4261 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
4262 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
4263 \catcode 61=\other % Turn off change made in \defparsebody
4266 % @defun == @deffn Function
4268 \def\defun{\defparsebody\Edefun\defunx\defunheader}
4270 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4271 \begingroup\defname {#1}{\putwordDeffunc}%
4272 \defunargs {#2}\endgroup %
4273 \catcode 61=\other % Turn off change made in \defparsebody
4276 % @deftypefun int foobar (int @var{foo}, float @var{bar})
4278 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
4280 % #1 is the data type. #2 is the name and args.
4281 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
4282 % #1 is the data type, #2 the name, #3 the args.
4283 \def\deftypefunheaderx #1#2 #3\relax{%
4284 \doind {fn}{\code{#2}}% Make entry in function index
4285 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}%
4286 \deftypefunargs {#3}\endgroup %
4287 \catcode 61=\other % Turn off change made in \defparsebody
4290 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
4292 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
4294 % \defheaderxcond#1\relax$$$
4295 % puts #1 in @code, followed by a space, but does nothing if #1 is null.
4296 \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
4298 % #1 is the classification. #2 is the data type. #3 is the name and args.
4299 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
4300 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
4301 \def\deftypefnheaderx #1#2#3 #4\relax{%
4302 \doind {fn}{\code{#3}}% Make entry in function index
4303 \begingroup
4304 \normalparens % notably, turn off `&' magic, which prevents
4305 % at least some C++ text from working
4306 \defname {\defheaderxcond#2\relax$$$#3}{#1}%
4307 \deftypefunargs {#4}\endgroup %
4308 \catcode 61=\other % Turn off change made in \defparsebody
4311 % @defmac == @deffn Macro
4313 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
4315 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4316 \begingroup\defname {#1}{\putwordDefmac}%
4317 \defunargs {#2}\endgroup %
4318 \catcode 61=\other % Turn off change made in \defparsebody
4321 % @defspec == @deffn Special Form
4323 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
4325 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4326 \begingroup\defname {#1}{\putwordDefspec}%
4327 \defunargs {#2}\endgroup %
4328 \catcode 61=\other % Turn off change made in \defparsebody
4331 % This definition is run if you use @defunx
4332 % anywhere other than immediately after a @defun or @defunx.
4334 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
4335 \def\defunx #1 {\errmessage{@defunx in invalid context}}
4336 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
4337 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
4338 \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
4339 \def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}}
4340 \def\deftypefunx #1 {\errmessage{@deftypefunx in invalid context}}
4342 % @defmethod, and so on
4344 % @defop CATEGORY CLASS OPERATION ARG...
4346 \def\defop #1 {\def\defoptype{#1}%
4347 \defopparsebody\Edefop\defopx\defopheader\defoptype}
4349 \def\defopheader #1#2#3{%
4350 \dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index
4351 \begingroup\defname {#2}{\defoptype{}\putwordon\ #1}%
4352 \defunargs {#3}\endgroup %
4355 % @deftypemethod CLASS RETURN-TYPE METHOD ARG...
4357 \def\deftypemethod{%
4358 \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
4360 % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
4361 \def\deftypemethodheader#1#2#3#4{%
4362 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
4363 \begingroup
4364 \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}%
4365 \deftypefunargs{#4}%
4366 \endgroup
4369 % @defmethod == @defop Method
4371 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
4373 % #1 is the class name, #2 the method name, #3 the args.
4374 \def\defmethodheader#1#2#3{%
4375 \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
4376 \begingroup
4377 \defname{#2}{\putwordMethodon\ \code{#1}}%
4378 \defunargs{#3}%
4379 \endgroup
4382 % @defcv {Class Option} foo-class foo-flag
4384 \def\defcv #1 {\def\defcvtype{#1}%
4385 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
4387 \def\defcvarheader #1#2#3{%
4388 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4389 \begingroup\defname {#2}{\defcvtype{}\putwordOf\ #1}%
4390 \defvarargs {#3}\endgroup %
4393 % @defivar == @defcv {Instance Variable}
4395 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
4397 \def\defivarheader #1#2#3{%
4398 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4399 \begingroup\defname {#2}{\putwordDefivar\putwordOf\ #1}%
4400 \defvarargs {#3}\endgroup %
4403 % These definitions are run if you use @defmethodx, etc.,
4404 % anywhere other than immediately after a @defmethod, etc.
4406 \def\defopx #1 {\errmessage{@defopx in invalid context}}
4407 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
4408 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
4409 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
4411 % Now @defvar
4413 % First, define the processing that is wanted for arguments of @defvar.
4414 % This is actually simple: just print them in roman.
4415 % This must expand the args and terminate the paragraph they make up
4416 \def\defvarargs #1{\normalparens #1%
4417 \interlinepenalty=10000
4418 \endgraf\nobreak\vskip -\parskip\nobreak}
4420 % @defvr Counter foo-count
4422 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
4424 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
4425 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
4427 % @defvar == @defvr Variable
4429 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
4431 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4432 \begingroup\defname {#1}{\putwordDefvar}%
4433 \defvarargs {#2}\endgroup %
4436 % @defopt == @defvr {User Option}
4438 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
4440 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4441 \begingroup\defname {#1}{\putwordDefopt}%
4442 \defvarargs {#2}\endgroup %
4445 % @deftypevar int foobar
4447 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
4449 % #1 is the data type. #2 is the name, perhaps followed by text that
4450 % is actually part of the data type, which should not be put into the index.
4451 \def\deftypevarheader #1#2{%
4452 \dovarind#2 \relax% Make entry in variables index
4453 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}%
4454 \interlinepenalty=10000
4455 \endgraf\nobreak\vskip -\parskip\nobreak
4456 \endgroup}
4457 \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
4459 % @deftypevr {Global Flag} int enable
4461 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
4463 \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
4464 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
4465 \interlinepenalty=10000
4466 \endgraf\nobreak\vskip -\parskip\nobreak
4467 \endgroup}
4469 % This definition is run if you use @defvarx
4470 % anywhere other than immediately after a @defvar or @defvarx.
4472 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
4473 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
4474 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
4475 \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
4476 \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
4478 % Now define @deftp
4479 % Args are printed in bold, a slight difference from @defvar.
4481 \def\deftpargs #1{\bf \defvarargs{#1}}
4483 % @deftp Class window height width ...
4485 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
4487 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4488 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4490 % This definition is run if you use @deftpx, etc
4491 % anywhere other than immediately after a @deftp, etc.
4493 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
4496 \message{macros,}
4497 % @macro.
4499 % To do this right we need a feature of e-TeX, \scantokens,
4500 % which we arrange to emulate with a temporary file in ordinary TeX.
4501 \ifx\eTeXversion\undefined
4502 \newwrite\macscribble
4503 \def\scanmacro#1{%
4504 \begingroup \newlinechar`\^^M
4505 \immediate\openout\macscribble=\jobname.tmp
4506 \immediate\write\macscribble{#1}%
4507 \immediate\closeout\macscribble
4508 \let\xeatspaces\eatspaces
4509 \input \jobname.tmp
4510 \endgroup
4512 \else
4513 \def\scanmacro#1{%
4514 \begingroup \newlinechar`\^^M
4515 \let\xeatspaces\eatspaces\scantokens{#1}\endgroup}
4518 \newcount\paramno % Count of parameters
4519 \newtoks\macname % Macro name
4520 \newif\ifrecursive % Is it recursive?
4522 % Utility routines.
4523 % Thisdoes \let #1 = #2, except with \csnames.
4524 \def\cslet#1#2{%
4525 \expandafter\expandafter
4526 \expandafter\let
4527 \expandafter\expandafter
4528 \csname#1\endcsname
4529 \csname#2\endcsname}
4531 % Trim leading and trailing spaces off a string.
4532 % Concepts from aro-bend problem 15 (see CTAN).
4533 {\catcode`\@=11
4534 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
4535 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
4536 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
4537 \def\unbrace#1{#1}
4538 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
4541 % Trim a single trailing ^^M off a string.
4542 {\catcode`\^^M=12\catcode`\Q=3%
4543 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
4544 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
4545 \gdef\eatcrb#1Q#2Q{#1}%
4548 % Macro bodies are absorbed as an argument in a context where
4549 % all characters are catcode 10, 11 or 12, except \ which is active
4550 % (as in normal texinfo). It is necessary to change the definition of \.
4552 % It's necessary to have hard CRs when the macro is executed. This is
4553 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
4554 % body, and then making it the \newlinechar in \scanmacro.
4556 \def\macrobodyctxt{%
4557 \catcode`\~=12
4558 \catcode`\^=12
4559 \catcode`\_=12
4560 \catcode`\|=12
4561 \catcode`\<=12
4562 \catcode`\>=12
4563 \catcode`\+=12
4564 \catcode`\{=12
4565 \catcode`\}=12
4566 \catcode`\@=12
4567 \catcode`\^^M=12
4568 \usembodybackslash}
4570 \def\macroargctxt{%
4571 \catcode`\~=12
4572 \catcode`\^=12
4573 \catcode`\_=12
4574 \catcode`\|=12
4575 \catcode`\<=12
4576 \catcode`\>=12
4577 \catcode`\+=12
4578 \catcode`\@=12
4579 \catcode`\\=12}
4581 % \mbodybackslash is the definition of \ in @macro bodies.
4582 % It maps \foo\ => \csname macarg.foo\endcsname => #N
4583 % where N is the macro parameter number.
4584 % We define \csname macarg.\endcsname to be \realbackslash, so
4585 % \\ in macro replacement text gets you a backslash.
4587 {\catcode`@=0 @catcode`@\=@active
4588 @gdef@usembodybackslash{@let\=@mbodybackslash}
4589 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
4591 \expandafter\def\csname macarg.\endcsname{\realbackslash}
4593 \def\macro{\recursivefalse\parsearg\macroxxx}
4594 \def\rmacro{\recursivetrue\parsearg\macroxxx}
4596 \def\macroxxx#1{%
4597 \getargs{#1}% now \macname is the macname and \argl the arglist
4598 \ifx\argl\empty % no arguments
4599 \paramno=0%
4600 \else
4601 \expandafter\parsemargdef \argl;%
4603 \expandafter\ifx \csname macsave.\the\macname\endcsname \relax
4604 \cslet{macsave.\the\macname}{\the\macname}%
4605 \else
4606 \message{Warning: redefining \the\macname}%
4608 \begingroup \macrobodyctxt
4609 \ifrecursive \expandafter\parsermacbody
4610 \else \expandafter\parsemacbody
4611 \fi}
4613 \def\unmacro{\parsearg\unmacroxxx}
4614 \def\unmacroxxx#1{%
4615 \expandafter\ifx \csname macsave.\the\macname\endcsname \relax
4616 \errmessage{Macro \the\macname\ not defined.}%
4617 \else
4618 \cslet{#1}{macsave.#1}%
4619 \expandafter\let \csname macsave.\the\macname\endcsname \undefined
4623 % This makes use of the obscure feature that if the last token of a
4624 % <parameter list> is #, then the preceding argument is delimited by
4625 % an opening brace, and that opening brace is not consumed.
4626 \def\getargs#1{\getargsxxx#1{}}
4627 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
4628 \def\getmacname #1 #2\relax{\macname={#1}}
4629 \def\getmacargs#1{\def\argl{#1}}
4631 % Parse the optional {params} list. Set up \paramno and \paramlist
4632 % so \defmacro knows what to do. Define \macarg.blah for each blah
4633 % in the params list, to be ##N where N is the position in that list.
4634 % That gets used by \mbodybackslash (above).
4636 % We need to get `macro parameter char #' into several definitions.
4637 % The technique used is stolen from LaTeX: let \hash be something
4638 % unexpandable, insert that wherever you need a #, and then redefine
4639 % it to # just before using the token list produced.
4641 % The same technique is used to protect \eatspaces till just before
4642 % the macro is used.
4644 \def\parsemargdef#1;{\paramno=0\def\paramlist{}%
4645 \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
4646 \def\parsemargdefxxx#1,{%
4647 \if#1;\let\next=\relax
4648 \else \let\next=\parsemargdefxxx
4649 \advance\paramno by 1%
4650 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
4651 {\xeatspaces{\hash\the\paramno}}%
4652 \edef\paramlist{\paramlist\hash\the\paramno,}%
4653 \fi\next}
4655 % These two commands read recursive and nonrecursive macro bodies.
4656 % (They're different since rec and nonrec macros end differently.)
4658 \long\def\parsemacbody#1@end macro%
4659 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
4660 \long\def\parsermacbody#1@end rmacro%
4661 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
4663 % This defines the macro itself. There are six cases: recursive and
4664 % nonrecursive macros of zero, one, and many arguments.
4665 % Much magic with \expandafter here.
4666 % \xdef is used so that macro definitions will survive the file
4667 % they're defined in; @include reads the file inside a group.
4668 \def\defmacro{%
4669 \let\hash=##% convert placeholders to macro parameter chars
4670 \ifrecursive
4671 \ifcase\paramno
4673 \expandafter\xdef\csname\the\macname\endcsname{%
4674 \noexpand\scanmacro{\temp}}%
4675 \or % 1
4676 \expandafter\xdef\csname\the\macname\endcsname{%
4677 \bgroup\noexpand\macroargctxt
4678 \noexpand\braceorline\csname\the\macname xxx\endcsname}%
4679 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
4680 \egroup\noexpand\scanmacro{\temp}}%
4681 \else % many
4682 \expandafter\xdef\csname\the\macname\endcsname{%
4683 \bgroup\noexpand\macroargctxt
4684 \noexpand\csname\the\macname xx\endcsname}
4685 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
4686 \csname\the\macname xxx\endcsname ##1,}%
4687 \expandafter\expandafter
4688 \expandafter\xdef
4689 \expandafter\expandafter
4690 \csname\the\macname xxx\endcsname
4691 \paramlist{\egroup\noexpand\scanmacro{\temp}}%
4693 \else
4694 \ifcase\paramno
4696 \expandafter\xdef\csname\the\macname\endcsname{%
4697 \noexpand\norecurse{\the\macname}%
4698 \noexpand\scanmacro{\temp}\egroup}%
4699 \or % 1
4700 \expandafter\xdef\csname\the\macname\endcsname{%
4701 \bgroup\noexpand\macroargctxt
4702 \noexpand\braceorline\csname\the\macname xxx\endcsname}%
4703 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
4704 \egroup
4705 \noexpand\norecurse{\the\macname}%
4706 \noexpand\scanmacro{\temp}\egroup}%
4707 \else % many
4708 \expandafter\xdef\csname\the\macname\endcsname{%
4709 \bgroup\noexpand\macroargctxt
4710 \noexpand\csname\the\macname xx\endcsname}
4711 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
4712 \csname\the\macname xxx\endcsname ##1,}%
4713 \expandafter\expandafter
4714 \expandafter\xdef
4715 \expandafter\expandafter
4716 \csname\the\macname xxx\endcsname
4717 \paramlist{%
4718 \egroup
4719 \noexpand\norecurse{\the\macname}%
4720 \noexpand\scanmacro{\temp}\egroup}%
4722 \fi}
4724 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
4726 % \braceorline decides whether the next nonwhitespace character is a
4727 % {. If so it reads up to the closing }, if not, it reads the whole
4728 % line. Whatever was read is then fed to the next control sequence
4729 % as an argument (by \parsebrace or \parsearg)
4730 \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
4731 \def\braceorlinexxx{%
4732 \ifx\nchar\bgroup\else
4733 \expandafter\parsearg
4734 \fi \next}
4737 \message{cross references,}
4738 \newwrite\auxfile
4740 \newif\ifhavexrefs % True if xref values are known.
4741 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
4743 % @inforef is relatively simple.
4744 \def\inforef #1{\inforefzzz #1,,,,**}
4745 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
4746 node \samp{\ignorespaces#1{}}}
4748 % @node's job is to define \lastnode.
4749 \def\node{\ENVcheck\parsearg\nodezzz}
4750 \def\nodezzz#1{\nodexxx [#1,]}
4751 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
4752 \let\nwnode=\node
4753 \let\lastnode=\relax
4755 % The sectioning commands (@chapter, etc.) call these.
4756 \def\donoderef{%
4757 \ifx\lastnode\relax\else
4758 \expandafter\expandafter\expandafter\setref{\lastnode}%
4759 {Ysectionnumberandtype}%
4760 \global\let\lastnode=\relax
4763 \def\unnumbnoderef{%
4764 \ifx\lastnode\relax\else
4765 \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
4766 \global\let\lastnode=\relax
4769 \def\appendixnoderef{%
4770 \ifx\lastnode\relax\else
4771 \expandafter\expandafter\expandafter\setref{\lastnode}%
4772 {Yappendixletterandtype}%
4773 \global\let\lastnode=\relax
4778 % @anchor{NAME} -- define xref target at arbitrary point.
4780 \def\anchor#1{\setref{#1}{Ynothing}}
4783 % \setref{NAME}{SNT} defines a cross-reference point NAME, namely
4784 % NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have
4785 % to set \indexdummies so commands such as @code in a section title
4786 % aren't expanded. It would be nicer not to expand the titles in the
4787 % first place, but there's so many layers that that is hard to do.
4789 \def\setref#1#2{{%
4790 \indexdummies
4791 \dosetq{#1-title}{Ytitle}%
4792 \dosetq{#1-pg}{Ypagenumber}%
4793 \dosetq{#1-snt}{#2}
4796 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
4797 % the node name, #2 the name of the Info cross-reference, #3 the printed
4798 % node name, #4 the name of the Info file, #5 the name of the printed
4799 % manual. All but the node name can be omitted.
4801 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
4802 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
4803 \def\ref#1{\xrefX[#1,,,,,,,]}
4804 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
4805 \def\printedmanual{\ignorespaces #5}%
4806 \def\printednodename{\ignorespaces #3}%
4807 \setbox1=\hbox{\printedmanual}%
4808 \setbox0=\hbox{\printednodename}%
4809 \ifdim \wd0 = 0pt
4810 % No printed node name was explicitly given.
4811 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
4812 % Use the node name inside the square brackets.
4813 \def\printednodename{\ignorespaces #1}%
4814 \else
4815 % Use the actual chapter/section title appear inside
4816 % the square brackets. Use the real section title if we have it.
4817 \ifdim \wd1 > 0pt
4818 % It is in another manual, so we don't have it.
4819 \def\printednodename{\ignorespaces #1}%
4820 \else
4821 \ifhavexrefs
4822 % We know the real title if we have the xref values.
4823 \def\printednodename{\refx{#1-title}{}}%
4824 \else
4825 % Otherwise just copy the Info node name.
4826 \def\printednodename{\ignorespaces #1}%
4827 \fi%
4832 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
4833 % insert empty discretionaries after hyphens, which means that it will
4834 % not find a line break at a hyphen in a node names. Since some manuals
4835 % are best written with fairly long node names, containing hyphens, this
4836 % is a loss. Therefore, we give the text of the node name again, so it
4837 % is as if TeX is seeing it for the first time.
4838 \ifdim \wd1 > 0pt
4839 \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
4840 \else
4841 % _ (for example) has to be the character _ for the purposes of the
4842 % control sequence corresponding to the node, but it has to expand
4843 % into the usual \leavevmode...\vrule stuff for purposes of
4844 % printing. So we \turnoffactive for the \refx-snt, back on for the
4845 % printing, back off for the \refx-pg.
4846 {\normalturnoffactive
4847 % Only output a following space if the -snt ref is nonempty; for
4848 % @unnumbered and @anchor, it won't be.
4849 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
4850 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
4852 % [mynode],
4853 [\printednodename],\space
4854 % page 3
4855 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
4857 \endgroup}
4859 % \dosetq is the interface for calls from other macros
4861 % Use \normalturnoffactive so that punctuation chars such as underscore
4862 % and backslash work in node names. (\turnoffactive doesn't do \.)
4863 \def\dosetq#1#2{%
4864 {\let\folio=0
4865 \normalturnoffactive
4866 \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
4867 \iflinks
4868 \next
4873 % \internalsetq {foo}{page} expands into
4874 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
4875 % When the aux file is read, ' is the escape character
4877 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
4879 % Things to be expanded by \internalsetq
4881 \def\Ypagenumber{\folio}
4883 \def\Ytitle{\thissection}
4885 \def\Ynothing{}
4887 \def\Ysectionnumberandtype{%
4888 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
4889 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
4890 \else \ifnum \subsubsecno=0 %
4891 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
4892 \else %
4893 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
4894 \fi \fi \fi }
4896 \def\Yappendixletterandtype{%
4897 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
4898 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
4899 \else \ifnum \subsubsecno=0 %
4900 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
4901 \else %
4902 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
4903 \fi \fi \fi }
4905 \gdef\xreftie{'tie}
4907 % Use TeX 3.0's \inputlineno to get the line number, for better error
4908 % messages, but if we're using an old version of TeX, don't do anything.
4910 \ifx\inputlineno\thisisundefined
4911 \let\linenumber = \empty % Non-3.0.
4912 \else
4913 \def\linenumber{\the\inputlineno:\space}
4916 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
4917 % If its value is nonempty, SUFFIX is output afterward.
4919 \def\refx#1#2{%
4920 \expandafter\ifx\csname X#1\endcsname\relax
4921 % If not defined, say something at least.
4922 \angleleft un\-de\-fined\angleright
4923 \iflinks
4924 \ifhavexrefs
4925 \message{\linenumber Undefined cross reference `#1'.}%
4926 \else
4927 \ifwarnedxrefs\else
4928 \global\warnedxrefstrue
4929 \message{Cross reference values unknown; you must run TeX again.}%
4933 \else
4934 % It's defined, so just use it.
4935 \csname X#1\endcsname
4937 #2% Output the suffix in any case.
4940 % This is the macro invoked by entries in the aux file.
4942 \def\xrdef#1{\begingroup
4943 % Reenable \ as an escape while reading the second argument.
4944 \catcode`\\ = 0
4945 \afterassignment\endgroup
4946 \expandafter\gdef\csname X#1\endcsname
4949 % Read the last existing aux file, if any. No error if none exists.
4950 \def\readauxfile{\begingroup
4951 \catcode`\^^@=\other
4952 \catcode`\^^A=\other
4953 \catcode`\^^B=\other
4954 \catcode`\^^C=\other
4955 \catcode`\^^D=\other
4956 \catcode`\^^E=\other
4957 \catcode`\^^F=\other
4958 \catcode`\^^G=\other
4959 \catcode`\^^H=\other
4960 \catcode`\^^K=\other
4961 \catcode`\^^L=\other
4962 \catcode`\^^N=\other
4963 \catcode`\^^P=\other
4964 \catcode`\^^Q=\other
4965 \catcode`\^^R=\other
4966 \catcode`\^^S=\other
4967 \catcode`\^^T=\other
4968 \catcode`\^^U=\other
4969 \catcode`\^^V=\other
4970 \catcode`\^^W=\other
4971 \catcode`\^^X=\other
4972 \catcode`\^^Z=\other
4973 \catcode`\^^[=\other
4974 \catcode`\^^\=\other
4975 \catcode`\^^]=\other
4976 \catcode`\^^^=\other
4977 \catcode`\^^_=\other
4978 \catcode`\@=\other
4979 \catcode`\^=\other
4980 % It was suggested to define this as 7, which would allow ^^e4 etc.
4981 % in xref tags, i.e., node names. But since ^^e4 notation isn't
4982 % supported in the main text, it doesn't seem desirable. Furthermore,
4983 % that is not enough: for node names that actually contain a ^
4984 % character, we would end up writing a line like this: 'xrdef {'hat
4985 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
4986 % argument, and \hat is not an expandable control sequence. It could
4987 % all be worked out, but why? Either we support ^^ or we don't.
4989 % The other change necessary for this was to define \auxhat:
4990 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
4991 % and then to call \auxhat in \setq.
4993 \catcode`\~=\other
4994 \catcode`\[=\other
4995 \catcode`\]=\other
4996 \catcode`\"=\other
4997 \catcode`\_=\other
4998 \catcode`\|=\other
4999 \catcode`\<=\other
5000 \catcode`\>=\other
5001 \catcode`\$=\other
5002 \catcode`\#=\other
5003 \catcode`\&=\other
5004 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
5005 % Make the characters 128-255 be printing characters
5007 \count 1=128
5008 \def\loop{%
5009 \catcode\count 1=\other
5010 \advance\count 1 by 1
5011 \ifnum \count 1<256 \loop \fi
5014 % The aux file uses ' as the escape (for now).
5015 % Turn off \ as an escape so we do not lose on
5016 % entries which were dumped with control sequences in their names.
5017 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
5018 % Reference to such entries still does not work the way one would wish,
5019 % but at least they do not bomb out when the aux file is read in.
5020 \catcode`\{=1
5021 \catcode`\}=2
5022 \catcode`\%=\other
5023 \catcode`\'=0
5024 \catcode`\\=\other
5026 \openin 1 \jobname.aux
5027 \ifeof 1 \else
5028 \closein 1
5029 \input \jobname.aux
5030 \global\havexrefstrue
5031 \global\warnedobstrue
5033 % Open the new aux file. TeX will close it automatically at exit.
5034 \openout\auxfile=\jobname.aux
5035 \endgroup}
5038 % Footnotes.
5040 \newcount \footnoteno
5042 % The trailing space in the following definition for supereject is
5043 % vital for proper filling; pages come out unaligned when you do a
5044 % pagealignmacro call if that space before the closing brace is
5045 % removed. (Generally, numeric constants should always be followed by a
5046 % space to prevent strange expansion errors.)
5047 \def\supereject{\par\penalty -20000\footnoteno =0 }
5049 % @footnotestyle is meaningful for info output only.
5050 \let\footnotestyle=\comment
5052 \let\ptexfootnote=\footnote
5054 {\catcode `\@=11
5056 % Auto-number footnotes. Otherwise like plain.
5057 \gdef\footnote{%
5058 \global\advance\footnoteno by \@ne
5059 \edef\thisfootno{$^{\the\footnoteno}$}%
5061 % In case the footnote comes at the end of a sentence, preserve the
5062 % extra spacing after we do the footnote number.
5063 \let\@sf\empty
5064 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
5066 % Remove inadvertent blank space before typesetting the footnote number.
5067 \unskip
5068 \thisfootno\@sf
5069 \footnotezzz
5072 % Don't bother with the trickery in plain.tex to not require the
5073 % footnote text as a parameter. Our footnotes don't need to be so general.
5075 % Oh yes, they do; otherwise, @ifset and anything else that uses
5076 % \parseargline fail inside footnotes because the tokens are fixed when
5077 % the footnote is read. --karl, 16nov96.
5079 \long\gdef\footnotezzz{\insert\footins\bgroup
5080 % We want to typeset this text as a normal paragraph, even if the
5081 % footnote reference occurs in (for example) a display environment.
5082 % So reset some parameters.
5083 \interlinepenalty\interfootnotelinepenalty
5084 \splittopskip\ht\strutbox % top baseline for broken footnotes
5085 \splitmaxdepth\dp\strutbox
5086 \floatingpenalty\@MM
5087 \leftskip\z@skip
5088 \rightskip\z@skip
5089 \spaceskip\z@skip
5090 \xspaceskip\z@skip
5091 \parindent\defaultparindent
5093 % Hang the footnote text off the number.
5094 \hang
5095 \textindent{\thisfootno}%
5097 % Don't crash into the line above the footnote text. Since this
5098 % expands into a box, it must come within the paragraph, lest it
5099 % provide a place where TeX can split the footnote.
5100 \footstrut
5101 \futurelet\next\fo@t
5103 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
5104 \else\let\next\f@t\fi \next}
5105 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
5106 \def\f@t#1{#1\@foot}
5107 \def\@foot{\strut\egroup}
5109 }%end \catcode `\@=11
5111 % Set the baselineskip to #1, and the lineskip and strut size
5112 % correspondingly. There is no deep meaning behind these magic numbers
5113 % used as factors; they just match (closely enough) what Knuth defined.
5115 \def\lineskipfactor{.08333}
5116 \def\strutheightpercent{.70833}
5117 \def\strutdepthpercent {.29167}
5119 \def\setleading#1{%
5120 \normalbaselineskip = #1\relax
5121 \normallineskip = \lineskipfactor\normalbaselineskip
5122 \normalbaselines
5123 \setbox\strutbox =\hbox{%
5124 \vrule width0pt height\strutheightpercent\baselineskip
5125 depth \strutdepthpercent \baselineskip
5129 % @| inserts a changebar to the left of the current line. It should
5130 % surround any changed text. This approach does *not* work if the
5131 % change spans more than two lines of output. To handle that, we would
5132 % have adopt a much more difficult approach (putting marks into the main
5133 % vertical list for the beginning and end of each change).
5135 \def\|{%
5136 % \vadjust can only be used in horizontal mode.
5137 \leavevmode
5139 % Append this vertical mode material after the current line in the output.
5140 \vadjust{%
5141 % We want to insert a rule with the height and depth of the current
5142 % leading; that is exactly what \strutbox is supposed to record.
5143 \vskip-\baselineskip
5145 % \vadjust-items are inserted at the left edge of the type. So
5146 % the \llap here moves out into the left-hand margin.
5147 \llap{%
5149 % For a thicker or thinner bar, change the `1pt'.
5150 \vrule height\baselineskip width1pt
5152 % This is the space between the bar and the text.
5153 \hskip 12pt
5158 % For a final copy, take out the rectangles
5159 % that mark overfull boxes (in case you have decided
5160 % that the text looks ok even though it passes the margin).
5162 \def\finalout{\overfullrule=0pt}
5164 % @image. We use the macros from epsf.tex to support this.
5165 % If epsf.tex is not installed and @image is used, we complain.
5167 % Check for and read epsf.tex up front. If we read it only at @image
5168 % time, we might be inside a group, and then its definitions would get
5169 % undone and the next image would fail.
5170 \openin 1 = epsf.tex
5171 \ifeof 1 \else
5172 \closein 1
5173 % Do not bother showing banner with post-v2.7 epsf.tex (available in
5174 % doc/epsf.tex until it shows up on ctan).
5175 \def\epsfannounce{\toks0 = }%
5176 \input epsf.tex
5179 \newif\ifwarnednoepsf
5180 \newhelp\noepsfhelp{epsf.tex must be installed for images to
5181 work. It is also included in the Texinfo distribution, or you can get
5182 it from ftp://tug.org/tex/epsf.tex.}
5184 % Only complain once about lack of epsf.tex.
5185 \def\image#1{%
5186 \ifx\pdfoutput\undefined
5187 \ifx\epsfbox\undefined
5188 \ifwarnednoepsf \else
5189 \errhelp = \noepsfhelp
5190 \errmessage{epsf.tex not found, images will be ignored}%
5191 \global\warnednoepsftrue
5193 \else
5194 \imagexxx #1,,,\finish
5196 \else
5197 \centerline{\pdfimage #1.pdf}%
5201 % Arguments to @image:
5202 % #1 is (mandatory) image filename; we tack on .eps extension.
5203 % #2 is (optional) width, #3 is (optional) height.
5204 % #4 is just the usual extra ignored arg for parsing this stuff.
5205 \def\imagexxx#1,#2,#3,#4\finish{%
5206 % \epsfbox itself resets \epsf?size at each figure.
5207 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
5208 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
5209 % If the image is by itself, center it.
5210 \ifvmode
5211 \nobreak\medskip
5212 \nobreak
5213 \centerline{\epsfbox{#1.eps}}%
5214 \bigbreak
5215 \else
5216 % In the middle of a paragraph, no extra space.
5217 \epsfbox{#1.eps}%
5222 \message{paper sizes,}
5223 % And other related parameters.
5225 \newdimen\defaultparindent \defaultparindent = 15pt
5227 \chapheadingskip = 15pt plus 4pt minus 2pt
5228 \secheadingskip = 12pt plus 3pt minus 2pt
5229 \subsecheadingskip = 9pt plus 2pt minus 2pt
5231 % Prevent underfull vbox error messages.
5232 \vbadness = 10000
5234 % Don't be so finicky about underfull hboxes, either.
5235 \hbadness = 2000
5237 % Following George Bush, just get rid of widows and orphans.
5238 \widowpenalty=10000
5239 \clubpenalty=10000
5241 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
5242 % using an old version of TeX, don't do anything. We want the amount of
5243 % stretch added to depend on the line length, hence the dependence on
5244 % \hsize. This makes it come to about 9pt for the 8.5x11 format. We
5245 % call this whenever the paper size is set.
5247 \def\setemergencystretch{%
5248 \ifx\emergencystretch\thisisundefined
5249 % Allow us to assign to \emergencystretch anyway.
5250 \def\emergencystretch{\dimen0}%
5251 \else
5252 \emergencystretch = \hsize
5253 \divide\emergencystretch by 45
5257 % Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
5258 % 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can
5259 % set \parskip and call \setleading for \baselineskip.
5261 \def\internalpagesizes#1#2#3#4#5#6{%
5262 \voffset = #3\relax
5263 \topskip = #6\relax
5264 \splittopskip = \topskip
5266 \vsize = #1\relax
5267 \advance\vsize by \topskip
5268 \outervsize = \vsize
5269 \advance\outervsize by 2\topandbottommargin
5270 \pageheight = \vsize
5272 \hsize = #2\relax
5273 \outerhsize = \hsize
5274 \advance\outerhsize by 0.5in
5275 \pagewidth = \hsize
5277 \normaloffset = #4\relax
5278 \bindingoffset = #5\relax
5280 \parindent = \defaultparindent
5281 \setemergencystretch
5284 % @letterpaper (the default).
5285 \def\letterpaper{{\globaldefs = 1
5286 \parskip = 3pt plus 2pt minus 1pt
5287 \setleading{13.2pt}%
5289 % If page is nothing but text, make it come out even.
5290 \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}%
5293 % Use @smallbook to reset parameters for 7x9.5 (or so) format.
5294 \def\smallbook{{\globaldefs = 1
5295 \parskip = 2pt plus 1pt
5296 \setleading{12pt}%
5298 \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}%
5300 \lispnarrowing = 0.3in
5301 \tolerance = 700
5302 \hfuzz = 1pt
5303 \contentsrightmargin = 0pt
5304 \deftypemargin = 0pt
5305 \defbodyindent = .5cm
5307 \let\smalldisplay = \smalldisplayx
5308 \let\smallexample = \smalllispx
5309 \let\smallformat = \smallformatx
5310 \let\smalllisp = \smalllispx
5313 % Use @afourpaper to print on European A4 paper.
5314 \def\afourpaper{{\globaldefs = 1
5315 \setleading{12pt}%
5316 \parskip = 3pt plus 2pt minus 1pt
5318 \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}%
5320 \tolerance = 700
5321 \hfuzz = 1pt
5324 % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
5325 % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
5326 \def\afourlatex{{\globaldefs = 1
5327 \setleading{13.6pt}%
5329 \afourpaper
5330 \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}%
5332 \globaldefs = 0
5335 % Use @afourwide to print on European A4 paper in wide format.
5336 \def\afourwide{%
5337 \afourpaper
5338 \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
5340 \globaldefs = 0
5343 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
5344 % Perhaps we should allow setting the margins, \topskip, \parskip,
5345 % and/or leading, also. Or perhaps we should compute them somehow.
5347 \def\pagesizes{\parsearg\pagesizesxxx}
5348 \def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
5349 \def\pagesizesyyy#1,#2,#3\finish{{%
5350 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
5351 \globaldefs = 1
5353 \parskip = 3pt plus 2pt minus 1pt
5354 \setleading{13.2pt}%
5356 \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}%
5359 % Set default to letter.
5361 \letterpaper
5363 \message{and turning on texinfo input format.}
5365 % Define macros to output various characters with catcode for normal text.
5366 \catcode`\"=\other
5367 \catcode`\~=\other
5368 \catcode`\^=\other
5369 \catcode`\_=\other
5370 \catcode`\|=\other
5371 \catcode`\<=\other
5372 \catcode`\>=\other
5373 \catcode`\+=\other
5374 \def\normaldoublequote{"}
5375 \def\normaltilde{~}
5376 \def\normalcaret{^}
5377 \def\normalunderscore{_}
5378 \def\normalverticalbar{|}
5379 \def\normalless{<}
5380 \def\normalgreater{>}
5381 \def\normalplus{+}
5383 % This macro is used to make a character print one way in ttfont
5384 % where it can probably just be output, and another way in other fonts,
5385 % where something hairier probably needs to be done.
5387 % #1 is what to print if we are indeed using \tt; #2 is what to print
5388 % otherwise. Since all the Computer Modern typewriter fonts have zero
5389 % interword stretch (and shrink), and it is reasonable to expect all
5390 % typewriter fonts to have this, we can check that font parameter.
5392 \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
5394 % Turn off all special characters except @
5395 % (and those which the user can use as if they were ordinary).
5396 % Most of these we simply print from the \tt font, but for some, we can
5397 % use math or other variants that look better in normal text.
5399 \catcode`\"=\active
5400 \def\activedoublequote{{\tt\char34}}
5401 \let"=\activedoublequote
5402 \catcode`\~=\active
5403 \def~{{\tt\char126}}
5404 \chardef\hat=`\^
5405 \catcode`\^=\active
5406 \def^{{\tt \hat}}
5408 \catcode`\_=\active
5409 \def_{\ifusingtt\normalunderscore\_}
5410 % Subroutine for the previous macro.
5411 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
5413 \catcode`\|=\active
5414 \def|{{\tt\char124}}
5415 \chardef \less=`\<
5416 \catcode`\<=\active
5417 \def<{{\tt \less}}
5418 \chardef \gtr=`\>
5419 \catcode`\>=\active
5420 \def>{{\tt \gtr}}
5421 \catcode`\+=\active
5422 \def+{{\tt \char 43}}
5423 %\catcode 27=\active
5424 %\def^^[{$\diamondsuit$}
5426 % Set up an active definition for =, but don't enable it most of the time.
5427 {\catcode`\==\active
5428 \global\def={{\tt \char 61}}}
5430 \catcode`+=\active
5431 \catcode`\_=\active
5433 % If a .fmt file is being used, characters that might appear in a file
5434 % name cannot be active until we have parsed the command line.
5435 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
5436 % \otherifyactive is called near the end of this file.
5437 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
5439 \catcode`\@=0
5441 % \rawbackslashxx output one backslash character in current font
5442 \global\chardef\rawbackslashxx=`\\
5443 %{\catcode`\\=\other
5444 %@gdef@rawbackslashxx{\}}
5446 % \rawbackslash redefines \ as input to do \rawbackslashxx.
5447 {\catcode`\\=\active
5448 @gdef@rawbackslash{@let\=@rawbackslashxx }}
5450 % \normalbackslash outputs one backslash in fixed width font.
5451 \def\normalbackslash{{\tt\rawbackslashxx}}
5453 % Say @foo, not \foo, in error messages.
5454 \escapechar=`\@
5456 % \catcode 17=0 % Define control-q
5457 \catcode`\\=\active
5459 % Used sometimes to turn off (effectively) the active characters
5460 % even after parsing them.
5461 @def@turnoffactive{@let"=@normaldoublequote
5462 @let\=@realbackslash
5463 @let~=@normaltilde
5464 @let^=@normalcaret
5465 @let_=@normalunderscore
5466 @let|=@normalverticalbar
5467 @let<=@normalless
5468 @let>=@normalgreater
5469 @let+=@normalplus}
5471 @def@normalturnoffactive{@let"=@normaldoublequote
5472 @let\=@normalbackslash
5473 @let~=@normaltilde
5474 @let^=@normalcaret
5475 @let_=@normalunderscore
5476 @let|=@normalverticalbar
5477 @let<=@normalless
5478 @let>=@normalgreater
5479 @let+=@normalplus}
5481 % Make _ and + \other characters, temporarily.
5482 % This is canceled by @fixbackslash.
5483 @otherifyactive
5485 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
5486 % That is what \eatinput is for; after that, the `\' should revert to printing
5487 % a backslash.
5489 @gdef@eatinput input texinfo{@fixbackslash}
5490 @global@let\ = @eatinput
5492 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
5493 % the first `\{ in the file would cause an error. This macro tries to fix
5494 % that, assuming it is called before the first `\' could plausibly occur.
5495 % Also back turn on active characters that might appear in the input
5496 % file name, in case not using a pre-dumped format.
5498 @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
5499 @catcode`+=@active @catcode`@_=@active}
5501 % These look ok in all fonts, so just make them not special. The @rm below
5502 % makes sure that the current font starts out as the newly loaded cmr10
5503 @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
5505 @textfonts
5508 @c Local variables:
5509 @c eval: (add-hook 'write-file-hooks 'time-stamp)
5510 @c page-delimiter: "^\\\\message"
5511 @c time-stamp-start: "def\\\\texinfoversion{"
5512 @c time-stamp-format: "%:y-%02m-%02d"
5513 @c time-stamp-end: "}"
5514 @c End: