Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / common / boot / grub / docs / texinfo.tex
blobc93912a055b8324c6f0971f2e07e4a3a44df2099
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{2004-11-25.16}
8 % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
10 % Foundation, Inc.
12 % This texinfo.tex file is free software; you can redistribute it and/or
13 % modify it under the terms of the GNU General Public License as
14 % published by the Free Software Foundation; either version 2, or (at
15 % your option) any later version.
17 % This texinfo.tex file is distributed in the hope that it will be
18 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
19 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 % General Public License for more details.
22 % You should have received a copy of the GNU General Public License
23 % along with this texinfo.tex file; see the file COPYING. If not, write
24 % to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 % Boston, MA 02111-1307, USA.
27 % As a special exception, when this file is read by TeX when processing
28 % a Texinfo source document, you may use the result without
29 % restriction. (This has been our intent since Texinfo was invented.)
31 % Please try the latest version of texinfo.tex before submitting bug
32 % reports; you can get the latest version from:
33 % http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
34 % ftp://tug.org/tex/texinfo.tex
35 % (and all CTAN mirrors, see http://www.ctan.org).
36 % The texinfo.tex in any given distribution could well be out
37 % of date, so if that's what you're using, please check.
39 % Send bug reports to bug-texinfo@gnu.org. Please include including a
40 % complete document in each bug report with which we can reproduce the
41 % problem. Patches are, of course, greatly appreciated.
43 % To process a Texinfo manual with TeX, it's most reliable to use the
44 % texi2dvi shell script that comes with the distribution. For a simple
45 % manual foo.texi, however, you can get away with this:
46 % tex foo.texi
47 % texindex foo.??
48 % tex foo.texi
49 % tex foo.texi
50 % dvips foo.dvi -o # or whatever; this makes foo.ps.
51 % The extra TeX runs get the cross-reference information correct.
52 % Sometimes one run after texindex suffices, and sometimes you need more
53 % than two; texi2dvi does it as many times as necessary.
55 % It is possible to adapt texinfo.tex for other languages, to some
56 % extent. You can get the existing language-specific files from the
57 % full Texinfo distribution.
59 % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
62 \message{Loading texinfo [version \texinfoversion]:}
64 % If in a .fmt file, print the version number
65 % and turn on active characters that we couldn't do earlier because
66 % they might have appeared in the input file name.
67 \everyjob{\message{[Texinfo version \texinfoversion]}%
68 \catcode`+=\active \catcode`\_=\active}
70 \message{Basics,}
71 \chardef\other=12
73 % We never want plain's \outer definition of \+ in Texinfo.
74 % For @tex, we can use \tabalign.
75 \let\+ = \relax
77 % Save some plain tex macros whose names we will redefine.
78 \let\ptexb=\b
79 \let\ptexbullet=\bullet
80 \let\ptexc=\c
81 \let\ptexcomma=\,
82 \let\ptexdot=\.
83 \let\ptexdots=\dots
84 \let\ptexend=\end
85 \let\ptexequiv=\equiv
86 \let\ptexexclam=\!
87 \let\ptexfootnote=\footnote
88 \let\ptexgtr=>
89 \let\ptexhat=^
90 \let\ptexi=\i
91 \let\ptexindent=\indent
92 \let\ptexinsert=\insert
93 \let\ptexlbrace=\{
94 \let\ptexless=<
95 \let\ptexnewwrite\newwrite
96 \let\ptexnoindent=\noindent
97 \let\ptexplus=+
98 \let\ptexrbrace=\}
99 \let\ptexslash=\/
100 \let\ptexstar=\*
101 \let\ptext=\t
103 % If this character appears in an error message or help string, it
104 % starts a new line in the output.
105 \newlinechar = `^^J
107 % Use TeX 3.0's \inputlineno to get the line number, for better error
108 % messages, but if we're using an old version of TeX, don't do anything.
110 \ifx\inputlineno\thisisundefined
111 \let\linenumber = \empty % Pre-3.0.
112 \else
113 \def\linenumber{l.\the\inputlineno:\space}
116 % Set up fixed words for English if not already set.
117 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
118 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
119 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
120 \ifx\putwordin\undefined \gdef\putwordin{in}\fi
121 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
122 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
123 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
124 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
125 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
126 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
127 \ifx\putwordof\undefined \gdef\putwordof{of}\fi
128 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
129 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
130 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
131 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
132 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
133 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
134 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
135 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
137 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
138 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
139 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
140 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
141 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
142 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
143 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
144 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
145 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
146 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
147 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
148 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
150 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
151 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
152 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
153 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
154 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
156 % In some macros, we cannot use the `\? notation---the left quote is
157 % in some cases the escape char.
158 \chardef\colonChar = `\:
159 \chardef\commaChar = `\,
160 \chardef\dotChar = `\.
161 \chardef\exclamChar= `\!
162 \chardef\questChar = `\?
163 \chardef\semiChar = `\;
164 \chardef\underChar = `\_
166 \chardef\spaceChar = `\ %
167 \chardef\spacecat = 10
168 \def\spaceisspace{\catcode\spaceChar=\spacecat}
170 % Ignore a token.
172 \def\gobble#1{}
174 % The following is used inside several \edef's.
175 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
177 % Hyphenation fixes.
178 \hyphenation{
179 Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
180 ap-pen-dix bit-map bit-maps
181 data-base data-bases eshell fall-ing half-way long-est man-u-script
182 man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
183 par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
184 spell-ing spell-ings
185 stand-alone strong-est time-stamp time-stamps which-ever white-space
186 wide-spread wrap-around
189 % Margin to add to right of even pages, to left of odd pages.
190 \newdimen\bindingoffset
191 \newdimen\normaloffset
192 \newdimen\pagewidth \newdimen\pageheight
194 % For a final copy, take out the rectangles
195 % that mark overfull boxes (in case you have decided
196 % that the text looks ok even though it passes the margin).
198 \def\finalout{\overfullrule=0pt}
200 % @| inserts a changebar to the left of the current line. It should
201 % surround any changed text. This approach does *not* work if the
202 % change spans more than two lines of output. To handle that, we would
203 % have adopt a much more difficult approach (putting marks into the main
204 % vertical list for the beginning and end of each change).
206 \def\|{%
207 % \vadjust can only be used in horizontal mode.
208 \leavevmode
210 % Append this vertical mode material after the current line in the output.
211 \vadjust{%
212 % We want to insert a rule with the height and depth of the current
213 % leading; that is exactly what \strutbox is supposed to record.
214 \vskip-\baselineskip
216 % \vadjust-items are inserted at the left edge of the type. So
217 % the \llap here moves out into the left-hand margin.
218 \llap{%
220 % For a thicker or thinner bar, change the `1pt'.
221 \vrule height\baselineskip width1pt
223 % This is the space between the bar and the text.
224 \hskip 12pt
229 % Sometimes it is convenient to have everything in the transcript file
230 % and nothing on the terminal. We don't just call \tracingall here,
231 % since that produces some useless output on the terminal. We also make
232 % some effort to order the tracing commands to reduce output in the log
233 % file; cf. trace.sty in LaTeX.
235 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
236 \def\loggingall{%
237 \tracingstats2
238 \tracingpages1
239 \tracinglostchars2 % 2 gives us more in etex
240 \tracingparagraphs1
241 \tracingoutput1
242 \tracingmacros2
243 \tracingrestores1
244 \showboxbreadth\maxdimen \showboxdepth\maxdimen
245 \ifx\eTeXversion\undefined\else % etex gives us more logging
246 \tracingscantokens1
247 \tracingifs1
248 \tracinggroups1
249 \tracingnesting2
250 \tracingassigns1
252 \tracingcommands3 % 3 gives us more in etex
253 \errorcontextlines16
256 % add check for \lastpenalty to plain's definitions. If the last thing
257 % we did was a \nobreak, we don't want to insert more space.
259 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
260 \removelastskip\penalty-50\smallskip\fi\fi}
261 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
262 \removelastskip\penalty-100\medskip\fi\fi}
263 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
264 \removelastskip\penalty-200\bigskip\fi\fi}
266 % For @cropmarks command.
267 % Do @cropmarks to get crop marks.
269 \newif\ifcropmarks
270 \let\cropmarks = \cropmarkstrue
272 % Dimensions to add cropmarks at corners.
273 % Added by P. A. MacKay, 12 Nov. 1986
275 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
276 \newdimen\cornerlong \cornerlong=1pc
277 \newdimen\cornerthick \cornerthick=.3pt
278 \newdimen\topandbottommargin \topandbottommargin=.75in
280 % Main output routine.
281 \chardef\PAGE = 255
282 \output = {\onepageout{\pagecontents\PAGE}}
284 \newbox\headlinebox
285 \newbox\footlinebox
287 % \onepageout takes a vbox as an argument. Note that \pagecontents
288 % does insertions, but you have to call it yourself.
289 \def\onepageout#1{%
290 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
292 \ifodd\pageno \advance\hoffset by \bindingoffset
293 \else \advance\hoffset by -\bindingoffset\fi
295 % Do this outside of the \shipout so @code etc. will be expanded in
296 % the headline as they should be, not taken literally (outputting ''code).
297 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
298 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
301 % Have to do this stuff outside the \shipout because we want it to
302 % take effect in \write's, yet the group defined by the \vbox ends
303 % before the \shipout runs.
305 \escapechar = `\\ % use backslash in output files.
306 \indexdummies % don't expand commands in the output.
307 \normalturnoffactive % \ in index entries must not stay \, e.g., if
308 % the page break happens to be in the middle of an example.
309 \shipout\vbox{%
310 % Do this early so pdf references go to the beginning of the page.
311 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
313 \ifcropmarks \vbox to \outervsize\bgroup
314 \hsize = \outerhsize
315 \vskip-\topandbottommargin
316 \vtop to0pt{%
317 \line{\ewtop\hfil\ewtop}%
318 \nointerlineskip
319 \line{%
320 \vbox{\moveleft\cornerthick\nstop}%
321 \hfill
322 \vbox{\moveright\cornerthick\nstop}%
324 \vss}%
325 \vskip\topandbottommargin
326 \line\bgroup
327 \hfil % center the page within the outer (page) hsize.
328 \ifodd\pageno\hskip\bindingoffset\fi
329 \vbox\bgroup
332 \unvbox\headlinebox
333 \pagebody{#1}%
334 \ifdim\ht\footlinebox > 0pt
335 % Only leave this space if the footline is nonempty.
336 % (We lessened \vsize for it in \oddfootingxxx.)
337 % The \baselineskip=24pt in plain's \makefootline has no effect.
338 \vskip 2\baselineskip
339 \unvbox\footlinebox
342 \ifcropmarks
343 \egroup % end of \vbox\bgroup
344 \hfil\egroup % end of (centering) \line\bgroup
345 \vskip\topandbottommargin plus1fill minus1fill
346 \boxmaxdepth = \cornerthick
347 \vbox to0pt{\vss
348 \line{%
349 \vbox{\moveleft\cornerthick\nsbot}%
350 \hfill
351 \vbox{\moveright\cornerthick\nsbot}%
353 \nointerlineskip
354 \line{\ewbot\hfil\ewbot}%
356 \egroup % \vbox from first cropmarks clause
358 }% end of \shipout\vbox
359 }% end of group with \normalturnoffactive
360 \advancepageno
361 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
364 \newinsert\margin \dimen\margin=\maxdimen
366 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
367 {\catcode`\@ =11
368 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
369 % marginal hacks, juha@viisa.uucp (Juha Takala)
370 \ifvoid\margin\else % marginal info is present
371 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
372 \dimen@=\dp#1 \unvbox#1
373 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
374 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
377 % Here are the rules for the cropmarks. Note that they are
378 % offset so that the space between them is truly \outerhsize or \outervsize
379 % (P. A. MacKay, 12 November, 1986)
381 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
382 \def\nstop{\vbox
383 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
384 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
385 \def\nsbot{\vbox
386 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
388 % Parse an argument, then pass it to #1. The argument is the rest of
389 % the input line (except we remove a trailing comment). #1 should be a
390 % macro which expects an ordinary undelimited TeX argument.
392 \def\parsearg{\parseargusing{}}
393 \def\parseargusing#1#2{%
394 \def\next{#2}%
395 \begingroup
396 \obeylines
397 \spaceisspace
399 \parseargline\empty% Insert the \empty token, see \finishparsearg below.
402 {\obeylines %
403 \gdef\parseargline#1^^M{%
404 \endgroup % End of the group started in \parsearg.
405 \argremovecomment #1\comment\ArgTerm%
409 % First remove any @comment, then any @c comment.
410 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
411 \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
413 % Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
415 % \argremovec might leave us with trailing space, e.g.,
416 % @end itemize @c foo
417 % This space token undergoes the same procedure and is eventually removed
418 % by \finishparsearg.
420 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
421 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
422 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
423 \def\temp{#3}%
424 \ifx\temp\empty
425 % We cannot use \next here, as it holds the macro to run;
426 % thus we reuse \temp.
427 \let\temp\finishparsearg
428 \else
429 \let\temp\argcheckspaces
431 % Put the space token in:
432 \temp#1 #3\ArgTerm
435 % If a _delimited_ argument is enclosed in braces, they get stripped; so
436 % to get _exactly_ the rest of the line, we had to prevent such situation.
437 % We prepended an \empty token at the very beginning and we expand it now,
438 % just before passing the control to \next.
439 % (Similarily, we have to think about #3 of \argcheckspacesY above: it is
440 % either the null string, or it ends with \^^M---thus there is no danger
441 % that a pair of braces would be stripped.
443 % But first, we have to remove the trailing space token.
445 \def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}}
447 % \parseargdef\foo{...}
448 % is roughly equivalent to
449 % \def\foo{\parsearg\Xfoo}
450 % \def\Xfoo#1{...}
452 % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
453 % favourite TeX trick. --kasal, 16nov03
455 \def\parseargdef#1{%
456 \expandafter \doparseargdef \csname\string#1\endcsname #1%
458 \def\doparseargdef#1#2{%
459 \def#2{\parsearg#1}%
460 \def#1##1%
463 % Several utility definitions with active space:
465 \obeyspaces
466 \gdef\obeyedspace{ }
468 % Make each space character in the input produce a normal interword
469 % space in the output. Don't allow a line break at this space, as this
470 % is used only in environments like @example, where each line of input
471 % should produce a line of output anyway.
473 \gdef\sepspaces{\obeyspaces\let =\tie}
475 % If an index command is used in an @example environment, any spaces
476 % therein should become regular spaces in the raw index file, not the
477 % expansion of \tie (\leavevmode \penalty \@M \ ).
478 \gdef\unsepspaces{\let =\space}
482 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
484 % Define the framework for environments in texinfo.tex. It's used like this:
486 % \envdef\foo{...}
487 % \def\Efoo{...}
489 % It's the responsibility of \envdef to insert \begingroup before the
490 % actual body; @end closes the group after calling \Efoo. \envdef also
491 % defines \thisenv, so the current environment is known; @end checks
492 % whether the environment name matches. The \checkenv macro can also be
493 % used to check whether the current environment is the one expected.
495 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
496 % are not treated as enviroments; they don't open a group. (The
497 % implementation of @end takes care not to call \endgroup in this
498 % special case.)
501 % At runtime, environments start with this:
502 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
503 % initialize
504 \let\thisenv\empty
506 % ... but they get defined via ``\envdef\foo{...}'':
507 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
508 \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
510 % Check whether we're in the right environment:
511 \def\checkenv#1{%
512 \def\temp{#1}%
513 \ifx\thisenv\temp
514 \else
515 \badenverr
519 % Evironment mismatch, #1 expected:
520 \def\badenverr{%
521 \errhelp = \EMsimple
522 \errmessage{This command can appear only \inenvironment\temp,
523 not \inenvironment\thisenv}%
525 \def\inenvironment#1{%
526 \ifx#1\empty
527 out of any environment%
528 \else
529 in environment \expandafter\string#1%
533 % @end foo executes the definition of \Efoo.
534 % But first, it executes a specialized version of \checkenv
536 \parseargdef\end{%
537 \if 1\csname iscond.#1\endcsname
538 \else
539 % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03
540 \expandafter\checkenv\csname#1\endcsname
541 \csname E#1\endcsname
542 \endgroup
546 \newhelp\EMsimple{Press RETURN to continue.}
549 %% Simple single-character @ commands
551 % @@ prints an @
552 % Kludge this until the fonts are right (grr).
553 \def\@{{\tt\char64}}
555 % This is turned off because it was never documented
556 % and you can use @w{...} around a quote to suppress ligatures.
557 %% Define @` and @' to be the same as ` and '
558 %% but suppressing ligatures.
559 %\def\`{{`}}
560 %\def\'{{'}}
562 % Used to generate quoted braces.
563 \def\mylbrace {{\tt\char123}}
564 \def\myrbrace {{\tt\char125}}
565 \let\{=\mylbrace
566 \let\}=\myrbrace
567 \begingroup
568 % Definitions to produce \{ and \} commands for indices,
569 % and @{ and @} for the aux file.
570 \catcode`\{ = \other \catcode`\} = \other
571 \catcode`\[ = 1 \catcode`\] = 2
572 \catcode`\! = 0 \catcode`\\ = \other
573 !gdef!lbracecmd[\{]%
574 !gdef!rbracecmd[\}]%
575 !gdef!lbraceatcmd[@{]%
576 !gdef!rbraceatcmd[@}]%
577 !endgroup
579 % @comma{} to avoid , parsing problems.
580 \let\comma = ,
582 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
583 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
584 \let\, = \c
585 \let\dotaccent = \.
586 \def\ringaccent#1{{\accent23 #1}}
587 \let\tieaccent = \t
588 \let\ubaraccent = \b
589 \let\udotaccent = \d
591 % Other special characters: @questiondown @exclamdown @ordf @ordm
592 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
593 \def\questiondown{?`}
594 \def\exclamdown{!`}
595 \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
596 \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
598 % Dotless i and dotless j, used for accents.
599 \def\imacro{i}
600 \def\jmacro{j}
601 \def\dotless#1{%
602 \def\temp{#1}%
603 \ifx\temp\imacro \ptexi
604 \else\ifx\temp\jmacro \j
605 \else \errmessage{@dotless can be used only with i or j}%
606 \fi\fi
609 % The \TeX{} logo, as in plain, but resetting the spacing so that a
610 % period following counts as ending a sentence. (Idea found in latex.)
612 \edef\TeX{\TeX \spacefactor=1000 }
614 % @LaTeX{} logo. Not quite the same results as the definition in
615 % latex.ltx, since we use a different font for the raised A; it's most
616 % convenient for us to use an explicitly smaller font, rather than using
617 % the \scriptstyle font (since we don't reset \scriptstyle and
618 % \scriptscriptstyle).
620 \def\LaTeX{%
621 L\kern-.36em
622 {\setbox0=\hbox{T}%
623 \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}%
624 \kern-.15em
625 \TeX
628 % Be sure we're in horizontal mode when doing a tie, since we make space
629 % equivalent to this in @example-like environments. Otherwise, a space
630 % at the beginning of a line will start with \penalty -- and
631 % since \penalty is valid in vertical mode, we'd end up putting the
632 % penalty on the vertical list instead of in the new paragraph.
633 {\catcode`@ = 11
634 % Avoid using \@M directly, because that causes trouble
635 % if the definition is written into an index file.
636 \global\let\tiepenalty = \@M
637 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
640 % @: forces normal size whitespace following.
641 \def\:{\spacefactor=1000 }
643 % @* forces a line break.
644 \def\*{\hfil\break\hbox{}\ignorespaces}
646 % @/ allows a line break.
647 \let\/=\allowbreak
649 % @. is an end-of-sentence period.
650 \def\.{.\spacefactor=3000 }
652 % @! is an end-of-sentence bang.
653 \def\!{!\spacefactor=3000 }
655 % @? is an end-of-sentence query.
656 \def\?{?\spacefactor=3000 }
658 % @w prevents a word break. Without the \leavevmode, @w at the
659 % beginning of a paragraph, when TeX is still in vertical mode, would
660 % produce a whole line of output instead of starting the paragraph.
661 \def\w#1{\leavevmode\hbox{#1}}
663 % @group ... @end group forces ... to be all on one page, by enclosing
664 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
665 % to keep its height that of a normal line. According to the rules for
666 % \topskip (p.114 of the TeXbook), the glue inserted is
667 % max (\topskip - \ht (first item), 0). If that height is large,
668 % therefore, no glue is inserted, and the space between the headline and
669 % the text is small, which looks bad.
671 % Another complication is that the group might be very large. This can
672 % cause the glue on the previous page to be unduly stretched, because it
673 % does not have much material. In this case, it's better to add an
674 % explicit \vfill so that the extra space is at the bottom. The
675 % threshold for doing this is if the group is more than \vfilllimit
676 % percent of a page (\vfilllimit can be changed inside of @tex).
678 \newbox\groupbox
679 \def\vfilllimit{0.7}
681 \envdef\group{%
682 \ifnum\catcode`\^^M=\active \else
683 \errhelp = \groupinvalidhelp
684 \errmessage{@group invalid in context where filling is enabled}%
686 \startsavinginserts
688 \setbox\groupbox = \vtop\bgroup
689 % Do @comment since we are called inside an environment such as
690 % @example, where each end-of-line in the input causes an
691 % end-of-line in the output. We don't want the end-of-line after
692 % the `@group' to put extra space in the output. Since @group
693 % should appear on a line by itself (according to the Texinfo
694 % manual), we don't worry about eating any user text.
695 \comment
698 % The \vtop produces a box with normal height and large depth; thus, TeX puts
699 % \baselineskip glue before it, and (when the next line of text is done)
700 % \lineskip glue after it. Thus, space below is not quite equal to space
701 % above. But it's pretty close.
702 \def\Egroup{%
703 % To get correct interline space between the last line of the group
704 % and the first line afterwards, we have to propagate \prevdepth.
705 \endgraf % Not \par, as it may have been set to \lisppar.
706 \global\dimen1 = \prevdepth
707 \egroup % End the \vtop.
708 % \dimen0 is the vertical size of the group's box.
709 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
710 % \dimen2 is how much space is left on the page (more or less).
711 \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
712 % if the group doesn't fit on the current page, and it's a big big
713 % group, force a page break.
714 \ifdim \dimen0 > \dimen2
715 \ifdim \pagetotal < \vfilllimit\pageheight
716 \page
719 \box\groupbox
720 \prevdepth = \dimen1
721 \checkinserts
724 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
725 % message, so this ends up printing `@group can only ...'.
727 \newhelp\groupinvalidhelp{%
728 group can only be used in environments such as @example,^^J%
729 where each line of input produces a line of output.}
731 % @need space-in-mils
732 % forces a page break if there is not space-in-mils remaining.
734 \newdimen\mil \mil=0.001in
736 % Old definition--didn't work.
737 %\parseargdef\need{\par %
738 %% This method tries to make TeX break the page naturally
739 %% if the depth of the box does not fit.
740 %{\baselineskip=0pt%
741 %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
742 %\prevdepth=-1000pt
745 \parseargdef\need{%
746 % Ensure vertical mode, so we don't make a big box in the middle of a
747 % paragraph.
748 \par
750 % If the @need value is less than one line space, it's useless.
751 \dimen0 = #1\mil
752 \dimen2 = \ht\strutbox
753 \advance\dimen2 by \dp\strutbox
754 \ifdim\dimen0 > \dimen2
756 % Do a \strut just to make the height of this box be normal, so the
757 % normal leading is inserted relative to the preceding line.
758 % And a page break here is fine.
759 \vtop to #1\mil{\strut\vfil}%
761 % TeX does not even consider page breaks if a penalty added to the
762 % main vertical list is 10000 or more. But in order to see if the
763 % empty box we just added fits on the page, we must make it consider
764 % page breaks. On the other hand, we don't want to actually break the
765 % page after the empty box. So we use a penalty of 9999.
767 % There is an extremely small chance that TeX will actually break the
768 % page at this \penalty, if there are no other feasible breakpoints in
769 % sight. (If the user is using lots of big @group commands, which
770 % almost-but-not-quite fill up a page, TeX will have a hard time doing
771 % good page breaking, for example.) However, I could not construct an
772 % example where a page broke at this \penalty; if it happens in a real
773 % document, then we can reconsider our strategy.
774 \penalty9999
776 % Back up by the size of the box, whether we did a page break or not.
777 \kern -#1\mil
779 % Do not allow a page break right after this kern.
780 \nobreak
784 % @br forces paragraph break (and is undocumented).
786 \let\br = \par
788 % @page forces the start of a new page.
790 \def\page{\par\vfill\supereject}
792 % @exdent text....
793 % outputs text on separate line in roman font, starting at standard page margin
795 % This records the amount of indent in the innermost environment.
796 % That's how much \exdent should take out.
797 \newskip\exdentamount
799 % This defn is used inside fill environments such as @defun.
800 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
802 % This defn is used inside nofill environments such as @example.
803 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
804 \leftline{\hskip\leftskip{\rm#1}}}}
806 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
807 % paragraph. For more general purposes, use the \margin insertion
808 % class. WHICH is `l' or `r'.
810 \newskip\inmarginspacing \inmarginspacing=1cm
811 \def\strutdepth{\dp\strutbox}
813 \def\doinmargin#1#2{\strut\vadjust{%
814 \nobreak
815 \kern-\strutdepth
816 \vtop to \strutdepth{%
817 \baselineskip=\strutdepth
818 \vss
819 % if you have multiple lines of stuff to put here, you'll need to
820 % make the vbox yourself of the appropriate size.
821 \ifx#1l%
822 \llap{\ignorespaces #2\hskip\inmarginspacing}%
823 \else
824 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
826 \null
829 \def\inleftmargin{\doinmargin l}
830 \def\inrightmargin{\doinmargin r}
832 % @inmargin{TEXT [, RIGHT-TEXT]}
833 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
834 % else use TEXT for both).
836 \def\inmargin#1{\parseinmargin #1,,\finish}
837 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
838 \setbox0 = \hbox{\ignorespaces #2}%
839 \ifdim\wd0 > 0pt
840 \def\lefttext{#1}% have both texts
841 \def\righttext{#2}%
842 \else
843 \def\lefttext{#1}% have only one text
844 \def\righttext{#1}%
847 \ifodd\pageno
848 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
849 \else
850 \def\temp{\inleftmargin\lefttext}%
852 \temp
855 % @include file insert text of that file as input.
857 \def\include{\parseargusing\filenamecatcodes\includezzz}
858 \def\includezzz#1{%
859 \pushthisfilestack
860 \def\thisfile{#1}%
862 \makevalueexpandable
863 \def\temp{\input #1 }%
864 \expandafter
865 }\temp
866 \popthisfilestack
868 \def\filenamecatcodes{%
869 \catcode`\\=\other
870 \catcode`~=\other
871 \catcode`^=\other
872 \catcode`_=\other
873 \catcode`|=\other
874 \catcode`<=\other
875 \catcode`>=\other
876 \catcode`+=\other
877 \catcode`-=\other
880 \def\pushthisfilestack{%
881 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
883 \def\pushthisfilestackX{%
884 \expandafter\pushthisfilestackY\thisfile\StackTerm
886 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
887 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
890 \def\popthisfilestack{\errthisfilestackempty}
891 \def\errthisfilestackempty{\errmessage{Internal error:
892 the stack of filenames is empty.}}
894 \def\thisfile{}
896 % @center line
897 % outputs that line, centered.
899 \parseargdef\center{%
900 \ifhmode
901 \let\next\centerH
902 \else
903 \let\next\centerV
905 \next{\hfil \ignorespaces#1\unskip \hfil}%
907 \def\centerH#1{%
909 \hfil\break
910 \advance\hsize by -\leftskip
911 \advance\hsize by -\rightskip
912 \line{#1}%
913 \break
916 \def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
918 % @sp n outputs n lines of vertical space
920 \parseargdef\sp{\vskip #1\baselineskip}
922 % @comment ...line which is ignored...
923 % @c is the same as @comment
924 % @ignore ... @end ignore is another way to write a comment
926 \def\comment{\begingroup \catcode`\^^M=\other%
927 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
928 \commentxxx}
929 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
931 \let\c=\comment
933 % @paragraphindent NCHARS
934 % We'll use ems for NCHARS, close enough.
935 % NCHARS can also be the word `asis' or `none'.
936 % We cannot feasibly implement @paragraphindent asis, though.
938 \def\asisword{asis} % no translation, these are keywords
939 \def\noneword{none}
941 \parseargdef\paragraphindent{%
942 \def\temp{#1}%
943 \ifx\temp\asisword
944 \else
945 \ifx\temp\noneword
946 \defaultparindent = 0pt
947 \else
948 \defaultparindent = #1em
951 \parindent = \defaultparindent
954 % @exampleindent NCHARS
955 % We'll use ems for NCHARS like @paragraphindent.
956 % It seems @exampleindent asis isn't necessary, but
957 % I preserve it to make it similar to @paragraphindent.
958 \parseargdef\exampleindent{%
959 \def\temp{#1}%
960 \ifx\temp\asisword
961 \else
962 \ifx\temp\noneword
963 \lispnarrowing = 0pt
964 \else
965 \lispnarrowing = #1em
970 % @firstparagraphindent WORD
971 % If WORD is `none', then suppress indentation of the first paragraph
972 % after a section heading. If WORD is `insert', then do indent at such
973 % paragraphs.
975 % The paragraph indentation is suppressed or not by calling
976 % \suppressfirstparagraphindent, which the sectioning commands do.
977 % We switch the definition of this back and forth according to WORD.
978 % By default, we suppress indentation.
980 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
981 \def\insertword{insert}
983 \parseargdef\firstparagraphindent{%
984 \def\temp{#1}%
985 \ifx\temp\noneword
986 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
987 \else\ifx\temp\insertword
988 \let\suppressfirstparagraphindent = \relax
989 \else
990 \errhelp = \EMsimple
991 \errmessage{Unknown @firstparagraphindent option `\temp'}%
992 \fi\fi
995 % Here is how we actually suppress indentation. Redefine \everypar to
996 % \kern backwards by \parindent, and then reset itself to empty.
998 % We also make \indent itself not actually do anything until the next
999 % paragraph.
1001 \gdef\dosuppressfirstparagraphindent{%
1002 \gdef\indent{%
1003 \restorefirstparagraphindent
1004 \indent
1006 \gdef\noindent{%
1007 \restorefirstparagraphindent
1008 \noindent
1010 \global\everypar = {%
1011 \kern -\parindent
1012 \restorefirstparagraphindent
1016 \gdef\restorefirstparagraphindent{%
1017 \global \let \indent = \ptexindent
1018 \global \let \noindent = \ptexnoindent
1019 \global \everypar = {}%
1023 % @asis just yields its argument. Used with @table, for example.
1025 \def\asis#1{#1}
1027 % @math outputs its argument in math mode.
1029 % One complication: _ usually means subscripts, but it could also mean
1030 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
1031 % _ active, and distinguish by seeing if the current family is \slfam,
1032 % which is what @var uses.
1034 \catcode\underChar = \active
1035 \gdef\mathunderscore{%
1036 \catcode\underChar=\active
1037 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
1040 % Another complication: we want \\ (and @\) to output a \ character.
1041 % FYI, plain.tex uses \\ as a temporary control sequence (why?), but
1042 % this is not advertised and we don't care. Texinfo does not
1043 % otherwise define @\.
1045 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
1046 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
1048 \def\math{%
1049 \tex
1050 \mathunderscore
1051 \let\\ = \mathbackslash
1052 \mathactive
1053 $\finishmath
1055 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
1057 % Some active characters (such as <) are spaced differently in math.
1058 % We have to reset their definitions in case the @math was an argument
1059 % to a command which sets the catcodes (such as @item or @section).
1062 \catcode`^ = \active
1063 \catcode`< = \active
1064 \catcode`> = \active
1065 \catcode`+ = \active
1066 \gdef\mathactive{%
1067 \let^ = \ptexhat
1068 \let< = \ptexless
1069 \let> = \ptexgtr
1070 \let+ = \ptexplus
1074 % @bullet and @minus need the same treatment as @math, just above.
1075 \def\bullet{$\ptexbullet$}
1076 \def\minus{$-$}
1078 % @dots{} outputs an ellipsis using the current font.
1079 % We do .5em per period so that it has the same spacing in a typewriter
1080 % font as three actual period characters.
1082 \def\dots{%
1083 \leavevmode
1084 \hbox to 1.5em{%
1085 \hskip 0pt plus 0.25fil
1086 .\hfil.\hfil.%
1087 \hskip 0pt plus 0.5fil
1091 % @enddots{} is an end-of-sentence ellipsis.
1093 \def\enddots{%
1094 \dots
1095 \spacefactor=3000
1098 % @comma{} is so commas can be inserted into text without messing up
1099 % Texinfo's parsing.
1101 \let\comma = ,
1103 % @refill is a no-op.
1104 \let\refill=\relax
1106 % If working on a large document in chapters, it is convenient to
1107 % be able to disable indexing, cross-referencing, and contents, for test runs.
1108 % This is done with @novalidate (before @setfilename).
1110 \newif\iflinks \linkstrue % by default we want the aux files.
1111 \let\novalidate = \linksfalse
1113 % @setfilename is done at the beginning of every texinfo file.
1114 % So open here the files we need to have open while reading the input.
1115 % This makes it possible to make a .fmt file for texinfo.
1116 \def\setfilename{%
1117 \fixbackslash % Turn off hack to swallow `\input texinfo'.
1118 \iflinks
1119 \tryauxfile
1120 % Open the new aux file. TeX will close it automatically at exit.
1121 \immediate\openout\auxfile=\jobname.aux
1122 \fi % \openindices needs to do some work in any case.
1123 \openindices
1124 \let\setfilename=\comment % Ignore extra @setfilename cmds.
1126 % If texinfo.cnf is present on the system, read it.
1127 % Useful for site-wide @afourpaper, etc.
1128 \openin 1 texinfo.cnf
1129 \ifeof 1 \else \input texinfo.cnf \fi
1130 \closein 1
1132 \comment % Ignore the actual filename.
1135 % Called from \setfilename.
1137 \def\openindices{%
1138 \newindex{cp}%
1139 \newcodeindex{fn}%
1140 \newcodeindex{vr}%
1141 \newcodeindex{tp}%
1142 \newcodeindex{ky}%
1143 \newcodeindex{pg}%
1146 % @bye.
1147 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1150 \message{pdf,}
1151 % adobe `portable' document format
1152 \newcount\tempnum
1153 \newcount\lnkcount
1154 \newtoks\filename
1155 \newcount\filenamelength
1156 \newcount\pgn
1157 \newtoks\toksA
1158 \newtoks\toksB
1159 \newtoks\toksC
1160 \newtoks\toksD
1161 \newbox\boxA
1162 \newcount\countA
1163 \newif\ifpdf
1164 \newif\ifpdfmakepagedest
1166 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1167 % can be set). So we test for \relax and 0 as well as \undefined,
1168 % borrowed from ifpdf.sty.
1169 \ifx\pdfoutput\undefined
1170 \else
1171 \ifx\pdfoutput\relax
1172 \else
1173 \ifcase\pdfoutput
1174 \else
1175 \pdftrue
1180 \ifpdf
1181 \input pdfcolor
1182 \pdfcatalog{/PageMode /UseOutlines}%
1183 \def\dopdfimage#1#2#3{%
1184 \def\imagewidth{#2}%
1185 \def\imageheight{#3}%
1186 % without \immediate, pdftex seg faults when the same image is
1187 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1188 \ifnum\pdftexversion < 14
1189 \immediate\pdfimage
1190 \else
1191 \immediate\pdfximage
1193 \ifx\empty\imagewidth\else width \imagewidth \fi
1194 \ifx\empty\imageheight\else height \imageheight \fi
1195 \ifnum\pdftexversion<13
1196 #1.pdf%
1197 \else
1198 {#1.pdf}%
1200 \ifnum\pdftexversion < 14 \else
1201 \pdfrefximage \pdflastximage
1202 \fi}
1203 \def\pdfmkdest#1{{%
1204 % We have to set dummies so commands such as @code in a section title
1205 % aren't expanded.
1206 \atdummies
1207 \normalturnoffactive
1208 \pdfdest name{#1} xyz%
1210 \def\pdfmkpgn#1{#1}
1211 \let\linkcolor = \Blue % was Cyan, but that seems light?
1212 \def\endlink{\Black\pdfendlink}
1213 % Adding outlines to PDF; macros for calculating structure of outlines
1214 % come from Petr Olsak
1215 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1216 \else \csname#1\endcsname \fi}
1217 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1218 \advance\tempnum by 1
1219 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1221 % #1 is the section text. #2 is the pdf expression for the number
1222 % of subentries (or empty, for subsubsections). #3 is the node
1223 % text, which might be empty if this toc entry had no
1224 % corresponding node. #4 is the page number.
1226 \def\dopdfoutline#1#2#3#4{%
1227 % Generate a link to the node text if that exists; else, use the
1228 % page number. We could generate a destination for the section
1229 % text in the case where a section has no node, but it doesn't
1230 % seem worthwhile, since most documents are normally structured.
1231 \def\pdfoutlinedest{#3}%
1232 \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}\fi
1234 \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{#1}%
1237 \def\pdfmakeoutlines{%
1238 \begingroup
1239 % Thanh's hack / proper braces in bookmarks
1240 \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
1241 \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
1243 % Read toc silently, to get counts of subentries for \pdfoutline.
1244 \def\numchapentry##1##2##3##4{%
1245 \def\thischapnum{##2}%
1246 \def\thissecnum{0}%
1247 \def\thissubsecnum{0}%
1249 \def\numsecentry##1##2##3##4{%
1250 \advancenumber{chap\thischapnum}%
1251 \def\thissecnum{##2}%
1252 \def\thissubsecnum{0}%
1254 \def\numsubsecentry##1##2##3##4{%
1255 \advancenumber{sec\thissecnum}%
1256 \def\thissubsecnum{##2}%
1258 \def\numsubsubsecentry##1##2##3##4{%
1259 \advancenumber{subsec\thissubsecnum}%
1261 \def\thischapnum{0}%
1262 \def\thissecnum{0}%
1263 \def\thissubsecnum{0}%
1265 % use \def rather than \let here because we redefine \chapentry et
1266 % al. a second time, below.
1267 \def\appentry{\numchapentry}%
1268 \def\appsecentry{\numsecentry}%
1269 \def\appsubsecentry{\numsubsecentry}%
1270 \def\appsubsubsecentry{\numsubsubsecentry}%
1271 \def\unnchapentry{\numchapentry}%
1272 \def\unnsecentry{\numsecentry}%
1273 \def\unnsubsecentry{\numsubsecentry}%
1274 \def\unnsubsubsecentry{\numsubsubsecentry}%
1275 \input \jobname.toc
1277 % Read toc second time, this time actually producing the outlines.
1278 % The `-' means take the \expnumber as the absolute number of
1279 % subentries, which we calculated on our first read of the .toc above.
1281 % We use the node names as the destinations.
1282 \def\numchapentry##1##2##3##4{%
1283 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1284 \def\numsecentry##1##2##3##4{%
1285 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1286 \def\numsubsecentry##1##2##3##4{%
1287 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1288 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1289 \dopdfoutline{##1}{}{##3}{##4}}%
1291 % PDF outlines are displayed using system fonts, instead of
1292 % document fonts. Therefore we cannot use special characters,
1293 % since the encoding is unknown. For example, the eogonek from
1294 % Latin 2 (0xea) gets translated to a | character. Info from
1295 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1297 % xx to do this right, we have to translate 8-bit characters to
1298 % their "best" equivalent, based on the @documentencoding. Right
1299 % now, I guess we'll just let the pdf reader have its way.
1300 \indexnofonts
1301 \turnoffactive
1302 \input \jobname.toc
1303 \endgroup
1306 \def\makelinks #1,{%
1307 \def\params{#1}\def\E{END}%
1308 \ifx\params\E
1309 \let\nextmakelinks=\relax
1310 \else
1311 \let\nextmakelinks=\makelinks
1312 \ifnum\lnkcount>0,\fi
1313 \picknum{#1}%
1314 \startlink attr{/Border [0 0 0]}
1315 goto name{\pdfmkpgn{\the\pgn}}%
1316 \linkcolor #1%
1317 \advance\lnkcount by 1%
1318 \endlink
1320 \nextmakelinks
1322 \def\picknum#1{\expandafter\pn#1}
1323 \def\pn#1{%
1324 \def\p{#1}%
1325 \ifx\p\lbrace
1326 \let\nextpn=\ppn
1327 \else
1328 \let\nextpn=\ppnn
1329 \def\first{#1}
1331 \nextpn
1333 \def\ppn#1{\pgn=#1\gobble}
1334 \def\ppnn{\pgn=\first}
1335 \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
1336 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1337 \ifx\PP\D\let\nextsp\relax
1338 \else\let\nextsp\skipspaces
1339 \ifx\p\space\else\addtokens{\filename}{\PP}%
1340 \advance\filenamelength by 1
1343 \nextsp}
1344 \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
1345 \ifnum\pdftexversion < 14
1346 \let \startlink \pdfannotlink
1347 \else
1348 \let \startlink \pdfstartlink
1350 \def\pdfurl#1{%
1351 \begingroup
1352 \normalturnoffactive\def\@{@}%
1353 \makevalueexpandable
1354 \leavevmode\Red
1355 \startlink attr{/Border [0 0 0]}%
1356 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1357 \endgroup}
1358 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1359 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1360 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1361 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1362 \def\maketoks{%
1363 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1364 \ifx\first0\adn0
1365 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1366 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1367 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1368 \else
1369 \ifnum0=\countA\else\makelink\fi
1370 \ifx\first.\let\next=\done\else
1371 \let\next=\maketoks
1372 \addtokens{\toksB}{\the\toksD}
1373 \ifx\first,\addtokens{\toksB}{\space}\fi
1375 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1376 \next}
1377 \def\makelink{\addtokens{\toksB}%
1378 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1379 \def\pdflink#1{%
1380 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1381 \linkcolor #1\endlink}
1382 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1383 \else
1384 \let\pdfmkdest = \gobble
1385 \let\pdfurl = \gobble
1386 \let\endlink = \relax
1387 \let\linkcolor = \relax
1388 \let\pdfmakeoutlines = \relax
1389 \fi % \ifx\pdfoutput
1392 \message{fonts,}
1394 % Change the current font style to #1, remembering it in \curfontstyle.
1395 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1396 % italics, not bold italics.
1398 \def\setfontstyle#1{%
1399 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1400 \csname ten#1\endcsname % change the current font
1403 % Select #1 fonts with the current style.
1405 \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1407 \def\rm{\fam=0 \setfontstyle{rm}}
1408 \def\it{\fam=\itfam \setfontstyle{it}}
1409 \def\sl{\fam=\slfam \setfontstyle{sl}}
1410 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1411 \def\tt{\fam=\ttfam \setfontstyle{tt}}
1413 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1414 % So we set up a \sf.
1415 \newfam\sffam
1416 \def\sf{\fam=\sffam \setfontstyle{sf}}
1417 \let\li = \sf % Sometimes we call it \li, not \sf.
1419 % We don't need math for this font style.
1420 \def\ttsl{\setfontstyle{ttsl}}
1422 % Default leading.
1423 \newdimen\textleading \textleading = 13.2pt
1425 % Set the baselineskip to #1, and the lineskip and strut size
1426 % correspondingly. There is no deep meaning behind these magic numbers
1427 % used as factors; they just match (closely enough) what Knuth defined.
1429 \def\lineskipfactor{.08333}
1430 \def\strutheightpercent{.70833}
1431 \def\strutdepthpercent {.29167}
1433 \def\setleading#1{%
1434 \normalbaselineskip = #1\relax
1435 \normallineskip = \lineskipfactor\normalbaselineskip
1436 \normalbaselines
1437 \setbox\strutbox =\hbox{%
1438 \vrule width0pt height\strutheightpercent\baselineskip
1439 depth \strutdepthpercent \baselineskip
1443 % Set the font macro #1 to the font named #2, adding on the
1444 % specified font prefix (normally `cm').
1445 % #3 is the font's design size, #4 is a scale factor
1446 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1448 % Use cm as the default font prefix.
1449 % To specify the font prefix, you must define \fontprefix
1450 % before you read in texinfo.tex.
1451 \ifx\fontprefix\undefined
1452 \def\fontprefix{cm}
1454 % Support font families that don't use the same naming scheme as CM.
1455 \def\rmshape{r}
1456 \def\rmbshape{bx} %where the normal face is bold
1457 \def\bfshape{b}
1458 \def\bxshape{bx}
1459 \def\ttshape{tt}
1460 \def\ttbshape{tt}
1461 \def\ttslshape{sltt}
1462 \def\itshape{ti}
1463 \def\itbshape{bxti}
1464 \def\slshape{sl}
1465 \def\slbshape{bxsl}
1466 \def\sfshape{ss}
1467 \def\sfbshape{ss}
1468 \def\scshape{csc}
1469 \def\scbshape{csc}
1471 % Text fonts (11.2pt, magstep1).
1472 \def\textnominalsize{11pt}
1473 \edef\mainmagstep{\magstephalf}
1474 \setfont\textrm\rmshape{10}{\mainmagstep}
1475 \setfont\texttt\ttshape{10}{\mainmagstep}
1476 \setfont\textbf\bfshape{10}{\mainmagstep}
1477 \setfont\textit\itshape{10}{\mainmagstep}
1478 \setfont\textsl\slshape{10}{\mainmagstep}
1479 \setfont\textsf\sfshape{10}{\mainmagstep}
1480 \setfont\textsc\scshape{10}{\mainmagstep}
1481 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1482 \font\texti=cmmi10 scaled \mainmagstep
1483 \font\textsy=cmsy10 scaled \mainmagstep
1485 % A few fonts for @defun names and args.
1486 \setfont\defbf\bfshape{10}{\magstep1}
1487 \setfont\deftt\ttshape{10}{\magstep1}
1488 \setfont\defttsl\ttslshape{10}{\magstep1}
1489 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1491 % Fonts for indices, footnotes, small examples (9pt).
1492 \def\smallnominalsize{9pt}
1493 \setfont\smallrm\rmshape{9}{1000}
1494 \setfont\smalltt\ttshape{9}{1000}
1495 \setfont\smallbf\bfshape{10}{900}
1496 \setfont\smallit\itshape{9}{1000}
1497 \setfont\smallsl\slshape{9}{1000}
1498 \setfont\smallsf\sfshape{9}{1000}
1499 \setfont\smallsc\scshape{10}{900}
1500 \setfont\smallttsl\ttslshape{10}{900}
1501 \font\smalli=cmmi9
1502 \font\smallsy=cmsy9
1504 % Fonts for small examples (8pt).
1505 \def\smallernominalsize{8pt}
1506 \setfont\smallerrm\rmshape{8}{1000}
1507 \setfont\smallertt\ttshape{8}{1000}
1508 \setfont\smallerbf\bfshape{10}{800}
1509 \setfont\smallerit\itshape{8}{1000}
1510 \setfont\smallersl\slshape{8}{1000}
1511 \setfont\smallersf\sfshape{8}{1000}
1512 \setfont\smallersc\scshape{10}{800}
1513 \setfont\smallerttsl\ttslshape{10}{800}
1514 \font\smalleri=cmmi8
1515 \font\smallersy=cmsy8
1517 % Fonts for title page (20.4pt):
1518 \def\titlenominalsize{20pt}
1519 \setfont\titlerm\rmbshape{12}{\magstep3}
1520 \setfont\titleit\itbshape{10}{\magstep4}
1521 \setfont\titlesl\slbshape{10}{\magstep4}
1522 \setfont\titlett\ttbshape{12}{\magstep3}
1523 \setfont\titlettsl\ttslshape{10}{\magstep4}
1524 \setfont\titlesf\sfbshape{17}{\magstep1}
1525 \let\titlebf=\titlerm
1526 \setfont\titlesc\scbshape{10}{\magstep4}
1527 \font\titlei=cmmi12 scaled \magstep3
1528 \font\titlesy=cmsy10 scaled \magstep4
1529 \def\authorrm{\secrm}
1530 \def\authortt{\sectt}
1532 % Chapter (and unnumbered) fonts (17.28pt).
1533 \def\chapnominalsize{17pt}
1534 \setfont\chaprm\rmbshape{12}{\magstep2}
1535 \setfont\chapit\itbshape{10}{\magstep3}
1536 \setfont\chapsl\slbshape{10}{\magstep3}
1537 \setfont\chaptt\ttbshape{12}{\magstep2}
1538 \setfont\chapttsl\ttslshape{10}{\magstep3}
1539 \setfont\chapsf\sfbshape{17}{1000}
1540 \let\chapbf=\chaprm
1541 \setfont\chapsc\scbshape{10}{\magstep3}
1542 \font\chapi=cmmi12 scaled \magstep2
1543 \font\chapsy=cmsy10 scaled \magstep3
1545 % Section fonts (14.4pt).
1546 \def\secnominalsize{14pt}
1547 \setfont\secrm\rmbshape{12}{\magstep1}
1548 \setfont\secit\itbshape{10}{\magstep2}
1549 \setfont\secsl\slbshape{10}{\magstep2}
1550 \setfont\sectt\ttbshape{12}{\magstep1}
1551 \setfont\secttsl\ttslshape{10}{\magstep2}
1552 \setfont\secsf\sfbshape{12}{\magstep1}
1553 \let\secbf\secrm
1554 \setfont\secsc\scbshape{10}{\magstep2}
1555 \font\seci=cmmi12 scaled \magstep1
1556 \font\secsy=cmsy10 scaled \magstep2
1558 % Subsection fonts (13.15pt).
1559 \def\ssecnominalsize{13pt}
1560 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1561 \setfont\ssecit\itbshape{10}{1315}
1562 \setfont\ssecsl\slbshape{10}{1315}
1563 \setfont\ssectt\ttbshape{12}{\magstephalf}
1564 \setfont\ssecttsl\ttslshape{10}{1315}
1565 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1566 \let\ssecbf\ssecrm
1567 \setfont\ssecsc\scbshape{10}{1315}
1568 \font\sseci=cmmi12 scaled \magstephalf
1569 \font\ssecsy=cmsy10 scaled 1315
1571 % Reduced fonts for @acro in text (10pt).
1572 \def\reducednominalsize{10pt}
1573 \setfont\reducedrm\rmshape{10}{1000}
1574 \setfont\reducedtt\ttshape{10}{1000}
1575 \setfont\reducedbf\bfshape{10}{1000}
1576 \setfont\reducedit\itshape{10}{1000}
1577 \setfont\reducedsl\slshape{10}{1000}
1578 \setfont\reducedsf\sfshape{10}{1000}
1579 \setfont\reducedsc\scshape{10}{1000}
1580 \setfont\reducedttsl\ttslshape{10}{1000}
1581 \font\reducedi=cmmi10
1582 \font\reducedsy=cmsy10
1584 % In order for the font changes to affect most math symbols and letters,
1585 % we have to define the \textfont of the standard families. Since
1586 % texinfo doesn't allow for producing subscripts and superscripts except
1587 % in the main text, we don't bother to reset \scriptfont and
1588 % \scriptscriptfont (which would also require loading a lot more fonts).
1590 \def\resetmathfonts{%
1591 \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
1592 \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
1593 \textfont\ttfam=\tentt \textfont\sffam=\tensf
1596 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1597 % of just \STYLE. We do this because \STYLE needs to also set the
1598 % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
1599 % \tenSTYLE to set the current font.
1601 % Each font-changing command also sets the names \lsize (one size lower)
1602 % and \lllsize (three sizes lower). These relative commands are used in
1603 % the LaTeX logo and acronyms.
1605 % This all needs generalizing, badly.
1607 \def\textfonts{%
1608 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1609 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1610 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
1611 \let\tenttsl=\textttsl
1612 \def\curfontsize{text}%
1613 \def\lsize{reduced}\def\lllsize{smaller}%
1614 \resetmathfonts \setleading{\textleading}}
1615 \def\titlefonts{%
1616 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
1617 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
1618 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
1619 \let\tenttsl=\titlettsl
1620 \def\curfontsize{title}%
1621 \def\lsize{chap}\def\lllsize{subsec}%
1622 \resetmathfonts \setleading{25pt}}
1623 \def\titlefont#1{{\titlefonts\rm #1}}
1624 \def\chapfonts{%
1625 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1626 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1627 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
1628 \let\tenttsl=\chapttsl
1629 \def\curfontsize{chap}%
1630 \def\lsize{sec}\def\lllsize{text}%
1631 \resetmathfonts \setleading{19pt}}
1632 \def\secfonts{%
1633 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1634 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1635 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
1636 \let\tenttsl=\secttsl
1637 \def\curfontsize{sec}%
1638 \def\lsize{subsec}\def\lllsize{reduced}%
1639 \resetmathfonts \setleading{16pt}}
1640 \def\subsecfonts{%
1641 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1642 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1643 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
1644 \let\tenttsl=\ssecttsl
1645 \def\curfontsize{ssec}%
1646 \def\lsize{text}\def\lllsize{small}%
1647 \resetmathfonts \setleading{15pt}}
1648 \let\subsubsecfonts = \subsecfonts
1649 \def\reducedfonts{%
1650 \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
1651 \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
1652 \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
1653 \let\tenttsl=\reducedttsl
1654 \def\curfontsize{reduced}%
1655 \def\lsize{small}\def\lllsize{smaller}%
1656 \resetmathfonts \setleading{10.5pt}}
1657 \def\smallfonts{%
1658 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
1659 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
1660 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
1661 \let\tenttsl=\smallttsl
1662 \def\curfontsize{small}%
1663 \def\lsize{smaller}\def\lllsize{smaller}%
1664 \resetmathfonts \setleading{10.5pt}}
1665 \def\smallerfonts{%
1666 \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
1667 \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
1668 \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
1669 \let\tenttsl=\smallerttsl
1670 \def\curfontsize{smaller}%
1671 \def\lsize{smaller}\def\lllsize{smaller}%
1672 \resetmathfonts \setleading{9.5pt}}
1674 % Set the fonts to use with the @small... environments.
1675 \let\smallexamplefonts = \smallfonts
1677 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
1678 % can fit this many characters:
1679 % 8.5x11=86 smallbook=72 a4=90 a5=69
1680 % If we use \scriptfonts (8pt), then we can fit this many characters:
1681 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
1682 % For me, subjectively, the few extra characters that fit aren't worth
1683 % the additional smallness of 8pt. So I'm making the default 9pt.
1685 % By the way, for comparison, here's what fits with @example (10pt):
1686 % 8.5x11=71 smallbook=60 a4=75 a5=58
1688 % I wish the USA used A4 paper.
1689 % --karl, 24jan03.
1692 % Set up the default fonts, so we can use them for creating boxes.
1694 \textfonts \rm
1696 % Define these so they can be easily changed for other fonts.
1697 \def\angleleft{$\langle$}
1698 \def\angleright{$\rangle$}
1700 % Count depth in font-changes, for error checks
1701 \newcount\fontdepth \fontdepth=0
1703 % Fonts for short table of contents.
1704 \setfont\shortcontrm\rmshape{12}{1000}
1705 \setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12
1706 \setfont\shortcontsl\slshape{12}{1000}
1707 \setfont\shortconttt\ttshape{12}{1000}
1709 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1710 %% serif) and @ii for TeX italic
1712 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1713 % unless the following character is such as not to need one.
1714 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else
1715 \ptexslash\fi\fi\fi}
1716 \def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
1717 \def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
1719 % like \smartslanted except unconditionally uses \ttsl.
1720 % @var is set to this for defun arguments.
1721 \def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx}
1723 % like \smartslanted except unconditionally use \sl. We never want
1724 % ttsl for book titles, do we?
1725 \def\cite#1{{\sl #1}\futurelet\next\smartitalicx}
1727 \let\i=\smartitalic
1728 \let\slanted=\smartslanted
1729 \let\var=\smartslanted
1730 \let\dfn=\smartslanted
1731 \let\emph=\smartitalic
1733 % @b, explicit bold.
1734 \def\b#1{{\bf #1}}
1735 \let\strong=\b
1737 % @sansserif, explicit sans.
1738 \def\sansserif#1{{\sf #1}}
1740 % We can't just use \exhyphenpenalty, because that only has effect at
1741 % the end of a paragraph. Restore normal hyphenation at the end of the
1742 % group within which \nohyphenation is presumably called.
1744 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1745 \def\restorehyphenation{\hyphenchar\font = `- }
1747 % Set sfcode to normal for the chars that usually have another value.
1748 % Can't use plain's \frenchspacing because it uses the `\x notation, and
1749 % sometimes \x has an active definition that messes things up.
1751 \catcode`@=11
1752 \def\frenchspacing{%
1753 \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
1754 \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
1756 \catcode`@=\other
1758 \def\t#1{%
1759 {\tt \rawbackslash \frenchspacing #1}%
1760 \null
1762 \def\samp#1{`\tclose{#1}'\null}
1763 \setfont\keyrm\rmshape{8}{1000}
1764 \font\keysy=cmsy9
1765 \def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
1766 \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
1767 \vbox{\hrule\kern-0.4pt
1768 \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
1769 \kern-0.4pt\hrule}%
1770 \kern-.06em\raise0.4pt\hbox{\angleright}}}}
1771 % The old definition, with no lozenge:
1772 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1773 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1775 % @file, @option are the same as @samp.
1776 \let\file=\samp
1777 \let\option=\samp
1779 % @code is a modification of @t,
1780 % which makes spaces the same size as normal in the surrounding text.
1781 \def\tclose#1{%
1783 % Change normal interword space to be same as for the current font.
1784 \spaceskip = \fontdimen2\font
1786 % Switch to typewriter.
1789 % But `\ ' produces the large typewriter interword space.
1790 \def\ {{\spaceskip = 0pt{} }}%
1792 % Turn off hyphenation.
1793 \nohyphenation
1795 \rawbackslash
1796 \frenchspacing
1799 \null
1802 % We *must* turn on hyphenation at `-' and `_' in @code.
1803 % Otherwise, it is too hard to avoid overfull hboxes
1804 % in the Emacs manual, the Library manual, etc.
1806 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1807 % both hyphenation at - and hyphenation within words.
1808 % We must therefore turn them both off (\tclose does that)
1809 % and arrange explicitly to hyphenate at a dash.
1810 % -- rms.
1812 \catcode`\-=\active
1813 \catcode`\_=\active
1815 \global\def\code{\begingroup
1816 \catcode`\-=\active \let-\codedash
1817 \catcode`\_=\active \let_\codeunder
1818 \codex
1822 \def\realdash{-}
1823 \def\codedash{-\discretionary{}{}{}}
1824 \def\codeunder{%
1825 % this is all so @math{@code{var_name}+1} can work. In math mode, _
1826 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
1827 % will therefore expand the active definition of _, which is us
1828 % (inside @code that is), therefore an endless loop.
1829 \ifusingtt{\ifmmode
1830 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
1831 \else\normalunderscore \fi
1832 \discretionary{}{}{}}%
1833 {\_}%
1835 \def\codex #1{\tclose{#1}\endgroup}
1837 % @kbd is like @code, except that if the argument is just one @key command,
1838 % then @kbd has no effect.
1840 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
1841 % `example' (@kbd uses ttsl only inside of @example and friends),
1842 % or `code' (@kbd uses normal tty font always).
1843 \parseargdef\kbdinputstyle{%
1844 \def\arg{#1}%
1845 \ifx\arg\worddistinct
1846 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
1847 \else\ifx\arg\wordexample
1848 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
1849 \else\ifx\arg\wordcode
1850 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
1851 \else
1852 \errhelp = \EMsimple
1853 \errmessage{Unknown @kbdinputstyle option `\arg'}%
1854 \fi\fi\fi
1856 \def\worddistinct{distinct}
1857 \def\wordexample{example}
1858 \def\wordcode{code}
1860 % Default is `distinct.'
1861 \kbdinputstyle distinct
1863 \def\xkey{\key}
1864 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1865 \ifx\one\xkey\ifx\threex\three \key{#2}%
1866 \else{\tclose{\kbdfont\look}}\fi
1867 \else{\tclose{\kbdfont\look}}\fi}
1869 % For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
1870 \let\indicateurl=\code
1871 \let\env=\code
1872 \let\command=\code
1874 % @uref (abbreviation for `urlref') takes an optional (comma-separated)
1875 % second argument specifying the text to display and an optional third
1876 % arg as text to display instead of (rather than in addition to) the url
1877 % itself. First (mandatory) arg is the url. Perhaps eventually put in
1878 % a hypertex \special here.
1880 \def\uref#1{\douref #1,,,\finish}
1881 \def\douref#1,#2,#3,#4\finish{\begingroup
1882 \unsepspaces
1883 \pdfurl{#1}%
1884 \setbox0 = \hbox{\ignorespaces #3}%
1885 \ifdim\wd0 > 0pt
1886 \unhbox0 % third arg given, show only that
1887 \else
1888 \setbox0 = \hbox{\ignorespaces #2}%
1889 \ifdim\wd0 > 0pt
1890 \ifpdf
1891 \unhbox0 % PDF: 2nd arg given, show only it
1892 \else
1893 \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
1895 \else
1896 \code{#1}% only url given, so show it
1899 \endlink
1900 \endgroup}
1902 % @url synonym for @uref, since that's how everyone uses it.
1904 \let\url=\uref
1906 % rms does not like angle brackets --karl, 17may97.
1907 % So now @email is just like @uref, unless we are pdf.
1909 %\def\email#1{\angleleft{\tt #1}\angleright}
1910 \ifpdf
1911 \def\email#1{\doemail#1,,\finish}
1912 \def\doemail#1,#2,#3\finish{\begingroup
1913 \unsepspaces
1914 \pdfurl{mailto:#1}%
1915 \setbox0 = \hbox{\ignorespaces #2}%
1916 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
1917 \endlink
1918 \endgroup}
1919 \else
1920 \let\email=\uref
1923 % Check if we are currently using a typewriter font. Since all the
1924 % Computer Modern typewriter fonts have zero interword stretch (and
1925 % shrink), and it is reasonable to expect all typewriter fonts to have
1926 % this property, we can check that font parameter.
1928 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1930 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1931 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
1933 \def\dmn#1{\thinspace #1}
1935 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1937 % @l was never documented to mean ``switch to the Lisp font'',
1938 % and it is not used as such in any manual I can find. We need it for
1939 % Polish suppressed-l. --karl, 22sep96.
1940 %\def\l#1{{\li #1}\null}
1942 % Explicit font changes: @r, @sc, undocumented @ii.
1943 \def\r#1{{\rm #1}} % roman font
1944 \def\sc#1{{\smallcaps#1}} % smallcaps font
1945 \def\ii#1{{\it #1}} % italic font
1947 % @acronym for "FBI", "NATO", and the like.
1948 % We print this one point size smaller, since it's intended for
1949 % all-uppercase.
1951 \def\acronym#1{\doacronym #1,,\finish}
1952 \def\doacronym#1,#2,#3\finish{%
1953 {\selectfonts\lsize #1}%
1954 \def\temp{#2}%
1955 \ifx\temp\empty \else
1956 \space ({\unsepspaces \ignorespaces \temp \unskip})%
1960 % @abbr for "Comput. J." and the like.
1961 % No font change, but don't do end-of-sentence spacing.
1963 \def\abbr#1{\doabbr #1,,\finish}
1964 \def\doabbr#1,#2,#3\finish{%
1965 {\frenchspacing #1}%
1966 \def\temp{#2}%
1967 \ifx\temp\empty \else
1968 \space ({\unsepspaces \ignorespaces \temp \unskip})%
1972 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
1974 \def\pounds{{\it\$}}
1976 % @euro{} comes from a separate font, depending on the current style.
1977 % We use the free feym* fonts from the eurosym package by Henrik
1978 % Theiling, which support regular, slanted, bold and bold slanted (and
1979 % "outlined" (blackboard board, sort of) versions, which we don't need).
1980 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
1982 % Although only regular is the truly official Euro symbol, we ignore
1983 % that. The Euro is designed to be slightly taller than the regular
1984 % font height.
1986 % feymr - regular
1987 % feymo - slanted
1988 % feybr - bold
1989 % feybo - bold slanted
1991 % There is no good (free) typewriter version, to my knowledge.
1992 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
1993 % Hmm.
1995 % Also doesn't work in math. Do we need to do math with euro symbols?
1996 % Hope not.
1999 \def\euro{{\eurofont e}}
2000 \def\eurofont{%
2001 % We set the font at each command, rather than predefining it in
2002 % \textfonts and the other font-switching commands, so that
2003 % installations which never need the symbold don't have to have the
2004 % font installed.
2006 % There is only one designed size (nominal 10pt), so we always scale
2007 % that to the current nominal size.
2009 % By the way, simply using "at 1em" works for cmr10 and the like, but
2010 % does not work for cmbx10 and other extended/shrunken fonts.
2012 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
2014 \ifx\curfontstyle\bfstylename
2015 % bold:
2016 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
2017 \else
2018 % regular:
2019 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
2021 \thiseurofont
2024 % @registeredsymbol - R in a circle. The font for the R should really
2025 % be smaller yet, but lllsize is the best we can do for now.
2026 % Adapted from the plain.tex definition of \copyright.
2028 \def\registeredsymbol{%
2029 $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
2030 \hfil\crcr\Orb}}%
2034 % Laurent Siebenmann reports \Orb undefined with:
2035 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
2036 % so we'll define it if necessary.
2038 \ifx\Orb\undefined
2039 \def\Orb{\mathhexbox20D}
2043 \message{page headings,}
2045 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
2046 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
2048 % First the title page. Must do @settitle before @titlepage.
2049 \newif\ifseenauthor
2050 \newif\iffinishedtitlepage
2052 % Do an implicit @contents or @shortcontents after @end titlepage if the
2053 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
2055 \newif\ifsetcontentsaftertitlepage
2056 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
2057 \newif\ifsetshortcontentsaftertitlepage
2058 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
2060 \parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
2061 \endgroup\page\hbox{}\page}
2063 \envdef\titlepage{%
2064 % Open one extra group, as we want to close it in the middle of \Etitlepage.
2065 \begingroup
2066 \parindent=0pt \textfonts
2067 % Leave some space at the very top of the page.
2068 \vglue\titlepagetopglue
2069 % No rule at page bottom unless we print one at the top with @title.
2070 \finishedtitlepagetrue
2072 % Most title ``pages'' are actually two pages long, with space
2073 % at the top of the second. We don't want the ragged left on the second.
2074 \let\oldpage = \page
2075 \def\page{%
2076 \iffinishedtitlepage\else
2077 \finishtitlepage
2079 \let\page = \oldpage
2080 \page
2081 \null
2085 \def\Etitlepage{%
2086 \iffinishedtitlepage\else
2087 \finishtitlepage
2089 % It is important to do the page break before ending the group,
2090 % because the headline and footline are only empty inside the group.
2091 % If we use the new definition of \page, we always get a blank page
2092 % after the title page, which we certainly don't want.
2093 \oldpage
2094 \endgroup
2096 % Need this before the \...aftertitlepage checks so that if they are
2097 % in effect the toc pages will come out with page numbers.
2098 \HEADINGSon
2100 % If they want short, they certainly want long too.
2101 \ifsetshortcontentsaftertitlepage
2102 \shortcontents
2103 \contents
2104 \global\let\shortcontents = \relax
2105 \global\let\contents = \relax
2108 \ifsetcontentsaftertitlepage
2109 \contents
2110 \global\let\contents = \relax
2111 \global\let\shortcontents = \relax
2115 \def\finishtitlepage{%
2116 \vskip4pt \hrule height 2pt width \hsize
2117 \vskip\titlepagebottomglue
2118 \finishedtitlepagetrue
2121 %%% Macros to be used within @titlepage:
2123 \let\subtitlerm=\tenrm
2124 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
2126 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
2127 \let\tt=\authortt}
2129 \parseargdef\title{%
2130 \checkenv\titlepage
2131 \leftline{\titlefonts\rm #1}
2132 % print a rule at the page bottom also.
2133 \finishedtitlepagefalse
2134 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
2137 \parseargdef\subtitle{%
2138 \checkenv\titlepage
2139 {\subtitlefont \rightline{#1}}%
2142 % @author should come last, but may come many times.
2143 % It can also be used inside @quotation.
2145 \parseargdef\author{%
2146 \def\temp{\quotation}%
2147 \ifx\thisenv\temp
2148 \def\quotationauthor{#1}% printed in \Equotation.
2149 \else
2150 \checkenv\titlepage
2151 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
2152 {\authorfont \leftline{#1}}%
2157 %%% Set up page headings and footings.
2159 \let\thispage=\folio
2161 \newtoks\evenheadline % headline on even pages
2162 \newtoks\oddheadline % headline on odd pages
2163 \newtoks\evenfootline % footline on even pages
2164 \newtoks\oddfootline % footline on odd pages
2166 % Now make TeX use those variables
2167 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
2168 \else \the\evenheadline \fi}}
2169 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
2170 \else \the\evenfootline \fi}\HEADINGShook}
2171 \let\HEADINGShook=\relax
2173 % Commands to set those variables.
2174 % For example, this is what @headings on does
2175 % @evenheading @thistitle|@thispage|@thischapter
2176 % @oddheading @thischapter|@thispage|@thistitle
2177 % @evenfooting @thisfile||
2178 % @oddfooting ||@thisfile
2181 \def\evenheading{\parsearg\evenheadingxxx}
2182 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
2183 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
2184 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
2186 \def\oddheading{\parsearg\oddheadingxxx}
2187 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
2188 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
2189 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
2191 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
2193 \def\evenfooting{\parsearg\evenfootingxxx}
2194 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
2195 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
2196 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
2198 \def\oddfooting{\parsearg\oddfootingxxx}
2199 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
2200 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
2201 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
2203 % Leave some space for the footline. Hopefully ok to assume
2204 % @evenfooting will not be used by itself.
2205 \global\advance\pageheight by -\baselineskip
2206 \global\advance\vsize by -\baselineskip
2209 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
2212 % @headings double turns headings on for double-sided printing.
2213 % @headings single turns headings on for single-sided printing.
2214 % @headings off turns them off.
2215 % @headings on same as @headings double, retained for compatibility.
2216 % @headings after turns on double-sided headings after this page.
2217 % @headings doubleafter turns on double-sided headings after this page.
2218 % @headings singleafter turns on single-sided headings after this page.
2219 % By default, they are off at the start of a document,
2220 % and turned `on' after @end titlepage.
2222 \def\headings #1 {\csname HEADINGS#1\endcsname}
2224 \def\HEADINGSoff{%
2225 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
2226 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
2227 \HEADINGSoff
2228 % When we turn headings on, set the page number to 1.
2229 % For double-sided printing, put current file name in lower left corner,
2230 % chapter name on inside top of right hand pages, document
2231 % title on inside top of left hand pages, and page numbers on outside top
2232 % edge of all pages.
2233 \def\HEADINGSdouble{%
2234 \global\pageno=1
2235 \global\evenfootline={\hfil}
2236 \global\oddfootline={\hfil}
2237 \global\evenheadline={\line{\folio\hfil\thistitle}}
2238 \global\oddheadline={\line{\thischapter\hfil\folio}}
2239 \global\let\contentsalignmacro = \chapoddpage
2241 \let\contentsalignmacro = \chappager
2243 % For single-sided printing, chapter title goes across top left of page,
2244 % page number on top right.
2245 \def\HEADINGSsingle{%
2246 \global\pageno=1
2247 \global\evenfootline={\hfil}
2248 \global\oddfootline={\hfil}
2249 \global\evenheadline={\line{\thischapter\hfil\folio}}
2250 \global\oddheadline={\line{\thischapter\hfil\folio}}
2251 \global\let\contentsalignmacro = \chappager
2253 \def\HEADINGSon{\HEADINGSdouble}
2255 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
2256 \let\HEADINGSdoubleafter=\HEADINGSafter
2257 \def\HEADINGSdoublex{%
2258 \global\evenfootline={\hfil}
2259 \global\oddfootline={\hfil}
2260 \global\evenheadline={\line{\folio\hfil\thistitle}}
2261 \global\oddheadline={\line{\thischapter\hfil\folio}}
2262 \global\let\contentsalignmacro = \chapoddpage
2265 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
2266 \def\HEADINGSsinglex{%
2267 \global\evenfootline={\hfil}
2268 \global\oddfootline={\hfil}
2269 \global\evenheadline={\line{\thischapter\hfil\folio}}
2270 \global\oddheadline={\line{\thischapter\hfil\folio}}
2271 \global\let\contentsalignmacro = \chappager
2274 % Subroutines used in generating headings
2275 % This produces Day Month Year style of output.
2276 % Only define if not already defined, in case a txi-??.tex file has set
2277 % up a different format (e.g., txi-cs.tex does this).
2278 \ifx\today\undefined
2279 \def\today{%
2280 \number\day\space
2281 \ifcase\month
2282 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
2283 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
2284 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
2286 \space\number\year}
2289 % @settitle line... specifies the title of the document, for headings.
2290 % It generates no output of its own.
2291 \def\thistitle{\putwordNoTitle}
2292 \def\settitle{\parsearg{\gdef\thistitle}}
2295 \message{tables,}
2296 % Tables -- @table, @ftable, @vtable, @item(x).
2298 % default indentation of table text
2299 \newdimen\tableindent \tableindent=.8in
2300 % default indentation of @itemize and @enumerate text
2301 \newdimen\itemindent \itemindent=.3in
2302 % margin between end of table item and start of table text.
2303 \newdimen\itemmargin \itemmargin=.1in
2305 % used internally for \itemindent minus \itemmargin
2306 \newdimen\itemmax
2308 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
2309 % these defs.
2310 % They also define \itemindex
2311 % to index the item name in whatever manner is desired (perhaps none).
2313 \newif\ifitemxneedsnegativevskip
2315 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
2317 \def\internalBitem{\smallbreak \parsearg\itemzzz}
2318 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
2320 \def\itemzzz #1{\begingroup %
2321 \advance\hsize by -\rightskip
2322 \advance\hsize by -\tableindent
2323 \setbox0=\hbox{\itemindicate{#1}}%
2324 \itemindex{#1}%
2325 \nobreak % This prevents a break before @itemx.
2327 % If the item text does not fit in the space we have, put it on a line
2328 % by itself, and do not allow a page break either before or after that
2329 % line. We do not start a paragraph here because then if the next
2330 % command is, e.g., @kindex, the whatsit would get put into the
2331 % horizontal list on a line by itself, resulting in extra blank space.
2332 \ifdim \wd0>\itemmax
2334 % Make this a paragraph so we get the \parskip glue and wrapping,
2335 % but leave it ragged-right.
2336 \begingroup
2337 \advance\leftskip by-\tableindent
2338 \advance\hsize by\tableindent
2339 \advance\rightskip by0pt plus1fil
2340 \leavevmode\unhbox0\par
2341 \endgroup
2343 % We're going to be starting a paragraph, but we don't want the
2344 % \parskip glue -- logically it's part of the @item we just started.
2345 \nobreak \vskip-\parskip
2347 % Stop a page break at the \parskip glue coming up. However, if
2348 % what follows is an environment such as @example, there will be no
2349 % \parskip glue; then the negative vskip we just inserted would
2350 % cause the example and the item to crash together. So we use this
2351 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
2352 % \parskip glue after all. Section titles are handled this way also.
2354 \penalty 10001
2355 \endgroup
2356 \itemxneedsnegativevskipfalse
2357 \else
2358 % The item text fits into the space. Start a paragraph, so that the
2359 % following text (if any) will end up on the same line.
2360 \noindent
2361 % Do this with kerns and \unhbox so that if there is a footnote in
2362 % the item text, it can migrate to the main vertical list and
2363 % eventually be printed.
2364 \nobreak\kern-\tableindent
2365 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
2366 \unhbox0
2367 \nobreak\kern\dimen0
2368 \endgroup
2369 \itemxneedsnegativevskiptrue
2373 \def\item{\errmessage{@item while not in a list environment}}
2374 \def\itemx{\errmessage{@itemx while not in a list environment}}
2376 % @table, @ftable, @vtable.
2377 \envdef\table{%
2378 \let\itemindex\gobble
2379 \tablecheck{table}%
2381 \envdef\ftable{%
2382 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
2383 \tablecheck{ftable}%
2385 \envdef\vtable{%
2386 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
2387 \tablecheck{vtable}%
2389 \def\tablecheck#1{%
2390 \ifnum \the\catcode`\^^M=\active
2391 \endgroup
2392 \errmessage{This command won't work in this context; perhaps the problem is
2393 that we are \inenvironment\thisenv}%
2394 \def\next{\doignore{#1}}%
2395 \else
2396 \let\next\tablex
2398 \next
2400 \def\tablex#1{%
2401 \def\itemindicate{#1}%
2402 \parsearg\tabley
2404 \def\tabley#1{%
2406 \makevalueexpandable
2407 \edef\temp{\noexpand\tablez #1\space\space\space}%
2408 \expandafter
2409 }\temp \endtablez
2411 \def\tablez #1 #2 #3 #4\endtablez{%
2412 \aboveenvbreak
2413 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
2414 \ifnum 0#2>0 \tableindent=#2\mil \fi
2415 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
2416 \itemmax=\tableindent
2417 \advance \itemmax by -\itemmargin
2418 \advance \leftskip by \tableindent
2419 \exdentamount=\tableindent
2420 \parindent = 0pt
2421 \parskip = \smallskipamount
2422 \ifdim \parskip=0pt \parskip=2pt \fi
2423 \let\item = \internalBitem
2424 \let\itemx = \internalBitemx
2426 \def\Etable{\endgraf\afterenvbreak}
2427 \let\Eftable\Etable
2428 \let\Evtable\Etable
2429 \let\Eitemize\Etable
2430 \let\Eenumerate\Etable
2432 % This is the counter used by @enumerate, which is really @itemize
2434 \newcount \itemno
2436 \envdef\itemize{\parsearg\doitemize}
2438 \def\doitemize#1{%
2439 \aboveenvbreak
2440 \itemmax=\itemindent
2441 \advance\itemmax by -\itemmargin
2442 \advance\leftskip by \itemindent
2443 \exdentamount=\itemindent
2444 \parindent=0pt
2445 \parskip=\smallskipamount
2446 \ifdim\parskip=0pt \parskip=2pt \fi
2447 \def\itemcontents{#1}%
2448 % @itemize with no arg is equivalent to @itemize @bullet.
2449 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
2450 \let\item=\itemizeitem
2453 % Definition of @item while inside @itemize and @enumerate.
2455 \def\itemizeitem{%
2456 \advance\itemno by 1 % for enumerations
2457 {\let\par=\endgraf \smallbreak}% reasonable place to break
2459 % If the document has an @itemize directly after a section title, a
2460 % \nobreak will be last on the list, and \sectionheading will have
2461 % done a \vskip-\parskip. In that case, we don't want to zero
2462 % parskip, or the item text will crash with the heading. On the
2463 % other hand, when there is normal text preceding the item (as there
2464 % usually is), we do want to zero parskip, or there would be too much
2465 % space. In that case, we won't have a \nobreak before. At least
2466 % that's the theory.
2467 \ifnum\lastpenalty<10000 \parskip=0in \fi
2468 \noindent
2469 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
2470 \vadjust{\penalty 1200}}% not good to break after first line of item.
2471 \flushcr
2474 % \splitoff TOKENS\endmark defines \first to be the first token in
2475 % TOKENS, and \rest to be the remainder.
2477 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
2479 % Allow an optional argument of an uppercase letter, lowercase letter,
2480 % or number, to specify the first label in the enumerated list. No
2481 % argument is the same as `1'.
2483 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
2484 \def\enumeratey #1 #2\endenumeratey{%
2485 % If we were given no argument, pretend we were given `1'.
2486 \def\thearg{#1}%
2487 \ifx\thearg\empty \def\thearg{1}\fi
2489 % Detect if the argument is a single token. If so, it might be a
2490 % letter. Otherwise, the only valid thing it can be is a number.
2491 % (We will always have one token, because of the test we just made.
2492 % This is a good thing, since \splitoff doesn't work given nothing at
2493 % all -- the first parameter is undelimited.)
2494 \expandafter\splitoff\thearg\endmark
2495 \ifx\rest\empty
2496 % Only one token in the argument. It could still be anything.
2497 % A ``lowercase letter'' is one whose \lccode is nonzero.
2498 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
2499 % not equal to itself.
2500 % Otherwise, we assume it's a number.
2502 % We need the \relax at the end of the \ifnum lines to stop TeX from
2503 % continuing to look for a <number>.
2505 \ifnum\lccode\expandafter`\thearg=0\relax
2506 \numericenumerate % a number (we hope)
2507 \else
2508 % It's a letter.
2509 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
2510 \lowercaseenumerate % lowercase letter
2511 \else
2512 \uppercaseenumerate % uppercase letter
2515 \else
2516 % Multiple tokens in the argument. We hope it's a number.
2517 \numericenumerate
2521 % An @enumerate whose labels are integers. The starting integer is
2522 % given in \thearg.
2524 \def\numericenumerate{%
2525 \itemno = \thearg
2526 \startenumeration{\the\itemno}%
2529 % The starting (lowercase) letter is in \thearg.
2530 \def\lowercaseenumerate{%
2531 \itemno = \expandafter`\thearg
2532 \startenumeration{%
2533 % Be sure we're not beyond the end of the alphabet.
2534 \ifnum\itemno=0
2535 \errmessage{No more lowercase letters in @enumerate; get a bigger
2536 alphabet}%
2538 \char\lccode\itemno
2542 % The starting (uppercase) letter is in \thearg.
2543 \def\uppercaseenumerate{%
2544 \itemno = \expandafter`\thearg
2545 \startenumeration{%
2546 % Be sure we're not beyond the end of the alphabet.
2547 \ifnum\itemno=0
2548 \errmessage{No more uppercase letters in @enumerate; get a bigger
2549 alphabet}
2551 \char\uccode\itemno
2555 % Call \doitemize, adding a period to the first argument and supplying the
2556 % common last two arguments. Also subtract one from the initial value in
2557 % \itemno, since @item increments \itemno.
2559 \def\startenumeration#1{%
2560 \advance\itemno by -1
2561 \doitemize{#1.}\flushcr
2564 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
2565 % to @enumerate.
2567 \def\alphaenumerate{\enumerate{a}}
2568 \def\capsenumerate{\enumerate{A}}
2569 \def\Ealphaenumerate{\Eenumerate}
2570 \def\Ecapsenumerate{\Eenumerate}
2573 % @multitable macros
2574 % Amy Hendrickson, 8/18/94, 3/6/96
2576 % @multitable ... @end multitable will make as many columns as desired.
2577 % Contents of each column will wrap at width given in preamble. Width
2578 % can be specified either with sample text given in a template line,
2579 % or in percent of \hsize, the current width of text on page.
2581 % Table can continue over pages but will only break between lines.
2583 % To make preamble:
2585 % Either define widths of columns in terms of percent of \hsize:
2586 % @multitable @columnfractions .25 .3 .45
2587 % @item ...
2589 % Numbers following @columnfractions are the percent of the total
2590 % current hsize to be used for each column. You may use as many
2591 % columns as desired.
2594 % Or use a template:
2595 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2596 % @item ...
2597 % using the widest term desired in each column.
2599 % Each new table line starts with @item, each subsequent new column
2600 % starts with @tab. Empty columns may be produced by supplying @tab's
2601 % with nothing between them for as many times as empty columns are needed,
2602 % ie, @tab@tab@tab will produce two empty columns.
2604 % @item, @tab do not need to be on their own lines, but it will not hurt
2605 % if they are.
2607 % Sample multitable:
2609 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2610 % @item first col stuff @tab second col stuff @tab third col
2611 % @item
2612 % first col stuff
2613 % @tab
2614 % second col stuff
2615 % @tab
2616 % third col
2617 % @item first col stuff @tab second col stuff
2618 % @tab Many paragraphs of text may be used in any column.
2620 % They will wrap at the width determined by the template.
2621 % @item@tab@tab This will be in third column.
2622 % @end multitable
2624 % Default dimensions may be reset by user.
2625 % @multitableparskip is vertical space between paragraphs in table.
2626 % @multitableparindent is paragraph indent in table.
2627 % @multitablecolmargin is horizontal space to be left between columns.
2628 % @multitablelinespace is space to leave between table items, baseline
2629 % to baseline.
2630 % 0pt means it depends on current normal line spacing.
2632 \newskip\multitableparskip
2633 \newskip\multitableparindent
2634 \newdimen\multitablecolspace
2635 \newskip\multitablelinespace
2636 \multitableparskip=0pt
2637 \multitableparindent=6pt
2638 \multitablecolspace=12pt
2639 \multitablelinespace=0pt
2641 % Macros used to set up halign preamble:
2643 \let\endsetuptable\relax
2644 \def\xendsetuptable{\endsetuptable}
2645 \let\columnfractions\relax
2646 \def\xcolumnfractions{\columnfractions}
2647 \newif\ifsetpercent
2649 % #1 is the @columnfraction, usually a decimal number like .5, but might
2650 % be just 1. We just use it, whatever it is.
2652 \def\pickupwholefraction#1 {%
2653 \global\advance\colcount by 1
2654 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
2655 \setuptable
2658 \newcount\colcount
2659 \def\setuptable#1{%
2660 \def\firstarg{#1}%
2661 \ifx\firstarg\xendsetuptable
2662 \let\go = \relax
2663 \else
2664 \ifx\firstarg\xcolumnfractions
2665 \global\setpercenttrue
2666 \else
2667 \ifsetpercent
2668 \let\go\pickupwholefraction
2669 \else
2670 \global\advance\colcount by 1
2671 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
2672 % separator; typically that is always in the input, anyway.
2673 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2676 \ifx\go\pickupwholefraction
2677 % Put the argument back for the \pickupwholefraction call, so
2678 % we'll always have a period there to be parsed.
2679 \def\go{\pickupwholefraction#1}%
2680 \else
2681 \let\go = \setuptable
2682 \fi%
2687 % multitable-only commands.
2689 % @headitem starts a heading row, which we typeset in bold.
2690 % Assignments have to be global since we are inside the implicit group
2691 % of an alignment entry. Note that \everycr resets \everytab.
2692 \def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}%
2694 % A \tab used to include \hskip1sp. But then the space in a template
2695 % line is not enough. That is bad. So let's go back to just `&' until
2696 % we encounter the problem it was intended to solve again.
2697 % --karl, nathan@acm.org, 20apr99.
2698 \def\tab{\checkenv\multitable &\the\everytab}%
2700 % @multitable ... @end multitable definitions:
2702 \newtoks\everytab % insert after every tab.
2704 \envdef\multitable{%
2705 \vskip\parskip
2706 \startsavinginserts
2708 % @item within a multitable starts a normal row.
2709 % We use \def instead of \let so that if one of the multitable entries
2710 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
2711 % \endtemplate) expanding \doitemize.
2712 \def\item{\crcr}%
2714 \tolerance=9500
2715 \hbadness=9500
2716 \setmultitablespacing
2717 \parskip=\multitableparskip
2718 \parindent=\multitableparindent
2719 \overfullrule=0pt
2720 \global\colcount=0
2722 \everycr = {%
2723 \noalign{%
2724 \global\everytab={}%
2725 \global\colcount=0 % Reset the column counter.
2726 % Check for saved footnotes, etc.
2727 \checkinserts
2728 % Keeps underfull box messages off when table breaks over pages.
2729 %\filbreak
2730 % Maybe so, but it also creates really weird page breaks when the
2731 % table breaks over pages. Wouldn't \vfil be better? Wait until the
2732 % problem manifests itself, so it can be fixed for real --karl.
2736 \parsearg\domultitable
2738 \def\domultitable#1{%
2739 % To parse everything between @multitable and @item:
2740 \setuptable#1 \endsetuptable
2742 % This preamble sets up a generic column definition, which will
2743 % be used as many times as user calls for columns.
2744 % \vtop will set a single line and will also let text wrap and
2745 % continue for many paragraphs if desired.
2746 \halign\bgroup &%
2747 \global\advance\colcount by 1
2748 \multistrut
2749 \vtop{%
2750 % Use the current \colcount to find the correct column width:
2751 \hsize=\expandafter\csname col\the\colcount\endcsname
2753 % In order to keep entries from bumping into each other
2754 % we will add a \leftskip of \multitablecolspace to all columns after
2755 % the first one.
2757 % If a template has been used, we will add \multitablecolspace
2758 % to the width of each template entry.
2760 % If the user has set preamble in terms of percent of \hsize we will
2761 % use that dimension as the width of the column, and the \leftskip
2762 % will keep entries from bumping into each other. Table will start at
2763 % left margin and final column will justify at right margin.
2765 % Make sure we don't inherit \rightskip from the outer environment.
2766 \rightskip=0pt
2767 \ifnum\colcount=1
2768 % The first column will be indented with the surrounding text.
2769 \advance\hsize by\leftskip
2770 \else
2771 \ifsetpercent \else
2772 % If user has not set preamble in terms of percent of \hsize
2773 % we will advance \hsize by \multitablecolspace.
2774 \advance\hsize by \multitablecolspace
2776 % In either case we will make \leftskip=\multitablecolspace:
2777 \leftskip=\multitablecolspace
2779 % Ignoring space at the beginning and end avoids an occasional spurious
2780 % blank line, when TeX decides to break the line at the space before the
2781 % box from the multistrut, so the strut ends up on a line by itself.
2782 % For example:
2783 % @multitable @columnfractions .11 .89
2784 % @item @code{#}
2785 % @tab Legal holiday which is valid in major parts of the whole country.
2786 % Is automatically provided with highlighting sequences respectively
2787 % marking characters.
2788 \noindent\ignorespaces##\unskip\multistrut
2789 }\cr
2791 \def\Emultitable{%
2792 \crcr
2793 \egroup % end the \halign
2794 \global\setpercentfalse
2797 \def\setmultitablespacing{%
2798 \def\multistrut{\strut}% just use the standard line spacing
2800 % Compute \multitablelinespace (if not defined by user) for use in
2801 % \multitableparskip calculation. We used define \multistrut based on
2802 % this, but (ironically) that caused the spacing to be off.
2803 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
2804 \ifdim\multitablelinespace=0pt
2805 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
2806 \global\advance\multitablelinespace by-\ht0
2808 %% Test to see if parskip is larger than space between lines of
2809 %% table. If not, do nothing.
2810 %% If so, set to same dimension as multitablelinespace.
2811 \ifdim\multitableparskip>\multitablelinespace
2812 \global\multitableparskip=\multitablelinespace
2813 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2814 %% than skip between lines in the table.
2815 \fi%
2816 \ifdim\multitableparskip=0pt
2817 \global\multitableparskip=\multitablelinespace
2818 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2819 %% than skip between lines in the table.
2820 \fi}
2823 \message{conditionals,}
2825 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
2826 % @ifnotxml always succeed. They currently do nothing; we don't
2827 % attempt to check whether the conditionals are properly nested. But we
2828 % have to remember that they are conditionals, so that @end doesn't
2829 % attempt to close an environment group.
2831 \def\makecond#1{%
2832 \expandafter\let\csname #1\endcsname = \relax
2833 \expandafter\let\csname iscond.#1\endcsname = 1
2835 \makecond{iftex}
2836 \makecond{ifnotdocbook}
2837 \makecond{ifnothtml}
2838 \makecond{ifnotinfo}
2839 \makecond{ifnotplaintext}
2840 \makecond{ifnotxml}
2842 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
2844 \def\direntry{\doignore{direntry}}
2845 \def\documentdescription{\doignore{documentdescription}}
2846 \def\docbook{\doignore{docbook}}
2847 \def\html{\doignore{html}}
2848 \def\ifdocbook{\doignore{ifdocbook}}
2849 \def\ifhtml{\doignore{ifhtml}}
2850 \def\ifinfo{\doignore{ifinfo}}
2851 \def\ifnottex{\doignore{ifnottex}}
2852 \def\ifplaintext{\doignore{ifplaintext}}
2853 \def\ifxml{\doignore{ifxml}}
2854 \def\ignore{\doignore{ignore}}
2855 \def\menu{\doignore{menu}}
2856 \def\xml{\doignore{xml}}
2858 % Ignore text until a line `@end #1', keeping track of nested conditionals.
2860 % A count to remember the depth of nesting.
2861 \newcount\doignorecount
2863 \def\doignore#1{\begingroup
2864 % Scan in ``verbatim'' mode:
2865 \catcode`\@ = \other
2866 \catcode`\{ = \other
2867 \catcode`\} = \other
2869 % Make sure that spaces turn into tokens that match what \doignoretext wants.
2870 \spaceisspace
2872 % Count number of #1's that we've seen.
2873 \doignorecount = 0
2875 % Swallow text until we reach the matching `@end #1'.
2876 \dodoignore{#1}%
2879 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
2880 \obeylines %
2882 \gdef\dodoignore#1{%
2883 % #1 contains the command name as a string, e.g., `ifinfo'.
2885 % Define a command to find the next `@end #1', which must be on a line
2886 % by itself.
2887 \long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}%
2888 % And this command to find another #1 command, at the beginning of a
2889 % line. (Otherwise, we would consider a line `@c @ifset', for
2890 % example, to count as an @ifset for nesting.)
2891 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
2893 % And now expand that command.
2894 \obeylines %
2895 \doignoretext ^^M%
2899 \def\doignoreyyy#1{%
2900 \def\temp{#1}%
2901 \ifx\temp\empty % Nothing found.
2902 \let\next\doignoretextzzz
2903 \else % Found a nested condition, ...
2904 \advance\doignorecount by 1
2905 \let\next\doignoretextyyy % ..., look for another.
2906 % If we're here, #1 ends with ^^M\ifinfo (for example).
2908 \next #1% the token \_STOP_ is present just after this macro.
2911 % We have to swallow the remaining "\_STOP_".
2913 \def\doignoretextzzz#1{%
2914 \ifnum\doignorecount = 0 % We have just found the outermost @end.
2915 \let\next\enddoignore
2916 \else % Still inside a nested condition.
2917 \advance\doignorecount by -1
2918 \let\next\doignoretext % Look for the next @end.
2920 \next
2923 % Finish off ignored text.
2924 \def\enddoignore{\endgroup\ignorespaces}
2927 % @set VAR sets the variable VAR to an empty value.
2928 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
2930 % Since we want to separate VAR from REST-OF-LINE (which might be
2931 % empty), we can't just use \parsearg; we have to insert a space of our
2932 % own to delimit the rest of the line, and then take it out again if we
2933 % didn't need it.
2934 % We rely on the fact that \parsearg sets \catcode`\ =10.
2936 \parseargdef\set{\setyyy#1 \endsetyyy}
2937 \def\setyyy#1 #2\endsetyyy{%
2939 \makevalueexpandable
2940 \def\temp{#2}%
2941 \edef\next{\gdef\makecsname{SET#1}}%
2942 \ifx\temp\empty
2943 \next{}%
2944 \else
2945 \setzzz#2\endsetzzz
2949 % Remove the trailing space \setxxx inserted.
2950 \def\setzzz#1 \endsetzzz{\next{#1}}
2952 % @clear VAR clears (i.e., unsets) the variable VAR.
2954 \parseargdef\clear{%
2956 \makevalueexpandable
2957 \global\expandafter\let\csname SET#1\endcsname=\relax
2961 % @value{foo} gets the text saved in variable foo.
2962 \def\value{\begingroup\makevalueexpandable\valuexxx}
2963 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
2965 \catcode`\- = \active \catcode`\_ = \active
2967 \gdef\makevalueexpandable{%
2968 \let\value = \expandablevalue
2969 % We don't want these characters active, ...
2970 \catcode`\-=\other \catcode`\_=\other
2971 % ..., but we might end up with active ones in the argument if
2972 % we're called from @code, as @code{@value{foo-bar_}}, though.
2973 % So \let them to their normal equivalents.
2974 \let-\realdash \let_\normalunderscore
2978 % We have this subroutine so that we can handle at least some @value's
2979 % properly in indexes (we call \makevalueexpandable in \indexdummies).
2980 % The command has to be fully expandable (if the variable is set), since
2981 % the result winds up in the index file. This means that if the
2982 % variable's value contains other Texinfo commands, it's almost certain
2983 % it will fail (although perhaps we could fix that with sufficient work
2984 % to do a one-level expansion on the result, instead of complete).
2986 \def\expandablevalue#1{%
2987 \expandafter\ifx\csname SET#1\endcsname\relax
2988 {[No value for ``#1'']}%
2989 \message{Variable `#1', used in @value, is not set.}%
2990 \else
2991 \csname SET#1\endcsname
2995 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
2996 % with @set.
2998 % To get special treatment of `@end ifset,' call \makeond and the redefine.
3000 \makecond{ifset}
3001 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
3002 \def\doifset#1#2{%
3004 \makevalueexpandable
3005 \let\next=\empty
3006 \expandafter\ifx\csname SET#2\endcsname\relax
3007 #1% If not set, redefine \next.
3009 \expandafter
3010 }\next
3012 \def\ifsetfail{\doignore{ifset}}
3014 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
3015 % defined with @set, or has been undefined with @clear.
3017 % The `\else' inside the `\doifset' parameter is a trick to reuse the
3018 % above code: if the variable is not set, do nothing, if it is set,
3019 % then redefine \next to \ifclearfail.
3021 \makecond{ifclear}
3022 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
3023 \def\ifclearfail{\doignore{ifclear}}
3025 % @dircategory CATEGORY -- specify a category of the dir file
3026 % which this file should belong to. Ignore this in TeX.
3027 \let\dircategory=\comment
3029 % @defininfoenclose.
3030 \let\definfoenclose=\comment
3033 \message{indexing,}
3034 % Index generation facilities
3036 % Define \newwrite to be identical to plain tex's \newwrite
3037 % except not \outer, so it can be used within macros and \if's.
3038 \edef\newwrite{\makecsname{ptexnewwrite}}
3040 % \newindex {foo} defines an index named foo.
3041 % It automatically defines \fooindex such that
3042 % \fooindex ...rest of line... puts an entry in the index foo.
3043 % It also defines \fooindfile to be the number of the output channel for
3044 % the file that accumulates this index. The file's extension is foo.
3045 % The name of an index should be no more than 2 characters long
3046 % for the sake of vms.
3048 \def\newindex#1{%
3049 \iflinks
3050 \expandafter\newwrite \csname#1indfile\endcsname
3051 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
3053 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
3054 \noexpand\doindex{#1}}
3057 % @defindex foo == \newindex{foo}
3059 \def\defindex{\parsearg\newindex}
3061 % Define @defcodeindex, like @defindex except put all entries in @code.
3063 \def\defcodeindex{\parsearg\newcodeindex}
3065 \def\newcodeindex#1{%
3066 \iflinks
3067 \expandafter\newwrite \csname#1indfile\endcsname
3068 \openout \csname#1indfile\endcsname \jobname.#1
3070 \expandafter\xdef\csname#1index\endcsname{%
3071 \noexpand\docodeindex{#1}}%
3075 % @synindex foo bar makes index foo feed into index bar.
3076 % Do this instead of @defindex foo if you don't want it as a separate index.
3078 % @syncodeindex foo bar similar, but put all entries made for index foo
3079 % inside @code.
3081 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
3082 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
3084 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
3085 % #3 the target index (bar).
3086 \def\dosynindex#1#2#3{%
3087 % Only do \closeout if we haven't already done it, else we'll end up
3088 % closing the target index.
3089 \expandafter \ifx\csname donesynindex#2\endcsname \undefined
3090 % The \closeout helps reduce unnecessary open files; the limit on the
3091 % Acorn RISC OS is a mere 16 files.
3092 \expandafter\closeout\csname#2indfile\endcsname
3093 \expandafter\let\csname\donesynindex#2\endcsname = 1
3095 % redefine \fooindfile:
3096 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
3097 \expandafter\let\csname#2indfile\endcsname=\temp
3098 % redefine \fooindex:
3099 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
3102 % Define \doindex, the driver for all \fooindex macros.
3103 % Argument #1 is generated by the calling \fooindex macro,
3104 % and it is "foo", the name of the index.
3106 % \doindex just uses \parsearg; it calls \doind for the actual work.
3107 % This is because \doind is more useful to call from other macros.
3109 % There is also \dosubind {index}{topic}{subtopic}
3110 % which makes an entry in a two-level index such as the operation index.
3112 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
3113 \def\singleindexer #1{\doind{\indexname}{#1}}
3115 % like the previous two, but they put @code around the argument.
3116 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
3117 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
3119 % Take care of Texinfo commands that can appear in an index entry.
3120 % Since there are some commands we want to expand, and others we don't,
3121 % we have to laboriously prevent expansion for those that we don't.
3123 \def\indexdummies{%
3124 \def\@{@}% change to @@ when we switch to @ as escape char in index files.
3125 \def\ {\realbackslash\space }%
3126 % Need these in case \tex is in effect and \{ is a \delimiter again.
3127 % But can't use \lbracecmd and \rbracecmd because texindex assumes
3128 % braces and backslashes are used only as delimiters.
3129 \let\{ = \mylbrace
3130 \let\} = \myrbrace
3132 % \definedummyword defines \#1 as \realbackslash #1\space, thus
3133 % effectively preventing its expansion. This is used only for control
3134 % words, not control letters, because the \space would be incorrect
3135 % for control characters, but is needed to separate the control word
3136 % from whatever follows.
3138 % For control letters, we have \definedummyletter, which omits the
3139 % space.
3141 % These can be used both for control words that take an argument and
3142 % those that do not. If it is followed by {arg} in the input, then
3143 % that will dutifully get written to the index (or wherever).
3145 \def\definedummyword##1{%
3146 \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}%
3148 \def\definedummyletter##1{%
3149 \expandafter\def\csname ##1\endcsname{\realbackslash ##1}%
3151 \let\definedummyaccent\definedummyletter
3153 % Do the redefinitions.
3154 \commondummies
3157 % For the aux file, @ is the escape character. So we want to redefine
3158 % everything using @ instead of \realbackslash. When everything uses
3159 % @, this will be simpler.
3161 \def\atdummies{%
3162 \def\@{@@}%
3163 \def\ {@ }%
3164 \let\{ = \lbraceatcmd
3165 \let\} = \rbraceatcmd
3167 % (See comments in \indexdummies.)
3168 \def\definedummyword##1{%
3169 \expandafter\def\csname ##1\endcsname{@##1\space}%
3171 \def\definedummyletter##1{%
3172 \expandafter\def\csname ##1\endcsname{@##1}%
3174 \let\definedummyaccent\definedummyletter
3176 % Do the redefinitions.
3177 \commondummies
3180 % Called from \indexdummies and \atdummies. \definedummyword and
3181 % \definedummyletter must be defined first.
3183 \def\commondummies{%
3185 \normalturnoffactive
3187 \commondummiesnofonts
3189 \definedummyletter{_}%
3191 % Non-English letters.
3192 \definedummyword{AA}%
3193 \definedummyword{AE}%
3194 \definedummyword{L}%
3195 \definedummyword{OE}%
3196 \definedummyword{O}%
3197 \definedummyword{aa}%
3198 \definedummyword{ae}%
3199 \definedummyword{l}%
3200 \definedummyword{oe}%
3201 \definedummyword{o}%
3202 \definedummyword{ss}%
3203 \definedummyword{exclamdown}%
3204 \definedummyword{questiondown}%
3205 \definedummyword{ordf}%
3206 \definedummyword{ordm}%
3208 % Although these internal commands shouldn't show up, sometimes they do.
3209 \definedummyword{bf}%
3210 \definedummyword{gtr}%
3211 \definedummyword{hat}%
3212 \definedummyword{less}%
3213 \definedummyword{sf}%
3214 \definedummyword{sl}%
3215 \definedummyword{tclose}%
3216 \definedummyword{tt}%
3218 \definedummyword{LaTeX}%
3219 \definedummyword{TeX}%
3221 % Assorted special characters.
3222 \definedummyword{bullet}%
3223 \definedummyword{comma}%
3224 \definedummyword{copyright}%
3225 \definedummyword{registeredsymbol}%
3226 \definedummyword{dots}%
3227 \definedummyword{enddots}%
3228 \definedummyword{equiv}%
3229 \definedummyword{error}%
3230 \definedummyword{euro}%
3231 \definedummyword{expansion}%
3232 \definedummyword{minus}%
3233 \definedummyword{pounds}%
3234 \definedummyword{point}%
3235 \definedummyword{print}%
3236 \definedummyword{result}%
3238 % Handle some cases of @value -- where it does not contain any
3239 % (non-fully-expandable) commands.
3240 \makevalueexpandable
3242 % Normal spaces, not active ones.
3243 \unsepspaces
3245 % No macro expansion.
3246 \turnoffmacros
3249 % \commondummiesnofonts: common to \commondummies and \indexnofonts.
3251 % Better have this without active chars.
3253 \catcode`\~=\other
3254 \gdef\commondummiesnofonts{%
3255 % Control letters and accents.
3256 \definedummyletter{!}%
3257 \definedummyaccent{"}%
3258 \definedummyaccent{'}%
3259 \definedummyletter{*}%
3260 \definedummyaccent{,}%
3261 \definedummyletter{.}%
3262 \definedummyletter{/}%
3263 \definedummyletter{:}%
3264 \definedummyaccent{=}%
3265 \definedummyletter{?}%
3266 \definedummyaccent{^}%
3267 \definedummyaccent{`}%
3268 \definedummyaccent{~}%
3269 \definedummyword{u}%
3270 \definedummyword{v}%
3271 \definedummyword{H}%
3272 \definedummyword{dotaccent}%
3273 \definedummyword{ringaccent}%
3274 \definedummyword{tieaccent}%
3275 \definedummyword{ubaraccent}%
3276 \definedummyword{udotaccent}%
3277 \definedummyword{dotless}%
3279 % Texinfo font commands.
3280 \definedummyword{b}%
3281 \definedummyword{i}%
3282 \definedummyword{r}%
3283 \definedummyword{sc}%
3284 \definedummyword{t}%
3286 % Commands that take arguments.
3287 \definedummyword{acronym}%
3288 \definedummyword{cite}%
3289 \definedummyword{code}%
3290 \definedummyword{command}%
3291 \definedummyword{dfn}%
3292 \definedummyword{emph}%
3293 \definedummyword{env}%
3294 \definedummyword{file}%
3295 \definedummyword{kbd}%
3296 \definedummyword{key}%
3297 \definedummyword{math}%
3298 \definedummyword{option}%
3299 \definedummyword{samp}%
3300 \definedummyword{strong}%
3301 \definedummyword{tie}%
3302 \definedummyword{uref}%
3303 \definedummyword{url}%
3304 \definedummyword{var}%
3305 \definedummyword{verb}%
3306 \definedummyword{w}%
3310 % \indexnofonts is used when outputting the strings to sort the index
3311 % by, and when constructing control sequence names. It eliminates all
3312 % control sequences and just writes whatever the best ASCII sort string
3313 % would be for a given command (usually its argument).
3315 \def\indexnofonts{%
3316 % Accent commands should become @asis.
3317 \def\definedummyaccent##1{%
3318 \expandafter\let\csname ##1\endcsname\asis
3320 % We can just ignore other control letters.
3321 \def\definedummyletter##1{%
3322 \expandafter\def\csname ##1\endcsname{}%
3324 % Hopefully, all control words can become @asis.
3325 \let\definedummyword\definedummyaccent
3327 \commondummiesnofonts
3329 % Don't no-op \tt, since it isn't a user-level command
3330 % and is used in the definitions of the active chars like <, >, |, etc.
3331 % Likewise with the other plain tex font commands.
3332 %\let\tt=\asis
3334 \def\ { }%
3335 \def\@{@}%
3336 % how to handle braces?
3337 \def\_{\normalunderscore}%
3339 % Non-English letters.
3340 \def\AA{AA}%
3341 \def\AE{AE}%
3342 \def\L{L}%
3343 \def\OE{OE}%
3344 \def\O{O}%
3345 \def\aa{aa}%
3346 \def\ae{ae}%
3347 \def\l{l}%
3348 \def\oe{oe}%
3349 \def\o{o}%
3350 \def\ss{ss}%
3351 \def\exclamdown{!}%
3352 \def\questiondown{?}%
3353 \def\ordf{a}%
3354 \def\ordm{o}%
3356 \def\LaTeX{LaTeX}%
3357 \def\TeX{TeX}%
3359 % Assorted special characters.
3360 % (The following {} will end up in the sort string, but that's ok.)
3361 \def\bullet{bullet}%
3362 \def\comma{,}%
3363 \def\copyright{copyright}%
3364 \def\registeredsymbol{R}%
3365 \def\dots{...}%
3366 \def\enddots{...}%
3367 \def\equiv{==}%
3368 \def\error{error}%
3369 \def\euro{euro}%
3370 \def\expansion{==>}%
3371 \def\minus{-}%
3372 \def\pounds{pounds}%
3373 \def\point{.}%
3374 \def\print{-|}%
3375 \def\result{=>}%
3377 % Don't write macro names.
3378 \emptyusermacros
3381 \let\indexbackslash=0 %overridden during \printindex.
3382 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
3384 % Most index entries go through here, but \dosubind is the general case.
3385 % #1 is the index name, #2 is the entry text.
3386 \def\doind#1#2{\dosubind{#1}{#2}{}}
3388 % Workhorse for all \fooindexes.
3389 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
3390 % empty if called from \doind, as we usually are (the main exception
3391 % is with most defuns, which call us directly).
3393 \def\dosubind#1#2#3{%
3394 \iflinks
3396 % Store the main index entry text (including the third arg).
3397 \toks0 = {#2}%
3398 % If third arg is present, precede it with a space.
3399 \def\thirdarg{#3}%
3400 \ifx\thirdarg\empty \else
3401 \toks0 = \expandafter{\the\toks0 \space #3}%
3404 \edef\writeto{\csname#1indfile\endcsname}%
3406 \ifvmode
3407 \dosubindsanitize
3408 \else
3409 \dosubindwrite
3415 % Write the entry in \toks0 to the index file:
3417 \def\dosubindwrite{%
3418 % Put the index entry in the margin if desired.
3419 \ifx\SETmarginindex\relax\else
3420 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
3423 % Remember, we are within a group.
3424 \indexdummies % Must do this here, since \bf, etc expand at this stage
3425 \escapechar=`\\
3426 \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
3427 % so it will be output as is; and it will print as backslash.
3429 % Process the index entry with all font commands turned off, to
3430 % get the string to sort by.
3431 {\indexnofonts
3432 \edef\temp{\the\toks0}% need full expansion
3433 \xdef\indexsorttmp{\temp}%
3436 % Set up the complete index entry, with both the sort key and
3437 % the original text, including any font commands. We write
3438 % three arguments to \entry to the .?? file (four in the
3439 % subentry case), texindex reduces to two when writing the .??s
3440 % sorted result.
3441 \edef\temp{%
3442 \write\writeto{%
3443 \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
3445 \temp
3448 % Take care of unwanted page breaks:
3450 % If a skip is the last thing on the list now, preserve it
3451 % by backing up by \lastskip, doing the \write, then inserting
3452 % the skip again. Otherwise, the whatsit generated by the
3453 % \write will make \lastskip zero. The result is that sequences
3454 % like this:
3455 % @end defun
3456 % @tindex whatever
3457 % @defun ...
3458 % will have extra space inserted, because the \medbreak in the
3459 % start of the @defun won't see the skip inserted by the @end of
3460 % the previous defun.
3462 % But don't do any of this if we're not in vertical mode. We
3463 % don't want to do a \vskip and prematurely end a paragraph.
3465 % Avoid page breaks due to these extra skips, too.
3467 % But wait, there is a catch there:
3468 % We'll have to check whether \lastskip is zero skip. \ifdim is not
3469 % sufficient for this purpose, as it ignores stretch and shrink parts
3470 % of the skip. The only way seems to be to check the textual
3471 % representation of the skip.
3473 % The following is almost like \def\zeroskipmacro{0.0pt} except that
3474 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
3476 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
3478 % ..., ready, GO:
3480 \def\dosubindsanitize{%
3481 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
3482 \skip0 = \lastskip
3483 \edef\lastskipmacro{\the\lastskip}%
3484 \count255 = \lastpenalty
3486 % If \lastskip is nonzero, that means the last item was a
3487 % skip. And since a skip is discardable, that means this
3488 % -\skip0 glue we're inserting is preceded by a
3489 % non-discardable item, therefore it is not a potential
3490 % breakpoint, therefore no \nobreak needed.
3491 \ifx\lastskipmacro\zeroskipmacro
3492 \else
3493 \vskip-\skip0
3496 \dosubindwrite
3498 \ifx\lastskipmacro\zeroskipmacro
3499 % If \lastskip was zero, perhaps the last item was a penalty, and
3500 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
3501 % to re-insert the same penalty (values >10000 are used for various
3502 % signals); since we just inserted a non-discardable item, any
3503 % following glue (such as a \parskip) would be a breakpoint. For example:
3505 % @deffn deffn-whatever
3506 % @vindex index-whatever
3507 % Description.
3508 % would allow a break between the index-whatever whatsit
3509 % and the "Description." paragraph.
3510 \ifnum\count255>9999 \penalty\count255 \fi
3511 \else
3512 % On the other hand, if we had a nonzero \lastskip,
3513 % this make-up glue would be preceded by a non-discardable item
3514 % (the whatsit from the \write), so we must insert a \nobreak.
3515 \nobreak\vskip\skip0
3519 % The index entry written in the file actually looks like
3520 % \entry {sortstring}{page}{topic}
3521 % or
3522 % \entry {sortstring}{page}{topic}{subtopic}
3523 % The texindex program reads in these files and writes files
3524 % containing these kinds of lines:
3525 % \initial {c}
3526 % before the first topic whose initial is c
3527 % \entry {topic}{pagelist}
3528 % for a topic that is used without subtopics
3529 % \primary {topic}
3530 % for the beginning of a topic that is used with subtopics
3531 % \secondary {subtopic}{pagelist}
3532 % for each subtopic.
3534 % Define the user-accessible indexing commands
3535 % @findex, @vindex, @kindex, @cindex.
3537 \def\findex {\fnindex}
3538 \def\kindex {\kyindex}
3539 \def\cindex {\cpindex}
3540 \def\vindex {\vrindex}
3541 \def\tindex {\tpindex}
3542 \def\pindex {\pgindex}
3544 \def\cindexsub {\begingroup\obeylines\cindexsub}
3545 {\obeylines %
3546 \gdef\cindexsub "#1" #2^^M{\endgroup %
3547 \dosubind{cp}{#2}{#1}}}
3549 % Define the macros used in formatting output of the sorted index material.
3551 % @printindex causes a particular index (the ??s file) to get printed.
3552 % It does not print any chapter heading (usually an @unnumbered).
3554 \parseargdef\printindex{\begingroup
3555 \dobreak \chapheadingskip{10000}%
3557 \smallfonts \rm
3558 \tolerance = 9500
3559 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
3561 % See if the index file exists and is nonempty.
3562 % Change catcode of @ here so that if the index file contains
3563 % \initial {@}
3564 % as its first line, TeX doesn't complain about mismatched braces
3565 % (because it thinks @} is a control sequence).
3566 \catcode`\@ = 11
3567 \openin 1 \jobname.#1s
3568 \ifeof 1
3569 % \enddoublecolumns gets confused if there is no text in the index,
3570 % and it loses the chapter title and the aux file entries for the
3571 % index. The easiest way to prevent this problem is to make sure
3572 % there is some text.
3573 \putwordIndexNonexistent
3574 \else
3576 % If the index file exists but is empty, then \openin leaves \ifeof
3577 % false. We have to make TeX try to read something from the file, so
3578 % it can discover if there is anything in it.
3579 \read 1 to \temp
3580 \ifeof 1
3581 \putwordIndexIsEmpty
3582 \else
3583 % Index files are almost Texinfo source, but we use \ as the escape
3584 % character. It would be better to use @, but that's too big a change
3585 % to make right now.
3586 \def\indexbackslash{\backslashcurfont}%
3587 \catcode`\\ = 0
3588 \escapechar = `\\
3589 \begindoublecolumns
3590 \input \jobname.#1s
3591 \enddoublecolumns
3594 \closein 1
3595 \endgroup}
3597 % These macros are used by the sorted index file itself.
3598 % Change them to control the appearance of the index.
3600 \def\initial#1{{%
3601 % Some minor font changes for the special characters.
3602 \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
3604 % Remove any glue we may have, we'll be inserting our own.
3605 \removelastskip
3607 % We like breaks before the index initials, so insert a bonus.
3608 \nobreak
3609 \vskip 0pt plus 3\baselineskip
3610 \penalty 0
3611 \vskip 0pt plus -3\baselineskip
3613 % Typeset the initial. Making this add up to a whole number of
3614 % baselineskips increases the chance of the dots lining up from column
3615 % to column. It still won't often be perfect, because of the stretch
3616 % we need before each entry, but it's better.
3618 % No shrink because it confuses \balancecolumns.
3619 \vskip 1.67\baselineskip plus .5\baselineskip
3620 \leftline{\secbf #1}%
3621 % Do our best not to break after the initial.
3622 \nobreak
3623 \vskip .33\baselineskip plus .1\baselineskip
3626 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
3627 % then page number (#2) flushed to the right margin. It is used for index
3628 % and table of contents entries. The paragraph is indented by \leftskip.
3630 % A straightforward implementation would start like this:
3631 % \def\entry#1#2{...
3632 % But this frozes the catcodes in the argument, and can cause problems to
3633 % @code, which sets - active. This problem was fixed by a kludge---
3634 % ``-'' was active throughout whole index, but this isn't really right.
3636 % The right solution is to prevent \entry from swallowing the whole text.
3637 % --kasal, 21nov03
3638 \def\entry{%
3639 \begingroup
3641 % Start a new paragraph if necessary, so our assignments below can't
3642 % affect previous text.
3643 \par
3645 % Do not fill out the last line with white space.
3646 \parfillskip = 0in
3648 % No extra space above this paragraph.
3649 \parskip = 0in
3651 % Do not prefer a separate line ending with a hyphen to fewer lines.
3652 \finalhyphendemerits = 0
3654 % \hangindent is only relevant when the entry text and page number
3655 % don't both fit on one line. In that case, bob suggests starting the
3656 % dots pretty far over on the line. Unfortunately, a large
3657 % indentation looks wrong when the entry text itself is broken across
3658 % lines. So we use a small indentation and put up with long leaders.
3660 % \hangafter is reset to 1 (which is the value we want) at the start
3661 % of each paragraph, so we need not do anything with that.
3662 \hangindent = 2em
3664 % When the entry text needs to be broken, just fill out the first line
3665 % with blank space.
3666 \rightskip = 0pt plus1fil
3668 % A bit of stretch before each entry for the benefit of balancing
3669 % columns.
3670 \vskip 0pt plus1pt
3672 % Swallow the left brace of the text (first parameter):
3673 \afterassignment\doentry
3674 \let\temp =
3676 \def\doentry{%
3677 \bgroup % Instead of the swallowed brace.
3678 \noindent
3679 \aftergroup\finishentry
3680 % And now comes the text of the entry.
3682 \def\finishentry#1{%
3683 % #1 is the page number.
3685 % The following is kludged to not output a line of dots in the index if
3686 % there are no page numbers. The next person who breaks this will be
3687 % cursed by a Unix daemon.
3688 \def\tempa{{\rm }}%
3689 \def\tempb{#1}%
3690 \edef\tempc{\tempa}%
3691 \edef\tempd{\tempb}%
3692 \ifx\tempc\tempd
3694 \else
3696 % If we must, put the page number on a line of its own, and fill out
3697 % this line with blank space. (The \hfil is overwhelmed with the
3698 % fill leaders glue in \indexdotfill if the page number does fit.)
3699 \hfil\penalty50
3700 \null\nobreak\indexdotfill % Have leaders before the page number.
3702 % The `\ ' here is removed by the implicit \unskip that TeX does as
3703 % part of (the primitive) \par. Without it, a spurious underfull
3704 % \hbox ensues.
3705 \ifpdf
3706 \pdfgettoks#1.%
3707 \ \the\toksA
3708 \else
3709 \ #1%
3712 \par
3713 \endgroup
3716 % Like \dotfill except takes at least 1 em.
3717 \def\indexdotfill{\cleaders
3718 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
3720 \def\primary #1{\line{#1\hfil}}
3722 \newskip\secondaryindent \secondaryindent=0.5cm
3723 \def\secondary#1#2{{%
3724 \parfillskip=0in
3725 \parskip=0in
3726 \hangindent=1in
3727 \hangafter=1
3728 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
3729 \ifpdf
3730 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
3731 \else
3734 \par
3737 % Define two-column mode, which we use to typeset indexes.
3738 % Adapted from the TeXbook, page 416, which is to say,
3739 % the manmac.tex format used to print the TeXbook itself.
3740 \catcode`\@=11
3742 \newbox\partialpage
3743 \newdimen\doublecolumnhsize
3745 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
3746 % Grab any single-column material above us.
3747 \output = {%
3749 % Here is a possibility not foreseen in manmac: if we accumulate a
3750 % whole lot of material, we might end up calling this \output
3751 % routine twice in a row (see the doublecol-lose test, which is
3752 % essentially a couple of indexes with @setchapternewpage off). In
3753 % that case we just ship out what is in \partialpage with the normal
3754 % output routine. Generally, \partialpage will be empty when this
3755 % runs and this will be a no-op. See the indexspread.tex test case.
3756 \ifvoid\partialpage \else
3757 \onepageout{\pagecontents\partialpage}%
3760 \global\setbox\partialpage = \vbox{%
3761 % Unvbox the main output page.
3762 \unvbox\PAGE
3763 \kern-\topskip \kern\baselineskip
3766 \eject % run that output routine to set \partialpage
3768 % Use the double-column output routine for subsequent pages.
3769 \output = {\doublecolumnout}%
3771 % Change the page size parameters. We could do this once outside this
3772 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
3773 % format, but then we repeat the same computation. Repeating a couple
3774 % of assignments once per index is clearly meaningless for the
3775 % execution time, so we may as well do it in one place.
3777 % First we halve the line length, less a little for the gutter between
3778 % the columns. We compute the gutter based on the line length, so it
3779 % changes automatically with the paper format. The magic constant
3780 % below is chosen so that the gutter has the same value (well, +-<1pt)
3781 % as it did when we hard-coded it.
3783 % We put the result in a separate register, \doublecolumhsize, so we
3784 % can restore it in \pagesofar, after \hsize itself has (potentially)
3785 % been clobbered.
3787 \doublecolumnhsize = \hsize
3788 \advance\doublecolumnhsize by -.04154\hsize
3789 \divide\doublecolumnhsize by 2
3790 \hsize = \doublecolumnhsize
3792 % Double the \vsize as well. (We don't need a separate register here,
3793 % since nobody clobbers \vsize.)
3794 \vsize = 2\vsize
3797 % The double-column output routine for all double-column pages except
3798 % the last.
3800 \def\doublecolumnout{%
3801 \splittopskip=\topskip \splitmaxdepth=\maxdepth
3802 % Get the available space for the double columns -- the normal
3803 % (undoubled) page height minus any material left over from the
3804 % previous page.
3805 \dimen@ = \vsize
3806 \divide\dimen@ by 2
3807 \advance\dimen@ by -\ht\partialpage
3809 % box0 will be the left-hand column, box2 the right.
3810 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
3811 \onepageout\pagesofar
3812 \unvbox255
3813 \penalty\outputpenalty
3816 % Re-output the contents of the output page -- any previous material,
3817 % followed by the two boxes we just split, in box0 and box2.
3818 \def\pagesofar{%
3819 \unvbox\partialpage
3821 \hsize = \doublecolumnhsize
3822 \wd0=\hsize \wd2=\hsize
3823 \hbox to\pagewidth{\box0\hfil\box2}%
3826 % All done with double columns.
3827 \def\enddoublecolumns{%
3828 \output = {%
3829 % Split the last of the double-column material. Leave it on the
3830 % current page, no automatic page break.
3831 \balancecolumns
3833 % If we end up splitting too much material for the current page,
3834 % though, there will be another page break right after this \output
3835 % invocation ends. Having called \balancecolumns once, we do not
3836 % want to call it again. Therefore, reset \output to its normal
3837 % definition right away. (We hope \balancecolumns will never be
3838 % called on to balance too much material, but if it is, this makes
3839 % the output somewhat more palatable.)
3840 \global\output = {\onepageout{\pagecontents\PAGE}}%
3842 \eject
3843 \endgroup % started in \begindoublecolumns
3845 % \pagegoal was set to the doubled \vsize above, since we restarted
3846 % the current page. We're now back to normal single-column
3847 % typesetting, so reset \pagegoal to the normal \vsize (after the
3848 % \endgroup where \vsize got restored).
3849 \pagegoal = \vsize
3852 % Called at the end of the double column material.
3853 \def\balancecolumns{%
3854 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
3855 \dimen@ = \ht0
3856 \advance\dimen@ by \topskip
3857 \advance\dimen@ by-\baselineskip
3858 \divide\dimen@ by 2 % target to split to
3859 %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
3860 \splittopskip = \topskip
3861 % Loop until we get a decent breakpoint.
3863 \vbadness = 10000
3864 \loop
3865 \global\setbox3 = \copy0
3866 \global\setbox1 = \vsplit3 to \dimen@
3867 \ifdim\ht3>\dimen@
3868 \global\advance\dimen@ by 1pt
3869 \repeat
3871 %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
3872 \setbox0=\vbox to\dimen@{\unvbox1}%
3873 \setbox2=\vbox to\dimen@{\unvbox3}%
3875 \pagesofar
3877 \catcode`\@ = \other
3880 \message{sectioning,}
3881 % Chapters, sections, etc.
3883 % \unnumberedno is an oxymoron, of course. But we count the unnumbered
3884 % sections so that we can refer to them unambiguously in the pdf
3885 % outlines by their "section number". We avoid collisions with chapter
3886 % numbers by starting them at 10000. (If a document ever has 10000
3887 % chapters, we're in trouble anyway, I'm sure.)
3888 \newcount\unnumberedno \unnumberedno = 10000
3889 \newcount\chapno
3890 \newcount\secno \secno=0
3891 \newcount\subsecno \subsecno=0
3892 \newcount\subsubsecno \subsubsecno=0
3894 % This counter is funny since it counts through charcodes of letters A, B, ...
3895 \newcount\appendixno \appendixno = `\@
3897 % \def\appendixletter{\char\the\appendixno}
3898 % We do the following ugly conditional instead of the above simple
3899 % construct for the sake of pdftex, which needs the actual
3900 % letter in the expansion, not just typeset.
3902 \def\appendixletter{%
3903 \ifnum\appendixno=`A A%
3904 \else\ifnum\appendixno=`B B%
3905 \else\ifnum\appendixno=`C C%
3906 \else\ifnum\appendixno=`D D%
3907 \else\ifnum\appendixno=`E E%
3908 \else\ifnum\appendixno=`F F%
3909 \else\ifnum\appendixno=`G G%
3910 \else\ifnum\appendixno=`H H%
3911 \else\ifnum\appendixno=`I I%
3912 \else\ifnum\appendixno=`J J%
3913 \else\ifnum\appendixno=`K K%
3914 \else\ifnum\appendixno=`L L%
3915 \else\ifnum\appendixno=`M M%
3916 \else\ifnum\appendixno=`N N%
3917 \else\ifnum\appendixno=`O O%
3918 \else\ifnum\appendixno=`P P%
3919 \else\ifnum\appendixno=`Q Q%
3920 \else\ifnum\appendixno=`R R%
3921 \else\ifnum\appendixno=`S S%
3922 \else\ifnum\appendixno=`T T%
3923 \else\ifnum\appendixno=`U U%
3924 \else\ifnum\appendixno=`V V%
3925 \else\ifnum\appendixno=`W W%
3926 \else\ifnum\appendixno=`X X%
3927 \else\ifnum\appendixno=`Y Y%
3928 \else\ifnum\appendixno=`Z Z%
3929 % The \the is necessary, despite appearances, because \appendixletter is
3930 % expanded while writing the .toc file. \char\appendixno is not
3931 % expandable, thus it is written literally, thus all appendixes come out
3932 % with the same letter (or @) in the toc without it.
3933 \else\char\the\appendixno
3934 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
3935 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
3937 % Each @chapter defines this as the name of the chapter.
3938 % page headings and footings can use it. @section does likewise.
3939 % However, they are not reliable, because we don't use marks.
3940 \def\thischapter{}
3941 \def\thissection{}
3943 \newcount\absseclevel % used to calculate proper heading level
3944 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
3946 % @raisesections: treat @section as chapter, @subsection as section, etc.
3947 \def\raisesections{\global\advance\secbase by -1}
3948 \let\up=\raisesections % original BFox name
3950 % @lowersections: treat @chapter as section, @section as subsection, etc.
3951 \def\lowersections{\global\advance\secbase by 1}
3952 \let\down=\lowersections % original BFox name
3954 % we only have subsub.
3955 \chardef\maxseclevel = 3
3957 % A numbered section within an unnumbered changes to unnumbered too.
3958 % To achive this, remember the "biggest" unnum. sec. we are currently in:
3959 \chardef\unmlevel = \maxseclevel
3961 % Trace whether the current chapter is an appendix or not:
3962 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
3963 \def\chapheadtype{N}
3965 % Choose a heading macro
3966 % #1 is heading type
3967 % #2 is heading level
3968 % #3 is text for heading
3969 \def\genhead#1#2#3{%
3970 % Compute the abs. sec. level:
3971 \absseclevel=#2
3972 \advance\absseclevel by \secbase
3973 % Make sure \absseclevel doesn't fall outside the range:
3974 \ifnum \absseclevel < 0
3975 \absseclevel = 0
3976 \else
3977 \ifnum \absseclevel > 3
3978 \absseclevel = 3
3981 % The heading type:
3982 \def\headtype{#1}%
3983 \if \headtype U%
3984 \ifnum \absseclevel < \unmlevel
3985 \chardef\unmlevel = \absseclevel
3987 \else
3988 % Check for appendix sections:
3989 \ifnum \absseclevel = 0
3990 \edef\chapheadtype{\headtype}%
3991 \else
3992 \if \headtype A\if \chapheadtype N%
3993 \errmessage{@appendix... within a non-appendix chapter}%
3994 \fi\fi
3996 % Check for numbered within unnumbered:
3997 \ifnum \absseclevel > \unmlevel
3998 \def\headtype{U}%
3999 \else
4000 \chardef\unmlevel = 3
4003 % Now print the heading:
4004 \if \headtype U%
4005 \ifcase\absseclevel
4006 \unnumberedzzz{#3}%
4007 \or \unnumberedseczzz{#3}%
4008 \or \unnumberedsubseczzz{#3}%
4009 \or \unnumberedsubsubseczzz{#3}%
4011 \else
4012 \if \headtype A%
4013 \ifcase\absseclevel
4014 \appendixzzz{#3}%
4015 \or \appendixsectionzzz{#3}%
4016 \or \appendixsubseczzz{#3}%
4017 \or \appendixsubsubseczzz{#3}%
4019 \else
4020 \ifcase\absseclevel
4021 \chapterzzz{#3}%
4022 \or \seczzz{#3}%
4023 \or \numberedsubseczzz{#3}%
4024 \or \numberedsubsubseczzz{#3}%
4028 \suppressfirstparagraphindent
4031 % an interface:
4032 \def\numhead{\genhead N}
4033 \def\apphead{\genhead A}
4034 \def\unnmhead{\genhead U}
4036 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
4037 % all lower-level sectioning counters to zero.
4039 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
4040 % (e.g., figures), q.v. By default (before any chapter), that is empty.
4041 \let\chaplevelprefix = \empty
4043 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
4044 \def\chapterzzz#1{%
4045 % section resetting is \global in case the chapter is in a group, such
4046 % as an @include file.
4047 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
4048 \global\advance\chapno by 1
4050 % Used for \float.
4051 \gdef\chaplevelprefix{\the\chapno.}%
4052 \resetallfloatnos
4054 \message{\putwordChapter\space \the\chapno}%
4056 % Write the actual heading.
4057 \chapmacro{#1}{Ynumbered}{\the\chapno}%
4059 % So @section and the like are numbered underneath this chapter.
4060 \global\let\section = \numberedsec
4061 \global\let\subsection = \numberedsubsec
4062 \global\let\subsubsection = \numberedsubsubsec
4065 \outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz
4066 \def\appendixzzz#1{%
4067 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
4068 \global\advance\appendixno by 1
4069 \gdef\chaplevelprefix{\appendixletter.}%
4070 \resetallfloatnos
4072 \def\appendixnum{\putwordAppendix\space \appendixletter}%
4073 \message{\appendixnum}%
4075 \chapmacro{#1}{Yappendix}{\appendixletter}%
4077 \global\let\section = \appendixsec
4078 \global\let\subsection = \appendixsubsec
4079 \global\let\subsubsection = \appendixsubsubsec
4082 \outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
4083 \def\unnumberedzzz#1{%
4084 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
4085 \global\advance\unnumberedno by 1
4087 % Since an unnumbered has no number, no prefix for figures.
4088 \global\let\chaplevelprefix = \empty
4089 \resetallfloatnos
4091 % This used to be simply \message{#1}, but TeX fully expands the
4092 % argument to \message. Therefore, if #1 contained @-commands, TeX
4093 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
4094 % expanded @cite (which turns out to cause errors because \cite is meant
4095 % to be executed, not expanded).
4097 % Anyway, we don't want the fully-expanded definition of @cite to appear
4098 % as a result of the \message, we just want `@cite' itself. We use
4099 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
4100 % simply yielding the contents of <toks register>. (We also do this for
4101 % the toc entries.)
4102 \toks0 = {#1}%
4103 \message{(\the\toks0)}%
4105 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
4107 \global\let\section = \unnumberedsec
4108 \global\let\subsection = \unnumberedsubsec
4109 \global\let\subsubsection = \unnumberedsubsubsec
4112 % @centerchap is like @unnumbered, but the heading is centered.
4113 \outer\parseargdef\centerchap{%
4114 % Well, we could do the following in a group, but that would break
4115 % an assumption that \chapmacro is called at the outermost level.
4116 % Thus we are safer this way: --kasal, 24feb04
4117 \let\centerparametersmaybe = \centerparameters
4118 \unnmhead0{#1}%
4119 \let\centerparametersmaybe = \relax
4122 % @top is like @unnumbered.
4123 \let\top\unnumbered
4125 % Sections.
4126 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
4127 \def\seczzz#1{%
4128 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
4129 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
4132 \outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz
4133 \def\appendixsectionzzz#1{%
4134 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
4135 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
4137 \let\appendixsec\appendixsection
4139 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz
4140 \def\unnumberedseczzz#1{%
4141 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
4142 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
4145 % Subsections.
4146 \outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz
4147 \def\numberedsubseczzz#1{%
4148 \global\subsubsecno=0 \global\advance\subsecno by 1
4149 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
4152 \outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz
4153 \def\appendixsubseczzz#1{%
4154 \global\subsubsecno=0 \global\advance\subsecno by 1
4155 \sectionheading{#1}{subsec}{Yappendix}%
4156 {\appendixletter.\the\secno.\the\subsecno}%
4159 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
4160 \def\unnumberedsubseczzz#1{%
4161 \global\subsubsecno=0 \global\advance\subsecno by 1
4162 \sectionheading{#1}{subsec}{Ynothing}%
4163 {\the\unnumberedno.\the\secno.\the\subsecno}%
4166 % Subsubsections.
4167 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz
4168 \def\numberedsubsubseczzz#1{%
4169 \global\advance\subsubsecno by 1
4170 \sectionheading{#1}{subsubsec}{Ynumbered}%
4171 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
4174 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz
4175 \def\appendixsubsubseczzz#1{%
4176 \global\advance\subsubsecno by 1
4177 \sectionheading{#1}{subsubsec}{Yappendix}%
4178 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
4181 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
4182 \def\unnumberedsubsubseczzz#1{%
4183 \global\advance\subsubsecno by 1
4184 \sectionheading{#1}{subsubsec}{Ynothing}%
4185 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
4188 % These macros control what the section commands do, according
4189 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
4190 % Define them by default for a numbered chapter.
4191 \let\section = \numberedsec
4192 \let\subsection = \numberedsubsec
4193 \let\subsubsection = \numberedsubsubsec
4195 % Define @majorheading, @heading and @subheading
4197 % NOTE on use of \vbox for chapter headings, section headings, and such:
4198 % 1) We use \vbox rather than the earlier \line to permit
4199 % overlong headings to fold.
4200 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
4201 % heading is obnoxious; this forbids it.
4202 % 3) Likewise, headings look best if no \parindent is used, and
4203 % if justification is not attempted. Hence \raggedright.
4206 \def\majorheading{%
4207 {\advance\chapheadingskip by 10pt \chapbreak }%
4208 \parsearg\chapheadingzzz
4211 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
4212 \def\chapheadingzzz#1{%
4213 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
4214 \parindent=0pt\raggedright
4215 \rm #1\hfill}}%
4216 \bigskip \par\penalty 200\relax
4217 \suppressfirstparagraphindent
4220 % @heading, @subheading, @subsubheading.
4221 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
4222 \suppressfirstparagraphindent}
4223 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
4224 \suppressfirstparagraphindent}
4225 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
4226 \suppressfirstparagraphindent}
4228 % These macros generate a chapter, section, etc. heading only
4229 % (including whitespace, linebreaking, etc. around it),
4230 % given all the information in convenient, parsed form.
4232 %%% Args are the skip and penalty (usually negative)
4233 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
4235 %%% Define plain chapter starts, and page on/off switching for it
4236 % Parameter controlling skip before chapter headings (if needed)
4238 \newskip\chapheadingskip
4240 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
4241 \def\chappager{\par\vfill\supereject}
4242 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
4244 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
4246 \def\CHAPPAGoff{%
4247 \global\let\contentsalignmacro = \chappager
4248 \global\let\pchapsepmacro=\chapbreak
4249 \global\let\pagealignmacro=\chappager}
4251 \def\CHAPPAGon{%
4252 \global\let\contentsalignmacro = \chappager
4253 \global\let\pchapsepmacro=\chappager
4254 \global\let\pagealignmacro=\chappager
4255 \global\def\HEADINGSon{\HEADINGSsingle}}
4257 \def\CHAPPAGodd{%
4258 \global\let\contentsalignmacro = \chapoddpage
4259 \global\let\pchapsepmacro=\chapoddpage
4260 \global\let\pagealignmacro=\chapoddpage
4261 \global\def\HEADINGSon{\HEADINGSdouble}}
4263 \CHAPPAGon
4265 % Chapter opening.
4267 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
4268 % Yappendix, Yomitfromtoc), #3 the chapter number.
4270 % To test against our argument.
4271 \def\Ynothingkeyword{Ynothing}
4272 \def\Yomitfromtockeyword{Yomitfromtoc}
4273 \def\Yappendixkeyword{Yappendix}
4275 \def\chapmacro#1#2#3{%
4276 \pchapsepmacro
4278 \chapfonts \rm
4280 % Have to define \thissection before calling \donoderef, because the
4281 % xref code eventually uses it. On the other hand, it has to be called
4282 % after \pchapsepmacro, or the headline will change too soon.
4283 \gdef\thissection{#1}%
4284 \gdef\thischaptername{#1}%
4286 % Only insert the separating space if we have a chapter/appendix
4287 % number, and don't print the unnumbered ``number''.
4288 \def\temptype{#2}%
4289 \ifx\temptype\Ynothingkeyword
4290 \setbox0 = \hbox{}%
4291 \def\toctype{unnchap}%
4292 \def\thischapter{#1}%
4293 \else\ifx\temptype\Yomitfromtockeyword
4294 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
4295 \def\toctype{omit}%
4296 \xdef\thischapter{}%
4297 \else\ifx\temptype\Yappendixkeyword
4298 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
4299 \def\toctype{app}%
4300 % We don't substitute the actual chapter name into \thischapter
4301 % because we don't want its macros evaluated now. And we don't
4302 % use \thissection because that changes with each section.
4304 \xdef\thischapter{\putwordAppendix{} \appendixletter:
4305 \noexpand\thischaptername}%
4306 \else
4307 \setbox0 = \hbox{#3\enspace}%
4308 \def\toctype{numchap}%
4309 \xdef\thischapter{\putwordChapter{} \the\chapno:
4310 \noexpand\thischaptername}%
4311 \fi\fi\fi
4313 % Write the toc entry for this chapter. Must come before the
4314 % \donoderef, because we include the current node name in the toc
4315 % entry, and \donoderef resets it to empty.
4316 \writetocentry{\toctype}{#1}{#3}%
4318 % For pdftex, we have to write out the node definition (aka, make
4319 % the pdfdest) after any page break, but before the actual text has
4320 % been typeset. If the destination for the pdf outline is after the
4321 % text, then jumping from the outline may wind up with the text not
4322 % being visible, for instance under high magnification.
4323 \donoderef{#2}%
4325 % Typeset the actual heading.
4326 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
4327 \hangindent=\wd0 \centerparametersmaybe
4328 \unhbox0 #1\par}%
4330 \nobreak\bigskip % no page break after a chapter title
4331 \nobreak
4334 % @centerchap -- centered and unnumbered.
4335 \let\centerparametersmaybe = \relax
4336 \def\centerparameters{%
4337 \advance\rightskip by 3\rightskip
4338 \leftskip = \rightskip
4339 \parfillskip = 0pt
4343 % I don't think this chapter style is supported any more, so I'm not
4344 % updating it with the new noderef stuff. We'll see. --karl, 11aug03.
4346 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
4348 \def\unnchfopen #1{%
4349 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
4350 \parindent=0pt\raggedright
4351 \rm #1\hfill}}\bigskip \par\nobreak
4353 \def\chfopen #1#2{\chapoddpage {\chapfonts
4354 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
4355 \par\penalty 5000 %
4357 \def\centerchfopen #1{%
4358 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
4359 \parindent=0pt
4360 \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
4362 \def\CHAPFopen{%
4363 \global\let\chapmacro=\chfopen
4364 \global\let\centerchapmacro=\centerchfopen}
4367 % Section titles. These macros combine the section number parts and
4368 % call the generic \sectionheading to do the printing.
4370 \newskip\secheadingskip
4371 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
4373 % Subsection titles.
4374 \newskip\subsecheadingskip
4375 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
4377 % Subsubsection titles.
4378 \def\subsubsecheadingskip{\subsecheadingskip}
4379 \def\subsubsecheadingbreak{\subsecheadingbreak}
4382 % Print any size, any type, section title.
4384 % #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
4385 % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
4386 % section number.
4388 \def\sectionheading#1#2#3#4{%
4390 % Switch to the right set of fonts.
4391 \csname #2fonts\endcsname \rm
4393 % Insert space above the heading.
4394 \csname #2headingbreak\endcsname
4396 % Only insert the space after the number if we have a section number.
4397 \def\sectionlevel{#2}%
4398 \def\temptype{#3}%
4400 \ifx\temptype\Ynothingkeyword
4401 \setbox0 = \hbox{}%
4402 \def\toctype{unn}%
4403 \gdef\thissection{#1}%
4404 \else\ifx\temptype\Yomitfromtockeyword
4405 % for @headings -- no section number, don't include in toc,
4406 % and don't redefine \thissection.
4407 \setbox0 = \hbox{}%
4408 \def\toctype{omit}%
4409 \let\sectionlevel=\empty
4410 \else\ifx\temptype\Yappendixkeyword
4411 \setbox0 = \hbox{#4\enspace}%
4412 \def\toctype{app}%
4413 \gdef\thissection{#1}%
4414 \else
4415 \setbox0 = \hbox{#4\enspace}%
4416 \def\toctype{num}%
4417 \gdef\thissection{#1}%
4418 \fi\fi\fi
4420 % Write the toc entry (before \donoderef). See comments in \chfplain.
4421 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
4423 % Write the node reference (= pdf destination for pdftex).
4424 % Again, see comments in \chfplain.
4425 \donoderef{#3}%
4427 % Output the actual section heading.
4428 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
4429 \hangindent=\wd0 % zero if no section number
4430 \unhbox0 #1}%
4432 % Add extra space after the heading -- half of whatever came above it.
4433 % Don't allow stretch, though.
4434 \kern .5 \csname #2headingskip\endcsname
4436 % Do not let the kern be a potential breakpoint, as it would be if it
4437 % was followed by glue.
4438 \nobreak
4440 % We'll almost certainly start a paragraph next, so don't let that
4441 % glue accumulate. (Not a breakpoint because it's preceded by a
4442 % discardable item.)
4443 \vskip-\parskip
4445 % This is purely so the last item on the list is a known \penalty >
4446 % 10000. This is so \startdefun can avoid allowing breakpoints after
4447 % section headings. Otherwise, it would insert a valid breakpoint between:
4449 % @section sec-whatever
4450 % @deffn def-whatever
4451 \penalty 10001
4455 \message{toc,}
4456 % Table of contents.
4457 \newwrite\tocfile
4459 % Write an entry to the toc file, opening it if necessary.
4460 % Called from @chapter, etc.
4462 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
4463 % We append the current node name (if any) and page number as additional
4464 % arguments for the \{chap,sec,...}entry macros which will eventually
4465 % read this. The node name is used in the pdf outlines as the
4466 % destination to jump to.
4468 % We open the .toc file for writing here instead of at @setfilename (or
4469 % any other fixed time) so that @contents can be anywhere in the document.
4470 % But if #1 is `omit', then we don't do anything. This is used for the
4471 % table of contents chapter openings themselves.
4473 \newif\iftocfileopened
4474 \def\omitkeyword{omit}%
4476 \def\writetocentry#1#2#3{%
4477 \edef\writetoctype{#1}%
4478 \ifx\writetoctype\omitkeyword \else
4479 \iftocfileopened\else
4480 \immediate\openout\tocfile = \jobname.toc
4481 \global\tocfileopenedtrue
4484 \iflinks
4485 \toks0 = {#2}%
4486 \toks2 = \expandafter{\lastnode}%
4487 \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}{#3}%
4488 {\the\toks2}{\noexpand\folio}}}%
4489 \temp
4493 % Tell \shipout to create a pdf destination on each page, if we're
4494 % writing pdf. These are used in the table of contents. We can't
4495 % just write one on every page because the title pages are numbered
4496 % 1 and 2 (the page numbers aren't printed), and so are the first
4497 % two pages of the document. Thus, we'd have two destinations named
4498 % `1', and two named `2'.
4499 \ifpdf \global\pdfmakepagedesttrue \fi
4502 \newskip\contentsrightmargin \contentsrightmargin=1in
4503 \newcount\savepageno
4504 \newcount\lastnegativepageno \lastnegativepageno = -1
4506 % Prepare to read what we've written to \tocfile.
4508 \def\startcontents#1{%
4509 % If @setchapternewpage on, and @headings double, the contents should
4510 % start on an odd page, unlike chapters. Thus, we maintain
4511 % \contentsalignmacro in parallel with \pagealignmacro.
4512 % From: Torbjorn Granlund <tege@matematik.su.se>
4513 \contentsalignmacro
4514 \immediate\closeout\tocfile
4516 % Don't need to put `Contents' or `Short Contents' in the headline.
4517 % It is abundantly clear what they are.
4518 \def\thischapter{}%
4519 \chapmacro{#1}{Yomitfromtoc}{}%
4521 \savepageno = \pageno
4522 \begingroup % Set up to handle contents files properly.
4523 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
4524 % We can't do this, because then an actual ^ in a section
4525 % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
4526 %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
4527 \raggedbottom % Worry more about breakpoints than the bottom.
4528 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
4530 % Roman numerals for page numbers.
4531 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
4535 % Normal (long) toc.
4536 \def\contents{%
4537 \startcontents{\putwordTOC}%
4538 \openin 1 \jobname.toc
4539 \ifeof 1 \else
4540 \input \jobname.toc
4542 \vfill \eject
4543 \contentsalignmacro % in case @setchapternewpage odd is in effect
4544 \ifeof 1 \else
4545 \pdfmakeoutlines
4547 \closein 1
4548 \endgroup
4549 \lastnegativepageno = \pageno
4550 \global\pageno = \savepageno
4553 % And just the chapters.
4554 \def\summarycontents{%
4555 \startcontents{\putwordShortTOC}%
4557 \let\numchapentry = \shortchapentry
4558 \let\appentry = \shortchapentry
4559 \let\unnchapentry = \shortunnchapentry
4560 % We want a true roman here for the page numbers.
4561 \secfonts
4562 \let\rm=\shortcontrm \let\bf=\shortcontbf
4563 \let\sl=\shortcontsl \let\tt=\shortconttt
4565 \hyphenpenalty = 10000
4566 \advance\baselineskip by 1pt % Open it up a little.
4567 \def\numsecentry##1##2##3##4{}
4568 \let\appsecentry = \numsecentry
4569 \let\unnsecentry = \numsecentry
4570 \let\numsubsecentry = \numsecentry
4571 \let\appsubsecentry = \numsecentry
4572 \let\unnsubsecentry = \numsecentry
4573 \let\numsubsubsecentry = \numsecentry
4574 \let\appsubsubsecentry = \numsecentry
4575 \let\unnsubsubsecentry = \numsecentry
4576 \openin 1 \jobname.toc
4577 \ifeof 1 \else
4578 \input \jobname.toc
4580 \closein 1
4581 \vfill \eject
4582 \contentsalignmacro % in case @setchapternewpage odd is in effect
4583 \endgroup
4584 \lastnegativepageno = \pageno
4585 \global\pageno = \savepageno
4587 \let\shortcontents = \summarycontents
4589 % Typeset the label for a chapter or appendix for the short contents.
4590 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
4592 \def\shortchaplabel#1{%
4593 % This space should be enough, since a single number is .5em, and the
4594 % widest letter (M) is 1em, at least in the Computer Modern fonts.
4595 % But use \hss just in case.
4596 % (This space doesn't include the extra space that gets added after
4597 % the label; that gets put in by \shortchapentry above.)
4599 % We'd like to right-justify chapter numbers, but that looks strange
4600 % with appendix letters. And right-justifying numbers and
4601 % left-justifying letters looks strange when there is less than 10
4602 % chapters. Have to read the whole toc once to know how many chapters
4603 % there are before deciding ...
4604 \hbox to 1em{#1\hss}%
4607 % These macros generate individual entries in the table of contents.
4608 % The first argument is the chapter or section name.
4609 % The last argument is the page number.
4610 % The arguments in between are the chapter number, section number, ...
4612 % Chapters, in the main contents.
4613 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
4615 % Chapters, in the short toc.
4616 % See comments in \dochapentry re vbox and related settings.
4617 \def\shortchapentry#1#2#3#4{%
4618 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
4621 % Appendices, in the main contents.
4622 % Need the word Appendix, and a fixed-size box.
4624 \def\appendixbox#1{%
4625 % We use M since it's probably the widest letter.
4626 \setbox0 = \hbox{\putwordAppendix{} M}%
4627 \hbox to \wd0{\putwordAppendix{} #1\hss}}
4629 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}}
4631 % Unnumbered chapters.
4632 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
4633 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
4635 % Sections.
4636 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
4637 \let\appsecentry=\numsecentry
4638 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
4640 % Subsections.
4641 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
4642 \let\appsubsecentry=\numsubsecentry
4643 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
4645 % And subsubsections.
4646 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
4647 \let\appsubsubsecentry=\numsubsubsecentry
4648 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
4650 % This parameter controls the indentation of the various levels.
4651 % Same as \defaultparindent.
4652 \newdimen\tocindent \tocindent = 15pt
4654 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
4655 % page number.
4657 % If the toc has to be broken over pages, we want it to be at chapters
4658 % if at all possible; hence the \penalty.
4659 \def\dochapentry#1#2{%
4660 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
4661 \begingroup
4662 \chapentryfonts
4663 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
4664 \endgroup
4665 \nobreak\vskip .25\baselineskip plus.1\baselineskip
4668 \def\dosecentry#1#2{\begingroup
4669 \secentryfonts \leftskip=\tocindent
4670 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
4671 \endgroup}
4673 \def\dosubsecentry#1#2{\begingroup
4674 \subsecentryfonts \leftskip=2\tocindent
4675 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
4676 \endgroup}
4678 \def\dosubsubsecentry#1#2{\begingroup
4679 \subsubsecentryfonts \leftskip=3\tocindent
4680 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
4681 \endgroup}
4683 % We use the same \entry macro as for the index entries.
4684 \let\tocentry = \entry
4686 % Space between chapter (or whatever) number and the title.
4687 \def\labelspace{\hskip1em \relax}
4689 \def\dopageno#1{{\rm #1}}
4690 \def\doshortpageno#1{{\rm #1}}
4692 \def\chapentryfonts{\secfonts \rm}
4693 \def\secentryfonts{\textfonts}
4694 \def\subsecentryfonts{\textfonts}
4695 \def\subsubsecentryfonts{\textfonts}
4698 \message{environments,}
4699 % @foo ... @end foo.
4701 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
4703 % Since these characters are used in examples, it should be an even number of
4704 % \tt widths. Each \tt character is 1en, so two makes it 1em.
4706 \def\point{$\star$}
4707 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
4708 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
4709 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
4710 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
4712 % The @error{} command.
4713 % Adapted from the TeXbook's \boxit.
4715 \newbox\errorbox
4717 {\tentt \global\dimen0 = 3em}% Width of the box.
4718 \dimen2 = .55pt % Thickness of rules
4719 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
4720 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
4722 \setbox\errorbox=\hbox to \dimen0{\hfil
4723 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
4724 \advance\hsize by -2\dimen2 % Rules.
4725 \vbox{%
4726 \hrule height\dimen2
4727 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
4728 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
4729 \kern3pt\vrule width\dimen2}% Space to right.
4730 \hrule height\dimen2}
4731 \hfil}
4733 \def\error{\leavevmode\lower.7ex\copy\errorbox}
4735 % @tex ... @end tex escapes into raw Tex temporarily.
4736 % One exception: @ is still an escape character, so that @end tex works.
4737 % But \@ or @@ will get a plain tex @ character.
4739 \envdef\tex{%
4740 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
4741 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
4742 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
4743 \catcode `\%=14
4744 \catcode `\+=\other
4745 \catcode `\"=\other
4746 \catcode `\|=\other
4747 \catcode `\<=\other
4748 \catcode `\>=\other
4749 \escapechar=`\\
4751 \let\b=\ptexb
4752 \let\bullet=\ptexbullet
4753 \let\c=\ptexc
4754 \let\,=\ptexcomma
4755 \let\.=\ptexdot
4756 \let\dots=\ptexdots
4757 \let\equiv=\ptexequiv
4758 \let\!=\ptexexclam
4759 \let\i=\ptexi
4760 \let\indent=\ptexindent
4761 \let\noindent=\ptexnoindent
4762 \let\{=\ptexlbrace
4763 \let\+=\tabalign
4764 \let\}=\ptexrbrace
4765 \let\/=\ptexslash
4766 \let\*=\ptexstar
4767 \let\t=\ptext
4769 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
4770 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
4771 \def\@{@}%
4773 % There is no need to define \Etex.
4775 % Define @lisp ... @end lisp.
4776 % @lisp environment forms a group so it can rebind things,
4777 % including the definition of @end lisp (which normally is erroneous).
4779 % Amount to narrow the margins by for @lisp.
4780 \newskip\lispnarrowing \lispnarrowing=0.4in
4782 % This is the definition that ^^M gets inside @lisp, @example, and other
4783 % such environments. \null is better than a space, since it doesn't
4784 % have any width.
4785 \def\lisppar{\null\endgraf}
4787 % This space is always present above and below environments.
4788 \newskip\envskipamount \envskipamount = 0pt
4790 % Make spacing and below environment symmetrical. We use \parskip here
4791 % to help in doing that, since in @example-like environments \parskip
4792 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
4793 % start of the next paragraph will insert \parskip.
4795 \def\aboveenvbreak{{%
4796 % =10000 instead of <10000 because of a special case in \itemzzz and
4797 % \sectionheading, q.v.
4798 \ifnum \lastpenalty=10000 \else
4799 \advance\envskipamount by \parskip
4800 \endgraf
4801 \ifdim\lastskip<\envskipamount
4802 \removelastskip
4803 % it's not a good place to break if the last penalty was \nobreak
4804 % or better ...
4805 \ifnum\lastpenalty<10000 \penalty-50 \fi
4806 \vskip\envskipamount
4811 \let\afterenvbreak = \aboveenvbreak
4813 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
4814 \let\nonarrowing=\relax
4816 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
4817 % environment contents.
4818 \font\circle=lcircle10
4819 \newdimen\circthick
4820 \newdimen\cartouter\newdimen\cartinner
4821 \newskip\normbskip\newskip\normpskip\newskip\normlskip
4822 \circthick=\fontdimen8\circle
4824 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
4825 \def\ctr{{\hskip 6pt\circle\char'010}}
4826 \def\cbl{{\circle\char'012\hskip -6pt}}
4827 \def\cbr{{\hskip 6pt\circle\char'011}}
4828 \def\carttop{\hbox to \cartouter{\hskip\lskip
4829 \ctl\leaders\hrule height\circthick\hfil\ctr
4830 \hskip\rskip}}
4831 \def\cartbot{\hbox to \cartouter{\hskip\lskip
4832 \cbl\leaders\hrule height\circthick\hfil\cbr
4833 \hskip\rskip}}
4835 \newskip\lskip\newskip\rskip
4837 \envdef\cartouche{%
4838 \ifhmode\par\fi % can't be in the midst of a paragraph.
4839 \startsavinginserts
4840 \lskip=\leftskip \rskip=\rightskip
4841 \leftskip=0pt\rightskip=0pt % we want these *outside*.
4842 \cartinner=\hsize \advance\cartinner by-\lskip
4843 \advance\cartinner by-\rskip
4844 \cartouter=\hsize
4845 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
4846 % side, and for 6pt waste from
4847 % each corner char, and rule thickness
4848 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
4849 % Flag to tell @lisp, etc., not to narrow margin.
4850 \let\nonarrowing=\comment
4851 \vbox\bgroup
4852 \baselineskip=0pt\parskip=0pt\lineskip=0pt
4853 \carttop
4854 \hbox\bgroup
4855 \hskip\lskip
4856 \vrule\kern3pt
4857 \vbox\bgroup
4858 \kern3pt
4859 \hsize=\cartinner
4860 \baselineskip=\normbskip
4861 \lineskip=\normlskip
4862 \parskip=\normpskip
4863 \vskip -\parskip
4864 \comment % For explanation, see the end of \def\group.
4866 \def\Ecartouche{%
4867 \ifhmode\par\fi
4868 \kern3pt
4869 \egroup
4870 \kern3pt\vrule
4871 \hskip\rskip
4872 \egroup
4873 \cartbot
4874 \egroup
4875 \checkinserts
4879 % This macro is called at the beginning of all the @example variants,
4880 % inside a group.
4881 \def\nonfillstart{%
4882 \aboveenvbreak
4883 \hfuzz = 12pt % Don't be fussy
4884 \sepspaces % Make spaces be word-separators rather than space tokens.
4885 \let\par = \lisppar % don't ignore blank lines
4886 \obeylines % each line of input is a line of output
4887 \parskip = 0pt
4888 \parindent = 0pt
4889 \emergencystretch = 0pt % don't try to avoid overfull boxes
4890 % @cartouche defines \nonarrowing to inhibit narrowing
4891 % at next level down.
4892 \ifx\nonarrowing\relax
4893 \advance \leftskip by \lispnarrowing
4894 \exdentamount=\lispnarrowing
4896 \let\exdent=\nofillexdent
4899 % If you want all examples etc. small: @set dispenvsize small.
4900 % If you want even small examples the full size: @set dispenvsize nosmall.
4901 % This affects the following displayed environments:
4902 % @example, @display, @format, @lisp
4904 \def\smallword{small}
4905 \def\nosmallword{nosmall}
4906 \let\SETdispenvsize\relax
4907 \def\setnormaldispenv{%
4908 \ifx\SETdispenvsize\smallword
4909 \smallexamplefonts \rm
4912 \def\setsmalldispenv{%
4913 \ifx\SETdispenvsize\nosmallword
4914 \else
4915 \smallexamplefonts \rm
4919 % We often define two environments, @foo and @smallfoo.
4920 % Let's do it by one command:
4921 \def\makedispenv #1#2{
4922 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}
4923 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}
4924 \expandafter\let\csname E#1\endcsname \afterenvbreak
4925 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
4928 % Define two synonyms:
4929 \def\maketwodispenvs #1#2#3{
4930 \makedispenv{#1}{#3}
4931 \makedispenv{#2}{#3}
4934 % @lisp: indented, narrowed, typewriter font; @example: same as @lisp.
4936 % @smallexample and @smalllisp: use smaller fonts.
4937 % Originally contributed by Pavel@xerox.
4939 \maketwodispenvs {lisp}{example}{%
4940 \nonfillstart
4942 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
4943 \gobble % eat return
4946 % @display/@smalldisplay: same as @lisp except keep current font.
4948 \makedispenv {display}{%
4949 \nonfillstart
4950 \gobble
4953 % @format/@smallformat: same as @display except don't narrow margins.
4955 \makedispenv{format}{%
4956 \let\nonarrowing = t%
4957 \nonfillstart
4958 \gobble
4961 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
4962 \envdef\flushleft{%
4963 \let\nonarrowing = t%
4964 \nonfillstart
4965 \gobble
4967 \let\Eflushleft = \afterenvbreak
4969 % @flushright.
4971 \envdef\flushright{%
4972 \let\nonarrowing = t%
4973 \nonfillstart
4974 \advance\leftskip by 0pt plus 1fill
4975 \gobble
4977 \let\Eflushright = \afterenvbreak
4980 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
4981 % and narrows the margins. We keep \parskip nonzero in general, since
4982 % we're doing normal filling. So, when using \aboveenvbreak and
4983 % \afterenvbreak, temporarily make \parskip 0.
4985 \envdef\quotation{%
4986 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
4987 \parindent=0pt
4989 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
4990 \ifx\nonarrowing\relax
4991 \advance\leftskip by \lispnarrowing
4992 \advance\rightskip by \lispnarrowing
4993 \exdentamount = \lispnarrowing
4994 \let\nonarrowing = \relax
4996 \parsearg\quotationlabel
4999 % We have retained a nonzero parskip for the environment, since we're
5000 % doing normal filling.
5002 \def\Equotation{%
5003 \par
5004 \ifx\quotationauthor\undefined\else
5005 % indent a bit.
5006 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
5008 {\parskip=0pt \afterenvbreak}%
5011 % If we're given an argument, typeset it in bold with a colon after.
5012 \def\quotationlabel#1{%
5013 \def\temp{#1}%
5014 \ifx\temp\empty \else
5015 {\bf #1: }%
5020 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
5021 % If we want to allow any <char> as delimiter,
5022 % we need the curly braces so that makeinfo sees the @verb command, eg:
5023 % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
5025 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
5027 % [Knuth] p.344; only we need to do the other characters Texinfo sets
5028 % active too. Otherwise, they get lost as the first character on a
5029 % verbatim line.
5030 \def\dospecials{%
5031 \do\ \do\\\do\{\do\}\do\$\do\&%
5032 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
5033 \do\<\do\>\do\|\do\@\do+\do\"%
5036 % [Knuth] p. 380
5037 \def\uncatcodespecials{%
5038 \def\do##1{\catcode`##1=\other}\dospecials}
5040 % [Knuth] pp. 380,381,391
5041 % Disable Spanish ligatures ?` and !` of \tt font
5042 \begingroup
5043 \catcode`\`=\active\gdef`{\relax\lq}
5044 \endgroup
5046 % Setup for the @verb command.
5048 % Eight spaces for a tab
5049 \begingroup
5050 \catcode`\^^I=\active
5051 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
5052 \endgroup
5054 \def\setupverb{%
5055 \tt % easiest (and conventionally used) font for verbatim
5056 \def\par{\leavevmode\endgraf}%
5057 \catcode`\`=\active
5058 \tabeightspaces
5059 % Respect line breaks,
5060 % print special symbols as themselves, and
5061 % make each space count
5062 % must do in this order:
5063 \obeylines \uncatcodespecials \sepspaces
5066 % Setup for the @verbatim environment
5068 % Real tab expansion
5069 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
5071 \def\starttabbox{\setbox0=\hbox\bgroup}
5072 \begingroup
5073 \catcode`\^^I=\active
5074 \gdef\tabexpand{%
5075 \catcode`\^^I=\active
5076 \def^^I{\leavevmode\egroup
5077 \dimen0=\wd0 % the width so far, or since the previous tab
5078 \divide\dimen0 by\tabw
5079 \multiply\dimen0 by\tabw % compute previous multiple of \tabw
5080 \advance\dimen0 by\tabw % advance to next multiple of \tabw
5081 \wd0=\dimen0 \box0 \starttabbox
5084 \endgroup
5085 \def\setupverbatim{%
5086 \nonfillstart
5087 \advance\leftskip by -\defbodyindent
5088 % Easiest (and conventionally used) font for verbatim
5090 \def\par{\leavevmode\egroup\box0\endgraf}%
5091 \catcode`\`=\active
5092 \tabexpand
5093 % Respect line breaks,
5094 % print special symbols as themselves, and
5095 % make each space count
5096 % must do in this order:
5097 \obeylines \uncatcodespecials \sepspaces
5098 \everypar{\starttabbox}%
5101 % Do the @verb magic: verbatim text is quoted by unique
5102 % delimiter characters. Before first delimiter expect a
5103 % right brace, after last delimiter expect closing brace:
5105 % \def\doverb'{'<char>#1<char>'}'{#1}
5107 % [Knuth] p. 382; only eat outer {}
5108 \begingroup
5109 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
5110 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
5111 \endgroup
5113 \def\verb{\begingroup\setupverb\doverb}
5116 % Do the @verbatim magic: define the macro \doverbatim so that
5117 % the (first) argument ends when '@end verbatim' is reached, ie:
5119 % \def\doverbatim#1@end verbatim{#1}
5121 % For Texinfo it's a lot easier than for LaTeX,
5122 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
5123 % we need not redefine '\', '{' and '}'.
5125 % Inspired by LaTeX's verbatim command set [latex.ltx]
5127 \begingroup
5128 \catcode`\ =\active
5129 \obeylines %
5130 % ignore everything up to the first ^^M, that's the newline at the end
5131 % of the @verbatim input line itself. Otherwise we get an extra blank
5132 % line in the output.
5133 \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
5134 % We really want {...\end verbatim} in the body of the macro, but
5135 % without the active space; thus we have to use \xdef and \gobble.
5136 \endgroup
5138 \envdef\verbatim{%
5139 \setupverbatim\doverbatim
5141 \let\Everbatim = \afterenvbreak
5144 % @verbatiminclude FILE - insert text of file in verbatim environment.
5146 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
5148 \def\doverbatiminclude#1{%
5150 \makevalueexpandable
5151 \setupverbatim
5152 \input #1
5153 \afterenvbreak
5157 % @copying ... @end copying.
5158 % Save the text away for @insertcopying later.
5160 % We save the uninterpreted tokens, rather than creating a box.
5161 % Saving the text in a box would be much easier, but then all the
5162 % typesetting commands (@smallbook, font changes, etc.) have to be done
5163 % beforehand -- and a) we want @copying to be done first in the source
5164 % file; b) letting users define the frontmatter in as flexible order as
5165 % possible is very desirable.
5167 \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
5168 \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
5170 \def\insertcopying{%
5171 \begingroup
5172 \parindent = 0pt % paragraph indentation looks wrong on title page
5173 \scanexp\copyingtext
5174 \endgroup
5177 \message{defuns,}
5178 % @defun etc.
5180 \newskip\defbodyindent \defbodyindent=.4in
5181 \newskip\defargsindent \defargsindent=50pt
5182 \newskip\deflastargmargin \deflastargmargin=18pt
5184 % Start the processing of @deffn:
5185 \def\startdefun{%
5186 \ifnum\lastpenalty<10000
5187 \medbreak
5188 \else
5189 % If there are two @def commands in a row, we'll have a \nobreak,
5190 % which is there to keep the function description together with its
5191 % header. But if there's nothing but headers, we need to allow a
5192 % break somewhere. Check specifically for penalty 10002, inserted
5193 % by \defargscommonending, instead of 10000, since the sectioning
5194 % commands also insert a nobreak penalty, and we don't want to allow
5195 % a break between a section heading and a defun.
5197 \ifnum\lastpenalty=10002 \penalty2000 \fi
5199 % Similarly, after a section heading, do not allow a break.
5200 % But do insert the glue.
5201 \medskip % preceded by discardable penalty, so not a breakpoint
5204 \parindent=0in
5205 \advance\leftskip by \defbodyindent
5206 \exdentamount=\defbodyindent
5209 \def\dodefunx#1{%
5210 % First, check whether we are in the right environment:
5211 \checkenv#1%
5213 % As above, allow line break if we have multiple x headers in a row.
5214 % It's not a great place, though.
5215 \ifnum\lastpenalty=10002 \penalty3000 \fi
5217 % And now, it's time to reuse the body of the original defun:
5218 \expandafter\gobbledefun#1%
5220 \def\gobbledefun#1\startdefun{}
5222 % \printdefunline \deffnheader{text}
5224 \def\printdefunline#1#2{%
5225 \begingroup
5226 % call \deffnheader:
5227 #1#2 \endheader
5228 % common ending:
5229 \interlinepenalty = 10000
5230 \advance\rightskip by 0pt plus 1fil
5231 \endgraf
5232 \nobreak\vskip -\parskip
5233 \penalty 10002 % signal to \startdefun and \dodefunx
5234 % Some of the @defun-type tags do not enable magic parentheses,
5235 % rendering the following check redundant. But we don't optimize.
5236 \checkparencounts
5237 \endgroup
5240 \def\Edefun{\endgraf\medbreak}
5242 % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
5243 % the only thing remainnig is to define \deffnheader.
5245 \def\makedefun#1{%
5246 \expandafter\let\csname E#1\endcsname = \Edefun
5247 \edef\temp{\noexpand\domakedefun
5248 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
5249 \temp
5252 % \domakedefun \deffn \deffnx \deffnheader
5254 % Define \deffn and \deffnx, without parameters.
5255 % \deffnheader has to be defined explicitly.
5257 \def\domakedefun#1#2#3{%
5258 \envdef#1{%
5259 \startdefun
5260 \parseargusing\activeparens{\printdefunline#3}%
5262 \def#2{\dodefunx#1}%
5263 \def#3%
5266 %%% Untyped functions:
5268 % @deffn category name args
5269 \makedefun{deffn}{\deffngeneral{}}
5271 % @deffn category class name args
5272 \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
5274 % \defopon {category on}class name args
5275 \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
5277 % \deffngeneral {subind}category name args
5279 \def\deffngeneral#1#2 #3 #4\endheader{%
5280 % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
5281 \dosubind{fn}{\code{#3}}{#1}%
5282 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
5285 %%% Typed functions:
5287 % @deftypefn category type name args
5288 \makedefun{deftypefn}{\deftypefngeneral{}}
5290 % @deftypeop category class type name args
5291 \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
5293 % \deftypeopon {category on}class type name args
5294 \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
5296 % \deftypefngeneral {subind}category type name args
5298 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
5299 \dosubind{fn}{\code{#4}}{#1}%
5300 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
5303 %%% Typed variables:
5305 % @deftypevr category type var args
5306 \makedefun{deftypevr}{\deftypecvgeneral{}}
5308 % @deftypecv category class type var args
5309 \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
5311 % \deftypecvof {category of}class type var args
5312 \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
5314 % \deftypecvgeneral {subind}category type var args
5316 \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
5317 \dosubind{vr}{\code{#4}}{#1}%
5318 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
5321 %%% Untyped variables:
5323 % @defvr category var args
5324 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
5326 % @defcv category class var args
5327 \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
5329 % \defcvof {category of}class var args
5330 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
5332 %%% Type:
5333 % @deftp category name args
5334 \makedefun{deftp}#1 #2 #3\endheader{%
5335 \doind{tp}{\code{#2}}%
5336 \defname{#1}{}{#2}\defunargs{#3\unskip}%
5339 % Remaining @defun-like shortcuts:
5340 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
5341 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
5342 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
5343 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
5344 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
5345 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
5346 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
5347 \makedefun{defmethod}{\defopon\putwordMethodon}
5348 \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
5349 \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
5350 \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
5352 % \defname, which formats the name of the @def (not the args).
5353 % #1 is the category, such as "Function".
5354 % #2 is the return type, if any.
5355 % #3 is the function name.
5357 % We are followed by (but not passed) the arguments, if any.
5359 \def\defname#1#2#3{%
5360 % Get the values of \leftskip and \rightskip as they were outside the @def...
5361 \advance\leftskip by -\defbodyindent
5363 % How we'll format the type name. Putting it in brackets helps
5364 % distinguish it from the body text that may end up on the next line
5365 % just below it.
5366 \def\temp{#1}%
5367 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
5369 % Figure out line sizes for the paragraph shape.
5370 % The first line needs space for \box0; but if \rightskip is nonzero,
5371 % we need only space for the part of \box0 which exceeds it:
5372 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
5373 % The continuations:
5374 \dimen2=\hsize \advance\dimen2 by -\defargsindent
5375 % (plain.tex says that \dimen1 should be used only as global.)
5376 \parshape 2 0in \dimen0 \defargsindent \dimen2
5378 % Put the type name to the right margin.
5379 \noindent
5380 \hbox to 0pt{%
5381 \hfil\box0 \kern-\hsize
5382 % \hsize has to be shortened this way:
5383 \kern\leftskip
5384 % Intentionally do not respect \rightskip, since we need the space.
5387 % Allow all lines to be underfull without complaint:
5388 \tolerance=10000 \hbadness=10000
5389 \exdentamount=\defbodyindent
5391 % defun fonts. We use typewriter by default (used to be bold) because:
5392 % . we're printing identifiers, they should be in tt in principle.
5393 % . in languages with many accents, such as Czech or French, it's
5394 % common to leave accents off identifiers. The result looks ok in
5395 % tt, but exceedingly strange in rm.
5396 % . we don't want -- and --- to be treated as ligatures.
5397 % . this still does not fix the ?` and !` ligatures, but so far no
5398 % one has made identifiers using them :).
5399 \df \tt
5400 \def\temp{#2}% return value type
5401 \ifx\temp\empty\else \tclose{\temp} \fi
5402 #3% output function name
5404 {\rm\enskip}% hskip 0.5 em of \tenrm
5406 \boldbrax
5407 % arguments will be output next, if any.
5410 % Print arguments in slanted roman (not ttsl), inconsistently with using
5411 % tt for the name. This is because literal text is sometimes needed in
5412 % the argument list (groff manual), and ttsl and tt are not very
5413 % distinguishable. Prevent hyphenation at `-' chars.
5415 \def\defunargs#1{%
5416 % use sl by default (not ttsl),
5417 % tt for the names.
5418 \df \sl \hyphenchar\font=0
5420 % On the other hand, if an argument has two dashes (for instance), we
5421 % want a way to get ttsl. Let's try @var for that.
5422 \let\var=\ttslanted
5424 \sl\hyphenchar\font=45
5427 % We want ()&[] to print specially on the defun line.
5429 \def\activeparens{%
5430 \catcode`\(=\active \catcode`\)=\active
5431 \catcode`\[=\active \catcode`\]=\active
5432 \catcode`\&=\active
5435 % Make control sequences which act like normal parenthesis chars.
5436 \let\lparen = ( \let\rparen = )
5438 % Be sure that we always have a definition for `(', etc. For example,
5439 % if the fn name has parens in it, \boldbrax will not be in effect yet,
5440 % so TeX would otherwise complain about undefined control sequence.
5442 \activeparens
5443 \global\let(=\lparen \global\let)=\rparen
5444 \global\let[=\lbrack \global\let]=\rbrack
5445 \global\let& = \&
5447 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
5448 \gdef\magicamp{\let&=\amprm}
5451 \newcount\parencount
5453 % If we encounter &foo, then turn on ()-hacking afterwards
5454 \newif\ifampseen
5455 \def\amprm#1 {\ampseentrue{\bf\&#1 }}
5457 \def\parenfont{%
5458 \ifampseen
5459 % At the first level, print parens in roman,
5460 % otherwise use the default font.
5461 \ifnum \parencount=1 \rm \fi
5462 \else
5463 % The \sf parens (in \boldbrax) actually are a little bolder than
5464 % the contained text. This is especially needed for [ and ] .
5468 \def\infirstlevel#1{%
5469 \ifampseen
5470 \ifnum\parencount=1
5475 \def\bfafterword#1 {#1 \bf}
5477 \def\opnr{%
5478 \global\advance\parencount by 1
5479 {\parenfont(}%
5480 \infirstlevel \bfafterword
5482 \def\clnr{%
5483 {\parenfont)}%
5484 \infirstlevel \sl
5485 \global\advance\parencount by -1
5488 \newcount\brackcount
5489 \def\lbrb{%
5490 \global\advance\brackcount by 1
5491 {\bf[}%
5493 \def\rbrb{%
5494 {\bf]}%
5495 \global\advance\brackcount by -1
5498 \def\checkparencounts{%
5499 \ifnum\parencount=0 \else \badparencount \fi
5500 \ifnum\brackcount=0 \else \badbrackcount \fi
5502 \def\badparencount{%
5503 \errmessage{Unbalanced parentheses in @def}%
5504 \global\parencount=0
5506 \def\badbrackcount{%
5507 \errmessage{Unbalanced square braces in @def}%
5508 \global\brackcount=0
5512 \message{macros,}
5513 % @macro.
5515 % To do this right we need a feature of e-TeX, \scantokens,
5516 % which we arrange to emulate with a temporary file in ordinary TeX.
5517 \ifx\eTeXversion\undefined
5518 \newwrite\macscribble
5519 \def\scantokens#1{%
5520 \toks0={#1}%
5521 \immediate\openout\macscribble=\jobname.tmp
5522 \immediate\write\macscribble{\the\toks0}%
5523 \immediate\closeout\macscribble
5524 \input \jobname.tmp
5528 \def\scanmacro#1{%
5529 \begingroup
5530 \newlinechar`\^^M
5531 \let\xeatspaces\eatspaces
5532 % Undo catcode changes of \startcontents and \doprintindex
5533 % When called from @insertcopying or (short)caption, we need active
5534 % backslash to get it printed correctly. Previously, we had
5535 % \catcode`\\=\other instead. We'll see whether a problem appears
5536 % with macro expansion. --kasal, 19aug04
5537 \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
5538 % ... and \example
5539 \spaceisspace
5541 % Append \endinput to make sure that TeX does not see the ending newline.
5543 % I've verified that it is necessary both for e-TeX and for ordinary TeX
5544 % --kasal, 29nov03
5545 \scantokens{#1\endinput}%
5546 \endgroup
5549 \def\scanexp#1{%
5550 \edef\temp{\noexpand\scanmacro{#1}}%
5551 \temp
5554 \newcount\paramno % Count of parameters
5555 \newtoks\macname % Macro name
5556 \newif\ifrecursive % Is it recursive?
5557 \def\macrolist{} % List of all defined macros in the form
5558 % \do\macro1\do\macro2...
5560 % Utility routines.
5561 % This does \let #1 = #2, with \csnames; that is,
5562 % \let \csname#1\endcsname = \csname#2\endcsname
5563 % (except of course we have to play expansion games).
5565 \def\cslet#1#2{%
5566 \expandafter\let
5567 \csname#1\expandafter\endcsname
5568 \csname#2\endcsname
5571 % Trim leading and trailing spaces off a string.
5572 % Concepts from aro-bend problem 15 (see CTAN).
5573 {\catcode`\@=11
5574 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
5575 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
5576 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
5577 \def\unbrace#1{#1}
5578 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
5581 % Trim a single trailing ^^M off a string.
5582 {\catcode`\^^M=\other \catcode`\Q=3%
5583 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
5584 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
5585 \gdef\eatcrb#1Q#2Q{#1}%
5588 % Macro bodies are absorbed as an argument in a context where
5589 % all characters are catcode 10, 11 or 12, except \ which is active
5590 % (as in normal texinfo). It is necessary to change the definition of \.
5592 % It's necessary to have hard CRs when the macro is executed. This is
5593 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
5594 % body, and then making it the \newlinechar in \scanmacro.
5596 \def\scanctxt{%
5597 \catcode`\"=\other
5598 \catcode`\+=\other
5599 \catcode`\<=\other
5600 \catcode`\>=\other
5601 \catcode`\@=\other
5602 \catcode`\^=\other
5603 \catcode`\_=\other
5604 \catcode`\|=\other
5605 \catcode`\~=\other
5608 \def\scanargctxt{%
5609 \scanctxt
5610 \catcode`\\=\other
5611 \catcode`\^^M=\other
5614 \def\macrobodyctxt{%
5615 \scanctxt
5616 \catcode`\{=\other
5617 \catcode`\}=\other
5618 \catcode`\^^M=\other
5619 \usembodybackslash
5622 \def\macroargctxt{%
5623 \scanctxt
5624 \catcode`\\=\other
5627 % \mbodybackslash is the definition of \ in @macro bodies.
5628 % It maps \foo\ => \csname macarg.foo\endcsname => #N
5629 % where N is the macro parameter number.
5630 % We define \csname macarg.\endcsname to be \realbackslash, so
5631 % \\ in macro replacement text gets you a backslash.
5633 {\catcode`@=0 @catcode`@\=@active
5634 @gdef@usembodybackslash{@let\=@mbodybackslash}
5635 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
5637 \expandafter\def\csname macarg.\endcsname{\realbackslash}
5639 \def\macro{\recursivefalse\parsearg\macroxxx}
5640 \def\rmacro{\recursivetrue\parsearg\macroxxx}
5642 \def\macroxxx#1{%
5643 \getargs{#1}% now \macname is the macname and \argl the arglist
5644 \ifx\argl\empty % no arguments
5645 \paramno=0%
5646 \else
5647 \expandafter\parsemargdef \argl;%
5649 \if1\csname ismacro.\the\macname\endcsname
5650 \message{Warning: redefining \the\macname}%
5651 \else
5652 \expandafter\ifx\csname \the\macname\endcsname \relax
5653 \else \errmessage{Macro name \the\macname\space already defined}\fi
5654 \global\cslet{macsave.\the\macname}{\the\macname}%
5655 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
5656 % Add the macroname to \macrolist
5657 \toks0 = \expandafter{\macrolist\do}%
5658 \xdef\macrolist{\the\toks0
5659 \expandafter\noexpand\csname\the\macname\endcsname}%
5661 \begingroup \macrobodyctxt
5662 \ifrecursive \expandafter\parsermacbody
5663 \else \expandafter\parsemacbody
5664 \fi}
5666 \parseargdef\unmacro{%
5667 \if1\csname ismacro.#1\endcsname
5668 \global\cslet{#1}{macsave.#1}%
5669 \global\expandafter\let \csname ismacro.#1\endcsname=0%
5670 % Remove the macro name from \macrolist:
5671 \begingroup
5672 \expandafter\let\csname#1\endcsname \relax
5673 \let\do\unmacrodo
5674 \xdef\macrolist{\macrolist}%
5675 \endgroup
5676 \else
5677 \errmessage{Macro #1 not defined}%
5681 % Called by \do from \dounmacro on each macro. The idea is to omit any
5682 % macro definitions that have been changed to \relax.
5684 \def\unmacrodo#1{%
5685 \ifx#1\relax
5686 % remove this
5687 \else
5688 \noexpand\do \noexpand #1%
5692 % This makes use of the obscure feature that if the last token of a
5693 % <parameter list> is #, then the preceding argument is delimited by
5694 % an opening brace, and that opening brace is not consumed.
5695 \def\getargs#1{\getargsxxx#1{}}
5696 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
5697 \def\getmacname #1 #2\relax{\macname={#1}}
5698 \def\getmacargs#1{\def\argl{#1}}
5700 % Parse the optional {params} list. Set up \paramno and \paramlist
5701 % so \defmacro knows what to do. Define \macarg.blah for each blah
5702 % in the params list, to be ##N where N is the position in that list.
5703 % That gets used by \mbodybackslash (above).
5705 % We need to get `macro parameter char #' into several definitions.
5706 % The technique used is stolen from LaTeX: let \hash be something
5707 % unexpandable, insert that wherever you need a #, and then redefine
5708 % it to # just before using the token list produced.
5710 % The same technique is used to protect \eatspaces till just before
5711 % the macro is used.
5713 \def\parsemargdef#1;{\paramno=0\def\paramlist{}%
5714 \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
5715 \def\parsemargdefxxx#1,{%
5716 \if#1;\let\next=\relax
5717 \else \let\next=\parsemargdefxxx
5718 \advance\paramno by 1%
5719 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
5720 {\xeatspaces{\hash\the\paramno}}%
5721 \edef\paramlist{\paramlist\hash\the\paramno,}%
5722 \fi\next}
5724 % These two commands read recursive and nonrecursive macro bodies.
5725 % (They're different since rec and nonrec macros end differently.)
5727 \long\def\parsemacbody#1@end macro%
5728 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
5729 \long\def\parsermacbody#1@end rmacro%
5730 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
5732 % This defines the macro itself. There are six cases: recursive and
5733 % nonrecursive macros of zero, one, and many arguments.
5734 % Much magic with \expandafter here.
5735 % \xdef is used so that macro definitions will survive the file
5736 % they're defined in; @include reads the file inside a group.
5737 \def\defmacro{%
5738 \let\hash=##% convert placeholders to macro parameter chars
5739 \ifrecursive
5740 \ifcase\paramno
5742 \expandafter\xdef\csname\the\macname\endcsname{%
5743 \noexpand\scanmacro{\temp}}%
5744 \or % 1
5745 \expandafter\xdef\csname\the\macname\endcsname{%
5746 \bgroup\noexpand\macroargctxt
5747 \noexpand\braceorline
5748 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
5749 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
5750 \egroup\noexpand\scanmacro{\temp}}%
5751 \else % many
5752 \expandafter\xdef\csname\the\macname\endcsname{%
5753 \bgroup\noexpand\macroargctxt
5754 \noexpand\csname\the\macname xx\endcsname}%
5755 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
5756 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
5757 \expandafter\expandafter
5758 \expandafter\xdef
5759 \expandafter\expandafter
5760 \csname\the\macname xxx\endcsname
5761 \paramlist{\egroup\noexpand\scanmacro{\temp}}%
5763 \else
5764 \ifcase\paramno
5766 \expandafter\xdef\csname\the\macname\endcsname{%
5767 \noexpand\norecurse{\the\macname}%
5768 \noexpand\scanmacro{\temp}\egroup}%
5769 \or % 1
5770 \expandafter\xdef\csname\the\macname\endcsname{%
5771 \bgroup\noexpand\macroargctxt
5772 \noexpand\braceorline
5773 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
5774 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
5775 \egroup
5776 \noexpand\norecurse{\the\macname}%
5777 \noexpand\scanmacro{\temp}\egroup}%
5778 \else % many
5779 \expandafter\xdef\csname\the\macname\endcsname{%
5780 \bgroup\noexpand\macroargctxt
5781 \expandafter\noexpand\csname\the\macname xx\endcsname}%
5782 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
5783 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
5784 \expandafter\expandafter
5785 \expandafter\xdef
5786 \expandafter\expandafter
5787 \csname\the\macname xxx\endcsname
5788 \paramlist{%
5789 \egroup
5790 \noexpand\norecurse{\the\macname}%
5791 \noexpand\scanmacro{\temp}\egroup}%
5793 \fi}
5795 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
5797 % \braceorline decides whether the next nonwhitespace character is a
5798 % {. If so it reads up to the closing }, if not, it reads the whole
5799 % line. Whatever was read is then fed to the next control sequence
5800 % as an argument (by \parsebrace or \parsearg)
5801 \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
5802 \def\braceorlinexxx{%
5803 \ifx\nchar\bgroup\else
5804 \expandafter\parsearg
5805 \fi \next}
5807 % We want to disable all macros during \shipout so that they are not
5808 % expanded by \write.
5809 \def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
5810 \edef\next{\macrolist}\expandafter\endgroup\next}
5812 % For \indexnofonts, we need to get rid of all macros, leaving only the
5813 % arguments (if present). Of course this is not nearly correct, but it
5814 % is the best we can do for now. makeinfo does not expand macros in the
5815 % argument to @deffn, which ends up writing an index entry, and texindex
5816 % isn't prepared for an index sort entry that starts with \.
5818 % Since macro invocations are followed by braces, we can just redefine them
5819 % to take a single TeX argument. The case of a macro invocation that
5820 % goes to end-of-line is not handled.
5822 \def\emptyusermacros{\begingroup
5823 \def\do##1{\let\noexpand##1=\noexpand\asis}%
5824 \edef\next{\macrolist}\expandafter\endgroup\next}
5827 % @alias.
5828 % We need some trickery to remove the optional spaces around the equal
5829 % sign. Just make them active and then expand them all to nothing.
5830 \def\alias{\parseargusing\obeyspaces\aliasxxx}
5831 \def\aliasxxx #1{\aliasyyy#1\relax}
5832 \def\aliasyyy #1=#2\relax{%
5834 \expandafter\let\obeyedspace=\empty
5835 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
5837 \next
5841 \message{cross references,}
5843 \newwrite\auxfile
5845 \newif\ifhavexrefs % True if xref values are known.
5846 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
5848 % @inforef is relatively simple.
5849 \def\inforef #1{\inforefzzz #1,,,,**}
5850 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
5851 node \samp{\ignorespaces#1{}}}
5853 % @node's only job in TeX is to define \lastnode, which is used in
5854 % cross-references. The @node line might or might not have commas, and
5855 % might or might not have spaces before the first comma, like:
5856 % @node foo , bar , ...
5857 % We don't want such trailing spaces in the node name.
5859 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
5861 % also remove a trailing comma, in case of something like this:
5862 % @node Help-Cross, , , Cross-refs
5863 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
5864 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
5866 \let\nwnode=\node
5867 \let\lastnode=\empty
5869 % Write a cross-reference definition for the current node. #1 is the
5870 % type (Ynumbered, Yappendix, Ynothing).
5872 \def\donoderef#1{%
5873 \ifx\lastnode\empty\else
5874 \setref{\lastnode}{#1}%
5875 \global\let\lastnode=\empty
5879 % @anchor{NAME} -- define xref target at arbitrary point.
5881 \newcount\savesfregister
5883 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
5884 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
5885 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
5887 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
5888 % anchor), which consists of three parts:
5889 % 1) NAME-title - the current sectioning name taken from \thissection,
5890 % or the anchor name.
5891 % 2) NAME-snt - section number and type, passed as the SNT arg, or
5892 % empty for anchors.
5893 % 3) NAME-pg - the page number.
5895 % This is called from \donoderef, \anchor, and \dofloat. In the case of
5896 % floats, there is an additional part, which is not written here:
5897 % 4) NAME-lof - the text as it should appear in a @listoffloats.
5899 \def\setref#1#2{%
5900 \pdfmkdest{#1}%
5901 \iflinks
5903 \atdummies % preserve commands, but don't expand them
5904 \turnoffactive
5905 \otherbackslash
5906 \edef\writexrdef##1##2{%
5907 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
5908 ##1}{##2}}% these are parameters of \writexrdef
5910 \toks0 = \expandafter{\thissection}%
5911 \immediate \writexrdef{title}{\the\toks0 }%
5912 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
5913 \writexrdef{pg}{\folio}% will be written later, during \shipout
5918 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
5919 % the node name, #2 the name of the Info cross-reference, #3 the printed
5920 % node name, #4 the name of the Info file, #5 the name of the printed
5921 % manual. All but the node name can be omitted.
5923 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
5924 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
5925 \def\ref#1{\xrefX[#1,,,,,,,]}
5926 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
5927 \unsepspaces
5928 \def\printedmanual{\ignorespaces #5}%
5929 \def\printedrefname{\ignorespaces #3}%
5930 \setbox1=\hbox{\printedmanual\unskip}%
5931 \setbox0=\hbox{\printedrefname\unskip}%
5932 \ifdim \wd0 = 0pt
5933 % No printed node name was explicitly given.
5934 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
5935 % Use the node name inside the square brackets.
5936 \def\printedrefname{\ignorespaces #1}%
5937 \else
5938 % Use the actual chapter/section title appear inside
5939 % the square brackets. Use the real section title if we have it.
5940 \ifdim \wd1 > 0pt
5941 % It is in another manual, so we don't have it.
5942 \def\printedrefname{\ignorespaces #1}%
5943 \else
5944 \ifhavexrefs
5945 % We know the real title if we have the xref values.
5946 \def\printedrefname{\refx{#1-title}{}}%
5947 \else
5948 % Otherwise just copy the Info node name.
5949 \def\printedrefname{\ignorespaces #1}%
5950 \fi%
5955 % Make link in pdf output.
5956 \ifpdf
5957 \leavevmode
5958 \getfilename{#4}%
5959 {\turnoffactive \otherbackslash
5960 \ifnum\filenamelength>0
5961 \startlink attr{/Border [0 0 0]}%
5962 goto file{\the\filename.pdf} name{#1}%
5963 \else
5964 \startlink attr{/Border [0 0 0]}%
5965 goto name{\pdfmkpgn{#1}}%
5968 \linkcolor
5971 % Float references are printed completely differently: "Figure 1.2"
5972 % instead of "[somenode], p.3". We distinguish them by the
5973 % LABEL-title being set to a magic string.
5975 % Have to otherify everything special to allow the \csname to
5976 % include an _ in the xref name, etc.
5977 \indexnofonts
5978 \turnoffactive
5979 \otherbackslash
5980 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
5981 \csname XR#1-title\endcsname
5983 \iffloat\Xthisreftitle
5984 % If the user specified the print name (third arg) to the ref,
5985 % print it instead of our usual "Figure 1.2".
5986 \ifdim\wd0 = 0pt
5987 \refx{#1-snt}%
5988 \else
5989 \printedrefname
5992 % if the user also gave the printed manual name (fifth arg), append
5993 % "in MANUALNAME".
5994 \ifdim \wd1 > 0pt
5995 \space \putwordin{} \cite{\printedmanual}%
5997 \else
5998 % node/anchor (non-float) references.
6000 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
6001 % insert empty discretionaries after hyphens, which means that it will
6002 % not find a line break at a hyphen in a node names. Since some manuals
6003 % are best written with fairly long node names, containing hyphens, this
6004 % is a loss. Therefore, we give the text of the node name again, so it
6005 % is as if TeX is seeing it for the first time.
6006 \ifdim \wd1 > 0pt
6007 \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}%
6008 \else
6009 % _ (for example) has to be the character _ for the purposes of the
6010 % control sequence corresponding to the node, but it has to expand
6011 % into the usual \leavevmode...\vrule stuff for purposes of
6012 % printing. So we \turnoffactive for the \refx-snt, back on for the
6013 % printing, back off for the \refx-pg.
6014 {\turnoffactive \otherbackslash
6015 % Only output a following space if the -snt ref is nonempty; for
6016 % @unnumbered and @anchor, it won't be.
6017 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
6018 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
6020 % output the `[mynode]' via a macro so it can be overridden.
6021 \xrefprintnodename\printedrefname
6023 % But we always want a comma and a space:
6024 ,\space
6026 % output the `page 3'.
6027 \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
6030 \endlink
6031 \endgroup}
6033 % This macro is called from \xrefX for the `[nodename]' part of xref
6034 % output. It's a separate macro only so it can be changed more easily,
6035 % since square brackets don't work well in some documents. Particularly
6036 % one that Bob is working on :).
6038 \def\xrefprintnodename#1{[#1]}
6040 % Things referred to by \setref.
6042 \def\Ynothing{}
6043 \def\Yomitfromtoc{}
6044 \def\Ynumbered{%
6045 \ifnum\secno=0
6046 \putwordChapter@tie \the\chapno
6047 \else \ifnum\subsecno=0
6048 \putwordSection@tie \the\chapno.\the\secno
6049 \else \ifnum\subsubsecno=0
6050 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
6051 \else
6052 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
6053 \fi\fi\fi
6055 \def\Yappendix{%
6056 \ifnum\secno=0
6057 \putwordAppendix@tie @char\the\appendixno{}%
6058 \else \ifnum\subsecno=0
6059 \putwordSection@tie @char\the\appendixno.\the\secno
6060 \else \ifnum\subsubsecno=0
6061 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
6062 \else
6063 \putwordSection@tie
6064 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
6065 \fi\fi\fi
6068 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
6069 % If its value is nonempty, SUFFIX is output afterward.
6071 \def\refx#1#2{%
6073 \indexnofonts
6074 \otherbackslash
6075 \expandafter\global\expandafter\let\expandafter\thisrefX
6076 \csname XR#1\endcsname
6078 \ifx\thisrefX\relax
6079 % If not defined, say something at least.
6080 \angleleft un\-de\-fined\angleright
6081 \iflinks
6082 \ifhavexrefs
6083 \message{\linenumber Undefined cross reference `#1'.}%
6084 \else
6085 \ifwarnedxrefs\else
6086 \global\warnedxrefstrue
6087 \message{Cross reference values unknown; you must run TeX again.}%
6091 \else
6092 % It's defined, so just use it.
6093 \thisrefX
6095 #2% Output the suffix in any case.
6098 % This is the macro invoked by entries in the aux file. Usually it's
6099 % just a \def (we prepend XR to the control sequence name to avoid
6100 % collisions). But if this is a float type, we have more work to do.
6102 \def\xrdef#1#2{%
6103 \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value.
6105 % Was that xref control sequence that we just defined for a float?
6106 \expandafter\iffloat\csname XR#1\endcsname
6107 % it was a float, and we have the (safe) float type in \iffloattype.
6108 \expandafter\let\expandafter\floatlist
6109 \csname floatlist\iffloattype\endcsname
6111 % Is this the first time we've seen this float type?
6112 \expandafter\ifx\floatlist\relax
6113 \toks0 = {\do}% yes, so just \do
6114 \else
6115 % had it before, so preserve previous elements in list.
6116 \toks0 = \expandafter{\floatlist\do}%
6119 % Remember this xref in the control sequence \floatlistFLOATTYPE,
6120 % for later use in \listoffloats.
6121 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}%
6125 % Read the last existing aux file, if any. No error if none exists.
6127 \def\tryauxfile{%
6128 \openin 1 \jobname.aux
6129 \ifeof 1 \else
6130 \readauxfile
6131 \global\havexrefstrue
6133 \closein 1
6136 \def\readauxfile{\begingroup
6137 \catcode`\^^@=\other
6138 \catcode`\^^A=\other
6139 \catcode`\^^B=\other
6140 \catcode`\^^C=\other
6141 \catcode`\^^D=\other
6142 \catcode`\^^E=\other
6143 \catcode`\^^F=\other
6144 \catcode`\^^G=\other
6145 \catcode`\^^H=\other
6146 \catcode`\^^K=\other
6147 \catcode`\^^L=\other
6148 \catcode`\^^N=\other
6149 \catcode`\^^P=\other
6150 \catcode`\^^Q=\other
6151 \catcode`\^^R=\other
6152 \catcode`\^^S=\other
6153 \catcode`\^^T=\other
6154 \catcode`\^^U=\other
6155 \catcode`\^^V=\other
6156 \catcode`\^^W=\other
6157 \catcode`\^^X=\other
6158 \catcode`\^^Z=\other
6159 \catcode`\^^[=\other
6160 \catcode`\^^\=\other
6161 \catcode`\^^]=\other
6162 \catcode`\^^^=\other
6163 \catcode`\^^_=\other
6164 % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
6165 % in xref tags, i.e., node names. But since ^^e4 notation isn't
6166 % supported in the main text, it doesn't seem desirable. Furthermore,
6167 % that is not enough: for node names that actually contain a ^
6168 % character, we would end up writing a line like this: 'xrdef {'hat
6169 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
6170 % argument, and \hat is not an expandable control sequence. It could
6171 % all be worked out, but why? Either we support ^^ or we don't.
6173 % The other change necessary for this was to define \auxhat:
6174 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
6175 % and then to call \auxhat in \setq.
6177 \catcode`\^=\other
6179 % Special characters. Should be turned off anyway, but...
6180 \catcode`\~=\other
6181 \catcode`\[=\other
6182 \catcode`\]=\other
6183 \catcode`\"=\other
6184 \catcode`\_=\other
6185 \catcode`\|=\other
6186 \catcode`\<=\other
6187 \catcode`\>=\other
6188 \catcode`\$=\other
6189 \catcode`\#=\other
6190 \catcode`\&=\other
6191 \catcode`\%=\other
6192 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
6194 % This is to support \ in node names and titles, since the \
6195 % characters end up in a \csname. It's easier than
6196 % leaving it active and making its active definition an actual \
6197 % character. What I don't understand is why it works in the *value*
6198 % of the xrdef. Seems like it should be a catcode12 \, and that
6199 % should not typeset properly. But it works, so I'm moving on for
6200 % now. --karl, 15jan04.
6201 \catcode`\\=\other
6203 % Make the characters 128-255 be printing characters.
6205 \count 1=128
6206 \def\loop{%
6207 \catcode\count 1=\other
6208 \advance\count 1 by 1
6209 \ifnum \count 1<256 \loop \fi
6213 % @ is our escape character in .aux files, and we need braces.
6214 \catcode`\{=1
6215 \catcode`\}=2
6216 \catcode`\@=0
6218 \input \jobname.aux
6219 \endgroup}
6222 \message{insertions,}
6223 % including footnotes.
6225 \newcount \footnoteno
6227 % The trailing space in the following definition for supereject is
6228 % vital for proper filling; pages come out unaligned when you do a
6229 % pagealignmacro call if that space before the closing brace is
6230 % removed. (Generally, numeric constants should always be followed by a
6231 % space to prevent strange expansion errors.)
6232 \def\supereject{\par\penalty -20000\footnoteno =0 }
6234 % @footnotestyle is meaningful for info output only.
6235 \let\footnotestyle=\comment
6237 {\catcode `\@=11
6239 % Auto-number footnotes. Otherwise like plain.
6240 \gdef\footnote{%
6241 \let\indent=\ptexindent
6242 \let\noindent=\ptexnoindent
6243 \global\advance\footnoteno by \@ne
6244 \edef\thisfootno{$^{\the\footnoteno}$}%
6246 % In case the footnote comes at the end of a sentence, preserve the
6247 % extra spacing after we do the footnote number.
6248 \let\@sf\empty
6249 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
6251 % Remove inadvertent blank space before typesetting the footnote number.
6252 \unskip
6253 \thisfootno\@sf
6254 \dofootnote
6257 % Don't bother with the trickery in plain.tex to not require the
6258 % footnote text as a parameter. Our footnotes don't need to be so general.
6260 % Oh yes, they do; otherwise, @ifset (and anything else that uses
6261 % \parseargline) fails inside footnotes because the tokens are fixed when
6262 % the footnote is read. --karl, 16nov96.
6264 \gdef\dofootnote{%
6265 \insert\footins\bgroup
6266 % We want to typeset this text as a normal paragraph, even if the
6267 % footnote reference occurs in (for example) a display environment.
6268 % So reset some parameters.
6269 \hsize=\pagewidth
6270 \interlinepenalty\interfootnotelinepenalty
6271 \splittopskip\ht\strutbox % top baseline for broken footnotes
6272 \splitmaxdepth\dp\strutbox
6273 \floatingpenalty\@MM
6274 \leftskip\z@skip
6275 \rightskip\z@skip
6276 \spaceskip\z@skip
6277 \xspaceskip\z@skip
6278 \parindent\defaultparindent
6280 \smallfonts \rm
6282 % Because we use hanging indentation in footnotes, a @noindent appears
6283 % to exdent this text, so make it be a no-op. makeinfo does not use
6284 % hanging indentation so @noindent can still be needed within footnote
6285 % text after an @example or the like (not that this is good style).
6286 \let\noindent = \relax
6288 % Hang the footnote text off the number. Use \everypar in case the
6289 % footnote extends for more than one paragraph.
6290 \everypar = {\hang}%
6291 \textindent{\thisfootno}%
6293 % Don't crash into the line above the footnote text. Since this
6294 % expands into a box, it must come within the paragraph, lest it
6295 % provide a place where TeX can split the footnote.
6296 \footstrut
6297 \futurelet\next\fo@t
6299 }%end \catcode `\@=11
6301 % In case a @footnote appears in a vbox, save the footnote text and create
6302 % the real \insert just after the vbox finished. Otherwise, the insertion
6303 % would be lost.
6304 % Similarily, if a @footnote appears inside an alignment, save the footnote
6305 % text to a box and make the \insert when a row of the table is finished.
6306 % And the same can be done for other insert classes. --kasal, 16nov03.
6308 % Replace the \insert primitive by a cheating macro.
6309 % Deeper inside, just make sure that the saved insertions are not spilled
6310 % out prematurely.
6312 \def\startsavinginserts{%
6313 \ifx \insert\ptexinsert
6314 \let\insert\saveinsert
6315 \else
6316 \let\checkinserts\relax
6320 % This \insert replacement works for both \insert\footins{foo} and
6321 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
6323 \def\saveinsert#1{%
6324 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
6325 \afterassignment\next
6326 % swallow the left brace
6327 \let\temp =
6329 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
6330 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
6332 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
6334 \def\placesaveins#1{%
6335 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
6336 {\box#1}%
6339 % eat @SAVE -- beware, all of them have catcode \other:
6341 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
6342 \gdef\gobblesave @SAVE{}
6345 % initialization:
6346 \def\newsaveins #1{%
6347 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
6348 \next
6350 \def\newsaveinsX #1{%
6351 \csname newbox\endcsname #1%
6352 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
6353 \checksaveins #1}%
6356 % initialize:
6357 \let\checkinserts\empty
6358 \newsaveins\footins
6359 \newsaveins\margin
6362 % @image. We use the macros from epsf.tex to support this.
6363 % If epsf.tex is not installed and @image is used, we complain.
6365 % Check for and read epsf.tex up front. If we read it only at @image
6366 % time, we might be inside a group, and then its definitions would get
6367 % undone and the next image would fail.
6368 \openin 1 = epsf.tex
6369 \ifeof 1 \else
6370 % Do not bother showing banner with epsf.tex v2.7k (available in
6371 % doc/epsf.tex and on ctan).
6372 \def\epsfannounce{\toks0 = }%
6373 \input epsf.tex
6375 \closein 1
6377 % We will only complain once about lack of epsf.tex.
6378 \newif\ifwarnednoepsf
6379 \newhelp\noepsfhelp{epsf.tex must be installed for images to
6380 work. It is also included in the Texinfo distribution, or you can get
6381 it from ftp://tug.org/tex/epsf.tex.}
6383 \def\image#1{%
6384 \ifx\epsfbox\undefined
6385 \ifwarnednoepsf \else
6386 \errhelp = \noepsfhelp
6387 \errmessage{epsf.tex not found, images will be ignored}%
6388 \global\warnednoepsftrue
6390 \else
6391 \imagexxx #1,,,,,\finish
6395 % Arguments to @image:
6396 % #1 is (mandatory) image filename; we tack on .eps extension.
6397 % #2 is (optional) width, #3 is (optional) height.
6398 % #4 is (ignored optional) html alt text.
6399 % #5 is (ignored optional) extension.
6400 % #6 is just the usual extra ignored arg for parsing this stuff.
6401 \newif\ifimagevmode
6402 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
6403 \catcode`\^^M = 5 % in case we're inside an example
6404 \normalturnoffactive % allow _ et al. in names
6405 % If the image is by itself, center it.
6406 \ifvmode
6407 \imagevmodetrue
6408 \nobreak\bigskip
6409 % Usually we'll have text after the image which will insert
6410 % \parskip glue, so insert it here too to equalize the space
6411 % above and below.
6412 \nobreak\vskip\parskip
6413 \nobreak
6414 \line\bgroup\hss
6417 % Output the image.
6418 \ifpdf
6419 \dopdfimage{#1}{#2}{#3}%
6420 \else
6421 % \epsfbox itself resets \epsf?size at each figure.
6422 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
6423 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
6424 \epsfbox{#1.eps}%
6427 \ifimagevmode \hss \egroup \bigbreak \fi % space after the image
6428 \endgroup}
6431 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
6432 % etc. We don't actually implement floating yet, we always include the
6433 % float "here". But it seemed the best name for the future.
6435 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
6437 % There may be a space before second and/or third parameter; delete it.
6438 \def\eatcommaspace#1, {#1,}
6440 % #1 is the optional FLOATTYPE, the text label for this float, typically
6441 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
6442 % this float will not be numbered and cannot be referred to.
6444 % #2 is the optional xref label. Also must be present for the float to
6445 % be referable.
6447 % #3 is the optional positioning argument; for now, it is ignored. It
6448 % will somehow specify the positions allowed to float to (here, top, bottom).
6450 % We keep a separate counter for each FLOATTYPE, which we reset at each
6451 % chapter-level command.
6452 \let\resetallfloatnos=\empty
6454 \def\dofloat#1,#2,#3,#4\finish{%
6455 \let\thiscaption=\empty
6456 \let\thisshortcaption=\empty
6458 % don't lose footnotes inside @float.
6460 % BEWARE: when the floats start float, we have to issue warning whenever an
6461 % insert appears inside a float which could possibly float. --kasal, 26may04
6463 \startsavinginserts
6465 % We can't be used inside a paragraph.
6466 \par
6468 \vtop\bgroup
6469 \def\floattype{#1}%
6470 \def\floatlabel{#2}%
6471 \def\floatloc{#3}% we do nothing with this yet.
6473 \ifx\floattype\empty
6474 \let\safefloattype=\empty
6475 \else
6477 % the floattype might have accents or other special characters,
6478 % but we need to use it in a control sequence name.
6479 \indexnofonts
6480 \turnoffactive
6481 \xdef\safefloattype{\floattype}%
6485 % If label is given but no type, we handle that as the empty type.
6486 \ifx\floatlabel\empty \else
6487 % We want each FLOATTYPE to be numbered separately (Figure 1,
6488 % Table 1, Figure 2, ...). (And if no label, no number.)
6490 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
6491 \global\advance\floatno by 1
6494 % This magic value for \thissection is output by \setref as the
6495 % XREFLABEL-title value. \xrefX uses it to distinguish float
6496 % labels (which have a completely different output format) from
6497 % node and anchor labels. And \xrdef uses it to construct the
6498 % lists of floats.
6500 \edef\thissection{\floatmagic=\safefloattype}%
6501 \setref{\floatlabel}{Yfloat}%
6505 % start with \parskip glue, I guess.
6506 \vskip\parskip
6508 % Don't suppress indentation if a float happens to start a section.
6509 \restorefirstparagraphindent
6512 % we have these possibilities:
6513 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
6514 % @float Foo,lbl & no caption: Foo 1.1
6515 % @float Foo & @caption{Cap}: Foo: Cap
6516 % @float Foo & no caption: Foo
6517 % @float ,lbl & Caption{Cap}: 1.1: Cap
6518 % @float ,lbl & no caption: 1.1
6519 % @float & @caption{Cap}: Cap
6520 % @float & no caption:
6522 \def\Efloat{%
6523 \let\floatident = \empty
6525 % In all cases, if we have a float type, it comes first.
6526 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
6528 % If we have an xref label, the number comes next.
6529 \ifx\floatlabel\empty \else
6530 \ifx\floattype\empty \else % if also had float type, need tie first.
6531 \appendtomacro\floatident{\tie}%
6533 % the number.
6534 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
6537 % Start the printed caption with what we've constructed in
6538 % \floatident, but keep it separate; we need \floatident again.
6539 \let\captionline = \floatident
6541 \ifx\thiscaption\empty \else
6542 \ifx\floatident\empty \else
6543 \appendtomacro\captionline{: }% had ident, so need a colon between
6546 % caption text.
6547 \appendtomacro\captionline{\scanexp\thiscaption}%
6550 % If we have anything to print, print it, with space before.
6551 % Eventually this needs to become an \insert.
6552 \ifx\captionline\empty \else
6553 \vskip.5\parskip
6554 \captionline
6556 % Space below caption.
6557 \vskip\parskip
6560 % If have an xref label, write the list of floats info. Do this
6561 % after the caption, to avoid chance of it being a breakpoint.
6562 \ifx\floatlabel\empty \else
6563 % Write the text that goes in the lof to the aux file as
6564 % \floatlabel-lof. Besides \floatident, we include the short
6565 % caption if specified, else the full caption if specified, else nothing.
6567 \atdummies \turnoffactive \otherbackslash
6568 % since we read the caption text in the macro world, where ^^M
6569 % is turned into a normal character, we have to scan it back, so
6570 % we don't write the literal three characters "^^M" into the aux file.
6571 \scanexp{%
6572 \xdef\noexpand\gtemp{%
6573 \ifx\thisshortcaption\empty
6574 \thiscaption
6575 \else
6576 \thisshortcaption
6580 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
6581 \ifx\gtemp\empty \else : \gtemp \fi}}%
6584 \egroup % end of \vtop
6586 % place the captured inserts
6588 % BEWARE: when the floats start float, we have to issue warning whenever an
6589 % insert appears inside a float which could possibly float. --kasal, 26may04
6591 \checkinserts
6594 % Append the tokens #2 to the definition of macro #1, not expanding either.
6596 \def\appendtomacro#1#2{%
6597 \expandafter\def\expandafter#1\expandafter{#1#2}%
6600 % @caption, @shortcaption
6602 \def\caption{\docaption\thiscaption}
6603 \def\shortcaption{\docaption\thisshortcaption}
6604 \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
6605 \def\defcaption#1#2{\egroup \def#1{#2}}
6607 % The parameter is the control sequence identifying the counter we are
6608 % going to use. Create it if it doesn't exist and assign it to \floatno.
6609 \def\getfloatno#1{%
6610 \ifx#1\relax
6611 % Haven't seen this figure type before.
6612 \csname newcount\endcsname #1%
6614 % Remember to reset this floatno at the next chap.
6615 \expandafter\gdef\expandafter\resetallfloatnos
6616 \expandafter{\resetallfloatnos #1=0 }%
6618 \let\floatno#1%
6621 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
6622 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
6623 % first read the @float command.
6625 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
6627 % Magic string used for the XREFLABEL-title value, so \xrefX can
6628 % distinguish floats from other xref types.
6629 \def\floatmagic{!!float!!}
6631 % #1 is the control sequence we are passed; we expand into a conditional
6632 % which is true if #1 represents a float ref. That is, the magic
6633 % \thissection value which we \setref above.
6635 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
6637 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
6638 % (safe) float type for this float. We set \iffloattype to #2.
6640 \def\doiffloat#1=#2=#3\finish{%
6641 \def\temp{#1}%
6642 \def\iffloattype{#2}%
6643 \ifx\temp\floatmagic
6646 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
6648 \parseargdef\listoffloats{%
6649 \def\floattype{#1}% floattype
6651 % the floattype might have accents or other special characters,
6652 % but we need to use it in a control sequence name.
6653 \indexnofonts
6654 \turnoffactive
6655 \xdef\safefloattype{\floattype}%
6658 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
6659 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
6660 \ifhavexrefs
6661 % if the user said @listoffloats foo but never @float foo.
6662 \message{\linenumber No `\safefloattype' floats to list.}%
6664 \else
6665 \begingroup
6666 \leftskip=\tocindent % indent these entries like a toc
6667 \let\do=\listoffloatsdo
6668 \csname floatlist\safefloattype\endcsname
6669 \endgroup
6673 % This is called on each entry in a list of floats. We're passed the
6674 % xref label, in the form LABEL-title, which is how we save it in the
6675 % aux file. We strip off the -title and look up \XRLABEL-lof, which
6676 % has the text we're supposed to typeset here.
6678 % Figures without xref labels will not be included in the list (since
6679 % they won't appear in the aux file).
6681 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
6682 \def\listoffloatsdoentry#1-title\finish{{%
6683 % Can't fully expand XR#1-lof because it can contain anything. Just
6684 % pass the control sequence. On the other hand, XR#1-pg is just the
6685 % page number, and we want to fully expand that so we can get a link
6686 % in pdf output.
6687 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
6689 % use the same \entry macro we use to generate the TOC and index.
6690 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
6691 \writeentry
6694 \message{localization,}
6695 % and i18n.
6697 % @documentlanguage is usually given very early, just after
6698 % @setfilename. If done too late, it may not override everything
6699 % properly. Single argument is the language abbreviation.
6700 % It would be nice if we could set up a hyphenation file here.
6702 \parseargdef\documentlanguage{%
6703 \tex % read txi-??.tex file in plain TeX.
6704 % Read the file if it exists.
6705 \openin 1 txi-#1.tex
6706 \ifeof 1
6707 \errhelp = \nolanghelp
6708 \errmessage{Cannot read language file txi-#1.tex}%
6709 \else
6710 \input txi-#1.tex
6712 \closein 1
6713 \endgroup
6715 \newhelp\nolanghelp{The given language definition file cannot be found or
6716 is empty. Maybe you need to install it? In the current directory
6717 should work if nowhere else does.}
6720 % @documentencoding should change something in TeX eventually, most
6721 % likely, but for now just recognize it.
6722 \let\documentencoding = \comment
6725 % Page size parameters.
6727 \newdimen\defaultparindent \defaultparindent = 15pt
6729 \chapheadingskip = 15pt plus 4pt minus 2pt
6730 \secheadingskip = 12pt plus 3pt minus 2pt
6731 \subsecheadingskip = 9pt plus 2pt minus 2pt
6733 % Prevent underfull vbox error messages.
6734 \vbadness = 10000
6736 % Don't be so finicky about underfull hboxes, either.
6737 \hbadness = 2000
6739 % Following George Bush, just get rid of widows and orphans.
6740 \widowpenalty=10000
6741 \clubpenalty=10000
6743 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
6744 % using an old version of TeX, don't do anything. We want the amount of
6745 % stretch added to depend on the line length, hence the dependence on
6746 % \hsize. We call this whenever the paper size is set.
6748 \def\setemergencystretch{%
6749 \ifx\emergencystretch\thisisundefined
6750 % Allow us to assign to \emergencystretch anyway.
6751 \def\emergencystretch{\dimen0}%
6752 \else
6753 \emergencystretch = .15\hsize
6757 % Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
6758 % 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8)
6759 % physical page width.
6761 % We also call \setleading{\textleading}, so the caller should define
6762 % \textleading. The caller should also set \parskip.
6764 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
6765 \voffset = #3\relax
6766 \topskip = #6\relax
6767 \splittopskip = \topskip
6769 \vsize = #1\relax
6770 \advance\vsize by \topskip
6771 \outervsize = \vsize
6772 \advance\outervsize by 2\topandbottommargin
6773 \pageheight = \vsize
6775 \hsize = #2\relax
6776 \outerhsize = \hsize
6777 \advance\outerhsize by 0.5in
6778 \pagewidth = \hsize
6780 \normaloffset = #4\relax
6781 \bindingoffset = #5\relax
6783 \ifpdf
6784 \pdfpageheight #7\relax
6785 \pdfpagewidth #8\relax
6788 \setleading{\textleading}
6790 \parindent = \defaultparindent
6791 \setemergencystretch
6794 % @letterpaper (the default).
6795 \def\letterpaper{{\globaldefs = 1
6796 \parskip = 3pt plus 2pt minus 1pt
6797 \textleading = 13.2pt
6799 % If page is nothing but text, make it come out even.
6800 \internalpagesizes{46\baselineskip}{6in}%
6801 {\voffset}{.25in}%
6802 {\bindingoffset}{36pt}%
6803 {11in}{8.5in}%
6806 % Use @smallbook to reset parameters for 7x9.5 (or so) format.
6807 \def\smallbook{{\globaldefs = 1
6808 \parskip = 2pt plus 1pt
6809 \textleading = 12pt
6811 \internalpagesizes{7.5in}{5in}%
6812 {\voffset}{.25in}%
6813 {\bindingoffset}{16pt}%
6814 {9.25in}{7in}%
6816 \lispnarrowing = 0.3in
6817 \tolerance = 700
6818 \hfuzz = 1pt
6819 \contentsrightmargin = 0pt
6820 \defbodyindent = .5cm
6823 % Use @afourpaper to print on European A4 paper.
6824 \def\afourpaper{{\globaldefs = 1
6825 \parskip = 3pt plus 2pt minus 1pt
6826 \textleading = 13.2pt
6828 % Double-side printing via postscript on Laserjet 4050
6829 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
6830 % To change the settings for a different printer or situation, adjust
6831 % \normaloffset until the front-side and back-side texts align. Then
6832 % do the same for \bindingoffset. You can set these for testing in
6833 % your texinfo source file like this:
6834 % @tex
6835 % \global\normaloffset = -6mm
6836 % \global\bindingoffset = 10mm
6837 % @end tex
6838 \internalpagesizes{51\baselineskip}{160mm}
6839 {\voffset}{\hoffset}%
6840 {\bindingoffset}{44pt}%
6841 {297mm}{210mm}%
6843 \tolerance = 700
6844 \hfuzz = 1pt
6845 \contentsrightmargin = 0pt
6846 \defbodyindent = 5mm
6849 % Use @afivepaper to print on European A5 paper.
6850 % From romildo@urano.iceb.ufop.br, 2 July 2000.
6851 % He also recommends making @example and @lisp be small.
6852 \def\afivepaper{{\globaldefs = 1
6853 \parskip = 2pt plus 1pt minus 0.1pt
6854 \textleading = 12.5pt
6856 \internalpagesizes{160mm}{120mm}%
6857 {\voffset}{\hoffset}%
6858 {\bindingoffset}{8pt}%
6859 {210mm}{148mm}%
6861 \lispnarrowing = 0.2in
6862 \tolerance = 800
6863 \hfuzz = 1.2pt
6864 \contentsrightmargin = 0pt
6865 \defbodyindent = 2mm
6866 \tableindent = 12mm
6869 % A specific text layout, 24x15cm overall, intended for A4 paper.
6870 \def\afourlatex{{\globaldefs = 1
6871 \afourpaper
6872 \internalpagesizes{237mm}{150mm}%
6873 {\voffset}{4.6mm}%
6874 {\bindingoffset}{7mm}%
6875 {297mm}{210mm}%
6877 % Must explicitly reset to 0 because we call \afourpaper.
6878 \globaldefs = 0
6881 % Use @afourwide to print on A4 paper in landscape format.
6882 \def\afourwide{{\globaldefs = 1
6883 \afourpaper
6884 \internalpagesizes{241mm}{165mm}%
6885 {\voffset}{-2.95mm}%
6886 {\bindingoffset}{7mm}%
6887 {297mm}{210mm}%
6888 \globaldefs = 0
6891 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
6892 % Perhaps we should allow setting the margins, \topskip, \parskip,
6893 % and/or leading, also. Or perhaps we should compute them somehow.
6895 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
6896 \def\pagesizesyyy#1,#2,#3\finish{{%
6897 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
6898 \globaldefs = 1
6900 \parskip = 3pt plus 2pt minus 1pt
6901 \setleading{\textleading}%
6903 \dimen0 = #1
6904 \advance\dimen0 by \voffset
6906 \dimen2 = \hsize
6907 \advance\dimen2 by \normaloffset
6909 \internalpagesizes{#1}{\hsize}%
6910 {\voffset}{\normaloffset}%
6911 {\bindingoffset}{44pt}%
6912 {\dimen0}{\dimen2}%
6915 % Set default to letter.
6917 \letterpaper
6920 \message{and turning on texinfo input format.}
6922 % Define macros to output various characters with catcode for normal text.
6923 \catcode`\"=\other
6924 \catcode`\~=\other
6925 \catcode`\^=\other
6926 \catcode`\_=\other
6927 \catcode`\|=\other
6928 \catcode`\<=\other
6929 \catcode`\>=\other
6930 \catcode`\+=\other
6931 \catcode`\$=\other
6932 \def\normaldoublequote{"}
6933 \def\normaltilde{~}
6934 \def\normalcaret{^}
6935 \def\normalunderscore{_}
6936 \def\normalverticalbar{|}
6937 \def\normalless{<}
6938 \def\normalgreater{>}
6939 \def\normalplus{+}
6940 \def\normaldollar{$}%$ font-lock fix
6942 % This macro is used to make a character print one way in \tt
6943 % (where it can probably be output as-is), and another way in other fonts,
6944 % where something hairier probably needs to be done.
6946 % #1 is what to print if we are indeed using \tt; #2 is what to print
6947 % otherwise. Since all the Computer Modern typewriter fonts have zero
6948 % interword stretch (and shrink), and it is reasonable to expect all
6949 % typewriter fonts to have this, we can check that font parameter.
6951 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
6953 % Same as above, but check for italic font. Actually this also catches
6954 % non-italic slanted fonts since it is impossible to distinguish them from
6955 % italic fonts. But since this is only used by $ and it uses \sl anyway
6956 % this is not a problem.
6957 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
6959 % Turn off all special characters except @
6960 % (and those which the user can use as if they were ordinary).
6961 % Most of these we simply print from the \tt font, but for some, we can
6962 % use math or other variants that look better in normal text.
6964 \catcode`\"=\active
6965 \def\activedoublequote{{\tt\char34}}
6966 \let"=\activedoublequote
6967 \catcode`\~=\active
6968 \def~{{\tt\char126}}
6969 \chardef\hat=`\^
6970 \catcode`\^=\active
6971 \def^{{\tt \hat}}
6973 \catcode`\_=\active
6974 \def_{\ifusingtt\normalunderscore\_}
6975 % Subroutine for the previous macro.
6976 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
6978 \catcode`\|=\active
6979 \def|{{\tt\char124}}
6980 \chardef \less=`\<
6981 \catcode`\<=\active
6982 \def<{{\tt \less}}
6983 \chardef \gtr=`\>
6984 \catcode`\>=\active
6985 \def>{{\tt \gtr}}
6986 \catcode`\+=\active
6987 \def+{{\tt \char 43}}
6988 \catcode`\$=\active
6989 \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
6991 % If a .fmt file is being used, characters that might appear in a file
6992 % name cannot be active until we have parsed the command line.
6993 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
6994 % \otherifyactive is called near the end of this file.
6995 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
6997 \catcode`\@=0
6999 % \backslashcurfont outputs one backslash character in current font,
7000 % as in \char`\\.
7001 \global\chardef\backslashcurfont=`\\
7002 \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
7004 % \rawbackslash defines an active \ to do \backslashcurfont.
7005 % \otherbackslash defines an active \ to be a literal `\' character with
7006 % catcode other.
7007 {\catcode`\\=\active
7008 @gdef@rawbackslash{@let\=@backslashcurfont}
7009 @gdef@otherbackslash{@let\=@realbackslash}
7012 % \realbackslash is an actual character `\' with catcode other.
7013 {\catcode`\\=\other @gdef@realbackslash{\}}
7015 % \normalbackslash outputs one backslash in fixed width font.
7016 \def\normalbackslash{{\tt\backslashcurfont}}
7018 \catcode`\\=\active
7020 % Used sometimes to turn off (effectively) the active characters
7021 % even after parsing them.
7022 @def@turnoffactive{%
7023 @let"=@normaldoublequote
7024 @let\=@realbackslash
7025 @let~=@normaltilde
7026 @let^=@normalcaret
7027 @let_=@normalunderscore
7028 @let|=@normalverticalbar
7029 @let<=@normalless
7030 @let>=@normalgreater
7031 @let+=@normalplus
7032 @let$=@normaldollar %$ font-lock fix
7033 @unsepspaces
7036 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
7037 % the literal character `\'. (Thus, \ is not expandable when this is in
7038 % effect.)
7040 @def@normalturnoffactive{@turnoffactive @let\=@normalbackslash}
7042 % Make _ and + \other characters, temporarily.
7043 % This is canceled by @fixbackslash.
7044 @otherifyactive
7046 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
7047 % That is what \eatinput is for; after that, the `\' should revert to printing
7048 % a backslash.
7050 @gdef@eatinput input texinfo{@fixbackslash}
7051 @global@let\ = @eatinput
7053 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
7054 % the first `\{ in the file would cause an error. This macro tries to fix
7055 % that, assuming it is called before the first `\' could plausibly occur.
7056 % Also back turn on active characters that might appear in the input
7057 % file name, in case not using a pre-dumped format.
7059 @gdef@fixbackslash{%
7060 @ifx\@eatinput @let\ = @normalbackslash @fi
7061 @catcode`+=@active
7062 @catcode`@_=@active
7065 % Say @foo, not \foo, in error messages.
7066 @escapechar = `@@
7068 % These look ok in all fonts, so just make them not special.
7069 @catcode`@& = @other
7070 @catcode`@# = @other
7071 @catcode`@% = @other
7074 @c Local variables:
7075 @c eval: (add-hook 'write-file-hooks 'time-stamp)
7076 @c page-delimiter: "^\\\\message"
7077 @c time-stamp-start: "def\\\\texinfoversion{"
7078 @c time-stamp-format: "%:y-%02m-%02d.%02H"
7079 @c time-stamp-end: "}"
7080 @c End:
7082 @c vim:sw=2:
7084 @ignore
7085 arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
7086 @end ignore