Update.
[glibc.git] / manual / texinfo.tex
blob7421f884d22145f03aa5f88a6d3e3b967429c03c
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-05-25.6}%
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 % (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
34 % ftp://tug.org/tex/texinfo.tex
35 % ftp://ctan.org/macros/texinfo/texinfo.tex
36 % (and all CTAN mirrors, finger ctan@ctan.org for a list).
37 % /home/gd/gnu/doc/texinfo.tex on the GNU machines.
38 % The texinfo.tex in any given Texinfo distribution could well be out
39 % of date, so if that's what you're using, please check.
40 % There is a small home page for Texinfo at http://texinfo.org/.
42 % Send bug reports to bug-texinfo@gnu.org. Please include including a
43 % complete document in each bug report with which we can reproduce the
44 % problem. Patches are, of course, greatly appreciated.
46 % To process a Texinfo manual with TeX, it's most reliable to use the
47 % texi2dvi shell script that comes with the distribution. For a simple
48 % manual foo.texi, however, you can get away with this:
49 % tex foo.texi
50 % texindex foo.??
51 % tex foo.texi
52 % tex foo.texi
53 % dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps.
54 % The extra runs of TeX get the cross-reference information correct.
55 % Sometimes one run after texindex suffices, and sometimes you need more
56 % than two; texi2dvi does it as many times as necessary.
58 % It is possible to adapt texinfo.tex for other languages. You can get
59 % the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/.
61 \message{Loading texinfo [version \texinfoversion]:}
63 % If in a .fmt file, print the version number
64 % and turn on active characters that we couldn't do earlier because
65 % they might have appeared in the input file name.
66 \everyjob{\message{[Texinfo version \texinfoversion]}%
67 \catcode`+=\active \catcode`\_=\active}
69 % Save some parts of plain tex whose names we will redefine.
70 \let\ptexb=\b
71 \let\ptexbullet=\bullet
72 \let\ptexc=\c
73 \let\ptexcomma=\,
74 \let\ptexdot=\.
75 \let\ptexdots=\dots
76 \let\ptexend=\end
77 \let\ptexequiv=\equiv
78 \let\ptexexclam=\!
79 \let\ptexi=\i
80 \let\ptexlbrace=\{
81 \let\ptexrbrace=\}
82 \let\ptexstar=\*
83 \let\ptext=\t
85 % We never want plain's outer \+ definition in Texinfo.
86 % For @tex, we can use \tabalign.
87 \let\+ = \relax
89 % Get ready for pdf.
90 \newif\ifpdf
91 \ifx\pdfoutput\undefined\else
92 \input pdfcolor
93 \pdfoutput=1
94 \pdftrue
95 \fi
97 \message{Basics,}
98 \chardef\other=12
100 % If this character appears in an error message or help string, it
101 % starts a new line in the output.
102 \newlinechar = `^^J
104 % Set up fixed words for English if not already set.
105 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
106 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
107 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
108 \ifx\putwordin\undefined \gdef\putwordin{in}\fi
109 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
110 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
111 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
112 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
113 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
114 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
115 \ifx\putwordof\undefined \gdef\putwordof{of}\fi
116 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
117 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
118 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
119 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
120 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
121 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
122 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
123 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
125 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
126 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
127 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
128 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
129 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
130 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
131 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
132 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
133 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
134 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
135 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
136 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
138 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
139 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
140 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
141 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
142 \ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
143 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
144 \ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
146 % Ignore a token.
148 \def\gobble#1{}
150 \hyphenation{ap-pen-dix}
151 \hyphenation{mini-buf-fer mini-buf-fers}
152 \hyphenation{eshell}
153 \hyphenation{white-space}
155 % Margin to add to right of even pages, to left of odd pages.
156 \newdimen \bindingoffset
157 \newdimen \normaloffset
158 \newdimen\pagewidth \newdimen\pageheight
160 % Sometimes it is convenient to have everything in the transcript file
161 % and nothing on the terminal. We don't just call \tracingall here,
162 % since that produces some useless output on the terminal.
164 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
165 \ifx\eTeXversion\undefined
166 \def\loggingall{\tracingcommands2 \tracingstats2
167 \tracingpages1 \tracingoutput1 \tracinglostchars1
168 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
169 \showboxbreadth\maxdimen\showboxdepth\maxdimen
171 \else
172 \def\loggingall{\tracingcommands3 \tracingstats2
173 \tracingpages1 \tracingoutput1 \tracinglostchars1
174 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
175 \tracingscantokens1 \tracingassigns1 \tracingifs1
176 \tracinggroups1 \tracingnesting2
177 \showboxbreadth\maxdimen\showboxdepth\maxdimen
181 % For @cropmarks command.
182 % Do @cropmarks to get crop marks.
184 \newif\ifcropmarks
185 \let\cropmarks = \cropmarkstrue
187 % Dimensions to add cropmarks at corners.
188 % Added by P. A. MacKay, 12 Nov. 1986
190 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
191 \newdimen\cornerlong \cornerlong=1pc
192 \newdimen\cornerthick \cornerthick=.3pt
193 \newdimen\topandbottommargin \topandbottommargin=.75in
195 % Main output routine.
196 \chardef\PAGE = 255
197 \output = {\onepageout{\pagecontents\PAGE}}
199 \newbox\headlinebox
200 \newbox\footlinebox
202 % \onepageout takes a vbox as an argument. Note that \pagecontents
203 % does insertions, but you have to call it yourself.
204 \def\onepageout#1{%
205 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
207 \ifodd\pageno \advance\hoffset by \bindingoffset
208 \else \advance\hoffset by -\bindingoffset\fi
210 % Do this outside of the \shipout so @code etc. will be expanded in
211 % the headline as they should be, not taken literally (outputting ''code).
212 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
213 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
216 % Have to do this stuff outside the \shipout because we want it to
217 % take effect in \write's, yet the group defined by the \vbox ends
218 % before the \shipout runs.
220 \escapechar = `\\ % use backslash in output files.
221 \indexdummies % don't expand commands in the output.
222 \normalturnoffactive % \ in index entries must not stay \, e.g., if
223 % the page break happens to be in the middle of an example.
224 \shipout\vbox{%
225 \ifcropmarks \vbox to \outervsize\bgroup
226 \hsize = \outerhsize
227 \vskip-\topandbottommargin
228 \vtop to0pt{%
229 \line{\ewtop\hfil\ewtop}%
230 \nointerlineskip
231 \line{%
232 \vbox{\moveleft\cornerthick\nstop}%
233 \hfill
234 \vbox{\moveright\cornerthick\nstop}%
236 \vss}%
237 \vskip\topandbottommargin
238 \line\bgroup
239 \hfil % center the page within the outer (page) hsize.
240 \ifodd\pageno\hskip\bindingoffset\fi
241 \vbox\bgroup
244 \unvbox\headlinebox
245 \pagebody{#1}%
246 \ifdim\ht\footlinebox > 0pt
247 % Only leave this space if the footline is nonempty.
248 % (We lessened \vsize for it in \oddfootingxxx.)
249 % The \baselineskip=24pt in plain's \makefootline has no effect.
250 \vskip 2\baselineskip
251 \unvbox\footlinebox
254 \ifpdf\pdfmkdest{\the\pageno}\fi
256 \ifcropmarks
257 \egroup % end of \vbox\bgroup
258 \hfil\egroup % end of (centering) \line\bgroup
259 \vskip\topandbottommargin plus1fill minus1fill
260 \boxmaxdepth = \cornerthick
261 \vbox to0pt{\vss
262 \line{%
263 \vbox{\moveleft\cornerthick\nsbot}%
264 \hfill
265 \vbox{\moveright\cornerthick\nsbot}%
267 \nointerlineskip
268 \line{\ewbot\hfil\ewbot}%
270 \egroup % \vbox from first cropmarks clause
272 }% end of \shipout\vbox
273 }% end of group with \turnoffactive
274 \advancepageno
275 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
278 \newinsert\margin \dimen\margin=\maxdimen
280 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
281 {\catcode`\@ =11
282 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
283 % marginal hacks, juha@viisa.uucp (Juha Takala)
284 \ifvoid\margin\else % marginal info is present
285 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
286 \dimen@=\dp#1 \unvbox#1
287 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
288 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
291 % Here are the rules for the cropmarks. Note that they are
292 % offset so that the space between them is truly \outerhsize or \outervsize
293 % (P. A. MacKay, 12 November, 1986)
295 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
296 \def\nstop{\vbox
297 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
298 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
299 \def\nsbot{\vbox
300 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
302 % Parse an argument, then pass it to #1. The argument is the rest of
303 % the input line (except we remove a trailing comment). #1 should be a
304 % macro which expects an ordinary undelimited TeX argument.
306 \def\parsearg#1{%
307 \let\next = #1%
308 \begingroup
309 \obeylines
310 \futurelet\temp\parseargx
313 % If the next token is an obeyed space (from an @example environment or
314 % the like), remove it and recurse. Otherwise, we're done.
315 \def\parseargx{%
316 % \obeyedspace is defined far below, after the definition of \sepspaces.
317 \ifx\obeyedspace\temp
318 \expandafter\parseargdiscardspace
319 \else
320 \expandafter\parseargline
324 % Remove a single space (as the delimiter token to the macro call).
325 {\obeyspaces %
326 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
328 {\obeylines %
329 \gdef\parseargline#1^^M{%
330 \endgroup % End of the group started in \parsearg.
332 % First remove any @c comment, then any @comment.
333 % Result of each macro is put in \toks0.
334 \argremovec #1\c\relax %
335 \expandafter\argremovecomment \the\toks0 \comment\relax %
337 % Call the caller's macro, saved as \next in \parsearg.
338 \expandafter\next\expandafter{\the\toks0}%
342 % Since all \c{,omment} does is throw away the argument, we can let TeX
343 % do that for us. The \relax here is matched by the \relax in the call
344 % in \parseargline; it could be more or less anything, its purpose is
345 % just to delimit the argument to the \c.
346 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
347 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
349 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
350 % @end itemize @c foo
351 % will have two active spaces as part of the argument with the
352 % `itemize'. Here we remove all active spaces from #1, and assign the
353 % result to \toks0.
355 % This loses if there are any *other* active characters besides spaces
356 % in the argument -- _ ^ +, for example -- since they get expanded.
357 % Fortunately, Texinfo does not define any such commands. (If it ever
358 % does, the catcode of the characters in questionwill have to be changed
359 % here.) But this means we cannot call \removeactivespaces as part of
360 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
361 % that \parsearg gets might well have any character at all in it.
363 \def\removeactivespaces#1{%
364 \begingroup
365 \ignoreactivespaces
366 \edef\temp{#1}%
367 \global\toks0 = \expandafter{\temp}%
368 \endgroup
371 % Change the active space to expand to nothing.
373 \begingroup
374 \obeyspaces
375 \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
376 \endgroup
379 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
381 %% These are used to keep @begin/@end levels from running away
382 %% Call \inENV within environments (after a \begingroup)
383 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
384 \def\ENVcheck{%
385 \ifENV\errmessage{Still within an environment; press RETURN to continue}
386 \endgroup\fi} % This is not perfect, but it should reduce lossage
388 % @begin foo is the same as @foo, for now.
389 \newhelp\EMsimple{Press RETURN to continue.}
391 \outer\def\begin{\parsearg\beginxxx}
393 \def\beginxxx #1{%
394 \expandafter\ifx\csname #1\endcsname\relax
395 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
396 \csname #1\endcsname\fi}
398 % @end foo executes the definition of \Efoo.
400 \def\end{\parsearg\endxxx}
401 \def\endxxx #1{%
402 \removeactivespaces{#1}%
403 \edef\endthing{\the\toks0}%
405 \expandafter\ifx\csname E\endthing\endcsname\relax
406 \expandafter\ifx\csname \endthing\endcsname\relax
407 % There's no \foo, i.e., no ``environment'' foo.
408 \errhelp = \EMsimple
409 \errmessage{Undefined command `@end \endthing'}%
410 \else
411 \unmatchedenderror\endthing
413 \else
414 % Everything's ok; the right environment has been started.
415 \csname E\endthing\endcsname
419 % There is an environment #1, but it hasn't been started. Give an error.
421 \def\unmatchedenderror#1{%
422 \errhelp = \EMsimple
423 \errmessage{This `@end #1' doesn't have a matching `@#1'}%
426 % Define the control sequence \E#1 to give an unmatched @end error.
428 \def\defineunmatchedend#1{%
429 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
433 % Single-spacing is done by various environments (specifically, in
434 % \nonfillstart and \quotations).
435 \newskip\singlespaceskip \singlespaceskip = 12.5pt
436 \def\singlespace{%
437 % Why was this kern here? It messes up equalizing space above and below
438 % environments. --karl, 6may93
439 %{\advance \baselineskip by -\singlespaceskip
440 %\kern \baselineskip}%
441 \setleading \singlespaceskip
444 %% Simple single-character @ commands
446 % @@ prints an @
447 % Kludge this until the fonts are right (grr).
448 \def\@{{\tt\char64}}
450 % This is turned off because it was never documented
451 % and you can use @w{...} around a quote to suppress ligatures.
452 %% Define @` and @' to be the same as ` and '
453 %% but suppressing ligatures.
454 %\def\`{{`}}
455 %\def\'{{'}}
457 % Used to generate quoted braces.
458 \def\mylbrace {{\tt\char123}}
459 \def\myrbrace {{\tt\char125}}
460 \let\{=\mylbrace
461 \let\}=\myrbrace
462 \begingroup
463 % Definitions to produce actual \{ & \} command in an index.
464 \catcode`\{ = 12 \catcode`\} = 12
465 \catcode`\[ = 1 \catcode`\] = 2
466 \catcode`\@ = 0 \catcode`\\ = 12
467 @gdef@lbracecmd[\{]%
468 @gdef@rbracecmd[\}]%
469 @endgroup
471 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
472 % Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
473 \let\, = \c
474 \let\dotaccent = \.
475 \def\ringaccent#1{{\accent23 #1}}
476 \let\tieaccent = \t
477 \let\ubaraccent = \b
478 \let\udotaccent = \d
480 % Other special characters: @questiondown @exclamdown
481 % Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
482 \def\questiondown{?`}
483 \def\exclamdown{!`}
485 % Dotless i and dotless j, used for accents.
486 \def\imacro{i}
487 \def\jmacro{j}
488 \def\dotless#1{%
489 \def\temp{#1}%
490 \ifx\temp\imacro \ptexi
491 \else\ifx\temp\jmacro \j
492 \else \errmessage{@dotless can be used only with i or j}%
493 \fi\fi
496 % Be sure we're in horizontal mode when doing a tie, since we make space
497 % equivalent to this in @example-like environments. Otherwise, a space
498 % at the beginning of a line will start with \penalty -- and
499 % since \penalty is valid in vertical mode, we'd end up putting the
500 % penalty on the vertical list instead of in the new paragraph.
501 {\catcode`@ = 11
502 % Avoid using \@M directly, because that causes trouble
503 % if the definition is written into an index file.
504 \global\let\tiepenalty = \@M
505 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
508 % @: forces normal size whitespace following.
509 \def\:{\spacefactor=1000 }
511 % @* forces a line break.
512 \def\*{\hfil\break\hbox{}\ignorespaces}
514 % @. is an end-of-sentence period.
515 \def\.{.\spacefactor=3000 }
517 % @! is an end-of-sentence bang.
518 \def\!{!\spacefactor=3000 }
520 % @? is an end-of-sentence query.
521 \def\?{?\spacefactor=3000 }
523 % @w prevents a word break. Without the \leavevmode, @w at the
524 % beginning of a paragraph, when TeX is still in vertical mode, would
525 % produce a whole line of output instead of starting the paragraph.
526 \def\w#1{\leavevmode\hbox{#1}}
528 % @group ... @end group forces ... to be all on one page, by enclosing
529 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
530 % to keep its height that of a normal line. According to the rules for
531 % \topskip (p.114 of the TeXbook), the glue inserted is
532 % max (\topskip - \ht (first item), 0). If that height is large,
533 % therefore, no glue is inserted, and the space between the headline and
534 % the text is small, which looks bad.
536 \def\group{\begingroup
537 \ifnum\catcode13=\active \else
538 \errhelp = \groupinvalidhelp
539 \errmessage{@group invalid in context where filling is enabled}%
542 % The \vtop we start below produces a box with normal height and large
543 % depth; thus, TeX puts \baselineskip glue before it, and (when the
544 % next line of text is done) \lineskip glue after it. (See p.82 of
545 % the TeXbook.) Thus, space below is not quite equal to space
546 % above. But it's pretty close.
547 \def\Egroup{%
548 \egroup % End the \vtop.
549 \endgroup % End the \group.
552 \vtop\bgroup
553 % We have to put a strut on the last line in case the @group is in
554 % the midst of an example, rather than completely enclosing it.
555 % Otherwise, the interline space between the last line of the group
556 % and the first line afterwards is too small. But we can't put the
557 % strut in \Egroup, since there it would be on a line by itself.
558 % Hence this just inserts a strut at the beginning of each line.
559 \everypar = {\strut}%
561 % Since we have a strut on every line, we don't need any of TeX's
562 % normal interline spacing.
563 \offinterlineskip
565 % OK, but now we have to do something about blank
566 % lines in the input in @example-like environments, which normally
567 % just turn into \lisppar, which will insert no space now that we've
568 % turned off the interline space. Simplest is to make them be an
569 % empty paragraph.
570 \ifx\par\lisppar
571 \edef\par{\leavevmode \par}%
573 % Reset ^^M's definition to new definition of \par.
574 \obeylines
577 % Do @comment since we are called inside an environment such as
578 % @example, where each end-of-line in the input causes an
579 % end-of-line in the output. We don't want the end-of-line after
580 % the `@group' to put extra space in the output. Since @group
581 % should appear on a line by itself (according to the Texinfo
582 % manual), we don't worry about eating any user text.
583 \comment
586 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
587 % message, so this ends up printing `@group can only ...'.
589 \newhelp\groupinvalidhelp{%
590 group can only be used in environments such as @example,^^J%
591 where each line of input produces a line of output.}
593 % @need space-in-mils
594 % forces a page break if there is not space-in-mils remaining.
596 \newdimen\mil \mil=0.001in
598 \def\need{\parsearg\needx}
600 % Old definition--didn't work.
601 %\def\needx #1{\par %
602 %% This method tries to make TeX break the page naturally
603 %% if the depth of the box does not fit.
604 %{\baselineskip=0pt%
605 %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
606 %\prevdepth=-1000pt
609 \def\needx#1{%
610 % Go into vertical mode, so we don't make a big box in the middle of a
611 % paragraph.
612 \par
614 % Don't add any leading before our big empty box, but allow a page
615 % break, since the best break might be right here.
616 \allowbreak
617 \nointerlineskip
618 \vtop to #1\mil{\vfil}%
620 % TeX does not even consider page breaks if a penalty added to the
621 % main vertical list is 10000 or more. But in order to see if the
622 % empty box we just added fits on the page, we must make it consider
623 % page breaks. On the other hand, we don't want to actually break the
624 % page after the empty box. So we use a penalty of 9999.
626 % There is an extremely small chance that TeX will actually break the
627 % page at this \penalty, if there are no other feasible breakpoints in
628 % sight. (If the user is using lots of big @group commands, which
629 % almost-but-not-quite fill up a page, TeX will have a hard time doing
630 % good page breaking, for example.) However, I could not construct an
631 % example where a page broke at this \penalty; if it happens in a real
632 % document, then we can reconsider our strategy.
633 \penalty9999
635 % Back up by the size of the box, whether we did a page break or not.
636 \kern -#1\mil
638 % Do not allow a page break right after this kern.
639 \nobreak
642 % @br forces paragraph break
644 \let\br = \par
646 % @dots{} output an ellipsis using the current font.
647 % We do .5em per period so that it has the same spacing in a typewriter
648 % font as three actual period characters.
650 \def\dots{%
651 \leavevmode
652 \hbox to 1.5em{%
653 \hskip 0pt plus 0.25fil minus 0.25fil
654 .\hss.\hss.%
655 \hskip 0pt plus 0.5fil minus 0.5fil
659 % @enddots{} is an end-of-sentence ellipsis.
661 \def\enddots{%
662 \leavevmode
663 \hbox to 2em{%
664 \hskip 0pt plus 0.25fil minus 0.25fil
665 .\hss.\hss.\hss.%
666 \hskip 0pt plus 0.5fil minus 0.5fil
668 \spacefactor=3000
672 % @page forces the start of a new page
674 \def\page{\par\vfill\supereject}
676 % @exdent text....
677 % outputs text on separate line in roman font, starting at standard page margin
679 % This records the amount of indent in the innermost environment.
680 % That's how much \exdent should take out.
681 \newskip\exdentamount
683 % This defn is used inside fill environments such as @defun.
684 \def\exdent{\parsearg\exdentyyy}
685 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
687 % This defn is used inside nofill environments such as @example.
688 \def\nofillexdent{\parsearg\nofillexdentyyy}
689 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
690 \leftline{\hskip\leftskip{\rm#1}}}}
692 % @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
694 \def\inmargin#1{%
695 \strut\vadjust{\nobreak\kern-\strutdepth
696 \vtop to \strutdepth{\baselineskip\strutdepth\vss
697 \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
698 \newskip\inmarginspacing \inmarginspacing=1cm
699 \def\strutdepth{\dp\strutbox}
701 %\hbox{{\rm#1}}\hfil\break}}
703 % @include file insert text of that file as input.
704 % Allow normal characters that we make active in the argument (a file name).
705 \def\include{\begingroup
706 \catcode`\\=12
707 \catcode`~=12
708 \catcode`^=12
709 \catcode`_=12
710 \catcode`|=12
711 \catcode`<=12
712 \catcode`>=12
713 \catcode`+=12
714 \parsearg\includezzz}
715 % Restore active chars for included file.
716 \def\includezzz#1{\endgroup\begingroup
717 % Read the included file in a group so nested @include's work.
718 \def\thisfile{#1}%
719 \input\thisfile
720 \endgroup}
722 \def\thisfile{}
724 % @center line outputs that line, centered
726 \def\center{\parsearg\centerzzz}
727 \def\centerzzz #1{{\advance\hsize by -\leftskip
728 \advance\hsize by -\rightskip
729 \centerline{#1}}}
731 % @sp n outputs n lines of vertical space
733 \def\sp{\parsearg\spxxx}
734 \def\spxxx #1{\vskip #1\baselineskip}
736 % @comment ...line which is ignored...
737 % @c is the same as @comment
738 % @ignore ... @end ignore is another way to write a comment
740 \def\comment{\begingroup \catcode`\^^M=\other%
741 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
742 \commentxxx}
743 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
745 \let\c=\comment
747 % @paragraphindent NCHARS
748 % We'll use ems for NCHARS, close enough.
749 % We cannot implement @paragraphindent asis, though.
751 \def\asisword{asis} % no translation, these are keywords
752 \def\noneword{none}
754 \def\paragraphindent{\parsearg\doparagraphindent}
755 \def\doparagraphindent#1{%
756 \def\temp{#1}%
757 \ifx\temp\asisword
758 \else
759 \ifx\temp\noneword
760 \defaultparindent = 0pt
761 \else
762 \defaultparindent = #1em
765 \parindent = \defaultparindent
768 % @exampleindent NCHARS
769 % We'll use ems for NCHARS like @paragraphindent.
770 % It seems @exampleindent asis isn't necessary, but
771 % I preserve it to make it similar to @paragraphindent.
772 \def\exampleindent{\parsearg\doexampleindent}
773 \def\doexampleindent#1{%
774 \def\temp{#1}%
775 \ifx\temp\asisword
776 \else
777 \ifx\temp\noneword
778 \lispnarrowing = 0pt
779 \else
780 \lispnarrowing = #1em
785 % @asis just yields its argument. Used with @table, for example.
787 \def\asis#1{#1}
789 % @math means output in math mode.
790 % We don't use $'s directly in the definition of \math because control
791 % sequences like \math are expanded when the toc file is written. Then,
792 % we read the toc file back, the $'s will be normal characters (as they
793 % should be, according to the definition of Texinfo). So we must use a
794 % control sequence to switch into and out of math mode.
796 % This isn't quite enough for @math to work properly in indices, but it
797 % seems unlikely it will ever be needed there.
799 \let\implicitmath = $
800 \def\math#1{\implicitmath #1\implicitmath}
802 % @bullet and @minus need the same treatment as @math, just above.
803 \def\bullet{\implicitmath\ptexbullet\implicitmath}
804 \def\minus{\implicitmath-\implicitmath}
806 % @refill is a no-op.
807 \let\refill=\relax
809 % If working on a large document in chapters, it is convenient to
810 % be able to disable indexing, cross-referencing, and contents, for test runs.
811 % This is done with @novalidate (before @setfilename).
813 \newif\iflinks \linkstrue % by default we want the aux files.
814 \let\novalidate = \linksfalse
816 % @setfilename is done at the beginning of every texinfo file.
817 % So open here the files we need to have open while reading the input.
818 % This makes it possible to make a .fmt file for texinfo.
819 \def\setfilename{%
820 \iflinks
821 \readauxfile
822 \fi % \openindices needs to do some work in any case.
823 \openindices
824 \fixbackslash % Turn off hack to swallow `\input texinfo'.
825 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
827 % If texinfo.cnf is present on the system, read it.
828 % Useful for site-wide @afourpaper, etc.
829 % Just to be on the safe side, close the input stream before the \input.
830 \openin 1 texinfo.cnf
831 \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
832 \closein1
833 \temp
835 \comment % Ignore the actual filename.
838 % Called from \setfilename.
840 \def\openindices{%
841 \newindex{cp}%
842 \newcodeindex{fn}%
843 \newcodeindex{vr}%
844 \newcodeindex{tp}%
845 \newcodeindex{ky}%
846 \newcodeindex{pg}%
849 % @bye.
850 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
853 \message{pdf,}
854 % adobe `portable' document format
856 \newcount\tempnum
857 \newcount\lnkcount
858 \newtoks\filename
859 \newcount\filenamelength
860 \newcount\pgn
862 \ifpdf
863 \def\pdfmkdest#1{\pdfdest name{#1@} xyz}
864 \def\pdfmkpgn#1{#1@}
866 % Adding outlines to PDF; macros for calculating structure of outlines
867 % come from Petr Olsak
868 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
869 \else \csname#1\endcsname \fi}
870 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
871 \advance\tempnum by1
872 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
873 \def\pdfmakeoutlines{{%
874 \openin 1 \jobname.toc
875 \ifeof 1\else\bgroup
876 \closein 1
877 \def\code##1{##1}
878 \def\file##1{##1}
879 \def\TeX##1{TeX}
880 \def\tt{}
881 \def\char{char}
882 \def\samp##1{##1}
883 \def\kbd##1{##1}
884 \def\key##1{##1}
885 \def\rawbackslashxx{\string\\}
886 \def\chapentry ##1##2##3{}
887 \def\unnumbchapentry ##1##2{}
888 \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
889 \def\unnumbsecentry ##1##2{}
890 \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
891 \def\unnumbsubsecentry ##1##2{}
892 \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
893 \def\unnumbsubsubsecentry ##1##2{}
894 \input \jobname.toc
895 \def\chapentry ##1##2##3{%
896 \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
897 \def\unnumbchapentry ##1##2{%
898 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
899 \def\secentry ##1##2##3##4{%
900 \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
901 \def\unnumbsecentry ##1##2{%
902 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
903 \def\subsecentry ##1##2##3##4##5{%
904 \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
905 \def\unnumbsubsecentry ##1##2{%
906 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
907 \def\subsubsecentry ##1##2##3##4##5##6{%
908 \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
909 \def\unnumbsubsubsecentry ##1##2{%
910 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
911 \input \jobname.toc
912 \egroup\fi
914 \pdfmakeoutlines
916 \def\makelinks #1,{%
917 \def\params{#1}\def\E{END}%
918 \ifx\params\E
919 \let\nextmakelinks=\relax
920 \else
921 \let\nextmakelinks=\makelinks
922 \ifnum\lnkcount>0,\fi
923 \picknum{#1}%
924 \Blue\pdfannotlink attr{/Border [0 0 0]}
925 goto name{\pdfmkpgn{\the\pgn}}%
927 \advance\lnkcount by 1%
928 \Black\pdfendlink
930 \nextmakelinks
933 \def\picknum#1{\expandafter\pn#1}
934 \def\pn#1{%
935 \def\p{#1}%
936 \ifx\p\lbrace
937 \let\nextpn=\ppn
938 \else
939 \let\nextpn=\ppnn
940 \def\first{#1}
942 \nextpn
944 \def\ppn#1{\pgn=#1\gobble}
945 \def\ppnn{\pgn=\first}
946 \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
948 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
949 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
950 \ifx\PP\D\let\nextsp\relax
951 \else\let\nextsp\skipspaces
952 \ifx\p\space\else\addtokens{\filename}{\PP}%
953 \advance\filenamelength by 1
956 \nextsp}
957 \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
959 \def\pdflink#1{%
960 \leavevmode\Red
961 \begingroup
962 \normalturnoffactive\def\@{@}%
963 \pdfannotlink
964 attr{/Border [0 0 0]}%
965 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
966 \endgroup
969 \else
970 \let\pdflink = \gobble
971 \fi % end \ifpdf
973 \message{fonts,}
974 % Font-change commands.
976 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
977 % So we set up a \sf analogous to plain's \rm, etc.
978 \newfam\sffam
979 \def\sf{\fam=\sffam \tensf}
980 \let\li = \sf % Sometimes we call it \li, not \sf.
982 % We don't need math for this one.
983 \def\ttsl{\tenttsl}
985 % Use Computer Modern fonts at \magstephalf (11pt).
986 \newcount\mainmagstep
987 \mainmagstep=\magstephalf
989 % Set the font macro #1 to the font named #2, adding on the
990 % specified font prefix (normally `cm').
991 % #3 is the font's design size, #4 is a scale factor
992 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
994 % Use cm as the default font prefix.
995 % To specify the font prefix, you must define \fontprefix
996 % before you read in texinfo.tex.
997 \ifx\fontprefix\undefined
998 \def\fontprefix{cm}
1000 % Support font families that don't use the same naming scheme as CM.
1001 \def\rmshape{r}
1002 \def\rmbshape{bx} %where the normal face is bold
1003 \def\bfshape{b}
1004 \def\bxshape{bx}
1005 \def\ttshape{tt}
1006 \def\ttbshape{tt}
1007 \def\ttslshape{sltt}
1008 \def\itshape{ti}
1009 \def\itbshape{bxti}
1010 \def\slshape{sl}
1011 \def\slbshape{bxsl}
1012 \def\sfshape{ss}
1013 \def\sfbshape{ss}
1014 \def\scshape{csc}
1015 \def\scbshape{csc}
1017 \ifx\bigger\relax
1018 \let\mainmagstep=\magstep1
1019 \setfont\textrm\rmshape{12}{1000}
1020 \setfont\texttt\ttshape{12}{1000}
1021 \else
1022 \setfont\textrm\rmshape{10}{\mainmagstep}
1023 \setfont\texttt\ttshape{10}{\mainmagstep}
1025 % Instead of cmb10, you many want to use cmbx10.
1026 % cmbx10 is a prettier font on its own, but cmb10
1027 % looks better when embedded in a line with cmr10.
1028 \setfont\textbf\bfshape{10}{\mainmagstep}
1029 \setfont\textit\itshape{10}{\mainmagstep}
1030 \setfont\textsl\slshape{10}{\mainmagstep}
1031 \setfont\textsf\sfshape{10}{\mainmagstep}
1032 \setfont\textsc\scshape{10}{\mainmagstep}
1033 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1034 \font\texti=cmmi10 scaled \mainmagstep
1035 \font\textsy=cmsy10 scaled \mainmagstep
1037 % A few fonts for @defun, etc.
1038 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1039 \setfont\deftt\ttshape{10}{\magstep1}
1040 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1042 % Fonts for indices and small examples (9pt).
1043 % We actually use the slanted font rather than the italic,
1044 % because texinfo normally uses the slanted fonts for that.
1045 % Do not make many font distinctions in general in the index, since they
1046 % aren't very useful.
1047 \setfont\ninett\ttshape{9}{1000}
1048 \setfont\ninettsl\ttslshape{10}{900}
1049 \setfont\indrm\rmshape{9}{1000}
1050 \setfont\indit\itshape{9}{1000}
1051 \setfont\indsl\slshape{9}{1000}
1052 \let\indtt=\ninett
1053 \let\indttsl=\ninettsl
1054 \let\indsf=\indrm
1055 \let\indbf=\indrm
1056 \setfont\indsc\scshape{10}{900}
1057 \font\indi=cmmi9
1058 \font\indsy=cmsy9
1060 % Fonts for title page:
1061 \setfont\titlerm\rmbshape{12}{\magstep3}
1062 \setfont\titleit\itbshape{10}{\magstep4}
1063 \setfont\titlesl\slbshape{10}{\magstep4}
1064 \setfont\titlett\ttbshape{12}{\magstep3}
1065 \setfont\titlettsl\ttslshape{10}{\magstep4}
1066 \setfont\titlesf\sfbshape{17}{\magstep1}
1067 \let\titlebf=\titlerm
1068 \setfont\titlesc\scbshape{10}{\magstep4}
1069 \font\titlei=cmmi12 scaled \magstep3
1070 \font\titlesy=cmsy10 scaled \magstep4
1071 \def\authorrm{\secrm}
1073 % Chapter (and unnumbered) fonts (17.28pt).
1074 \setfont\chaprm\rmbshape{12}{\magstep2}
1075 \setfont\chapit\itbshape{10}{\magstep3}
1076 \setfont\chapsl\slbshape{10}{\magstep3}
1077 \setfont\chaptt\ttbshape{12}{\magstep2}
1078 \setfont\chapttsl\ttslshape{10}{\magstep3}
1079 \setfont\chapsf\sfbshape{17}{1000}
1080 \let\chapbf=\chaprm
1081 \setfont\chapsc\scbshape{10}{\magstep3}
1082 \font\chapi=cmmi12 scaled \magstep2
1083 \font\chapsy=cmsy10 scaled \magstep3
1085 % Section fonts (14.4pt).
1086 \setfont\secrm\rmbshape{12}{\magstep1}
1087 \setfont\secit\itbshape{10}{\magstep2}
1088 \setfont\secsl\slbshape{10}{\magstep2}
1089 \setfont\sectt\ttbshape{12}{\magstep1}
1090 \setfont\secttsl\ttslshape{10}{\magstep2}
1091 \setfont\secsf\sfbshape{12}{\magstep1}
1092 \let\secbf\secrm
1093 \setfont\secsc\scbshape{10}{\magstep2}
1094 \font\seci=cmmi12 scaled \magstep1
1095 \font\secsy=cmsy10 scaled \magstep2
1097 % \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
1098 % \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
1099 % \setfont\ssecsl\slshape{10}{\magstep1}
1100 % \setfont\ssectt\ttshape{10}{\magstep1}
1101 % \setfont\ssecsf\sfshape{10}{\magstep1}
1103 %\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
1104 %\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
1105 %\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
1106 %\setfont\ssectt\ttshape{10}{1315}
1107 %\setfont\ssecsf\sfshape{10}{1315}
1109 %\let\ssecbf=\ssecrm
1111 % Subsection fonts (13.15pt).
1112 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1113 \setfont\ssecit\itbshape{10}{1315}
1114 \setfont\ssecsl\slbshape{10}{1315}
1115 \setfont\ssectt\ttbshape{12}{\magstephalf}
1116 \setfont\ssecttsl\ttslshape{10}{1315}
1117 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1118 \let\ssecbf\ssecrm
1119 \setfont\ssecsc\scbshape{10}{\magstep1}
1120 \font\sseci=cmmi12 scaled \magstephalf
1121 \font\ssecsy=cmsy10 scaled 1315
1122 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1123 % but that is not a standard magnification.
1125 % In order for the font changes to affect most math symbols and letters,
1126 % we have to define the \textfont of the standard families. Since
1127 % texinfo doesn't allow for producing subscripts and superscripts, we
1128 % don't bother to reset \scriptfont and \scriptscriptfont (which would
1129 % also require loading a lot more fonts).
1131 \def\resetmathfonts{%
1132 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1133 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1134 \textfont\ttfam = \tentt \textfont\sffam = \tensf
1138 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1139 % of just \STYLE. We do this so that font changes will continue to work
1140 % in math mode, where it is the current \fam that is relevant in most
1141 % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
1142 % \tenbf}, for example. By redefining \tenbf, we obviate the need to
1143 % redefine \bf itself.
1144 \def\textfonts{%
1145 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1146 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1147 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1148 \resetmathfonts}
1149 \def\titlefonts{%
1150 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
1151 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
1152 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
1153 \let\tenttsl=\titlettsl
1154 \resetmathfonts \setleading{25pt}}
1155 \def\titlefont#1{{\titlefonts\rm #1}}
1156 \def\chapfonts{%
1157 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1158 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1159 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1160 \resetmathfonts \setleading{19pt}}
1161 \def\secfonts{%
1162 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1163 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1164 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1165 \resetmathfonts \setleading{16pt}}
1166 \def\subsecfonts{%
1167 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1168 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1169 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1170 \resetmathfonts \setleading{15pt}}
1171 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1172 \def\indexfonts{%
1173 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
1174 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
1175 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
1176 \resetmathfonts \setleading{12pt}}
1178 % Set up the default fonts, so we can use them for creating boxes.
1180 \textfonts
1182 % Define these so they can be easily changed for other fonts.
1183 \def\angleleft{$\langle$}
1184 \def\angleright{$\rangle$}
1186 % Count depth in font-changes, for error checks
1187 \newcount\fontdepth \fontdepth=0
1189 % Fonts for short table of contents.
1190 \setfont\shortcontrm\rmshape{12}{1000}
1191 \setfont\shortcontbf\bxshape{12}{1000}
1192 \setfont\shortcontsl\slshape{12}{1000}
1194 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1195 %% serif) and @ii for TeX italic
1197 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1198 % unless the following character is such as not to need one.
1199 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1200 \def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx}
1201 \def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx}
1203 \let\i=\smartitalic
1204 \let\var=\smartslanted
1205 \let\dfn=\smartslanted
1206 \let\emph=\smartitalic
1207 \let\cite=\smartslanted
1209 \def\b#1{{\bf #1}}
1210 \let\strong=\b
1212 % We can't just use \exhyphenpenalty, because that only has effect at
1213 % the end of a paragraph. Restore normal hyphenation at the end of the
1214 % group within which \nohyphenation is presumably called.
1216 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1217 \def\restorehyphenation{\hyphenchar\font = `- }
1219 \def\t#1{%
1220 {\tt \rawbackslash \frenchspacing #1}%
1221 \null
1223 \let\ttfont=\t
1224 \def\samp#1{`\tclose{#1}'\null}
1225 \setfont\smallrm\rmshape{8}{1000}
1226 \font\smallsy=cmsy9
1227 \def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
1228 \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
1229 \vbox{\hrule\kern-0.4pt
1230 \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
1231 \kern-0.4pt\hrule}%
1232 \kern-.06em\raise0.4pt\hbox{\angleright}}}}
1233 % The old definition, with no lozenge:
1234 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1235 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1237 % @file, @option are the same as @samp.
1238 \let\file=\samp
1239 \let\option=\samp
1241 % @code is a modification of @t,
1242 % which makes spaces the same size as normal in the surrounding text.
1243 \def\tclose#1{%
1245 % Change normal interword space to be same as for the current font.
1246 \spaceskip = \fontdimen2\font
1248 % Switch to typewriter.
1251 % But `\ ' produces the large typewriter interword space.
1252 \def\ {{\spaceskip = 0pt{} }}%
1254 % Turn off hyphenation.
1255 \nohyphenation
1257 \rawbackslash
1258 \frenchspacing
1261 \null
1264 % We *must* turn on hyphenation at `-' and `_' in \code.
1265 % Otherwise, it is too hard to avoid overfull hboxes
1266 % in the Emacs manual, the Library manual, etc.
1268 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1269 % both hyphenation at - and hyphenation within words.
1270 % We must therefore turn them both off (\tclose does that)
1271 % and arrange explicitly to hyphenate at a dash.
1272 % -- rms.
1274 \catcode`\-=\active
1275 \catcode`\_=\active
1277 \global\def\code{\begingroup
1278 \catcode`\-=\active \let-\codedash
1279 \catcode`\_=\active \let_\codeunder
1280 \codex
1283 % If we end up with any active - characters when handling the index,
1284 % just treat them as a normal -.
1285 \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
1288 \def\realdash{-}
1289 \def\codedash{-\discretionary{}{}{}}
1290 \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
1291 \def\codex #1{\tclose{#1}\endgroup}
1293 %\let\exp=\tclose %Was temporary
1295 % @kbd is like @code, except that if the argument is just one @key command,
1296 % then @kbd has no effect.
1298 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
1299 % `example' (@kbd uses ttsl only inside of @example and friends),
1300 % or `code' (@kbd uses normal tty font always).
1301 \def\kbdinputstyle{\parsearg\kbdinputstylexxx}
1302 \def\kbdinputstylexxx#1{%
1303 \def\arg{#1}%
1304 \ifx\arg\worddistinct
1305 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
1306 \else\ifx\arg\wordexample
1307 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
1308 \else\ifx\arg\wordcode
1309 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
1310 \fi\fi\fi
1312 \def\worddistinct{distinct}
1313 \def\wordexample{example}
1314 \def\wordcode{code}
1316 % Default is kbdinputdistinct. (Too much of a hassle to call the macro,
1317 % the catcodes are wrong for parsearg to work.)
1318 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
1320 \def\xkey{\key}
1321 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1322 \ifx\one\xkey\ifx\threex\three \key{#2}%
1323 \else{\tclose{\kbdfont\look}}\fi
1324 \else{\tclose{\kbdfont\look}}\fi}
1326 % For @url, @env, @command quotes seem unnecessary, so use \code.
1327 \let\url=\code
1328 \let\env=\code
1329 \let\command=\code
1331 % @uref (abbreviation for `urlref') takes an optional (comma-separated)
1332 % second argument specifying the text to display and an optional third
1333 % arg as text to display instead of (rather than in addition to) the url
1334 % itself. First (mandatory) arg is the url. Perhaps eventually put in
1335 % a hypertex \special here.
1337 \def\uref#1{\douref #1,,,\finish}
1338 \def\douref#1,#2,#3,#4\finish{%
1339 \pdflink{#1}%
1340 \setbox0 = \hbox{\ignorespaces #3}%
1341 \ifdim\wd0 > 0pt
1342 \unhbox0 % third arg given, show only that
1343 \else
1344 \setbox0 = \hbox{\ignorespaces #2}%
1345 \ifdim\wd0 > 0pt
1346 \ifpdf
1347 \unhbox0 % PDF: 2nd arg given, show only it
1348 \else
1349 \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
1351 \else
1352 \code{#1}% only url given, so show it
1356 \ifpdf
1357 \Black\pdfendlink
1361 % rms does not like angle brackets --karl, 17may97.
1362 % So now @email is just like @uref, unless we are pdf.
1364 %\def\email#1{\angleleft{\tt #1}\angleright}
1365 \ifpdf
1366 \def\email#1{\doemail#1,,\finish}
1367 \def\doemail#1,#2,#3\finish{%
1368 \pdflink{mailto:#1}%
1369 \setbox0 = \hbox{\ignorespaces #2}%
1370 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
1371 \Black\pdfendlink
1373 \else
1374 \let\email=\uref
1377 % Check if we are currently using a typewriter font. Since all the
1378 % Computer Modern typewriter fonts have zero interword stretch (and
1379 % shrink), and it is reasonable to expect all typewriter fonts to have
1380 % this property, we can check that font parameter.
1382 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1384 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1385 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
1387 \def\dmn#1{\thinspace #1}
1389 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1391 % @l was never documented to mean ``switch to the Lisp font'',
1392 % and it is not used as such in any manual I can find. We need it for
1393 % Polish suppressed-l. --karl, 22sep96.
1394 %\def\l#1{{\li #1}\null}
1396 % Explicit font changes: @r, @sc, undocumented @ii.
1397 \def\r#1{{\rm #1}} % roman font
1398 \def\sc#1{{\smallcaps#1}} % smallcaps font
1399 \def\ii#1{{\it #1}} % italic font
1401 % @acronym downcases the argument and prints in smallcaps.
1402 \def\acronym#1{{\smallcaps \lowercase{#1}}}
1404 % @pounds{} is a sterling sign.
1405 \def\pounds{{\it\$}}
1408 \message{page headings,}
1410 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1411 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1413 % First the title page. Must do @settitle before @titlepage.
1414 \newif\ifseenauthor
1415 \newif\iffinishedtitlepage
1417 % Do an implicit @contents or @shortcontents after @end titlepage if the
1418 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
1420 \newif\ifsetcontentsaftertitlepage
1421 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
1422 \newif\ifsetshortcontentsaftertitlepage
1423 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
1425 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1426 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1427 \endgroup\page\hbox{}\page}
1429 \def\titlepage{\begingroup \parindent=0pt \textfonts
1430 \let\subtitlerm=\tenrm
1431 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1433 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1435 % Leave some space at the very top of the page.
1436 \vglue\titlepagetopglue
1438 % Now you can print the title using @title.
1439 \def\title{\parsearg\titlezzz}%
1440 \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
1441 % print a rule at the page bottom also.
1442 \finishedtitlepagefalse
1443 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1444 % No rule at page bottom unless we print one at the top with @title.
1445 \finishedtitlepagetrue
1447 % Now you can put text using @subtitle.
1448 \def\subtitle{\parsearg\subtitlezzz}%
1449 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1451 % @author should come last, but may come many times.
1452 \def\author{\parsearg\authorzzz}%
1453 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1454 {\authorfont \leftline{##1}}}%
1456 % Most title ``pages'' are actually two pages long, with space
1457 % at the top of the second. We don't want the ragged left on the second.
1458 \let\oldpage = \page
1459 \def\page{%
1460 \iffinishedtitlepage\else
1461 \finishtitlepage
1463 \oldpage
1464 \let\page = \oldpage
1465 \hbox{}}%
1466 % \def\page{\oldpage \hbox{}}
1469 \def\Etitlepage{%
1470 \iffinishedtitlepage\else
1471 \finishtitlepage
1473 % It is important to do the page break before ending the group,
1474 % because the headline and footline are only empty inside the group.
1475 % If we use the new definition of \page, we always get a blank page
1476 % after the title page, which we certainly don't want.
1477 \oldpage
1478 \endgroup
1480 % If they want short, they certainly want long too.
1481 \ifsetshortcontentsaftertitlepage
1482 \shortcontents
1483 \contents
1484 \global\let\shortcontents = \relax
1485 \global\let\contents = \relax
1488 \ifsetcontentsaftertitlepage
1489 \contents
1490 \global\let\contents = \relax
1491 \global\let\shortcontents = \relax
1494 \HEADINGSon
1497 \def\finishtitlepage{%
1498 \vskip4pt \hrule height 2pt width \hsize
1499 \vskip\titlepagebottomglue
1500 \finishedtitlepagetrue
1503 %%% Set up page headings and footings.
1505 \let\thispage=\folio
1507 \newtoks\evenheadline % headline on even pages
1508 \newtoks\oddheadline % headline on odd pages
1509 \newtoks\evenfootline % footline on even pages
1510 \newtoks\oddfootline % footline on odd pages
1512 % Now make Tex use those variables
1513 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1514 \else \the\evenheadline \fi}}
1515 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1516 \else \the\evenfootline \fi}\HEADINGShook}
1517 \let\HEADINGShook=\relax
1519 % Commands to set those variables.
1520 % For example, this is what @headings on does
1521 % @evenheading @thistitle|@thispage|@thischapter
1522 % @oddheading @thischapter|@thispage|@thistitle
1523 % @evenfooting @thisfile||
1524 % @oddfooting ||@thisfile
1526 \def\evenheading{\parsearg\evenheadingxxx}
1527 \def\oddheading{\parsearg\oddheadingxxx}
1528 \def\everyheading{\parsearg\everyheadingxxx}
1530 \def\evenfooting{\parsearg\evenfootingxxx}
1531 \def\oddfooting{\parsearg\oddfootingxxx}
1532 \def\everyfooting{\parsearg\everyfootingxxx}
1534 {\catcode`\@=0 %
1536 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1537 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1538 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1540 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1541 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1542 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1544 \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
1546 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1547 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1548 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1550 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1551 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1552 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
1554 % Leave some space for the footline. Hopefully ok to assume
1555 % @evenfooting will not be used by itself.
1556 \global\advance\pageheight by -\baselineskip
1557 \global\advance\vsize by -\baselineskip
1560 \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
1562 }% unbind the catcode of @.
1564 % @headings double turns headings on for double-sided printing.
1565 % @headings single turns headings on for single-sided printing.
1566 % @headings off turns them off.
1567 % @headings on same as @headings double, retained for compatibility.
1568 % @headings after turns on double-sided headings after this page.
1569 % @headings doubleafter turns on double-sided headings after this page.
1570 % @headings singleafter turns on single-sided headings after this page.
1571 % By default, they are off at the start of a document,
1572 % and turned `on' after @end titlepage.
1574 \def\headings #1 {\csname HEADINGS#1\endcsname}
1576 \def\HEADINGSoff{
1577 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1578 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1579 \HEADINGSoff
1580 % When we turn headings on, set the page number to 1.
1581 % For double-sided printing, put current file name in lower left corner,
1582 % chapter name on inside top of right hand pages, document
1583 % title on inside top of left hand pages, and page numbers on outside top
1584 % edge of all pages.
1585 \def\HEADINGSdouble{
1586 \global\pageno=1
1587 \global\evenfootline={\hfil}
1588 \global\oddfootline={\hfil}
1589 \global\evenheadline={\line{\folio\hfil\thistitle}}
1590 \global\oddheadline={\line{\thischapter\hfil\folio}}
1591 \global\let\contentsalignmacro = \chapoddpage
1593 \let\contentsalignmacro = \chappager
1595 % For single-sided printing, chapter title goes across top left of page,
1596 % page number on top right.
1597 \def\HEADINGSsingle{
1598 \global\pageno=1
1599 \global\evenfootline={\hfil}
1600 \global\oddfootline={\hfil}
1601 \global\evenheadline={\line{\thischapter\hfil\folio}}
1602 \global\oddheadline={\line{\thischapter\hfil\folio}}
1603 \global\let\contentsalignmacro = \chappager
1605 \def\HEADINGSon{\HEADINGSdouble}
1607 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1608 \let\HEADINGSdoubleafter=\HEADINGSafter
1609 \def\HEADINGSdoublex{%
1610 \global\evenfootline={\hfil}
1611 \global\oddfootline={\hfil}
1612 \global\evenheadline={\line{\folio\hfil\thistitle}}
1613 \global\oddheadline={\line{\thischapter\hfil\folio}}
1614 \global\let\contentsalignmacro = \chapoddpage
1617 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1618 \def\HEADINGSsinglex{%
1619 \global\evenfootline={\hfil}
1620 \global\oddfootline={\hfil}
1621 \global\evenheadline={\line{\thischapter\hfil\folio}}
1622 \global\oddheadline={\line{\thischapter\hfil\folio}}
1623 \global\let\contentsalignmacro = \chappager
1626 % Subroutines used in generating headings
1627 % Produces Day Month Year style of output.
1628 \def\today{%
1629 \number\day\space
1630 \ifcase\month
1631 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
1632 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
1633 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
1635 \space\number\year}
1637 % @settitle line... specifies the title of the document, for headings.
1638 % It generates no output of its own.
1639 \def\thistitle{\putwordNoTitle}
1640 \def\settitle{\parsearg\settitlezzz}
1641 \def\settitlezzz #1{\gdef\thistitle{#1}}
1644 \message{tables,}
1645 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1647 % default indentation of table text
1648 \newdimen\tableindent \tableindent=.8in
1649 % default indentation of @itemize and @enumerate text
1650 \newdimen\itemindent \itemindent=.3in
1651 % margin between end of table item and start of table text.
1652 \newdimen\itemmargin \itemmargin=.1in
1654 % used internally for \itemindent minus \itemmargin
1655 \newdimen\itemmax
1657 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1658 % these defs.
1659 % They also define \itemindex
1660 % to index the item name in whatever manner is desired (perhaps none).
1662 \newif\ifitemxneedsnegativevskip
1664 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1666 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1667 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1669 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1670 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1672 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1673 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1675 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1676 \itemzzz {#1}}
1678 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1679 \itemzzz {#1}}
1681 \def\itemzzz #1{\begingroup %
1682 \advance\hsize by -\rightskip
1683 \advance\hsize by -\tableindent
1684 \setbox0=\hbox{\itemfont{#1}}%
1685 \itemindex{#1}%
1686 \nobreak % This prevents a break before @itemx.
1688 % If the item text does not fit in the space we have, put it on a line
1689 % by itself, and do not allow a page break either before or after that
1690 % line. We do not start a paragraph here because then if the next
1691 % command is, e.g., @kindex, the whatsit would get put into the
1692 % horizontal list on a line by itself, resulting in extra blank space.
1693 \ifdim \wd0>\itemmax
1695 % Make this a paragraph so we get the \parskip glue and wrapping,
1696 % but leave it ragged-right.
1697 \begingroup
1698 \advance\leftskip by-\tableindent
1699 \advance\hsize by\tableindent
1700 \advance\rightskip by0pt plus1fil
1701 \leavevmode\unhbox0\par
1702 \endgroup
1704 % We're going to be starting a paragraph, but we don't want the
1705 % \parskip glue -- logically it's part of the @item we just started.
1706 \nobreak \vskip-\parskip
1708 % Stop a page break at the \parskip glue coming up. Unfortunately
1709 % we can't prevent a possible page break at the following
1710 % \baselineskip glue.
1711 \nobreak
1712 \endgroup
1713 \itemxneedsnegativevskipfalse
1714 \else
1715 % The item text fits into the space. Start a paragraph, so that the
1716 % following text (if any) will end up on the same line.
1717 \noindent
1718 % Do this with kerns and \unhbox so that if there is a footnote in
1719 % the item text, it can migrate to the main vertical list and
1720 % eventually be printed.
1721 \nobreak\kern-\tableindent
1722 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
1723 \unhbox0
1724 \nobreak\kern\dimen0
1725 \endgroup
1726 \itemxneedsnegativevskiptrue
1730 \def\item{\errmessage{@item while not in a table}}
1731 \def\itemx{\errmessage{@itemx while not in a table}}
1732 \def\kitem{\errmessage{@kitem while not in a table}}
1733 \def\kitemx{\errmessage{@kitemx while not in a table}}
1734 \def\xitem{\errmessage{@xitem while not in a table}}
1735 \def\xitemx{\errmessage{@xitemx while not in a table}}
1737 % Contains a kludge to get @end[description] to work.
1738 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1740 % @table, @ftable, @vtable.
1741 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1742 {\obeylines\obeyspaces%
1743 \gdef\tablex #1^^M{%
1744 \tabley\dontindex#1 \endtabley}}
1746 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1747 {\obeylines\obeyspaces%
1748 \gdef\ftablex #1^^M{%
1749 \tabley\fnitemindex#1 \endtabley
1750 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1751 \let\Etable=\relax}}
1753 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1754 {\obeylines\obeyspaces%
1755 \gdef\vtablex #1^^M{%
1756 \tabley\vritemindex#1 \endtabley
1757 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1758 \let\Etable=\relax}}
1760 \def\dontindex #1{}
1761 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1762 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1764 {\obeyspaces %
1765 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1766 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1768 \def\tablez #1#2#3#4#5#6{%
1769 \aboveenvbreak %
1770 \begingroup %
1771 \def\Edescription{\Etable}% Necessary kludge.
1772 \let\itemindex=#1%
1773 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1774 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1775 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1776 \def\itemfont{#2}%
1777 \itemmax=\tableindent %
1778 \advance \itemmax by -\itemmargin %
1779 \advance \leftskip by \tableindent %
1780 \exdentamount=\tableindent
1781 \parindent = 0pt
1782 \parskip = \smallskipamount
1783 \ifdim \parskip=0pt \parskip=2pt \fi%
1784 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1785 \let\item = \internalBitem %
1786 \let\itemx = \internalBitemx %
1787 \let\kitem = \internalBkitem %
1788 \let\kitemx = \internalBkitemx %
1789 \let\xitem = \internalBxitem %
1790 \let\xitemx = \internalBxitemx %
1793 % This is the counter used by @enumerate, which is really @itemize
1795 \newcount \itemno
1797 \def\itemize{\parsearg\itemizezzz}
1799 \def\itemizezzz #1{%
1800 \begingroup % ended by the @end itemize
1801 \itemizey {#1}{\Eitemize}
1804 \def\itemizey #1#2{%
1805 \aboveenvbreak %
1806 \itemmax=\itemindent %
1807 \advance \itemmax by -\itemmargin %
1808 \advance \leftskip by \itemindent %
1809 \exdentamount=\itemindent
1810 \parindent = 0pt %
1811 \parskip = \smallskipamount %
1812 \ifdim \parskip=0pt \parskip=2pt \fi%
1813 \def#2{\endgraf\afterenvbreak\endgroup}%
1814 \def\itemcontents{#1}%
1815 \let\item=\itemizeitem}
1817 % Set sfcode to normal for the chars that usually have another value.
1818 % These are `.?!:;,'
1819 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1820 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1822 % \splitoff TOKENS\endmark defines \first to be the first token in
1823 % TOKENS, and \rest to be the remainder.
1825 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1827 % Allow an optional argument of an uppercase letter, lowercase letter,
1828 % or number, to specify the first label in the enumerated list. No
1829 % argument is the same as `1'.
1831 \def\enumerate{\parsearg\enumeratezzz}
1832 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1833 \def\enumeratey #1 #2\endenumeratey{%
1834 \begingroup % ended by the @end enumerate
1836 % If we were given no argument, pretend we were given `1'.
1837 \def\thearg{#1}%
1838 \ifx\thearg\empty \def\thearg{1}\fi
1840 % Detect if the argument is a single token. If so, it might be a
1841 % letter. Otherwise, the only valid thing it can be is a number.
1842 % (We will always have one token, because of the test we just made.
1843 % This is a good thing, since \splitoff doesn't work given nothing at
1844 % all -- the first parameter is undelimited.)
1845 \expandafter\splitoff\thearg\endmark
1846 \ifx\rest\empty
1847 % Only one token in the argument. It could still be anything.
1848 % A ``lowercase letter'' is one whose \lccode is nonzero.
1849 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1850 % not equal to itself.
1851 % Otherwise, we assume it's a number.
1853 % We need the \relax at the end of the \ifnum lines to stop TeX from
1854 % continuing to look for a <number>.
1856 \ifnum\lccode\expandafter`\thearg=0\relax
1857 \numericenumerate % a number (we hope)
1858 \else
1859 % It's a letter.
1860 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1861 \lowercaseenumerate % lowercase letter
1862 \else
1863 \uppercaseenumerate % uppercase letter
1866 \else
1867 % Multiple tokens in the argument. We hope it's a number.
1868 \numericenumerate
1872 % An @enumerate whose labels are integers. The starting integer is
1873 % given in \thearg.
1875 \def\numericenumerate{%
1876 \itemno = \thearg
1877 \startenumeration{\the\itemno}%
1880 % The starting (lowercase) letter is in \thearg.
1881 \def\lowercaseenumerate{%
1882 \itemno = \expandafter`\thearg
1883 \startenumeration{%
1884 % Be sure we're not beyond the end of the alphabet.
1885 \ifnum\itemno=0
1886 \errmessage{No more lowercase letters in @enumerate; get a bigger
1887 alphabet}%
1889 \char\lccode\itemno
1893 % The starting (uppercase) letter is in \thearg.
1894 \def\uppercaseenumerate{%
1895 \itemno = \expandafter`\thearg
1896 \startenumeration{%
1897 % Be sure we're not beyond the end of the alphabet.
1898 \ifnum\itemno=0
1899 \errmessage{No more uppercase letters in @enumerate; get a bigger
1900 alphabet}
1902 \char\uccode\itemno
1906 % Call itemizey, adding a period to the first argument and supplying the
1907 % common last two arguments. Also subtract one from the initial value in
1908 % \itemno, since @item increments \itemno.
1910 \def\startenumeration#1{%
1911 \advance\itemno by -1
1912 \itemizey{#1.}\Eenumerate\flushcr
1915 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
1916 % to @enumerate.
1918 \def\alphaenumerate{\enumerate{a}}
1919 \def\capsenumerate{\enumerate{A}}
1920 \def\Ealphaenumerate{\Eenumerate}
1921 \def\Ecapsenumerate{\Eenumerate}
1923 % Definition of @item while inside @itemize.
1925 \def\itemizeitem{%
1926 \advance\itemno by 1
1927 {\let\par=\endgraf \smallbreak}%
1928 \ifhmode \errmessage{In hmode at itemizeitem}\fi
1929 {\parskip=0in \hskip 0pt
1930 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
1931 \vadjust{\penalty 1200}}%
1932 \flushcr}
1934 % @multitable macros
1935 % Amy Hendrickson, 8/18/94, 3/6/96
1937 % @multitable ... @end multitable will make as many columns as desired.
1938 % Contents of each column will wrap at width given in preamble. Width
1939 % can be specified either with sample text given in a template line,
1940 % or in percent of \hsize, the current width of text on page.
1942 % Table can continue over pages but will only break between lines.
1944 % To make preamble:
1946 % Either define widths of columns in terms of percent of \hsize:
1947 % @multitable @columnfractions .25 .3 .45
1948 % @item ...
1950 % Numbers following @columnfractions are the percent of the total
1951 % current hsize to be used for each column. You may use as many
1952 % columns as desired.
1955 % Or use a template:
1956 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
1957 % @item ...
1958 % using the widest term desired in each column.
1960 % For those who want to use more than one line's worth of words in
1961 % the preamble, break the line within one argument and it
1962 % will parse correctly, i.e.,
1964 % @multitable {Column 1 template} {Column 2 template} {Column 3
1965 % template}
1966 % Not:
1967 % @multitable {Column 1 template} {Column 2 template}
1968 % {Column 3 template}
1970 % Each new table line starts with @item, each subsequent new column
1971 % starts with @tab. Empty columns may be produced by supplying @tab's
1972 % with nothing between them for as many times as empty columns are needed,
1973 % ie, @tab@tab@tab will produce two empty columns.
1975 % @item, @tab, @multitable or @end multitable do not need to be on their
1976 % own lines, but it will not hurt if they are.
1978 % Sample multitable:
1980 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
1981 % @item first col stuff @tab second col stuff @tab third col
1982 % @item
1983 % first col stuff
1984 % @tab
1985 % second col stuff
1986 % @tab
1987 % third col
1988 % @item first col stuff @tab second col stuff
1989 % @tab Many paragraphs of text may be used in any column.
1991 % They will wrap at the width determined by the template.
1992 % @item@tab@tab This will be in third column.
1993 % @end multitable
1995 % Default dimensions may be reset by user.
1996 % @multitableparskip is vertical space between paragraphs in table.
1997 % @multitableparindent is paragraph indent in table.
1998 % @multitablecolmargin is horizontal space to be left between columns.
1999 % @multitablelinespace is space to leave between table items, baseline
2000 % to baseline.
2001 % 0pt means it depends on current normal line spacing.
2003 \newskip\multitableparskip
2004 \newskip\multitableparindent
2005 \newdimen\multitablecolspace
2006 \newskip\multitablelinespace
2007 \multitableparskip=0pt
2008 \multitableparindent=6pt
2009 \multitablecolspace=12pt
2010 \multitablelinespace=0pt
2012 % Macros used to set up halign preamble:
2014 \let\endsetuptable\relax
2015 \def\xendsetuptable{\endsetuptable}
2016 \let\columnfractions\relax
2017 \def\xcolumnfractions{\columnfractions}
2018 \newif\ifsetpercent
2020 % #1 is the part of the @columnfraction before the decimal point, which
2021 % is presumably either 0 or the empty string (but we don't check, we
2022 % just throw it away). #2 is the decimal part, which we use as the
2023 % percent of \hsize for this column.
2024 \def\pickupwholefraction#1.#2 {%
2025 \global\advance\colcount by 1
2026 \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
2027 \setuptable
2030 \newcount\colcount
2031 \def\setuptable#1{%
2032 \def\firstarg{#1}%
2033 \ifx\firstarg\xendsetuptable
2034 \let\go = \relax
2035 \else
2036 \ifx\firstarg\xcolumnfractions
2037 \global\setpercenttrue
2038 \else
2039 \ifsetpercent
2040 \let\go\pickupwholefraction
2041 \else
2042 \global\advance\colcount by 1
2043 \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator;
2044 % typically that is always in the input, anyway.
2045 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2048 \ifx\go\pickupwholefraction
2049 % Put the argument back for the \pickupwholefraction call, so
2050 % we'll always have a period there to be parsed.
2051 \def\go{\pickupwholefraction#1}%
2052 \else
2053 \let\go = \setuptable
2054 \fi%
2059 % This used to have \hskip1sp. But then the space in a template line is
2060 % not enough. That is bad. So let's go back to just & until we
2061 % encounter the problem it was intended to solve again.
2062 % --karl, nathan@acm.org, 20apr99.
2063 \def\tab{&}
2065 % @multitable ... @end multitable definitions:
2067 \def\multitable{\parsearg\dotable}
2068 \def\dotable#1{\bgroup
2069 \vskip\parskip
2070 \let\item\crcr
2071 \tolerance=9500
2072 \hbadness=9500
2073 \setmultitablespacing
2074 \parskip=\multitableparskip
2075 \parindent=\multitableparindent
2076 \overfullrule=0pt
2077 \global\colcount=0
2078 \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
2080 % To parse everything between @multitable and @item:
2081 \setuptable#1 \endsetuptable
2083 % \everycr will reset column counter, \colcount, at the end of
2084 % each line. Every column entry will cause \colcount to advance by one.
2085 % The table preamble
2086 % looks at the current \colcount to find the correct column width.
2087 \everycr{\noalign{%
2089 % \filbreak%% keeps underfull box messages off when table breaks over pages.
2090 % Maybe so, but it also creates really weird page breaks when the table
2091 % breaks over pages. Wouldn't \vfil be better? Wait until the problem
2092 % manifests itself, so it can be fixed for real --karl.
2093 \global\colcount=0\relax}}%
2095 % This preamble sets up a generic column definition, which will
2096 % be used as many times as user calls for columns.
2097 % \vtop will set a single line and will also let text wrap and
2098 % continue for many paragraphs if desired.
2099 \halign\bgroup&\global\advance\colcount by 1\relax
2100 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2102 % In order to keep entries from bumping into each other
2103 % we will add a \leftskip of \multitablecolspace to all columns after
2104 % the first one.
2106 % If a template has been used, we will add \multitablecolspace
2107 % to the width of each template entry.
2109 % If the user has set preamble in terms of percent of \hsize we will
2110 % use that dimension as the width of the column, and the \leftskip
2111 % will keep entries from bumping into each other. Table will start at
2112 % left margin and final column will justify at right margin.
2114 % Make sure we don't inherit \rightskip from the outer environment.
2115 \rightskip=0pt
2116 \ifnum\colcount=1
2117 % The first column will be indented with the surrounding text.
2118 \advance\hsize by\leftskip
2119 \else
2120 \ifsetpercent \else
2121 % If user has not set preamble in terms of percent of \hsize
2122 % we will advance \hsize by \multitablecolspace.
2123 \advance\hsize by \multitablecolspace
2125 % In either case we will make \leftskip=\multitablecolspace:
2126 \leftskip=\multitablecolspace
2128 % Ignoring space at the beginning and end avoids an occasional spurious
2129 % blank line, when TeX decides to break the line at the space before the
2130 % box from the multistrut, so the strut ends up on a line by itself.
2131 % For example:
2132 % @multitable @columnfractions .11 .89
2133 % @item @code{#}
2134 % @tab Legal holiday which is valid in major parts of the whole country.
2135 % Is automatically provided with highlighting sequences respectively marking
2136 % characters.
2137 \noindent\ignorespaces##\unskip\multistrut}\cr
2140 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2141 % If so, do nothing. If not, give it an appropriate dimension based on
2142 % current baselineskip.
2143 \ifdim\multitablelinespace=0pt
2144 %% strut to put in table in case some entry doesn't have descenders,
2145 %% to keep lines equally spaced
2146 \let\multistrut = \strut
2147 %% Test to see if parskip is larger than space between lines of
2148 %% table. If not, do nothing.
2149 %% If so, set to same dimension as multitablelinespace.
2150 \else
2151 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2152 width0pt\relax} \fi
2153 \ifdim\multitableparskip>\multitablelinespace
2154 \global\multitableparskip=\multitablelinespace
2155 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2156 %% than skip between lines in the table.
2157 \fi%
2158 \ifdim\multitableparskip=0pt
2159 \global\multitableparskip=\multitablelinespace
2160 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2161 %% than skip between lines in the table.
2162 \fi}
2165 \message{conditionals,}
2166 % Prevent errors for section commands.
2167 % Used in @ignore and in failing conditionals.
2168 \def\ignoresections{%
2169 \let\chapter=\relax
2170 \let\unnumbered=\relax
2171 \let\top=\relax
2172 \let\unnumberedsec=\relax
2173 \let\unnumberedsection=\relax
2174 \let\unnumberedsubsec=\relax
2175 \let\unnumberedsubsection=\relax
2176 \let\unnumberedsubsubsec=\relax
2177 \let\unnumberedsubsubsection=\relax
2178 \let\section=\relax
2179 \let\subsec=\relax
2180 \let\subsubsec=\relax
2181 \let\subsection=\relax
2182 \let\subsubsection=\relax
2183 \let\appendix=\relax
2184 \let\appendixsec=\relax
2185 \let\appendixsection=\relax
2186 \let\appendixsubsec=\relax
2187 \let\appendixsubsection=\relax
2188 \let\appendixsubsubsec=\relax
2189 \let\appendixsubsubsection=\relax
2190 \let\contents=\relax
2191 \let\smallbook=\relax
2192 \let\titlepage=\relax
2195 % Used in nested conditionals, where we have to parse the Texinfo source
2196 % and so want to turn off most commands, in case they are used
2197 % incorrectly.
2199 \def\ignoremorecommands{%
2200 \let\defcodeindex = \relax
2201 \let\defcv = \relax
2202 \let\deffn = \relax
2203 \let\deffnx = \relax
2204 \let\defindex = \relax
2205 \let\defivar = \relax
2206 \let\defmac = \relax
2207 \let\defmethod = \relax
2208 \let\defop = \relax
2209 \let\defopt = \relax
2210 \let\defspec = \relax
2211 \let\deftp = \relax
2212 \let\deftypefn = \relax
2213 \let\deftypefun = \relax
2214 \let\deftypeivar = \relax
2215 \let\deftypevar = \relax
2216 \let\deftypevr = \relax
2217 \let\defun = \relax
2218 \let\defvar = \relax
2219 \let\defvr = \relax
2220 \let\ref = \relax
2221 \let\xref = \relax
2222 \let\printindex = \relax
2223 \let\pxref = \relax
2224 \let\settitle = \relax
2225 \let\setchapternewpage = \relax
2226 \let\setchapterstyle = \relax
2227 \let\everyheading = \relax
2228 \let\evenheading = \relax
2229 \let\oddheading = \relax
2230 \let\everyfooting = \relax
2231 \let\evenfooting = \relax
2232 \let\oddfooting = \relax
2233 \let\headings = \relax
2234 \let\include = \relax
2235 \let\lowersections = \relax
2236 \let\down = \relax
2237 \let\raisesections = \relax
2238 \let\up = \relax
2239 \let\set = \relax
2240 \let\clear = \relax
2241 \let\item = \relax
2244 % Ignore @ignore ... @end ignore.
2246 \def\ignore{\doignore{ignore}}
2248 % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
2250 \def\ifinfo{\doignore{ifinfo}}
2251 \def\ifhtml{\doignore{ifhtml}}
2252 \def\ifnottex{\doignore{ifnottex}}
2253 \def\html{\doignore{html}}
2254 \def\menu{\doignore{menu}}
2255 \def\direntry{\doignore{direntry}}
2257 % @dircategory CATEGORY -- specify a category of the dir file
2258 % which this file should belong to. Ignore this in TeX.
2259 \let\dircategory = \comment
2261 % Ignore text until a line `@end #1'.
2263 \def\doignore#1{\begingroup
2264 % Don't complain about control sequences we have declared \outer.
2265 \ignoresections
2267 % Define a command to swallow text until we reach `@end #1'.
2268 % This @ is a catcode 12 token (that is the normal catcode of @ in
2269 % this texinfo.tex file). We change the catcode of @ below to match.
2270 \long\def\doignoretext##1@end #1{\enddoignore}%
2272 % Make sure that spaces turn into tokens that match what \doignoretext wants.
2273 \catcode32 = 10
2275 % Ignore braces, too, so mismatched braces don't cause trouble.
2276 \catcode`\{ = 9
2277 \catcode`\} = 9
2279 % We must not have @c interpreted as a control sequence.
2280 \catcode`\@ = 12
2282 % Make the letter c a comment character so that the rest of the line
2283 % will be ignored. This way, the document can have (for example)
2284 % @c @end ifinfo
2285 % and the @end ifinfo will be properly ignored.
2286 % (We've just changed @ to catcode 12.)
2287 \catcode`\c = 14
2289 % And now expand that command.
2290 \doignoretext
2293 % What we do to finish off ignored text.
2295 \def\enddoignore{\endgroup\ignorespaces}%
2297 \newif\ifwarnedobs\warnedobsfalse
2298 \def\obstexwarn{%
2299 \ifwarnedobs\relax\else
2300 % We need to warn folks that they may have trouble with TeX 3.0.
2301 % This uses \immediate\write16 rather than \message to get newlines.
2302 \immediate\write16{}
2303 \immediate\write16{WARNING: for users of Unix TeX 3.0!}
2304 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
2305 \immediate\write16{If you are running another version of TeX, relax.}
2306 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
2307 \immediate\write16{ Then upgrade your TeX installation if you can.}
2308 \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
2309 \immediate\write16{If you are stuck with version 3.0, run the}
2310 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
2311 \immediate\write16{ to use a workaround.}
2312 \immediate\write16{}
2313 \global\warnedobstrue
2317 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
2318 % workaround (which requires the file ``dummy.tfm'' to be installed),
2319 % uncomment the following line:
2320 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
2322 % Ignore text, except that we keep track of conditional commands for
2323 % purposes of nesting, up to an `@end #1' command.
2325 \def\nestedignore#1{%
2326 \obstexwarn
2327 % We must actually expand the ignored text to look for the @end
2328 % command, so that nested ignore constructs work. Thus, we put the
2329 % text into a \vbox and then do nothing with the result. To minimize
2330 % the change of memory overflow, we follow the approach outlined on
2331 % page 401 of the TeXbook: make the current font be a dummy font.
2333 \setbox0 = \vbox\bgroup
2334 % Don't complain about control sequences we have declared \outer.
2335 \ignoresections
2337 % Define `@end #1' to end the box, which will in turn undefine the
2338 % @end command again.
2339 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
2341 % We are going to be parsing Texinfo commands. Most cause no
2342 % trouble when they are used incorrectly, but some commands do
2343 % complicated argument parsing or otherwise get confused, so we
2344 % undefine them.
2346 % We can't do anything about stray @-signs, unfortunately;
2347 % they'll produce `undefined control sequence' errors.
2348 \ignoremorecommands
2350 % Set the current font to be \nullfont, a TeX primitive, and define
2351 % all the font commands to also use \nullfont. We don't use
2352 % dummy.tfm, as suggested in the TeXbook, because not all sites
2353 % might have that installed. Therefore, math mode will still
2354 % produce output, but that should be an extremely small amount of
2355 % stuff compared to the main input.
2357 \nullfont
2358 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
2359 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
2360 \let\tensf = \nullfont
2361 % Similarly for index fonts (mostly for their use in
2362 % smallexample)
2363 \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
2364 \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
2365 \let\indsf = \nullfont
2367 % Don't complain when characters are missing from the fonts.
2368 \tracinglostchars = 0
2370 % Don't bother to do space factor calculations.
2371 \frenchspacing
2373 % Don't report underfull hboxes.
2374 \hbadness = 10000
2376 % Do minimal line-breaking.
2377 \pretolerance = 10000
2379 % Do not execute instructions in @tex
2380 \def\tex{\doignore{tex}}%
2381 % Do not execute macro definitions.
2382 % `c' is a comment character, so the word `macro' will get cut off.
2383 \def\macro{\doignore{ma}}%
2386 % @set VAR sets the variable VAR to an empty value.
2387 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
2389 % Since we want to separate VAR from REST-OF-LINE (which might be
2390 % empty), we can't just use \parsearg; we have to insert a space of our
2391 % own to delimit the rest of the line, and then take it out again if we
2392 % didn't need it. Make sure the catcode of space is correct to avoid
2393 % losing inside @example, for instance.
2395 \def\set{\begingroup\catcode` =10
2396 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
2397 \parsearg\setxxx}
2398 \def\setxxx#1{\setyyy#1 \endsetyyy}
2399 \def\setyyy#1 #2\endsetyyy{%
2400 \def\temp{#2}%
2401 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
2402 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
2404 \endgroup
2406 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
2407 % \next or other control sequences that we've defined might get us into
2408 % an infinite loop. Consider `@set foo @cite{bar}'.
2409 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
2411 % @clear VAR clears (i.e., unsets) the variable VAR.
2413 \def\clear{\parsearg\clearxxx}
2414 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
2416 % @value{foo} gets the text saved in variable foo.
2418 \catcode`\_ = \active
2420 % We might end up with active _ or - characters in the argument if
2421 % we're called from @code, as @code{@value{foo-bar_}}. So \let any
2422 % such active characters to their normal equivalents.
2423 \gdef\value{\begingroup
2424 \catcode`\-=12 \catcode`\_=12
2425 \indexbreaks \let_\normalunderscore
2426 \valuexxx}
2428 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
2430 % We have this subroutine so that we can handle at least some @value's
2431 % properly in indexes (we \let\value to this in \indexdummies). Ones
2432 % whose names contain - or _ still won't work, but we can't do anything
2433 % about that. The command has to be fully expandable, since the result
2434 % winds up in the index file. This means that if the variable's value
2435 % contains other Texinfo commands, it's almost certain it will fail
2436 % (although perhaps we could fix that with sufficient work to do a
2437 % one-level expansion on the result, instead of complete).
2439 \def\expandablevalue#1{%
2440 \expandafter\ifx\csname SET#1\endcsname\relax
2441 {[No value for ``#1'']}%
2442 \else
2443 \csname SET#1\endcsname
2447 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
2448 % with @set.
2450 \def\ifset{\parsearg\ifsetxxx}
2451 \def\ifsetxxx #1{%
2452 \expandafter\ifx\csname SET#1\endcsname\relax
2453 \expandafter\ifsetfail
2454 \else
2455 \expandafter\ifsetsucceed
2458 \def\ifsetsucceed{\conditionalsucceed{ifset}}
2459 \def\ifsetfail{\nestedignore{ifset}}
2460 \defineunmatchedend{ifset}
2462 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
2463 % defined with @set, or has been undefined with @clear.
2465 \def\ifclear{\parsearg\ifclearxxx}
2466 \def\ifclearxxx #1{%
2467 \expandafter\ifx\csname SET#1\endcsname\relax
2468 \expandafter\ifclearsucceed
2469 \else
2470 \expandafter\ifclearfail
2473 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
2474 \def\ifclearfail{\nestedignore{ifclear}}
2475 \defineunmatchedend{ifclear}
2477 % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
2478 % following, through the first @end iftex (etc.). Make `@end iftex'
2479 % (etc.) valid only after an @iftex.
2481 \def\iftex{\conditionalsucceed{iftex}}
2482 \def\ifnothtml{\conditionalsucceed{ifnothtml}}
2483 \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
2484 \defineunmatchedend{iftex}
2485 \defineunmatchedend{ifnothtml}
2486 \defineunmatchedend{ifnotinfo}
2488 % We can't just want to start a group at @iftex (for example) and end it
2489 % at @end iftex, since then @set commands inside the conditional have no
2490 % effect (they'd get reverted at the end of the group). So we must
2491 % define \Eiftex to redefine itself to be its previous value. (We can't
2492 % just define it to fail again with an ``unmatched end'' error, since
2493 % the @ifset might be nested.)
2495 \def\conditionalsucceed#1{%
2496 \edef\temp{%
2497 % Remember the current value of \E#1.
2498 \let\nece{prevE#1} = \nece{E#1}%
2500 % At the `@end #1', redefine \E#1 to be its previous value.
2501 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
2503 \temp
2506 % We need to expand lots of \csname's, but we don't want to expand the
2507 % control sequences after we've constructed them.
2509 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
2511 % @defininfoenclose.
2512 \let\definfoenclose=\comment
2515 \message{indexing,}
2516 % Index generation facilities
2518 % Define \newwrite to be identical to plain tex's \newwrite
2519 % except not \outer, so it can be used within \newindex.
2520 {\catcode`\@=11
2521 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2523 % \newindex {foo} defines an index named foo.
2524 % It automatically defines \fooindex such that
2525 % \fooindex ...rest of line... puts an entry in the index foo.
2526 % It also defines \fooindfile to be the number of the output channel for
2527 % the file that accumulates this index. The file's extension is foo.
2528 % The name of an index should be no more than 2 characters long
2529 % for the sake of vms.
2531 \def\newindex#1{%
2532 \iflinks
2533 \expandafter\newwrite \csname#1indfile\endcsname
2534 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2536 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
2537 \noexpand\doindex{#1}}
2540 % @defindex foo == \newindex{foo}
2542 \def\defindex{\parsearg\newindex}
2544 % Define @defcodeindex, like @defindex except put all entries in @code.
2546 \def\newcodeindex#1{%
2547 \iflinks
2548 \expandafter\newwrite \csname#1indfile\endcsname
2549 \openout \csname#1indfile\endcsname \jobname.#1
2551 \expandafter\xdef\csname#1index\endcsname{%
2552 \noexpand\docodeindex{#1}}
2555 \def\defcodeindex{\parsearg\newcodeindex}
2557 % @synindex foo bar makes index foo feed into index bar.
2558 % Do this instead of @defindex foo if you don't want it as a separate index.
2559 % The \closeout helps reduce unnecessary open files; the limit on the
2560 % Acorn RISC OS is a mere 16 files.
2561 \def\synindex#1 #2 {%
2562 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2563 \expandafter\closeout\csname#1indfile\endcsname
2564 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2565 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2566 \noexpand\doindex{#2}}%
2569 % @syncodeindex foo bar similar, but put all entries made for index foo
2570 % inside @code.
2571 \def\syncodeindex#1 #2 {%
2572 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2573 \expandafter\closeout\csname#1indfile\endcsname
2574 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2575 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2576 \noexpand\docodeindex{#2}}%
2579 % Define \doindex, the driver for all \fooindex macros.
2580 % Argument #1 is generated by the calling \fooindex macro,
2581 % and it is "foo", the name of the index.
2583 % \doindex just uses \parsearg; it calls \doind for the actual work.
2584 % This is because \doind is more useful to call from other macros.
2586 % There is also \dosubind {index}{topic}{subtopic}
2587 % which makes an entry in a two-level index such as the operation index.
2589 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
2590 \def\singleindexer #1{\doind{\indexname}{#1}}
2592 % like the previous two, but they put @code around the argument.
2593 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2594 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2596 \def\indexdummies{%
2597 \def\ { }%
2598 % Take care of the plain tex accent commands.
2599 \def\"{\realbackslash "}%
2600 \def\`{\realbackslash `}%
2601 \def\'{\realbackslash '}%
2602 \def\^{\realbackslash ^}%
2603 \def\~{\realbackslash ~}%
2604 \def\={\realbackslash =}%
2605 \def\b{\realbackslash b}%
2606 \def\c{\realbackslash c}%
2607 \def\d{\realbackslash d}%
2608 \def\u{\realbackslash u}%
2609 \def\v{\realbackslash v}%
2610 \def\H{\realbackslash H}%
2611 % Take care of the plain tex special European modified letters.
2612 \def\oe{\realbackslash oe}%
2613 \def\ae{\realbackslash ae}%
2614 \def\aa{\realbackslash aa}%
2615 \def\OE{\realbackslash OE}%
2616 \def\AE{\realbackslash AE}%
2617 \def\AA{\realbackslash AA}%
2618 \def\o{\realbackslash o}%
2619 \def\O{\realbackslash O}%
2620 \def\l{\realbackslash l}%
2621 \def\L{\realbackslash L}%
2622 \def\ss{\realbackslash ss}%
2623 % Take care of texinfo commands likely to appear in an index entry.
2624 % (Must be a way to avoid doing expansion at all, and thus not have to
2625 % laboriously list every single command here.)
2626 \def\@{@}% will be @@ when we switch to @ as escape char.
2627 % Need these in case \tex is in effect and \{ is a \delimiter again.
2628 % But can't use \lbracecmd and \rbracecmd because texindex assumes
2629 % braces and backslashes are used only as delimiters.
2630 \let\{ = \mylbrace
2631 \let\} = \myrbrace
2632 \def\_{{\realbackslash _}}%
2633 \def\w{\realbackslash w }%
2634 \def\bf{\realbackslash bf }%
2635 %\def\rm{\realbackslash rm }%
2636 \def\sl{\realbackslash sl }%
2637 \def\sf{\realbackslash sf}%
2638 \def\tt{\realbackslash tt}%
2639 \def\gtr{\realbackslash gtr}%
2640 \def\less{\realbackslash less}%
2641 \def\hat{\realbackslash hat}%
2642 \def\TeX{\realbackslash TeX}%
2643 \def\dots{\realbackslash dots }%
2644 \def\result{\realbackslash result}%
2645 \def\equiv{\realbackslash equiv}%
2646 \def\expansion{\realbackslash expansion}%
2647 \def\print{\realbackslash print}%
2648 \def\error{\realbackslash error}%
2649 \def\point{\realbackslash point}%
2650 \def\copyright{\realbackslash copyright}%
2651 \def\tclose##1{\realbackslash tclose {##1}}%
2652 \def\code##1{\realbackslash code {##1}}%
2653 \def\uref##1{\realbackslash uref {##1}}%
2654 \def\url##1{\realbackslash url {##1}}%
2655 \def\env##1{\realbackslash env {##1}}%
2656 \def\command##1{\realbackslash command {##1}}%
2657 \def\option##1{\realbackslash option {##1}}%
2658 \def\dotless##1{\realbackslash dotless {##1}}%
2659 \def\samp##1{\realbackslash samp {##1}}%
2660 \def\,##1{\realbackslash ,{##1}}%
2661 \def\t##1{\realbackslash t {##1}}%
2662 \def\r##1{\realbackslash r {##1}}%
2663 \def\i##1{\realbackslash i {##1}}%
2664 \def\b##1{\realbackslash b {##1}}%
2665 \def\sc##1{\realbackslash sc {##1}}%
2666 \def\cite##1{\realbackslash cite {##1}}%
2667 \def\key##1{\realbackslash key {##1}}%
2668 \def\file##1{\realbackslash file {##1}}%
2669 \def\var##1{\realbackslash var {##1}}%
2670 \def\kbd##1{\realbackslash kbd {##1}}%
2671 \def\dfn##1{\realbackslash dfn {##1}}%
2672 \def\emph##1{\realbackslash emph {##1}}%
2673 \def\acronym##1{\realbackslash acronym {##1}}%
2675 % Handle some cases of @value -- where the variable name does not
2676 % contain - or _, and the value does not contain any
2677 % (non-fully-expandable) commands.
2678 \let\value = \expandablevalue
2680 \unsepspaces
2681 % Turn off macro expansion
2682 \turnoffmacros
2685 % If an index command is used in an @example environment, any spaces
2686 % therein should become regular spaces in the raw index file, not the
2687 % expansion of \tie (\\leavevmode \penalty \@M \ ).
2688 {\obeyspaces
2689 \gdef\unsepspaces{\obeyspaces\let =\space}}
2691 % \indexnofonts no-ops all font-change commands.
2692 % This is used when outputting the strings to sort the index by.
2693 \def\indexdummyfont#1{#1}
2694 \def\indexdummytex{TeX}
2695 \def\indexdummydots{...}
2697 \def\indexnofonts{%
2698 % Just ignore accents.
2699 \let\,=\indexdummyfont
2700 \let\"=\indexdummyfont
2701 \let\`=\indexdummyfont
2702 \let\'=\indexdummyfont
2703 \let\^=\indexdummyfont
2704 \let\~=\indexdummyfont
2705 \let\==\indexdummyfont
2706 \let\b=\indexdummyfont
2707 \let\c=\indexdummyfont
2708 \let\d=\indexdummyfont
2709 \let\u=\indexdummyfont
2710 \let\v=\indexdummyfont
2711 \let\H=\indexdummyfont
2712 \let\dotless=\indexdummyfont
2713 % Take care of the plain tex special European modified letters.
2714 \def\oe{oe}%
2715 \def\ae{ae}%
2716 \def\aa{aa}%
2717 \def\OE{OE}%
2718 \def\AE{AE}%
2719 \def\AA{AA}%
2720 \def\o{o}%
2721 \def\O{O}%
2722 \def\l{l}%
2723 \def\L{L}%
2724 \def\ss{ss}%
2725 \let\w=\indexdummyfont
2726 \let\t=\indexdummyfont
2727 \let\r=\indexdummyfont
2728 \let\i=\indexdummyfont
2729 \let\b=\indexdummyfont
2730 \let\emph=\indexdummyfont
2731 \let\strong=\indexdummyfont
2732 \let\cite=\indexdummyfont
2733 \let\sc=\indexdummyfont
2734 %Don't no-op \tt, since it isn't a user-level command
2735 % and is used in the definitions of the active chars like <, >, |...
2736 %\let\tt=\indexdummyfont
2737 \let\tclose=\indexdummyfont
2738 \let\code=\indexdummyfont
2739 \let\url=\indexdummyfont
2740 \let\uref=\indexdummyfont
2741 \let\env=\indexdummyfont
2742 \let\command=\indexdummyfont
2743 \let\option=\indexdummyfont
2744 \let\file=\indexdummyfont
2745 \let\samp=\indexdummyfont
2746 \let\kbd=\indexdummyfont
2747 \let\key=\indexdummyfont
2748 \let\var=\indexdummyfont
2749 \let\TeX=\indexdummytex
2750 \let\dots=\indexdummydots
2751 \def\@{@}%
2754 % To define \realbackslash, we must make \ not be an escape.
2755 % We must first make another character (@) an escape
2756 % so we do not become unable to do a definition.
2758 {\catcode`\@=0 \catcode`\\=\other
2759 @gdef@realbackslash{\}}
2761 \let\indexbackslash=0 %overridden during \printindex.
2762 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
2764 % For \ifx comparisons.
2765 \def\emptymacro{\empty}
2767 % Most index entries go through here, but \dosubind is the general case.
2769 \def\doind#1#2{\dosubind{#1}{#2}\empty}
2771 % Workhorse for all \fooindexes.
2772 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
2773 % \empty if called from \doind, as we usually are. The main exception
2774 % is with defuns, which call us directly.
2776 \def\dosubind#1#2#3{%
2777 % Put the index entry in the margin if desired.
2778 \ifx\SETmarginindex\relax\else
2779 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2782 \count255=\lastpenalty
2784 \indexdummies % Must do this here, since \bf, etc expand at this stage
2785 \escapechar=`\\
2787 \let\folio = 0% We will expand all macros now EXCEPT \folio.
2788 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2789 % so it will be output as is; and it will print as backslash.
2791 \def\thirdarg{#3}%
2793 % If third arg is present, precede it with space in sort key.
2794 \ifx\thirdarg\emptymacro
2795 \let\subentry = \empty
2796 \else
2797 \def\subentry{ #3}%
2800 % First process the index entry with all font commands turned
2801 % off to get the string to sort by.
2802 {\indexnofonts \xdef\indexsorttmp{#2\subentry}}%
2804 % Now the real index entry with the fonts.
2805 \toks0 = {#2}%
2807 % If third (subentry) arg is present, add it to the index
2808 % string. And include a space.
2809 \ifx\thirdarg\emptymacro \else
2810 \toks0 = \expandafter{\the\toks0 \space #3}%
2813 % Set up the complete index entry, with both the sort key
2814 % and the original text, including any font commands. We write
2815 % three arguments to \entry to the .?? file, texindex reduces to
2816 % two when writing the .??s sorted result.
2817 \edef\temp{%
2818 \write\csname#1indfile\endcsname{%
2819 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
2822 % If a skip is the last thing on the list now, preserve it
2823 % by backing up by \lastskip, doing the \write, then inserting
2824 % the skip again. Otherwise, the whatsit generated by the
2825 % \write will make \lastskip zero. The result is that sequences
2826 % like this:
2827 % @end defun
2828 % @tindex whatever
2829 % @defun ...
2830 % will have extra space inserted, because the \medbreak in the
2831 % start of the @defun won't see the skip inserted by the @end of
2832 % the previous defun.
2834 % But don't do any of this if we're not in vertical mode. We
2835 % don't want to do a \vskip and prematurely end a paragraph.
2837 % Avoid page breaks due to these extra skips, too.
2839 \iflinks
2840 \ifvmode
2841 \skip0 = \lastskip
2842 \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi
2845 \temp % do the write
2848 \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
2852 \penalty\count255
2856 % The index entry written in the file actually looks like
2857 % \entry {sortstring}{page}{topic}
2858 % or
2859 % \entry {sortstring}{page}{topic}{subtopic}
2860 % The texindex program reads in these files and writes files
2861 % containing these kinds of lines:
2862 % \initial {c}
2863 % before the first topic whose initial is c
2864 % \entry {topic}{pagelist}
2865 % for a topic that is used without subtopics
2866 % \primary {topic}
2867 % for the beginning of a topic that is used with subtopics
2868 % \secondary {subtopic}{pagelist}
2869 % for each subtopic.
2871 % Define the user-accessible indexing commands
2872 % @findex, @vindex, @kindex, @cindex.
2874 \def\findex {\fnindex}
2875 \def\kindex {\kyindex}
2876 \def\cindex {\cpindex}
2877 \def\vindex {\vrindex}
2878 \def\tindex {\tpindex}
2879 \def\pindex {\pgindex}
2881 \def\cindexsub {\begingroup\obeylines\cindexsub}
2882 {\obeylines %
2883 \gdef\cindexsub "#1" #2^^M{\endgroup %
2884 \dosubind{cp}{#2}{#1}}}
2886 % Define the macros used in formatting output of the sorted index material.
2888 % @printindex causes a particular index (the ??s file) to get printed.
2889 % It does not print any chapter heading (usually an @unnumbered).
2891 \def\printindex{\parsearg\doprintindex}
2892 \def\doprintindex#1{\begingroup
2893 \dobreak \chapheadingskip{10000}%
2895 \indexfonts \rm
2896 \tolerance = 9500
2897 \indexbreaks
2899 % See if the index file exists and is nonempty.
2900 % Change catcode of @ here so that if the index file contains
2901 % \initial {@}
2902 % as its first line, TeX doesn't complain about mismatched braces
2903 % (because it thinks @} is a control sequence).
2904 \catcode`\@ = 11
2905 \openin 1 \jobname.#1s
2906 \ifeof 1
2907 % \enddoublecolumns gets confused if there is no text in the index,
2908 % and it loses the chapter title and the aux file entries for the
2909 % index. The easiest way to prevent this problem is to make sure
2910 % there is some text.
2911 \putwordIndexNonexistent
2912 \else
2914 % If the index file exists but is empty, then \openin leaves \ifeof
2915 % false. We have to make TeX try to read something from the file, so
2916 % it can discover if there is anything in it.
2917 \read 1 to \temp
2918 \ifeof 1
2919 \putwordIndexIsEmpty
2920 \else
2921 % Index files are almost Texinfo source, but we use \ as the escape
2922 % character. It would be better to use @, but that's too big a change
2923 % to make right now.
2924 \def\indexbackslash{\rawbackslashxx}%
2925 \catcode`\\ = 0
2926 \escapechar = `\\
2927 \begindoublecolumns
2928 \input \jobname.#1s
2929 \enddoublecolumns
2932 \closein 1
2933 \endgroup}
2935 % These macros are used by the sorted index file itself.
2936 % Change them to control the appearance of the index.
2938 \def\initial#1{{%
2939 % Some minor font changes for the special characters.
2940 \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2942 % Remove any glue we may have, we'll be inserting our own.
2943 \removelastskip
2945 % We like breaks before the index initials, so insert a bonus.
2946 \penalty -300
2948 % Typeset the initial. Making this add up to a whole number of
2949 % baselineskips increases the chance of the dots lining up from column
2950 % to column. It still won't often be perfect, because of the stretch
2951 % we need before each entry, but it's better.
2953 % No shrink because it confuses \balancecolumns.
2954 \vskip 1.67\baselineskip plus .5\baselineskip
2955 \leftline{\secbf #1}%
2956 \vskip .33\baselineskip plus .1\baselineskip
2958 % Do our best not to break after the initial.
2959 \nobreak
2962 % This typesets a paragraph consisting of #1, dot leaders, and then #2
2963 % flush to the right margin. It is used for index and table of contents
2964 % entries. The paragraph is indented by \leftskip.
2966 \def\entry#1#2{\begingroup
2968 % Start a new paragraph if necessary, so our assignments below can't
2969 % affect previous text.
2970 \par
2972 % Do not fill out the last line with white space.
2973 \parfillskip = 0in
2975 % No extra space above this paragraph.
2976 \parskip = 0in
2978 % Do not prefer a separate line ending with a hyphen to fewer lines.
2979 \finalhyphendemerits = 0
2981 % \hangindent is only relevant when the entry text and page number
2982 % don't both fit on one line. In that case, bob suggests starting the
2983 % dots pretty far over on the line. Unfortunately, a large
2984 % indentation looks wrong when the entry text itself is broken across
2985 % lines. So we use a small indentation and put up with long leaders.
2987 % \hangafter is reset to 1 (which is the value we want) at the start
2988 % of each paragraph, so we need not do anything with that.
2989 \hangindent = 2em
2991 % When the entry text needs to be broken, just fill out the first line
2992 % with blank space.
2993 \rightskip = 0pt plus1fil
2995 % A bit of stretch before each entry for the benefit of balancing columns.
2996 \vskip 0pt plus1pt
2998 % Start a ``paragraph'' for the index entry so the line breaking
2999 % parameters we've set above will have an effect.
3000 \noindent
3002 % Insert the text of the index entry. TeX will do line-breaking on it.
3004 % The following is kludged to not output a line of dots in the index if
3005 % there are no page numbers. The next person who breaks this will be
3006 % cursed by a Unix daemon.
3007 \def\tempa{{\rm }}%
3008 \def\tempb{#2}%
3009 \edef\tempc{\tempa}%
3010 \edef\tempd{\tempb}%
3011 \ifx\tempc\tempd\ \else%
3013 % If we must, put the page number on a line of its own, and fill out
3014 % this line with blank space. (The \hfil is overwhelmed with the
3015 % fill leaders glue in \indexdotfill if the page number does fit.)
3016 \hfil\penalty50
3017 \null\nobreak\indexdotfill % Have leaders before the page number.
3019 % The `\ ' here is removed by the implicit \unskip that TeX does as
3020 % part of (the primitive) \par. Without it, a spurious underfull
3021 % \hbox ensues.
3022 \ #2% The page number ends the paragraph.
3023 \fi%
3024 \par
3025 \endgroup}
3027 % Like \dotfill except takes at least 1 em.
3028 \def\indexdotfill{\cleaders
3029 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
3031 \def\primary #1{\line{#1\hfil}}
3033 \newskip\secondaryindent \secondaryindent=0.5cm
3035 \def\secondary #1#2{
3036 {\parfillskip=0in \parskip=0in
3037 \hangindent =1in \hangafter=1
3038 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
3041 % Define two-column mode, which we use to typeset indexes.
3042 % Adapted from the TeXbook, page 416, which is to say,
3043 % the manmac.tex format used to print the TeXbook itself.
3044 \catcode`\@=11
3046 \newbox\partialpage
3047 \newdimen\doublecolumnhsize
3049 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
3050 % Grab any single-column material above us.
3051 \output = {%
3053 % Here is a possibility not foreseen in manmac: if we accumulate a
3054 % whole lot of material, we might end up calling this \output
3055 % routine twice in a row (see the doublecol-lose test, which is
3056 % essentially a couple of indexes with @setchapternewpage off). In
3057 % that case we just ship out what is in \partialpage with the normal
3058 % output routine. Generally, \partialpage will be empty when this
3059 % runs and this will be a no-op. See the indexspread.tex test case.
3060 \ifvoid\partialpage \else
3061 \onepageout{\pagecontents\partialpage}%
3064 \global\setbox\partialpage = \vbox{%
3065 % Unvbox the main output page.
3066 \unvbox\PAGE
3067 \kern-\topskip \kern\baselineskip
3070 \eject % run that output routine to set \partialpage
3072 % Use the double-column output routine for subsequent pages.
3073 \output = {\doublecolumnout}%
3075 % Change the page size parameters. We could do this once outside this
3076 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
3077 % format, but then we repeat the same computation. Repeating a couple
3078 % of assignments once per index is clearly meaningless for the
3079 % execution time, so we may as well do it in one place.
3081 % First we halve the line length, less a little for the gutter between
3082 % the columns. We compute the gutter based on the line length, so it
3083 % changes automatically with the paper format. The magic constant
3084 % below is chosen so that the gutter has the same value (well, +-<1pt)
3085 % as it did when we hard-coded it.
3087 % We put the result in a separate register, \doublecolumhsize, so we
3088 % can restore it in \pagesofar, after \hsize itself has (potentially)
3089 % been clobbered.
3091 \doublecolumnhsize = \hsize
3092 \advance\doublecolumnhsize by -.04154\hsize
3093 \divide\doublecolumnhsize by 2
3094 \hsize = \doublecolumnhsize
3096 % Double the \vsize as well. (We don't need a separate register here,
3097 % since nobody clobbers \vsize.)
3098 \advance\vsize by -\ht\partialpage
3099 \vsize = 2\vsize
3102 % The double-column output routine for all double-column pages except
3103 % the last.
3105 \def\doublecolumnout{%
3106 \splittopskip=\topskip \splitmaxdepth=\maxdepth
3107 % Get the available space for the double columns -- the normal
3108 % (undoubled) page height minus any material left over from the
3109 % previous page.
3110 \dimen@ = \vsize
3111 \divide\dimen@ by 2
3113 % box0 will be the left-hand column, box2 the right.
3114 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
3115 \onepageout\pagesofar
3116 \unvbox255
3117 \penalty\outputpenalty
3119 \def\pagesofar{%
3120 % Re-output the contents of the output page -- any previous material,
3121 % followed by the two boxes we just split, in box0 and box2.
3122 \unvbox\partialpage
3124 \hsize = \doublecolumnhsize
3125 \wd0=\hsize \wd2=\hsize
3126 \hbox to\pagewidth{\box0\hfil\box2}%
3128 \def\enddoublecolumns{%
3129 \output = {%
3130 % Split the last of the double-column material. Leave it on the
3131 % current page, no automatic page break.
3132 \balancecolumns
3134 % If we end up splitting too much material for the current page,
3135 % though, there will be another page break right after this \output
3136 % invocation ends. Having called \balancecolumns once, we do not
3137 % want to call it again. Therefore, reset \output to its normal
3138 % definition right away. (We hope \balancecolumns will never be
3139 % called on to balance too much material, but if it is, this makes
3140 % the output somewhat more palatable.)
3141 \global\output = {\onepageout{\pagecontents\PAGE}}%
3143 \eject
3144 \endgroup % started in \begindoublecolumns
3146 % \pagegoal was set to the doubled \vsize above, since we restarted
3147 % the current page. We're now back to normal single-column
3148 % typesetting, so reset \pagegoal to the normal \vsize (after the
3149 % \endgroup where \vsize got restored).
3150 \pagegoal = \vsize
3152 \def\balancecolumns{%
3153 % Called at the end of the double column material.
3154 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
3155 \dimen@ = \ht0
3156 \advance\dimen@ by \topskip
3157 \advance\dimen@ by-\baselineskip
3158 \divide\dimen@ by 2 % target to split to
3159 %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
3160 \splittopskip = \topskip
3161 % Loop until we get a decent breakpoint.
3163 \vbadness = 10000
3164 \loop
3165 \global\setbox3 = \copy0
3166 \global\setbox1 = \vsplit3 to \dimen@
3167 \ifdim\ht3>\dimen@
3168 \global\advance\dimen@ by 1pt
3169 \repeat
3171 %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
3172 \setbox0=\vbox to\dimen@{\unvbox1}%
3173 \setbox2=\vbox to\dimen@{\unvbox3}%
3175 \pagesofar
3177 \catcode`\@ = \other
3180 \message{sectioning,}
3181 % Chapters, sections, etc.
3183 \newcount\chapno
3184 \newcount\secno \secno=0
3185 \newcount\subsecno \subsecno=0
3186 \newcount\subsubsecno \subsubsecno=0
3188 % This counter is funny since it counts through charcodes of letters A, B, ...
3189 % The \the is necessary, despite appearances, because \appendixletter is
3190 % expanded while writing the .toc file. \char\appendixno is not
3191 % expandable, thus it is written literally, thus all appendixes come out
3192 % with the same letter (or @) in the toc without it.
3193 \newcount\appendixno \appendixno = `\@
3194 \def\appendixletter{\char\the\appendixno}
3196 % Each @chapter defines this as the name of the chapter.
3197 % page headings and footings can use it. @section does likewise.
3198 \def\thischapter{}
3199 \def\thissection{}
3201 \newcount\absseclevel % used to calculate proper heading level
3202 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
3204 % @raisesections: treat @section as chapter, @subsection as section, etc.
3205 \def\raisesections{\global\advance\secbase by -1}
3206 \let\up=\raisesections % original BFox name
3208 % @lowersections: treat @chapter as section, @section as subsection, etc.
3209 \def\lowersections{\global\advance\secbase by 1}
3210 \let\down=\lowersections % original BFox name
3212 % Choose a numbered-heading macro
3213 % #1 is heading level if unmodified by @raisesections or @lowersections
3214 % #2 is text for heading
3215 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3216 \ifcase\absseclevel
3217 \chapterzzz{#2}
3219 \seczzz{#2}
3221 \numberedsubseczzz{#2}
3223 \numberedsubsubseczzz{#2}
3224 \else
3225 \ifnum \absseclevel<0
3226 \chapterzzz{#2}
3227 \else
3228 \numberedsubsubseczzz{#2}
3233 % like \numhead, but chooses appendix heading levels
3234 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3235 \ifcase\absseclevel
3236 \appendixzzz{#2}
3238 \appendixsectionzzz{#2}
3240 \appendixsubseczzz{#2}
3242 \appendixsubsubseczzz{#2}
3243 \else
3244 \ifnum \absseclevel<0
3245 \appendixzzz{#2}
3246 \else
3247 \appendixsubsubseczzz{#2}
3252 % like \numhead, but chooses numberless heading levels
3253 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3254 \ifcase\absseclevel
3255 \unnumberedzzz{#2}
3257 \unnumberedseczzz{#2}
3259 \unnumberedsubseczzz{#2}
3261 \unnumberedsubsubseczzz{#2}
3262 \else
3263 \ifnum \absseclevel<0
3264 \unnumberedzzz{#2}
3265 \else
3266 \unnumberedsubsubseczzz{#2}
3271 % @chapter, @appendix, @unnumbered.
3272 \def\thischaptername{No Chapter Title}
3273 \outer\def\chapter{\parsearg\chapteryyy}
3274 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
3275 \def\chapterzzz #1{%
3276 \secno=0 \subsecno=0 \subsubsecno=0
3277 \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
3278 \chapmacro {#1}{\the\chapno}%
3279 \gdef\thissection{#1}%
3280 \gdef\thischaptername{#1}%
3281 % We don't substitute the actual chapter name into \thischapter
3282 % because we don't want its macros evaluated now.
3283 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
3284 \toks0 = {#1}%
3285 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
3286 {\the\chapno}}}%
3287 \temp
3288 \donoderef
3289 \global\let\section = \numberedsec
3290 \global\let\subsection = \numberedsubsec
3291 \global\let\subsubsection = \numberedsubsubsec
3294 \outer\def\appendix{\parsearg\appendixyyy}
3295 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
3296 \def\appendixzzz #1{%
3297 \secno=0 \subsecno=0 \subsubsecno=0
3298 \global\advance \appendixno by 1
3299 \message{\putwordAppendix\space \appendixletter}%
3300 \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
3301 \gdef\thissection{#1}%
3302 \gdef\thischaptername{#1}%
3303 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
3304 \toks0 = {#1}%
3305 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
3306 {\putwordAppendix{} \appendixletter}}}%
3307 \temp
3308 \appendixnoderef
3309 \global\let\section = \appendixsec
3310 \global\let\subsection = \appendixsubsec
3311 \global\let\subsubsection = \appendixsubsubsec
3314 % @centerchap is like @unnumbered, but the heading is centered.
3315 \outer\def\centerchap{\parsearg\centerchapyyy}
3316 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
3318 % @top is like @unnumbered.
3319 \outer\def\top{\parsearg\unnumberedyyy}
3321 \outer\def\unnumbered{\parsearg\unnumberedyyy}
3322 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
3323 \def\unnumberedzzz #1{%
3324 \secno=0 \subsecno=0 \subsubsecno=0
3326 % This used to be simply \message{#1}, but TeX fully expands the
3327 % argument to \message. Therefore, if #1 contained @-commands, TeX
3328 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
3329 % expanded @cite (which turns out to cause errors because \cite is meant
3330 % to be executed, not expanded).
3332 % Anyway, we don't want the fully-expanded definition of @cite to appear
3333 % as a result of the \message, we just want `@cite' itself. We use
3334 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
3335 % simply yielding the contents of <toks register>. (We also do this for
3336 % the toc entries.)
3337 \toks0 = {#1}\message{(\the\toks0)}%
3339 \unnumbchapmacro {#1}%
3340 \gdef\thischapter{#1}\gdef\thissection{#1}%
3341 \toks0 = {#1}%
3342 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}%
3343 \temp
3344 \unnumbnoderef
3345 \global\let\section = \unnumberedsec
3346 \global\let\subsection = \unnumberedsubsec
3347 \global\let\subsubsection = \unnumberedsubsubsec
3350 % Sections.
3351 \outer\def\numberedsec{\parsearg\secyyy}
3352 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
3353 \def\seczzz #1{%
3354 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3355 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
3356 \toks0 = {#1}%
3357 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3358 {\the\chapno}{\the\secno}}}%
3359 \temp
3360 \donoderef
3361 \nobreak
3364 \outer\def\appendixsection{\parsearg\appendixsecyyy}
3365 \outer\def\appendixsec{\parsearg\appendixsecyyy}
3366 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
3367 \def\appendixsectionzzz #1{%
3368 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3369 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
3370 \toks0 = {#1}%
3371 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3372 {\appendixletter}{\the\secno}}}%
3373 \temp
3374 \appendixnoderef
3375 \nobreak
3378 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
3379 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
3380 \def\unnumberedseczzz #1{%
3381 \plainsecheading {#1}\gdef\thissection{#1}%
3382 \toks0 = {#1}%
3383 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}%
3384 \temp
3385 \unnumbnoderef
3386 \nobreak
3389 % Subsections.
3390 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
3391 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
3392 \def\numberedsubseczzz #1{%
3393 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3394 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
3395 \toks0 = {#1}%
3396 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3397 {\the\chapno}{\the\secno}{\the\subsecno}}}%
3398 \temp
3399 \donoderef
3400 \nobreak
3403 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
3404 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
3405 \def\appendixsubseczzz #1{%
3406 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3407 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
3408 \toks0 = {#1}%
3409 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3410 {\appendixletter}{\the\secno}{\the\subsecno}}}%
3411 \temp
3412 \appendixnoderef
3413 \nobreak
3416 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
3417 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
3418 \def\unnumberedsubseczzz #1{%
3419 \plainsubsecheading {#1}\gdef\thissection{#1}%
3420 \toks0 = {#1}%
3421 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry%
3422 {\the\toks0}}}%
3423 \temp
3424 \unnumbnoderef
3425 \nobreak
3428 % Subsubsections.
3429 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
3430 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
3431 \def\numberedsubsubseczzz #1{%
3432 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3433 \subsubsecheading {#1}
3434 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3435 \toks0 = {#1}%
3436 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3437 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3438 \temp
3439 \donoderef
3440 \nobreak
3443 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
3444 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
3445 \def\appendixsubsubseczzz #1{%
3446 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3447 \subsubsecheading {#1}
3448 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3449 \toks0 = {#1}%
3450 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3451 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3452 \temp
3453 \appendixnoderef
3454 \nobreak
3457 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
3458 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
3459 \def\unnumberedsubsubseczzz #1{%
3460 \plainsubsubsecheading {#1}\gdef\thissection{#1}%
3461 \toks0 = {#1}%
3462 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry%
3463 {\the\toks0}}}%
3464 \temp
3465 \unnumbnoderef
3466 \nobreak
3469 % These are variants which are not "outer", so they can appear in @ifinfo.
3470 % Actually, they should now be obsolete; ordinary section commands should work.
3471 \def\infotop{\parsearg\unnumberedzzz}
3472 \def\infounnumbered{\parsearg\unnumberedzzz}
3473 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
3474 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
3475 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
3477 \def\infoappendix{\parsearg\appendixzzz}
3478 \def\infoappendixsec{\parsearg\appendixseczzz}
3479 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
3480 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
3482 \def\infochapter{\parsearg\chapterzzz}
3483 \def\infosection{\parsearg\sectionzzz}
3484 \def\infosubsection{\parsearg\subsectionzzz}
3485 \def\infosubsubsection{\parsearg\subsubsectionzzz}
3487 % These macros control what the section commands do, according
3488 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
3489 % Define them by default for a numbered chapter.
3490 \global\let\section = \numberedsec
3491 \global\let\subsection = \numberedsubsec
3492 \global\let\subsubsection = \numberedsubsubsec
3494 % Define @majorheading, @heading and @subheading
3496 % NOTE on use of \vbox for chapter headings, section headings, and such:
3497 % 1) We use \vbox rather than the earlier \line to permit
3498 % overlong headings to fold.
3499 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
3500 % heading is obnoxious; this forbids it.
3501 % 3) Likewise, headings look best if no \parindent is used, and
3502 % if justification is not attempted. Hence \raggedright.
3505 \def\majorheading{\parsearg\majorheadingzzz}
3506 \def\majorheadingzzz #1{%
3507 {\advance\chapheadingskip by 10pt \chapbreak }%
3508 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3509 \parindent=0pt\raggedright
3510 \rm #1\hfill}}\bigskip \par\penalty 200}
3512 \def\chapheading{\parsearg\chapheadingzzz}
3513 \def\chapheadingzzz #1{\chapbreak %
3514 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3515 \parindent=0pt\raggedright
3516 \rm #1\hfill}}\bigskip \par\penalty 200}
3518 % @heading, @subheading, @subsubheading.
3519 \def\heading{\parsearg\plainsecheading}
3520 \def\subheading{\parsearg\plainsubsecheading}
3521 \def\subsubheading{\parsearg\plainsubsubsecheading}
3523 % These macros generate a chapter, section, etc. heading only
3524 % (including whitespace, linebreaking, etc. around it),
3525 % given all the information in convenient, parsed form.
3527 %%% Args are the skip and penalty (usually negative)
3528 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
3530 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
3532 %%% Define plain chapter starts, and page on/off switching for it
3533 % Parameter controlling skip before chapter headings (if needed)
3535 \newskip\chapheadingskip
3537 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
3538 \def\chappager{\par\vfill\supereject}
3539 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
3541 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
3543 \def\CHAPPAGoff{%
3544 \global\let\contentsalignmacro = \chappager
3545 \global\let\pchapsepmacro=\chapbreak
3546 \global\let\pagealignmacro=\chappager}
3548 \def\CHAPPAGon{%
3549 \global\let\contentsalignmacro = \chappager
3550 \global\let\pchapsepmacro=\chappager
3551 \global\let\pagealignmacro=\chappager
3552 \global\def\HEADINGSon{\HEADINGSsingle}}
3554 \def\CHAPPAGodd{
3555 \global\let\contentsalignmacro = \chapoddpage
3556 \global\let\pchapsepmacro=\chapoddpage
3557 \global\let\pagealignmacro=\chapoddpage
3558 \global\def\HEADINGSon{\HEADINGSdouble}}
3560 \CHAPPAGon
3562 \def\CHAPFplain{
3563 \global\let\chapmacro=\chfplain
3564 \global\let\unnumbchapmacro=\unnchfplain
3565 \global\let\centerchapmacro=\centerchfplain}
3567 % Plain chapter opening.
3568 % #1 is the text, #2 the chapter number or empty if unnumbered.
3569 \def\chfplain#1#2{%
3570 \pchapsepmacro
3572 \chapfonts \rm
3573 \def\chapnum{#2}%
3574 \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
3575 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3576 \hangindent = \wd0 \centerparametersmaybe
3577 \unhbox0 #1\par}%
3579 \nobreak\bigskip % no page break after a chapter title
3580 \nobreak
3583 % Plain opening for unnumbered.
3584 \def\unnchfplain#1{\chfplain{#1}{}}
3586 % @centerchap -- centered and unnumbered.
3587 \let\centerparametersmaybe = \relax
3588 \def\centerchfplain#1{{%
3589 \def\centerparametersmaybe{%
3590 \advance\rightskip by 3\rightskip
3591 \leftskip = \rightskip
3592 \parfillskip = 0pt
3594 \chfplain{#1}{}%
3597 \CHAPFplain % The default
3599 \def\unnchfopen #1{%
3600 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3601 \parindent=0pt\raggedright
3602 \rm #1\hfill}}\bigskip \par\nobreak
3605 \def\chfopen #1#2{\chapoddpage {\chapfonts
3606 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
3607 \par\penalty 5000 %
3610 \def\centerchfopen #1{%
3611 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3612 \parindent=0pt
3613 \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
3616 \def\CHAPFopen{
3617 \global\let\chapmacro=\chfopen
3618 \global\let\unnumbchapmacro=\unnchfopen
3619 \global\let\centerchapmacro=\centerchfopen}
3622 % Section titles.
3623 \newskip\secheadingskip
3624 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
3625 \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
3626 \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
3628 % Subsection titles.
3629 \newskip \subsecheadingskip
3630 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
3631 \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
3632 \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
3634 % Subsubsection titles.
3635 \let\subsubsecheadingskip = \subsecheadingskip
3636 \let\subsubsecheadingbreak = \subsecheadingbreak
3637 \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
3638 \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
3641 % Print any size section title.
3643 % #1 is the section type (sec/subsec/subsubsec), #2 is the section
3644 % number (maybe empty), #3 the text.
3645 \def\sectionheading#1#2#3{%
3647 \expandafter\advance\csname #1headingskip\endcsname by \parskip
3648 \csname #1headingbreak\endcsname
3651 % Switch to the right set of fonts.
3652 \csname #1fonts\endcsname \rm
3654 % Only insert the separating space if we have a section number.
3655 \def\secnum{#2}%
3656 \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
3658 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3659 \hangindent = \wd0 % zero if no section number
3660 \unhbox0 #3}%
3662 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
3666 \message{toc,}
3667 % Table of contents.
3668 \newwrite\tocfile
3670 % Write an entry to the toc file, opening it if necessary.
3671 % Called from @chapter, etc. We supply {\folio} at the end of the
3672 % argument, which will end up as the last argument to the \...entry macro.
3674 % We open the .toc file here instead of at @setfilename or any other
3675 % given time so that @contents can be put in the document anywhere.
3677 \newif\iftocfileopened
3678 \def\writetocentry#1{%
3679 \iftocfileopened\else
3680 \immediate\openout\tocfile = \jobname.toc
3681 \global\tocfileopenedtrue
3683 \iflinks \write\tocfile{#1{\folio}}\fi
3686 \newskip\contentsrightmargin \contentsrightmargin=1in
3687 \newcount\savepageno
3688 \newcount\lastnegativepageno \lastnegativepageno = -1
3690 % Finish up the main text and prepare to read what we've written
3691 % to \tocfile.
3693 \def\startcontents#1{%
3694 % If @setchapternewpage on, and @headings double, the contents should
3695 % start on an odd page, unlike chapters. Thus, we maintain
3696 % \contentsalignmacro in parallel with \pagealignmacro.
3697 % From: Torbjorn Granlund <tege@matematik.su.se>
3698 \contentsalignmacro
3699 \immediate\closeout\tocfile
3701 % Don't need to put `Contents' or `Short Contents' in the headline.
3702 % It is abundantly clear what they are.
3703 \unnumbchapmacro{#1}\def\thischapter{}%
3704 \savepageno = \pageno
3705 \begingroup % Set up to handle contents files properly.
3706 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
3707 % We can't do this, because then an actual ^ in a section
3708 % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
3709 %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3710 \raggedbottom % Worry more about breakpoints than the bottom.
3711 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3713 % Roman numerals for page numbers.
3714 \ifnum \pageno>0 \pageno = \lastnegativepageno \fi
3718 % Normal (long) toc.
3719 \def\contents{%
3720 \startcontents{\putwordTOC}%
3721 \openin 1 \jobname.toc
3722 \ifeof 1 \else
3723 \closein 1
3724 \input \jobname.toc
3726 \vfill \eject
3727 \contentsalignmacro % in case @setchapternewpage odd is in effect
3728 \endgroup
3729 \lastnegativepageno = \pageno
3730 \pageno = \savepageno
3733 % And just the chapters.
3734 \def\summarycontents{%
3735 \startcontents{\putwordShortTOC}%
3737 \let\chapentry = \shortchapentry
3738 \let\unnumbchapentry = \shortunnumberedentry
3739 % We want a true roman here for the page numbers.
3740 \secfonts
3741 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
3743 \hyphenpenalty = 10000
3744 \advance\baselineskip by 1pt % Open it up a little.
3745 \def\secentry ##1##2##3##4{}
3746 \def\unnumbsecentry ##1##2{}
3747 \def\subsecentry ##1##2##3##4##5{}
3748 \def\unnumbsubsecentry ##1##2{}
3749 \def\subsubsecentry ##1##2##3##4##5##6{}
3750 \def\unnumbsubsubsecentry ##1##2{}
3751 \openin 1 \jobname.toc
3752 \ifeof 1 \else
3753 \closein 1
3754 \input \jobname.toc
3756 \vfill \eject
3757 \contentsalignmacro % in case @setchapternewpage odd is in effect
3758 \endgroup
3759 \lastnegativepageno = \pageno
3760 \pageno = \savepageno
3762 \let\shortcontents = \summarycontents
3764 \ifpdf
3765 \pdfcatalog{/PageMode /UseOutlines}%
3768 % These macros generate individual entries in the table of contents.
3769 % The first argument is the chapter or section name.
3770 % The last argument is the page number.
3771 % The arguments in between are the chapter number, section number, ...
3773 % Chapter-level things, for both the long and short contents.
3774 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3776 % See comments in \dochapentry re vbox and related settings
3777 \def\shortchapentry#1#2#3{%
3778 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
3781 % Typeset the label for a chapter or appendix for the short contents.
3782 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
3783 % We could simplify the code here by writing out an \appendixentry
3784 % command in the toc file for appendices, instead of using \chapentry
3785 % for both, but it doesn't seem worth it.
3786 \setbox0 = \hbox{\shortcontrm \putwordAppendix }
3787 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
3789 \def\shortchaplabel#1{%
3790 % We typeset #1 in a box of constant width, regardless of the text of
3791 % #1, so the chapter titles will come out aligned.
3792 \setbox0 = \hbox{#1}%
3793 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3795 % This space should be plenty, since a single number is .5em, and the
3796 % widest letter (M) is 1em, at least in the Computer Modern fonts.
3797 % (This space doesn't include the extra space that gets added after
3798 % the label; that gets put in by \shortchapentry above.)
3799 \advance\dimen0 by 1.1em
3800 \hbox to \dimen0{#1\hfil}%
3803 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3804 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
3806 % Sections.
3807 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3808 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
3810 % Subsections.
3811 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
3812 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
3814 % And subsubsections.
3815 \def\subsubsecentry#1#2#3#4#5#6{%
3816 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
3817 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
3819 % This parameter controls the indentation of the various levels.
3820 \newdimen\tocindent \tocindent = 3pc
3822 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
3823 % page number.
3825 % If the toc has to be broken over pages, we want it to be at chapters
3826 % if at all possible; hence the \penalty.
3827 \def\dochapentry#1#2{%
3828 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
3829 \begingroup
3830 \chapentryfonts
3831 \tocentry{#1}{\dopageno{#2}}%
3832 \endgroup
3833 \nobreak\vskip .25\baselineskip plus.1\baselineskip
3836 \def\dosecentry#1#2{\begingroup
3837 \secentryfonts \leftskip=\tocindent
3838 \tocentry{#1}{\dopageno{#2}}%
3839 \endgroup}
3841 \def\dosubsecentry#1#2{\begingroup
3842 \subsecentryfonts \leftskip=2\tocindent
3843 \tocentry{#1}{\dopageno{#2}}%
3844 \endgroup}
3846 \def\dosubsubsecentry#1#2{\begingroup
3847 \subsubsecentryfonts \leftskip=3\tocindent
3848 \tocentry{#1}{\dopageno{#2}}%
3849 \endgroup}
3851 % Final typesetting of a toc entry; we use the same \entry macro as for
3852 % the index entries, but we want to suppress hyphenation here. (We
3853 % can't do that in the \entry macro, since index entries might consist
3854 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
3855 \def\tocentry#1#2{\begingroup
3856 \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
3857 % Do not use \turnoffactive in these arguments. Since the toc is
3858 % typeset in cmr, so characters such as _ would come out wrong; we
3859 % have to do the usual translation tricks.
3860 \entry{#1}{#2}%
3861 \endgroup}
3863 % Space between chapter (or whatever) number and the title.
3864 \def\labelspace{\hskip1em \relax}
3866 \def\dopageno#1{{\rm #1}}
3867 \def\doshortpageno#1{{\rm #1}}
3869 \def\chapentryfonts{\secfonts \rm}
3870 \def\secentryfonts{\textfonts}
3871 \let\subsecentryfonts = \textfonts
3872 \let\subsubsecentryfonts = \textfonts
3875 \message{environments,}
3876 % @foo ... @end foo.
3878 % Since these characters are used in examples, it should be an even number of
3879 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3880 % Furthermore, these definitions must come after we define our fonts.
3881 \newbox\dblarrowbox \newbox\longdblarrowbox
3882 \newbox\pushcharbox \newbox\bullbox
3883 \newbox\equivbox \newbox\errorbox
3885 %{\tentt
3886 %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
3887 %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
3888 %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
3889 %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
3890 % Adapted from the manmac format (p.420 of TeXbook)
3891 %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
3892 % depth .1ex\hfil}
3895 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3896 \def\point{$\star$}
3897 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3898 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
3899 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3900 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3902 % Adapted from the TeXbook's \boxit.
3903 {\tentt \global\dimen0 = 3em}% Width of the box.
3904 \dimen2 = .55pt % Thickness of rules
3905 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3906 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
3908 \global\setbox\errorbox=\hbox to \dimen0{\hfil
3909 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3910 \advance\hsize by -2\dimen2 % Rules.
3911 \vbox{
3912 \hrule height\dimen2
3913 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3914 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3915 \kern3pt\vrule width\dimen2}% Space to right.
3916 \hrule height\dimen2}
3917 \hfil}
3919 % The @error{} command.
3920 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3922 % @tex ... @end tex escapes into raw Tex temporarily.
3923 % One exception: @ is still an escape character, so that @end tex works.
3924 % But \@ or @@ will get a plain tex @ character.
3926 \def\tex{\begingroup
3927 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
3928 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
3929 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
3930 \catcode `\%=14
3931 \catcode 43=12 % plus
3932 \catcode`\"=12
3933 \catcode`\==12
3934 \catcode`\|=12
3935 \catcode`\<=12
3936 \catcode`\>=12
3937 \escapechar=`\\
3939 \let\b=\ptexb
3940 \let\bullet=\ptexbullet
3941 \let\c=\ptexc
3942 \let\,=\ptexcomma
3943 \let\.=\ptexdot
3944 \let\dots=\ptexdots
3945 \let\equiv=\ptexequiv
3946 \let\!=\ptexexclam
3947 \let\i=\ptexi
3948 \let\{=\ptexlbrace
3949 \let\+=\tabalign
3950 \let\}=\ptexrbrace
3951 \let\*=\ptexstar
3952 \let\t=\ptext
3954 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
3955 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
3956 \def\@{@}%
3957 \let\Etex=\endgroup}
3959 % Define @lisp ... @endlisp.
3960 % @lisp does a \begingroup so it can rebind things,
3961 % including the definition of @endlisp (which normally is erroneous).
3963 % Amount to narrow the margins by for @lisp.
3964 \newskip\lispnarrowing \lispnarrowing=0.4in
3966 % This is the definition that ^^M gets inside @lisp, @example, and other
3967 % such environments. \null is better than a space, since it doesn't
3968 % have any width.
3969 \def\lisppar{\null\endgraf}
3971 % Make each space character in the input produce a normal interword
3972 % space in the output. Don't allow a line break at this space, as this
3973 % is used only in environments like @example, where each line of input
3974 % should produce a line of output anyway.
3976 {\obeyspaces %
3977 \gdef\sepspaces{\obeyspaces\let =\tie}}
3979 % Define \obeyedspace to be our active space, whatever it is. This is
3980 % for use in \parsearg.
3981 {\sepspaces%
3982 \global\let\obeyedspace= }
3984 % This space is always present above and below environments.
3985 \newskip\envskipamount \envskipamount = 0pt
3987 % Make spacing and below environment symmetrical. We use \parskip here
3988 % to help in doing that, since in @example-like environments \parskip
3989 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
3990 % start of the next paragraph will insert \parskip
3992 \def\aboveenvbreak{{\advance\envskipamount by \parskip
3993 \endgraf \ifdim\lastskip<\envskipamount
3994 \removelastskip \penalty-50 \vskip\envskipamount \fi}}
3996 \let\afterenvbreak = \aboveenvbreak
3998 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
3999 \let\nonarrowing=\relax
4001 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
4002 % environment contents.
4003 \font\circle=lcircle10
4004 \newdimen\circthick
4005 \newdimen\cartouter\newdimen\cartinner
4006 \newskip\normbskip\newskip\normpskip\newskip\normlskip
4007 \circthick=\fontdimen8\circle
4009 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
4010 \def\ctr{{\hskip 6pt\circle\char'010}}
4011 \def\cbl{{\circle\char'012\hskip -6pt}}
4012 \def\cbr{{\hskip 6pt\circle\char'011}}
4013 \def\carttop{\hbox to \cartouter{\hskip\lskip
4014 \ctl\leaders\hrule height\circthick\hfil\ctr
4015 \hskip\rskip}}
4016 \def\cartbot{\hbox to \cartouter{\hskip\lskip
4017 \cbl\leaders\hrule height\circthick\hfil\cbr
4018 \hskip\rskip}}
4020 \newskip\lskip\newskip\rskip
4022 \long\def\cartouche{%
4023 \begingroup
4024 \lskip=\leftskip \rskip=\rightskip
4025 \leftskip=0pt\rightskip=0pt %we want these *outside*.
4026 \cartinner=\hsize \advance\cartinner by-\lskip
4027 \advance\cartinner by-\rskip
4028 \cartouter=\hsize
4029 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
4030 % side, and for 6pt waste from
4031 % each corner char, and rule thickness
4032 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
4033 % Flag to tell @lisp, etc., not to narrow margin.
4034 \let\nonarrowing=\comment
4035 \vbox\bgroup
4036 \baselineskip=0pt\parskip=0pt\lineskip=0pt
4037 \carttop
4038 \hbox\bgroup
4039 \hskip\lskip
4040 \vrule\kern3pt
4041 \vbox\bgroup
4042 \hsize=\cartinner
4043 \kern3pt
4044 \begingroup
4045 \baselineskip=\normbskip
4046 \lineskip=\normlskip
4047 \parskip=\normpskip
4048 \vskip -\parskip
4049 \def\Ecartouche{%
4050 \endgroup
4051 \kern3pt
4052 \egroup
4053 \kern3pt\vrule
4054 \hskip\rskip
4055 \egroup
4056 \cartbot
4057 \egroup
4058 \endgroup
4062 % This macro is called at the beginning of all the @example variants,
4063 % inside a group.
4064 \def\nonfillstart{%
4065 \aboveenvbreak
4066 \inENV % This group ends at the end of the body
4067 \hfuzz = 12pt % Don't be fussy
4068 \sepspaces % Make spaces be word-separators rather than space tokens.
4069 \singlespace
4070 \let\par = \lisppar % don't ignore blank lines
4071 \obeylines % each line of input is a line of output
4072 \parskip = 0pt
4073 \parindent = 0pt
4074 \emergencystretch = 0pt % don't try to avoid overfull boxes
4075 % @cartouche defines \nonarrowing to inhibit narrowing
4076 % at next level down.
4077 \ifx\nonarrowing\relax
4078 \advance \leftskip by \lispnarrowing
4079 \exdentamount=\lispnarrowing
4080 \let\exdent=\nofillexdent
4081 \let\nonarrowing=\relax
4085 % Define the \E... control sequence only if we are inside the particular
4086 % environment, so the error checking in \end will work.
4088 % To end an @example-like environment, we first end the paragraph (via
4089 % \afterenvbreak's vertical glue), and then the group. That way we keep
4090 % the zero \parskip that the environments set -- \parskip glue will be
4091 % inserted at the beginning of the next paragraph in the document, after
4092 % the environment.
4094 \def\nonfillfinish{\afterenvbreak\endgroup}
4096 % @lisp: indented, narrowed, typewriter font.
4097 \def\lisp{\begingroup
4098 \nonfillstart
4099 \let\Elisp = \nonfillfinish
4101 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
4102 \gobble % eat return
4105 % @example: Same as @lisp.
4106 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
4108 % @small... is usually equivalent to the non-small (@smallbook
4109 % redefines). We must call \example (or whatever) last in the
4110 % definition, since it reads the return following the @example (or
4111 % whatever) command.
4113 % This actually allows (for example) @end display inside an
4114 % @smalldisplay. Too bad, but makeinfo will catch the error anyway.
4116 \def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display}
4117 \def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp}
4118 \def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format}
4119 \def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
4121 % Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
4122 % Originally contributed by Pavel@xerox.
4123 \def\smalllispx{\begingroup
4124 \def\Esmalllisp{\nonfillfinish\endgroup}%
4125 \def\Esmallexample{\nonfillfinish\endgroup}%
4126 \indexfonts
4127 \lisp
4130 % @display: same as @lisp except keep current font.
4132 \def\display{\begingroup
4133 \nonfillstart
4134 \let\Edisplay = \nonfillfinish
4135 \gobble
4138 % @smalldisplay (when @smallbook): @display plus smaller fonts.
4140 \def\smalldisplayx{\begingroup
4141 \def\Esmalldisplay{\nonfillfinish\endgroup}%
4142 \indexfonts \rm
4143 \display
4146 % @format: same as @display except don't narrow margins.
4148 \def\format{\begingroup
4149 \let\nonarrowing = t
4150 \nonfillstart
4151 \let\Eformat = \nonfillfinish
4152 \gobble
4155 % @smallformat (when @smallbook): @format plus smaller fonts.
4157 \def\smallformatx{\begingroup
4158 \def\Esmallformat{\nonfillfinish\endgroup}%
4159 \indexfonts \rm
4160 \format
4163 % @flushleft (same as @format).
4165 \def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
4167 % @flushright.
4169 \def\flushright{\begingroup
4170 \let\nonarrowing = t
4171 \nonfillstart
4172 \let\Eflushright = \nonfillfinish
4173 \advance\leftskip by 0pt plus 1fill
4174 \gobble
4177 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
4178 % and narrows the margins.
4180 \def\quotation{%
4181 \begingroup\inENV %This group ends at the end of the @quotation body
4182 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
4183 \singlespace
4184 \parindent=0pt
4185 % We have retained a nonzero parskip for the environment, since we're
4186 % doing normal filling. So to avoid extra space below the environment...
4187 \def\Equotation{\parskip = 0pt \nonfillfinish}%
4189 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
4190 \ifx\nonarrowing\relax
4191 \advance\leftskip by \lispnarrowing
4192 \advance\rightskip by \lispnarrowing
4193 \exdentamount = \lispnarrowing
4194 \let\nonarrowing = \relax
4199 \message{defuns,}
4200 % @defun etc.
4202 % Allow user to change definition object font (\df) internally
4203 \def\setdeffont #1 {\csname DEF#1\endcsname}
4205 \newskip\defbodyindent \defbodyindent=.4in
4206 \newskip\defargsindent \defargsindent=50pt
4207 \newskip\deftypemargin \deftypemargin=12pt
4208 \newskip\deflastargmargin \deflastargmargin=18pt
4210 \newcount\parencount
4211 % define \functionparens, which makes ( and ) and & do special things.
4212 % \functionparens affects the group it is contained in.
4213 \def\activeparens{%
4214 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
4215 \catcode`\[=\active \catcode`\]=\active}
4217 % Make control sequences which act like normal parenthesis chars.
4218 \let\lparen = ( \let\rparen = )
4220 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
4222 % Be sure that we always have a definition for `(', etc. For example,
4223 % if the fn name has parens in it, \boldbrax will not be in effect yet,
4224 % so TeX would otherwise complain about undefined control sequence.
4225 \global\let(=\lparen \global\let)=\rparen
4226 \global\let[=\lbrack \global\let]=\rbrack
4228 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
4229 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
4230 % This is used to turn on special parens
4231 % but make & act ordinary (given that it's active).
4232 \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
4234 % Definitions of (, ) and & used in args for functions.
4235 % This is the definition of ( outside of all parentheses.
4236 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
4237 \global\advance\parencount by 1
4240 % This is the definition of ( when already inside a level of parens.
4241 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
4243 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
4244 % also in that case restore the outer-level definition of (.
4245 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
4246 \global\advance \parencount by -1 }
4247 % If we encounter &foo, then turn on ()-hacking afterwards
4248 \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
4250 \gdef\normalparens{\boldbrax\let&=\ampnr}
4251 } % End of definition inside \activeparens
4252 %% These parens (in \boldbrax) actually are a little bolder than the
4253 %% contained text. This is especially needed for [ and ]
4254 \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
4255 \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
4256 \let\ampnr = \&
4257 \def\lbrb{{\bf\char`\[}}
4258 \def\rbrb{{\bf\char`\]}}
4260 % Active &'s sneak into the index arguments, so make sure it's defined.
4262 \catcode`& = 13
4263 \global\let& = \ampnr
4266 % First, defname, which formats the header line itself.
4267 % #1 should be the function name.
4268 % #2 should be the type of definition, such as "Function".
4270 \def\defname #1#2{%
4271 % Get the values of \leftskip and \rightskip as they were
4272 % outside the @def...
4273 \dimen2=\leftskip
4274 \advance\dimen2 by -\defbodyindent
4275 \noindent
4276 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
4277 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
4278 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
4279 \parshape 2 0in \dimen0 \defargsindent \dimen1
4280 % Now output arg 2 ("Function" or some such)
4281 % ending at \deftypemargin from the right margin,
4282 % but stuck inside a box of width 0 so it does not interfere with linebreaking
4283 {% Adjust \hsize to exclude the ambient margins,
4284 % so that \rightline will obey them.
4285 \advance \hsize by -\dimen2
4286 \rlap{\rightline{{\rm #2}\hskip -1.25pc }}}%
4287 % Make all lines underfull and no complaints:
4288 \tolerance=10000 \hbadness=10000
4289 \advance\leftskip by -\defbodyindent
4290 \exdentamount=\defbodyindent
4291 {\df #1}\enskip % Generate function name
4294 % Actually process the body of a definition
4295 % #1 should be the terminating control sequence, such as \Edefun.
4296 % #2 should be the "another name" control sequence, such as \defunx.
4297 % #3 should be the control sequence that actually processes the header,
4298 % such as \defunheader.
4300 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4301 \medbreak %
4302 % Define the end token that this defining construct specifies
4303 % so that it will exit this group.
4304 \def#1{\endgraf\endgroup\medbreak}%
4305 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
4306 \parindent=0in
4307 \advance\leftskip by \defbodyindent
4308 \exdentamount=\defbodyindent
4309 \begingroup %
4310 \catcode 61=\active % 61 is `='
4311 \obeylines\activeparens\spacesplit#3}
4313 % #1 is the \E... control sequence to end the definition (which we define).
4314 % #2 is the \...x control sequence for consecutive fns (which we define).
4315 % #3 is the control sequence to call to resume processing.
4316 % #4, delimited by the space, is the class name.
4318 \def\defmethparsebody#1#2#3#4 {\begingroup\inENV %
4319 \medbreak %
4320 % Define the end token that this defining construct specifies
4321 % so that it will exit this group.
4322 \def#1{\endgraf\endgroup\medbreak}%
4323 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
4324 \parindent=0in
4325 \advance\leftskip by \defbodyindent
4326 \exdentamount=\defbodyindent
4327 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
4329 % @deftypemethod has an extra argument that nothing else does. Sigh.
4330 % #1 is the \E... control sequence to end the definition (which we define).
4331 % #2 is the \...x control sequence for consecutive fns (which we define).
4332 % #3 is the control sequence to call to resume processing.
4333 % #4, delimited by the space, is the class name.
4334 % #5 is the method's return type.
4336 \def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV %
4337 \medbreak %
4338 % Define the end token that this defining construct specifies
4339 % so that it will exit this group.
4340 \def#1{\endgraf\endgroup\medbreak}%
4341 \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}%
4342 \parindent=0in
4343 \advance\leftskip by \defbodyindent
4344 \exdentamount=\defbodyindent
4345 \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}}
4347 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
4348 \medbreak %
4349 % Define the end token that this defining construct specifies
4350 % so that it will exit this group.
4351 \def#1{\endgraf\endgroup\medbreak}%
4352 \def#2##1 ##2 {\def#4{##1}%
4353 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
4354 \parindent=0in
4355 \advance\leftskip by \defbodyindent
4356 \exdentamount=\defbodyindent
4357 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
4359 % These parsing functions are similar to the preceding ones
4360 % except that they do not make parens into active characters.
4361 % These are used for "variables" since they have no arguments.
4363 \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4364 \medbreak %
4365 % Define the end token that this defining construct specifies
4366 % so that it will exit this group.
4367 \def#1{\endgraf\endgroup\medbreak}%
4368 \def#2{\begingroup\obeylines\spacesplit#3}%
4369 \parindent=0in
4370 \advance\leftskip by \defbodyindent
4371 \exdentamount=\defbodyindent
4372 \begingroup %
4373 \catcode 61=\active %
4374 \obeylines\spacesplit#3}
4376 % This is used for \def{tp,vr}parsebody. It could probably be used for
4377 % some of the others, too, with some judicious conditionals.
4379 \def\parsebodycommon#1#2#3{%
4380 \begingroup\inENV %
4381 \medbreak %
4382 % Define the end token that this defining construct specifies
4383 % so that it will exit this group.
4384 \def#1{\endgraf\endgroup\medbreak}%
4385 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
4386 \parindent=0in
4387 \advance\leftskip by \defbodyindent
4388 \exdentamount=\defbodyindent
4389 \begingroup\obeylines
4392 \def\defvrparsebody#1#2#3#4 {%
4393 \parsebodycommon{#1}{#2}{#3}%
4394 \spacesplit{#3{#4}}%
4397 % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
4398 % type is just `struct', because we lose the braces in `{struct
4399 % termios}' when \spacesplit reads its undelimited argument. Sigh.
4400 % \let\deftpparsebody=\defvrparsebody
4402 % So, to get around this, we put \empty in with the type name. That
4403 % way, TeX won't find exactly `{...}' as an undelimited argument, and
4404 % won't strip off the braces.
4406 \def\deftpparsebody #1#2#3#4 {%
4407 \parsebodycommon{#1}{#2}{#3}%
4408 \spacesplit{\parsetpheaderline{#3{#4}}}\empty
4411 % Fine, but then we have to eventually remove the \empty *and* the
4412 % braces (if any). That's what this does.
4414 \def\removeemptybraces\empty#1\relax{#1}
4416 % After \spacesplit has done its work, this is called -- #1 is the final
4417 % thing to call, #2 the type name (which starts with \empty), and #3
4418 % (which might be empty) the arguments.
4420 \def\parsetpheaderline#1#2#3{%
4421 #1{\removeemptybraces#2\relax}{#3}%
4424 \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
4425 \medbreak %
4426 % Define the end token that this defining construct specifies
4427 % so that it will exit this group.
4428 \def#1{\endgraf\endgroup\medbreak}%
4429 \def#2##1 ##2 {\def#4{##1}%
4430 \begingroup\obeylines\spacesplit{#3{##2}}}%
4431 \parindent=0in
4432 \advance\leftskip by \defbodyindent
4433 \exdentamount=\defbodyindent
4434 \begingroup\obeylines\spacesplit{#3{#5}}}
4436 % Split up #2 at the first space token.
4437 % call #1 with two arguments:
4438 % the first is all of #2 before the space token,
4439 % the second is all of #2 after that space token.
4440 % If #2 contains no space token, all of it is passed as the first arg
4441 % and the second is passed as empty.
4443 {\obeylines
4444 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
4445 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
4446 \ifx\relax #3%
4447 #1{#2}{}\else #1{#2}{#3#4}\fi}}
4449 % So much for the things common to all kinds of definitions.
4451 % Define @defun.
4453 % First, define the processing that is wanted for arguments of \defun
4454 % Use this to expand the args and terminate the paragraph they make up
4456 \def\defunargs#1{\functionparens \sl
4457 % Expand, preventing hyphenation at `-' chars.
4458 % Note that groups don't affect changes in \hyphenchar.
4459 % Set the font temporarily and use \font in case \setfont made \tensl a macro.
4460 {\tensl\hyphenchar\font=0}%
4462 {\tensl\hyphenchar\font=45}%
4463 \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
4464 \interlinepenalty=10000
4465 \advance\rightskip by 0pt plus 1fil
4466 \endgraf\nobreak\vskip -\parskip\nobreak
4469 \def\deftypefunargs #1{%
4470 % Expand, preventing hyphenation at `-' chars.
4471 % Note that groups don't affect changes in \hyphenchar.
4472 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
4473 \boldbraxnoamp
4474 \tclose{#1}% avoid \code because of side effects on active chars
4475 \interlinepenalty=10000
4476 \advance\rightskip by 0pt plus 1fil
4477 \endgraf\nobreak\vskip -\parskip\nobreak
4480 % Do complete processing of one @defun or @defunx line already parsed.
4482 % @deffn Command forward-char nchars
4484 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
4486 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
4487 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
4488 \catcode 61=\other % Turn off change made in \defparsebody
4491 % @defun == @deffn Function
4493 \def\defun{\defparsebody\Edefun\defunx\defunheader}
4495 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4496 \begingroup\defname {#1}{\putwordDeffunc}%
4497 \defunargs {#2}\endgroup %
4498 \catcode 61=\other % Turn off change made in \defparsebody
4501 % @deftypefun int foobar (int @var{foo}, float @var{bar})
4503 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
4505 % #1 is the data type. #2 is the name and args.
4506 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
4507 % #1 is the data type, #2 the name, #3 the args.
4508 \def\deftypefunheaderx #1#2 #3\relax{%
4509 \doind {fn}{\code{#2}}% Make entry in function index
4510 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}%
4511 \deftypefunargs {#3}\endgroup %
4512 \catcode 61=\other % Turn off change made in \defparsebody
4515 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
4517 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
4519 % \defheaderxcond#1\relax$$$
4520 % puts #1 in @code, followed by a space, but does nothing if #1 is null.
4521 \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
4523 % #1 is the classification. #2 is the data type. #3 is the name and args.
4524 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
4525 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
4526 \def\deftypefnheaderx #1#2#3 #4\relax{%
4527 \doind {fn}{\code{#3}}% Make entry in function index
4528 \begingroup
4529 \normalparens % notably, turn off `&' magic, which prevents
4530 % at least some C++ text from working
4531 \defname {\defheaderxcond#2\relax$$$#3}{#1}%
4532 \deftypefunargs {#4}\endgroup %
4533 \catcode 61=\other % Turn off change made in \defparsebody
4536 % @defmac == @deffn Macro
4538 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
4540 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4541 \begingroup\defname {#1}{\putwordDefmac}%
4542 \defunargs {#2}\endgroup %
4543 \catcode 61=\other % Turn off change made in \defparsebody
4546 % @defspec == @deffn Special Form
4548 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
4550 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4551 \begingroup\defname {#1}{\putwordDefspec}%
4552 \defunargs {#2}\endgroup %
4553 \catcode 61=\other % Turn off change made in \defparsebody
4556 % @defop CATEGORY CLASS OPERATION ARG...
4558 \def\defop #1 {\def\defoptype{#1}%
4559 \defopparsebody\Edefop\defopx\defopheader\defoptype}
4561 \def\defopheader #1#2#3{%
4562 \dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index
4563 \begingroup\defname {#2}{\defoptype\ \putwordon\ #1}%
4564 \defunargs {#3}\endgroup %
4567 % @deftypemethod CLASS RETURN-TYPE METHOD ARG...
4569 \def\deftypemethod{%
4570 \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
4572 % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
4573 \def\deftypemethodheader#1#2#3#4{%
4574 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
4575 \begingroup
4576 \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}%
4577 \deftypefunargs{#4}%
4578 \endgroup
4581 % @deftypeivar CLASS TYPE VARNAME
4583 \def\deftypeivar{%
4584 \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
4586 % #1 is the class name, #2 the data type, #3 the variable name.
4587 \def\deftypeivarheader#1#2#3{%
4588 \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
4589 \begingroup
4590 \defname{#3}{\putwordInstanceVariableof\ \code{#1}}%
4591 \defvarargs{#3}%
4592 \endgroup
4595 % @defmethod == @defop Method
4597 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
4599 % #1 is the class name, #2 the method name, #3 the args.
4600 \def\defmethodheader#1#2#3{%
4601 \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
4602 \begingroup
4603 \defname{#2}{\putwordMethodon\ \code{#1}}%
4604 \defunargs{#3}%
4605 \endgroup
4608 % @defcv {Class Option} foo-class foo-flag
4610 \def\defcv #1 {\def\defcvtype{#1}%
4611 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
4613 \def\defcvarheader #1#2#3{%
4614 \dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index
4615 \begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}%
4616 \defvarargs {#3}\endgroup %
4619 % @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
4621 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
4623 \def\defivarheader#1#2#3{%
4624 \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index
4625 \begingroup
4626 \defname{#2}{\putwordInstanceVariableof\ #1}%
4627 \defvarargs{#3}%
4628 \endgroup
4631 % @defvar
4632 % First, define the processing that is wanted for arguments of @defvar.
4633 % This is actually simple: just print them in roman.
4634 % This must expand the args and terminate the paragraph they make up
4635 \def\defvarargs #1{\normalparens #1%
4636 \interlinepenalty=10000
4637 \endgraf\nobreak\vskip -\parskip\nobreak}
4639 % @defvr Counter foo-count
4641 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
4643 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
4644 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
4646 % @defvar == @defvr Variable
4648 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
4650 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4651 \begingroup\defname {#1}{\putwordDefvar}%
4652 \defvarargs {#2}\endgroup %
4655 % @defopt == @defvr {User Option}
4657 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
4659 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4660 \begingroup\defname {#1}{\putwordDefopt}%
4661 \defvarargs {#2}\endgroup %
4664 % @deftypevar int foobar
4666 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
4668 % #1 is the data type. #2 is the name, perhaps followed by text that
4669 % is actually part of the data type, which should not be put into the index.
4670 \def\deftypevarheader #1#2{%
4671 \dovarind#2 \relax% Make entry in variables index
4672 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}%
4673 \interlinepenalty=10000
4674 \endgraf\nobreak\vskip -\parskip\nobreak
4675 \endgroup}
4676 \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
4678 % @deftypevr {Global Flag} int enable
4680 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
4682 \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
4683 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
4684 \interlinepenalty=10000
4685 \endgraf\nobreak\vskip -\parskip\nobreak
4686 \endgroup}
4688 % Now define @deftp
4689 % Args are printed in bold, a slight difference from @defvar.
4691 \def\deftpargs #1{\bf \defvarargs{#1}}
4693 % @deftp Class window height width ...
4695 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
4697 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4698 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4700 % These definitions are used if you use @defunx (etc.)
4701 % anywhere other than immediately after a @defun or @defunx.
4703 \def\defcvx#1 {\errmessage{@defcvx in invalid context}}
4704 \def\deffnx#1 {\errmessage{@deffnx in invalid context}}
4705 \def\defivarx#1 {\errmessage{@defivarx in invalid context}}
4706 \def\defmacx#1 {\errmessage{@defmacx in invalid context}}
4707 \def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
4708 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
4709 \def\defopx#1 {\errmessage{@defopx in invalid context}}
4710 \def\defspecx#1 {\errmessage{@defspecx in invalid context}}
4711 \def\deftpx#1 {\errmessage{@deftpx in invalid context}}
4712 \def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
4713 \def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
4714 \def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
4715 \def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
4716 \def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
4717 \def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
4718 \def\defunx#1 {\errmessage{@defunx in invalid context}}
4719 \def\defvarx#1 {\errmessage{@defvarx in invalid context}}
4720 \def\defvrx#1 {\errmessage{@defvrx in invalid context}}
4723 \message{macros,}
4724 % @macro.
4726 % To do this right we need a feature of e-TeX, \scantokens,
4727 % which we arrange to emulate with a temporary file in ordinary TeX.
4728 \ifx\eTeXversion\undefined
4729 \newwrite\macscribble
4730 \def\scanmacro#1{%
4731 \begingroup \newlinechar`\^^M
4732 % Undo catcode changes of \startcontents and \doprintindex
4733 \catcode`\@=0 \catcode`\\=12 \escapechar=`\@
4734 % Append \endinput to make sure that TeX does not see the ending newline.
4735 \toks0={#1\endinput}%
4736 \immediate\openout\macscribble=\jobname.tmp
4737 \immediate\write\macscribble{\the\toks0}%
4738 \immediate\closeout\macscribble
4739 \let\xeatspaces\eatspaces
4740 \input \jobname.tmp
4741 \endgroup
4743 \else
4744 \def\scanmacro#1{%
4745 \begingroup \newlinechar`\^^M
4746 % Undo catcode changes of \startcontents and \doprintindex
4747 \catcode`\@=0 \catcode`\\=12 \escapechar=`\@
4748 \let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
4751 \newcount\paramno % Count of parameters
4752 \newtoks\macname % Macro name
4753 \newif\ifrecursive % Is it recursive?
4754 \def\macrolist{} % List of all defined macros in the form
4755 % \do\macro1\do\macro2...
4757 % Utility routines.
4758 % Thisdoes \let #1 = #2, except with \csnames.
4759 \def\cslet#1#2{%
4760 \expandafter\expandafter
4761 \expandafter\let
4762 \expandafter\expandafter
4763 \csname#1\endcsname
4764 \csname#2\endcsname}
4766 % Trim leading and trailing spaces off a string.
4767 % Concepts from aro-bend problem 15 (see CTAN).
4768 {\catcode`\@=11
4769 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
4770 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
4771 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
4772 \def\unbrace#1{#1}
4773 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
4776 % Trim a single trailing ^^M off a string.
4777 {\catcode`\^^M=12\catcode`\Q=3%
4778 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
4779 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
4780 \gdef\eatcrb#1Q#2Q{#1}%
4783 % Macro bodies are absorbed as an argument in a context where
4784 % all characters are catcode 10, 11 or 12, except \ which is active
4785 % (as in normal texinfo). It is necessary to change the definition of \.
4787 % It's necessary to have hard CRs when the macro is executed. This is
4788 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
4789 % body, and then making it the \newlinechar in \scanmacro.
4791 \def\macrobodyctxt{%
4792 \catcode`\~=12
4793 \catcode`\^=12
4794 \catcode`\_=12
4795 \catcode`\|=12
4796 \catcode`\<=12
4797 \catcode`\>=12
4798 \catcode`\+=12
4799 \catcode`\{=12
4800 \catcode`\}=12
4801 \catcode`\@=12
4802 \catcode`\^^M=12
4803 \usembodybackslash}
4805 \def\macroargctxt{%
4806 \catcode`\~=12
4807 \catcode`\^=12
4808 \catcode`\_=12
4809 \catcode`\|=12
4810 \catcode`\<=12
4811 \catcode`\>=12
4812 \catcode`\+=12
4813 \catcode`\@=12
4814 \catcode`\\=12}
4816 % \mbodybackslash is the definition of \ in @macro bodies.
4817 % It maps \foo\ => \csname macarg.foo\endcsname => #N
4818 % where N is the macro parameter number.
4819 % We define \csname macarg.\endcsname to be \realbackslash, so
4820 % \\ in macro replacement text gets you a backslash.
4822 {\catcode`@=0 @catcode`@\=@active
4823 @gdef@usembodybackslash{@let\=@mbodybackslash}
4824 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
4826 \expandafter\def\csname macarg.\endcsname{\realbackslash}
4828 \def\macro{\recursivefalse\parsearg\macroxxx}
4829 \def\rmacro{\recursivetrue\parsearg\macroxxx}
4831 \def\macroxxx#1{%
4832 \getargs{#1}% now \macname is the macname and \argl the arglist
4833 \ifx\argl\empty % no arguments
4834 \paramno=0%
4835 \else
4836 \expandafter\parsemargdef \argl;%
4838 \if1\csname ismacro.\the\macname\endcsname
4839 \message{Warning: redefining \the\macname}%
4840 \else
4841 \expandafter\ifx\csname \the\macname\endcsname \relax
4842 \else \errmessage{The name \the\macname\space is reserved}\fi
4843 \global\cslet{macsave.\the\macname}{\the\macname}%
4844 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
4845 % Add the macroname to \macrolist
4846 \toks0 = \expandafter{\macrolist\do}%
4847 \xdef\macrolist{\the\toks0
4848 \expandafter\noexpand\csname\the\macname\endcsname}%
4850 \begingroup \macrobodyctxt
4851 \ifrecursive \expandafter\parsermacbody
4852 \else \expandafter\parsemacbody
4853 \fi}
4855 \def\unmacro{\parsearg\unmacroxxx}
4856 \def\unmacroxxx#1{%
4857 \if1\csname ismacro.#1\endcsname
4858 \global\cslet{#1}{macsave.#1}%
4859 \global\expandafter\let \csname ismacro.#1\endcsname=0%
4860 % Remove the macro name from \macrolist
4861 \begingroup
4862 \edef\tempa{\expandafter\noexpand\csname#1\endcsname}%
4863 \def\do##1{%
4864 \def\tempb{##1}%
4865 \ifx\tempa\tempb
4866 % remove this
4867 \else
4868 \toks0 = \expandafter{\newmacrolist\do}%
4869 \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}%
4870 \fi}%
4871 \def\newmacrolist{}%
4872 % Execute macro list to define \newmacrolist
4873 \macrolist
4874 \global\let\macrolist\newmacrolist
4875 \endgroup
4876 \else
4877 \errmessage{Macro #1 not defined}%
4881 % This makes use of the obscure feature that if the last token of a
4882 % <parameter list> is #, then the preceding argument is delimited by
4883 % an opening brace, and that opening brace is not consumed.
4884 \def\getargs#1{\getargsxxx#1{}}
4885 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
4886 \def\getmacname #1 #2\relax{\macname={#1}}
4887 \def\getmacargs#1{\def\argl{#1}}
4889 % Parse the optional {params} list. Set up \paramno and \paramlist
4890 % so \defmacro knows what to do. Define \macarg.blah for each blah
4891 % in the params list, to be ##N where N is the position in that list.
4892 % That gets used by \mbodybackslash (above).
4894 % We need to get `macro parameter char #' into several definitions.
4895 % The technique used is stolen from LaTeX: let \hash be something
4896 % unexpandable, insert that wherever you need a #, and then redefine
4897 % it to # just before using the token list produced.
4899 % The same technique is used to protect \eatspaces till just before
4900 % the macro is used.
4902 \def\parsemargdef#1;{\paramno=0\def\paramlist{}%
4903 \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
4904 \def\parsemargdefxxx#1,{%
4905 \if#1;\let\next=\relax
4906 \else \let\next=\parsemargdefxxx
4907 \advance\paramno by 1%
4908 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
4909 {\xeatspaces{\hash\the\paramno}}%
4910 \edef\paramlist{\paramlist\hash\the\paramno,}%
4911 \fi\next}
4913 % These two commands read recursive and nonrecursive macro bodies.
4914 % (They're different since rec and nonrec macros end differently.)
4916 \long\def\parsemacbody#1@end macro%
4917 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
4918 \long\def\parsermacbody#1@end rmacro%
4919 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
4921 % This defines the macro itself. There are six cases: recursive and
4922 % nonrecursive macros of zero, one, and many arguments.
4923 % Much magic with \expandafter here.
4924 % \xdef is used so that macro definitions will survive the file
4925 % they're defined in; @include reads the file inside a group.
4926 \def\defmacro{%
4927 \let\hash=##% convert placeholders to macro parameter chars
4928 \ifrecursive
4929 \ifcase\paramno
4931 \expandafter\xdef\csname\the\macname\endcsname{%
4932 \noexpand\scanmacro{\temp}}%
4933 \or % 1
4934 \expandafter\xdef\csname\the\macname\endcsname{%
4935 \bgroup\noexpand\macroargctxt
4936 \noexpand\braceorline
4937 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
4938 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
4939 \egroup\noexpand\scanmacro{\temp}}%
4940 \else % many
4941 \expandafter\xdef\csname\the\macname\endcsname{%
4942 \bgroup\noexpand\macroargctxt
4943 \noexpand\csname\the\macname xx\endcsname}%
4944 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
4945 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
4946 \expandafter\expandafter
4947 \expandafter\xdef
4948 \expandafter\expandafter
4949 \csname\the\macname xxx\endcsname
4950 \paramlist{\egroup\noexpand\scanmacro{\temp}}%
4952 \else
4953 \ifcase\paramno
4955 \expandafter\xdef\csname\the\macname\endcsname{%
4956 \noexpand\norecurse{\the\macname}%
4957 \noexpand\scanmacro{\temp}\egroup}%
4958 \or % 1
4959 \expandafter\xdef\csname\the\macname\endcsname{%
4960 \bgroup\noexpand\macroargctxt
4961 \noexpand\braceorline
4962 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
4963 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
4964 \egroup
4965 \noexpand\norecurse{\the\macname}%
4966 \noexpand\scanmacro{\temp}\egroup}%
4967 \else % many
4968 \expandafter\xdef\csname\the\macname\endcsname{%
4969 \bgroup\noexpand\macroargctxt
4970 \expandafter\noexpand\csname\the\macname xx\endcsname}%
4971 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
4972 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
4973 \expandafter\expandafter
4974 \expandafter\xdef
4975 \expandafter\expandafter
4976 \csname\the\macname xxx\endcsname
4977 \paramlist{%
4978 \egroup
4979 \noexpand\norecurse{\the\macname}%
4980 \noexpand\scanmacro{\temp}\egroup}%
4982 \fi}
4984 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
4986 % \braceorline decides whether the next nonwhitespace character is a
4987 % {. If so it reads up to the closing }, if not, it reads the whole
4988 % line. Whatever was read is then fed to the next control sequence
4989 % as an argument (by \parsebrace or \parsearg)
4990 \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
4991 \def\braceorlinexxx{%
4992 \ifx\nchar\bgroup\else
4993 \expandafter\parsearg
4994 \fi \next}
4996 % We mant to disable all macros during \shipout so that they are not
4997 % expanded by \write.
4998 \def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
4999 \edef\next{\macrolist}\expandafter\endgroup\next}
5002 % @alias.
5003 \def\alias#1=#2{\gdef#1{#2}}
5006 \message{cross references,}
5007 % @xref etc.
5009 \newwrite\auxfile
5011 \newif\ifhavexrefs % True if xref values are known.
5012 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
5014 % @inforef is relatively simple.
5015 \def\inforef #1{\inforefzzz #1,,,,**}
5016 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
5017 node \samp{\ignorespaces#1{}}}
5019 % @node's job is to define \lastnode.
5020 \def\node{\ENVcheck\parsearg\nodezzz}
5021 \def\nodezzz#1{\nodexxx [#1,]}
5022 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
5023 \let\nwnode=\node
5024 \let\lastnode=\relax
5026 % The sectioning commands (@chapter, etc.) call these.
5027 \def\donoderef{%
5028 \ifx\lastnode\relax\else
5029 \expandafter\expandafter\expandafter\setref{\lastnode}%
5030 {Ysectionnumberandtype}%
5031 \global\let\lastnode=\relax
5034 \def\unnumbnoderef{%
5035 \ifx\lastnode\relax\else
5036 \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
5037 \global\let\lastnode=\relax
5040 \def\appendixnoderef{%
5041 \ifx\lastnode\relax\else
5042 \expandafter\expandafter\expandafter\setref{\lastnode}%
5043 {Yappendixletterandtype}%
5044 \global\let\lastnode=\relax
5049 % @anchor{NAME} -- define xref target at arbitrary point.
5051 { \catcode`\@ = 11
5052 % From latex.ltx, to make @anchor truely invisible.
5053 \newdimen\@savsk
5054 \newcount\@savsf
5055 \gdef\@bsphack{\relax
5056 \ifhmode \@savsk\lastskip \@savsf\spacefactor \fi
5058 \gdef\@esphack{\relax
5059 \ifhmode \spacefactor\@savsf
5060 \ifdim\@savsk>\z@ \ignorespaces \fi
5063 \gdef\anchor#1{\@bsphack \setref{#1}{Ynothing}\@esphack}
5066 % \setref{NAME}{SNT} defines a cross-reference point NAME, namely
5067 % NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have
5068 % to set \indexdummies so commands such as @code in a section title
5069 % aren't expanded. It would be nicer not to expand the titles in the
5070 % first place, but there's so many layers that that is hard to do.
5072 \def\setref#1#2{{%
5073 \indexdummies
5074 \ifpdf \pdfmkdest{#1}\fi
5075 \dosetq{#1-title}{Ytitle}%
5076 \dosetq{#1-pg}{Ypagenumber}%
5077 \dosetq{#1-snt}{#2}%
5080 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
5081 % the node name, #2 the name of the Info cross-reference, #3 the printed
5082 % node name, #4 the name of the Info file, #5 the name of the printed
5083 % manual. All but the node name can be omitted.
5085 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
5086 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
5087 \def\ref#1{\xrefX[#1,,,,,,,]}
5088 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
5089 \def\printedmanual{\ignorespaces #5}%
5090 \def\printednodename{\ignorespaces #3}%
5091 \setbox1=\hbox{\printedmanual}%
5092 \setbox0=\hbox{\printednodename}%
5093 \ifdim \wd0 = 0pt
5094 % No printed node name was explicitly given.
5095 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
5096 % Use the node name inside the square brackets.
5097 \def\printednodename{\ignorespaces #1}%
5098 \else
5099 % Use the actual chapter/section title appear inside
5100 % the square brackets. Use the real section title if we have it.
5101 \ifdim \wd1 > 0pt
5102 % It is in another manual, so we don't have it.
5103 \def\printednodename{\ignorespaces #1}%
5104 \else
5105 \ifhavexrefs
5106 % We know the real title if we have the xref values.
5107 \def\printednodename{\refx{#1-title}{}}%
5108 \else
5109 % Otherwise just copy the Info node name.
5110 \def\printednodename{\ignorespaces #1}%
5111 \fi%
5116 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
5117 % insert empty discretionaries after hyphens, which means that it will
5118 % not find a line break at a hyphen in a node names. Since some manuals
5119 % are best written with fairly long node names, containing hyphens, this
5120 % is a loss. Therefore, we give the text of the node name again, so it
5121 % is as if TeX is seeing it for the first time.
5122 \ifpdf
5123 \leavevmode
5124 \getfilename{#4}%
5125 \ifnum\filenamelength>0
5126 \pdfannotlink attr{/Border [0 0 0]}%
5127 goto file{\the\filename.pdf} name{#1@}%
5128 \else
5129 \pdfannotlink attr{/Border [0 0 0]}%
5130 goto name{#1@}%
5132 \BlueGreen
5135 \ifdim \wd1 > 0pt
5136 \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
5137 \else
5138 % _ (for example) has to be the character _ for the purposes of the
5139 % control sequence corresponding to the node, but it has to expand
5140 % into the usual \leavevmode...\vrule stuff for purposes of
5141 % printing. So we \turnoffactive for the \refx-snt, back on for the
5142 % printing, back off for the \refx-pg.
5143 {\normalturnoffactive
5144 % Only output a following space if the -snt ref is nonempty; for
5145 % @unnumbered and @anchor, it won't be.
5146 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
5147 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
5149 % [mynode],
5150 [\printednodename],\space
5151 % page 3
5152 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
5154 \ifpdf \Black\pdfendlink \fi
5155 \endgroup}
5157 % \dosetq is the interface for calls from other macros
5159 % Use \normalturnoffactive so that punctuation chars such as underscore
5160 % and backslash work in node names. (\turnoffactive doesn't do \.)
5161 \def\dosetq#1#2{%
5162 {\let\folio=0%
5163 \normalturnoffactive
5164 \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
5165 \iflinks
5166 \next
5171 % \internalsetq {foo}{page} expands into
5172 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
5173 % When the aux file is read, ' is the escape character
5175 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
5177 % Things to be expanded by \internalsetq
5179 \def\Ypagenumber{\folio}
5181 \def\Ytitle{\thissection}
5183 \def\Ynothing{}
5185 \def\Ysectionnumberandtype{%
5186 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
5187 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
5188 \else \ifnum \subsubsecno=0 %
5189 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
5190 \else %
5191 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
5192 \fi \fi \fi }
5194 \def\Yappendixletterandtype{%
5195 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
5196 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
5197 \else \ifnum \subsubsecno=0 %
5198 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
5199 \else %
5200 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
5201 \fi \fi \fi }
5203 \gdef\xreftie{'tie}
5205 % Use TeX 3.0's \inputlineno to get the line number, for better error
5206 % messages, but if we're using an old version of TeX, don't do anything.
5208 \ifx\inputlineno\thisisundefined
5209 \let\linenumber = \empty % Non-3.0.
5210 \else
5211 \def\linenumber{\the\inputlineno:\space}
5214 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
5215 % If its value is nonempty, SUFFIX is output afterward.
5217 \def\refx#1#2{%
5218 \expandafter\ifx\csname X#1\endcsname\relax
5219 % If not defined, say something at least.
5220 \angleleft un\-de\-fined\angleright
5221 \iflinks
5222 \ifhavexrefs
5223 \message{\linenumber Undefined cross reference `#1'.}%
5224 \else
5225 \ifwarnedxrefs\else
5226 \global\warnedxrefstrue
5227 \message{Cross reference values unknown; you must run TeX again.}%
5231 \else
5232 % It's defined, so just use it.
5233 \csname X#1\endcsname
5235 #2% Output the suffix in any case.
5238 % This is the macro invoked by entries in the aux file.
5240 \def\xrdef#1{\begingroup
5241 % Reenable \ as an escape while reading the second argument.
5242 \catcode`\\ = 0
5243 \afterassignment\endgroup
5244 \expandafter\gdef\csname X#1\endcsname
5247 % Read the last existing aux file, if any. No error if none exists.
5248 \def\readauxfile{\begingroup
5249 \catcode`\^^@=\other
5250 \catcode`\^^A=\other
5251 \catcode`\^^B=\other
5252 \catcode`\^^C=\other
5253 \catcode`\^^D=\other
5254 \catcode`\^^E=\other
5255 \catcode`\^^F=\other
5256 \catcode`\^^G=\other
5257 \catcode`\^^H=\other
5258 \catcode`\^^K=\other
5259 \catcode`\^^L=\other
5260 \catcode`\^^N=\other
5261 \catcode`\^^P=\other
5262 \catcode`\^^Q=\other
5263 \catcode`\^^R=\other
5264 \catcode`\^^S=\other
5265 \catcode`\^^T=\other
5266 \catcode`\^^U=\other
5267 \catcode`\^^V=\other
5268 \catcode`\^^W=\other
5269 \catcode`\^^X=\other
5270 \catcode`\^^Z=\other
5271 \catcode`\^^[=\other
5272 \catcode`\^^\=\other
5273 \catcode`\^^]=\other
5274 \catcode`\^^^=\other
5275 \catcode`\^^_=\other
5276 \catcode`\@=\other
5277 \catcode`\^=\other
5278 % It was suggested to define this as 7, which would allow ^^e4 etc.
5279 % in xref tags, i.e., node names. But since ^^e4 notation isn't
5280 % supported in the main text, it doesn't seem desirable. Furthermore,
5281 % that is not enough: for node names that actually contain a ^
5282 % character, we would end up writing a line like this: 'xrdef {'hat
5283 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
5284 % argument, and \hat is not an expandable control sequence. It could
5285 % all be worked out, but why? Either we support ^^ or we don't.
5287 % The other change necessary for this was to define \auxhat:
5288 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
5289 % and then to call \auxhat in \setq.
5291 \catcode`\~=\other
5292 \catcode`\[=\other
5293 \catcode`\]=\other
5294 \catcode`\"=\other
5295 \catcode`\_=\other
5296 \catcode`\|=\other
5297 \catcode`\<=\other
5298 \catcode`\>=\other
5299 \catcode`\$=\other
5300 \catcode`\#=\other
5301 \catcode`\&=\other
5302 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
5303 % Make the characters 128-255 be printing characters
5305 \count 1=128
5306 \def\loop{%
5307 \catcode\count 1=\other
5308 \advance\count 1 by 1
5309 \ifnum \count 1<256 \loop \fi
5312 % The aux file uses ' as the escape (for now).
5313 % Turn off \ as an escape so we do not lose on
5314 % entries which were dumped with control sequences in their names.
5315 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
5316 % Reference to such entries still does not work the way one would wish,
5317 % but at least they do not bomb out when the aux file is read in.
5318 \catcode`\{=1
5319 \catcode`\}=2
5320 \catcode`\%=\other
5321 \catcode`\'=0
5322 \catcode`\\=\other
5324 \openin 1 \jobname.aux
5325 \ifeof 1 \else
5326 \closein 1
5327 \input \jobname.aux
5328 \global\havexrefstrue
5329 \global\warnedobstrue
5331 % Open the new aux file. TeX will close it automatically at exit.
5332 \openout\auxfile=\jobname.aux
5333 \endgroup}
5336 % Footnotes.
5338 \newcount \footnoteno
5340 % The trailing space in the following definition for supereject is
5341 % vital for proper filling; pages come out unaligned when you do a
5342 % pagealignmacro call if that space before the closing brace is
5343 % removed. (Generally, numeric constants should always be followed by a
5344 % space to prevent strange expansion errors.)
5345 \def\supereject{\par\penalty -20000\footnoteno =0 }
5347 % @footnotestyle is meaningful for info output only.
5348 \let\footnotestyle=\comment
5350 \let\ptexfootnote=\footnote
5352 {\catcode `\@=11
5354 % Auto-number footnotes. Otherwise like plain.
5355 \gdef\footnote{%
5356 \global\advance\footnoteno by \@ne
5357 \edef\thisfootno{$^{\the\footnoteno}$}%
5359 % In case the footnote comes at the end of a sentence, preserve the
5360 % extra spacing after we do the footnote number.
5361 \let\@sf\empty
5362 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
5364 % Remove inadvertent blank space before typesetting the footnote number.
5365 \unskip
5366 \thisfootno\@sf
5367 \footnotezzz
5370 % Don't bother with the trickery in plain.tex to not require the
5371 % footnote text as a parameter. Our footnotes don't need to be so general.
5373 % Oh yes, they do; otherwise, @ifset and anything else that uses
5374 % \parseargline fail inside footnotes because the tokens are fixed when
5375 % the footnote is read. --karl, 16nov96.
5377 \long\gdef\footnotezzz{\insert\footins\bgroup
5378 % We want to typeset this text as a normal paragraph, even if the
5379 % footnote reference occurs in (for example) a display environment.
5380 % So reset some parameters.
5381 \interlinepenalty\interfootnotelinepenalty
5382 \splittopskip\ht\strutbox % top baseline for broken footnotes
5383 \splitmaxdepth\dp\strutbox
5384 \floatingpenalty\@MM
5385 \leftskip\z@skip
5386 \rightskip\z@skip
5387 \spaceskip\z@skip
5388 \xspaceskip\z@skip
5389 \parindent\defaultparindent
5391 % Hang the footnote text off the number.
5392 \hang
5393 \textindent{\thisfootno}%
5395 % Don't crash into the line above the footnote text. Since this
5396 % expands into a box, it must come within the paragraph, lest it
5397 % provide a place where TeX can split the footnote.
5398 \footstrut
5399 \futurelet\next\fo@t
5401 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
5402 \else\let\next\f@t\fi \next}
5403 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
5404 \def\f@t#1{#1\@foot}
5405 \def\@foot{\strut\egroup}
5407 }%end \catcode `\@=11
5409 % Set the baselineskip to #1, and the lineskip and strut size
5410 % correspondingly. There is no deep meaning behind these magic numbers
5411 % used as factors; they just match (closely enough) what Knuth defined.
5413 \def\lineskipfactor{.08333}
5414 \def\strutheightpercent{.70833}
5415 \def\strutdepthpercent {.29167}
5417 \def\setleading#1{%
5418 \normalbaselineskip = #1\relax
5419 \normallineskip = \lineskipfactor\normalbaselineskip
5420 \normalbaselines
5421 \setbox\strutbox =\hbox{%
5422 \vrule width0pt height\strutheightpercent\baselineskip
5423 depth \strutdepthpercent \baselineskip
5427 % @| inserts a changebar to the left of the current line. It should
5428 % surround any changed text. This approach does *not* work if the
5429 % change spans more than two lines of output. To handle that, we would
5430 % have adopt a much more difficult approach (putting marks into the main
5431 % vertical list for the beginning and end of each change).
5433 \def\|{%
5434 % \vadjust can only be used in horizontal mode.
5435 \leavevmode
5437 % Append this vertical mode material after the current line in the output.
5438 \vadjust{%
5439 % We want to insert a rule with the height and depth of the current
5440 % leading; that is exactly what \strutbox is supposed to record.
5441 \vskip-\baselineskip
5443 % \vadjust-items are inserted at the left edge of the type. So
5444 % the \llap here moves out into the left-hand margin.
5445 \llap{%
5447 % For a thicker or thinner bar, change the `1pt'.
5448 \vrule height\baselineskip width1pt
5450 % This is the space between the bar and the text.
5451 \hskip 12pt
5456 % For a final copy, take out the rectangles
5457 % that mark overfull boxes (in case you have decided
5458 % that the text looks ok even though it passes the margin).
5460 \def\finalout{\overfullrule=0pt}
5462 % @image. We use the macros from epsf.tex to support this.
5463 % If epsf.tex is not installed and @image is used, we complain.
5465 % Check for and read epsf.tex up front. If we read it only at @image
5466 % time, we might be inside a group, and then its definitions would get
5467 % undone and the next image would fail.
5468 \openin 1 = epsf.tex
5469 \ifeof 1 \else
5470 \closein 1
5471 % Do not bother showing banner with post-v2.7 epsf.tex (available in
5472 % doc/epsf.tex until it shows up on ctan).
5473 \def\epsfannounce{\toks0 = }%
5474 \input epsf.tex
5477 % We will only complain once about lack of epsf.tex.
5478 \newif\ifwarnednoepsf
5479 \newhelp\noepsfhelp{epsf.tex must be installed for images to
5480 work. It is also included in the Texinfo distribution, or you can get
5481 it from ftp://tug.org/tex/epsf.tex.}
5483 \def\image#1{%
5484 \ifx\epsfbox\undefined
5485 \ifwarnednoepsf \else
5486 \errhelp = \noepsfhelp
5487 \errmessage{epsf.tex not found, images will be ignored}%
5488 \global\warnednoepsftrue
5490 \else
5491 \imagexxx #1,,,\finish
5495 % Arguments to @image:
5496 % #1 is (mandatory) image filename; we tack on .eps extension.
5497 % #2 is (optional) width, #3 is (optional) height.
5498 % #4 is just the usual extra ignored arg for parsing this stuff.
5499 \def\imagexxx#1,#2,#3,#4\finish{%
5500 \ifx\pdfoutput\undefined
5501 % \epsfbox itself resets \epsf?size at each figure.
5502 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
5503 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
5504 \begingroup
5505 \catcode`\^^M = 5 % in case we're inside an example
5506 % If the image is by itself, center it.
5507 \ifvmode
5508 \nobreak\bigskip
5509 % Usually we'll have text after the image which will insert
5510 % \parskip glue, so insert it here too to equalize the space
5511 % above and below.
5512 \nobreak\vskip\parskip
5513 \nobreak
5514 \centerline{\epsfbox{#1.eps}}%
5515 \bigbreak
5516 \else
5517 % In the middle of a paragraph, no extra space.
5518 \epsfbox{#1.eps}%
5520 \endgroup
5521 \else
5522 \centerline{\pdfimage #1.pdf}%
5527 \message{localization,}
5528 % and i18n.
5530 % @documentlanguage is usually given very early, just after
5531 % @setfilename. If done too late, it may not override everything
5532 % properly. Single argument is the language abbreviation.
5533 % It would be nice if we could set up a hyphenation file here.
5535 \def\documentlanguage{\parsearg\dodocumentlanguage}
5536 \def\dodocumentlanguage#1{%
5537 \tex % read txi-??.tex file in plain TeX.
5538 % Read the file if it exists.
5539 \openin 1 txi-#1.tex
5540 \ifeof1
5541 \errhelp = \nolanghelp
5542 \errmessage{Cannot read language file txi-#1.tex}%
5543 \let\temp = \relax
5544 \else
5545 \def\temp{\input txi-#1.tex }%
5547 \temp
5548 \endgroup
5550 \newhelp\nolanghelp{The given language definition file cannot be found or
5551 is empty. Maybe you need to install it? In the current directory
5552 should work if nowhere else does.}
5555 % @documentencoding should change something in TeX eventually, most
5556 % likely, but for now just recognize it.
5557 \let\documentencoding = \comment
5560 % Page size parameters.
5562 \newdimen\defaultparindent \defaultparindent = 15pt
5564 \chapheadingskip = 15pt plus 4pt minus 2pt
5565 \secheadingskip = 12pt plus 3pt minus 2pt
5566 \subsecheadingskip = 9pt plus 2pt minus 2pt
5568 % Prevent underfull vbox error messages.
5569 \vbadness = 10000
5571 % Don't be so finicky about underfull hboxes, either.
5572 \hbadness = 2000
5574 % Following George Bush, just get rid of widows and orphans.
5575 \widowpenalty=10000
5576 \clubpenalty=10000
5578 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
5579 % using an old version of TeX, don't do anything. We want the amount of
5580 % stretch added to depend on the line length, hence the dependence on
5581 % \hsize. We call this whenever the paper size is set.
5583 \def\setemergencystretch{%
5584 \ifx\emergencystretch\thisisundefined
5585 % Allow us to assign to \emergencystretch anyway.
5586 \def\emergencystretch{\dimen0}%
5587 \else
5588 \emergencystretch = .15\hsize
5592 % Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
5593 % 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can
5594 % set \parskip and call \setleading for \baselineskip.
5596 \def\internalpagesizes#1#2#3#4#5#6{%
5597 \voffset = #3\relax
5598 \topskip = #6\relax
5599 \splittopskip = \topskip
5601 \vsize = #1\relax
5602 \advance\vsize by \topskip
5603 \outervsize = \vsize
5604 \advance\outervsize by 2\topandbottommargin
5605 \pageheight = \vsize
5607 \hsize = #2\relax
5608 \outerhsize = \hsize
5609 \advance\outerhsize by 0.5in
5610 \pagewidth = \hsize
5612 \normaloffset = #4\relax
5613 \bindingoffset = #5\relax
5615 \parindent = \defaultparindent
5616 \setemergencystretch
5619 % @letterpaper (the default).
5620 \def\letterpaper{{\globaldefs = 1
5621 \parskip = 3pt plus 2pt minus 1pt
5622 \setleading{13.2pt}%
5624 % If page is nothing but text, make it come out even.
5625 \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}%
5628 % Use @smallbook to reset parameters for 7x9.5 (or so) format.
5629 \def\smallbook{{\globaldefs = 1
5630 \parskip = 2pt plus 1pt
5631 \setleading{12pt}%
5633 \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}%
5635 \lispnarrowing = 0.3in
5636 \tolerance = 700
5637 \hfuzz = 1pt
5638 \contentsrightmargin = 0pt
5639 \deftypemargin = 0pt
5640 \defbodyindent = .5cm
5642 \let\smalldisplay = \smalldisplayx
5643 \let\smallexample = \smalllispx
5644 \let\smallformat = \smallformatx
5645 \let\smalllisp = \smalllispx
5648 % Use @afourpaper to print on European A4 paper.
5649 \def\afourpaper{{\globaldefs = 1
5650 \setleading{12pt}%
5651 \parskip = 3pt plus 2pt minus 1pt
5653 \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}%
5655 \tolerance = 700
5656 \hfuzz = 1pt
5659 % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
5660 % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
5661 \def\afourlatex{{\globaldefs = 1
5662 \setleading{13.6pt}%
5664 \afourpaper
5665 \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}%
5667 \globaldefs = 0
5670 % Use @afourwide to print on European A4 paper in wide format.
5671 \def\afourwide{%
5672 \afourpaper
5673 \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
5675 \globaldefs = 0
5678 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
5679 % Perhaps we should allow setting the margins, \topskip, \parskip,
5680 % and/or leading, also. Or perhaps we should compute them somehow.
5682 \def\pagesizes{\parsearg\pagesizesxxx}
5683 \def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
5684 \def\pagesizesyyy#1,#2,#3\finish{{%
5685 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
5686 \globaldefs = 1
5688 \parskip = 3pt plus 2pt minus 1pt
5689 \setleading{13.2pt}%
5691 \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}%
5694 % Set default to letter.
5696 \letterpaper
5699 \message{and turning on texinfo input format.}
5701 % Define macros to output various characters with catcode for normal text.
5702 \catcode`\"=\other
5703 \catcode`\~=\other
5704 \catcode`\^=\other
5705 \catcode`\_=\other
5706 \catcode`\|=\other
5707 \catcode`\<=\other
5708 \catcode`\>=\other
5709 \catcode`\+=\other
5710 \catcode`\$=\other
5711 \def\normaldoublequote{"}
5712 \def\normaltilde{~}
5713 \def\normalcaret{^}
5714 \def\normalunderscore{_}
5715 \def\normalverticalbar{|}
5716 \def\normalless{<}
5717 \def\normalgreater{>}
5718 \def\normalplus{+}
5719 \def\normaldollar{$}
5721 % This macro is used to make a character print one way in ttfont
5722 % where it can probably just be output, and another way in other fonts,
5723 % where something hairier probably needs to be done.
5725 % #1 is what to print if we are indeed using \tt; #2 is what to print
5726 % otherwise. Since all the Computer Modern typewriter fonts have zero
5727 % interword stretch (and shrink), and it is reasonable to expect all
5728 % typewriter fonts to have this, we can check that font parameter.
5730 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
5732 % Same as above, but check for italic font. Actually this also catches
5733 % non-italic slanted fonts since it is impossible to distinguish them from
5734 % italic fonts. But since this is only used by $ and it uses \sl anyway
5735 % this is not a problem.
5736 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
5738 % Turn off all special characters except @
5739 % (and those which the user can use as if they were ordinary).
5740 % Most of these we simply print from the \tt font, but for some, we can
5741 % use math or other variants that look better in normal text.
5743 \catcode`\"=\active
5744 \def\activedoublequote{{\tt\char34}}
5745 \let"=\activedoublequote
5746 \catcode`\~=\active
5747 \def~{{\tt\char126}}
5748 \chardef\hat=`\^
5749 \catcode`\^=\active
5750 \def^{{\tt \hat}}
5752 \catcode`\_=\active
5753 \def_{\ifusingtt\normalunderscore\_}
5754 % Subroutine for the previous macro.
5755 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
5757 \catcode`\|=\active
5758 \def|{{\tt\char124}}
5759 \chardef \less=`\<
5760 \catcode`\<=\active
5761 \def<{{\tt \less}}
5762 \chardef \gtr=`\>
5763 \catcode`\>=\active
5764 \def>{{\tt \gtr}}
5765 \catcode`\+=\active
5766 \def+{{\tt \char 43}}
5767 \catcode`\$=\active
5768 \def${\ifusingit{{\sl\$}}\normaldollar}
5769 %\catcode 27=\active
5770 %\def^^[{$\diamondsuit$}
5772 % Set up an active definition for =, but don't enable it most of the time.
5773 {\catcode`\==\active
5774 \global\def={{\tt \char 61}}}
5776 \catcode`+=\active
5777 \catcode`\_=\active
5779 % If a .fmt file is being used, characters that might appear in a file
5780 % name cannot be active until we have parsed the command line.
5781 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
5782 % \otherifyactive is called near the end of this file.
5783 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
5785 \catcode`\@=0
5787 % \rawbackslashxx output one backslash character in current font
5788 \global\chardef\rawbackslashxx=`\\
5789 %{\catcode`\\=\other
5790 %@gdef@rawbackslashxx{\}}
5792 % \rawbackslash redefines \ as input to do \rawbackslashxx.
5793 {\catcode`\\=\active
5794 @gdef@rawbackslash{@let\=@rawbackslashxx }}
5796 % \normalbackslash outputs one backslash in fixed width font.
5797 \def\normalbackslash{{\tt\rawbackslashxx}}
5799 % \catcode 17=0 % Define control-q
5800 \catcode`\\=\active
5802 % Used sometimes to turn off (effectively) the active characters
5803 % even after parsing them.
5804 @def@turnoffactive{@let"=@normaldoublequote
5805 @let\=@realbackslash
5806 @let~=@normaltilde
5807 @let^=@normalcaret
5808 @let_=@normalunderscore
5809 @let|=@normalverticalbar
5810 @let<=@normalless
5811 @let>=@normalgreater
5812 @let+=@normalplus
5813 @let$=@normaldollar}
5815 @def@normalturnoffactive{@let"=@normaldoublequote
5816 @let\=@normalbackslash
5817 @let~=@normaltilde
5818 @let^=@normalcaret
5819 @let_=@normalunderscore
5820 @let|=@normalverticalbar
5821 @let<=@normalless
5822 @let>=@normalgreater
5823 @let+=@normalplus
5824 @let$=@normaldollar}
5826 % Make _ and + \other characters, temporarily.
5827 % This is canceled by @fixbackslash.
5828 @otherifyactive
5830 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
5831 % That is what \eatinput is for; after that, the `\' should revert to printing
5832 % a backslash.
5834 @gdef@eatinput input texinfo{@fixbackslash}
5835 @global@let\ = @eatinput
5837 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
5838 % the first `\{ in the file would cause an error. This macro tries to fix
5839 % that, assuming it is called before the first `\' could plausibly occur.
5840 % Also back turn on active characters that might appear in the input
5841 % file name, in case not using a pre-dumped format.
5843 @gdef@fixbackslash{%
5844 @ifx\@eatinput @let\ = @normalbackslash @fi
5845 @catcode`+=@active
5846 @catcode`@_=@active
5849 % Say @foo, not \foo, in error messages.
5850 @escapechar = `@@
5852 % These look ok in all fonts, so just make them not special.
5853 @catcode`@& = @other
5854 @catcode`@# = @other
5855 @catcode`@% = @other
5857 @c Set initial fonts.
5858 @textfonts
5862 @c Local variables:
5863 @c eval: (add-hook 'write-file-hooks 'time-stamp)
5864 @c page-delimiter: "^\\\\message"
5865 @c time-stamp-start: "def\\\\texinfoversion{"
5866 @c time-stamp-format: "%:y-%02m-%02d.%H"
5867 @c time-stamp-end: "}"
5868 @c End: