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{2002-10-30.16}
8 % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9 % 1996, 1997, 1998, 1999, 2000, 2001, 2002 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/gnu/texinfo.tex
33 % (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
34 % ftp://texinfo.org/texinfo/texinfo.tex
35 % ftp://tug.org/tex/texinfo.tex
36 % (and all CTAN mirrors, see http://www.ctan.org),
37 % and /home/gd/gnu/doc/texinfo.tex on the GNU machines.
39 % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
41 % The texinfo.tex in any given Texinfo distribution could well be out
42 % of date, so if that's what you're using, please check.
44 % Send bug reports to bug-texinfo@gnu.org. Please include including a
45 % complete document in each bug report with which we can reproduce the
46 % problem. Patches are, of course, greatly appreciated.
48 % To process a Texinfo manual with TeX, it's most reliable to use the
49 % texi2dvi shell script that comes with the distribution. For a simple
50 % manual foo.texi, however, you can get away with this:
55 % dvips foo.dvi -o # or whatever; this makes foo.ps.
56 % The extra TeX runs get the cross-reference information correct.
57 % Sometimes one run after texindex suffices, and sometimes you need more
58 % than two; texi2dvi does it as many times as necessary.
60 % It is possible to adapt texinfo.tex for other languages. You can get
61 % the existing language-specific files from the full Texinfo distribution.
63 \message{Loading texinfo [version \texinfoversion]:}
65 % If in a .fmt file, print the version number
66 % and turn on active characters that we couldn't do earlier because
67 % they might have appeared in the input file name.
68 \everyjob{\message{[Texinfo version \texinfoversion]}%
69 \catcode`+=\active \catcode`\_=\active}
71 % Save some parts of plain tex whose names we will redefine.
73 \let\ptexbullet=\bullet
87 % We never want plain's outer \+ definition in Texinfo.
88 % For @tex, we can use \tabalign.
94 % If this character appears in an error message or help string, it
95 % starts a new line in the output.
98 % Set up fixed words for English if not already set.
99 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
100 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
101 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
102 \ifx\putwordin\undefined \gdef\putwordin{in}\fi
103 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
104 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
105 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
106 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
107 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
108 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
109 \ifx\putwordof\undefined \gdef\putwordof{of}\fi
110 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
111 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
112 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
113 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
114 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
115 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
116 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
117 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
119 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
120 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
121 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
122 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
123 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
124 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
125 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
126 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
127 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
128 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
129 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
130 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
132 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
133 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
134 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
135 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
136 \ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
137 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
138 \ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
144 % True if #1 is the empty string, i.e., called like `\ifempty{}'.
146 \def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}%
147 \def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}%
150 \hyphenation{ap-pen-dix}
151 \hyphenation{mini-buf-fer mini-buf-fers}
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. We also make
163 % some effort to order the tracing commands to reduce output in the log
164 % file; cf. trace.sty in LaTeX.
166 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
170 \tracinglostchars2 % 2 gives us more in etex
175 \showboxbreadth\maxdimen \showboxdepth\maxdimen
176 \ifx\eTeXversion\undefined\else % etex gives us more logging
183 \tracingcommands3 % 3 gives us more in etex
184 \errorcontextlines\maxdimen
187 % add check for \lastpenalty to plain's definitions. If the last thing
188 % we did was a \nobreak, we don't want to insert more space.
190 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
191 \removelastskip\penalty-50\smallskip\fi\fi}
192 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
193 \removelastskip\penalty-100\medskip\fi\fi}
194 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
195 \removelastskip\penalty-200\bigskip\fi\fi}
197 % For @cropmarks command.
198 % Do @cropmarks to get crop marks.
201 \let\cropmarks = \cropmarkstrue
203 % Dimensions to add cropmarks at corners.
204 % Added by P. A. MacKay, 12 Nov. 1986
206 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
207 \newdimen\cornerlong \cornerlong=1pc
208 \newdimen\cornerthick \cornerthick=.3pt
209 \newdimen\topandbottommargin \topandbottommargin=.75in
211 % Main output routine.
213 \output = {\onepageout{\pagecontents\PAGE}}
218 % \onepageout takes a vbox as an argument. Note that \pagecontents
219 % does insertions, but you have to call it yourself.
221 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
223 \ifodd\pageno \advance\hoffset by \bindingoffset
224 \else \advance\hoffset by -\bindingoffset\fi
226 % Do this outside of the \shipout so @code etc. will be expanded in
227 % the headline as they should be, not taken literally (outputting ''code).
228 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
229 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
232 % Have to do this stuff outside the \shipout because we want it to
233 % take effect in \write's, yet the group defined by the \vbox ends
234 % before the \shipout runs.
236 \escapechar = `\\ % use backslash in output files.
237 \indexdummies % don't expand commands in the output.
238 \normalturnoffactive % \ in index entries must not stay \, e.g., if
239 % the page break happens to be in the middle of an example.
241 % Do this early so pdf references go to the beginning of the page.
242 \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
244 \ifcropmarks \vbox to \outervsize\bgroup
246 \vskip-\topandbottommargin
248 \line{\ewtop\hfil\ewtop}%
251 \vbox{\moveleft\cornerthick\nstop}%
253 \vbox{\moveright\cornerthick\nstop}%
256 \vskip\topandbottommargin
258 \hfil % center the page within the outer (page) hsize.
259 \ifodd\pageno\hskip\bindingoffset\fi
265 \ifdim\ht\footlinebox > 0pt
266 % Only leave this space if the footline is nonempty.
267 % (We lessened \vsize for it in \oddfootingxxx.)
268 % The \baselineskip=24pt in plain's \makefootline has no effect.
269 \vskip 2\baselineskip
274 \egroup % end of \vbox\bgroup
275 \hfil\egroup % end of (centering) \line\bgroup
276 \vskip\topandbottommargin plus1fill minus1fill
277 \boxmaxdepth = \cornerthick
280 \vbox{\moveleft\cornerthick\nsbot}%
282 \vbox{\moveright\cornerthick\nsbot}%
285 \line{\ewbot\hfil\ewbot}%
287 \egroup % \vbox from first cropmarks clause
289 }% end of \shipout\vbox
290 }% end of group with \turnoffactive
292 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
295 \newinsert\margin \dimen\margin=\maxdimen
297 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
299 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
300 % marginal hacks, juha@viisa.uucp (Juha Takala)
301 \ifvoid\margin\else % marginal info is present
302 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
303 \dimen@=\dp#1 \unvbox#1
304 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
305 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
308 % Here are the rules for the cropmarks. Note that they are
309 % offset so that the space between them is truly \outerhsize or \outervsize
310 % (P. A. MacKay, 12 November, 1986)
312 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
314 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
315 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
317 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
319 % Parse an argument, then pass it to #1. The argument is the rest of
320 % the input line (except we remove a trailing comment). #1 should be a
321 % macro which expects an ordinary undelimited TeX argument.
327 \futurelet\temp\parseargx
330 % If the next token is an obeyed space (from an @example environment or
331 % the like), remove it and recurse. Otherwise, we're done.
333 % \obeyedspace is defined far below, after the definition of \sepspaces.
334 \ifx\obeyedspace\temp
335 \expandafter\parseargdiscardspace
337 \expandafter\parseargline
341 % Remove a single space (as the delimiter token to the macro call).
343 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
346 \gdef\parseargline#1^^M{%
347 \endgroup % End of the group started in \parsearg.
349 % First remove any @c comment, then any @comment.
350 % Result of each macro is put in \toks0.
351 \argremovec #1\c\relax %
352 \expandafter\argremovecomment \the\toks0 \comment\relax %
354 % Call the caller's macro, saved as \next in \parsearg.
355 \expandafter\next\expandafter{\the\toks0}%
359 % Since all \c{,omment} does is throw away the argument, we can let TeX
360 % do that for us. The \relax here is matched by the \relax in the call
361 % in \parseargline; it could be more or less anything, its purpose is
362 % just to delimit the argument to the \c.
363 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
364 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
366 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
367 % @end itemize @c foo
368 % will have two active spaces as part of the argument with the
369 % `itemize'. Here we remove all active spaces from #1, and assign the
372 % This loses if there are any *other* active characters besides spaces
373 % in the argument -- _ ^ +, for example -- since they get expanded.
374 % Fortunately, Texinfo does not define any such commands. (If it ever
375 % does, the catcode of the characters in questionwill have to be changed
376 % here.) But this means we cannot call \removeactivespaces as part of
377 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
378 % that \parsearg gets might well have any character at all in it.
380 \def\removeactivespaces#1{%
384 \global\toks0 = \expandafter{\temp}%
388 % Change the active space to expand to nothing.
392 \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
396 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
398 %% These are used to keep @begin/@end levels from running away
399 %% Call \inENV within environments (after a \begingroup)
400 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
402 \ifENV\errmessage{Still within an environment; press RETURN to continue}
403 \endgroup\fi} % This is not perfect, but it should reduce lossage
405 % @begin foo is the same as @foo, for now.
406 \newhelp\EMsimple{Press RETURN to continue.}
408 \outer\def\begin{\parsearg\beginxxx}
411 \expandafter\ifx\csname #1\endcsname\relax
412 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
413 \csname #1\endcsname\fi}
415 % @end foo executes the definition of \Efoo.
417 \def\end{\parsearg\endxxx}
419 \removeactivespaces{#1}%
420 \edef\endthing{\the\toks0}%
422 \expandafter\ifx\csname E\endthing\endcsname\relax
423 \expandafter\ifx\csname \endthing\endcsname\relax
424 % There's no \foo, i.e., no ``environment'' foo.
426 \errmessage{Undefined command `@end \endthing'}%
428 \unmatchedenderror\endthing
431 % Everything's ok; the right environment has been started.
432 \csname E\endthing\endcsname
436 % There is an environment #1, but it hasn't been started. Give an error.
438 \def\unmatchedenderror#1{%
440 \errmessage{This `@end #1' doesn't have a matching `@#1'}%
443 % Define the control sequence \E#1 to give an unmatched @end error.
445 \def\defineunmatchedend#1{%
446 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
450 %% Simple single-character @ commands
453 % Kludge this until the fonts are right (grr).
456 % This is turned off because it was never documented
457 % and you can use @w{...} around a quote to suppress ligatures.
458 %% Define @` and @' to be the same as ` and '
459 %% but suppressing ligatures.
463 % Used to generate quoted braces.
464 \def\mylbrace {{\tt\char123}}
465 \def\myrbrace {{\tt\char125}}
469 % Definitions to produce actual \{ & \} command in an index.
470 \catcode`\{ = 12 \catcode`\} = 12
471 \catcode`\[ = 1 \catcode`\] = 2
472 \catcode`\@ = 0 \catcode`\\ = 12
477 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
478 % Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
481 \def\ringaccent#1{{\accent23 #1}}
486 % Other special characters: @questiondown @exclamdown
487 % Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
488 \def\questiondown{?`}
491 % Dotless i and dotless j, used for accents.
496 \ifx\temp\imacro \ptexi
497 \else\ifx\temp\jmacro \j
498 \else \errmessage{@dotless can be used only with i or j}%
502 % Be sure we're in horizontal mode when doing a tie, since we make space
503 % equivalent to this in @example-like environments. Otherwise, a space
504 % at the beginning of a line will start with \penalty -- and
505 % since \penalty is valid in vertical mode, we'd end up putting the
506 % penalty on the vertical list instead of in the new paragraph.
508 % Avoid using \@M directly, because that causes trouble
509 % if the definition is written into an index file.
510 \global\let\tiepenalty = \@M
511 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
514 % @: forces normal size whitespace following.
515 \def\:{\spacefactor=1000 }
517 % @* forces a line break.
518 \def\*{\hfil\break\hbox{}\ignorespaces}
520 % @. is an end-of-sentence period.
521 \def\.{.\spacefactor=3000 }
523 % @! is an end-of-sentence bang.
524 \def\!{!\spacefactor=3000 }
526 % @? is an end-of-sentence query.
527 \def\?{?\spacefactor=3000 }
529 % @w prevents a word break. Without the \leavevmode, @w at the
530 % beginning of a paragraph, when TeX is still in vertical mode, would
531 % produce a whole line of output instead of starting the paragraph.
532 \def\w#1{\leavevmode\hbox{#1}}
534 % @group ... @end group forces ... to be all on one page, by enclosing
535 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
536 % to keep its height that of a normal line. According to the rules for
537 % \topskip (p.114 of the TeXbook), the glue inserted is
538 % max (\topskip - \ht (first item), 0). If that height is large,
539 % therefore, no glue is inserted, and the space between the headline and
540 % the text is small, which looks bad.
542 \def\group{\begingroup
543 \ifnum\catcode13=\active \else
544 \errhelp = \groupinvalidhelp
545 \errmessage{@group invalid in context where filling is enabled}%
548 % The \vtop we start below produces a box with normal height and large
549 % depth; thus, TeX puts \baselineskip glue before it, and (when the
550 % next line of text is done) \lineskip glue after it. (See p.82 of
551 % the TeXbook.) Thus, space below is not quite equal to space
552 % above. But it's pretty close.
554 \egroup % End the \vtop.
555 \endgroup % End the \group.
559 % We have to put a strut on the last line in case the @group is in
560 % the midst of an example, rather than completely enclosing it.
561 % Otherwise, the interline space between the last line of the group
562 % and the first line afterwards is too small. But we can't put the
563 % strut in \Egroup, since there it would be on a line by itself.
564 % Hence this just inserts a strut at the beginning of each line.
565 \everypar = {\strut}%
567 % Since we have a strut on every line, we don't need any of TeX's
568 % normal interline spacing.
571 % OK, but now we have to do something about blank
572 % lines in the input in @example-like environments, which normally
573 % just turn into \lisppar, which will insert no space now that we've
574 % turned off the interline space. Simplest is to make them be an
577 \edef\par{\leavevmode \par}%
579 % Reset ^^M's definition to new definition of \par.
583 % Do @comment since we are called inside an environment such as
584 % @example, where each end-of-line in the input causes an
585 % end-of-line in the output. We don't want the end-of-line after
586 % the `@group' to put extra space in the output. Since @group
587 % should appear on a line by itself (according to the Texinfo
588 % manual), we don't worry about eating any user text.
592 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
593 % message, so this ends up printing `@group can only ...'.
595 \newhelp\groupinvalidhelp{%
596 group can only be used in environments such as @example,^^J%
597 where each line of input produces a line of output.}
599 % @need space-in-mils
600 % forces a page break if there is not space-in-mils remaining.
602 \newdimen\mil \mil=0.001in
604 \def\need{\parsearg\needx}
606 % Old definition--didn't work.
607 %\def\needx #1{\par %
608 %% This method tries to make TeX break the page naturally
609 %% if the depth of the box does not fit.
611 %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
616 % Ensure vertical mode, so we don't make a big box in the middle of a
620 % If the @need value is less than one line space, it's useless.
622 \dimen2 = \ht\strutbox
623 \advance\dimen2 by \dp\strutbox
624 \ifdim\dimen0 > \dimen2
626 % Do a \strut just to make the height of this box be normal, so the
627 % normal leading is inserted relative to the preceding line.
628 % And a page break here is fine.
629 \vtop to #1\mil{\strut\vfil}%
631 % TeX does not even consider page breaks if a penalty added to the
632 % main vertical list is 10000 or more. But in order to see if the
633 % empty box we just added fits on the page, we must make it consider
634 % page breaks. On the other hand, we don't want to actually break the
635 % page after the empty box. So we use a penalty of 9999.
637 % There is an extremely small chance that TeX will actually break the
638 % page at this \penalty, if there are no other feasible breakpoints in
639 % sight. (If the user is using lots of big @group commands, which
640 % almost-but-not-quite fill up a page, TeX will have a hard time doing
641 % good page breaking, for example.) However, I could not construct an
642 % example where a page broke at this \penalty; if it happens in a real
643 % document, then we can reconsider our strategy.
646 % Back up by the size of the box, whether we did a page break or not.
649 % Do not allow a page break right after this kern.
654 % @br forces paragraph break
658 % @dots{} output an ellipsis using the current font.
659 % We do .5em per period so that it has the same spacing in a typewriter
660 % font as three actual period characters.
665 \hskip 0pt plus 0.25fil minus 0.25fil
667 \hskip 0pt plus 0.5fil minus 0.5fil
671 % @enddots{} is an end-of-sentence ellipsis.
676 \hskip 0pt plus 0.25fil minus 0.25fil
678 \hskip 0pt plus 0.5fil minus 0.5fil
684 % @page forces the start of a new page
686 \def\page{\par\vfill\supereject}
689 % outputs text on separate line in roman font, starting at standard page margin
691 % This records the amount of indent in the innermost environment.
692 % That's how much \exdent should take out.
693 \newskip\exdentamount
695 % This defn is used inside fill environments such as @defun.
696 \def\exdent{\parsearg\exdentyyy}
697 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
699 % This defn is used inside nofill environments such as @example.
700 \def\nofillexdent{\parsearg\nofillexdentyyy}
701 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
702 \leftline{\hskip\leftskip{\rm#1}}}}
704 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
705 % paragraph. For more general purposes, use the \margin insertion
706 % class. WHICH is `l' or `r'.
708 \newskip\inmarginspacing \inmarginspacing=1cm
709 \def\strutdepth{\dp\strutbox}
711 \def\doinmargin#1#2{\strut\vadjust{%
714 \vtop to \strutdepth{%
715 \baselineskip=\strutdepth
717 % if you have multiple lines of stuff to put here, you'll need to
718 % make the vbox yourself of the appropriate size.
720 \llap{\ignorespaces #2\hskip\inmarginspacing}%
722 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
727 \def\inleftmargin{\doinmargin l}
728 \def\inrightmargin{\doinmargin r}
730 % @inmargin{TEXT [, RIGHT-TEXT]}
731 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
732 % else use TEXT for both).
734 \def\inmargin#1{\parseinmargin #1,,\finish}
735 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
736 \setbox0 = \hbox{\ignorespaces #2}%
738 \def\lefttext{#1}% have both texts
741 \def\lefttext{#1}% have only one text
746 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
748 \def\temp{\inleftmargin\lefttext}%
753 % @include file insert text of that file as input.
754 % Allow normal characters that we make active in the argument (a file name).
755 \def\include{\begingroup
764 \parsearg\includezzz}
765 % Restore active chars for included file.
766 \def\includezzz#1{\endgroup\begingroup
767 % Read the included file in a group so nested @include's work.
774 % @center line outputs that line, centered
776 \def\center{\parsearg\centerzzz}
777 \def\centerzzz #1{{\advance\hsize by -\leftskip
778 \advance\hsize by -\rightskip
781 % @sp n outputs n lines of vertical space
783 \def\sp{\parsearg\spxxx}
784 \def\spxxx #1{\vskip #1\baselineskip}
786 % @comment ...line which is ignored...
787 % @c is the same as @comment
788 % @ignore ... @end ignore is another way to write a comment
790 \def\comment{\begingroup \catcode`\^^M=\other%
791 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
793 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
797 % @paragraphindent NCHARS
798 % We'll use ems for NCHARS, close enough.
799 % We cannot implement @paragraphindent asis, though.
801 \def\asisword{asis} % no translation, these are keywords
804 \def\paragraphindent{\parsearg\doparagraphindent}
805 \def\doparagraphindent#1{%
810 \defaultparindent = 0pt
812 \defaultparindent = #1em
815 \parindent = \defaultparindent
818 % @exampleindent NCHARS
819 % We'll use ems for NCHARS like @paragraphindent.
820 % It seems @exampleindent asis isn't necessary, but
821 % I preserve it to make it similar to @paragraphindent.
822 \def\exampleindent{\parsearg\doexampleindent}
823 \def\doexampleindent#1{%
830 \lispnarrowing = #1em
835 % @asis just yields its argument. Used with @table, for example.
839 % @math outputs its argument in math mode.
840 % We don't use $'s directly in the definition of \math because we need
841 % to set catcodes according to plain TeX first, to allow for subscripts,
842 % superscripts, special math chars, etc.
844 % @math does not do math typesetting in section titles, index
845 % entries, and other such contexts where the catcodes are set before
846 % @math gets a chance to work. This could perhaps be fixed, but for now
847 % at least we can have real math in the main text, where it's needed most.
849 \let\implicitmath = $%$ font-lock fix
851 % One complication: _ usually means subscripts, but it could also mean
852 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
853 % _ within @math be active (mathcode "8000), and distinguish by seeing
854 % if the current family is \slfam, which is what @var uses.
856 {\catcode95 = \active % 95 = _
857 \gdef\mathunderscore{%
859 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
862 % Another complication: we want \\ (and @\) to output a \ character.
863 % FYI, plain.tex uses \\ as a temporary control sequence (why?), but
864 % this is not advertised and we don't care. Texinfo does not
865 % otherwise define @\.
867 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
868 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
872 \mathcode`\_="8000 \mathunderscore
873 \let\\ = \mathbackslash
874 \implicitmath\finishmath}
875 \def\finishmath#1{#1\implicitmath\Etex}
877 % @bullet and @minus need the same treatment as @math, just above.
878 \def\bullet{\implicitmath\ptexbullet\implicitmath}
879 \def\minus{\implicitmath-\implicitmath}
881 % @refill is a no-op.
884 % If working on a large document in chapters, it is convenient to
885 % be able to disable indexing, cross-referencing, and contents, for test runs.
886 % This is done with @novalidate (before @setfilename).
888 \newif\iflinks \linkstrue % by default we want the aux files.
889 \let\novalidate = \linksfalse
891 % @setfilename is done at the beginning of every texinfo file.
892 % So open here the files we need to have open while reading the input.
893 % This makes it possible to make a .fmt file for texinfo.
897 \fi % \openindices needs to do some work in any case.
899 \fixbackslash % Turn off hack to swallow `\input texinfo'.
900 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
902 % If texinfo.cnf is present on the system, read it.
903 % Useful for site-wide @afourpaper, etc.
904 % Just to be on the safe side, close the input stream before the \input.
905 \openin 1 texinfo.cnf
906 \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
910 \comment % Ignore the actual filename.
913 % Called from \setfilename.
925 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
929 % adobe `portable' document format
933 \newcount\filenamelength
942 \newif\ifpdfmakepagedest
944 \ifx\pdfoutput\undefined
946 \let\pdfmkdest = \gobble
947 \let\pdfurl = \gobble
948 \let\endlink = \relax
949 \let\linkcolor = \relax
950 \let\pdfmakeoutlines = \relax
955 \def\dopdfimage#1#2#3{%
957 \def\imageheight{#3}%
958 % without \immediate, pdftex seg faults when the same image is
959 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
960 \ifnum\pdftexversion < 14
965 \ifx\empty\imagewidth\else width \imagewidth \fi
966 \ifx\empty\imageheight\else height \imageheight \fi
967 \ifnum\pdftexversion<13
972 \ifnum\pdftexversion < 14 \else
973 \pdfrefximage \pdflastximage
975 \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}}
977 \let\linkcolor = \Blue % was Cyan, but that seems light?
978 \def\endlink{\Black\pdfendlink}
979 % Adding outlines to PDF; macros for calculating structure of outlines
980 % come from Petr Olsak
981 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
982 \else \csname#1\endcsname \fi}
983 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
985 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
986 \def\pdfmakeoutlines{{%
987 \openin 1 \jobname.toc
988 \ifeof 1\else\begingroup
990 % Thanh's hack / proper braces in bookmarks
991 \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
992 \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
994 \def\chapentry ##1##2##3{}
995 \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
996 \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
997 \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
998 \let\appendixentry = \chapentry
999 \let\unnumbchapentry = \chapentry
1000 \let\unnumbsecentry = \secentry
1001 \let\unnumbsubsecentry = \subsecentry
1002 \let\unnumbsubsubsecentry = \subsubsecentry
1004 \def\chapentry ##1##2##3{%
1005 \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
1006 \def\secentry ##1##2##3##4{%
1007 \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
1008 \def\subsecentry ##1##2##3##4##5{%
1009 \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
1010 \def\subsubsecentry ##1##2##3##4##5##6{%
1011 \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
1012 \let\appendixentry = \chapentry
1013 \let\unnumbchapentry = \chapentry
1014 \let\unnumbsecentry = \secentry
1015 \let\unnumbsubsecentry = \subsecentry
1016 \let\unnumbsubsubsecentry = \subsubsecentry
1018 % Make special characters normal for writing to the pdf file.
1026 \def\makelinks #1,{%
1027 \def\params{#1}\def\E{END}%
1029 \let\nextmakelinks=\relax
1031 \let\nextmakelinks=\makelinks
1032 \ifnum\lnkcount>0,\fi
1034 \startlink attr{/Border [0 0 0]}
1035 goto name{\pdfmkpgn{\the\pgn}}%
1037 \advance\lnkcount by 1%
1042 \def\picknum#1{\expandafter\pn#1}
1053 \def\ppn#1{\pgn=#1\gobble}
1054 \def\ppnn{\pgn=\first}
1055 \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
1056 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1057 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1058 \ifx\PP\D\let\nextsp\relax
1059 \else\let\nextsp\skipspaces
1060 \ifx\p\space\else\addtokens{\filename}{\PP}%
1061 \advance\filenamelength by 1
1065 \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
1066 \ifnum\pdftexversion < 14
1067 \let \startlink \pdfannotlink
1069 \let \startlink \pdfstartlink
1073 \normalturnoffactive\def\@{@}%
1074 \let\value=\expandablevalue
1076 \startlink attr{/Border [0 0 0]}%
1077 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1080 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1081 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1082 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1083 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1085 \expandafter\poptoks\the\toksA|ENDTOKS|
1087 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1088 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1089 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1091 \ifnum0=\countA\else\makelink\fi
1092 \ifx\first.\let\next=\done\else
1094 \addtokens{\toksB}{\the\toksD}
1095 \ifx\first,\addtokens{\toksB}{\space}\fi
1097 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1099 \def\makelink{\addtokens{\toksB}%
1100 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1102 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1103 \linkcolor #1\endlink}
1104 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1105 \fi % \ifx\pdfoutput
1109 % Font-change commands.
1111 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1112 % So we set up a \sf analogous to plain's \rm, etc.
1114 \def\sf{\fam=\sffam \tensf}
1115 \let\li = \sf % Sometimes we call it \li, not \sf.
1117 % We don't need math for this one.
1121 \newdimen\textleading \textleading = 13.2pt
1123 % Set the baselineskip to #1, and the lineskip and strut size
1124 % correspondingly. There is no deep meaning behind these magic numbers
1125 % used as factors; they just match (closely enough) what Knuth defined.
1127 \def\lineskipfactor{.08333}
1128 \def\strutheightpercent{.70833}
1129 \def\strutdepthpercent {.29167}
1132 \normalbaselineskip = #1\relax
1133 \normallineskip = \lineskipfactor\normalbaselineskip
1135 \setbox\strutbox =\hbox{%
1136 \vrule width0pt height\strutheightpercent\baselineskip
1137 depth \strutdepthpercent \baselineskip
1141 % Set the font macro #1 to the font named #2, adding on the
1142 % specified font prefix (normally `cm').
1143 % #3 is the font's design size, #4 is a scale factor
1144 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1146 % Use cm as the default font prefix.
1147 % To specify the font prefix, you must define \fontprefix
1148 % before you read in texinfo.tex.
1149 \ifx\fontprefix\undefined
1152 % Support font families that don't use the same naming scheme as CM.
1154 \def\rmbshape{bx} %where the normal face is bold
1159 \def\ttslshape{sltt}
1169 \newcount\mainmagstep
1171 % not really supported.
1172 \mainmagstep=\magstep1
1173 \setfont\textrm\rmshape{12}{1000}
1174 \setfont\texttt\ttshape{12}{1000}
1176 \mainmagstep=\magstephalf
1177 \setfont\textrm\rmshape{10}{\mainmagstep}
1178 \setfont\texttt\ttshape{10}{\mainmagstep}
1180 % Instead of cmb10, you many want to use cmbx10.
1181 % cmbx10 is a prettier font on its own, but cmb10
1182 % looks better when embedded in a line with cmr10.
1183 \setfont\textbf\bfshape{10}{\mainmagstep}
1184 \setfont\textit\itshape{10}{\mainmagstep}
1185 \setfont\textsl\slshape{10}{\mainmagstep}
1186 \setfont\textsf\sfshape{10}{\mainmagstep}
1187 \setfont\textsc\scshape{10}{\mainmagstep}
1188 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1189 \font\texti=cmmi10 scaled \mainmagstep
1190 \font\textsy=cmsy10 scaled \mainmagstep
1192 % A few fonts for @defun, etc.
1193 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1194 \setfont\deftt\ttshape{10}{\magstep1}
1195 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1197 % Fonts for indices, footnotes, small examples (9pt).
1198 \setfont\smallrm\rmshape{9}{1000}
1199 \setfont\smalltt\ttshape{9}{1000}
1200 \setfont\smallbf\bfshape{10}{900}
1201 \setfont\smallit\itshape{9}{1000}
1202 \setfont\smallsl\slshape{9}{1000}
1203 \setfont\smallsf\sfshape{9}{1000}
1204 \setfont\smallsc\scshape{10}{900}
1205 \setfont\smallttsl\ttslshape{10}{900}
1209 % Fonts for small examples (8pt).
1210 \setfont\smallerrm\rmshape{8}{1000}
1211 \setfont\smallertt\ttshape{8}{1000}
1212 \setfont\smallerbf\bfshape{10}{800}
1213 \setfont\smallerit\itshape{8}{1000}
1214 \setfont\smallersl\slshape{8}{1000}
1215 \setfont\smallersf\sfshape{8}{1000}
1216 \setfont\smallersc\scshape{10}{800}
1217 \setfont\smallerttsl\ttslshape{10}{800}
1218 \font\smalleri=cmmi8
1219 \font\smallersy=cmsy8
1221 % Fonts for title page:
1222 \setfont\titlerm\rmbshape{12}{\magstep3}
1223 \setfont\titleit\itbshape{10}{\magstep4}
1224 \setfont\titlesl\slbshape{10}{\magstep4}
1225 \setfont\titlett\ttbshape{12}{\magstep3}
1226 \setfont\titlettsl\ttslshape{10}{\magstep4}
1227 \setfont\titlesf\sfbshape{17}{\magstep1}
1228 \let\titlebf=\titlerm
1229 \setfont\titlesc\scbshape{10}{\magstep4}
1230 \font\titlei=cmmi12 scaled \magstep3
1231 \font\titlesy=cmsy10 scaled \magstep4
1232 \def\authorrm{\secrm}
1233 \def\authortt{\sectt}
1235 % Chapter (and unnumbered) fonts (17.28pt).
1236 \setfont\chaprm\rmbshape{12}{\magstep2}
1237 \setfont\chapit\itbshape{10}{\magstep3}
1238 \setfont\chapsl\slbshape{10}{\magstep3}
1239 \setfont\chaptt\ttbshape{12}{\magstep2}
1240 \setfont\chapttsl\ttslshape{10}{\magstep3}
1241 \setfont\chapsf\sfbshape{17}{1000}
1243 \setfont\chapsc\scbshape{10}{\magstep3}
1244 \font\chapi=cmmi12 scaled \magstep2
1245 \font\chapsy=cmsy10 scaled \magstep3
1247 % Section fonts (14.4pt).
1248 \setfont\secrm\rmbshape{12}{\magstep1}
1249 \setfont\secit\itbshape{10}{\magstep2}
1250 \setfont\secsl\slbshape{10}{\magstep2}
1251 \setfont\sectt\ttbshape{12}{\magstep1}
1252 \setfont\secttsl\ttslshape{10}{\magstep2}
1253 \setfont\secsf\sfbshape{12}{\magstep1}
1255 \setfont\secsc\scbshape{10}{\magstep2}
1256 \font\seci=cmmi12 scaled \magstep1
1257 \font\secsy=cmsy10 scaled \magstep2
1259 % Subsection fonts (13.15pt).
1260 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1261 \setfont\ssecit\itbshape{10}{1315}
1262 \setfont\ssecsl\slbshape{10}{1315}
1263 \setfont\ssectt\ttbshape{12}{\magstephalf}
1264 \setfont\ssecttsl\ttslshape{10}{1315}
1265 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1267 \setfont\ssecsc\scbshape{10}{\magstep1}
1268 \font\sseci=cmmi12 scaled \magstephalf
1269 \font\ssecsy=cmsy10 scaled 1315
1270 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1271 % but that is not a standard magnification.
1273 % In order for the font changes to affect most math symbols and letters,
1274 % we have to define the \textfont of the standard families. Since
1275 % texinfo doesn't allow for producing subscripts and superscripts except
1276 % in the main text, we don't bother to reset \scriptfont and
1277 % \scriptscriptfont (which would also require loading a lot more fonts).
1279 \def\resetmathfonts{%
1280 \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
1281 \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
1282 \textfont\ttfam=\tentt \textfont\sffam=\tensf
1285 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1286 % of just \STYLE. We do this so that font changes will continue to work
1287 % in math mode, where it is the current \fam that is relevant in most
1288 % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
1289 % \tenbf}, for example. By redefining \tenbf, we obviate the need to
1290 % redefine \bf itself.
1292 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1293 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1294 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1295 \resetmathfonts \setleading{\textleading}}
1297 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
1298 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
1299 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
1300 \let\tenttsl=\titlettsl
1301 \resetmathfonts \setleading{25pt}}
1302 \def\titlefont#1{{\titlefonts\rm #1}}
1304 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1305 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1306 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1307 \resetmathfonts \setleading{19pt}}
1309 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1310 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1311 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1312 \resetmathfonts \setleading{16pt}}
1314 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1315 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1316 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1317 \resetmathfonts \setleading{15pt}}
1318 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1320 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
1321 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
1322 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
1323 \let\tenttsl=\smallttsl
1324 \resetmathfonts \setleading{10.5pt}}
1326 \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
1327 \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
1328 \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
1329 \let\tenttsl=\smallerttsl
1330 \resetmathfonts \setleading{9.5pt}}
1331 \let\smallexamplefonts = \smallerfonts
1333 % Set up the default fonts, so we can use them for creating boxes.
1337 % Define these so they can be easily changed for other fonts.
1338 \def\angleleft{$\langle$}
1339 \def\angleright{$\rangle$}
1341 % Count depth in font-changes, for error checks
1342 \newcount\fontdepth \fontdepth=0
1344 % Fonts for short table of contents.
1345 \setfont\shortcontrm\rmshape{12}{1000}
1346 \setfont\shortcontbf\bxshape{12}{1000}
1347 \setfont\shortcontsl\slshape{12}{1000}
1348 \setfont\shortconttt\ttshape{12}{1000}
1350 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1351 %% serif) and @ii for TeX italic
1353 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1354 % unless the following character is such as not to need one.
1355 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1356 \def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
1357 \def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
1360 \let\var=\smartslanted
1361 \let\dfn=\smartslanted
1362 \let\emph=\smartitalic
1363 \let\cite=\smartslanted
1368 % We can't just use \exhyphenpenalty, because that only has effect at
1369 % the end of a paragraph. Restore normal hyphenation at the end of the
1370 % group within which \nohyphenation is presumably called.
1372 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1373 \def\restorehyphenation{\hyphenchar\font = `- }
1376 {\tt \rawbackslash \frenchspacing #1}%
1380 \def\samp#1{`\tclose{#1}'\null}
1381 \setfont\keyrm\rmshape{8}{1000}
1383 \def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
1384 \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
1385 \vbox{\hrule\kern-0.4pt
1386 \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
1388 \kern-.06em\raise0.4pt\hbox{\angleright}}}}
1389 % The old definition, with no lozenge:
1390 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1391 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1393 % @file, @option are the same as @samp.
1397 % @code is a modification of @t,
1398 % which makes spaces the same size as normal in the surrounding text.
1401 % Change normal interword space to be same as for the current font.
1402 \spaceskip = \fontdimen2\font
1404 % Switch to typewriter.
1407 % But `\ ' produces the large typewriter interword space.
1408 \def\ {{\spaceskip = 0pt{} }}%
1410 % Turn off hyphenation.
1420 % We *must* turn on hyphenation at `-' and `_' in \code.
1421 % Otherwise, it is too hard to avoid overfull hboxes
1422 % in the Emacs manual, the Library manual, etc.
1424 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1425 % both hyphenation at - and hyphenation within words.
1426 % We must therefore turn them both off (\tclose does that)
1427 % and arrange explicitly to hyphenate at a dash.
1433 \global\def\code{\begingroup
1434 \catcode`\-=\active \let-\codedash
1435 \catcode`\_=\active \let_\codeunder
1439 % If we end up with any active - characters when handling the index,
1440 % just treat them as a normal -.
1441 \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
1445 \def\codedash{-\discretionary{}{}{}}
1447 % this is all so @math{@code{var_name}+1} can work. In math mode, _
1448 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
1449 % will therefore expand the active definition of _, which is us
1450 % (inside @code that is), therefore an endless loop.
1452 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
1453 \else\normalunderscore \fi
1454 \discretionary{}{}{}}%
1457 \def\codex #1{\tclose{#1}\endgroup}
1459 % @kbd is like @code, except that if the argument is just one @key command,
1460 % then @kbd has no effect.
1462 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
1463 % `example' (@kbd uses ttsl only inside of @example and friends),
1464 % or `code' (@kbd uses normal tty font always).
1465 \def\kbdinputstyle{\parsearg\kbdinputstylexxx}
1466 \def\kbdinputstylexxx#1{%
1468 \ifx\arg\worddistinct
1469 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
1470 \else\ifx\arg\wordexample
1471 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
1472 \else\ifx\arg\wordcode
1473 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
1476 \def\worddistinct{distinct}
1477 \def\wordexample{example}
1480 % Default is kbdinputdistinct. (Too much of a hassle to call the macro,
1481 % the catcodes are wrong for parsearg to work.)
1482 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
1485 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1486 \ifx\one\xkey\ifx\threex\three \key{#2}%
1487 \else{\tclose{\kbdfont\look}}\fi
1488 \else{\tclose{\kbdfont\look}}\fi}
1490 % For @url, @env, @command quotes seem unnecessary, so use \code.
1495 % @uref (abbreviation for `urlref') takes an optional (comma-separated)
1496 % second argument specifying the text to display and an optional third
1497 % arg as text to display instead of (rather than in addition to) the url
1498 % itself. First (mandatory) arg is the url. Perhaps eventually put in
1499 % a hypertex \special here.
1501 \def\uref#1{\douref #1,,,\finish}
1502 \def\douref#1,#2,#3,#4\finish{\begingroup
1505 \setbox0 = \hbox{\ignorespaces #3}%
1507 \unhbox0 % third arg given, show only that
1509 \setbox0 = \hbox{\ignorespaces #2}%
1512 \unhbox0 % PDF: 2nd arg given, show only it
1514 \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
1517 \code{#1}% only url given, so show it
1523 % rms does not like angle brackets --karl, 17may97.
1524 % So now @email is just like @uref, unless we are pdf.
1526 %\def\email#1{\angleleft{\tt #1}\angleright}
1528 \def\email#1{\doemail#1,,\finish}
1529 \def\doemail#1,#2,#3\finish{\begingroup
1532 \setbox0 = \hbox{\ignorespaces #2}%
1533 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
1540 % Check if we are currently using a typewriter font. Since all the
1541 % Computer Modern typewriter fonts have zero interword stretch (and
1542 % shrink), and it is reasonable to expect all typewriter fonts to have
1543 % this property, we can check that font parameter.
1545 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1547 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1548 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
1550 \def\dmn#1{\thinspace #1}
1552 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1554 % @l was never documented to mean ``switch to the Lisp font'',
1555 % and it is not used as such in any manual I can find. We need it for
1556 % Polish suppressed-l. --karl, 22sep96.
1557 %\def\l#1{{\li #1}\null}
1559 % Explicit font changes: @r, @sc, undocumented @ii.
1560 \def\r#1{{\rm #1}} % roman font
1561 \def\sc#1{{\smallcaps#1}} % smallcaps font
1562 \def\ii#1{{\it #1}} % italic font
1564 % @acronym downcases the argument and prints in smallcaps.
1565 \def\acronym#1{{\smallcaps \lowercase{#1}}}
1567 % @pounds{} is a sterling sign.
1568 \def\pounds{{\it\$}}
1571 \message{page headings,}
1573 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1574 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1576 % First the title page. Must do @settitle before @titlepage.
1578 \newif\iffinishedtitlepage
1580 % Do an implicit @contents or @shortcontents after @end titlepage if the
1581 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
1583 \newif\ifsetcontentsaftertitlepage
1584 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
1585 \newif\ifsetshortcontentsaftertitlepage
1586 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
1588 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1589 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1590 \endgroup\page\hbox{}\page}
1592 \def\titlepage{\begingroup \parindent=0pt \textfonts
1593 \let\subtitlerm=\tenrm
1594 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1596 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
1599 % Leave some space at the very top of the page.
1600 \vglue\titlepagetopglue
1602 % Now you can print the title using @title.
1603 \def\title{\parsearg\titlezzz}%
1604 \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
1605 % print a rule at the page bottom also.
1606 \finishedtitlepagefalse
1607 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1608 % No rule at page bottom unless we print one at the top with @title.
1609 \finishedtitlepagetrue
1611 % Now you can put text using @subtitle.
1612 \def\subtitle{\parsearg\subtitlezzz}%
1613 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1615 % @author should come last, but may come many times.
1616 \def\author{\parsearg\authorzzz}%
1617 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1618 {\authorfont \leftline{##1}}}%
1620 % Most title ``pages'' are actually two pages long, with space
1621 % at the top of the second. We don't want the ragged left on the second.
1622 \let\oldpage = \page
1624 \iffinishedtitlepage\else
1628 \let\page = \oldpage
1630 % \def\page{\oldpage \hbox{}}
1634 \iffinishedtitlepage\else
1637 % It is important to do the page break before ending the group,
1638 % because the headline and footline are only empty inside the group.
1639 % If we use the new definition of \page, we always get a blank page
1640 % after the title page, which we certainly don't want.
1644 % Need this before the \...aftertitlepage checks so that if they are
1645 % in effect the toc pages will come out with page numbers.
1648 % If they want short, they certainly want long too.
1649 \ifsetshortcontentsaftertitlepage
1652 \global\let\shortcontents = \relax
1653 \global\let\contents = \relax
1656 \ifsetcontentsaftertitlepage
1658 \global\let\contents = \relax
1659 \global\let\shortcontents = \relax
1663 \def\finishtitlepage{%
1664 \vskip4pt \hrule height 2pt width \hsize
1665 \vskip\titlepagebottomglue
1666 \finishedtitlepagetrue
1669 %%% Set up page headings and footings.
1671 \let\thispage=\folio
1673 \newtoks\evenheadline % headline on even pages
1674 \newtoks\oddheadline % headline on odd pages
1675 \newtoks\evenfootline % footline on even pages
1676 \newtoks\oddfootline % footline on odd pages
1678 % Now make Tex use those variables
1679 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1680 \else \the\evenheadline \fi}}
1681 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1682 \else \the\evenfootline \fi}\HEADINGShook}
1683 \let\HEADINGShook=\relax
1685 % Commands to set those variables.
1686 % For example, this is what @headings on does
1687 % @evenheading @thistitle|@thispage|@thischapter
1688 % @oddheading @thischapter|@thispage|@thistitle
1689 % @evenfooting @thisfile||
1690 % @oddfooting ||@thisfile
1692 \def\evenheading{\parsearg\evenheadingxxx}
1693 \def\oddheading{\parsearg\oddheadingxxx}
1694 \def\everyheading{\parsearg\everyheadingxxx}
1696 \def\evenfooting{\parsearg\evenfootingxxx}
1697 \def\oddfooting{\parsearg\oddfootingxxx}
1698 \def\everyfooting{\parsearg\everyfootingxxx}
1702 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1703 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1704 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1706 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1707 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1708 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1710 \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
1712 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1713 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1714 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1716 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1717 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1718 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
1720 % Leave some space for the footline. Hopefully ok to assume
1721 % @evenfooting will not be used by itself.
1722 \global\advance\pageheight by -\baselineskip
1723 \global\advance\vsize by -\baselineskip
1726 \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
1728 }% unbind the catcode of @.
1730 % @headings double turns headings on for double-sided printing.
1731 % @headings single turns headings on for single-sided printing.
1732 % @headings off turns them off.
1733 % @headings on same as @headings double, retained for compatibility.
1734 % @headings after turns on double-sided headings after this page.
1735 % @headings doubleafter turns on double-sided headings after this page.
1736 % @headings singleafter turns on single-sided headings after this page.
1737 % By default, they are off at the start of a document,
1738 % and turned `on' after @end titlepage.
1740 \def\headings #1 {\csname HEADINGS#1\endcsname}
1743 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1744 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1746 % When we turn headings on, set the page number to 1.
1747 % For double-sided printing, put current file name in lower left corner,
1748 % chapter name on inside top of right hand pages, document
1749 % title on inside top of left hand pages, and page numbers on outside top
1750 % edge of all pages.
1751 \def\HEADINGSdouble{
1753 \global\evenfootline={\hfil}
1754 \global\oddfootline={\hfil}
1755 \global\evenheadline={\line{\folio\hfil\thistitle}}
1756 \global\oddheadline={\line{\thischapter\hfil\folio}}
1757 \global\let\contentsalignmacro = \chapoddpage
1759 \let\contentsalignmacro = \chappager
1761 % For single-sided printing, chapter title goes across top left of page,
1762 % page number on top right.
1763 \def\HEADINGSsingle{
1765 \global\evenfootline={\hfil}
1766 \global\oddfootline={\hfil}
1767 \global\evenheadline={\line{\thischapter\hfil\folio}}
1768 \global\oddheadline={\line{\thischapter\hfil\folio}}
1769 \global\let\contentsalignmacro = \chappager
1771 \def\HEADINGSon{\HEADINGSdouble}
1773 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1774 \let\HEADINGSdoubleafter=\HEADINGSafter
1775 \def\HEADINGSdoublex{%
1776 \global\evenfootline={\hfil}
1777 \global\oddfootline={\hfil}
1778 \global\evenheadline={\line{\folio\hfil\thistitle}}
1779 \global\oddheadline={\line{\thischapter\hfil\folio}}
1780 \global\let\contentsalignmacro = \chapoddpage
1783 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1784 \def\HEADINGSsinglex{%
1785 \global\evenfootline={\hfil}
1786 \global\oddfootline={\hfil}
1787 \global\evenheadline={\line{\thischapter\hfil\folio}}
1788 \global\oddheadline={\line{\thischapter\hfil\folio}}
1789 \global\let\contentsalignmacro = \chappager
1792 % Subroutines used in generating headings
1793 % This produces Day Month Year style of output.
1794 % Only define if not already defined, in case a txi-??.tex file has set
1795 % up a different format (e.g., txi-cs.tex does this).
1796 \ifx\today\undefined
1800 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
1801 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
1802 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
1807 % @settitle line... specifies the title of the document, for headings.
1808 % It generates no output of its own.
1809 \def\thistitle{\putwordNoTitle}
1810 \def\settitle{\parsearg\settitlezzz}
1811 \def\settitlezzz #1{\gdef\thistitle{#1}}
1815 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1817 % default indentation of table text
1818 \newdimen\tableindent \tableindent=.8in
1819 % default indentation of @itemize and @enumerate text
1820 \newdimen\itemindent \itemindent=.3in
1821 % margin between end of table item and start of table text.
1822 \newdimen\itemmargin \itemmargin=.1in
1824 % used internally for \itemindent minus \itemmargin
1827 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1829 % They also define \itemindex
1830 % to index the item name in whatever manner is desired (perhaps none).
1832 \newif\ifitemxneedsnegativevskip
1834 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1836 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1837 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1839 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1840 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1842 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1843 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1845 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1848 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1851 \def\itemzzz #1{\begingroup %
1852 \advance\hsize by -\rightskip
1853 \advance\hsize by -\tableindent
1854 \setbox0=\hbox{\itemfont{#1}}%
1856 \nobreak % This prevents a break before @itemx.
1858 % If the item text does not fit in the space we have, put it on a line
1859 % by itself, and do not allow a page break either before or after that
1860 % line. We do not start a paragraph here because then if the next
1861 % command is, e.g., @kindex, the whatsit would get put into the
1862 % horizontal list on a line by itself, resulting in extra blank space.
1863 \ifdim \wd0>\itemmax
1865 % Make this a paragraph so we get the \parskip glue and wrapping,
1866 % but leave it ragged-right.
1868 \advance\leftskip by-\tableindent
1869 \advance\hsize by\tableindent
1870 \advance\rightskip by0pt plus1fil
1871 \leavevmode\unhbox0\par
1874 % We're going to be starting a paragraph, but we don't want the
1875 % \parskip glue -- logically it's part of the @item we just started.
1876 \nobreak \vskip-\parskip
1878 % Stop a page break at the \parskip glue coming up. Unfortunately
1879 % we can't prevent a possible page break at the following
1880 % \baselineskip glue.
1883 \itemxneedsnegativevskipfalse
1885 % The item text fits into the space. Start a paragraph, so that the
1886 % following text (if any) will end up on the same line.
1888 % Do this with kerns and \unhbox so that if there is a footnote in
1889 % the item text, it can migrate to the main vertical list and
1890 % eventually be printed.
1891 \nobreak\kern-\tableindent
1892 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
1894 \nobreak\kern\dimen0
1896 \itemxneedsnegativevskiptrue
1900 \def\item{\errmessage{@item while not in a table}}
1901 \def\itemx{\errmessage{@itemx while not in a table}}
1902 \def\kitem{\errmessage{@kitem while not in a table}}
1903 \def\kitemx{\errmessage{@kitemx while not in a table}}
1904 \def\xitem{\errmessage{@xitem while not in a table}}
1905 \def\xitemx{\errmessage{@xitemx while not in a table}}
1907 % Contains a kludge to get @end[description] to work.
1908 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1910 % @table, @ftable, @vtable.
1911 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1912 {\obeylines\obeyspaces%
1913 \gdef\tablex #1^^M{%
1914 \tabley\dontindex#1 \endtabley}}
1916 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1917 {\obeylines\obeyspaces%
1918 \gdef\ftablex #1^^M{%
1919 \tabley\fnitemindex#1 \endtabley
1920 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1921 \let\Etable=\relax}}
1923 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1924 {\obeylines\obeyspaces%
1925 \gdef\vtablex #1^^M{%
1926 \tabley\vritemindex#1 \endtabley
1927 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1928 \let\Etable=\relax}}
1931 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1932 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1935 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1936 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1938 \def\tablez #1#2#3#4#5#6{%
1941 \def\Edescription{\Etable}% Necessary kludge.
1943 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1944 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1945 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1947 \itemmax=\tableindent %
1948 \advance \itemmax by -\itemmargin %
1949 \advance \leftskip by \tableindent %
1950 \exdentamount=\tableindent
1952 \parskip = \smallskipamount
1953 \ifdim \parskip=0pt \parskip=2pt \fi%
1954 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1955 \let\item = \internalBitem %
1956 \let\itemx = \internalBitemx %
1957 \let\kitem = \internalBkitem %
1958 \let\kitemx = \internalBkitemx %
1959 \let\xitem = \internalBxitem %
1960 \let\xitemx = \internalBxitemx %
1963 % This is the counter used by @enumerate, which is really @itemize
1967 \def\itemize{\parsearg\itemizezzz}
1969 \def\itemizezzz #1{%
1970 \begingroup % ended by the @end itemize
1971 \itemizey {#1}{\Eitemize}
1974 \def\itemizey #1#2{%
1976 \itemmax=\itemindent %
1977 \advance \itemmax by -\itemmargin %
1978 \advance \leftskip by \itemindent %
1979 \exdentamount=\itemindent
1981 \parskip = \smallskipamount %
1982 \ifdim \parskip=0pt \parskip=2pt \fi%
1983 \def#2{\endgraf\afterenvbreak\endgroup}%
1984 \def\itemcontents{#1}%
1985 \let\item=\itemizeitem}
1987 % Set sfcode to normal for the chars that usually have another value.
1988 % These are `.?!:;,'
1989 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1990 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1992 % \splitoff TOKENS\endmark defines \first to be the first token in
1993 % TOKENS, and \rest to be the remainder.
1995 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1997 % Allow an optional argument of an uppercase letter, lowercase letter,
1998 % or number, to specify the first label in the enumerated list. No
1999 % argument is the same as `1'.
2001 \def\enumerate{\parsearg\enumeratezzz}
2002 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
2003 \def\enumeratey #1 #2\endenumeratey{%
2004 \begingroup % ended by the @end enumerate
2006 % If we were given no argument, pretend we were given `1'.
2008 \ifx\thearg\empty \def\thearg{1}\fi
2010 % Detect if the argument is a single token. If so, it might be a
2011 % letter. Otherwise, the only valid thing it can be is a number.
2012 % (We will always have one token, because of the test we just made.
2013 % This is a good thing, since \splitoff doesn't work given nothing at
2014 % all -- the first parameter is undelimited.)
2015 \expandafter\splitoff\thearg\endmark
2017 % Only one token in the argument. It could still be anything.
2018 % A ``lowercase letter'' is one whose \lccode is nonzero.
2019 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
2020 % not equal to itself.
2021 % Otherwise, we assume it's a number.
2023 % We need the \relax at the end of the \ifnum lines to stop TeX from
2024 % continuing to look for a <number>.
2026 \ifnum\lccode\expandafter`\thearg=0\relax
2027 \numericenumerate % a number (we hope)
2030 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
2031 \lowercaseenumerate % lowercase letter
2033 \uppercaseenumerate % uppercase letter
2037 % Multiple tokens in the argument. We hope it's a number.
2042 % An @enumerate whose labels are integers. The starting integer is
2045 \def\numericenumerate{%
2047 \startenumeration{\the\itemno}%
2050 % The starting (lowercase) letter is in \thearg.
2051 \def\lowercaseenumerate{%
2052 \itemno = \expandafter`\thearg
2054 % Be sure we're not beyond the end of the alphabet.
2056 \errmessage{No more lowercase letters in @enumerate; get a bigger
2063 % The starting (uppercase) letter is in \thearg.
2064 \def\uppercaseenumerate{%
2065 \itemno = \expandafter`\thearg
2067 % Be sure we're not beyond the end of the alphabet.
2069 \errmessage{No more uppercase letters in @enumerate; get a bigger
2076 % Call itemizey, adding a period to the first argument and supplying the
2077 % common last two arguments. Also subtract one from the initial value in
2078 % \itemno, since @item increments \itemno.
2080 \def\startenumeration#1{%
2081 \advance\itemno by -1
2082 \itemizey{#1.}\Eenumerate\flushcr
2085 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
2088 \def\alphaenumerate{\enumerate{a}}
2089 \def\capsenumerate{\enumerate{A}}
2090 \def\Ealphaenumerate{\Eenumerate}
2091 \def\Ecapsenumerate{\Eenumerate}
2093 % Definition of @item while inside @itemize.
2096 \advance\itemno by 1
2097 {\let\par=\endgraf \smallbreak}%
2098 \ifhmode \errmessage{In hmode at itemizeitem}\fi
2099 {\parskip=0in \hskip 0pt
2100 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
2101 \vadjust{\penalty 1200}}%
2104 % @multitable macros
2105 % Amy Hendrickson, 8/18/94, 3/6/96
2107 % @multitable ... @end multitable will make as many columns as desired.
2108 % Contents of each column will wrap at width given in preamble. Width
2109 % can be specified either with sample text given in a template line,
2110 % or in percent of \hsize, the current width of text on page.
2112 % Table can continue over pages but will only break between lines.
2116 % Either define widths of columns in terms of percent of \hsize:
2117 % @multitable @columnfractions .25 .3 .45
2120 % Numbers following @columnfractions are the percent of the total
2121 % current hsize to be used for each column. You may use as many
2122 % columns as desired.
2125 % Or use a template:
2126 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2128 % using the widest term desired in each column.
2130 % For those who want to use more than one line's worth of words in
2131 % the preamble, break the line within one argument and it
2132 % will parse correctly, i.e.,
2134 % @multitable {Column 1 template} {Column 2 template} {Column 3
2137 % @multitable {Column 1 template} {Column 2 template}
2138 % {Column 3 template}
2140 % Each new table line starts with @item, each subsequent new column
2141 % starts with @tab. Empty columns may be produced by supplying @tab's
2142 % with nothing between them for as many times as empty columns are needed,
2143 % ie, @tab@tab@tab will produce two empty columns.
2145 % @item, @tab, @multitable or @end multitable do not need to be on their
2146 % own lines, but it will not hurt if they are.
2148 % Sample multitable:
2150 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2151 % @item first col stuff @tab second col stuff @tab third col
2158 % @item first col stuff @tab second col stuff
2159 % @tab Many paragraphs of text may be used in any column.
2161 % They will wrap at the width determined by the template.
2162 % @item@tab@tab This will be in third column.
2165 % Default dimensions may be reset by user.
2166 % @multitableparskip is vertical space between paragraphs in table.
2167 % @multitableparindent is paragraph indent in table.
2168 % @multitablecolmargin is horizontal space to be left between columns.
2169 % @multitablelinespace is space to leave between table items, baseline
2171 % 0pt means it depends on current normal line spacing.
2173 \newskip\multitableparskip
2174 \newskip\multitableparindent
2175 \newdimen\multitablecolspace
2176 \newskip\multitablelinespace
2177 \multitableparskip=0pt
2178 \multitableparindent=6pt
2179 \multitablecolspace=12pt
2180 \multitablelinespace=0pt
2182 % Macros used to set up halign preamble:
2184 \let\endsetuptable\relax
2185 \def\xendsetuptable{\endsetuptable}
2186 \let\columnfractions\relax
2187 \def\xcolumnfractions{\columnfractions}
2190 % #1 is the part of the @columnfraction before the decimal point, which
2191 % is presumably either 0 or the empty string (but we don't check, we
2192 % just throw it away). #2 is the decimal part, which we use as the
2193 % percent of \hsize for this column.
2194 \def\pickupwholefraction#1.#2 {%
2195 \global\advance\colcount by 1
2196 \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
2203 \ifx\firstarg\xendsetuptable
2206 \ifx\firstarg\xcolumnfractions
2207 \global\setpercenttrue
2210 \let\go\pickupwholefraction
2212 \global\advance\colcount by 1
2213 \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator;
2214 % typically that is always in the input, anyway.
2215 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2218 \ifx\go\pickupwholefraction
2219 % Put the argument back for the \pickupwholefraction call, so
2220 % we'll always have a period there to be parsed.
2221 \def\go{\pickupwholefraction#1}%
2223 \let\go = \setuptable
2229 % This used to have \hskip1sp. But then the space in a template line is
2230 % not enough. That is bad. So let's go back to just & until we
2231 % encounter the problem it was intended to solve again.
2232 % --karl, nathan@acm.org, 20apr99.
2235 % @multitable ... @end multitable definitions:
2237 \def\multitable{\parsearg\dotable}
2238 \def\dotable#1{\bgroup
2243 \setmultitablespacing
2244 \parskip=\multitableparskip
2245 \parindent=\multitableparindent
2248 \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
2250 % To parse everything between @multitable and @item:
2251 \setuptable#1 \endsetuptable
2253 % \everycr will reset column counter, \colcount, at the end of
2254 % each line. Every column entry will cause \colcount to advance by one.
2255 % The table preamble
2256 % looks at the current \colcount to find the correct column width.
2259 % \filbreak%% keeps underfull box messages off when table breaks over pages.
2260 % Maybe so, but it also creates really weird page breaks when the table
2261 % breaks over pages. Wouldn't \vfil be better? Wait until the problem
2262 % manifests itself, so it can be fixed for real --karl.
2263 \global\colcount=0\relax}}%
2265 % This preamble sets up a generic column definition, which will
2266 % be used as many times as user calls for columns.
2267 % \vtop will set a single line and will also let text wrap and
2268 % continue for many paragraphs if desired.
2269 \halign\bgroup&\global\advance\colcount by 1\relax
2270 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2272 % In order to keep entries from bumping into each other
2273 % we will add a \leftskip of \multitablecolspace to all columns after
2276 % If a template has been used, we will add \multitablecolspace
2277 % to the width of each template entry.
2279 % If the user has set preamble in terms of percent of \hsize we will
2280 % use that dimension as the width of the column, and the \leftskip
2281 % will keep entries from bumping into each other. Table will start at
2282 % left margin and final column will justify at right margin.
2284 % Make sure we don't inherit \rightskip from the outer environment.
2287 % The first column will be indented with the surrounding text.
2288 \advance\hsize by\leftskip
2291 % If user has not set preamble in terms of percent of \hsize
2292 % we will advance \hsize by \multitablecolspace.
2293 \advance\hsize by \multitablecolspace
2295 % In either case we will make \leftskip=\multitablecolspace:
2296 \leftskip=\multitablecolspace
2298 % Ignoring space at the beginning and end avoids an occasional spurious
2299 % blank line, when TeX decides to break the line at the space before the
2300 % box from the multistrut, so the strut ends up on a line by itself.
2302 % @multitable @columnfractions .11 .89
2304 % @tab Legal holiday which is valid in major parts of the whole country.
2305 % Is automatically provided with highlighting sequences respectively marking
2307 \noindent\ignorespaces##\unskip\multistrut}\cr
2310 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2311 % If so, do nothing. If not, give it an appropriate dimension based on
2312 % current baselineskip.
2313 \ifdim\multitablelinespace=0pt
2314 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
2315 \global\advance\multitablelinespace by-\ht0
2316 %% strut to put in table in case some entry doesn't have descenders,
2317 %% to keep lines equally spaced
2318 \let\multistrut = \strut
2320 %% FIXME: what is \box0 supposed to be?
2321 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2323 %% Test to see if parskip is larger than space between lines of
2324 %% table. If not, do nothing.
2325 %% If so, set to same dimension as multitablelinespace.
2326 \ifdim\multitableparskip>\multitablelinespace
2327 \global\multitableparskip=\multitablelinespace
2328 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2329 %% than skip between lines in the table.
2331 \ifdim\multitableparskip=0pt
2332 \global\multitableparskip=\multitablelinespace
2333 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2334 %% than skip between lines in the table.
2338 \message{conditionals,}
2339 % Prevent errors for section commands.
2340 % Used in @ignore and in failing conditionals.
2341 \def\ignoresections{%
2343 \let\unnumbered=\relax
2345 \let\unnumberedsec=\relax
2346 \let\unnumberedsection=\relax
2347 \let\unnumberedsubsec=\relax
2348 \let\unnumberedsubsection=\relax
2349 \let\unnumberedsubsubsec=\relax
2350 \let\unnumberedsubsubsection=\relax
2353 \let\subsubsec=\relax
2354 \let\subsection=\relax
2355 \let\subsubsection=\relax
2356 \let\appendix=\relax
2357 \let\appendixsec=\relax
2358 \let\appendixsection=\relax
2359 \let\appendixsubsec=\relax
2360 \let\appendixsubsection=\relax
2361 \let\appendixsubsubsec=\relax
2362 \let\appendixsubsubsection=\relax
2363 \let\contents=\relax
2364 \let\smallbook=\relax
2365 \let\titlepage=\relax
2368 % Used in nested conditionals, where we have to parse the Texinfo source
2369 % and so want to turn off most commands, in case they are used
2372 \def\ignoremorecommands{%
2373 \let\defcodeindex = \relax
2376 \let\deffnx = \relax
2377 \let\defindex = \relax
2378 \let\defivar = \relax
2379 \let\defmac = \relax
2380 \let\defmethod = \relax
2382 \let\defopt = \relax
2383 \let\defspec = \relax
2385 \let\deftypefn = \relax
2386 \let\deftypefun = \relax
2387 \let\deftypeivar = \relax
2388 \let\deftypeop = \relax
2389 \let\deftypevar = \relax
2390 \let\deftypevr = \relax
2392 \let\defvar = \relax
2396 \let\printindex = \relax
2398 \let\settitle = \relax
2399 \let\setchapternewpage = \relax
2400 \let\setchapterstyle = \relax
2401 \let\everyheading = \relax
2402 \let\evenheading = \relax
2403 \let\oddheading = \relax
2404 \let\everyfooting = \relax
2405 \let\evenfooting = \relax
2406 \let\oddfooting = \relax
2407 \let\headings = \relax
2408 \let\include = \relax
2409 \let\lowersections = \relax
2411 \let\raisesections = \relax
2418 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
2420 \def\direntry{\doignore{direntry}}
2421 \def\documentdescriptionword{documentdescription}
2422 \def\documentdescription{\doignore{documentdescription}}
2423 \def\html{\doignore{html}}
2424 \def\ifhtml{\doignore{ifhtml}}
2425 \def\ifinfo{\doignore{ifinfo}}
2426 \def\ifnottex{\doignore{ifnottex}}
2427 \def\ifplaintext{\doignore{ifplaintext}}
2428 \def\ifxml{\doignore{ifxml}}
2429 \def\ignore{\doignore{ignore}}
2430 \def\menu{\doignore{menu}}
2431 \def\xml{\doignore{xml}}
2433 % @dircategory CATEGORY -- specify a category of the dir file
2434 % which this file should belong to. Ignore this in TeX.
2435 \let\dircategory = \comment
2437 % Ignore text until a line `@end #1'.
2439 \def\doignore#1{\begingroup
2440 % Don't complain about control sequences we have declared \outer.
2443 % Define a command to swallow text until we reach `@end #1'.
2444 % This @ is a catcode 12 token (that is the normal catcode of @ in
2445 % this texinfo.tex file). We change the catcode of @ below to match.
2446 \long\def\doignoretext##1@end #1{\enddoignore}%
2448 % Make sure that spaces turn into tokens that match what \doignoretext wants.
2451 % Ignore braces, too, so mismatched braces don't cause trouble.
2455 % We must not have @c interpreted as a control sequence.
2458 \def\ignoreword{#1}%
2459 \ifx\ignoreword\documentdescriptionword
2460 % The c kludge breaks documentdescription, since
2461 % `documentdescription' contains a `c'. Means not everything will
2462 % be ignored inside @documentdescription, but oh well...
2464 % Make the letter c a comment character so that the rest of the line
2465 % will be ignored. This way, the document can have (for example)
2467 % and the @end ifinfo will be properly ignored.
2468 % (We've just changed @ to catcode 12.)
2472 % And now expand the command defined above.
2476 % What we do to finish off ignored text.
2478 \def\enddoignore{\endgroup\ignorespaces}%
2480 \newif\ifwarnedobs\warnedobsfalse
2482 \ifwarnedobs\relax\else
2483 % We need to warn folks that they may have trouble with TeX 3.0.
2484 % This uses \immediate\write16 rather than \message to get newlines.
2485 \immediate\write16{}
2486 \immediate\write16{WARNING: for users of Unix TeX 3.0!}
2487 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
2488 \immediate\write16{If you are running another version of TeX, relax.}
2489 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
2490 \immediate\write16{ Then upgrade your TeX installation if you can.}
2491 \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
2492 \immediate\write16{If you are stuck with version 3.0, run the}
2493 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
2494 \immediate\write16{ to use a workaround.}
2495 \immediate\write16{}
2496 \global\warnedobstrue
2500 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
2501 % workaround (which requires the file ``dummy.tfm'' to be installed),
2502 % uncomment the following line:
2503 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
2505 % Ignore text, except that we keep track of conditional commands for
2506 % purposes of nesting, up to an `@end #1' command.
2508 \def\nestedignore#1{%
2510 % We must actually expand the ignored text to look for the @end
2511 % command, so that nested ignore constructs work. Thus, we put the
2512 % text into a \vbox and then do nothing with the result. To minimize
2513 % the chance of memory overflow, we follow the approach outlined on
2514 % page 401 of the TeXbook: make the current font be a dummy font.
2516 \setbox0 = \vbox\bgroup
2517 % Don't complain about control sequences we have declared \outer.
2520 % Define `@end #1' to end the box, which will in turn undefine the
2521 % @end command again.
2522 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
2524 % We are going to be parsing Texinfo commands. Most cause no
2525 % trouble when they are used incorrectly, but some commands do
2526 % complicated argument parsing or otherwise get confused, so we
2529 % We can't do anything about stray @-signs, unfortunately;
2530 % they'll produce `undefined control sequence' errors.
2533 % Set the current font to be \nullfont, a TeX primitive, and define
2534 % all the font commands to also use \nullfont. We don't use
2535 % dummy.tfm, as suggested in the TeXbook, because not all sites
2536 % might have that installed. Therefore, math mode will still
2537 % produce output, but that should be an extremely small amount of
2538 % stuff compared to the main input.
2541 \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont
2542 \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont
2543 \let\tensf=\nullfont
2544 % Similarly for index fonts.
2545 \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont
2546 \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont
2547 \let\smallsf=\nullfont
2548 % Similarly for smallexample fonts.
2549 \let\smallerrm=\nullfont \let\smallerit=\nullfont \let\smallersl=\nullfont
2550 \let\smallerbf=\nullfont \let\smallertt=\nullfont \let\smallersc=\nullfont
2551 \let\smallersf=\nullfont
2553 % Don't complain when characters are missing from the fonts.
2554 \tracinglostchars = 0
2556 % Don't bother to do space factor calculations.
2559 % Don't report underfull hboxes.
2562 % Do minimal line-breaking.
2563 \pretolerance = 10000
2565 % Do not execute instructions in @tex.
2566 \def\tex{\doignore{tex}}%
2567 % Do not execute macro definitions.
2568 % `c' is a comment character, so the word `macro' will get cut off.
2569 \def\macro{\doignore{ma}}%
2572 % @set VAR sets the variable VAR to an empty value.
2573 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
2575 % Since we want to separate VAR from REST-OF-LINE (which might be
2576 % empty), we can't just use \parsearg; we have to insert a space of our
2577 % own to delimit the rest of the line, and then take it out again if we
2578 % didn't need it. Make sure the catcode of space is correct to avoid
2579 % losing inside @example, for instance.
2581 \def\set{\begingroup\catcode` =10
2582 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
2584 \def\setxxx#1{\setyyy#1 \endsetyyy}
2585 \def\setyyy#1 #2\endsetyyy{%
2587 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
2588 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
2592 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
2593 % \next or other control sequences that we've defined might get us into
2594 % an infinite loop. Consider `@set foo @cite{bar}'.
2595 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
2597 % @clear VAR clears (i.e., unsets) the variable VAR.
2599 \def\clear{\parsearg\clearxxx}
2600 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
2602 % @value{foo} gets the text saved in variable foo.
2604 \catcode`\_ = \active
2606 % We might end up with active _ or - characters in the argument if
2607 % we're called from @code, as @code{@value{foo-bar_}}. So \let any
2608 % such active characters to their normal equivalents.
2609 \gdef\value{\begingroup
2610 \catcode`\-=12 \catcode`\_=12
2611 \indexbreaks \let_\normalunderscore
2614 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
2616 % We have this subroutine so that we can handle at least some @value's
2617 % properly in indexes (we \let\value to this in \indexdummies). Ones
2618 % whose names contain - or _ still won't work, but we can't do anything
2619 % about that. The command has to be fully expandable, since the result
2620 % winds up in the index file. This means that if the variable's value
2621 % contains other Texinfo commands, it's almost certain it will fail
2622 % (although perhaps we could fix that with sufficient work to do a
2623 % one-level expansion on the result, instead of complete).
2625 \def\expandablevalue#1{%
2626 \expandafter\ifx\csname SET#1\endcsname\relax
2627 {[No value for ``#1'']}%
2629 \csname SET#1\endcsname
2633 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
2636 \def\ifset{\parsearg\ifsetxxx}
2638 \expandafter\ifx\csname SET#1\endcsname\relax
2639 \expandafter\ifsetfail
2641 \expandafter\ifsetsucceed
2644 \def\ifsetsucceed{\conditionalsucceed{ifset}}
2645 \def\ifsetfail{\nestedignore{ifset}}
2646 \defineunmatchedend{ifset}
2648 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
2649 % defined with @set, or has been undefined with @clear.
2651 \def\ifclear{\parsearg\ifclearxxx}
2652 \def\ifclearxxx #1{%
2653 \expandafter\ifx\csname SET#1\endcsname\relax
2654 \expandafter\ifclearsucceed
2656 \expandafter\ifclearfail
2659 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
2660 \def\ifclearfail{\nestedignore{ifclear}}
2661 \defineunmatchedend{ifclear}
2663 % @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we
2664 % read the text following, through the first @end iftex (etc.). Make
2665 % `@end iftex' (etc.) valid only after an @iftex.
2667 \def\iftex{\conditionalsucceed{iftex}}
2668 \def\ifnothtml{\conditionalsucceed{ifnothtml}}
2669 \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
2670 \def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}}
2671 \defineunmatchedend{iftex}
2672 \defineunmatchedend{ifnothtml}
2673 \defineunmatchedend{ifnotinfo}
2674 \defineunmatchedend{ifnotplaintext}
2676 % We can't just want to start a group at @iftex (etc.) and end it at
2677 % @end iftex, since then @set commands inside the conditional have no
2678 % effect (they'd get reverted at the end of the group). So we must
2679 % define \Eiftex to redefine itself to be its previous value. (We can't
2680 % just define it to fail again with an ``unmatched end'' error, since
2681 % the @ifset might be nested.)
2683 \def\conditionalsucceed#1{%
2685 % Remember the current value of \E#1.
2686 \let\nece{prevE#1} = \nece{E#1}%
2688 % At the `@end #1', redefine \E#1 to be its previous value.
2689 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
2694 % We need to expand lots of \csname's, but we don't want to expand the
2695 % control sequences after we've constructed them.
2697 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
2699 % @defininfoenclose.
2700 \let\definfoenclose=\comment
2704 % Index generation facilities
2706 % Define \newwrite to be identical to plain tex's \newwrite
2707 % except not \outer, so it can be used within \newindex.
2709 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2711 % \newindex {foo} defines an index named foo.
2712 % It automatically defines \fooindex such that
2713 % \fooindex ...rest of line... puts an entry in the index foo.
2714 % It also defines \fooindfile to be the number of the output channel for
2715 % the file that accumulates this index. The file's extension is foo.
2716 % The name of an index should be no more than 2 characters long
2717 % for the sake of vms.
2721 \expandafter\newwrite \csname#1indfile\endcsname
2722 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2724 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
2725 \noexpand\doindex{#1}}
2728 % @defindex foo == \newindex{foo}
2730 \def\defindex{\parsearg\newindex}
2732 % Define @defcodeindex, like @defindex except put all entries in @code.
2734 \def\defcodeindex{\parsearg\newcodeindex}
2736 \def\newcodeindex#1{%
2738 \expandafter\newwrite \csname#1indfile\endcsname
2739 \openout \csname#1indfile\endcsname \jobname.#1
2741 \expandafter\xdef\csname#1index\endcsname{%
2742 \noexpand\docodeindex{#1}}%
2746 % @synindex foo bar makes index foo feed into index bar.
2747 % Do this instead of @defindex foo if you don't want it as a separate index.
2749 % @syncodeindex foo bar similar, but put all entries made for index foo
2752 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
2753 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
2755 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
2756 % #3 the target index (bar).
2757 \def\dosynindex#1#2#3{%
2758 % Only do \closeout if we haven't already done it, else we'll end up
2759 % closing the target index.
2760 \expandafter \ifx\csname donesynindex#2\endcsname \undefined
2761 % The \closeout helps reduce unnecessary open files; the limit on the
2762 % Acorn RISC OS is a mere 16 files.
2763 \expandafter\closeout\csname#2indfile\endcsname
2764 \expandafter\let\csname\donesynindex#2\endcsname = 1
2766 % redefine \fooindfile:
2767 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
2768 \expandafter\let\csname#2indfile\endcsname=\temp
2769 % redefine \fooindex:
2770 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
2773 % Define \doindex, the driver for all \fooindex macros.
2774 % Argument #1 is generated by the calling \fooindex macro,
2775 % and it is "foo", the name of the index.
2777 % \doindex just uses \parsearg; it calls \doind for the actual work.
2778 % This is because \doind is more useful to call from other macros.
2780 % There is also \dosubind {index}{topic}{subtopic}
2781 % which makes an entry in a two-level index such as the operation index.
2783 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
2784 \def\singleindexer #1{\doind{\indexname}{#1}}
2786 % like the previous two, but they put @code around the argument.
2787 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2788 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2790 % Take care of texinfo commands likely to appear in an index entry.
2791 % (Must be a way to avoid doing expansion at all, and thus not have to
2792 % laboriously list every single command here.)
2796 \def\@{@}% change to @@ when we switch to @ as escape char in aux files.
2797 % Need these in case \tex is in effect and \{ is a \delimiter again.
2798 % But can't use \lbracecmd and \rbracecmd because texindex assumes
2799 % braces and backslashes are used only as delimiters.
2802 \def\_{{\realbackslash _}}%
2803 \normalturnoffactive
2805 % Take care of the plain tex accent commands.
2806 \def\,##1{\realbackslash ,{##1}}%
2807 \def\"{\realbackslash "}%
2808 \def\`{\realbackslash `}%
2809 \def\'{\realbackslash '}%
2810 \def\^{\realbackslash ^}%
2811 \def\~{\realbackslash ~}%
2812 \def\={\realbackslash =}%
2813 \def\b{\realbackslash b}%
2814 \def\c{\realbackslash c}%
2815 \def\d{\realbackslash d}%
2816 \def\u{\realbackslash u}%
2817 \def\v{\realbackslash v}%
2818 \def\H{\realbackslash H}%
2819 \def\dotless##1{\realbackslash dotless {##1}}%
2820 % Take care of the plain tex special European modified letters.
2821 \def\AA{\realbackslash AA}%
2822 \def\AE{\realbackslash AE}%
2823 \def\L{\realbackslash L}%
2824 \def\OE{\realbackslash OE}%
2825 \def\O{\realbackslash O}%
2826 \def\aa{\realbackslash aa}%
2827 \def\ae{\realbackslash ae}%
2828 \def\l{\realbackslash l}%
2829 \def\oe{\realbackslash oe}%
2830 \def\o{\realbackslash o}%
2831 \def\ss{\realbackslash ss}%
2833 % Although these internals commands shouldn't show up, sometimes they do.
2834 \def\bf{\realbackslash bf }%
2835 \def\gtr{\realbackslash gtr}%
2836 \def\hat{\realbackslash hat}%
2837 \def\less{\realbackslash less}%
2838 %\def\rm{\realbackslash rm }%
2839 \def\sf{\realbackslash sf}%
2840 \def\sl{\realbackslash sl }%
2841 \def\tclose##1{\realbackslash tclose {##1}}%
2842 \def\tt{\realbackslash tt}%
2844 \def\b##1{\realbackslash b {##1}}%
2845 \def\i##1{\realbackslash i {##1}}%
2846 \def\sc##1{\realbackslash sc {##1}}%
2847 \def\t##1{\realbackslash t {##1}}%
2848 \def\r##1{\realbackslash r {##1}}%
2850 \def\TeX{\realbackslash TeX}%
2851 \def\acronym##1{\realbackslash acronym {##1}}%
2852 \def\cite##1{\realbackslash cite {##1}}%
2853 \def\code##1{\realbackslash code {##1}}%
2854 \def\command##1{\realbackslash command {##1}}%
2855 \def\dfn##1{\realbackslash dfn {##1}}%
2856 \def\dots{\realbackslash dots }%
2857 \def\emph##1{\realbackslash emph {##1}}%
2858 \def\env##1{\realbackslash env {##1}}%
2859 \def\file##1{\realbackslash file {##1}}%
2860 \def\kbd##1{\realbackslash kbd {##1}}%
2861 \def\key##1{\realbackslash key {##1}}%
2862 \def\math##1{\realbackslash math {##1}}%
2863 \def\option##1{\realbackslash option {##1}}%
2864 \def\samp##1{\realbackslash samp {##1}}%
2865 \def\strong##1{\realbackslash strong {##1}}%
2866 \def\uref##1{\realbackslash uref {##1}}%
2867 \def\url##1{\realbackslash url {##1}}%
2868 \def\var##1{\realbackslash var {##1}}%
2869 \def\w{\realbackslash w }%
2871 % These math commands don't seem likely to be used in index entries.
2872 \def\copyright{\realbackslash copyright}%
2873 \def\equiv{\realbackslash equiv}%
2874 \def\error{\realbackslash error}%
2875 \def\expansion{\realbackslash expansion}%
2876 \def\point{\realbackslash point}%
2877 \def\print{\realbackslash print}%
2878 \def\result{\realbackslash result}%
2880 % Handle some cases of @value -- where the variable name does not
2881 % contain - or _, and the value does not contain any
2882 % (non-fully-expandable) commands.
2883 \let\value = \expandablevalue
2886 % Turn off macro expansion
2890 % If an index command is used in an @example environment, any spaces
2891 % therein should become regular spaces in the raw index file, not the
2892 % expansion of \tie (\leavevmode \penalty \@M \ ).
2894 \gdef\unsepspaces{\obeyspaces\let =\space}}
2896 % \indexnofonts no-ops all font-change commands.
2897 % This is used when outputting the strings to sort the index by.
2898 \def\indexdummyfont#1{#1}
2899 \def\indexdummytex{TeX}
2900 \def\indexdummydots{...}
2904 % how to handle braces?
2905 \def\_{\normalunderscore}%
2907 \let\,=\indexdummyfont
2908 \let\"=\indexdummyfont
2909 \let\`=\indexdummyfont
2910 \let\'=\indexdummyfont
2911 \let\^=\indexdummyfont
2912 \let\~=\indexdummyfont
2913 \let\==\indexdummyfont
2914 \let\b=\indexdummyfont
2915 \let\c=\indexdummyfont
2916 \let\d=\indexdummyfont
2917 \let\u=\indexdummyfont
2918 \let\v=\indexdummyfont
2919 \let\H=\indexdummyfont
2920 \let\dotless=\indexdummyfont
2921 % Take care of the plain tex special European modified letters.
2934 % Don't no-op \tt, since it isn't a user-level command
2935 % and is used in the definitions of the active chars like <, >, |, etc.
2936 % Likewise with the other plain tex font commands.
2937 %\let\tt=\indexdummyfont
2939 \let\b=\indexdummyfont
2940 \let\i=\indexdummyfont
2941 \let\r=\indexdummyfont
2942 \let\sc=\indexdummyfont
2943 \let\t=\indexdummyfont
2945 \let\TeX=\indexdummytex
2946 \let\acronym=\indexdummyfont
2947 \let\cite=\indexdummyfont
2948 \let\code=\indexdummyfont
2949 \let\command=\indexdummyfont
2950 \let\dfn=\indexdummyfont
2951 \let\dots=\indexdummydots
2952 \let\emph=\indexdummyfont
2953 \let\env=\indexdummyfont
2954 \let\file=\indexdummyfont
2955 \let\kbd=\indexdummyfont
2956 \let\key=\indexdummyfont
2957 \let\math=\indexdummyfont
2958 \let\option=\indexdummyfont
2959 \let\samp=\indexdummyfont
2960 \let\strong=\indexdummyfont
2961 \let\uref=\indexdummyfont
2962 \let\url=\indexdummyfont
2963 \let\var=\indexdummyfont
2964 \let\w=\indexdummyfont
2967 % To define \realbackslash, we must make \ not be an escape.
2968 % We must first make another character (@) an escape
2969 % so we do not become unable to do a definition.
2971 {\catcode`\@=0 \catcode`\\=\other
2972 @gdef@realbackslash{\}}
2974 \let\indexbackslash=0 %overridden during \printindex.
2975 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
2977 % For \ifx comparisons.
2978 \def\emptymacro{\empty}
2980 % Most index entries go through here, but \dosubind is the general case.
2982 \def\doind#1#2{\dosubind{#1}{#2}\empty}
2984 % Workhorse for all \fooindexes.
2985 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
2986 % \empty if called from \doind, as we usually are. The main exception
2987 % is with defuns, which call us directly.
2989 \def\dosubind#1#2#3{%
2990 % Put the index entry in the margin if desired.
2991 \ifx\SETmarginindex\relax\else
2992 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2995 \count255=\lastpenalty
2997 \indexdummies % Must do this here, since \bf, etc expand at this stage
3000 \let\folio = 0% We will expand all macros now EXCEPT \folio.
3001 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
3002 % so it will be output as is; and it will print as backslash.
3006 % If third arg is present, precede it with space in sort key.
3007 \ifx\thirdarg\emptymacro
3008 \let\subentry = \empty
3013 % First process the index entry with all font commands turned
3014 % off to get the string to sort by.
3015 {\indexnofonts \xdef\indexsorttmp{#2\subentry}}%
3017 % Now the real index entry with the fonts.
3020 % If the third (subentry) arg is present, add it to the index
3022 \ifx\thirdarg\emptymacro \else
3023 \toks0 = \expandafter{\the\toks0{#3}}%
3026 % Set up the complete index entry, with both the sort key and
3027 % the original text, including any font commands. We write
3028 % three arguments to \entry to the .?? file (four in the
3029 % subentry case), texindex reduces to two when writing the .??s
3032 \write\csname#1indfile\endcsname{%
3033 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
3036 % If a skip is the last thing on the list now, preserve it
3037 % by backing up by \lastskip, doing the \write, then inserting
3038 % the skip again. Otherwise, the whatsit generated by the
3039 % \write will make \lastskip zero. The result is that sequences
3044 % will have extra space inserted, because the \medbreak in the
3045 % start of the @defun won't see the skip inserted by the @end of
3046 % the previous defun.
3048 % But don't do any of this if we're not in vertical mode. We
3049 % don't want to do a \vskip and prematurely end a paragraph.
3051 % Avoid page breaks due to these extra skips, too.
3056 \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi
3059 \temp % do the write
3062 \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
3070 % The index entry written in the file actually looks like
3071 % \entry {sortstring}{page}{topic}
3073 % \entry {sortstring}{page}{topic}{subtopic}
3074 % The texindex program reads in these files and writes files
3075 % containing these kinds of lines:
3077 % before the first topic whose initial is c
3078 % \entry {topic}{pagelist}
3079 % for a topic that is used without subtopics
3081 % for the beginning of a topic that is used with subtopics
3082 % \secondary {subtopic}{pagelist}
3083 % for each subtopic.
3085 % Define the user-accessible indexing commands
3086 % @findex, @vindex, @kindex, @cindex.
3088 \def\findex {\fnindex}
3089 \def\kindex {\kyindex}
3090 \def\cindex {\cpindex}
3091 \def\vindex {\vrindex}
3092 \def\tindex {\tpindex}
3093 \def\pindex {\pgindex}
3095 \def\cindexsub {\begingroup\obeylines\cindexsub}
3097 \gdef\cindexsub "#1" #2^^M{\endgroup %
3098 \dosubind{cp}{#2}{#1}}}
3100 % Define the macros used in formatting output of the sorted index material.
3102 % @printindex causes a particular index (the ??s file) to get printed.
3103 % It does not print any chapter heading (usually an @unnumbered).
3105 \def\printindex{\parsearg\doprintindex}
3106 \def\doprintindex#1{\begingroup
3107 \dobreak \chapheadingskip{10000}%
3113 % See if the index file exists and is nonempty.
3114 % Change catcode of @ here so that if the index file contains
3116 % as its first line, TeX doesn't complain about mismatched braces
3117 % (because it thinks @} is a control sequence).
3119 \openin 1 \jobname.#1s
3121 % \enddoublecolumns gets confused if there is no text in the index,
3122 % and it loses the chapter title and the aux file entries for the
3123 % index. The easiest way to prevent this problem is to make sure
3124 % there is some text.
3125 \putwordIndexNonexistent
3128 % If the index file exists but is empty, then \openin leaves \ifeof
3129 % false. We have to make TeX try to read something from the file, so
3130 % it can discover if there is anything in it.
3133 \putwordIndexIsEmpty
3135 % Index files are almost Texinfo source, but we use \ as the escape
3136 % character. It would be better to use @, but that's too big a change
3137 % to make right now.
3138 \def\indexbackslash{\rawbackslashxx}%
3149 % These macros are used by the sorted index file itself.
3150 % Change them to control the appearance of the index.
3153 % Some minor font changes for the special characters.
3154 \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
3156 % Remove any glue we may have, we'll be inserting our own.
3159 % We like breaks before the index initials, so insert a bonus.
3162 % Typeset the initial. Making this add up to a whole number of
3163 % baselineskips increases the chance of the dots lining up from column
3164 % to column. It still won't often be perfect, because of the stretch
3165 % we need before each entry, but it's better.
3167 % No shrink because it confuses \balancecolumns.
3168 \vskip 1.67\baselineskip plus .5\baselineskip
3169 \leftline{\secbf #1}%
3170 \vskip .33\baselineskip plus .1\baselineskip
3172 % Do our best not to break after the initial.
3176 % This typesets a paragraph consisting of #1, dot leaders, and then #2
3177 % flush to the right margin. It is used for index and table of contents
3178 % entries. The paragraph is indented by \leftskip.
3180 \def\entry#1#2{\begingroup
3182 % Start a new paragraph if necessary, so our assignments below can't
3183 % affect previous text.
3186 % Do not fill out the last line with white space.
3189 % No extra space above this paragraph.
3192 % Do not prefer a separate line ending with a hyphen to fewer lines.
3193 \finalhyphendemerits = 0
3195 % \hangindent is only relevant when the entry text and page number
3196 % don't both fit on one line. In that case, bob suggests starting the
3197 % dots pretty far over on the line. Unfortunately, a large
3198 % indentation looks wrong when the entry text itself is broken across
3199 % lines. So we use a small indentation and put up with long leaders.
3201 % \hangafter is reset to 1 (which is the value we want) at the start
3202 % of each paragraph, so we need not do anything with that.
3205 % When the entry text needs to be broken, just fill out the first line
3207 \rightskip = 0pt plus1fil
3209 % A bit of stretch before each entry for the benefit of balancing columns.
3212 % Start a ``paragraph'' for the index entry so the line breaking
3213 % parameters we've set above will have an effect.
3216 % Insert the text of the index entry. TeX will do line-breaking on it.
3218 % The following is kludged to not output a line of dots in the index if
3219 % there are no page numbers. The next person who breaks this will be
3220 % cursed by a Unix daemon.
3223 \edef\tempc{\tempa}%
3224 \edef\tempd{\tempb}%
3225 \ifx\tempc\tempd\ \else%
3227 % If we must, put the page number on a line of its own, and fill out
3228 % this line with blank space. (The \hfil is overwhelmed with the
3229 % fill leaders glue in \indexdotfill if the page number does fit.)
3231 \null\nobreak\indexdotfill % Have leaders before the page number.
3233 % The `\ ' here is removed by the implicit \unskip that TeX does as
3234 % part of (the primitive) \par. Without it, a spurious underfull
3237 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
3239 \ #2% The page number ends the paragraph.
3245 % Like \dotfill except takes at least 1 em.
3246 \def\indexdotfill{\cleaders
3247 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
3249 \def\primary #1{\line{#1\hfil}}
3251 \newskip\secondaryindent \secondaryindent=0.5cm
3252 \def\secondary#1#2{{%
3257 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
3259 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
3266 % Define two-column mode, which we use to typeset indexes.
3267 % Adapted from the TeXbook, page 416, which is to say,
3268 % the manmac.tex format used to print the TeXbook itself.
3272 \newdimen\doublecolumnhsize
3274 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
3275 % Grab any single-column material above us.
3278 % Here is a possibility not foreseen in manmac: if we accumulate a
3279 % whole lot of material, we might end up calling this \output
3280 % routine twice in a row (see the doublecol-lose test, which is
3281 % essentially a couple of indexes with @setchapternewpage off). In
3282 % that case we just ship out what is in \partialpage with the normal
3283 % output routine. Generally, \partialpage will be empty when this
3284 % runs and this will be a no-op. See the indexspread.tex test case.
3285 \ifvoid\partialpage \else
3286 \onepageout{\pagecontents\partialpage}%
3289 \global\setbox\partialpage = \vbox{%
3290 % Unvbox the main output page.
3292 \kern-\topskip \kern\baselineskip
3295 \eject % run that output routine to set \partialpage
3297 % Use the double-column output routine for subsequent pages.
3298 \output = {\doublecolumnout}%
3300 % Change the page size parameters. We could do this once outside this
3301 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
3302 % format, but then we repeat the same computation. Repeating a couple
3303 % of assignments once per index is clearly meaningless for the
3304 % execution time, so we may as well do it in one place.
3306 % First we halve the line length, less a little for the gutter between
3307 % the columns. We compute the gutter based on the line length, so it
3308 % changes automatically with the paper format. The magic constant
3309 % below is chosen so that the gutter has the same value (well, +-<1pt)
3310 % as it did when we hard-coded it.
3312 % We put the result in a separate register, \doublecolumhsize, so we
3313 % can restore it in \pagesofar, after \hsize itself has (potentially)
3316 \doublecolumnhsize = \hsize
3317 \advance\doublecolumnhsize by -.04154\hsize
3318 \divide\doublecolumnhsize by 2
3319 \hsize = \doublecolumnhsize
3321 % Double the \vsize as well. (We don't need a separate register here,
3322 % since nobody clobbers \vsize.)
3326 % The double-column output routine for all double-column pages except
3329 \def\doublecolumnout{%
3330 \splittopskip=\topskip \splitmaxdepth=\maxdepth
3331 % Get the available space for the double columns -- the normal
3332 % (undoubled) page height minus any material left over from the
3336 \advance\dimen@ by -\ht\partialpage
3338 % box0 will be the left-hand column, box2 the right.
3339 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
3340 \onepageout\pagesofar
3342 \penalty\outputpenalty
3345 % Re-output the contents of the output page -- any previous material,
3346 % followed by the two boxes we just split, in box0 and box2.
3350 \hsize = \doublecolumnhsize
3351 \wd0=\hsize \wd2=\hsize
3352 \hbox to\pagewidth{\box0\hfil\box2}%
3355 % All done with double columns.
3356 \def\enddoublecolumns{%
3358 % Split the last of the double-column material. Leave it on the
3359 % current page, no automatic page break.
3362 % If we end up splitting too much material for the current page,
3363 % though, there will be another page break right after this \output
3364 % invocation ends. Having called \balancecolumns once, we do not
3365 % want to call it again. Therefore, reset \output to its normal
3366 % definition right away. (We hope \balancecolumns will never be
3367 % called on to balance too much material, but if it is, this makes
3368 % the output somewhat more palatable.)
3369 \global\output = {\onepageout{\pagecontents\PAGE}}%
3372 \endgroup % started in \begindoublecolumns
3374 % \pagegoal was set to the doubled \vsize above, since we restarted
3375 % the current page. We're now back to normal single-column
3376 % typesetting, so reset \pagegoal to the normal \vsize (after the
3377 % \endgroup where \vsize got restored).
3381 % Called at the end of the double column material.
3382 \def\balancecolumns{%
3383 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
3385 \advance\dimen@ by \topskip
3386 \advance\dimen@ by-\baselineskip
3387 \divide\dimen@ by 2 % target to split to
3388 %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
3389 \splittopskip = \topskip
3390 % Loop until we get a decent breakpoint.
3394 \global\setbox3 = \copy0
3395 \global\setbox1 = \vsplit3 to \dimen@
3397 \global\advance\dimen@ by 1pt
3400 %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
3401 \setbox0=\vbox to\dimen@{\unvbox1}%
3402 \setbox2=\vbox to\dimen@{\unvbox3}%
3406 \catcode`\@ = \other
3409 \message{sectioning,}
3410 % Chapters, sections, etc.
3413 \newcount\secno \secno=0
3414 \newcount\subsecno \subsecno=0
3415 \newcount\subsubsecno \subsubsecno=0
3417 % This counter is funny since it counts through charcodes of letters A, B, ...
3418 \newcount\appendixno \appendixno = `\@
3419 % \def\appendixletter{\char\the\appendixno}
3420 % We do the following for the sake of pdftex, which needs the actual
3421 % letter in the expansion, not just typeset.
3422 \def\appendixletter{%
3423 \ifnum\appendixno=`A A%
3424 \else\ifnum\appendixno=`B B%
3425 \else\ifnum\appendixno=`C C%
3426 \else\ifnum\appendixno=`D D%
3427 \else\ifnum\appendixno=`E E%
3428 \else\ifnum\appendixno=`F F%
3429 \else\ifnum\appendixno=`G G%
3430 \else\ifnum\appendixno=`H H%
3431 \else\ifnum\appendixno=`I I%
3432 \else\ifnum\appendixno=`J J%
3433 \else\ifnum\appendixno=`K K%
3434 \else\ifnum\appendixno=`L L%
3435 \else\ifnum\appendixno=`M M%
3436 \else\ifnum\appendixno=`N N%
3437 \else\ifnum\appendixno=`O O%
3438 \else\ifnum\appendixno=`P P%
3439 \else\ifnum\appendixno=`Q Q%
3440 \else\ifnum\appendixno=`R R%
3441 \else\ifnum\appendixno=`S S%
3442 \else\ifnum\appendixno=`T T%
3443 \else\ifnum\appendixno=`U U%
3444 \else\ifnum\appendixno=`V V%
3445 \else\ifnum\appendixno=`W W%
3446 \else\ifnum\appendixno=`X X%
3447 \else\ifnum\appendixno=`Y Y%
3448 \else\ifnum\appendixno=`Z Z%
3449 % The \the is necessary, despite appearances, because \appendixletter is
3450 % expanded while writing the .toc file. \char\appendixno is not
3451 % expandable, thus it is written literally, thus all appendixes come out
3452 % with the same letter (or @) in the toc without it.
3453 \else\char\the\appendixno
3454 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
3455 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
3457 % Each @chapter defines this as the name of the chapter.
3458 % page headings and footings can use it. @section does likewise.
3462 \newcount\absseclevel % used to calculate proper heading level
3463 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
3465 % @raisesections: treat @section as chapter, @subsection as section, etc.
3466 \def\raisesections{\global\advance\secbase by -1}
3467 \let\up=\raisesections % original BFox name
3469 % @lowersections: treat @chapter as section, @section as subsection, etc.
3470 \def\lowersections{\global\advance\secbase by 1}
3471 \let\down=\lowersections % original BFox name
3473 % Choose a numbered-heading macro
3474 % #1 is heading level if unmodified by @raisesections or @lowersections
3475 % #2 is text for heading
3476 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3482 \numberedsubseczzz{#2}
3484 \numberedsubsubseczzz{#2}
3486 \ifnum \absseclevel<0
3489 \numberedsubsubseczzz{#2}
3494 % like \numhead, but chooses appendix heading levels
3495 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3499 \appendixsectionzzz{#2}
3501 \appendixsubseczzz{#2}
3503 \appendixsubsubseczzz{#2}
3505 \ifnum \absseclevel<0
3508 \appendixsubsubseczzz{#2}
3513 % like \numhead, but chooses numberless heading levels
3514 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
3518 \unnumberedseczzz{#2}
3520 \unnumberedsubseczzz{#2}
3522 \unnumberedsubsubseczzz{#2}
3524 \ifnum \absseclevel<0
3527 \unnumberedsubsubseczzz{#2}
3532 % @chapter, @appendix, @unnumbered.
3533 \def\thischaptername{No Chapter Title}
3534 \outer\def\chapter{\parsearg\chapteryyy}
3535 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
3536 \def\chapterzzz #1{%
3537 \secno=0 \subsecno=0 \subsubsecno=0
3538 \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
3539 \chapmacro {#1}{\the\chapno}%
3540 \gdef\thissection{#1}%
3541 \gdef\thischaptername{#1}%
3542 % We don't substitute the actual chapter name into \thischapter
3543 % because we don't want its macros evaluated now.
3544 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
3546 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
3550 \global\let\section = \numberedsec
3551 \global\let\subsection = \numberedsubsec
3552 \global\let\subsubsection = \numberedsubsubsec
3555 % we use \chapno to avoid indenting back
3556 \def\appendixbox#1{%
3557 \setbox0 = \hbox{\putwordAppendix{} \the\chapno}%
3558 \hbox to \wd0{#1\hss}}
3560 \outer\def\appendix{\parsearg\appendixyyy}
3561 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
3562 \def\appendixzzz #1{%
3563 \secno=0 \subsecno=0 \subsubsecno=0
3564 \global\advance \appendixno by 1
3565 \message{\putwordAppendix\space \appendixletter}%
3566 \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}%
3567 \gdef\thissection{#1}%
3568 \gdef\thischaptername{#1}%
3569 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
3571 \edef\temp{\noexpand\writetocentry{\realbackslash appendixentry{\the\toks0}%
3572 {\appendixletter}}}%
3575 \global\let\section = \appendixsec
3576 \global\let\subsection = \appendixsubsec
3577 \global\let\subsubsection = \appendixsubsubsec
3580 % @centerchap is like @unnumbered, but the heading is centered.
3581 \outer\def\centerchap{\parsearg\centerchapyyy}
3582 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
3584 % @top is like @unnumbered.
3585 \outer\def\top{\parsearg\unnumberedyyy}
3587 \outer\def\unnumbered{\parsearg\unnumberedyyy}
3588 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
3589 \def\unnumberedzzz #1{%
3590 \secno=0 \subsecno=0 \subsubsecno=0
3592 % This used to be simply \message{#1}, but TeX fully expands the
3593 % argument to \message. Therefore, if #1 contained @-commands, TeX
3594 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
3595 % expanded @cite (which turns out to cause errors because \cite is meant
3596 % to be executed, not expanded).
3598 % Anyway, we don't want the fully-expanded definition of @cite to appear
3599 % as a result of the \message, we just want `@cite' itself. We use
3600 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
3601 % simply yielding the contents of <toks register>. (We also do this for
3603 \toks0 = {#1}\message{(\the\toks0)}%
3605 \unnumbchapmacro {#1}%
3606 \gdef\thischapter{#1}\gdef\thissection{#1}%
3608 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}{\the\chapno}}}%
3611 \global\let\section = \unnumberedsec
3612 \global\let\subsection = \unnumberedsubsec
3613 \global\let\subsubsection = \unnumberedsubsubsec
3617 \outer\def\numberedsec{\parsearg\secyyy}
3618 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
3620 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3621 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
3623 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3624 {\the\chapno}{\the\secno}}}%
3630 \outer\def\appendixsection{\parsearg\appendixsecyyy}
3631 \outer\def\appendixsec{\parsearg\appendixsecyyy}
3632 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
3633 \def\appendixsectionzzz #1{%
3634 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3635 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
3637 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
3638 {\appendixletter}{\the\secno}}}%
3644 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
3645 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
3646 \def\unnumberedseczzz #1{%
3647 \plainsecheading {#1}\gdef\thissection{#1}%
3649 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry%
3650 {\the\toks0}{\the\chapno}{\the\secno}}}%
3657 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
3658 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
3659 \def\numberedsubseczzz #1{%
3660 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3661 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
3663 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3664 {\the\chapno}{\the\secno}{\the\subsecno}}}%
3670 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
3671 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
3672 \def\appendixsubseczzz #1{%
3673 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3674 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
3676 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
3677 {\appendixletter}{\the\secno}{\the\subsecno}}}%
3683 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
3684 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
3685 \def\unnumberedsubseczzz #1{%
3686 \plainsubsecheading {#1}\gdef\thissection{#1}%
3688 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry%
3689 {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}}}%
3696 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
3697 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
3698 \def\numberedsubsubseczzz #1{%
3699 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3700 \subsubsecheading {#1}
3701 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3703 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3704 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3710 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
3711 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
3712 \def\appendixsubsubseczzz #1{%
3713 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3714 \subsubsecheading {#1}
3715 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3717 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
3718 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3724 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
3725 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
3726 \def\unnumberedsubsubseczzz #1{%
3727 \plainsubsubsecheading {#1}\gdef\thissection{#1}%
3729 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry%
3730 {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
3736 % These are variants which are not "outer", so they can appear in @ifinfo.
3737 % Actually, they should now be obsolete; ordinary section commands should work.
3738 \def\infotop{\parsearg\unnumberedzzz}
3739 \def\infounnumbered{\parsearg\unnumberedzzz}
3740 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
3741 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
3742 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
3744 \def\infoappendix{\parsearg\appendixzzz}
3745 \def\infoappendixsec{\parsearg\appendixseczzz}
3746 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
3747 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
3749 \def\infochapter{\parsearg\chapterzzz}
3750 \def\infosection{\parsearg\sectionzzz}
3751 \def\infosubsection{\parsearg\subsectionzzz}
3752 \def\infosubsubsection{\parsearg\subsubsectionzzz}
3754 % These macros control what the section commands do, according
3755 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
3756 % Define them by default for a numbered chapter.
3757 \global\let\section = \numberedsec
3758 \global\let\subsection = \numberedsubsec
3759 \global\let\subsubsection = \numberedsubsubsec
3761 % Define @majorheading, @heading and @subheading
3763 % NOTE on use of \vbox for chapter headings, section headings, and such:
3764 % 1) We use \vbox rather than the earlier \line to permit
3765 % overlong headings to fold.
3766 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
3767 % heading is obnoxious; this forbids it.
3768 % 3) Likewise, headings look best if no \parindent is used, and
3769 % if justification is not attempted. Hence \raggedright.
3772 \def\majorheading{\parsearg\majorheadingzzz}
3773 \def\majorheadingzzz #1{%
3774 {\advance\chapheadingskip by 10pt \chapbreak }%
3775 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3776 \parindent=0pt\raggedright
3777 \rm #1\hfill}}\bigskip \par\penalty 200}
3779 \def\chapheading{\parsearg\chapheadingzzz}
3780 \def\chapheadingzzz #1{\chapbreak %
3781 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3782 \parindent=0pt\raggedright
3783 \rm #1\hfill}}\bigskip \par\penalty 200}
3785 % @heading, @subheading, @subsubheading.
3786 \def\heading{\parsearg\plainsecheading}
3787 \def\subheading{\parsearg\plainsubsecheading}
3788 \def\subsubheading{\parsearg\plainsubsubsecheading}
3790 % These macros generate a chapter, section, etc. heading only
3791 % (including whitespace, linebreaking, etc. around it),
3792 % given all the information in convenient, parsed form.
3794 %%% Args are the skip and penalty (usually negative)
3795 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
3797 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
3799 %%% Define plain chapter starts, and page on/off switching for it
3800 % Parameter controlling skip before chapter headings (if needed)
3802 \newskip\chapheadingskip
3804 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
3805 \def\chappager{\par\vfill\supereject}
3806 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
3808 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
3811 \global\let\contentsalignmacro = \chappager
3812 \global\let\pchapsepmacro=\chapbreak
3813 \global\let\pagealignmacro=\chappager}
3816 \global\let\contentsalignmacro = \chappager
3817 \global\let\pchapsepmacro=\chappager
3818 \global\let\pagealignmacro=\chappager
3819 \global\def\HEADINGSon{\HEADINGSsingle}}
3822 \global\let\contentsalignmacro = \chapoddpage
3823 \global\let\pchapsepmacro=\chapoddpage
3824 \global\let\pagealignmacro=\chapoddpage
3825 \global\def\HEADINGSon{\HEADINGSdouble}}
3830 \global\let\chapmacro=\chfplain
3831 \global\let\unnumbchapmacro=\unnchfplain
3832 \global\let\centerchapmacro=\centerchfplain}
3834 % Plain chapter opening.
3835 % #1 is the text, #2 the chapter number or empty if unnumbered.
3841 \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
3842 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3843 \hangindent = \wd0 \centerparametersmaybe
3846 \nobreak\bigskip % no page break after a chapter title
3850 % Plain opening for unnumbered.
3851 \def\unnchfplain#1{\chfplain{#1}{}}
3853 % @centerchap -- centered and unnumbered.
3854 \let\centerparametersmaybe = \relax
3855 \def\centerchfplain#1{{%
3856 \def\centerparametersmaybe{%
3857 \advance\rightskip by 3\rightskip
3858 \leftskip = \rightskip
3864 \CHAPFplain % The default
3866 \def\unnchfopen #1{%
3867 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3868 \parindent=0pt\raggedright
3869 \rm #1\hfill}}\bigskip \par\nobreak
3872 \def\chfopen #1#2{\chapoddpage {\chapfonts
3873 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
3877 \def\centerchfopen #1{%
3878 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3880 \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
3884 \global\let\chapmacro=\chfopen
3885 \global\let\unnumbchapmacro=\unnchfopen
3886 \global\let\centerchapmacro=\centerchfopen}
3890 \newskip\secheadingskip
3891 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
3892 \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
3893 \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
3895 % Subsection titles.
3896 \newskip \subsecheadingskip
3897 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
3898 \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
3899 \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
3901 % Subsubsection titles.
3902 \let\subsubsecheadingskip = \subsecheadingskip
3903 \let\subsubsecheadingbreak = \subsecheadingbreak
3904 \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
3905 \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
3908 % Print any size section title.
3910 % #1 is the section type (sec/subsec/subsubsec), #2 is the section
3911 % number (maybe empty), #3 the text.
3912 \def\sectionheading#1#2#3{%
3914 \expandafter\advance\csname #1headingskip\endcsname by \parskip
3915 \csname #1headingbreak\endcsname
3918 % Switch to the right set of fonts.
3919 \csname #1fonts\endcsname \rm
3921 % Only insert the separating space if we have a section number.
3923 \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
3925 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3926 \hangindent = \wd0 % zero if no section number
3929 % Add extra space after the heading -- either a line space or a
3930 % paragraph space, whichever is more. (Some people like to set
3931 % \parskip to large values for some reason.)
3933 \ifdim\parskip>\normalbaselineskip
3936 \kern\normalbaselineskip
3943 % Table of contents.
3946 % Write an entry to the toc file, opening it if necessary.
3947 % Called from @chapter, etc. We supply {\folio} at the end of the
3948 % argument, which will end up as the last argument to the \...entry macro.
3950 % We open the .toc file here instead of at @setfilename or any other
3951 % fixed time so that @contents can be put in the document anywhere.
3953 \newif\iftocfileopened
3954 \def\writetocentry#1{%
3955 \iftocfileopened\else
3956 \immediate\openout\tocfile = \jobname.toc
3957 \global\tocfileopenedtrue
3959 \iflinks \write\tocfile{#1{\folio}}\fi
3961 % Tell \shipout to create a page destination if we're doing pdf, which
3962 % will be the target of the links in the table of contents. We can't
3963 % just do it on every page because the title pages are numbered 1 and
3964 % 2 (the page numbers aren't printed), and so are the first two pages
3965 % of the document. Thus, we'd have two destinations named `1', and
3967 \ifpdf \pdfmakepagedesttrue \fi
3970 \newskip\contentsrightmargin \contentsrightmargin=1in
3971 \newcount\savepageno
3972 \newcount\lastnegativepageno \lastnegativepageno = -1
3974 % Finish up the main text and prepare to read what we've written
3977 \def\startcontents#1{%
3978 % If @setchapternewpage on, and @headings double, the contents should
3979 % start on an odd page, unlike chapters. Thus, we maintain
3980 % \contentsalignmacro in parallel with \pagealignmacro.
3981 % From: Torbjorn Granlund <tege@matematik.su.se>
3983 \immediate\closeout\tocfile
3985 % Don't need to put `Contents' or `Short Contents' in the headline.
3986 % It is abundantly clear what they are.
3987 \unnumbchapmacro{#1}\def\thischapter{}%
3988 \savepageno = \pageno
3989 \begingroup % Set up to handle contents files properly.
3990 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
3991 % We can't do this, because then an actual ^ in a section
3992 % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
3993 %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3994 \raggedbottom % Worry more about breakpoints than the bottom.
3995 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3997 % Roman numerals for page numbers.
3998 \ifnum \pageno>0 \pageno = \lastnegativepageno \fi
4002 % Normal (long) toc.
4004 \startcontents{\putwordTOC}%
4005 \openin 1 \jobname.toc
4011 \contentsalignmacro % in case @setchapternewpage odd is in effect
4014 \lastnegativepageno = \pageno
4015 \pageno = \savepageno
4018 % And just the chapters.
4019 \def\summarycontents{%
4020 \startcontents{\putwordShortTOC}%
4022 \let\chapentry = \shortchapentry
4023 \let\appendixentry = \shortappendixentry
4024 \let\unnumbchapentry = \shortunnumberedentry
4025 % We want a true roman here for the page numbers.
4027 \let\rm=\shortcontrm \let\bf=\shortcontbf
4028 \let\sl=\shortcontsl \let\tt=\shortconttt
4030 \hyphenpenalty = 10000
4031 \advance\baselineskip by 1pt % Open it up a little.
4032 \def\secentry ##1##2##3##4{}
4033 \def\subsecentry ##1##2##3##4##5{}
4034 \def\subsubsecentry ##1##2##3##4##5##6{}
4035 \let\unnumbsecentry = \secentry
4036 \let\unnumbsubsecentry = \subsecentry
4037 \let\unnumbsubsubsecentry = \subsubsecentry
4038 \openin 1 \jobname.toc
4044 \contentsalignmacro % in case @setchapternewpage odd is in effect
4046 \lastnegativepageno = \pageno
4047 \pageno = \savepageno
4049 \let\shortcontents = \summarycontents
4052 \pdfcatalog{/PageMode /UseOutlines}%
4055 % These macros generate individual entries in the table of contents.
4056 % The first argument is the chapter or section name.
4057 % The last argument is the page number.
4058 % The arguments in between are the chapter number, section number, ...
4060 % Chapters, in the main contents.
4061 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
4063 % Chapters, in the short toc.
4064 % See comments in \dochapentry re vbox and related settings.
4065 \def\shortchapentry#1#2#3{%
4066 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}%
4069 % Appendices, in the main contents.
4070 \def\appendixentry#1#2#3{%
4071 \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}}
4073 % Appendices, in the short toc.
4074 \let\shortappendixentry = \shortchapentry
4076 % Typeset the label for a chapter or appendix for the short contents.
4077 % The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter.
4078 % We could simplify the code here by writing out an \appendixentry
4079 % command in the toc file for appendices, instead of using \chapentry
4080 % for both, but it doesn't seem worth it.
4082 \newdimen\shortappendixwidth
4084 \def\shortchaplabel#1{%
4085 % This space should be enough, since a single number is .5em, and the
4086 % widest letter (M) is 1em, at least in the Computer Modern fonts.
4087 % But use \hss just in case.
4088 % (This space doesn't include the extra space that gets added after
4089 % the label; that gets put in by \shortchapentry above.)
4091 \hbox to \dimen0{#1\hss}%
4094 % Unnumbered chapters.
4095 \def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}}
4096 \def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}}
4099 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
4100 \def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}}
4103 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
4104 \def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}}
4106 % And subsubsections.
4107 \def\subsubsecentry#1#2#3#4#5#6{%
4108 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
4109 \def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}}
4111 % This parameter controls the indentation of the various levels.
4112 \newdimen\tocindent \tocindent = 3pc
4114 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
4117 % If the toc has to be broken over pages, we want it to be at chapters
4118 % if at all possible; hence the \penalty.
4119 \def\dochapentry#1#2{%
4120 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
4123 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
4125 \nobreak\vskip .25\baselineskip plus.1\baselineskip
4128 \def\dosecentry#1#2{\begingroup
4129 \secentryfonts \leftskip=\tocindent
4130 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
4133 \def\dosubsecentry#1#2{\begingroup
4134 \subsecentryfonts \leftskip=2\tocindent
4135 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
4138 \def\dosubsubsecentry#1#2{\begingroup
4139 \subsubsecentryfonts \leftskip=3\tocindent
4140 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
4143 % Final typesetting of a toc entry; we use the same \entry macro as for
4144 % the index entries, but we want to suppress hyphenation here. (We
4145 % can't do that in the \entry macro, since index entries might consist
4146 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
4147 \def\tocentry#1#2{\begingroup
4148 \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
4149 % Do not use \turnoffactive in these arguments. Since the toc is
4150 % typeset in cmr, characters such as _ would come out wrong; we
4151 % have to do the usual translation tricks.
4155 % Space between chapter (or whatever) number and the title.
4156 \def\labelspace{\hskip1em \relax}
4158 \def\dopageno#1{{\rm #1}}
4159 \def\doshortpageno#1{{\rm #1}}
4161 \def\chapentryfonts{\secfonts \rm}
4162 \def\secentryfonts{\textfonts}
4163 \let\subsecentryfonts = \textfonts
4164 \let\subsubsecentryfonts = \textfonts
4167 \message{environments,}
4168 % @foo ... @end foo.
4170 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
4172 % Since these characters are used in examples, it should be an even number of
4173 % \tt widths. Each \tt character is 1en, so two makes it 1em.
4176 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
4177 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
4178 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
4179 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
4181 % The @error{} command.
4182 % Adapted from the TeXbook's \boxit.
4186 {\tentt \global\dimen0 = 3em}% Width of the box.
4187 \dimen2 = .55pt % Thickness of rules
4188 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
4189 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
4191 \global\setbox\errorbox=\hbox to \dimen0{\hfil
4192 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
4193 \advance\hsize by -2\dimen2 % Rules.
4195 \hrule height\dimen2
4196 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
4197 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
4198 \kern3pt\vrule width\dimen2}% Space to right.
4199 \hrule height\dimen2}
4202 \def\error{\leavevmode\lower.7ex\copy\errorbox}
4204 % @tex ... @end tex escapes into raw Tex temporarily.
4205 % One exception: @ is still an escape character, so that @end tex works.
4206 % But \@ or @@ will get a plain tex @ character.
4208 \def\tex{\begingroup
4209 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
4210 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
4211 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
4213 \catcode 43=12 % plus
4222 \let\bullet=\ptexbullet
4227 \let\equiv=\ptexequiv
4236 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
4237 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
4239 \let\Etex=\endgroup}
4241 % Define @lisp ... @end lisp.
4242 % @lisp does a \begingroup so it can rebind things,
4243 % including the definition of @end lisp (which normally is erroneous).
4245 % Amount to narrow the margins by for @lisp.
4246 \newskip\lispnarrowing \lispnarrowing=0.4in
4248 % This is the definition that ^^M gets inside @lisp, @example, and other
4249 % such environments. \null is better than a space, since it doesn't
4251 \def\lisppar{\null\endgraf}
4253 % Make each space character in the input produce a normal interword
4254 % space in the output. Don't allow a line break at this space, as this
4255 % is used only in environments like @example, where each line of input
4256 % should produce a line of output anyway.
4259 \gdef\sepspaces{\obeyspaces\let =\tie}}
4261 % Define \obeyedspace to be our active space, whatever it is. This is
4262 % for use in \parsearg.
4264 \global\let\obeyedspace= }
4266 % This space is always present above and below environments.
4267 \newskip\envskipamount \envskipamount = 0pt
4269 % Make spacing and below environment symmetrical. We use \parskip here
4270 % to help in doing that, since in @example-like environments \parskip
4271 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
4272 % start of the next paragraph will insert \parskip.
4274 \def\aboveenvbreak{{%
4275 \ifnum\lastpenalty < 10000
4276 \advance\envskipamount by \parskip
4278 \ifdim\lastskip<\envskipamount
4281 \vskip\envskipamount
4286 \let\afterenvbreak = \aboveenvbreak
4288 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
4289 \let\nonarrowing=\relax
4291 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
4292 % environment contents.
4293 \font\circle=lcircle10
4295 \newdimen\cartouter\newdimen\cartinner
4296 \newskip\normbskip\newskip\normpskip\newskip\normlskip
4297 \circthick=\fontdimen8\circle
4299 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
4300 \def\ctr{{\hskip 6pt\circle\char'010}}
4301 \def\cbl{{\circle\char'012\hskip -6pt}}
4302 \def\cbr{{\hskip 6pt\circle\char'011}}
4303 \def\carttop{\hbox to \cartouter{\hskip\lskip
4304 \ctl\leaders\hrule height\circthick\hfil\ctr
4306 \def\cartbot{\hbox to \cartouter{\hskip\lskip
4307 \cbl\leaders\hrule height\circthick\hfil\cbr
4310 \newskip\lskip\newskip\rskip
4312 \long\def\cartouche{%
4314 \lskip=\leftskip \rskip=\rightskip
4315 \leftskip=0pt\rightskip=0pt %we want these *outside*.
4316 \cartinner=\hsize \advance\cartinner by-\lskip
4317 \advance\cartinner by-\rskip
4319 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
4320 % side, and for 6pt waste from
4321 % each corner char, and rule thickness
4322 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
4323 % Flag to tell @lisp, etc., not to narrow margin.
4324 \let\nonarrowing=\comment
4326 \baselineskip=0pt\parskip=0pt\lineskip=0pt
4335 \baselineskip=\normbskip
4336 \lineskip=\normlskip
4352 % This macro is called at the beginning of all the @example variants,
4356 \inENV % This group ends at the end of the body
4357 \hfuzz = 12pt % Don't be fussy
4358 \sepspaces % Make spaces be word-separators rather than space tokens.
4359 \let\par = \lisppar % don't ignore blank lines
4360 \obeylines % each line of input is a line of output
4363 \emergencystretch = 0pt % don't try to avoid overfull boxes
4364 % @cartouche defines \nonarrowing to inhibit narrowing
4365 % at next level down.
4366 \ifx\nonarrowing\relax
4367 \advance \leftskip by \lispnarrowing
4368 \exdentamount=\lispnarrowing
4369 \let\exdent=\nofillexdent
4370 \let\nonarrowing=\relax
4374 % Define the \E... control sequence only if we are inside the particular
4375 % environment, so the error checking in \end will work.
4377 % To end an @example-like environment, we first end the paragraph (via
4378 % \afterenvbreak's vertical glue), and then the group. That way we keep
4379 % the zero \parskip that the environments set -- \parskip glue will be
4380 % inserted at the beginning of the next paragraph in the document, after
4383 \def\nonfillfinish{\afterenvbreak\endgroup}
4385 % @lisp: indented, narrowed, typewriter font.
4386 \def\lisp{\begingroup
4388 \let\Elisp = \nonfillfinish
4390 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
4391 \gobble % eat return
4394 % @example: Same as @lisp.
4395 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
4397 % @small... is usually equivalent to the non-small (@smallbook
4398 % redefines). We must call \example (or whatever) last in the
4399 % definition, since it reads the return following the @example (or
4400 % whatever) command.
4402 % This actually allows (for example) @end display inside an
4403 % @smalldisplay. Too bad, but makeinfo will catch the error anyway.
4405 \def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display}
4406 \def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp}
4407 \def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format}
4408 \def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
4410 % Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
4411 % Originally contributed by Pavel@xerox.
4412 \def\smalllispx{\begingroup
4413 \def\Esmalllisp{\nonfillfinish\endgroup}%
4414 \def\Esmallexample{\nonfillfinish\endgroup}%
4419 % @display: same as @lisp except keep current font.
4421 \def\display{\begingroup
4423 \let\Edisplay = \nonfillfinish
4427 % @smalldisplay (when @smallbook): @display plus smaller fonts.
4429 \def\smalldisplayx{\begingroup
4430 \def\Esmalldisplay{\nonfillfinish\endgroup}%
4431 \smallexamplefonts \rm
4435 % @format: same as @display except don't narrow margins.
4437 \def\format{\begingroup
4438 \let\nonarrowing = t
4440 \let\Eformat = \nonfillfinish
4444 % @smallformat (when @smallbook): @format plus smaller fonts.
4446 \def\smallformatx{\begingroup
4447 \def\Esmallformat{\nonfillfinish\endgroup}%
4448 \smallexamplefonts \rm
4452 % @flushleft (same as @format).
4454 \def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
4458 \def\flushright{\begingroup
4459 \let\nonarrowing = t
4461 \let\Eflushright = \nonfillfinish
4462 \advance\leftskip by 0pt plus 1fill
4467 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
4468 % and narrows the margins.
4471 \begingroup\inENV %This group ends at the end of the @quotation body
4472 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
4474 % We have retained a nonzero parskip for the environment, since we're
4475 % doing normal filling. So to avoid extra space below the environment...
4476 \def\Equotation{\parskip = 0pt \nonfillfinish}%
4478 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
4479 \ifx\nonarrowing\relax
4480 \advance\leftskip by \lispnarrowing
4481 \advance\rightskip by \lispnarrowing
4482 \exdentamount = \lispnarrowing
4483 \let\nonarrowing = \relax
4488 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
4489 % If we want to allow any <char> as delimiter,
4490 % we need the curly braces so that makeinfo sees the @verb command, eg:
4491 % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
4493 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
4495 % [Knuth] p. 344; only we need to do '@' too
4497 \do\ \do\\\do\@\do\{\do\}\do\$\do\&%
4498 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}
4501 \def\uncatcodespecials{%
4502 \def\do##1{\catcode`##1=12}\dospecials}
4504 % [Knuth] pp. 380,381,391
4505 % Disable Spanish ligatures ?` and !` of \tt font
4507 \catcode`\`=\active\gdef`{\relax\lq}
4510 % Setup for the @verb command.
4512 % Eight spaces for a tab
4514 \catcode`\^^I=\active
4515 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
4519 \tt % easiest (and conventionally used) font for verbatim
4520 \def\par{\leavevmode\endgraf}%
4523 % Respect line breaks,
4524 % print special symbols as themselves, and
4525 % make each space count
4526 % must do in this order:
4527 \obeylines \uncatcodespecials \sepspaces
4530 % Setup for the @verbatim environment
4532 % Real tab expansion
4533 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
4535 \def\starttabbox{\setbox0=\hbox\bgroup}
4537 \catcode`\^^I=\active
4539 \catcode`\^^I=\active
4540 \def^^I{\leavevmode\egroup
4541 \dimen0=\wd0 % the width so far, or since the previous tab
4542 \divide\dimen0 by\tabw
4543 \multiply\dimen0 by\tabw % compute previous multiple of \tabw
4544 \advance\dimen0 by\tabw % advance to next multiple of \tabw
4545 \wd0=\dimen0 \box0 \starttabbox
4549 \def\setupverbatim{%
4550 % Easiest (and conventionally used) font for verbatim
4552 \def\par{\leavevmode\egroup\box0\endgraf}%
4555 % Respect line breaks,
4556 % print special symbols as themselves, and
4557 % make each space count
4558 % must do in this order:
4559 \obeylines \uncatcodespecials \sepspaces
4560 \everypar{\starttabbox}%
4563 % Do the @verb magic: verbatim text is quoted by unique
4564 % delimiter characters. Before first delimiter expect a
4565 % right brace, after last delimiter expect closing brace:
4567 % \def\doverb'{'<char>#1<char>'}'{#1}
4569 % [Knuth] p. 382; only eat outer {}
4571 \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
4572 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
4575 \def\verb{\begingroup\setupverb\doverb}
4578 % Do the @verbatim magic: define the macro \doverbatim so that
4579 % the (first) argument ends when '@end verbatim' is reached, ie:
4581 % \def\doverbatim#1@end verbatim{#1}
4583 % For Texinfo it's a lot easier than for LaTeX,
4584 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
4585 % we need not redefine '\', '{' and '}'
4587 % Inspired by LaTeX's verbatim command set [latex.ltx]
4588 %% Include LaTeX hack for completeness -- never know
4590 %% \catcode`|=0 \catcode`[=1
4591 %% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active
4592 %% \catcode`\\=12|gdef|doverbatim#1@end verbatim[
4593 %% #1|endgroup|def|Everbatim[]|end[verbatim]]
4597 \gdef\doverbatim#1@end verbatim{#1\end{verbatim}}
4601 \def\Everbatim{\nonfillfinish\endgroup}%
4604 \advance\leftskip by -\defbodyindent
4605 \begingroup\setupverbatim\doverbatim
4608 % @verbatiminclude FILE - insert text of file in verbatim environment.
4610 % Allow normal characters that we make active in the argument (a file name).
4611 \def\verbatiminclude{%
4621 \parsearg\doverbatiminclude
4623 \def\setupverbatiminclude{%
4626 \advance\leftskip by -\defbodyindent
4627 \begingroup\setupverbatim
4630 \def\doverbatiminclude#1{%
4631 % Restore active chars for included file.
4635 \expandafter\expandafter\setupverbatiminclude\input\thisfile
4636 \endgroup\nonfillfinish\endgroup
4639 % @copying ... @end copying.
4640 % Save the text away for @insertcopying later. Many commands won't be
4641 % allowed in this context, but that's ok.
4643 % We save the uninterpreted tokens, rather than creating a box.
4644 % Saving the text in a box would be much easier, but then all the
4645 % typesetting commands (@smallbook, font changes, etc.) have to be done
4646 % beforehand -- and a) we want @copying to be done first in the source
4647 % file; b) letting users define the frontmatter in as flexible order as
4648 % possible is very desirable.
4650 \def\copying{\begingroup
4651 % Define a command to swallow text until we reach `@end copying'.
4652 % \ is the escape char in this texinfo.tex file, so it is the
4653 % delimiter for the command; @ will be the escape char when we read
4654 % it, but that doesn't matter.
4655 \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}%
4657 % We must preserve ^^M's in the input file; see \insertcopying below.
4658 \catcode`\^^M = \active
4662 % What we do to finish off the copying text.
4664 \def\enddocopying{\endgroup\ignorespaces}
4666 % @insertcopying. Here we must play games with ^^M's. On the one hand,
4667 % we need them to delimit commands such as `@end quotation', so they
4668 % must be active. On the other hand, we certainly don't want every
4669 % end-of-line to be a \par, as would happen with the normal active
4670 % definition of ^^M. On the third hand, two ^^M's in a row should still
4673 % Our approach is to make ^^M insert a space and a penalty1 normally;
4674 % then it can also check if \lastpenalty=1. If it does, then manually
4677 % Seems pretty fragile, but for the limited use of getting the copying
4678 % text (which should be quite simple) inserted, we can hope it's ok.
4680 {\catcode`\^^M=\active %
4681 \gdef\insertcopying{\begingroup %
4682 \parindent = 0pt % looks wrong on title page
4684 \ifnum \lastpenalty=1 %
4697 % Allow user to change definition object font (\df) internally
4698 \def\setdeffont#1 {\csname DEF#1\endcsname}
4700 \newskip\defbodyindent \defbodyindent=.4in
4701 \newskip\defargsindent \defargsindent=50pt
4702 \newskip\deflastargmargin \deflastargmargin=18pt
4704 \newcount\parencount
4706 % We want ()&[] to print specially on the defun line.
4709 \catcode`\(=\active \catcode`\)=\active
4711 \catcode`\[=\active \catcode`\]=\active
4714 % Make control sequences which act like normal parenthesis chars.
4715 \let\lparen = ( \let\rparen = )
4717 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
4719 % Be sure that we always have a definition for `(', etc. For example,
4720 % if the fn name has parens in it, \boldbrax will not be in effect yet,
4721 % so TeX would otherwise complain about undefined control sequence.
4722 \global\let(=\lparen \global\let)=\rparen
4723 \global\let[=\lbrack \global\let]=\rbrack
4725 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
4726 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
4727 % This is used to turn on special parens
4728 % but make & act ordinary (given that it's active).
4729 \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
4731 % Definitions of (, ) and & used in args for functions.
4732 % This is the definition of ( outside of all parentheses.
4733 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
4734 \global\advance\parencount by 1
4737 % This is the definition of ( when already inside a level of parens.
4738 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
4740 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
4741 % also in that case restore the outer-level definition of (.
4742 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
4743 \global\advance \parencount by -1 }
4744 % If we encounter &foo, then turn on ()-hacking afterwards
4745 \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
4747 \gdef\normalparens{\boldbrax\let&=\ampnr}
4748 } % End of definition inside \activeparens
4749 %% These parens (in \boldbrax) actually are a little bolder than the
4750 %% contained text. This is especially needed for [ and ]
4751 \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
4752 \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
4754 \def\lbrb{{\bf\char`\[}}
4755 \def\rbrb{{\bf\char`\]}}
4757 % Active &'s sneak into the index arguments, so make sure it's defined.
4760 \global\let& = \ampnr
4763 % \defname, which formats the name of the @def (not the args).
4764 % #1 is the function name.
4765 % #2 is the type of definition, such as "Function".
4768 % How we'll output the type name. Putting it in brackets helps
4769 % distinguish it from the body text that may end up on the next line
4774 \def\defnametype{[\rm #2]}%
4777 % Get the values of \leftskip and \rightskip as they were outside the @def...
4779 \advance\dimen2 by -\defbodyindent
4781 % Figure out values for the paragraph shape.
4782 \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}%
4783 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
4784 \dimen1=\hsize \advance \dimen1 by -\defargsindent % size for continuations
4785 \parshape 2 0in \dimen0 \defargsindent \dimen1
4787 % Output arg 2 ("Function" or some such) but stuck inside a box of
4788 % width 0 so it does not interfere with linebreaking.
4791 {% Adjust \hsize to exclude the ambient margins,
4792 % so that \rightline will obey them.
4793 \advance \hsize by -\dimen2
4794 \dimen3 = 0pt % was -1.25pc
4795 \rlap{\rightline{\defnametype\kern\dimen3}}%
4798 % Allow all lines to be underfull without complaint:
4799 \tolerance=10000 \hbadness=10000
4800 \advance\leftskip by -\defbodyindent
4801 \exdentamount=\defbodyindent
4802 {\df #1}\enskip % output function name
4803 % \defunargs will be called next to output the arguments, if any.
4806 % Common pieces to start any @def...
4807 % #1 is the \E... control sequence to end the definition (which we define).
4808 % #2 is the \...x control sequence (which our caller defines).
4809 % #3 is the control sequence to process the header, such as \defunheader.
4811 \def\parsebodycommon#1#2#3{%
4813 % If there are two @def commands in a row, we'll have a \nobreak,
4814 % which is there to keep the function description together with its
4815 % header. But if there's nothing but headers, we want to allow a
4817 \ifnum\lastpenalty=10000 \penalty0 \fi
4820 % Define the \E... end token that this defining construct specifies
4821 % so that it will exit this group.
4822 \def#1{\endgraf\endgroup\medbreak}%
4825 \advance\leftskip by \defbodyindent
4826 \exdentamount=\defbodyindent
4829 % Common part of the \...x definitions.
4831 \def\defxbodycommon{%
4832 % As with \parsebodycommon above, allow line break if we have multiple
4833 % x headers in a row. It's not a great place, though.
4834 \ifnum\lastpenalty=10000 \penalty1000 \fi
4836 \begingroup\obeylines
4839 % Process body of @defun, @deffn, @defmac, etc.
4841 \def\defparsebody#1#2#3{%
4842 \parsebodycommon{#1}{#2}{#3}%
4843 \def#2{\defxbodycommon \activeparens \spacesplit#3}%
4844 \catcode61=\active % 61 is `='
4845 \begingroup\obeylines\activeparens
4849 % #1, #2, #3 are the common arguments (see \parsebodycommon above).
4850 % #4, delimited by the space, is the class name.
4852 \def\defmethparsebody#1#2#3#4 {%
4853 \parsebodycommon{#1}{#2}{#3}%
4854 \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}%
4855 \begingroup\obeylines\activeparens
4856 % The \empty here prevents misinterpretation of a construct such as
4857 % @deffn {whatever} {Enharmonic comma}
4858 % See comments at \deftpparsebody, although in our case we don't have
4859 % to remove the \empty afterwards, since it is empty.
4860 \spacesplit{#3{#4}}\empty
4863 % Used for @deftypemethod and @deftypeivar.
4864 % #1, #2, #3 are the common arguments (see \defparsebody).
4865 % #4, delimited by a space, is the class name.
4866 % #5 is the method's return type.
4868 \def\deftypemethparsebody#1#2#3#4 #5 {%
4869 \parsebodycommon{#1}{#2}{#3}%
4870 \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}%
4871 \begingroup\obeylines\activeparens
4872 \spacesplit{#3{#4}{#5}}%
4875 % Used for @deftypeop. The change from \deftypemethparsebody is an
4876 % extra argument at the beginning which is the `category', instead of it
4877 % being the hardwired string `Method' or `Instance Variable'. We have
4878 % to account for this both in the \...x definition and in parsing the
4879 % input at hand. Thus also need a control sequence (passed as #5) for
4880 % the \E... definition to assign the category name to.
4882 \def\deftypeopparsebody#1#2#3#4#5 #6 {%
4883 \parsebodycommon{#1}{#2}{#3}%
4884 \def#2##1 ##2 ##3 {\def#4{##1}%
4885 \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}%
4886 \begingroup\obeylines\activeparens
4887 \spacesplit{#3{#5}{#6}}%
4891 \def\defopparsebody #1#2#3#4#5 {%
4892 \parsebodycommon{#1}{#2}{#3}%
4893 \def#2##1 ##2 {\def#4{##1}%
4894 \defxbodycommon \activeparens \spacesplit{#3{##2}}}%
4895 \begingroup\obeylines\activeparens
4896 \spacesplit{#3{#5}}%
4899 % These parsing functions are similar to the preceding ones
4900 % except that they do not make parens into active characters.
4901 % These are used for "variables" since they have no arguments.
4903 \def\defvarparsebody #1#2#3{%
4904 \parsebodycommon{#1}{#2}{#3}%
4905 \def#2{\defxbodycommon \spacesplit#3}%
4906 \catcode61=\active %
4907 \begingroup\obeylines
4912 \def\defopvarparsebody #1#2#3#4#5 {%
4913 \parsebodycommon{#1}{#2}{#3}%
4914 \def#2##1 ##2 {\def#4{##1}%
4915 \defxbodycommon \spacesplit{#3{##2}}}%
4916 \begingroup\obeylines
4917 \spacesplit{#3{#5}}%
4920 \def\defvrparsebody#1#2#3#4 {%
4921 \parsebodycommon{#1}{#2}{#3}%
4922 \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
4923 \begingroup\obeylines
4924 \spacesplit{#3{#4}}%
4927 % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
4928 % type is just `struct', because we lose the braces in `{struct
4929 % termios}' when \spacesplit reads its undelimited argument. Sigh.
4930 % \let\deftpparsebody=\defvrparsebody
4932 % So, to get around this, we put \empty in with the type name. That
4933 % way, TeX won't find exactly `{...}' as an undelimited argument, and
4934 % won't strip off the braces.
4936 \def\deftpparsebody #1#2#3#4 {%
4937 \parsebodycommon{#1}{#2}{#3}%
4938 \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
4939 \begingroup\obeylines
4940 \spacesplit{\parsetpheaderline{#3{#4}}}\empty
4943 % Fine, but then we have to eventually remove the \empty *and* the
4944 % braces (if any). That's what this does.
4946 \def\removeemptybraces\empty#1\relax{#1}
4948 % After \spacesplit has done its work, this is called -- #1 is the final
4949 % thing to call, #2 the type name (which starts with \empty), and #3
4950 % (which might be empty) the arguments.
4952 \def\parsetpheaderline#1#2#3{%
4953 #1{\removeemptybraces#2\relax}{#3}%
4956 % Split up #2 (the rest of the input line) at the first space token.
4957 % call #1 with two arguments:
4958 % the first is all of #2 before the space token,
4959 % the second is all of #2 after that space token.
4960 % If #2 contains no space token, all of it is passed as the first arg
4961 % and the second is passed as empty.
4964 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}%
4965 \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{%
4975 % First, define the processing that is wanted for arguments of \defun
4976 % Use this to expand the args and terminate the paragraph they make up
4978 \def\defunargs#1{\functionparens \sl
4979 % Expand, preventing hyphenation at `-' chars.
4980 % Note that groups don't affect changes in \hyphenchar.
4981 % Set the font temporarily and use \font in case \setfont made \tensl a macro.
4982 {\tensl\hyphenchar\font=0}%
4984 {\tensl\hyphenchar\font=45}%
4985 \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
4986 \interlinepenalty=10000
4987 \advance\rightskip by 0pt plus 1fil
4988 \endgraf\nobreak\vskip -\parskip\nobreak
4991 \def\deftypefunargs #1{%
4992 % Expand, preventing hyphenation at `-' chars.
4993 % Note that groups don't affect changes in \hyphenchar.
4994 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
4996 \tclose{#1}% avoid \code because of side effects on active chars
4997 \interlinepenalty=10000
4998 \advance\rightskip by 0pt plus 1fil
4999 \endgraf\nobreak\vskip -\parskip\nobreak
5002 % Do complete processing of one @defun or @defunx line already parsed.
5004 % @deffn Command forward-char nchars
5006 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
5008 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
5009 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
5010 \catcode 61=\other % Turn off change made in \defparsebody
5013 % @defun == @deffn Function
5015 \def\defun{\defparsebody\Edefun\defunx\defunheader}
5017 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
5018 \begingroup\defname {#1}{\putwordDeffunc}%
5019 \defunargs {#2}\endgroup %
5020 \catcode 61=\other % Turn off change made in \defparsebody
5023 % @deftypefun int foobar (int @var{foo}, float @var{bar})
5025 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
5027 % #1 is the data type. #2 is the name and args.
5028 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
5029 % #1 is the data type, #2 the name, #3 the args.
5030 \def\deftypefunheaderx #1#2 #3\relax{%
5031 \doind {fn}{\code{#2}}% Make entry in function index
5032 \begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}%
5033 \deftypefunargs {#3}\endgroup %
5034 \catcode 61=\other % Turn off change made in \defparsebody
5037 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
5039 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
5041 % \defheaderxcond#1\relax$.$
5042 % puts #1 in @code, followed by a space, but does nothing if #1 is null.
5043 \def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi}
5045 % #1 is the classification. #2 is the data type. #3 is the name and args.
5046 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
5047 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
5048 \def\deftypefnheaderx #1#2#3 #4\relax{%
5049 \doind {fn}{\code{#3}}% Make entry in function index
5051 \normalparens % notably, turn off `&' magic, which prevents
5052 % at least some C++ text from working
5053 \defname {\defheaderxcond#2\relax$.$#3}{#1}%
5054 \deftypefunargs {#4}\endgroup %
5055 \catcode 61=\other % Turn off change made in \defparsebody
5058 % @defmac == @deffn Macro
5060 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
5062 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
5063 \begingroup\defname {#1}{\putwordDefmac}%
5064 \defunargs {#2}\endgroup %
5065 \catcode 61=\other % Turn off change made in \defparsebody
5068 % @defspec == @deffn Special Form
5070 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
5072 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
5073 \begingroup\defname {#1}{\putwordDefspec}%
5074 \defunargs {#2}\endgroup %
5075 \catcode 61=\other % Turn off change made in \defparsebody
5078 % @defop CATEGORY CLASS OPERATION ARG...
5080 \def\defop #1 {\def\defoptype{#1}%
5081 \defopparsebody\Edefop\defopx\defopheader\defoptype}
5083 \def\defopheader#1#2#3{%
5084 \dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index
5085 \begingroup\defname {#2}{\defoptype\ \putwordon\ #1}%
5086 \defunargs {#3}\endgroup %
5089 % @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
5091 \def\deftypeop #1 {\def\deftypeopcategory{#1}%
5092 \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
5095 % #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
5096 \def\deftypeopheader#1#2#3#4{%
5097 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
5099 \defname{\defheaderxcond#2\relax$.$#3}
5100 {\deftypeopcategory\ \putwordon\ \code{#1}}%
5101 \deftypefunargs{#4}%
5105 % @deftypemethod CLASS TYPE METHOD ARG...
5107 \def\deftypemethod{%
5108 \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
5110 % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
5111 \def\deftypemethodheader#1#2#3#4{%
5112 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
5114 \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}%
5115 \deftypefunargs{#4}%
5119 % @deftypeivar CLASS TYPE VARNAME
5122 \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
5124 % #1 is the class name, #2 the data type, #3 the variable name.
5125 \def\deftypeivarheader#1#2#3{%
5126 \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
5128 \defname{\defheaderxcond#2\relax$.$#3}
5129 {\putwordInstanceVariableof\ \code{#1}}%
5134 % @defmethod == @defop Method
5136 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
5138 % #1 is the class name, #2 the method name, #3 the args.
5139 \def\defmethodheader#1#2#3{%
5140 \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
5142 \defname{#2}{\putwordMethodon\ \code{#1}}%
5147 % @defcv {Class Option} foo-class foo-flag
5149 \def\defcv #1 {\def\defcvtype{#1}%
5150 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
5152 \def\defcvarheader #1#2#3{%
5153 \dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index
5154 \begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}%
5155 \defvarargs {#3}\endgroup %
5158 % @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
5160 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
5162 \def\defivarheader#1#2#3{%
5163 \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index
5165 \defname{#2}{\putwordInstanceVariableof\ #1}%
5171 % First, define the processing that is wanted for arguments of @defvar.
5172 % This is actually simple: just print them in roman.
5173 % This must expand the args and terminate the paragraph they make up
5174 \def\defvarargs #1{\normalparens #1%
5175 \interlinepenalty=10000
5176 \endgraf\nobreak\vskip -\parskip\nobreak}
5178 % @defvr Counter foo-count
5180 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
5182 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
5183 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
5185 % @defvar == @defvr Variable
5187 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
5189 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
5190 \begingroup\defname {#1}{\putwordDefvar}%
5191 \defvarargs {#2}\endgroup %
5194 % @defopt == @defvr {User Option}
5196 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
5198 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
5199 \begingroup\defname {#1}{\putwordDefopt}%
5200 \defvarargs {#2}\endgroup %
5203 % @deftypevar int foobar
5205 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
5207 % #1 is the data type. #2 is the name, perhaps followed by text that
5208 % is actually part of the data type, which should not be put into the index.
5209 \def\deftypevarheader #1#2{%
5210 \dovarind#2 \relax% Make entry in variables index
5211 \begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}%
5212 \interlinepenalty=10000
5213 \endgraf\nobreak\vskip -\parskip\nobreak
5215 \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
5217 % @deftypevr {Global Flag} int enable
5219 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
5221 \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
5222 \begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1}
5223 \interlinepenalty=10000
5224 \endgraf\nobreak\vskip -\parskip\nobreak
5228 % Args are printed in bold, a slight difference from @defvar.
5230 \def\deftpargs #1{\bf \defvarargs{#1}}
5232 % @deftp Class window height width ...
5234 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
5236 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
5237 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
5239 % These definitions are used if you use @defunx (etc.)
5240 % anywhere other than immediately after a @defun or @defunx.
5242 \def\defcvx#1 {\errmessage{@defcvx in invalid context}}
5243 \def\deffnx#1 {\errmessage{@deffnx in invalid context}}
5244 \def\defivarx#1 {\errmessage{@defivarx in invalid context}}
5245 \def\defmacx#1 {\errmessage{@defmacx in invalid context}}
5246 \def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
5247 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
5248 \def\defopx#1 {\errmessage{@defopx in invalid context}}
5249 \def\defspecx#1 {\errmessage{@defspecx in invalid context}}
5250 \def\deftpx#1 {\errmessage{@deftpx in invalid context}}
5251 \def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
5252 \def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
5253 \def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
5254 \def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
5255 \def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
5256 \def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
5257 \def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
5258 \def\defunx#1 {\errmessage{@defunx in invalid context}}
5259 \def\defvarx#1 {\errmessage{@defvarx in invalid context}}
5260 \def\defvrx#1 {\errmessage{@defvrx in invalid context}}
5266 % To do this right we need a feature of e-TeX, \scantokens,
5267 % which we arrange to emulate with a temporary file in ordinary TeX.
5268 \ifx\eTeXversion\undefined
5269 \newwrite\macscribble
5271 \begingroup \newlinechar`\^^M
5272 % Undo catcode changes of \startcontents and \doprintindex
5273 \catcode`\@=0 \catcode`\\=12 \escapechar=`\@
5274 % Append \endinput to make sure that TeX does not see the ending newline.
5275 \toks0={#1\endinput}%
5276 \immediate\openout\macscribble=\jobname.tmp
5277 \immediate\write\macscribble{\the\toks0}%
5278 \immediate\closeout\macscribble
5279 \let\xeatspaces\eatspaces
5285 \begingroup \newlinechar`\^^M
5286 % Undo catcode changes of \startcontents and \doprintindex
5287 \catcode`\@=0 \catcode`\\=12 \escapechar=`\@
5288 \let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
5291 \newcount\paramno % Count of parameters
5292 \newtoks\macname % Macro name
5293 \newif\ifrecursive % Is it recursive?
5294 \def\macrolist{} % List of all defined macros in the form
5295 % \do\macro1\do\macro2...
5298 % Thisdoes \let #1 = #2, except with \csnames.
5300 \expandafter\expandafter
5302 \expandafter\expandafter
5304 \csname#2\endcsname}
5306 % Trim leading and trailing spaces off a string.
5307 % Concepts from aro-bend problem 15 (see CTAN).
5309 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
5310 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
5311 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
5313 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
5316 % Trim a single trailing ^^M off a string.
5317 {\catcode`\^^M=12\catcode`\Q=3%
5318 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
5319 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
5320 \gdef\eatcrb#1Q#2Q{#1}%
5323 % Macro bodies are absorbed as an argument in a context where
5324 % all characters are catcode 10, 11 or 12, except \ which is active
5325 % (as in normal texinfo). It is necessary to change the definition of \.
5327 % It's necessary to have hard CRs when the macro is executed. This is
5328 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
5329 % body, and then making it the \newlinechar in \scanmacro.
5331 \def\macrobodyctxt{%
5356 % \mbodybackslash is the definition of \ in @macro bodies.
5357 % It maps \foo\ => \csname macarg.foo\endcsname => #N
5358 % where N is the macro parameter number.
5359 % We define \csname macarg.\endcsname to be \realbackslash, so
5360 % \\ in macro replacement text gets you a backslash.
5362 {\catcode`@=0 @catcode`@\=@active
5363 @gdef@usembodybackslash{@let\=@mbodybackslash}
5364 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
5366 \expandafter\def\csname macarg.\endcsname{\realbackslash}
5368 \def\macro{\recursivefalse\parsearg\macroxxx}
5369 \def\rmacro{\recursivetrue\parsearg\macroxxx}
5372 \getargs{#1}% now \macname is the macname and \argl the arglist
5373 \ifx\argl\empty % no arguments
5376 \expandafter\parsemargdef \argl;%
5378 \if1\csname ismacro.\the\macname\endcsname
5379 \message{Warning: redefining \the\macname}%
5381 \expandafter\ifx\csname \the\macname\endcsname \relax
5382 \else \errmessage{Macro name \the\macname\space already defined}\fi
5383 \global\cslet{macsave.\the\macname}{\the\macname}%
5384 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
5385 % Add the macroname to \macrolist
5386 \toks0 = \expandafter{\macrolist\do}%
5387 \xdef\macrolist{\the\toks0
5388 \expandafter\noexpand\csname\the\macname\endcsname}%
5390 \begingroup \macrobodyctxt
5391 \ifrecursive \expandafter\parsermacbody
5392 \else \expandafter\parsemacbody
5395 \def\unmacro{\parsearg\unmacroxxx}
5397 \if1\csname ismacro.#1\endcsname
5398 \global\cslet{#1}{macsave.#1}%
5399 \global\expandafter\let \csname ismacro.#1\endcsname=0%
5400 % Remove the macro name from \macrolist
5402 \edef\tempa{\expandafter\noexpand\csname#1\endcsname}%
5408 \toks0 = \expandafter{\newmacrolist\do}%
5409 \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}%
5411 \def\newmacrolist{}%
5412 % Execute macro list to define \newmacrolist
5414 \global\let\macrolist\newmacrolist
5417 \errmessage{Macro #1 not defined}%
5421 % This makes use of the obscure feature that if the last token of a
5422 % <parameter list> is #, then the preceding argument is delimited by
5423 % an opening brace, and that opening brace is not consumed.
5424 \def\getargs#1{\getargsxxx#1{}}
5425 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
5426 \def\getmacname #1 #2\relax{\macname={#1}}
5427 \def\getmacargs#1{\def\argl{#1}}
5429 % Parse the optional {params} list. Set up \paramno and \paramlist
5430 % so \defmacro knows what to do. Define \macarg.blah for each blah
5431 % in the params list, to be ##N where N is the position in that list.
5432 % That gets used by \mbodybackslash (above).
5434 % We need to get `macro parameter char #' into several definitions.
5435 % The technique used is stolen from LaTeX: let \hash be something
5436 % unexpandable, insert that wherever you need a #, and then redefine
5437 % it to # just before using the token list produced.
5439 % The same technique is used to protect \eatspaces till just before
5440 % the macro is used.
5442 \def\parsemargdef#1;{\paramno=0\def\paramlist{}%
5443 \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
5444 \def\parsemargdefxxx#1,{%
5445 \if#1;\let\next=\relax
5446 \else \let\next=\parsemargdefxxx
5447 \advance\paramno by 1%
5448 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
5449 {\xeatspaces{\hash\the\paramno}}%
5450 \edef\paramlist{\paramlist\hash\the\paramno,}%
5453 % These two commands read recursive and nonrecursive macro bodies.
5454 % (They're different since rec and nonrec macros end differently.)
5456 \long\def\parsemacbody#1@end macro%
5457 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
5458 \long\def\parsermacbody#1@end rmacro%
5459 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
5461 % This defines the macro itself. There are six cases: recursive and
5462 % nonrecursive macros of zero, one, and many arguments.
5463 % Much magic with \expandafter here.
5464 % \xdef is used so that macro definitions will survive the file
5465 % they're defined in; @include reads the file inside a group.
5467 \let\hash=##% convert placeholders to macro parameter chars
5471 \expandafter\xdef\csname\the\macname\endcsname{%
5472 \noexpand\scanmacro{\temp}}%
5474 \expandafter\xdef\csname\the\macname\endcsname{%
5475 \bgroup\noexpand\macroargctxt
5476 \noexpand\braceorline
5477 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
5478 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
5479 \egroup\noexpand\scanmacro{\temp}}%
5481 \expandafter\xdef\csname\the\macname\endcsname{%
5482 \bgroup\noexpand\macroargctxt
5483 \noexpand\csname\the\macname xx\endcsname}%
5484 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
5485 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
5486 \expandafter\expandafter
5488 \expandafter\expandafter
5489 \csname\the\macname xxx\endcsname
5490 \paramlist{\egroup\noexpand\scanmacro{\temp}}%
5495 \expandafter\xdef\csname\the\macname\endcsname{%
5496 \noexpand\norecurse{\the\macname}%
5497 \noexpand\scanmacro{\temp}\egroup}%
5499 \expandafter\xdef\csname\the\macname\endcsname{%
5500 \bgroup\noexpand\macroargctxt
5501 \noexpand\braceorline
5502 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
5503 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
5505 \noexpand\norecurse{\the\macname}%
5506 \noexpand\scanmacro{\temp}\egroup}%
5508 \expandafter\xdef\csname\the\macname\endcsname{%
5509 \bgroup\noexpand\macroargctxt
5510 \expandafter\noexpand\csname\the\macname xx\endcsname}%
5511 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
5512 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
5513 \expandafter\expandafter
5515 \expandafter\expandafter
5516 \csname\the\macname xxx\endcsname
5519 \noexpand\norecurse{\the\macname}%
5520 \noexpand\scanmacro{\temp}\egroup}%
5524 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
5526 % \braceorline decides whether the next nonwhitespace character is a
5527 % {. If so it reads up to the closing }, if not, it reads the whole
5528 % line. Whatever was read is then fed to the next control sequence
5529 % as an argument (by \parsebrace or \parsearg)
5530 \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
5531 \def\braceorlinexxx{%
5532 \ifx\nchar\bgroup\else
5533 \expandafter\parsearg
5536 % We mant to disable all macros during \shipout so that they are not
5537 % expanded by \write.
5538 \def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
5539 \edef\next{\macrolist}\expandafter\endgroup\next}
5543 % We need some trickery to remove the optional spaces around the equal
5544 % sign. Just make them active and then expand them all to nothing.
5545 \def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
5546 \def\aliasxxx #1{\aliasyyy#1\relax}
5547 \def\aliasyyy #1=#2\relax{\ignoreactivespaces
5548 \edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
5549 \expandafter\noexpand\csname#2\endcsname}%
5550 \expandafter\endgroup\next}
5553 \message{cross references,}
5558 \newif\ifhavexrefs % True if xref values are known.
5559 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
5561 % @inforef is relatively simple.
5562 \def\inforef #1{\inforefzzz #1,,,,**}
5563 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
5564 node \samp{\ignorespaces#1{}}}
5566 % @node's job is to define \lastnode.
5567 \def\node{\ENVcheck\parsearg\nodezzz}
5568 \def\nodezzz#1{\nodexxx [#1,]}
5569 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
5571 \let\lastnode=\relax
5573 % The sectioning commands (@chapter, etc.) call these.
5575 \ifx\lastnode\relax\else
5576 \expandafter\expandafter\expandafter\setref{\lastnode}%
5577 {Ysectionnumberandtype}%
5578 \global\let\lastnode=\relax
5581 \def\unnumbnoderef{%
5582 \ifx\lastnode\relax\else
5583 \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
5584 \global\let\lastnode=\relax
5587 \def\appendixnoderef{%
5588 \ifx\lastnode\relax\else
5589 \expandafter\expandafter\expandafter\setref{\lastnode}%
5590 {Yappendixletterandtype}%
5591 \global\let\lastnode=\relax
5596 % @anchor{NAME} -- define xref target at arbitrary point.
5598 \newcount\savesfregister
5599 \gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
5600 \gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
5601 \gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
5603 % \setref{NAME}{SNT} defines a cross-reference point NAME, namely
5604 % NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have
5605 % to set \indexdummies so commands such as @code in a section title
5606 % aren't expanded. It would be nicer not to expand the titles in the
5607 % first place, but there's so many layers that that is hard to do.
5612 \dosetq{#1-title}{Ytitle}%
5613 \dosetq{#1-pg}{Ypagenumber}%
5614 \dosetq{#1-snt}{#2}%
5617 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
5618 % the node name, #2 the name of the Info cross-reference, #3 the printed
5619 % node name, #4 the name of the Info file, #5 the name of the printed
5620 % manual. All but the node name can be omitted.
5622 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
5623 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
5624 \def\ref#1{\xrefX[#1,,,,,,,]}
5625 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
5627 \def\printedmanual{\ignorespaces #5}%
5628 \def\printednodename{\ignorespaces #3}%
5629 \setbox1=\hbox{\printedmanual}%
5630 \setbox0=\hbox{\printednodename}%
5632 % No printed node name was explicitly given.
5633 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
5634 % Use the node name inside the square brackets.
5635 \def\printednodename{\ignorespaces #1}%
5637 % Use the actual chapter/section title appear inside
5638 % the square brackets. Use the real section title if we have it.
5640 % It is in another manual, so we don't have it.
5641 \def\printednodename{\ignorespaces #1}%
5644 % We know the real title if we have the xref values.
5645 \def\printednodename{\refx{#1-title}{}}%
5647 % Otherwise just copy the Info node name.
5648 \def\printednodename{\ignorespaces #1}%
5654 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
5655 % insert empty discretionaries after hyphens, which means that it will
5656 % not find a line break at a hyphen in a node names. Since some manuals
5657 % are best written with fairly long node names, containing hyphens, this
5658 % is a loss. Therefore, we give the text of the node name again, so it
5659 % is as if TeX is seeing it for the first time.
5663 {\normalturnoffactive
5664 \ifnum\filenamelength>0
5665 \startlink attr{/Border [0 0 0]}%
5666 goto file{\the\filename.pdf} name{#1}%
5668 \startlink attr{/Border [0 0 0]}%
5676 \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
5678 % _ (for example) has to be the character _ for the purposes of the
5679 % control sequence corresponding to the node, but it has to expand
5680 % into the usual \leavevmode...\vrule stuff for purposes of
5681 % printing. So we \turnoffactive for the \refx-snt, back on for the
5682 % printing, back off for the \refx-pg.
5683 {\normalturnoffactive
5684 % Only output a following space if the -snt ref is nonempty; for
5685 % @unnumbered and @anchor, it won't be.
5686 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
5687 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
5690 [\printednodename],\space
5692 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
5697 % \dosetq is the interface for calls from other macros
5699 % Use \normalturnoffactive so that punctuation chars such as underscore
5700 % and backslash work in node names. (\turnoffactive doesn't do \.)
5703 \normalturnoffactive
5704 \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
5711 % \internalsetq {foo}{page} expands into
5712 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
5713 % When the aux file is read, ' is the escape character
5715 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
5717 % Things to be expanded by \internalsetq
5719 \def\Ypagenumber{\folio}
5721 \def\Ytitle{\thissection}
5725 \def\Ysectionnumberandtype{%
5726 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
5727 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
5728 \else \ifnum \subsubsecno=0 %
5729 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
5731 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
5734 \def\Yappendixletterandtype{%
5735 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
5736 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
5737 \else \ifnum \subsubsecno=0 %
5738 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
5740 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
5745 % Use TeX 3.0's \inputlineno to get the line number, for better error
5746 % messages, but if we're using an old version of TeX, don't do anything.
5748 \ifx\inputlineno\thisisundefined
5749 \let\linenumber = \empty % Non-3.0.
5751 \def\linenumber{\the\inputlineno:\space}
5754 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
5755 % If its value is nonempty, SUFFIX is output afterward.
5758 \expandafter\ifx\csname X#1\endcsname\relax
5759 % If not defined, say something at least.
5760 \angleleft un\-de\-fined\angleright
5763 \message{\linenumber Undefined cross reference `#1'.}%
5766 \global\warnedxrefstrue
5767 \message{Cross reference values unknown; you must run TeX again.}%
5772 % It's defined, so just use it.
5773 \csname X#1\endcsname
5775 #2% Output the suffix in any case.
5778 % This is the macro invoked by entries in the aux file.
5780 \def\xrdef#1{\begingroup
5781 % Reenable \ as an escape while reading the second argument.
5783 \afterassignment\endgroup
5784 \expandafter\gdef\csname X#1\endcsname
5787 % Read the last existing aux file, if any. No error if none exists.
5788 \def\readauxfile{\begingroup
5789 \catcode`\^^@=\other
5790 \catcode`\^^A=\other
5791 \catcode`\^^B=\other
5792 \catcode`\^^C=\other
5793 \catcode`\^^D=\other
5794 \catcode`\^^E=\other
5795 \catcode`\^^F=\other
5796 \catcode`\^^G=\other
5797 \catcode`\^^H=\other
5798 \catcode`\^^K=\other
5799 \catcode`\^^L=\other
5800 \catcode`\^^N=\other
5801 \catcode`\^^P=\other
5802 \catcode`\^^Q=\other
5803 \catcode`\^^R=\other
5804 \catcode`\^^S=\other
5805 \catcode`\^^T=\other
5806 \catcode`\^^U=\other
5807 \catcode`\^^V=\other
5808 \catcode`\^^W=\other
5809 \catcode`\^^X=\other
5810 \catcode`\^^Z=\other
5811 \catcode`\^^[=\other
5812 \catcode`\^^\=\other
5813 \catcode`\^^]=\other
5814 \catcode`\^^^=\other
5815 \catcode`\^^_=\other
5818 % It was suggested to define this as 7, which would allow ^^e4 etc.
5819 % in xref tags, i.e., node names. But since ^^e4 notation isn't
5820 % supported in the main text, it doesn't seem desirable. Furthermore,
5821 % that is not enough: for node names that actually contain a ^
5822 % character, we would end up writing a line like this: 'xrdef {'hat
5823 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
5824 % argument, and \hat is not an expandable control sequence. It could
5825 % all be worked out, but why? Either we support ^^ or we don't.
5827 % The other change necessary for this was to define \auxhat:
5828 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
5829 % and then to call \auxhat in \setq.
5842 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
5843 % Make the characters 128-255 be printing characters
5847 \catcode\count 1=\other
5848 \advance\count 1 by 1
5849 \ifnum \count 1<256 \loop \fi
5852 % The aux file uses ' as the escape (for now).
5853 % Turn off \ as an escape so we do not lose on
5854 % entries which were dumped with control sequences in their names.
5855 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
5856 % Reference to such entries still does not work the way one would wish,
5857 % but at least they do not bomb out when the aux file is read in.
5864 \openin 1 \jobname.aux
5868 \global\havexrefstrue
5869 \global\warnedobstrue
5871 % Open the new aux file. TeX will close it automatically at exit.
5872 \openout\auxfile=\jobname.aux
5878 \newcount \footnoteno
5880 % The trailing space in the following definition for supereject is
5881 % vital for proper filling; pages come out unaligned when you do a
5882 % pagealignmacro call if that space before the closing brace is
5883 % removed. (Generally, numeric constants should always be followed by a
5884 % space to prevent strange expansion errors.)
5885 \def\supereject{\par\penalty -20000\footnoteno =0 }
5887 % @footnotestyle is meaningful for info output only.
5888 \let\footnotestyle=\comment
5890 \let\ptexfootnote=\footnote
5894 % Auto-number footnotes. Otherwise like plain.
5896 \global\advance\footnoteno by \@ne
5897 \edef\thisfootno{$^{\the\footnoteno}$}%
5899 % In case the footnote comes at the end of a sentence, preserve the
5900 % extra spacing after we do the footnote number.
5902 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
5904 % Remove inadvertent blank space before typesetting the footnote number.
5910 % Don't bother with the trickery in plain.tex to not require the
5911 % footnote text as a parameter. Our footnotes don't need to be so general.
5913 % Oh yes, they do; otherwise, @ifset and anything else that uses
5914 % \parseargline fail inside footnotes because the tokens are fixed when
5915 % the footnote is read. --karl, 16nov96.
5917 \long\gdef\footnotezzz{\insert\footins\bgroup
5918 % We want to typeset this text as a normal paragraph, even if the
5919 % footnote reference occurs in (for example) a display environment.
5920 % So reset some parameters.
5921 \interlinepenalty\interfootnotelinepenalty
5922 \splittopskip\ht\strutbox % top baseline for broken footnotes
5923 \splitmaxdepth\dp\strutbox
5924 \floatingpenalty\@MM
5929 \parindent\defaultparindent
5933 % Because we use hanging indentation in footnotes, a @noindent appears
5934 % to exdent this text, so make it be a no-op. makeinfo does not use
5935 % hanging indentation so @noindent can still be needed within footnote
5936 % text after an @example or the like (not that this is good style).
5937 \let\noindent = \relax
5939 % Hang the footnote text off the number. Use \everypar in case the
5940 % footnote extends for more than one paragraph.
5941 \everypar = {\hang}%
5942 \textindent{\thisfootno}%
5944 % Don't crash into the line above the footnote text. Since this
5945 % expands into a box, it must come within the paragraph, lest it
5946 % provide a place where TeX can split the footnote.
5948 \futurelet\next\fo@t
5950 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
5951 \else\let\next\f@t\fi \next}
5952 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
5953 \def\f@t#1{#1\@foot}
5954 \def\@foot{\strut\par\egroup}
5956 }%end \catcode `\@=11
5958 % @| inserts a changebar to the left of the current line. It should
5959 % surround any changed text. This approach does *not* work if the
5960 % change spans more than two lines of output. To handle that, we would
5961 % have adopt a much more difficult approach (putting marks into the main
5962 % vertical list for the beginning and end of each change).
5965 % \vadjust can only be used in horizontal mode.
5968 % Append this vertical mode material after the current line in the output.
5970 % We want to insert a rule with the height and depth of the current
5971 % leading; that is exactly what \strutbox is supposed to record.
5972 \vskip-\baselineskip
5974 % \vadjust-items are inserted at the left edge of the type. So
5975 % the \llap here moves out into the left-hand margin.
5978 % For a thicker or thinner bar, change the `1pt'.
5979 \vrule height\baselineskip width1pt
5981 % This is the space between the bar and the text.
5987 % For a final copy, take out the rectangles
5988 % that mark overfull boxes (in case you have decided
5989 % that the text looks ok even though it passes the margin).
5991 \def\finalout{\overfullrule=0pt}
5993 % @image. We use the macros from epsf.tex to support this.
5994 % If epsf.tex is not installed and @image is used, we complain.
5996 % Check for and read epsf.tex up front. If we read it only at @image
5997 % time, we might be inside a group, and then its definitions would get
5998 % undone and the next image would fail.
5999 \openin 1 = epsf.tex
6002 % Do not bother showing banner with post-v2.7 epsf.tex (available in
6003 % doc/epsf.tex until it shows up on ctan).
6004 \def\epsfannounce{\toks0 = }%
6008 % We will only complain once about lack of epsf.tex.
6009 \newif\ifwarnednoepsf
6010 \newhelp\noepsfhelp{epsf.tex must be installed for images to
6011 work. It is also included in the Texinfo distribution, or you can get
6012 it from ftp://tug.org/tex/epsf.tex.}
6015 \ifx\epsfbox\undefined
6016 \ifwarnednoepsf \else
6017 \errhelp = \noepsfhelp
6018 \errmessage{epsf.tex not found, images will be ignored}%
6019 \global\warnednoepsftrue
6022 \imagexxx #1,,,,,\finish
6026 % Arguments to @image:
6027 % #1 is (mandatory) image filename; we tack on .eps extension.
6028 % #2 is (optional) width, #3 is (optional) height.
6029 % #4 is (ignored optional) html alt text.
6030 % #5 is (ignored optional) extension.
6031 % #6 is just the usual extra ignored arg for parsing this stuff.
6033 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
6034 \catcode`\^^M = 5 % in case we're inside an example
6035 \normalturnoffactive % allow _ et al. in names
6036 % If the image is by itself, center it.
6040 % Usually we'll have text after the image which will insert
6041 % \parskip glue, so insert it here too to equalize the space
6043 \nobreak\vskip\parskip
6050 \dopdfimage{#1}{#2}{#3}%
6052 % \epsfbox itself resets \epsf?size at each figure.
6053 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
6054 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
6058 \ifimagevmode \hss \egroup \bigbreak \fi % space after the image
6062 \message{localization,}
6065 % @documentlanguage is usually given very early, just after
6066 % @setfilename. If done too late, it may not override everything
6067 % properly. Single argument is the language abbreviation.
6068 % It would be nice if we could set up a hyphenation file here.
6070 \def\documentlanguage{\parsearg\dodocumentlanguage}
6071 \def\dodocumentlanguage#1{%
6072 \tex % read txi-??.tex file in plain TeX.
6073 % Read the file if it exists.
6074 \openin 1 txi-#1.tex
6076 \errhelp = \nolanghelp
6077 \errmessage{Cannot read language file txi-#1.tex}%
6080 \def\temp{\input txi-#1.tex }%
6085 \newhelp\nolanghelp{The given language definition file cannot be found or
6086 is empty. Maybe you need to install it? In the current directory
6087 should work if nowhere else does.}
6090 % @documentencoding should change something in TeX eventually, most
6091 % likely, but for now just recognize it.
6092 \let\documentencoding = \comment
6095 % Page size parameters.
6097 \newdimen\defaultparindent \defaultparindent = 15pt
6099 \chapheadingskip = 15pt plus 4pt minus 2pt
6100 \secheadingskip = 12pt plus 3pt minus 2pt
6101 \subsecheadingskip = 9pt plus 2pt minus 2pt
6103 % Prevent underfull vbox error messages.
6106 % Don't be so finicky about underfull hboxes, either.
6109 % Following George Bush, just get rid of widows and orphans.
6113 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
6114 % using an old version of TeX, don't do anything. We want the amount of
6115 % stretch added to depend on the line length, hence the dependence on
6116 % \hsize. We call this whenever the paper size is set.
6118 \def\setemergencystretch{%
6119 \ifx\emergencystretch\thisisundefined
6120 % Allow us to assign to \emergencystretch anyway.
6121 \def\emergencystretch{\dimen0}%
6123 \emergencystretch = .15\hsize
6127 % Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
6128 % 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8)
6129 % physical page width.
6131 % We also call \setleading{\textleading}, so the caller should define
6132 % \textleading. The caller should also set \parskip.
6134 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
6137 \splittopskip = \topskip
6140 \advance\vsize by \topskip
6141 \outervsize = \vsize
6142 \advance\outervsize by 2\topandbottommargin
6143 \pageheight = \vsize
6146 \outerhsize = \hsize
6147 \advance\outerhsize by 0.5in
6150 \normaloffset = #4\relax
6151 \bindingoffset = #5\relax
6154 \pdfpageheight #7\relax
6155 \pdfpagewidth #8\relax
6158 \setleading{\textleading}
6160 \parindent = \defaultparindent
6161 \setemergencystretch
6164 % Use `small' versions.
6166 \def\smallenvironments{%
6167 \let\smalldisplay = \smalldisplayx
6168 \let\smallexample = \smalllispx
6169 \let\smallformat = \smallformatx
6170 \let\smalllisp = \smalllispx
6173 % @letterpaper (the default).
6174 \def\letterpaper{{\globaldefs = 1
6175 \parskip = 3pt plus 2pt minus 1pt
6176 \textleading = 13.2pt
6178 % If page is nothing but text, make it come out even.
6179 \internalpagesizes{46\baselineskip}{6in}%
6181 {\bindingoffset}{36pt}%
6185 % Use @smallbook to reset parameters for 7x9.5 (or so) format.
6186 \def\smallbook{{\globaldefs = 1
6187 \parskip = 2pt plus 1pt
6190 \internalpagesizes{7.5in}{5in}%
6192 {\bindingoffset}{16pt}%
6195 \lispnarrowing = 0.3in
6198 \contentsrightmargin = 0pt
6199 \defbodyindent = .5cm
6203 % Use @afourpaper to print on European A4 paper.
6204 \def\afourpaper{{\globaldefs = 1
6205 \parskip = 3pt plus 2pt minus 1pt
6206 \textleading = 13.2pt
6208 % Double-side printing via postscript on Laserjet 4050
6209 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
6210 % To change the settings for a different printer or situation, adjust
6211 % \normaloffset until the front-side and back-side texts align. Then
6212 % do the same for \bindingoffset. You can set these for testing in
6213 % your texinfo source file like this:
6215 % \global\normaloffset = -6mm
6216 % \global\bindingoffset = 10mm
6218 \internalpagesizes{51\baselineskip}{160mm}
6219 {\voffset}{\hoffset}%
6220 {\bindingoffset}{44pt}%
6225 \contentsrightmargin = 0pt
6226 \defbodyindent = 5mm
6229 % Use @afivepaper to print on European A5 paper.
6230 % From romildo@urano.iceb.ufop.br, 2 July 2000.
6231 % He also recommends making @example and @lisp be small.
6232 \def\afivepaper{{\globaldefs = 1
6233 \parskip = 2pt plus 1pt minus 0.1pt
6234 \textleading = 12.5pt
6236 \internalpagesizes{160mm}{120mm}%
6237 {\voffset}{\hoffset}%
6238 {\bindingoffset}{8pt}%
6241 \lispnarrowing = 0.2in
6244 \contentsrightmargin = 0pt
6245 \defbodyindent = 2mm
6251 % A specific text layout, 24x15cm overall, intended for A4 paper.
6252 \def\afourlatex{{\globaldefs = 1
6254 \internalpagesizes{237mm}{150mm}%
6256 {\bindingoffset}{7mm}%
6259 % Must explicitly reset to 0 because we call \afourpaper.
6263 % Use @afourwide to print on A4 paper in landscape format.
6264 \def\afourwide{{\globaldefs = 1
6266 \internalpagesizes{241mm}{165mm}%
6267 {\voffset}{-2.95mm}%
6268 {\bindingoffset}{7mm}%
6273 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
6274 % Perhaps we should allow setting the margins, \topskip, \parskip,
6275 % and/or leading, also. Or perhaps we should compute them somehow.
6277 \def\pagesizes{\parsearg\pagesizesxxx}
6278 \def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
6279 \def\pagesizesyyy#1,#2,#3\finish{{%
6280 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
6283 \parskip = 3pt plus 2pt minus 1pt
6284 \setleading{\textleading}%
6287 \advance\dimen0 by \voffset
6290 \advance\dimen2 by \normaloffset
6292 \internalpagesizes{#1}{\hsize}%
6293 {\voffset}{\normaloffset}%
6294 {\bindingoffset}{44pt}%
6298 % Set default to letter.
6303 \message{and turning on texinfo input format.}
6305 % Define macros to output various characters with catcode for normal text.
6315 \def\normaldoublequote{"}
6318 \def\normalunderscore{_}
6319 \def\normalverticalbar{|}
6321 \def\normalgreater{>}
6323 \def\normaldollar{$}%$ font-lock fix
6325 % This macro is used to make a character print one way in ttfont
6326 % where it can probably just be output, and another way in other fonts,
6327 % where something hairier probably needs to be done.
6329 % #1 is what to print if we are indeed using \tt; #2 is what to print
6330 % otherwise. Since all the Computer Modern typewriter fonts have zero
6331 % interword stretch (and shrink), and it is reasonable to expect all
6332 % typewriter fonts to have this, we can check that font parameter.
6334 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
6336 % Same as above, but check for italic font. Actually this also catches
6337 % non-italic slanted fonts since it is impossible to distinguish them from
6338 % italic fonts. But since this is only used by $ and it uses \sl anyway
6339 % this is not a problem.
6340 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
6342 % Turn off all special characters except @
6343 % (and those which the user can use as if they were ordinary).
6344 % Most of these we simply print from the \tt font, but for some, we can
6345 % use math or other variants that look better in normal text.
6348 \def\activedoublequote{{\tt\char34}}
6349 \let"=\activedoublequote
6351 \def~{{\tt\char126}}
6357 \def_{\ifusingtt\normalunderscore\_}
6358 % Subroutine for the previous macro.
6359 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
6362 \def|{{\tt\char124}}
6370 \def+{{\tt \char 43}}
6372 \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
6373 %\catcode 27=\active
6374 %\def^^[{$\diamondsuit$}
6376 % Set up an active definition for =, but don't enable it most of the time.
6377 {\catcode`\==\active
6378 \global\def={{\tt \char 61}}}
6383 % If a .fmt file is being used, characters that might appear in a file
6384 % name cannot be active until we have parsed the command line.
6385 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
6386 % \otherifyactive is called near the end of this file.
6387 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
6391 % \rawbackslashxx output one backslash character in current font
6392 \global\chardef\rawbackslashxx=`\\
6393 %{\catcode`\\=\other
6394 %@gdef@rawbackslashxx{\}}
6396 % \rawbackslash redefines \ as input to do \rawbackslashxx.
6397 {\catcode`\\=\active
6398 @gdef@rawbackslash{@let\=@rawbackslashxx }}
6400 % \normalbackslash outputs one backslash in fixed width font.
6401 \def\normalbackslash{{\tt\rawbackslashxx}}
6403 % \catcode 17=0 % Define control-q
6406 % Used sometimes to turn off (effectively) the active characters
6407 % even after parsing them.
6408 @def@turnoffactive{@let"=@normaldoublequote
6409 @let\=@realbackslash
6412 @let_=@normalunderscore
6413 @let|=@normalverticalbar
6415 @let>=@normalgreater
6417 @let$=@normaldollar}%$ font-lock fix
6419 % Same as @turnoffactive except for \.
6420 @def@normalturnoffactive{@turnoffactive @let\=@normalbackslash}
6422 % Make _ and + \other characters, temporarily.
6423 % This is canceled by @fixbackslash.
6426 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
6427 % That is what \eatinput is for; after that, the `\' should revert to printing
6430 @gdef@eatinput input texinfo{@fixbackslash}
6431 @global@let\ = @eatinput
6433 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
6434 % the first `\{ in the file would cause an error. This macro tries to fix
6435 % that, assuming it is called before the first `\' could plausibly occur.
6436 % Also back turn on active characters that might appear in the input
6437 % file name, in case not using a pre-dumped format.
6439 @gdef@fixbackslash{%
6440 @ifx\@eatinput @let\ = @normalbackslash @fi
6445 % Say @foo, not \foo, in error messages.
6448 % These look ok in all fonts, so just make them not special.
6449 @catcode`@& = @other
6450 @catcode`@# = @other
6451 @catcode`@% = @other
6453 @c Set initial fonts.
6459 @c eval: (add-hook 'write-file-hooks 'time-stamp)
6460 @c page-delimiter: "^\\\\message"
6461 @c time-stamp-start: "def\\\\texinfoversion{"
6462 @c time-stamp-format: "%:y-%02m-%02d.%02H"
6463 @c time-stamp-end: "}"