Update.
[glibc.git] / manual / texinfo.tex
blobfd306fa290373c2e88a999e302ba8496a1400a46
1 %% TeX macros to handle Texinfo files.
2 %% $Id: texinfo.tex,v 2.210 1997/07/15 19:22:46 drepper Exp $
4 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
5 % 94, 95, 96, 97 Free Software Foundation, Inc.
7 %This texinfo.tex file is free software; you can redistribute it and/or
8 %modify it under the terms of the GNU General Public License as
9 %published by the Free Software Foundation; either version 2, or (at
10 %your option) any later version.
12 %This texinfo.tex file is distributed in the hope that it will be
13 %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 %General Public License for more details.
17 %You should have received a copy of the GNU General Public License
18 %along with this texinfo.tex file; see the file COPYING. If not, write
19 %to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 %Boston, MA 02111-1307, USA.
23 %In other words, you are welcome to use, share and improve this program.
24 %You are forbidden to forbid anyone else to use, share and improve
25 %what you give them. Help stamp out software-hoarding!
28 % Send bug reports to bug-texinfo@prep.ai.mit.edu.
29 % Please include a *precise* test case in each bug report.
32 % Make it possible to create a .fmt file just by loading this file:
33 % if the underlying format is not loaded, start by loading it now.
34 % Added by gildea November 1993.
35 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
37 % This automatically updates the version number based on RCS.
38 \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
39 \deftexinfoversion$Revision: 2.210 $
40 \message{Loading texinfo package [Version \texinfoversion]:}
42 % If in a .fmt file, print the version number
43 % and turn on active characters that we couldn't do earlier because
44 % they might have appeared in the input file name.
45 \everyjob{\message{[Texinfo version \texinfoversion]}\message{}
46 \catcode`+=\active \catcode`\_=\active}
48 % Save some parts of plain tex whose names we will redefine.
50 \let\ptexb=\b
51 \let\ptexbullet=\bullet
52 \let\ptexc=\c
53 \let\ptexcomma=\,
54 \let\ptexdot=\.
55 \let\ptexdots=\dots
56 \let\ptexend=\end
57 \let\ptexequiv = \equiv
58 \let\ptexi=\i
59 \let\ptexlbrace=\{
60 \let\ptexrbrace=\}
61 \let\ptexstar=\*
62 \let\ptext=\t
64 % Be sure we're in horizontal mode when doing a tie, since we make space
65 % equivalent to this in @example-like environments. Otherwise, a space
66 % at the beginning of a line will start with \penalty -- and
67 % since \penalty is valid in vertical mode, we'd end up putting the
68 % penalty on the vertical list instead of in the new paragraph.
69 {\catcode`@ = 11
70 % Avoid using \@M directly, because that causes trouble
71 % if the definition is written into an index file.
72 \global\let\tiepenalty = \@M
73 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
77 \message{Basics,}
78 \chardef\other=12
80 % If this character appears in an error message or help string, it
81 % starts a new line in the output.
82 \newlinechar = `^^J
84 % Set up fixed words for English.
85 \ifx\putwordChapter\undefined{\gdef\putwordChapter{Chapter}}\fi%
86 \def\putwordInfo{Info}%
87 \ifx\putwordSee\undefined{\gdef\putwordSee{See}}\fi%
88 \ifx\putwordsee\undefined{\gdef\putwordsee{see}}\fi%
89 \ifx\putwordfile\undefined{\gdef\putwordfile{file}}\fi%
90 \ifx\putwordpage\undefined{\gdef\putwordpage{page}}\fi%
91 \ifx\putwordsection\undefined{\gdef\putwordsection{section}}\fi%
92 \ifx\putwordSection\undefined{\gdef\putwordSection{Section}}\fi%
93 \ifx\putwordTableofContents\undefined{\gdef\putwordTableofContents{Table of Contents}}\fi%
94 \ifx\putwordShortContents\undefined{\gdef\putwordShortContents{Short Contents}}\fi%
95 \ifx\putwordAppendix\undefined{\gdef\putwordAppendix{Appendix}}\fi%
97 % Ignore a token.
99 \def\gobble#1{}
101 \hyphenation{ap-pen-dix}
102 \hyphenation{mini-buf-fer mini-buf-fers}
103 \hyphenation{eshell}
104 \hyphenation{white-space}
106 % Margin to add to right of even pages, to left of odd pages.
107 \newdimen \bindingoffset
108 \newdimen \normaloffset
109 \newdimen\pagewidth \newdimen\pageheight
111 % Sometimes it is convenient to have everything in the transcript file
112 % and nothing on the terminal. We don't just call \tracingall here,
113 % since that produces some useless output on the terminal.
115 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
116 \def\loggingall{\tracingcommands2 \tracingstats2
117 \tracingpages1 \tracingoutput1 \tracinglostchars1
118 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
119 \showboxbreadth\maxdimen\showboxdepth\maxdimen
122 % For @cropmarks command.
123 % Do @cropmarks to get crop marks.
125 \newif\ifcropmarks
126 \let\cropmarks = \cropmarkstrue
128 % Dimensions to add cropmarks at corners.
129 % Added by P. A. MacKay, 12 Nov. 1986
131 \newdimen\cornerlong \newdimen\cornerthick
132 \newdimen\topandbottommargin
133 \newdimen\outerhsize \newdimen\outervsize
134 \cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks
135 \outerhsize=7in
136 %\outervsize=9.5in
137 % Alternative @smallbook page size is 9.25in
138 \outervsize=9.25in
139 \topandbottommargin=.75in
141 % Main output routine.
142 \chardef\PAGE = 255
143 \output = {\onepageout{\pagecontents\PAGE}}
145 \newbox\headlinebox
146 \newbox\footlinebox
148 % \onepageout takes a vbox as an argument. Note that \pagecontents
149 % does insertions, but you have to call it yourself.
150 \def\onepageout#1{%
151 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
153 \ifodd\pageno \advance\hoffset by \bindingoffset
154 \else \advance\hoffset by -\bindingoffset\fi
156 % Do this outside of the \shipout so @code etc. will be expanded in
157 % the headline as they should be, not taken literally (outputting ''code).
158 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
159 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
162 % Have to do this stuff outside the \shipout because we want it to
163 % take effect in \write's, yet the group defined by the \vbox ends
164 % before the \shipout runs.
166 \escapechar = `\\ % use backslash in output files.
167 \indexdummies % don't expand commands in the output.
168 \normalturnoffactive % \ in index entries must not stay \, e.g., if
169 % the page break happens to be in the middle of an example.
170 \shipout\vbox{%
171 \ifcropmarks \vbox to \outervsize\bgroup
172 \hsize = \outerhsize
173 \line{\ewtop\hfil\ewtop}%
174 \nointerlineskip
175 \line{%
176 \vbox{\moveleft\cornerthick\nstop}%
177 \hfill
178 \vbox{\moveright\cornerthick\nstop}%
180 \vskip\topandbottommargin
181 \line\bgroup
182 \hfil % center the page within the outer (page) hsize.
183 \ifodd\pageno\hskip\bindingoffset\fi
184 \vbox\bgroup
187 \unvbox\headlinebox
188 \pagebody{#1}%
189 \ifdim\ht\footlinebox > 0pt
190 % Only leave this space if the footline is nonempty.
191 % (We lessened \vsize for it in \oddfootingxxx.)
192 % The \baselineskip=24pt in plain's \makefootline has no effect.
193 \vskip 2\baselineskip
194 \unvbox\footlinebox
197 \ifcropmarks
198 \egroup % end of \vbox\bgroup
199 \hfil\egroup % end of (centering) \line\bgroup
200 \vskip\topandbottommargin plus1fill minus1fill
201 \boxmaxdepth = \cornerthick
202 \line{%
203 \vbox{\moveleft\cornerthick\nsbot}%
204 \hfill
205 \vbox{\moveright\cornerthick\nsbot}%
207 \nointerlineskip
208 \line{\ewbot\hfil\ewbot}%
209 \egroup % \vbox from first cropmarks clause
211 }% end of \shipout\vbox
212 }% end of group with \turnoffactive
213 \advancepageno
214 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
217 \newinsert\margin \dimen\margin=\maxdimen
219 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
220 {\catcode`\@ =11
221 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
222 % marginal hacks, juha@viisa.uucp (Juha Takala)
223 \ifvoid\margin\else % marginal info is present
224 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
225 \dimen@=\dp#1 \unvbox#1
226 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
227 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
230 % Here are the rules for the cropmarks. Note that they are
231 % offset so that the space between them is truly \outerhsize or \outervsize
232 % (P. A. MacKay, 12 November, 1986)
234 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
235 \def\nstop{\vbox
236 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
237 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
238 \def\nsbot{\vbox
239 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
241 % Parse an argument, then pass it to #1. The argument is the rest of
242 % the input line (except we remove a trailing comment). #1 should be a
243 % macro which expects an ordinary undelimited TeX argument.
245 \def\parsearg#1{%
246 \let\next = #1%
247 \begingroup
248 \obeylines
249 \futurelet\temp\parseargx
252 % If the next token is an obeyed space (from an @example environment or
253 % the like), remove it and recurse. Otherwise, we're done.
254 \def\parseargx{%
255 % \obeyedspace is defined far below, after the definition of \sepspaces.
256 \ifx\obeyedspace\temp
257 \expandafter\parseargdiscardspace
258 \else
259 \expandafter\parseargline
263 % Remove a single space (as the delimiter token to the macro call).
264 {\obeyspaces %
265 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
267 {\obeylines %
268 \gdef\parseargline#1^^M{%
269 \endgroup % End of the group started in \parsearg.
271 % First remove any @c comment, then any @comment.
272 % Result of each macro is put in \toks0.
273 \argremovec #1\c\relax %
274 \expandafter\argremovecomment \the\toks0 \comment\relax %
276 % Call the caller's macro, saved as \next in \parsearg.
277 \expandafter\next\expandafter{\the\toks0}%
281 % Since all \c{,omment} does is throw away the argument, we can let TeX
282 % do that for us. The \relax here is matched by the \relax in the call
283 % in \parseargline; it could be more or less anything, its purpose is
284 % just to delimit the argument to the \c.
285 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
286 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
288 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
289 % @end itemize @c foo
290 % will have two active spaces as part of the argument with the
291 % `itemize'. Here we remove all active spaces from #1, and assign the
292 % result to \toks0.
294 % This loses if there are any *other* active characters besides spaces
295 % in the argument -- _ ^ +, for example -- since they get expanded.
296 % Fortunately, Texinfo does not define any such commands. (If it ever
297 % does, the catcode of the characters in questionwill have to be changed
298 % here.) But this means we cannot call \removeactivespaces as part of
299 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
300 % that \parsearg gets might well have any character at all in it.
302 \def\removeactivespaces#1{%
303 \begingroup
304 \ignoreactivespaces
305 \edef\temp{#1}%
306 \global\toks0 = \expandafter{\temp}%
307 \endgroup
310 % Change the active space to expand to nothing.
312 \begingroup
313 \obeyspaces
314 \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
315 \endgroup
318 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
320 %% These are used to keep @begin/@end levels from running away
321 %% Call \inENV within environments (after a \begingroup)
322 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
323 \def\ENVcheck{%
324 \ifENV\errmessage{Still within an environment. Type Return to continue.}
325 \endgroup\fi} % This is not perfect, but it should reduce lossage
327 % @begin foo is the same as @foo, for now.
328 \newhelp\EMsimple{Type <Return> to continue.}
330 \outer\def\begin{\parsearg\beginxxx}
332 \def\beginxxx #1{%
333 \expandafter\ifx\csname #1\endcsname\relax
334 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
335 \csname #1\endcsname\fi}
337 % @end foo executes the definition of \Efoo.
339 \def\end{\parsearg\endxxx}
340 \def\endxxx #1{%
341 \removeactivespaces{#1}%
342 \edef\endthing{\the\toks0}%
344 \expandafter\ifx\csname E\endthing\endcsname\relax
345 \expandafter\ifx\csname \endthing\endcsname\relax
346 % There's no \foo, i.e., no ``environment'' foo.
347 \errhelp = \EMsimple
348 \errmessage{Undefined command `@end \endthing'}%
349 \else
350 \unmatchedenderror\endthing
352 \else
353 % Everything's ok; the right environment has been started.
354 \csname E\endthing\endcsname
358 % There is an environment #1, but it hasn't been started. Give an error.
360 \def\unmatchedenderror#1{%
361 \errhelp = \EMsimple
362 \errmessage{This `@end #1' doesn't have a matching `@#1'}%
365 % Define the control sequence \E#1 to give an unmatched @end error.
367 \def\defineunmatchedend#1{%
368 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
372 % Single-spacing is done by various environments (specifically, in
373 % \nonfillstart and \quotations).
374 \newskip\singlespaceskip \singlespaceskip = 12.5pt
375 \def\singlespace{%
376 % Why was this kern here? It messes up equalizing space above and below
377 % environments. --karl, 6may93
378 %{\advance \baselineskip by -\singlespaceskip
379 %\kern \baselineskip}%
380 \setleading \singlespaceskip
383 %% Simple single-character @ commands
385 % @@ prints an @
386 % Kludge this until the fonts are right (grr).
387 \def\@{{\tt \char '100}}
389 % This is turned off because it was never documented
390 % and you can use @w{...} around a quote to suppress ligatures.
391 %% Define @` and @' to be the same as ` and '
392 %% but suppressing ligatures.
393 %\def\`{{`}}
394 %\def\'{{'}}
396 % Used to generate quoted braces.
397 \def\mylbrace {{\tt \char '173}}
398 \def\myrbrace {{\tt \char '175}}
399 \let\{=\mylbrace
400 \let\}=\myrbrace
401 \begingroup
402 % Definitions to produce actual \{ & \} command in an index.
403 \catcode`\{ = 12 \catcode`\} = 12
404 \catcode`\[ = 1 \catcode`\] = 2
405 \catcode`\@ = 0 \catcode`\\ = 12
406 @gdef@lbracecmd[\{]%
407 @gdef@rbracecmd[\}]%
408 @endgroup
410 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
411 % Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
412 \let\, = \c
413 \let\dotaccent = \.
414 \def\ringaccent#1{{\accent23 #1}}
415 \let\tieaccent = \t
416 \let\ubaraccent = \b
417 \let\udotaccent = \d
419 % Other special characters: @questiondown @exclamdown
420 % Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
421 \def\questiondown{?`}
422 \def\exclamdown{!`}
424 % Dotless i and dotless j, used for accents.
425 \def\imacro{i}
426 \def\jmacro{j}
427 \def\dotless#1{%
428 \def\temp{#1}%
429 \ifx\temp\imacro \ptexi
430 \else\ifx\temp\jmacro \j
431 \else \errmessage{@dotless can be used only with i or j}%
432 \fi\fi
435 % @: forces normal size whitespace following.
436 \def\:{\spacefactor=1000 }
438 % @* forces a line break.
439 \def\*{\hfil\break\hbox{}\ignorespaces}
441 % @. is an end-of-sentence period.
442 \def\.{.\spacefactor=3000 }
444 % @enddots{} is an end-of-sentence ellipsis.
445 \gdef\enddots{$\mathinner{\ldotp\ldotp\ldotp\ldotp}$\spacefactor=3000}
447 % @! is an end-of-sentence bang.
448 \gdef\!{!\spacefactor=3000 }
450 % @? is an end-of-sentence query.
451 \gdef\?{?\spacefactor=3000 }
453 % @w prevents a word break. Without the \leavevmode, @w at the
454 % beginning of a paragraph, when TeX is still in vertical mode, would
455 % produce a whole line of output instead of starting the paragraph.
456 \def\w#1{\leavevmode\hbox{#1}}
458 % @group ... @end group forces ... to be all on one page, by enclosing
459 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
460 % to keep its height that of a normal line. According to the rules for
461 % \topskip (p.114 of the TeXbook), the glue inserted is
462 % max (\topskip - \ht (first item), 0). If that height is large,
463 % therefore, no glue is inserted, and the space between the headline and
464 % the text is small, which looks bad.
466 \def\group{\begingroup
467 \ifnum\catcode13=\active \else
468 \errhelp = \groupinvalidhelp
469 \errmessage{@group invalid in context where filling is enabled}%
472 % The \vtop we start below produces a box with normal height and large
473 % depth; thus, TeX puts \baselineskip glue before it, and (when the
474 % next line of text is done) \lineskip glue after it. (See p.82 of
475 % the TeXbook.) Thus, space below is not quite equal to space
476 % above. But it's pretty close.
477 \def\Egroup{%
478 \egroup % End the \vtop.
479 \endgroup % End the \group.
482 \vtop\bgroup
483 % We have to put a strut on the last line in case the @group is in
484 % the midst of an example, rather than completely enclosing it.
485 % Otherwise, the interline space between the last line of the group
486 % and the first line afterwards is too small. But we can't put the
487 % strut in \Egroup, since there it would be on a line by itself.
488 % Hence this just inserts a strut at the beginning of each line.
489 \everypar = {\strut}%
491 % Since we have a strut on every line, we don't need any of TeX's
492 % normal interline spacing.
493 \offinterlineskip
495 % OK, but now we have to do something about blank
496 % lines in the input in @example-like environments, which normally
497 % just turn into \lisppar, which will insert no space now that we've
498 % turned off the interline space. Simplest is to make them be an
499 % empty paragraph.
500 \ifx\par\lisppar
501 \edef\par{\leavevmode \par}%
503 % Reset ^^M's definition to new definition of \par.
504 \obeylines
507 % Do @comment since we are called inside an environment such as
508 % @example, where each end-of-line in the input causes an
509 % end-of-line in the output. We don't want the end-of-line after
510 % the `@group' to put extra space in the output. Since @group
511 % should appear on a line by itself (according to the Texinfo
512 % manual), we don't worry about eating any user text.
513 \comment
516 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
517 % message, so this ends up printing `@group can only ...'.
519 \newhelp\groupinvalidhelp{%
520 group can only be used in environments such as @example,^^J%
521 where each line of input produces a line of output.}
523 % @need space-in-mils
524 % forces a page break if there is not space-in-mils remaining.
526 \newdimen\mil \mil=0.001in
528 \def\need{\parsearg\needx}
530 % Old definition--didn't work.
531 %\def\needx #1{\par %
532 %% This method tries to make TeX break the page naturally
533 %% if the depth of the box does not fit.
534 %{\baselineskip=0pt%
535 %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
536 %\prevdepth=-1000pt
539 \def\needx#1{%
540 % Go into vertical mode, so we don't make a big box in the middle of a
541 % paragraph.
542 \par
544 % Don't add any leading before our big empty box, but allow a page
545 % break, since the best break might be right here.
546 \allowbreak
547 \nointerlineskip
548 \vtop to #1\mil{\vfil}%
550 % TeX does not even consider page breaks if a penalty added to the
551 % main vertical list is 10000 or more. But in order to see if the
552 % empty box we just added fits on the page, we must make it consider
553 % page breaks. On the other hand, we don't want to actually break the
554 % page after the empty box. So we use a penalty of 9999.
556 % There is an extremely small chance that TeX will actually break the
557 % page at this \penalty, if there are no other feasible breakpoints in
558 % sight. (If the user is using lots of big @group commands, which
559 % almost-but-not-quite fill up a page, TeX will have a hard time doing
560 % good page breaking, for example.) However, I could not construct an
561 % example where a page broke at this \penalty; if it happens in a real
562 % document, then we can reconsider our strategy.
563 \penalty9999
565 % Back up by the size of the box, whether we did a page break or not.
566 \kern -#1\mil
568 % Do not allow a page break right after this kern.
569 \nobreak
572 % @br forces paragraph break
574 \let\br = \par
576 % @dots{} output some dots
578 \def\dots{$\ldots$}
580 % @page forces the start of a new page
582 \def\page{\par\vfill\supereject}
584 % @exdent text....
585 % outputs text on separate line in roman font, starting at standard page margin
587 % This records the amount of indent in the innermost environment.
588 % That's how much \exdent should take out.
589 \newskip\exdentamount
591 % This defn is used inside fill environments such as @defun.
592 \def\exdent{\parsearg\exdentyyy}
593 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
595 % This defn is used inside nofill environments such as @example.
596 \def\nofillexdent{\parsearg\nofillexdentyyy}
597 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
598 \leftline{\hskip\leftskip{\rm#1}}}}
600 % @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
602 \def\inmargin#1{%
603 \strut\vadjust{\nobreak\kern-\strutdepth
604 \vtop to \strutdepth{\baselineskip\strutdepth\vss
605 \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
606 \newskip\inmarginspacing \inmarginspacing=1cm
607 \def\strutdepth{\dp\strutbox}
609 %\hbox{{\rm#1}}\hfil\break}}
611 % @include file insert text of that file as input.
612 % Allow normal characters that we make active in the argument (a file name).
613 \def\include{\begingroup
614 \catcode`\\=12
615 \catcode`~=12
616 \catcode`^=12
617 \catcode`_=12
618 \catcode`|=12
619 \catcode`<=12
620 \catcode`>=12
621 \catcode`+=12
622 \parsearg\includezzz}
623 % Restore active chars for included file.
624 \def\includezzz#1{\endgroup\begingroup
625 % Read the included file in a group so nested @include's work.
626 \def\thisfile{#1}%
627 \input\thisfile
628 \endgroup}
630 \def\thisfile{}
632 % @center line outputs that line, centered
634 \def\center{\parsearg\centerzzz}
635 \def\centerzzz #1{{\advance\hsize by -\leftskip
636 \advance\hsize by -\rightskip
637 \centerline{#1}}}
639 % @sp n outputs n lines of vertical space
641 \def\sp{\parsearg\spxxx}
642 \def\spxxx #1{\vskip #1\baselineskip}
644 % @comment ...line which is ignored...
645 % @c is the same as @comment
646 % @ignore ... @end ignore is another way to write a comment
648 \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
649 \parsearg \commentxxx}
651 \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
653 \let\c=\comment
655 % @paragraphindent is defined for the Info formatting commands only.
656 \let\paragraphindent=\comment
658 % Prevent errors for section commands.
659 % Used in @ignore and in failing conditionals.
660 \def\ignoresections{%
661 \let\chapter=\relax
662 \let\unnumbered=\relax
663 \let\top=\relax
664 \let\unnumberedsec=\relax
665 \let\unnumberedsection=\relax
666 \let\unnumberedsubsec=\relax
667 \let\unnumberedsubsection=\relax
668 \let\unnumberedsubsubsec=\relax
669 \let\unnumberedsubsubsection=\relax
670 \let\section=\relax
671 \let\subsec=\relax
672 \let\subsubsec=\relax
673 \let\subsection=\relax
674 \let\subsubsection=\relax
675 \let\appendix=\relax
676 \let\appendixsec=\relax
677 \let\appendixsection=\relax
678 \let\appendixsubsec=\relax
679 \let\appendixsubsection=\relax
680 \let\appendixsubsubsec=\relax
681 \let\appendixsubsubsection=\relax
682 \let\contents=\relax
683 \let\smallbook=\relax
684 \let\titlepage=\relax
687 % Used in nested conditionals, where we have to parse the Texinfo source
688 % and so want to turn off most commands, in case they are used
689 % incorrectly.
691 \def\ignoremorecommands{%
692 \let\defcodeindex = \relax
693 \let\defcv = \relax
694 \let\deffn = \relax
695 \let\deffnx = \relax
696 \let\defindex = \relax
697 \let\defivar = \relax
698 \let\defmac = \relax
699 \let\defmethod = \relax
700 \let\defop = \relax
701 \let\defopt = \relax
702 \let\defspec = \relax
703 \let\deftp = \relax
704 \let\deftypefn = \relax
705 \let\deftypefun = \relax
706 \let\deftypevar = \relax
707 \let\deftypevr = \relax
708 \let\defun = \relax
709 \let\defvar = \relax
710 \let\defvr = \relax
711 \let\ref = \relax
712 \let\xref = \relax
713 \let\printindex = \relax
714 \let\pxref = \relax
715 \let\settitle = \relax
716 \let\setchapternewpage = \relax
717 \let\setchapterstyle = \relax
718 \let\everyheading = \relax
719 \let\evenheading = \relax
720 \let\oddheading = \relax
721 \let\everyfooting = \relax
722 \let\evenfooting = \relax
723 \let\oddfooting = \relax
724 \let\headings = \relax
725 \let\include = \relax
726 \let\lowersections = \relax
727 \let\down = \relax
728 \let\raisesections = \relax
729 \let\up = \relax
730 \let\set = \relax
731 \let\clear = \relax
732 \let\item = \relax
735 % Ignore @ignore ... @end ignore.
737 \def\ignore{\doignore{ignore}}
739 % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
741 \def\ifinfo{\doignore{ifinfo}}
742 \def\ifhtml{\doignore{ifhtml}}
743 \def\ifnottex{\doignore{ifnottex}}
744 \def\html{\doignore{html}}
745 \def\menu{\doignore{menu}}
746 \def\direntry{\doignore{direntry}}
748 % Also ignore @macro ... @end macro. The user must run texi2dvi,
749 % which runs makeinfo to do macro expansion. Ignore @unmacro, too.
750 \def\macro{\doignore{macro}}
751 \let\unmacro = \comment
754 % @dircategory CATEGORY -- specify a category of the dir file
755 % which this file should belong to. Ignore this in TeX.
756 \let\dircategory = \comment
758 % Ignore text until a line `@end #1'.
760 \def\doignore#1{\begingroup
761 % Don't complain about control sequences we have declared \outer.
762 \ignoresections
764 % Define a command to swallow text until we reach `@end #1'.
765 \long\def\doignoretext##1\end #1{\enddoignore}%
767 % Make sure that spaces turn into tokens that match what \doignoretext wants.
768 \catcode32 = 10
770 % Ignore braces, too, so mismatched braces don't cause trouble.
771 \catcode`\{ = 9
772 \catcode`\} = 9
774 % And now expand that command.
775 \doignoretext
778 % What we do to finish off ignored text.
780 \def\enddoignore{\endgroup\ignorespaces}%
782 \newif\ifwarnedobs\warnedobsfalse
783 \def\obstexwarn{%
784 \ifwarnedobs\relax\else
785 % We need to warn folks that they may have trouble with TeX 3.0.
786 % This uses \immediate\write16 rather than \message to get newlines.
787 \immediate\write16{}
788 \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
789 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
790 \immediate\write16{If you are running another version of TeX, relax.}
791 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
792 \immediate\write16{ Then upgrade your TeX installation if you can.}
793 \immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
794 \immediate\write16{If you are stuck with version 3.0, run the}
795 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
796 \immediate\write16{ to use a workaround.}
797 \immediate\write16{}
798 \global\warnedobstrue
802 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
803 % workaround (which requires the file ``dummy.tfm'' to be installed),
804 % uncomment the following line:
805 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
807 % Ignore text, except that we keep track of conditional commands for
808 % purposes of nesting, up to an `@end #1' command.
810 \def\nestedignore#1{%
811 \obstexwarn
812 % We must actually expand the ignored text to look for the @end
813 % command, so that nested ignore constructs work. Thus, we put the
814 % text into a \vbox and then do nothing with the result. To minimize
815 % the change of memory overflow, we follow the approach outlined on
816 % page 401 of the TeXbook: make the current font be a dummy font.
818 \setbox0 = \vbox\bgroup
819 % Don't complain about control sequences we have declared \outer.
820 \ignoresections
822 % Define `@end #1' to end the box, which will in turn undefine the
823 % @end command again.
824 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
826 % We are going to be parsing Texinfo commands. Most cause no
827 % trouble when they are used incorrectly, but some commands do
828 % complicated argument parsing or otherwise get confused, so we
829 % undefine them.
831 % We can't do anything about stray @-signs, unfortunately;
832 % they'll produce `undefined control sequence' errors.
833 \ignoremorecommands
835 % Set the current font to be \nullfont, a TeX primitive, and define
836 % all the font commands to also use \nullfont. We don't use
837 % dummy.tfm, as suggested in the TeXbook, because not all sites
838 % might have that installed. Therefore, math mode will still
839 % produce output, but that should be an extremely small amount of
840 % stuff compared to the main input.
842 \nullfont
843 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
844 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
845 \let\tensf = \nullfont
846 % Similarly for index fonts (mostly for their use in
847 % smallexample)
848 \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
849 \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
850 \let\indsf = \nullfont
852 % Don't complain when characters are missing from the fonts.
853 \tracinglostchars = 0
855 % Don't bother to do space factor calculations.
856 \frenchspacing
858 % Don't report underfull hboxes.
859 \hbadness = 10000
861 % Do minimal line-breaking.
862 \pretolerance = 10000
864 % Do not execute instructions in @tex
865 \def\tex{\doignore{tex}}%
868 % @set VAR sets the variable VAR to an empty value.
869 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
871 % Since we want to separate VAR from REST-OF-LINE (which might be
872 % empty), we can't just use \parsearg; we have to insert a space of our
873 % own to delimit the rest of the line, and then take it out again if we
874 % didn't need it. Make sure the catcode of space is correct to avoid
875 % losing inside @example, for instance.
877 \def\set{\begingroup\catcode` =10
878 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
879 \parsearg\setxxx}
880 \def\setxxx#1{\setyyy#1 \endsetyyy}
881 \def\setyyy#1 #2\endsetyyy{%
882 \def\temp{#2}%
883 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
884 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
886 \endgroup
888 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
889 % \next or other control sequences that we've defined might get us into
890 % an infinite loop. Consider `@set foo @cite{bar}'.
891 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
893 % @clear VAR clears (i.e., unsets) the variable VAR.
895 \def\clear{\parsearg\clearxxx}
896 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
898 % @value{foo} gets the text saved in variable foo.
900 \def\value{\begingroup
901 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
902 \valuexxx}
903 \def\valuexxx#1{%
904 \expandafter\ifx\csname SET#1\endcsname\relax
905 {\{No value for ``#1''\}}%
906 \else
907 \csname SET#1\endcsname
909 \endgroup}
911 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
912 % with @set.
914 \def\ifset{\parsearg\ifsetxxx}
915 \def\ifsetxxx #1{%
916 \expandafter\ifx\csname SET#1\endcsname\relax
917 \expandafter\ifsetfail
918 \else
919 \expandafter\ifsetsucceed
922 \def\ifsetsucceed{\conditionalsucceed{ifset}}
923 \def\ifsetfail{\nestedignore{ifset}}
924 \defineunmatchedend{ifset}
926 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
927 % defined with @set, or has been undefined with @clear.
929 \def\ifclear{\parsearg\ifclearxxx}
930 \def\ifclearxxx #1{%
931 \expandafter\ifx\csname SET#1\endcsname\relax
932 \expandafter\ifclearsucceed
933 \else
934 \expandafter\ifclearfail
937 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
938 \def\ifclearfail{\nestedignore{ifclear}}
939 \defineunmatchedend{ifclear}
941 % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
942 % following, through the first @end iftex (etc.). Make `@end iftex'
943 % (etc.) valid only after an @iftex.
945 \def\iftex{\conditionalsucceed{iftex}}
946 \def\ifnothtml{\conditionalsucceed{ifnothtml}}
947 \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
948 \defineunmatchedend{iftex}
949 \defineunmatchedend{ifnothtml}
950 \defineunmatchedend{ifnotinfo}
952 % We can't just want to start a group at @iftex (for example) and end it
953 % at @end iftex, since then @set commands inside the conditional have no
954 % effect (they'd get reverted at the end of the group). So we must
955 % define \Eiftex to redefine itself to be its previous value. (We can't
956 % just define it to fail again with an ``unmatched end'' error, since
957 % the @ifset might be nested.)
959 \def\conditionalsucceed#1{%
960 \edef\temp{%
961 % Remember the current value of \E#1.
962 \let\nece{prevE#1} = \nece{E#1}%
964 % At the `@end #1', redefine \E#1 to be its previous value.
965 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
967 \temp
970 % We need to expand lots of \csname's, but we don't want to expand the
971 % control sequences after we've constructed them.
973 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
975 % @asis just yields its argument. Used with @table, for example.
977 \def\asis#1{#1}
979 % @math means output in math mode.
980 % We don't use $'s directly in the definition of \math because control
981 % sequences like \math are expanded when the toc file is written. Then,
982 % we read the toc file back, the $'s will be normal characters (as they
983 % should be, according to the definition of Texinfo). So we must use a
984 % control sequence to switch into and out of math mode.
986 % This isn't quite enough for @math to work properly in indices, but it
987 % seems unlikely it will ever be needed there.
989 \let\implicitmath = $
990 \def\math#1{\implicitmath #1\implicitmath}
992 % @bullet and @minus need the same treatment as @math, just above.
993 \def\bullet{\implicitmath\ptexbullet\implicitmath}
994 \def\minus{\implicitmath-\implicitmath}
996 \def\node{\ENVcheck\parsearg\nodezzz}
997 \def\nodezzz#1{\nodexxx [#1,]}
998 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
999 \let\nwnode=\node
1000 \let\lastnode=\relax
1002 \def\donoderef{\ifx\lastnode\relax\else
1003 \expandafter\expandafter\expandafter\setref{\lastnode}\fi
1004 \global\let\lastnode=\relax}
1006 \def\unnumbnoderef{\ifx\lastnode\relax\else
1007 \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
1008 \global\let\lastnode=\relax}
1010 \def\appendixnoderef{\ifx\lastnode\relax\else
1011 \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
1012 \global\let\lastnode=\relax}
1014 % @refill is a no-op.
1015 \let\refill=\relax
1017 % @setfilename is done at the beginning of every texinfo file.
1018 % So open here the files we need to have open while reading the input.
1019 % This makes it possible to make a .fmt file for texinfo.
1020 \def\setfilename{%
1021 \readauxfile
1022 \opencontents
1023 \openindices
1024 \fixbackslash % Turn off hack to swallow `\input texinfo'.
1025 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
1027 % If texinfo.cnf is present on the system, read it.
1028 % Useful for site-wide @afourpaper, etc.
1029 % Just to be on the safe side, close the input stream before the \input.
1030 \openin 1 texinfo.cnf
1031 \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
1032 \closein1
1033 \temp
1035 \comment % Ignore the actual filename.
1038 % @bye.
1039 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1041 % \def\macro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\macroxxx}
1042 % \def\macroxxx#1#2 \end macro{%
1043 % \expandafter\gdef\macrotemp#1{#2}%
1044 % \endgroup}
1046 %\def\linemacro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\linemacroxxx}
1047 %\def\linemacroxxx#1#2 \end linemacro{%
1048 %\let\parsearg=\relax
1049 %\edef\macrotempx{\csname M\butfirst\expandafter\string\macrotemp\endcsname}%
1050 %\expandafter\xdef\macrotemp{\parsearg\macrotempx}%
1051 %\expandafter\gdef\macrotempx#1{#2}%
1052 %\endgroup}
1054 %\def\butfirst#1{}
1057 \message{fonts,}
1059 % Font-change commands.
1061 % Texinfo supports the sans serif font style, which plain TeX does not.
1062 % So we set up a \sf analogous to plain's \rm, etc.
1063 \newfam\sffam
1064 \def\sf{\fam=\sffam \tensf}
1065 \let\li = \sf % Sometimes we call it \li, not \sf.
1067 % We don't need math for this one.
1068 \def\ttsl{\tenttsl}
1070 % Use Computer Modern fonts at \magstephalf (11pt).
1071 \newcount\mainmagstep
1072 \mainmagstep=\magstephalf
1074 % Set the font macro #1 to the font named #2, adding on the
1075 % specified font prefix (normally `cm').
1076 % #3 is the font's design size, #4 is a scale factor
1077 \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1079 % Use cm as the default font prefix.
1080 % To specify the font prefix, you must define \fontprefix
1081 % before you read in texinfo.tex.
1082 \ifx\fontprefix\undefined
1083 \def\fontprefix{cm}
1085 % Support font families that don't use the same naming scheme as CM.
1086 \def\rmshape{r}
1087 \def\rmbshape{bx} %where the normal face is bold
1088 \def\bfshape{b}
1089 \def\bxshape{bx}
1090 \def\ttshape{tt}
1091 \def\ttbshape{tt}
1092 \def\ttslshape{sltt}
1093 \def\itshape{ti}
1094 \def\itbshape{bxti}
1095 \def\slshape{sl}
1096 \def\slbshape{bxsl}
1097 \def\sfshape{ss}
1098 \def\sfbshape{ss}
1099 \def\scshape{csc}
1100 \def\scbshape{csc}
1102 \ifx\bigger\relax
1103 \let\mainmagstep=\magstep1
1104 \setfont\textrm\rmshape{12}{1000}
1105 \setfont\texttt\ttshape{12}{1000}
1106 \else
1107 \setfont\textrm\rmshape{10}{\mainmagstep}
1108 \setfont\texttt\ttshape{10}{\mainmagstep}
1110 % Instead of cmb10, you many want to use cmbx10.
1111 % cmbx10 is a prettier font on its own, but cmb10
1112 % looks better when embedded in a line with cmr10.
1113 \setfont\textbf\bfshape{10}{\mainmagstep}
1114 \setfont\textit\itshape{10}{\mainmagstep}
1115 \setfont\textsl\slshape{10}{\mainmagstep}
1116 \setfont\textsf\sfshape{10}{\mainmagstep}
1117 \setfont\textsc\scshape{10}{\mainmagstep}
1118 \setfont\textttsl\ttslshape{10}{\mainmagstep}
1119 \font\texti=cmmi10 scaled \mainmagstep
1120 \font\textsy=cmsy10 scaled \mainmagstep
1122 % A few fonts for @defun, etc.
1123 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1124 \setfont\deftt\ttshape{10}{\magstep1}
1125 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1127 % Fonts for indices and small examples (9pt).
1128 % We actually use the slanted font rather than the italic,
1129 % because texinfo normally uses the slanted fonts for that.
1130 % Do not make many font distinctions in general in the index, since they
1131 % aren't very useful.
1132 \setfont\ninett\ttshape{9}{1000}
1133 \setfont\indrm\rmshape{9}{1000}
1134 \setfont\indit\slshape{9}{1000}
1135 \let\indsl=\indit
1136 \let\indtt=\ninett
1137 \let\indttsl=\ninett
1138 \let\indsf=\indrm
1139 \let\indbf=\indrm
1140 \setfont\indsc\scshape{10}{900}
1141 \font\indi=cmmi9
1142 \font\indsy=cmsy9
1144 % Fonts for title page:
1145 \setfont\titlerm\rmbshape{12}{\magstep3}
1146 \setfont\titleit\itbshape{10}{\magstep4}
1147 \setfont\titlesl\slbshape{10}{\magstep4}
1148 \setfont\titlett\ttbshape{12}{\magstep3}
1149 \setfont\titlettsl\ttslshape{10}{\magstep4}
1150 \setfont\titlesf\sfbshape{17}{\magstep1}
1151 \let\titlebf=\titlerm
1152 \setfont\titlesc\scbshape{10}{\magstep4}
1153 \font\titlei=cmmi12 scaled \magstep3
1154 \font\titlesy=cmsy10 scaled \magstep4
1155 \def\authorrm{\secrm}
1157 % Chapter (and unnumbered) fonts (17.28pt).
1158 \setfont\chaprm\rmbshape{12}{\magstep2}
1159 \setfont\chapit\itbshape{10}{\magstep3}
1160 \setfont\chapsl\slbshape{10}{\magstep3}
1161 \setfont\chaptt\ttbshape{12}{\magstep2}
1162 \setfont\chapttsl\ttslshape{10}{\magstep3}
1163 \setfont\chapsf\sfbshape{17}{1000}
1164 \let\chapbf=\chaprm
1165 \setfont\chapsc\scbshape{10}{\magstep3}
1166 \font\chapi=cmmi12 scaled \magstep2
1167 \font\chapsy=cmsy10 scaled \magstep3
1169 % Section fonts (14.4pt).
1170 \setfont\secrm\rmbshape{12}{\magstep1}
1171 \setfont\secit\itbshape{10}{\magstep2}
1172 \setfont\secsl\slbshape{10}{\magstep2}
1173 \setfont\sectt\ttbshape{12}{\magstep1}
1174 \setfont\secttsl\ttslshape{10}{\magstep2}
1175 \setfont\secsf\sfbshape{12}{\magstep1}
1176 \let\secbf\secrm
1177 \setfont\secsc\scbshape{10}{\magstep2}
1178 \font\seci=cmmi12 scaled \magstep1
1179 \font\secsy=cmsy10 scaled \magstep2
1181 % \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
1182 % \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
1183 % \setfont\ssecsl\slshape{10}{\magstep1}
1184 % \setfont\ssectt\ttshape{10}{\magstep1}
1185 % \setfont\ssecsf\sfshape{10}{\magstep1}
1187 %\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
1188 %\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
1189 %\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
1190 %\setfont\ssectt\ttshape{10}{1315}
1191 %\setfont\ssecsf\sfshape{10}{1315}
1193 %\let\ssecbf=\ssecrm
1195 % Subsection fonts (13.15pt).
1196 \setfont\ssecrm\rmbshape{12}{\magstephalf}
1197 \setfont\ssecit\itbshape{10}{1315}
1198 \setfont\ssecsl\slbshape{10}{1315}
1199 \setfont\ssectt\ttbshape{12}{\magstephalf}
1200 \setfont\ssecttsl\ttslshape{10}{1315}
1201 \setfont\ssecsf\sfbshape{12}{\magstephalf}
1202 \let\ssecbf\ssecrm
1203 \setfont\ssecsc\scbshape{10}{\magstep1}
1204 \font\sseci=cmmi12 scaled \magstephalf
1205 \font\ssecsy=cmsy10 scaled 1315
1206 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1207 % but that is not a standard magnification.
1209 % In order for the font changes to affect most math symbols and letters,
1210 % we have to define the \textfont of the standard families. Since
1211 % texinfo doesn't allow for producing subscripts and superscripts, we
1212 % don't bother to reset \scriptfont and \scriptscriptfont (which would
1213 % also require loading a lot more fonts).
1215 \def\resetmathfonts{%
1216 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1217 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1218 \textfont\ttfam = \tentt \textfont\sffam = \tensf
1222 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1223 % of just \STYLE. We do this so that font changes will continue to work
1224 % in math mode, where it is the current \fam that is relevant in most
1225 % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
1226 % \tenbf}, for example. By redefining \tenbf, we obviate the need to
1227 % redefine \bf itself.
1228 \def\textfonts{%
1229 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1230 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1231 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
1232 \resetmathfonts}
1233 \def\titlefonts{%
1234 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
1235 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
1236 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
1237 \let\tenttsl=\titlettsl
1238 \resetmathfonts \setleading{25pt}}
1239 \def\titlefont#1{{\titlefonts #1}}
1240 \def\chapfonts{%
1241 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1242 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1243 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
1244 \resetmathfonts \setleading{19pt}}
1245 \def\secfonts{%
1246 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1247 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1248 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
1249 \resetmathfonts \setleading{16pt}}
1250 \def\subsecfonts{%
1251 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1252 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1253 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1254 \resetmathfonts \setleading{15pt}}
1255 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1256 \def\indexfonts{%
1257 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
1258 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
1259 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
1260 \resetmathfonts \setleading{12pt}}
1262 % Set up the default fonts, so we can use them for creating boxes.
1264 \textfonts
1266 % Count depth in font-changes, for error checks
1267 \newcount\fontdepth \fontdepth=0
1269 % Fonts for short table of contents.
1270 \setfont\shortcontrm\rmshape{12}{1000}
1271 \setfont\shortcontbf\bxshape{12}{1000}
1272 \setfont\shortcontsl\slshape{12}{1000}
1274 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1275 %% serif) and @ii for TeX italic
1277 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1278 % unless the following character is such as not to need one.
1279 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1280 \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
1282 \let\i=\smartitalic
1283 \let\var=\smartitalic
1284 \let\dfn=\smartitalic
1285 \let\emph=\smartitalic
1286 \let\cite=\smartitalic
1288 \def\b#1{{\bf #1}}
1289 \let\strong=\b
1291 % We can't just use \exhyphenpenalty, because that only has effect at
1292 % the end of a paragraph. Restore normal hyphenation at the end of the
1293 % group within which \nohyphenation is presumably called.
1295 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1296 \def\restorehyphenation{\hyphenchar\font = `- }
1298 \def\t#1{%
1299 {\tt \rawbackslash \frenchspacing #1}%
1300 \null
1302 \let\ttfont=\t
1303 \def\samp #1{`\tclose{#1}'\null}
1304 \setfont\smallrm\rmshape{8}{1000}
1305 \font\smallsy=cmsy9
1306 \def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
1307 \raise0.4pt\hbox{$\langle$}\kern-.08em\vtop{%
1308 \vbox{\hrule\kern-0.4pt
1309 \hbox{\raise0.4pt\hbox{\vphantom{$\langle$}}#1}}%
1310 \kern-0.4pt\hrule}%
1311 \kern-.06em\raise0.4pt\hbox{$\rangle$}}}}
1312 % The old definition, with no lozenge:
1313 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1314 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1316 \let\file=\samp
1318 % @code is a modification of @t,
1319 % which makes spaces the same size as normal in the surrounding text.
1320 \def\tclose#1{%
1322 % Change normal interword space to be same as for the current font.
1323 \spaceskip = \fontdimen2\font
1325 % Switch to typewriter.
1328 % But `\ ' produces the large typewriter interword space.
1329 \def\ {{\spaceskip = 0pt{} }}%
1331 % Turn off hyphenation.
1332 \nohyphenation
1334 \rawbackslash
1335 \frenchspacing
1338 \null
1341 % We *must* turn on hyphenation at `-' and `_' in \code.
1342 % Otherwise, it is too hard to avoid overfull hboxes
1343 % in the Emacs manual, the Library manual, etc.
1345 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1346 % both hyphenation at - and hyphenation within words.
1347 % We must therefore turn them both off (\tclose does that)
1348 % and arrange explicitly to hyphenate at a dash.
1349 % -- rms.
1351 \catcode`\-=\active
1352 \catcode`\_=\active
1353 \catcode`\|=\active
1354 \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
1355 % The following is used by \doprintindex to insure that long function names
1356 % wrap around. It is necessary for - and _ to be active before the index is
1357 % read from the file, as \entry parses the arguments long before \code is
1358 % ever called. -- mycroft
1359 % _ is always active; and it shouldn't be \let = to an _ that is a
1360 % subscript character anyway. Then, @cindex @samp{_} (for example)
1361 % fails. --karl
1362 \global\def\indexbreaks{%
1363 \catcode`\-=\active \let-\realdash
1367 \def\realdash{-}
1368 \def\codedash{-\discretionary{}{}{}}
1369 \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
1370 \def\codex #1{\tclose{#1}\endgroup}
1372 %\let\exp=\tclose %Was temporary
1374 % @kbd is like @code, except that if the argument is just one @key command,
1375 % then @kbd has no effect.
1377 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
1378 % `example' (@kbd uses ttsl only inside of @example and friends),
1379 % or `code' (@kbd uses normal tty font always).
1380 \def\kbdinputstyle{\parsearg\kbdinputstylexxx}
1381 \def\kbdinputstylexxx#1{%
1382 \def\arg{#1}%
1383 \ifx\arg\worddistinct
1384 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
1385 \else\ifx\arg\wordexample
1386 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
1387 \else\ifx\arg\wordcode
1388 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
1389 \fi\fi\fi
1391 \def\worddistinct{distinct}
1392 \def\wordexample{example}
1393 \def\wordcode{code}
1395 % Default is kbdinputdistinct. (Too much of a hassle to call the macro,
1396 % the catcodes are wrong for parsearg to work.)
1397 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
1399 % If you use @setkbdinputexample, then @kbd produces slanted tty font
1400 % only inside of @example and friends.
1401 \def\setkbdinputexample{\gdef\kbdexamplefont\ttsl}
1403 \def\xkey{\key}
1404 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1405 \ifx\one\xkey\ifx\threex\three \key{#2}%
1406 \else{\tclose{\kbdfont\look}}\fi
1407 \else{\tclose{\kbdfont\look}}\fi}
1409 % @url, @email. Quotes do not seem necessary.
1410 \let\url=\code % perhaps include a hypertex \special eventually
1411 % rms does not like the angle brackets --karl, 17may97.
1412 %\def\email#1{$\langle${\tt #1}$\rangle$}
1413 \let\email=\code
1415 % @uref (abbreviation for `urlref') takes an optional second argument
1416 % specifying the text to display. First (mandatory) arg is the url.
1418 \def\uref#1{\urefxxx #1,,\finish}
1419 \def\urefxxx#1,#2,#3\finish{%
1420 \setbox0 = \hbox{\ignorespaces #2}%
1421 \ifdim\wd0 > 0pt
1422 \unhbox0\ (\code{#1})%
1423 \else
1424 \code{#1}%
1428 % Check if we are currently using a typewriter font. Since all the
1429 % Computer Modern typewriter fonts have zero interword stretch (and
1430 % shrink), and it is reasonable to expect all typewriter fonts to have
1431 % this property, we can check that font parameter.
1433 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1435 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1436 % argument is to make the input look right: @dmn{pt} instead of
1437 % @dmn{}pt.
1439 \def\dmn#1{\thinspace #1}
1441 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1443 % @l was never documented to mean ``switch to the Lisp font'',
1444 % and it is not used as such in any manual I can find. We need it for
1445 % Polish suppressed-l. --karl, 22sep96.
1446 %\def\l#1{{\li #1}\null}
1448 \def\r#1{{\rm #1}} % roman font
1449 % Use of \lowercase was suggested.
1450 \def\sc#1{{\smallcaps#1}} % smallcaps font
1451 \def\ii#1{{\it #1}} % italic font
1453 % @pounds{} is a sterling sign.
1454 \def\pounds{{\it\$}}
1457 \message{page headings,}
1459 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1460 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1462 % First the title page. Must do @settitle before @titlepage.
1463 \newif\ifseenauthor
1464 \newif\iffinishedtitlepage
1466 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1467 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1468 \endgroup\page\hbox{}\page}
1470 \def\titlepage{\begingroup \parindent=0pt \textfonts
1471 \let\subtitlerm=\tenrm
1472 % I deinstalled the following change because \cmr12 is undefined.
1473 % This change was not in the ChangeLog anyway. --rms.
1474 % \let\subtitlerm=\cmr12
1475 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1477 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1479 % Leave some space at the very top of the page.
1480 \vglue\titlepagetopglue
1482 % Now you can print the title using @title.
1483 \def\title{\parsearg\titlezzz}%
1484 \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
1485 % print a rule at the page bottom also.
1486 \finishedtitlepagefalse
1487 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1488 % No rule at page bottom unless we print one at the top with @title.
1489 \finishedtitlepagetrue
1491 % Now you can put text using @subtitle.
1492 \def\subtitle{\parsearg\subtitlezzz}%
1493 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1495 % @author should come last, but may come many times.
1496 \def\author{\parsearg\authorzzz}%
1497 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1498 {\authorfont \leftline{##1}}}%
1500 % Most title ``pages'' are actually two pages long, with space
1501 % at the top of the second. We don't want the ragged left on the second.
1502 \let\oldpage = \page
1503 \def\page{%
1504 \iffinishedtitlepage\else
1505 \finishtitlepage
1507 \oldpage
1508 \let\page = \oldpage
1509 \hbox{}}%
1510 % \def\page{\oldpage \hbox{}}
1513 \def\Etitlepage{%
1514 \iffinishedtitlepage\else
1515 \finishtitlepage
1517 % It is important to do the page break before ending the group,
1518 % because the headline and footline are only empty inside the group.
1519 % If we use the new definition of \page, we always get a blank page
1520 % after the title page, which we certainly don't want.
1521 \oldpage
1522 \endgroup
1523 \HEADINGSon
1526 \def\finishtitlepage{%
1527 \vskip4pt \hrule height 2pt width \hsize
1528 \vskip\titlepagebottomglue
1529 \finishedtitlepagetrue
1532 %%% Set up page headings and footings.
1534 \let\thispage=\folio
1536 \newtoks \evenheadline % Token sequence for heading line of even pages
1537 \newtoks \oddheadline % Token sequence for heading line of odd pages
1538 \newtoks \evenfootline % Token sequence for footing line of even pages
1539 \newtoks \oddfootline % Token sequence for footing line of odd pages
1541 % Now make Tex use those variables
1542 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1543 \else \the\evenheadline \fi}}
1544 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1545 \else \the\evenfootline \fi}\HEADINGShook}
1546 \let\HEADINGShook=\relax
1548 % Commands to set those variables.
1549 % For example, this is what @headings on does
1550 % @evenheading @thistitle|@thispage|@thischapter
1551 % @oddheading @thischapter|@thispage|@thistitle
1552 % @evenfooting @thisfile||
1553 % @oddfooting ||@thisfile
1555 \def\evenheading{\parsearg\evenheadingxxx}
1556 \def\oddheading{\parsearg\oddheadingxxx}
1557 \def\everyheading{\parsearg\everyheadingxxx}
1559 \def\evenfooting{\parsearg\evenfootingxxx}
1560 \def\oddfooting{\parsearg\oddfootingxxx}
1561 \def\everyfooting{\parsearg\everyfootingxxx}
1563 {\catcode`\@=0 %
1565 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1566 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1567 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1569 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1570 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1571 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1573 \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
1575 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1576 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1577 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1579 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1580 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1581 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
1583 % Leave some space for the footline. Hopefully ok to assume
1584 % @evenfooting will not be used by itself.
1585 \global\advance\pageheight by -\baselineskip
1586 \global\advance\vsize by -\baselineskip
1589 \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
1591 }% unbind the catcode of @.
1593 % @headings double turns headings on for double-sided printing.
1594 % @headings single turns headings on for single-sided printing.
1595 % @headings off turns them off.
1596 % @headings on same as @headings double, retained for compatibility.
1597 % @headings after turns on double-sided headings after this page.
1598 % @headings doubleafter turns on double-sided headings after this page.
1599 % @headings singleafter turns on single-sided headings after this page.
1600 % By default, they are off at the start of a document,
1601 % and turned `on' after @end titlepage.
1603 \def\headings #1 {\csname HEADINGS#1\endcsname}
1605 \def\HEADINGSoff{
1606 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1607 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1608 \HEADINGSoff
1609 % When we turn headings on, set the page number to 1.
1610 % For double-sided printing, put current file name in lower left corner,
1611 % chapter name on inside top of right hand pages, document
1612 % title on inside top of left hand pages, and page numbers on outside top
1613 % edge of all pages.
1614 \def\HEADINGSdouble{
1615 \global\pageno=1
1616 \global\evenfootline={\hfil}
1617 \global\oddfootline={\hfil}
1618 \global\evenheadline={\line{\folio\hfil\thistitle}}
1619 \global\oddheadline={\line{\thischapter\hfil\folio}}
1620 \global\let\contentsalignmacro = \chapoddpage
1622 \let\contentsalignmacro = \chappager
1624 % For single-sided printing, chapter title goes across top left of page,
1625 % page number on top right.
1626 \def\HEADINGSsingle{
1627 \global\pageno=1
1628 \global\evenfootline={\hfil}
1629 \global\oddfootline={\hfil}
1630 \global\evenheadline={\line{\thischapter\hfil\folio}}
1631 \global\oddheadline={\line{\thischapter\hfil\folio}}
1632 \global\let\contentsalignmacro = \chappager
1634 \def\HEADINGSon{\HEADINGSdouble}
1636 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1637 \let\HEADINGSdoubleafter=\HEADINGSafter
1638 \def\HEADINGSdoublex{%
1639 \global\evenfootline={\hfil}
1640 \global\oddfootline={\hfil}
1641 \global\evenheadline={\line{\folio\hfil\thistitle}}
1642 \global\oddheadline={\line{\thischapter\hfil\folio}}
1643 \global\let\contentsalignmacro = \chapoddpage
1646 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1647 \def\HEADINGSsinglex{%
1648 \global\evenfootline={\hfil}
1649 \global\oddfootline={\hfil}
1650 \global\evenheadline={\line{\thischapter\hfil\folio}}
1651 \global\oddheadline={\line{\thischapter\hfil\folio}}
1652 \global\let\contentsalignmacro = \chappager
1655 % Subroutines used in generating headings
1656 % Produces Day Month Year style of output.
1657 \def\today{\number\day\space
1658 \ifcase\month\or
1659 January\or February\or March\or April\or May\or June\or
1660 July\or August\or September\or October\or November\or December\fi
1661 \space\number\year}
1663 % Use this if you want the Month Day, Year style of output.
1664 %\def\today{\ifcase\month\or
1665 %January\or February\or March\or April\or May\or June\or
1666 %July\or August\or September\or October\or November\or December\fi
1667 %\space\number\day, \number\year}
1669 % @settitle line... specifies the title of the document, for headings
1670 % It generates no output of its own
1672 \def\thistitle{No Title}
1673 \def\settitle{\parsearg\settitlezzz}
1674 \def\settitlezzz #1{\gdef\thistitle{#1}}
1677 \message{tables,}
1679 % @tabs -- simple alignment
1681 % These don't work. For one thing, \+ is defined as outer.
1682 % So these macros cannot even be defined.
1684 %\def\tabs{\parsearg\tabszzz}
1685 %\def\tabszzz #1{\settabs\+#1\cr}
1686 %\def\tabline{\parsearg\tablinezzz}
1687 %\def\tablinezzz #1{\+#1\cr}
1688 %\def\&{&}
1690 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1692 % default indentation of table text
1693 \newdimen\tableindent \tableindent=.8in
1694 % default indentation of @itemize and @enumerate text
1695 \newdimen\itemindent \itemindent=.3in
1696 % margin between end of table item and start of table text.
1697 \newdimen\itemmargin \itemmargin=.1in
1699 % used internally for \itemindent minus \itemmargin
1700 \newdimen\itemmax
1702 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1703 % these defs.
1704 % They also define \itemindex
1705 % to index the item name in whatever manner is desired (perhaps none).
1707 \newif\ifitemxneedsnegativevskip
1709 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
1711 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1712 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1714 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1715 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1717 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1718 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1720 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1721 \itemzzz {#1}}
1723 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1724 \itemzzz {#1}}
1726 \def\itemzzz #1{\begingroup %
1727 \advance\hsize by -\rightskip
1728 \advance\hsize by -\tableindent
1729 \setbox0=\hbox{\itemfont{#1}}%
1730 \itemindex{#1}%
1731 \nobreak % This prevents a break before @itemx.
1733 % Be sure we are not still in the middle of a paragraph.
1734 %{\parskip = 0in
1735 %\par
1738 % If the item text does not fit in the space we have, put it on a line
1739 % by itself, and do not allow a page break either before or after that
1740 % line. We do not start a paragraph here because then if the next
1741 % command is, e.g., @kindex, the whatsit would get put into the
1742 % horizontal list on a line by itself, resulting in extra blank space.
1743 \ifdim \wd0>\itemmax
1745 % Make this a paragraph so we get the \parskip glue and wrapping,
1746 % but leave it ragged-right.
1747 \begingroup
1748 \advance\leftskip by-\tableindent
1749 \advance\hsize by\tableindent
1750 \advance\rightskip by0pt plus1fil
1751 \leavevmode\unhbox0\par
1752 \endgroup
1754 % We're going to be starting a paragraph, but we don't want the
1755 % \parskip glue -- logically it's part of the @item we just started.
1756 \nobreak \vskip-\parskip
1758 % Stop a page break at the \parskip glue coming up. Unfortunately
1759 % we can't prevent a possible page break at the following
1760 % \baselineskip glue.
1761 \nobreak
1762 \endgroup
1763 \itemxneedsnegativevskipfalse
1764 \else
1765 % The item text fits into the space. Start a paragraph, so that the
1766 % following text (if any) will end up on the same line. Since that
1767 % text will be indented by \tableindent, we make the item text be in
1768 % a zero-width box.
1769 \noindent
1770 \rlap{\hskip -\tableindent\box0}\ignorespaces%
1771 \endgroup%
1772 \itemxneedsnegativevskiptrue%
1776 \def\item{\errmessage{@item while not in a table}}
1777 \def\itemx{\errmessage{@itemx while not in a table}}
1778 \def\kitem{\errmessage{@kitem while not in a table}}
1779 \def\kitemx{\errmessage{@kitemx while not in a table}}
1780 \def\xitem{\errmessage{@xitem while not in a table}}
1781 \def\xitemx{\errmessage{@xitemx while not in a table}}
1783 %% Contains a kludge to get @end[description] to work
1784 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1786 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1787 {\obeylines\obeyspaces%
1788 \gdef\tablex #1^^M{%
1789 \tabley\dontindex#1 \endtabley}}
1791 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1792 {\obeylines\obeyspaces%
1793 \gdef\ftablex #1^^M{%
1794 \tabley\fnitemindex#1 \endtabley
1795 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1796 \let\Etable=\relax}}
1798 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1799 {\obeylines\obeyspaces%
1800 \gdef\vtablex #1^^M{%
1801 \tabley\vritemindex#1 \endtabley
1802 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1803 \let\Etable=\relax}}
1805 \def\dontindex #1{}
1806 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1807 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1809 {\obeyspaces %
1810 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1811 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1813 \def\tablez #1#2#3#4#5#6{%
1814 \aboveenvbreak %
1815 \begingroup %
1816 \def\Edescription{\Etable}% Necessary kludge.
1817 \let\itemindex=#1%
1818 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1819 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1820 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1821 \def\itemfont{#2}%
1822 \itemmax=\tableindent %
1823 \advance \itemmax by -\itemmargin %
1824 \advance \leftskip by \tableindent %
1825 \exdentamount=\tableindent
1826 \parindent = 0pt
1827 \parskip = \smallskipamount
1828 \ifdim \parskip=0pt \parskip=2pt \fi%
1829 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1830 \let\item = \internalBitem %
1831 \let\itemx = \internalBitemx %
1832 \let\kitem = \internalBkitem %
1833 \let\kitemx = \internalBkitemx %
1834 \let\xitem = \internalBxitem %
1835 \let\xitemx = \internalBxitemx %
1838 % This is the counter used by @enumerate, which is really @itemize
1840 \newcount \itemno
1842 \def\itemize{\parsearg\itemizezzz}
1844 \def\itemizezzz #1{%
1845 \begingroup % ended by the @end itemsize
1846 \itemizey {#1}{\Eitemize}
1849 \def\itemizey #1#2{%
1850 \aboveenvbreak %
1851 \itemmax=\itemindent %
1852 \advance \itemmax by -\itemmargin %
1853 \advance \leftskip by \itemindent %
1854 \exdentamount=\itemindent
1855 \parindent = 0pt %
1856 \parskip = \smallskipamount %
1857 \ifdim \parskip=0pt \parskip=2pt \fi%
1858 \def#2{\endgraf\afterenvbreak\endgroup}%
1859 \def\itemcontents{#1}%
1860 \let\item=\itemizeitem}
1862 % Set sfcode to normal for the chars that usually have another value.
1863 % These are `.?!:;,'
1864 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1865 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1867 % \splitoff TOKENS\endmark defines \first to be the first token in
1868 % TOKENS, and \rest to be the remainder.
1870 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1872 % Allow an optional argument of an uppercase letter, lowercase letter,
1873 % or number, to specify the first label in the enumerated list. No
1874 % argument is the same as `1'.
1876 \def\enumerate{\parsearg\enumeratezzz}
1877 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1878 \def\enumeratey #1 #2\endenumeratey{%
1879 \begingroup % ended by the @end enumerate
1881 % If we were given no argument, pretend we were given `1'.
1882 \def\thearg{#1}%
1883 \ifx\thearg\empty \def\thearg{1}\fi
1885 % Detect if the argument is a single token. If so, it might be a
1886 % letter. Otherwise, the only valid thing it can be is a number.
1887 % (We will always have one token, because of the test we just made.
1888 % This is a good thing, since \splitoff doesn't work given nothing at
1889 % all -- the first parameter is undelimited.)
1890 \expandafter\splitoff\thearg\endmark
1891 \ifx\rest\empty
1892 % Only one token in the argument. It could still be anything.
1893 % A ``lowercase letter'' is one whose \lccode is nonzero.
1894 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1895 % not equal to itself.
1896 % Otherwise, we assume it's a number.
1898 % We need the \relax at the end of the \ifnum lines to stop TeX from
1899 % continuing to look for a <number>.
1901 \ifnum\lccode\expandafter`\thearg=0\relax
1902 \numericenumerate % a number (we hope)
1903 \else
1904 % It's a letter.
1905 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1906 \lowercaseenumerate % lowercase letter
1907 \else
1908 \uppercaseenumerate % uppercase letter
1911 \else
1912 % Multiple tokens in the argument. We hope it's a number.
1913 \numericenumerate
1917 % An @enumerate whose labels are integers. The starting integer is
1918 % given in \thearg.
1920 \def\numericenumerate{%
1921 \itemno = \thearg
1922 \startenumeration{\the\itemno}%
1925 % The starting (lowercase) letter is in \thearg.
1926 \def\lowercaseenumerate{%
1927 \itemno = \expandafter`\thearg
1928 \startenumeration{%
1929 % Be sure we're not beyond the end of the alphabet.
1930 \ifnum\itemno=0
1931 \errmessage{No more lowercase letters in @enumerate; get a bigger
1932 alphabet}%
1934 \char\lccode\itemno
1938 % The starting (uppercase) letter is in \thearg.
1939 \def\uppercaseenumerate{%
1940 \itemno = \expandafter`\thearg
1941 \startenumeration{%
1942 % Be sure we're not beyond the end of the alphabet.
1943 \ifnum\itemno=0
1944 \errmessage{No more uppercase letters in @enumerate; get a bigger
1945 alphabet}
1947 \char\uccode\itemno
1951 % Call itemizey, adding a period to the first argument and supplying the
1952 % common last two arguments. Also subtract one from the initial value in
1953 % \itemno, since @item increments \itemno.
1955 \def\startenumeration#1{%
1956 \advance\itemno by -1
1957 \itemizey{#1.}\Eenumerate\flushcr
1960 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
1961 % to @enumerate.
1963 \def\alphaenumerate{\enumerate{a}}
1964 \def\capsenumerate{\enumerate{A}}
1965 \def\Ealphaenumerate{\Eenumerate}
1966 \def\Ecapsenumerate{\Eenumerate}
1968 % Definition of @item while inside @itemize.
1970 \def\itemizeitem{%
1971 \advance\itemno by 1
1972 {\let\par=\endgraf \smallbreak}%
1973 \ifhmode \errmessage{In hmode at itemizeitem}\fi
1974 {\parskip=0in \hskip 0pt
1975 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
1976 \vadjust{\penalty 1200}}%
1977 \flushcr}
1979 % @multitable macros
1980 % Amy Hendrickson, 8/18/94, 3/6/96
1982 % @multitable ... @end multitable will make as many columns as desired.
1983 % Contents of each column will wrap at width given in preamble. Width
1984 % can be specified either with sample text given in a template line,
1985 % or in percent of \hsize, the current width of text on page.
1987 % Table can continue over pages but will only break between lines.
1989 % To make preamble:
1991 % Either define widths of columns in terms of percent of \hsize:
1992 % @multitable @columnfractions .25 .3 .45
1993 % @item ...
1995 % Numbers following @columnfractions are the percent of the total
1996 % current hsize to be used for each column. You may use as many
1997 % columns as desired.
2000 % Or use a template:
2001 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2002 % @item ...
2003 % using the widest term desired in each column.
2005 % For those who want to use more than one line's worth of words in
2006 % the preamble, break the line within one argument and it
2007 % will parse correctly, i.e.,
2009 % @multitable {Column 1 template} {Column 2 template} {Column 3
2010 % template}
2011 % Not:
2012 % @multitable {Column 1 template} {Column 2 template}
2013 % {Column 3 template}
2015 % Each new table line starts with @item, each subsequent new column
2016 % starts with @tab. Empty columns may be produced by supplying @tab's
2017 % with nothing between them for as many times as empty columns are needed,
2018 % ie, @tab@tab@tab will produce two empty columns.
2020 % @item, @tab, @multitable or @end multitable do not need to be on their
2021 % own lines, but it will not hurt if they are.
2023 % Sample multitable:
2025 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
2026 % @item first col stuff @tab second col stuff @tab third col
2027 % @item
2028 % first col stuff
2029 % @tab
2030 % second col stuff
2031 % @tab
2032 % third col
2033 % @item first col stuff @tab second col stuff
2034 % @tab Many paragraphs of text may be used in any column.
2036 % They will wrap at the width determined by the template.
2037 % @item@tab@tab This will be in third column.
2038 % @end multitable
2040 % Default dimensions may be reset by user.
2041 % @multitableparskip is vertical space between paragraphs in table.
2042 % @multitableparindent is paragraph indent in table.
2043 % @multitablecolmargin is horizontal space to be left between columns.
2044 % @multitablelinespace is space to leave between table items, baseline
2045 % to baseline.
2046 % 0pt means it depends on current normal line spacing.
2048 %%%%
2049 % Dimensions
2051 \newskip\multitableparskip
2052 \newskip\multitableparindent
2053 \newdimen\multitablecolspace
2054 \newskip\multitablelinespace
2055 \multitableparskip=0pt
2056 \multitableparindent=6pt
2057 \multitablecolspace=12pt
2058 \multitablelinespace=0pt
2060 %%%%
2061 % Macros used to set up halign preamble:
2062 \let\endsetuptable\relax
2063 \def\xendsetuptable{\endsetuptable}
2064 \let\columnfractions\relax
2065 \def\xcolumnfractions{\columnfractions}
2066 \newif\ifsetpercent
2068 %% 2/1/96, to allow fractions to be given with more than one digit.
2069 \def\pickupwholefraction#1 {\global\advance\colcount by1 %
2070 \expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
2071 \setuptable}
2073 \newcount\colcount
2074 \def\setuptable#1{\def\firstarg{#1}%
2075 \ifx\firstarg\xendsetuptable\let\go\relax%
2076 \else
2077 \ifx\firstarg\xcolumnfractions\global\setpercenttrue%
2078 \else
2079 \ifsetpercent
2080 \let\go\pickupwholefraction % In this case arg of setuptable
2081 % is the decimal point before the
2082 % number given in percent of hsize.
2083 % We don't need this so we don't use it.
2084 \else
2085 \global\advance\colcount by1
2086 \setbox0=\hbox{#1 }% Add a normal word space as a separator;
2087 % typically that is always in the input, anyway.
2088 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2089 \fi%
2090 \fi%
2091 \ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
2092 \fi\go}
2094 %%%%
2095 % multitable syntax
2096 \def\tab{&\hskip1sp\relax} % 2/2/96
2097 % tiny skip here makes sure this column space is
2098 % maintained, even if it is never used.
2101 %%%%
2102 % @multitable ... @end multitable definitions:
2104 \def\multitable{\parsearg\dotable}
2106 \def\dotable#1{\bgroup
2107 \let\item\cr
2108 \tolerance=9500
2109 \hbadness=9500
2110 \setmultitablespacing
2111 \parskip=\multitableparskip
2112 \parindent=\multitableparindent
2113 \overfullrule=0pt
2114 \global\colcount=0\relax%
2115 \def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}%
2116 % To parse everything between @multitable and @item :
2117 \setuptable#1 \endsetuptable
2118 % Need to reset this to 0 after \setuptable.
2119 \global\colcount=0\relax%
2121 % This preamble sets up a generic column definition, which will
2122 % be used as many times as user calls for columns.
2123 % \vtop will set a single line and will also let text wrap and
2124 % continue for many paragraphs if desired.
2125 \halign\bgroup&\global\advance\colcount by 1\relax%
2126 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2127 % In order to keep entries from bumping into each other
2128 % we will add a \leftskip of \multitablecolspace to all columns after
2129 % the first one.
2130 % If a template has been used, we will add \multitablecolspace
2131 % to the width of each template entry.
2132 % If user has set preamble in terms of percent of \hsize
2133 % we will use that dimension as the width of the column, and
2134 % the \leftskip will keep entries from bumping into each other.
2135 % Table will start at left margin and final column will justify at
2136 % right margin.
2137 \ifnum\colcount=1
2138 \else
2139 \ifsetpercent
2140 \else
2141 % If user has <not> set preamble in terms of percent of \hsize
2142 % we will advance \hsize by \multitablecolspace
2143 \advance\hsize by \multitablecolspace
2145 % In either case we will make \leftskip=\multitablecolspace:
2146 \leftskip=\multitablecolspace
2148 % Ignoring space at the beginning and end avoids an occasional spurious
2149 % blank line, when TeX decides to break the line at the space before the
2150 % box from the multistrut, so the strut ends up on a line by itself.
2151 % For example:
2152 % @multitable @columnfractions .11 .89
2153 % @item @code{#}
2154 % @tab Legal holiday which is valid in major parts of the whole country.
2155 % Is automatically provided with highlighting sequences respectively marking
2156 % characters.
2157 \noindent\ignorespaces##\unskip\multistrut}\cr
2158 % \everycr will reset column counter, \colcount, at the end of
2159 % each line. Every column entry will cause \colcount to advance by one.
2160 % The table preamble
2161 % looks at the current \colcount to find the correct column width.
2162 \global\everycr{\noalign{%
2163 % \filbreak%% keeps underfull box messages off when table breaks over pages.
2164 % Maybe so, but it also creates really weird page breaks when the table
2165 % breaks over pages Wouldn't \vfil be better? Wait until the problem
2166 % manifests itself, so it can be fixed for real --karl.
2167 \global\colcount=0\relax}}
2170 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2171 % If so, do nothing. If not, give it an appropriate dimension based on
2172 % current baselineskip.
2173 \ifdim\multitablelinespace=0pt
2174 %% strut to put in table in case some entry doesn't have descenders,
2175 %% to keep lines equally spaced
2176 \let\multistrut = \strut
2177 %% Test to see if parskip is larger than space between lines of
2178 %% table. If not, do nothing.
2179 %% If so, set to same dimension as multitablelinespace.
2180 \else
2181 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2182 width0pt\relax} \fi
2183 \ifdim\multitableparskip>\multitablelinespace
2184 \global\multitableparskip=\multitablelinespace
2185 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2186 %% than skip between lines in the table.
2187 \fi%
2188 \ifdim\multitableparskip=0pt
2189 \global\multitableparskip=\multitablelinespace
2190 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2191 %% than skip between lines in the table.
2192 \fi}
2195 \message{indexing,}
2196 % Index generation facilities
2198 % Define \newwrite to be identical to plain tex's \newwrite
2199 % except not \outer, so it can be used within \newindex.
2200 {\catcode`\@=11
2201 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
2203 % \newindex {foo} defines an index named foo.
2204 % It automatically defines \fooindex such that
2205 % \fooindex ...rest of line... puts an entry in the index foo.
2206 % It also defines \fooindfile to be the number of the output channel for
2207 % the file that accumulates this index. The file's extension is foo.
2208 % The name of an index should be no more than 2 characters long
2209 % for the sake of vms.
2211 \def\newindex #1{
2212 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
2213 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2214 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2215 \noexpand\doindex {#1}}
2218 % @defindex foo == \newindex{foo}
2220 \def\defindex{\parsearg\newindex}
2222 % Define @defcodeindex, like @defindex except put all entries in @code.
2224 \def\newcodeindex #1{
2225 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
2226 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2227 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2228 \noexpand\docodeindex {#1}}
2231 \def\defcodeindex{\parsearg\newcodeindex}
2233 % @synindex foo bar makes index foo feed into index bar.
2234 % Do this instead of @defindex foo if you don't want it as a separate index.
2235 \def\synindex #1 #2 {%
2236 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2237 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2238 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2239 \noexpand\doindex {#2}}%
2242 % @syncodeindex foo bar similar, but put all entries made for index foo
2243 % inside @code.
2244 \def\syncodeindex #1 #2 {%
2245 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2246 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2247 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2248 \noexpand\docodeindex {#2}}%
2251 % Define \doindex, the driver for all \fooindex macros.
2252 % Argument #1 is generated by the calling \fooindex macro,
2253 % and it is "foo", the name of the index.
2255 % \doindex just uses \parsearg; it calls \doind for the actual work.
2256 % This is because \doind is more useful to call from other macros.
2258 % There is also \dosubind {index}{topic}{subtopic}
2259 % which makes an entry in a two-level index such as the operation index.
2261 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
2262 \def\singleindexer #1{\doind{\indexname}{#1}}
2264 % like the previous two, but they put @code around the argument.
2265 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2266 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2268 \def\indexdummies{%
2269 % Take care of the plain tex accent commands.
2270 \def\"{\realbackslash "}%
2271 \def\`{\realbackslash `}%
2272 \def\'{\realbackslash '}%
2273 \def\^{\realbackslash ^}%
2274 \def\~{\realbackslash ~}%
2275 \def\={\realbackslash =}%
2276 \def\b{\realbackslash b}%
2277 \def\c{\realbackslash c}%
2278 \def\d{\realbackslash d}%
2279 \def\u{\realbackslash u}%
2280 \def\v{\realbackslash v}%
2281 \def\H{\realbackslash H}%
2282 % Take care of the plain tex special European modified letters.
2283 \def\oe{\realbackslash oe}%
2284 \def\ae{\realbackslash ae}%
2285 \def\aa{\realbackslash aa}%
2286 \def\OE{\realbackslash OE}%
2287 \def\AE{\realbackslash AE}%
2288 \def\AA{\realbackslash AA}%
2289 \def\o{\realbackslash o}%
2290 \def\O{\realbackslash O}%
2291 \def\l{\realbackslash l}%
2292 \def\L{\realbackslash L}%
2293 \def\ss{\realbackslash ss}%
2294 % Take care of texinfo commands likely to appear in an index entry.
2295 % (Must be a way to avoid doing expansion at all, and thus not have to
2296 % laboriously list every single command here.)
2297 \def\@{@}% will be @@ when we switch to @ as escape char.
2298 %\let\{ = \lbracecmd
2299 %\let\} = \rbracecmd
2300 \def\_{{\realbackslash _}}%
2301 \def\w{\realbackslash w }%
2302 \def\bf{\realbackslash bf }%
2303 %\def\rm{\realbackslash rm }%
2304 \def\sl{\realbackslash sl }%
2305 \def\sf{\realbackslash sf}%
2306 \def\tt{\realbackslash tt}%
2307 \def\gtr{\realbackslash gtr}%
2308 \def\less{\realbackslash less}%
2309 \def\hat{\realbackslash hat}%
2310 %\def\char{\realbackslash char}%
2311 \def\TeX{\realbackslash TeX}%
2312 \def\dots{\realbackslash dots }%
2313 \def\result{\realbackslash result}%
2314 \def\equiv{\realbackslash equiv}%
2315 \def\expansion{\realbackslash expansion}%
2316 \def\print{\realbackslash print}%
2317 \def\error{\realbackslash error}%
2318 \def\point{\realbackslash point}%
2319 \def\copyright{\realbackslash copyright}%
2320 \def\tclose##1{\realbackslash tclose {##1}}%
2321 \def\code##1{\realbackslash code {##1}}%
2322 \def\dotless##1{\realbackslash dotless {##1}}%
2323 \def\samp##1{\realbackslash samp {##1}}%
2324 \def\,##1{\realbackslash ,{##1}}%
2325 \def\t##1{\realbackslash t {##1}}%
2326 \def\r##1{\realbackslash r {##1}}%
2327 \def\i##1{\realbackslash i {##1}}%
2328 \def\b##1{\realbackslash b {##1}}%
2329 \def\sc##1{\realbackslash sc {##1}}%
2330 \def\cite##1{\realbackslash cite {##1}}%
2331 \def\key##1{\realbackslash key {##1}}%
2332 \def\file##1{\realbackslash file {##1}}%
2333 \def\var##1{\realbackslash var {##1}}%
2334 \def\kbd##1{\realbackslash kbd {##1}}%
2335 \def\dfn##1{\realbackslash dfn {##1}}%
2336 \def\emph##1{\realbackslash emph {##1}}%
2337 \def\value##1{\realbackslash value {##1}}%
2338 \unsepspaces
2341 % If an index command is used in an @example environment, any spaces
2342 % therein should become regular spaces in the raw index file, not the
2343 % expansion of \tie (\\leavevmode \penalty \@M \ ).
2344 {\obeyspaces
2345 \gdef\unsepspaces{\obeyspaces\let =\space}}
2347 % \indexnofonts no-ops all font-change commands.
2348 % This is used when outputting the strings to sort the index by.
2349 \def\indexdummyfont#1{#1}
2350 \def\indexdummytex{TeX}
2351 \def\indexdummydots{...}
2353 \def\indexnofonts{%
2354 % Just ignore accents.
2355 \let\,=\indexdummyfont
2356 \let\"=\indexdummyfont
2357 \let\`=\indexdummyfont
2358 \let\'=\indexdummyfont
2359 \let\^=\indexdummyfont
2360 \let\~=\indexdummyfont
2361 \let\==\indexdummyfont
2362 \let\b=\indexdummyfont
2363 \let\c=\indexdummyfont
2364 \let\d=\indexdummyfont
2365 \let\u=\indexdummyfont
2366 \let\v=\indexdummyfont
2367 \let\H=\indexdummyfont
2368 \let\dotless=\indexdummyfont
2369 % Take care of the plain tex special European modified letters.
2370 \def\oe{oe}%
2371 \def\ae{ae}%
2372 \def\aa{aa}%
2373 \def\OE{OE}%
2374 \def\AE{AE}%
2375 \def\AA{AA}%
2376 \def\o{o}%
2377 \def\O{O}%
2378 \def\l{l}%
2379 \def\L{L}%
2380 \def\ss{ss}%
2381 \let\w=\indexdummyfont
2382 \let\t=\indexdummyfont
2383 \let\r=\indexdummyfont
2384 \let\i=\indexdummyfont
2385 \let\b=\indexdummyfont
2386 \let\emph=\indexdummyfont
2387 \let\strong=\indexdummyfont
2388 \let\cite=\indexdummyfont
2389 \let\sc=\indexdummyfont
2390 %Don't no-op \tt, since it isn't a user-level command
2391 % and is used in the definitions of the active chars like <, >, |...
2392 %\let\tt=\indexdummyfont
2393 \let\tclose=\indexdummyfont
2394 \let\code=\indexdummyfont
2395 \let\file=\indexdummyfont
2396 \let\samp=\indexdummyfont
2397 \let\kbd=\indexdummyfont
2398 \let\key=\indexdummyfont
2399 \let\var=\indexdummyfont
2400 \let\TeX=\indexdummytex
2401 \let\dots=\indexdummydots
2402 \def\@{@}%
2405 % To define \realbackslash, we must make \ not be an escape.
2406 % We must first make another character (@) an escape
2407 % so we do not become unable to do a definition.
2409 {\catcode`\@=0 \catcode`\\=\other
2410 @gdef@realbackslash{\}}
2412 \let\indexbackslash=0 %overridden during \printindex.
2414 \let\SETmarginindex=\relax %initialize!
2415 % workhorse for all \fooindexes
2416 % #1 is name of index, #2 is stuff to put there
2417 \def\doind #1#2{%
2418 % Put the index entry in the margin if desired.
2419 \ifx\SETmarginindex\relax\else
2420 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2423 \count255=\lastpenalty
2425 \indexdummies % Must do this here, since \bf, etc expand at this stage
2426 \escapechar=`\\
2428 \let\folio=0% We will expand all macros now EXCEPT \folio.
2429 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2430 % so it will be output as is; and it will print as backslash.
2432 % First process the index-string with all font commands turned off
2433 % to get the string to sort by.
2434 {\indexnofonts \xdef\indexsorttmp{#2}}%
2436 % Now produce the complete index entry, with both the sort key and the
2437 % original text, including any font commands.
2438 \toks0 = {#2}%
2439 \edef\temp{%
2440 \write\csname#1indfile\endcsname{%
2441 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
2443 \temp
2446 \penalty\count255
2450 \def\dosubind #1#2#3{%
2451 {\count10=\lastpenalty %
2452 {\indexdummies % Must do this here, since \bf, etc expand at this stage
2453 \escapechar=`\\%
2454 {\let\folio=0%
2455 \def\rawbackslashxx{\indexbackslash}%
2457 % Now process the index-string once, with all font commands turned off,
2458 % to get the string to sort the index by.
2459 {\indexnofonts
2460 \xdef\temp1{#2 #3}%
2462 % Now produce the complete index entry. We process the index-string again,
2463 % this time with font commands expanded, to get what to print in the index.
2464 \edef\temp{%
2465 \write \csname#1indfile\endcsname{%
2466 \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
2467 \temp }%
2468 }\penalty\count10}}
2470 % The index entry written in the file actually looks like
2471 % \entry {sortstring}{page}{topic}
2472 % or
2473 % \entry {sortstring}{page}{topic}{subtopic}
2474 % The texindex program reads in these files and writes files
2475 % containing these kinds of lines:
2476 % \initial {c}
2477 % before the first topic whose initial is c
2478 % \entry {topic}{pagelist}
2479 % for a topic that is used without subtopics
2480 % \primary {topic}
2481 % for the beginning of a topic that is used with subtopics
2482 % \secondary {subtopic}{pagelist}
2483 % for each subtopic.
2485 % Define the user-accessible indexing commands
2486 % @findex, @vindex, @kindex, @cindex.
2488 \def\findex {\fnindex}
2489 \def\kindex {\kyindex}
2490 \def\cindex {\cpindex}
2491 \def\vindex {\vrindex}
2492 \def\tindex {\tpindex}
2493 \def\pindex {\pgindex}
2495 \def\cindexsub {\begingroup\obeylines\cindexsub}
2496 {\obeylines %
2497 \gdef\cindexsub "#1" #2^^M{\endgroup %
2498 \dosubind{cp}{#2}{#1}}}
2500 % Define the macros used in formatting output of the sorted index material.
2502 % @printindex causes a particular index (the ??s file) to get printed.
2503 % It does not print any chapter heading (usually an @unnumbered).
2505 \def\printindex{\parsearg\doprintindex}
2506 \def\doprintindex#1{\begingroup
2507 \dobreak \chapheadingskip{10000}%
2509 \indexfonts \rm
2510 \tolerance = 9500
2511 \indexbreaks
2513 % See if the index file exists and is nonempty.
2514 \openin 1 \jobname.#1s
2515 \ifeof 1
2516 % \enddoublecolumns gets confused if there is no text in the index,
2517 % and it loses the chapter title and the aux file entries for the
2518 % index. The easiest way to prevent this problem is to make sure
2519 % there is some text.
2520 (Index is nonexistent)
2521 \else
2523 % If the index file exists but is empty, then \openin leaves \ifeof
2524 % false. We have to make TeX try to read something from the file, so
2525 % it can discover if there is anything in it.
2526 \read 1 to \temp
2527 \ifeof 1
2528 (Index is empty)
2529 \else
2530 % Index files are almost Texinfo source, but we use \ as the escape
2531 % character. It would be better to use @, but that's too big a change
2532 % to make right now.
2533 \def\indexbackslash{\rawbackslashxx}%
2534 \catcode`\\ = 0
2535 \catcode`\@ = 11
2536 \escapechar = `\\
2537 \begindoublecolumns
2538 \input \jobname.#1s
2539 \enddoublecolumns
2542 \closein 1
2543 \endgroup}
2545 % These macros are used by the sorted index file itself.
2546 % Change them to control the appearance of the index.
2548 % Same as \bigskipamount except no shrink.
2549 % \balancecolumns gets confused if there is any shrink.
2550 \newskip\initialskipamount \initialskipamount 12pt plus4pt
2552 \def\initial #1{%
2553 {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2554 \ifdim\lastskip<\initialskipamount
2555 \removelastskip \penalty-200 \vskip \initialskipamount\fi
2556 \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
2558 % This typesets a paragraph consisting of #1, dot leaders, and then #2
2559 % flush to the right margin. It is used for index and table of contents
2560 % entries. The paragraph is indented by \leftskip.
2562 \def\entry #1#2{\begingroup
2564 % Start a new paragraph if necessary, so our assignments below can't
2565 % affect previous text.
2566 \par
2568 % Do not fill out the last line with white space.
2569 \parfillskip = 0in
2571 % No extra space above this paragraph.
2572 \parskip = 0in
2574 % Do not prefer a separate line ending with a hyphen to fewer lines.
2575 \finalhyphendemerits = 0
2577 % \hangindent is only relevant when the entry text and page number
2578 % don't both fit on one line. In that case, bob suggests starting the
2579 % dots pretty far over on the line. Unfortunately, a large
2580 % indentation looks wrong when the entry text itself is broken across
2581 % lines. So we use a small indentation and put up with long leaders.
2583 % \hangafter is reset to 1 (which is the value we want) at the start
2584 % of each paragraph, so we need not do anything with that.
2585 \hangindent=2em
2587 % When the entry text needs to be broken, just fill out the first line
2588 % with blank space.
2589 \rightskip = 0pt plus1fil
2591 % Start a ``paragraph'' for the index entry so the line breaking
2592 % parameters we've set above will have an effect.
2593 \noindent
2595 % Insert the text of the index entry. TeX will do line-breaking on it.
2597 % The following is kludged to not output a line of dots in the index if
2598 % there are no page numbers. The next person who breaks this will be
2599 % cursed by a Unix daemon.
2600 \def\tempa{{\rm }}%
2601 \def\tempb{#2}%
2602 \edef\tempc{\tempa}%
2603 \edef\tempd{\tempb}%
2604 \ifx\tempc\tempd\ \else%
2606 % If we must, put the page number on a line of its own, and fill out
2607 % this line with blank space. (The \hfil is overwhelmed with the
2608 % fill leaders glue in \indexdotfill if the page number does fit.)
2609 \hfil\penalty50
2610 \null\nobreak\indexdotfill % Have leaders before the page number.
2612 % The `\ ' here is removed by the implicit \unskip that TeX does as
2613 % part of (the primitive) \par. Without it, a spurious underfull
2614 % \hbox ensues.
2615 \ #2% The page number ends the paragraph.
2616 \fi%
2617 \par
2618 \endgroup}
2620 % Like \dotfill except takes at least 1 em.
2621 \def\indexdotfill{\cleaders
2622 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
2624 \def\primary #1{\line{#1\hfil}}
2626 \newskip\secondaryindent \secondaryindent=0.5cm
2628 \def\secondary #1#2{
2629 {\parfillskip=0in \parskip=0in
2630 \hangindent =1in \hangafter=1
2631 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
2634 % Define two-column mode, which we use to typeset indexes.
2635 % Adapted from the TeXbook, page 416, which is to say,
2636 % the manmac.tex format used to print the TeXbook itself.
2637 \catcode`\@=11
2639 \newbox\partialpage
2640 \newdimen\doublecolumnhsize
2642 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
2643 % Grab any single-column material above us.
2644 \output = {\global\setbox\partialpage = \vbox{%
2646 % Here is a possibility not foreseen in manmac: if we accumulate a
2647 % whole lot of material, we might end up calling this \output
2648 % routine twice in a row (see the doublecol-lose test, which is
2649 % essentially a couple of indexes with @setchapternewpage off). In
2650 % that case, we must prevent the second \partialpage from
2651 % simply overwriting the first, causing us to lose the page.
2652 % This will preserve it until a real output routine can ship it
2653 % out. Generally, \partialpage will be empty when this runs and
2654 % this will be a no-op.
2655 \unvbox\partialpage
2657 % Unvbox the main output page.
2658 \unvbox255
2659 \kern-\topskip \kern\baselineskip
2661 \eject
2663 % Use the double-column output routine for subsequent pages.
2664 \output = {\doublecolumnout}%
2666 % Change the page size parameters. We could do this once outside this
2667 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
2668 % format, but then we repeat the same computation. Repeating a couple
2669 % of assignments once per index is clearly meaningless for the
2670 % execution time, so we may as well do it in one place.
2672 % First we halve the line length, less a little for the gutter between
2673 % the columns. We compute the gutter based on the line length, so it
2674 % changes automatically with the paper format. The magic constant
2675 % below is chosen so that the gutter has the same value (well, +-<1pt)
2676 % as it did when we hard-coded it.
2678 % We put the result in a separate register, \doublecolumhsize, so we
2679 % can restore it in \pagesofar, after \hsize itself has (potentially)
2680 % been clobbered.
2682 \doublecolumnhsize = \hsize
2683 \advance\doublecolumnhsize by -.04154\hsize
2684 \divide\doublecolumnhsize by 2
2685 \hsize = \doublecolumnhsize
2687 % Double the \vsize as well. (We don't need a separate register here,
2688 % since nobody clobbers \vsize.)
2689 \vsize = 2\vsize
2691 \def\doublecolumnout{%
2692 \splittopskip=\topskip \splitmaxdepth=\maxdepth
2693 % Get the available space for the double columns -- the normal
2694 % (undoubled) page height minus any material left over from the
2695 % previous page.
2696 \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
2697 % box0 will be the left-hand column, box2 the right.
2698 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
2699 \onepageout\pagesofar
2700 \unvbox255
2701 \penalty\outputpenalty
2703 \def\pagesofar{%
2704 % Re-output the contents of the output page -- any previous material,
2705 % followed by the two boxes we just split.
2706 \unvbox\partialpage
2707 \hsize = \doublecolumnhsize
2708 \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}%
2710 \def\enddoublecolumns{%
2711 \output = {\balancecolumns}\eject % split what we have
2712 \endgroup % started in \begindoublecolumns
2714 % Back to normal single-column typesetting, but take account of the
2715 % fact that we just accumulated some stuff on the output page.
2716 \pagegoal = \vsize
2718 \def\balancecolumns{%
2719 % Called at the end of the double column material.
2720 \setbox0 = \vbox{\unvbox255}%
2721 \dimen@ = \ht0
2722 \advance\dimen@ by \topskip
2723 \advance\dimen@ by-\baselineskip
2724 \divide\dimen@ by 2
2725 \splittopskip = \topskip
2726 % Loop until we get a decent breakpoint.
2727 {\vbadness=10000 \loop
2728 \global\setbox3=\copy0
2729 \global\setbox1=\vsplit3 to\dimen@
2730 \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt
2731 \repeat}%
2732 \setbox0=\vbox to\dimen@{\unvbox1}%
2733 \setbox2=\vbox to\dimen@{\unvbox3}%
2734 \pagesofar
2736 \catcode`\@ = \other
2739 \message{sectioning,}
2740 % Define chapters, sections, etc.
2742 \newcount\chapno
2743 \newcount\secno \secno=0
2744 \newcount\subsecno \subsecno=0
2745 \newcount\subsubsecno \subsubsecno=0
2747 % This counter is funny since it counts through charcodes of letters A, B, ...
2748 \newcount\appendixno \appendixno = `\@
2749 \def\appendixletter{\char\the\appendixno}
2751 \newwrite\contentsfile
2752 % This is called from \setfilename.
2753 \def\opencontents{\openout\contentsfile = \jobname.toc }
2755 % Each @chapter defines this as the name of the chapter.
2756 % page headings and footings can use it. @section does likewise
2758 \def\thischapter{} \def\thissection{}
2759 \def\seccheck#1{\ifnum \pageno<0
2760 \errmessage{@#1 not allowed after generating table of contents}%
2761 \fi}
2763 \def\chapternofonts{%
2764 \let\rawbackslash=\relax
2765 \let\frenchspacing=\relax
2766 \def\result{\realbackslash result}%
2767 \def\equiv{\realbackslash equiv}%
2768 \def\expansion{\realbackslash expansion}%
2769 \def\print{\realbackslash print}%
2770 \def\TeX{\realbackslash TeX}%
2771 \def\dots{\realbackslash dots}%
2772 \def\result{\realbackslash result}%
2773 \def\equiv{\realbackslash equiv}%
2774 \def\expansion{\realbackslash expansion}%
2775 \def\print{\realbackslash print}%
2776 \def\error{\realbackslash error}%
2777 \def\point{\realbackslash point}%
2778 \def\copyright{\realbackslash copyright}%
2779 \def\tt{\realbackslash tt}%
2780 \def\bf{\realbackslash bf}%
2781 \def\w{\realbackslash w}%
2782 \def\less{\realbackslash less}%
2783 \def\gtr{\realbackslash gtr}%
2784 \def\hat{\realbackslash hat}%
2785 \def\char{\realbackslash char}%
2786 \def\tclose##1{\realbackslash tclose{##1}}%
2787 \def\code##1{\realbackslash code{##1}}%
2788 \def\samp##1{\realbackslash samp{##1}}%
2789 \def\r##1{\realbackslash r{##1}}%
2790 \def\b##1{\realbackslash b{##1}}%
2791 \def\key##1{\realbackslash key{##1}}%
2792 \def\file##1{\realbackslash file{##1}}%
2793 \def\kbd##1{\realbackslash kbd{##1}}%
2794 % These are redefined because @smartitalic wouldn't work inside xdef.
2795 \def\i##1{\realbackslash i{##1}}%
2796 \def\cite##1{\realbackslash cite{##1}}%
2797 \def\var##1{\realbackslash var{##1}}%
2798 \def\emph##1{\realbackslash emph{##1}}%
2799 \def\dfn##1{\realbackslash dfn{##1}}%
2802 \newcount\absseclevel % used to calculate proper heading level
2803 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
2805 % @raisesections: treat @section as chapter, @subsection as section, etc.
2806 \def\raisesections{\global\advance\secbase by -1}
2807 \let\up=\raisesections % original BFox name
2809 % @lowersections: treat @chapter as section, @section as subsection, etc.
2810 \def\lowersections{\global\advance\secbase by 1}
2811 \let\down=\lowersections % original BFox name
2813 % Choose a numbered-heading macro
2814 % #1 is heading level if unmodified by @raisesections or @lowersections
2815 % #2 is text for heading
2816 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2817 \ifcase\absseclevel
2818 \chapterzzz{#2}
2820 \seczzz{#2}
2822 \numberedsubseczzz{#2}
2824 \numberedsubsubseczzz{#2}
2825 \else
2826 \ifnum \absseclevel<0
2827 \chapterzzz{#2}
2828 \else
2829 \numberedsubsubseczzz{#2}
2834 % like \numhead, but chooses appendix heading levels
2835 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2836 \ifcase\absseclevel
2837 \appendixzzz{#2}
2839 \appendixsectionzzz{#2}
2841 \appendixsubseczzz{#2}
2843 \appendixsubsubseczzz{#2}
2844 \else
2845 \ifnum \absseclevel<0
2846 \appendixzzz{#2}
2847 \else
2848 \appendixsubsubseczzz{#2}
2853 % like \numhead, but chooses numberless heading levels
2854 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2855 \ifcase\absseclevel
2856 \unnumberedzzz{#2}
2858 \unnumberedseczzz{#2}
2860 \unnumberedsubseczzz{#2}
2862 \unnumberedsubsubseczzz{#2}
2863 \else
2864 \ifnum \absseclevel<0
2865 \unnumberedzzz{#2}
2866 \else
2867 \unnumberedsubsubseczzz{#2}
2873 \def\thischaptername{No Chapter Title}
2874 \outer\def\chapter{\parsearg\chapteryyy}
2875 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
2876 \def\chapterzzz #1{\seccheck{chapter}%
2877 \secno=0 \subsecno=0 \subsubsecno=0
2878 \global\advance \chapno by 1 \message{\putwordChapter \the\chapno}%
2879 \chapmacro {#1}{\the\chapno}%
2880 \gdef\thissection{#1}%
2881 \gdef\thischaptername{#1}%
2882 % We don't substitute the actual chapter name into \thischapter
2883 % because we don't want its macros evaluated now.
2884 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
2885 {\chapternofonts%
2886 \toks0 = {#1}%
2887 \edef\temp{{\realbackslash chapentry{\the\toks0}{\the\chapno}{\noexpand\folio}}}%
2888 \escapechar=`\\%
2889 \write \contentsfile \temp %
2890 \donoderef %
2891 \global\let\section = \numberedsec
2892 \global\let\subsection = \numberedsubsec
2893 \global\let\subsubsection = \numberedsubsubsec
2896 \outer\def\appendix{\parsearg\appendixyyy}
2897 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
2898 \def\appendixzzz #1{\seccheck{appendix}%
2899 \secno=0 \subsecno=0 \subsubsecno=0
2900 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
2901 \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
2902 \gdef\thissection{#1}%
2903 \gdef\thischaptername{#1}%
2904 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
2905 {\chapternofonts%
2906 \toks0 = {#1}%
2907 \edef\temp{{\realbackslash chapentry{\the\toks0}%
2908 {\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
2909 \escapechar=`\\%
2910 \write \contentsfile \temp %
2911 \appendixnoderef %
2912 \global\let\section = \appendixsec
2913 \global\let\subsection = \appendixsubsec
2914 \global\let\subsubsection = \appendixsubsubsec
2917 % @centerchap is like @unnumbered, but the heading is centered.
2918 \outer\def\centerchap{\parsearg\centerchapyyy}
2919 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
2921 \outer\def\top{\parsearg\unnumberedyyy}
2922 \outer\def\unnumbered{\parsearg\unnumberedyyy}
2923 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
2924 \def\unnumberedzzz #1{\seccheck{unnumbered}%
2925 \secno=0 \subsecno=0 \subsubsecno=0
2927 % This used to be simply \message{#1}, but TeX fully expands the
2928 % argument to \message. Therefore, if #1 contained @-commands, TeX
2929 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
2930 % expanded @cite (which turns out to cause errors because \cite is meant
2931 % to be executed, not expanded).
2933 % Anyway, we don't want the fully-expanded definition of @cite to appear
2934 % as a result of the \message, we just want `@cite' itself. We use
2935 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
2936 % simply yielding the contents of the <toks register>.
2937 \toks0 = {#1}\message{(\the\toks0)}%
2939 \unnumbchapmacro {#1}%
2940 \gdef\thischapter{#1}\gdef\thissection{#1}%
2941 {\chapternofonts%
2942 \toks0 = {#1}%
2943 \edef\temp{{\realbackslash unnumbchapentry{\the\toks0}{\noexpand\folio}}}%
2944 \escapechar=`\\%
2945 \write \contentsfile \temp %
2946 \unnumbnoderef %
2947 \global\let\section = \unnumberedsec
2948 \global\let\subsection = \unnumberedsubsec
2949 \global\let\subsubsection = \unnumberedsubsubsec
2952 \outer\def\numberedsec{\parsearg\secyyy}
2953 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
2954 \def\seczzz #1{\seccheck{section}%
2955 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
2956 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
2957 {\chapternofonts%
2958 \toks0 = {#1}%
2959 \edef\temp{{\realbackslash secentry %
2960 {\the\toks0}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
2961 \escapechar=`\\%
2962 \write \contentsfile \temp %
2963 \donoderef %
2964 \penalty 10000 %
2967 \outer\def\appendixsection{\parsearg\appendixsecyyy}
2968 \outer\def\appendixsec{\parsearg\appendixsecyyy}
2969 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
2970 \def\appendixsectionzzz #1{\seccheck{appendixsection}%
2971 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
2972 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
2973 {\chapternofonts%
2974 \toks0 = {#1}%
2975 \edef\temp{{\realbackslash secentry %
2976 {\the\toks0}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
2977 \escapechar=`\\%
2978 \write \contentsfile \temp %
2979 \appendixnoderef %
2980 \penalty 10000 %
2983 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
2984 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
2985 \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
2986 \plainsecheading {#1}\gdef\thissection{#1}%
2987 {\chapternofonts%
2988 \toks0 = {#1}%
2989 \edef\temp{{\realbackslash unnumbsecentry{\the\toks0}{\noexpand\folio}}}%
2990 \escapechar=`\\%
2991 \write \contentsfile \temp %
2992 \unnumbnoderef %
2993 \penalty 10000 %
2996 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
2997 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
2998 \def\numberedsubseczzz #1{\seccheck{subsection}%
2999 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3000 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
3001 {\chapternofonts%
3002 \toks0 = {#1}%
3003 \edef\temp{{\realbackslash subsecentry %
3004 {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
3005 \escapechar=`\\%
3006 \write \contentsfile \temp %
3007 \donoderef %
3008 \penalty 10000 %
3011 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
3012 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
3013 \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
3014 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3015 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
3016 {\chapternofonts%
3017 \toks0 = {#1}%
3018 \edef\temp{{\realbackslash subsecentry %
3019 {\the\toks0}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
3020 \escapechar=`\\%
3021 \write \contentsfile \temp %
3022 \appendixnoderef %
3023 \penalty 10000 %
3026 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
3027 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
3028 \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
3029 \plainsubsecheading {#1}\gdef\thissection{#1}%
3030 {\chapternofonts%
3031 \toks0 = {#1}%
3032 \edef\temp{{\realbackslash unnumbsubsecentry{\the\toks0}{\noexpand\folio}}}%
3033 \escapechar=`\\%
3034 \write \contentsfile \temp %
3035 \unnumbnoderef %
3036 \penalty 10000 %
3039 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
3040 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
3041 \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
3042 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3043 \subsubsecheading {#1}
3044 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3045 {\chapternofonts%
3046 \toks0 = {#1}%
3047 \edef\temp{{\realbackslash subsubsecentry{\the\toks0}
3048 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
3049 {\noexpand\folio}}}%
3050 \escapechar=`\\%
3051 \write \contentsfile \temp %
3052 \donoderef %
3053 \penalty 10000 %
3056 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
3057 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
3058 \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
3059 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3060 \subsubsecheading {#1}
3061 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3062 {\chapternofonts%
3063 \toks0 = {#1}%
3064 \edef\temp{{\realbackslash subsubsecentry{\the\toks0}%
3065 {\appendixletter}
3066 {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
3067 \escapechar=`\\%
3068 \write \contentsfile \temp %
3069 \appendixnoderef %
3070 \penalty 10000 %
3073 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
3074 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
3075 \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
3076 \plainsubsubsecheading {#1}\gdef\thissection{#1}%
3077 {\chapternofonts%
3078 \toks0 = {#1}%
3079 \edef\temp{{\realbackslash unnumbsubsubsecentry{\the\toks0}{\noexpand\folio}}}%
3080 \escapechar=`\\%
3081 \write \contentsfile \temp %
3082 \unnumbnoderef %
3083 \penalty 10000 %
3086 % These are variants which are not "outer", so they can appear in @ifinfo.
3087 % Actually, they should now be obsolete; ordinary section commands should work.
3088 \def\infotop{\parsearg\unnumberedzzz}
3089 \def\infounnumbered{\parsearg\unnumberedzzz}
3090 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
3091 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
3092 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
3094 \def\infoappendix{\parsearg\appendixzzz}
3095 \def\infoappendixsec{\parsearg\appendixseczzz}
3096 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
3097 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
3099 \def\infochapter{\parsearg\chapterzzz}
3100 \def\infosection{\parsearg\sectionzzz}
3101 \def\infosubsection{\parsearg\subsectionzzz}
3102 \def\infosubsubsection{\parsearg\subsubsectionzzz}
3104 % These macros control what the section commands do, according
3105 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
3106 % Define them by default for a numbered chapter.
3107 \global\let\section = \numberedsec
3108 \global\let\subsection = \numberedsubsec
3109 \global\let\subsubsection = \numberedsubsubsec
3111 % Define @majorheading, @heading and @subheading
3113 % NOTE on use of \vbox for chapter headings, section headings, and
3114 % such:
3115 % 1) We use \vbox rather than the earlier \line to permit
3116 % overlong headings to fold.
3117 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
3118 % heading is obnoxious; this forbids it.
3119 % 3) Likewise, headings look best if no \parindent is used, and
3120 % if justification is not attempted. Hence \raggedright.
3123 \def\majorheading{\parsearg\majorheadingzzz}
3124 \def\majorheadingzzz #1{%
3125 {\advance\chapheadingskip by 10pt \chapbreak }%
3126 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3127 \parindent=0pt\raggedright
3128 \rm #1\hfill}}\bigskip \par\penalty 200}
3130 \def\chapheading{\parsearg\chapheadingzzz}
3131 \def\chapheadingzzz #1{\chapbreak %
3132 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3133 \parindent=0pt\raggedright
3134 \rm #1\hfill}}\bigskip \par\penalty 200}
3136 % @heading, @subheading, @subsubheading.
3137 \def\heading{\parsearg\plainsecheading}
3138 \def\subheading{\parsearg\plainsubsecheading}
3139 \def\subsubheading{\parsearg\plainsubsubsecheading}
3141 % These macros generate a chapter, section, etc. heading only
3142 % (including whitespace, linebreaking, etc. around it),
3143 % given all the information in convenient, parsed form.
3145 %%% Args are the skip and penalty (usually negative)
3146 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
3148 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
3150 %%% Define plain chapter starts, and page on/off switching for it
3151 % Parameter controlling skip before chapter headings (if needed)
3153 \newskip\chapheadingskip
3155 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
3156 \def\chappager{\par\vfill\supereject}
3157 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
3159 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
3161 \def\CHAPPAGoff{
3162 \global\let\contentsalignmacro = \chappager
3163 \global\let\pchapsepmacro=\chapbreak
3164 \global\let\pagealignmacro=\chappager}
3166 \def\CHAPPAGon{
3167 \global\let\contentsalignmacro = \chappager
3168 \global\let\pchapsepmacro=\chappager
3169 \global\let\pagealignmacro=\chappager
3170 \global\def\HEADINGSon{\HEADINGSsingle}}
3172 \def\CHAPPAGodd{
3173 \global\let\contentsalignmacro = \chapoddpage
3174 \global\let\pchapsepmacro=\chapoddpage
3175 \global\let\pagealignmacro=\chapoddpage
3176 \global\def\HEADINGSon{\HEADINGSdouble}}
3178 \CHAPPAGon
3180 \def\CHAPFplain{
3181 \global\let\chapmacro=\chfplain
3182 \global\let\unnumbchapmacro=\unnchfplain
3183 \global\let\centerchapmacro=\centerchfplain}
3185 % Plain chapter opening.
3186 % #1 is the text, #2 the chapter number or empty if unnumbered.
3187 \def\chfplain#1#2{%
3188 \pchapsepmacro
3190 \chapfonts \rm
3191 \def\chapnum{#2}%
3192 \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
3193 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3194 \hangindent = \wd0 \centerparametersmaybe
3195 \unhbox0 #1\par}%
3197 \nobreak\bigskip % no page break after a chapter title
3198 \nobreak
3201 % Plain opening for unnumbered.
3202 \def\unnchfplain#1{\chfplain{#1}{}}
3204 % @centerchap -- centered and unnumbered.
3205 \let\centerparametersmaybe = \relax
3206 \def\centerchfplain#1{{%
3207 \def\centerparametersmaybe{%
3208 \advance\rightskip by 3\rightskip
3209 \leftskip = \rightskip
3210 \parfillskip = 0pt
3212 \chfplain{#1}{}%
3215 \CHAPFplain % The default
3217 \def\unnchfopen #1{%
3218 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3219 \parindent=0pt\raggedright
3220 \rm #1\hfill}}\bigskip \par\penalty 10000 %
3223 \def\chfopen #1#2{\chapoddpage {\chapfonts
3224 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
3225 \par\penalty 5000 %
3228 \def\centerchfopen #1{%
3229 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3230 \parindent=0pt
3231 \hfill {\rm #1}\hfill}}\bigskip \par\penalty 10000 %
3234 \def\CHAPFopen{
3235 \global\let\chapmacro=\chfopen
3236 \global\let\unnumbchapmacro=\unnchfopen
3237 \global\let\centerchapmacro=\centerchfopen}
3240 % Section titles.
3241 \newskip\secheadingskip
3242 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
3243 \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
3244 \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
3246 % Subsection titles.
3247 \newskip \subsecheadingskip
3248 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
3249 \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
3250 \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
3252 % Subsubsection titles.
3253 \let\subsubsecheadingskip = \subsecheadingskip
3254 \let\subsubsecheadingbreak = \subsecheadingbreak
3255 \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
3256 \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
3259 % Print any size section title.
3261 % #1 is the section type (sec/subsec/subsubsec), #2 is the section
3262 % number (maybe empty), #3 the text.
3263 \def\sectionheading#1#2#3{%
3265 \expandafter\advance\csname #1headingskip\endcsname by \parskip
3266 \csname #1headingbreak\endcsname
3269 % Switch to the right set of fonts.
3270 \csname #1fonts\endcsname \rm
3272 % Only insert the separating space if we have a section number.
3273 \def\secnum{#2}%
3274 \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
3276 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
3277 \hangindent = \wd0 % zero if no section number
3278 \unhbox0 #3}%
3280 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
3284 \message{toc printing,}
3285 % Finish up the main text and prepare to read what we've written
3286 % to \contentsfile.
3288 \newskip\contentsrightmargin \contentsrightmargin=1in
3289 \def\startcontents#1{%
3290 % If @setchapternewpage on, and @headings double, the contents should
3291 % start on an odd page, unlike chapters. Thus, we maintain
3292 % \contentsalignmacro in parallel with \pagealignmacro.
3293 % From: Torbjorn Granlund <tege@matematik.su.se>
3294 \contentsalignmacro
3295 \immediate\closeout \contentsfile
3296 \ifnum \pageno>0
3297 \pageno = -1 % Request roman numbered pages.
3299 % Don't need to put `Contents' or `Short Contents' in the headline.
3300 % It is abundantly clear what they are.
3301 \unnumbchapmacro{#1}\def\thischapter{}%
3302 \begingroup % Set up to handle contents files properly.
3303 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
3304 % We can't do this, because then an actual ^ in a section
3305 % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
3306 %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3307 \raggedbottom % Worry more about breakpoints than the bottom.
3308 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3312 % Normal (long) toc.
3313 \outer\def\contents{%
3314 \startcontents{\putwordTableofContents}%
3315 \input \jobname.toc
3316 \endgroup
3317 \vfill \eject
3320 % And just the chapters.
3321 \outer\def\summarycontents{%
3322 \startcontents{\putwordShortContents}%
3324 \let\chapentry = \shortchapentry
3325 \let\unnumbchapentry = \shortunnumberedentry
3326 % We want a true roman here for the page numbers.
3327 \secfonts
3328 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
3330 \hyphenpenalty = 10000
3331 \advance\baselineskip by 1pt % Open it up a little.
3332 \def\secentry ##1##2##3##4{}
3333 \def\unnumbsecentry ##1##2{}
3334 \def\subsecentry ##1##2##3##4##5{}
3335 \def\unnumbsubsecentry ##1##2{}
3336 \def\subsubsecentry ##1##2##3##4##5##6{}
3337 \def\unnumbsubsubsecentry ##1##2{}
3338 \input \jobname.toc
3339 \endgroup
3340 \vfill \eject
3342 \let\shortcontents = \summarycontents
3344 % These macros generate individual entries in the table of contents.
3345 % The first argument is the chapter or section name.
3346 % The last argument is the page number.
3347 % The arguments in between are the chapter number, section number, ...
3349 % Chapter-level things, for both the long and short contents.
3350 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3352 % See comments in \dochapentry re vbox and related settings
3353 \def\shortchapentry#1#2#3{%
3354 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
3357 % Typeset the label for a chapter or appendix for the short contents.
3358 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
3359 % We could simplify the code here by writing out an \appendixentry
3360 % command in the toc file for appendices, instead of using \chapentry
3361 % for both, but it doesn't seem worth it.
3362 \setbox0 = \hbox{\shortcontrm \putwordAppendix }
3363 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
3365 \def\shortchaplabel#1{%
3366 % We typeset #1 in a box of constant width, regardless of the text of
3367 % #1, so the chapter titles will come out aligned.
3368 \setbox0 = \hbox{#1}%
3369 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3371 % This space should be plenty, since a single number is .5em, and the
3372 % widest letter (M) is 1em, at least in the Computer Modern fonts.
3373 % (This space doesn't include the extra space that gets added after
3374 % the label; that gets put in by \shortchapentry above.)
3375 \advance\dimen0 by 1.1em
3376 \hbox to \dimen0{#1\hfil}%
3379 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3380 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
3382 % Sections.
3383 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3384 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
3386 % Subsections.
3387 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
3388 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
3390 % And subsubsections.
3391 \def\subsubsecentry#1#2#3#4#5#6{%
3392 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
3393 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
3395 % This parameter controls the indentation of the various levels.
3396 \newdimen\tocindent \tocindent = 3pc
3398 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
3399 % page number.
3401 % If the toc has to be broken over pages, we want it to be at chapters
3402 % if at all possible; hence the \penalty.
3403 \def\dochapentry#1#2{%
3404 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
3405 \begingroup
3406 \chapentryfonts
3407 \tocentry{#1}{\dopageno{#2}}%
3408 \endgroup
3409 \nobreak\vskip .25\baselineskip plus.1\baselineskip
3412 \def\dosecentry#1#2{\begingroup
3413 \secentryfonts \leftskip=\tocindent
3414 \tocentry{#1}{\dopageno{#2}}%
3415 \endgroup}
3417 \def\dosubsecentry#1#2{\begingroup
3418 \subsecentryfonts \leftskip=2\tocindent
3419 \tocentry{#1}{\dopageno{#2}}%
3420 \endgroup}
3422 \def\dosubsubsecentry#1#2{\begingroup
3423 \subsubsecentryfonts \leftskip=3\tocindent
3424 \tocentry{#1}{\dopageno{#2}}%
3425 \endgroup}
3427 % Final typesetting of a toc entry; we use the same \entry macro as for
3428 % the index entries, but we want to suppress hyphenation here. (We
3429 % can't do that in the \entry macro, since index entries might consist
3430 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
3432 % \turnoffactive is for the sake of @" used for umlauts.
3433 \def\tocentry#1#2{\begingroup
3434 \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
3435 \entry{\turnoffactive #1}{\turnoffactive #2}%
3436 \endgroup}
3438 % Space between chapter (or whatever) number and the title.
3439 \def\labelspace{\hskip1em \relax}
3441 \def\dopageno#1{{\rm #1}}
3442 \def\doshortpageno#1{{\rm #1}}
3444 \def\chapentryfonts{\secfonts \rm}
3445 \def\secentryfonts{\textfonts}
3446 \let\subsecentryfonts = \textfonts
3447 \let\subsubsecentryfonts = \textfonts
3450 \message{environments,}
3452 % Since these characters are used in examples, it should be an even number of
3453 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3454 % Furthermore, these definitions must come after we define our fonts.
3455 \newbox\dblarrowbox \newbox\longdblarrowbox
3456 \newbox\pushcharbox \newbox\bullbox
3457 \newbox\equivbox \newbox\errorbox
3459 %{\tentt
3460 %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
3461 %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
3462 %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
3463 %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
3464 % Adapted from the manmac format (p.420 of TeXbook)
3465 %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
3466 % depth .1ex\hfil}
3469 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3470 \def\point{$\star$}
3471 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3472 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
3473 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3474 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3476 % Adapted from the TeXbook's \boxit.
3477 {\tentt \global\dimen0 = 3em}% Width of the box.
3478 \dimen2 = .55pt % Thickness of rules
3479 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3480 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
3482 \global\setbox\errorbox=\hbox to \dimen0{\hfil
3483 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3484 \advance\hsize by -2\dimen2 % Rules.
3485 \vbox{
3486 \hrule height\dimen2
3487 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3488 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3489 \kern3pt\vrule width\dimen2}% Space to right.
3490 \hrule height\dimen2}
3491 \hfil}
3493 % The @error{} command.
3494 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3496 % @tex ... @end tex escapes into raw Tex temporarily.
3497 % One exception: @ is still an escape character, so that @end tex works.
3498 % But \@ or @@ will get a plain tex @ character.
3500 \def\tex{\begingroup
3501 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
3502 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
3503 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
3504 \catcode `\%=14
3505 \catcode 43=12 % plus
3506 \catcode`\"=12
3507 \catcode`\==12
3508 \catcode`\|=12
3509 \catcode`\<=12
3510 \catcode`\>=12
3511 \escapechar=`\\
3513 \let\,=\ptexcomma
3514 \let\{=\ptexlbrace
3515 \let\}=\ptexrbrace
3516 \let\.=\ptexdot
3517 \let\*=\ptexstar
3518 \let\dots=\ptexdots
3519 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
3520 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
3521 \def\@{@}%
3522 \let\bullet=\ptexbullet
3523 \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext
3525 \let\Etex=\endgroup}
3527 % Define @lisp ... @endlisp.
3528 % @lisp does a \begingroup so it can rebind things,
3529 % including the definition of @endlisp (which normally is erroneous).
3531 % Amount to narrow the margins by for @lisp.
3532 \newskip\lispnarrowing \lispnarrowing=0.4in
3534 % This is the definition that ^^M gets inside @lisp, @example, and other
3535 % such environments. \null is better than a space, since it doesn't
3536 % have any width.
3537 \def\lisppar{\null\endgraf}
3539 % Make each space character in the input produce a normal interword
3540 % space in the output. Don't allow a line break at this space, as this
3541 % is used only in environments like @example, where each line of input
3542 % should produce a line of output anyway.
3544 {\obeyspaces %
3545 \gdef\sepspaces{\obeyspaces\let =\tie}}
3547 % Define \obeyedspace to be our active space, whatever it is. This is
3548 % for use in \parsearg.
3549 {\sepspaces%
3550 \global\let\obeyedspace= }
3552 % This space is always present above and below environments.
3553 \newskip\envskipamount \envskipamount = 0pt
3555 % Make spacing and below environment symmetrical. We use \parskip here
3556 % to help in doing that, since in @example-like environments \parskip
3557 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
3558 % start of the next paragraph will insert \parskip
3560 \def\aboveenvbreak{{\advance\envskipamount by \parskip
3561 \endgraf \ifdim\lastskip<\envskipamount
3562 \removelastskip \penalty-50 \vskip\envskipamount \fi}}
3564 \let\afterenvbreak = \aboveenvbreak
3566 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
3567 \let\nonarrowing=\relax
3569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3570 % \cartouche: draw rectangle w/rounded corners around argument
3571 \font\circle=lcircle10
3572 \newdimen\circthick
3573 \newdimen\cartouter\newdimen\cartinner
3574 \newskip\normbskip\newskip\normpskip\newskip\normlskip
3575 \circthick=\fontdimen8\circle
3577 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
3578 \def\ctr{{\hskip 6pt\circle\char'010}}
3579 \def\cbl{{\circle\char'012\hskip -6pt}}
3580 \def\cbr{{\hskip 6pt\circle\char'011}}
3581 \def\carttop{\hbox to \cartouter{\hskip\lskip
3582 \ctl\leaders\hrule height\circthick\hfil\ctr
3583 \hskip\rskip}}
3584 \def\cartbot{\hbox to \cartouter{\hskip\lskip
3585 \cbl\leaders\hrule height\circthick\hfil\cbr
3586 \hskip\rskip}}
3588 \newskip\lskip\newskip\rskip
3590 \long\def\cartouche{%
3591 \begingroup
3592 \lskip=\leftskip \rskip=\rightskip
3593 \leftskip=0pt\rightskip=0pt %we want these *outside*.
3594 \cartinner=\hsize \advance\cartinner by-\lskip
3595 \advance\cartinner by-\rskip
3596 \cartouter=\hsize
3597 \advance\cartouter by 18pt % allow for 3pt kerns on either
3598 % side, and for 6pt waste from
3599 % each corner char
3600 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
3601 % Flag to tell @lisp, etc., not to narrow margin.
3602 \let\nonarrowing=\comment
3603 \vbox\bgroup
3604 \baselineskip=0pt\parskip=0pt\lineskip=0pt
3605 \carttop
3606 \hbox\bgroup
3607 \hskip\lskip
3608 \vrule\kern3pt
3609 \vbox\bgroup
3610 \hsize=\cartinner
3611 \kern3pt
3612 \begingroup
3613 \baselineskip=\normbskip
3614 \lineskip=\normlskip
3615 \parskip=\normpskip
3616 \vskip -\parskip
3617 \def\Ecartouche{%
3618 \endgroup
3619 \kern3pt
3620 \egroup
3621 \kern3pt\vrule
3622 \hskip\rskip
3623 \egroup
3624 \cartbot
3625 \egroup
3626 \endgroup
3630 % This macro is called at the beginning of all the @example variants,
3631 % inside a group.
3632 \def\nonfillstart{%
3633 \aboveenvbreak
3634 \inENV % This group ends at the end of the body
3635 \hfuzz = 12pt % Don't be fussy
3636 \sepspaces % Make spaces be word-separators rather than space tokens.
3637 \singlespace
3638 \let\par = \lisppar % don't ignore blank lines
3639 \obeylines % each line of input is a line of output
3640 \parskip = 0pt
3641 \parindent = 0pt
3642 \emergencystretch = 0pt % don't try to avoid overfull boxes
3643 % @cartouche defines \nonarrowing to inhibit narrowing
3644 % at next level down.
3645 \ifx\nonarrowing\relax
3646 \advance \leftskip by \lispnarrowing
3647 \exdentamount=\lispnarrowing
3648 \let\exdent=\nofillexdent
3649 \let\nonarrowing=\relax
3653 % To ending an @example-like environment, we first end the paragraph
3654 % (via \afterenvbreak's vertical glue), and then the group. That way we
3655 % keep the zero \parskip that the environments set -- \parskip glue
3656 % will be inserted at the beginning of the next paragraph in the
3657 % document, after the environment.
3659 \def\nonfillfinish{\afterenvbreak\endgroup}%
3661 \def\lisp{\begingroup
3662 \nonfillstart
3663 \let\Elisp = \nonfillfinish
3665 % Make @kbd do something special, if requested.
3666 \let\kbdfont\kbdexamplefont
3667 \rawbackslash % have \ input char produce \ char from current font
3668 \gobble
3671 % Define the \E... control sequence only if we are inside the
3672 % environment, so the error checking in \end will work.
3674 % We must call \lisp last in the definition, since it reads the
3675 % return following the @example (or whatever) command.
3677 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
3678 \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
3679 \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
3681 % @smallexample and @smalllisp. This is not used unless the @smallbook
3682 % command is given. Originally contributed by Pavel@xerox.
3684 \def\smalllispx{\begingroup
3685 \nonfillstart
3686 \let\Esmalllisp = \nonfillfinish
3687 \let\Esmallexample = \nonfillfinish
3689 % Smaller fonts for small examples.
3690 \indexfonts \tt
3691 \rawbackslash % make \ output the \ character from the current font (tt)
3692 \gobble
3695 % This is @display; same as @lisp except use roman font.
3697 \def\display{\begingroup
3698 \nonfillstart
3699 \let\Edisplay = \nonfillfinish
3700 \gobble
3703 % This is @format; same as @display except don't narrow margins.
3705 \def\format{\begingroup
3706 \let\nonarrowing = t
3707 \nonfillstart
3708 \let\Eformat = \nonfillfinish
3709 \gobble
3712 % @flushleft (same as @format) and @flushright.
3714 \def\flushleft{\begingroup
3715 \let\nonarrowing = t
3716 \nonfillstart
3717 \let\Eflushleft = \nonfillfinish
3718 \gobble
3720 \def\flushright{\begingroup
3721 \let\nonarrowing = t
3722 \nonfillstart
3723 \let\Eflushright = \nonfillfinish
3724 \advance\leftskip by 0pt plus 1fill
3725 \gobble}
3727 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
3728 % and narrows the margins.
3730 \def\quotation{%
3731 \begingroup\inENV %This group ends at the end of the @quotation body
3732 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
3733 \singlespace
3734 \parindent=0pt
3735 % We have retained a nonzero parskip for the environment, since we're
3736 % doing normal filling. So to avoid extra space below the environment...
3737 \def\Equotation{\parskip = 0pt \nonfillfinish}%
3739 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
3740 \ifx\nonarrowing\relax
3741 \advance\leftskip by \lispnarrowing
3742 \advance\rightskip by \lispnarrowing
3743 \exdentamount = \lispnarrowing
3744 \let\nonarrowing = \relax
3748 \message{defuns,}
3749 % Define formatter for defuns
3750 % First, allow user to change definition object font (\df) internally
3751 \def\setdeffont #1 {\csname DEF#1\endcsname}
3753 \newskip\defbodyindent \defbodyindent=.4in
3754 \newskip\defargsindent \defargsindent=50pt
3755 \newskip\deftypemargin \deftypemargin=12pt
3756 \newskip\deflastargmargin \deflastargmargin=18pt
3758 \newcount\parencount
3759 % define \functionparens, which makes ( and ) and & do special things.
3760 % \functionparens affects the group it is contained in.
3761 \def\activeparens{%
3762 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
3763 \catcode`\[=\active \catcode`\]=\active}
3765 % Make control sequences which act like normal parenthesis chars.
3766 \let\lparen = ( \let\rparen = )
3768 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
3770 % Be sure that we always have a definition for `(', etc. For example,
3771 % if the fn name has parens in it, \boldbrax will not be in effect yet,
3772 % so TeX would otherwise complain about undefined control sequence.
3773 \global\let(=\lparen \global\let)=\rparen
3774 \global\let[=\lbrack \global\let]=\rbrack
3776 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
3777 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
3778 % This is used to turn on special parens
3779 % but make & act ordinary (given that it's active).
3780 \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
3782 % Definitions of (, ) and & used in args for functions.
3783 % This is the definition of ( outside of all parentheses.
3784 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
3785 \global\advance\parencount by 1
3788 % This is the definition of ( when already inside a level of parens.
3789 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
3791 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
3792 % also in that case restore the outer-level definition of (.
3793 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
3794 \global\advance \parencount by -1 }
3795 % If we encounter &foo, then turn on ()-hacking afterwards
3796 \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
3798 \gdef\normalparens{\boldbrax\let&=\ampnr}
3799 } % End of definition inside \activeparens
3800 %% These parens (in \boldbrax) actually are a little bolder than the
3801 %% contained text. This is especially needed for [ and ]
3802 \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
3803 \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
3804 \def\ampnr{\&}
3805 \def\lbrb{{\bf\char`\[}}
3806 \def\rbrb{{\bf\char`\]}}
3808 % First, defname, which formats the header line itself.
3809 % #1 should be the function name.
3810 % #2 should be the type of definition, such as "Function".
3812 \def\defname #1#2{%
3813 % Get the values of \leftskip and \rightskip as they were
3814 % outside the @def...
3815 \dimen2=\leftskip
3816 \advance\dimen2 by -\defbodyindent
3817 \dimen3=\rightskip
3818 \advance\dimen3 by -\defbodyindent
3819 \noindent %
3820 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
3821 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
3822 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
3823 \parshape 2 0in \dimen0 \defargsindent \dimen1 %
3824 % Now output arg 2 ("Function" or some such)
3825 % ending at \deftypemargin from the right margin,
3826 % but stuck inside a box of width 0 so it does not interfere with linebreaking
3827 {% Adjust \hsize to exclude the ambient margins,
3828 % so that \rightline will obey them.
3829 \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
3830 \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
3831 % Make all lines underfull and no complaints:
3832 \tolerance=10000 \hbadness=10000
3833 \advance\leftskip by -\defbodyindent
3834 \exdentamount=\defbodyindent
3835 {\df #1}\enskip % Generate function name
3838 % Actually process the body of a definition
3839 % #1 should be the terminating control sequence, such as \Edefun.
3840 % #2 should be the "another name" control sequence, such as \defunx.
3841 % #3 should be the control sequence that actually processes the header,
3842 % such as \defunheader.
3844 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3845 \medbreak %
3846 % Define the end token that this defining construct specifies
3847 % so that it will exit this group.
3848 \def#1{\endgraf\endgroup\medbreak}%
3849 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
3850 \parindent=0in
3851 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3852 \exdentamount=\defbodyindent
3853 \begingroup %
3854 \catcode 61=\active % 61 is `='
3855 \obeylines\activeparens\spacesplit#3}
3857 \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
3858 \medbreak %
3859 % Define the end token that this defining construct specifies
3860 % so that it will exit this group.
3861 \def#1{\endgraf\endgroup\medbreak}%
3862 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
3863 \parindent=0in
3864 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3865 \exdentamount=\defbodyindent
3866 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
3868 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
3869 \medbreak %
3870 % Define the end token that this defining construct specifies
3871 % so that it will exit this group.
3872 \def#1{\endgraf\endgroup\medbreak}%
3873 \def#2##1 ##2 {\def#4{##1}%
3874 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
3875 \parindent=0in
3876 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3877 \exdentamount=\defbodyindent
3878 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
3880 % These parsing functions are similar to the preceding ones
3881 % except that they do not make parens into active characters.
3882 % These are used for "variables" since they have no arguments.
3884 \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3885 \medbreak %
3886 % Define the end token that this defining construct specifies
3887 % so that it will exit this group.
3888 \def#1{\endgraf\endgroup\medbreak}%
3889 \def#2{\begingroup\obeylines\spacesplit#3}%
3890 \parindent=0in
3891 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3892 \exdentamount=\defbodyindent
3893 \begingroup %
3894 \catcode 61=\active %
3895 \obeylines\spacesplit#3}
3897 % This is used for \def{tp,vr}parsebody. It could probably be used for
3898 % some of the others, too, with some judicious conditionals.
3900 \def\parsebodycommon#1#2#3{%
3901 \begingroup\inENV %
3902 \medbreak %
3903 % Define the end token that this defining construct specifies
3904 % so that it will exit this group.
3905 \def#1{\endgraf\endgroup\medbreak}%
3906 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
3907 \parindent=0in
3908 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3909 \exdentamount=\defbodyindent
3910 \begingroup\obeylines
3913 \def\defvrparsebody#1#2#3#4 {%
3914 \parsebodycommon{#1}{#2}{#3}%
3915 \spacesplit{#3{#4}}%
3918 % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
3919 % type is just `struct', because we lose the braces in `{struct
3920 % termios}' when \spacesplit reads its undelimited argument. Sigh.
3921 % \let\deftpparsebody=\defvrparsebody
3923 % So, to get around this, we put \empty in with the type name. That
3924 % way, TeX won't find exactly `{...}' as an undelimited argument, and
3925 % won't strip off the braces.
3927 \def\deftpparsebody #1#2#3#4 {%
3928 \parsebodycommon{#1}{#2}{#3}%
3929 \spacesplit{\parsetpheaderline{#3{#4}}}\empty
3932 % Fine, but then we have to eventually remove the \empty *and* the
3933 % braces (if any). That's what this does.
3935 \def\removeemptybraces\empty#1\relax{#1}
3937 % After \spacesplit has done its work, this is called -- #1 is the final
3938 % thing to call, #2 the type name (which starts with \empty), and #3
3939 % (which might be empty) the arguments.
3941 \def\parsetpheaderline#1#2#3{%
3942 #1{\removeemptybraces#2\relax}{#3}%
3945 \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
3946 \medbreak %
3947 % Define the end token that this defining construct specifies
3948 % so that it will exit this group.
3949 \def#1{\endgraf\endgroup\medbreak}%
3950 \def#2##1 ##2 {\def#4{##1}%
3951 \begingroup\obeylines\spacesplit{#3{##2}}}%
3952 \parindent=0in
3953 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3954 \exdentamount=\defbodyindent
3955 \begingroup\obeylines\spacesplit{#3{#5}}}
3957 % Split up #2 at the first space token.
3958 % call #1 with two arguments:
3959 % the first is all of #2 before the space token,
3960 % the second is all of #2 after that space token.
3961 % If #2 contains no space token, all of it is passed as the first arg
3962 % and the second is passed as empty.
3964 {\obeylines
3965 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
3966 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
3967 \ifx\relax #3%
3968 #1{#2}{}\else #1{#2}{#3#4}\fi}}
3970 % So much for the things common to all kinds of definitions.
3972 % Define @defun.
3974 % First, define the processing that is wanted for arguments of \defun
3975 % Use this to expand the args and terminate the paragraph they make up
3977 \def\defunargs #1{\functionparens \sl
3978 % Expand, preventing hyphenation at `-' chars.
3979 % Note that groups don't affect changes in \hyphenchar.
3980 \hyphenchar\tensl=0
3982 \hyphenchar\tensl=45
3983 \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
3984 \interlinepenalty=10000
3985 \advance\rightskip by 0pt plus 1fil
3986 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
3989 \def\deftypefunargs #1{%
3990 % Expand, preventing hyphenation at `-' chars.
3991 % Note that groups don't affect changes in \hyphenchar.
3992 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
3993 \boldbraxnoamp
3994 \tclose{#1}% avoid \code because of side effects on active chars
3995 \interlinepenalty=10000
3996 \advance\rightskip by 0pt plus 1fil
3997 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
4000 % Do complete processing of one @defun or @defunx line already parsed.
4002 % @deffn Command forward-char nchars
4004 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
4006 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
4007 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
4008 \catcode 61=\other % Turn off change made in \defparsebody
4011 % @defun == @deffn Function
4013 \def\defun{\defparsebody\Edefun\defunx\defunheader}
4015 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4016 \begingroup\defname {#1}{Function}%
4017 \defunargs {#2}\endgroup %
4018 \catcode 61=\other % Turn off change made in \defparsebody
4021 % @deftypefun int foobar (int @var{foo}, float @var{bar})
4023 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
4025 % #1 is the data type. #2 is the name and args.
4026 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
4027 % #1 is the data type, #2 the name, #3 the args.
4028 \def\deftypefunheaderx #1#2 #3\relax{%
4029 \doind {fn}{\code{#2}}% Make entry in function index
4030 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
4031 \deftypefunargs {#3}\endgroup %
4032 \catcode 61=\other % Turn off change made in \defparsebody
4035 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
4037 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
4039 % \defheaderxcond#1\relax$$$
4040 % puts #1 in @code, followed by a space, but does nothing if #1 is null.
4041 \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
4043 % #1 is the classification. #2 is the data type. #3 is the name and args.
4044 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
4045 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
4046 \def\deftypefnheaderx #1#2#3 #4\relax{%
4047 \doind {fn}{\code{#3}}% Make entry in function index
4048 \begingroup
4049 \normalparens % notably, turn off `&' magic, which prevents
4050 % at least some C++ text from working
4051 \defname {\defheaderxcond#2\relax$$$#3}{#1}%
4052 \deftypefunargs {#4}\endgroup %
4053 \catcode 61=\other % Turn off change made in \defparsebody
4056 % @defmac == @deffn Macro
4058 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
4060 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4061 \begingroup\defname {#1}{Macro}%
4062 \defunargs {#2}\endgroup %
4063 \catcode 61=\other % Turn off change made in \defparsebody
4066 % @defspec == @deffn Special Form
4068 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
4070 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4071 \begingroup\defname {#1}{Special Form}%
4072 \defunargs {#2}\endgroup %
4073 \catcode 61=\other % Turn off change made in \defparsebody
4076 % This definition is run if you use @defunx
4077 % anywhere other than immediately after a @defun or @defunx.
4079 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
4080 \def\defunx #1 {\errmessage{@defunx in invalid context}}
4081 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
4082 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
4083 \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
4084 \def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}}
4085 \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
4087 % @defmethod, and so on
4089 % @defop {Funny Method} foo-class frobnicate argument
4091 \def\defop #1 {\def\defoptype{#1}%
4092 \defopparsebody\Edefop\defopx\defopheader\defoptype}
4094 \def\defopheader #1#2#3{%
4095 \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
4096 \begingroup\defname {#2}{\defoptype{} on #1}%
4097 \defunargs {#3}\endgroup %
4100 % @deftypemethod foo-class return-type foo-method args
4102 \def\deftypemethod{%
4103 \defmethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
4105 % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
4106 \def\deftypemethodheader#1#2#3#4{%
4107 \deftypefnheaderx{Method on #1}{#2}#3 #4\relax
4110 % @defmethod == @defop Method
4112 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
4114 \def\defmethodheader #1#2#3{%
4115 \dosubind {fn}{\code{#2}}{on #1}% entry in function index
4116 \begingroup\defname {#2}{Method on #1}%
4117 \defunargs {#3}\endgroup %
4120 % @defcv {Class Option} foo-class foo-flag
4122 \def\defcv #1 {\def\defcvtype{#1}%
4123 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
4125 \def\defcvarheader #1#2#3{%
4126 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4127 \begingroup\defname {#2}{\defcvtype{} of #1}%
4128 \defvarargs {#3}\endgroup %
4131 % @defivar == @defcv {Instance Variable}
4133 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
4135 \def\defivarheader #1#2#3{%
4136 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4137 \begingroup\defname {#2}{Instance Variable of #1}%
4138 \defvarargs {#3}\endgroup %
4141 % These definitions are run if you use @defmethodx, etc.,
4142 % anywhere other than immediately after a @defmethod, etc.
4144 \def\defopx #1 {\errmessage{@defopx in invalid context}}
4145 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
4146 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
4147 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
4149 % Now @defvar
4151 % First, define the processing that is wanted for arguments of @defvar.
4152 % This is actually simple: just print them in roman.
4153 % This must expand the args and terminate the paragraph they make up
4154 \def\defvarargs #1{\normalparens #1%
4155 \interlinepenalty=10000
4156 \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
4158 % @defvr Counter foo-count
4160 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
4162 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
4163 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
4165 % @defvar == @defvr Variable
4167 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
4169 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4170 \begingroup\defname {#1}{Variable}%
4171 \defvarargs {#2}\endgroup %
4174 % @defopt == @defvr {User Option}
4176 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
4178 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4179 \begingroup\defname {#1}{User Option}%
4180 \defvarargs {#2}\endgroup %
4183 % @deftypevar int foobar
4185 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
4187 % #1 is the data type. #2 is the name, perhaps followed by text that
4188 % is actually part of the data type, which should not be put into the index.
4189 \def\deftypevarheader #1#2{%
4190 \dovarind#2 \relax% Make entry in variables index
4191 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
4192 \interlinepenalty=10000
4193 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
4194 \endgroup}
4195 \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
4197 % @deftypevr {Global Flag} int enable
4199 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
4201 \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
4202 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
4203 \interlinepenalty=10000
4204 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
4205 \endgroup}
4207 % This definition is run if you use @defvarx
4208 % anywhere other than immediately after a @defvar or @defvarx.
4210 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
4211 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
4212 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
4213 \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
4214 \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
4216 % Now define @deftp
4217 % Args are printed in bold, a slight difference from @defvar.
4219 \def\deftpargs #1{\bf \defvarargs{#1}}
4221 % @deftp Class window height width ...
4223 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
4225 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4226 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4228 % This definition is run if you use @deftpx, etc
4229 % anywhere other than immediately after a @deftp, etc.
4231 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
4234 \message{cross reference,}
4235 % Define cross-reference macros
4236 \newwrite \auxfile
4238 \newif\ifhavexrefs % True if xref values are known.
4239 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
4241 % @inforef is simple.
4242 \def\inforef #1{\inforefzzz #1,,,,**}
4243 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
4244 node \samp{\ignorespaces#1{}}}
4246 % \setref{foo} defines a cross-reference point named foo.
4248 \def\setref#1{%
4249 \dosetq{#1-title}{Ytitle}%
4250 \dosetq{#1-pg}{Ypagenumber}%
4251 \dosetq{#1-snt}{Ysectionnumberandtype}}
4253 \def\unnumbsetref#1{%
4254 \dosetq{#1-title}{Ytitle}%
4255 \dosetq{#1-pg}{Ypagenumber}%
4256 \dosetq{#1-snt}{Ynothing}}
4258 \def\appendixsetref#1{%
4259 \dosetq{#1-title}{Ytitle}%
4260 \dosetq{#1-pg}{Ypagenumber}%
4261 \dosetq{#1-snt}{Yappendixletterandtype}}
4263 % \xref, \pxref, and \ref generate cross-references to specified points.
4264 % For \xrefX, #1 is the node name, #2 the name of the Info
4265 % cross-reference, #3 the printed node name, #4 the name of the Info
4266 % file, #5 the name of the printed manual. All but the node name can be
4267 % omitted.
4269 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
4270 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
4271 \def\ref#1{\xrefX[#1,,,,,,,]}
4272 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
4273 \def\printedmanual{\ignorespaces #5}%
4274 \def\printednodename{\ignorespaces #3}%
4275 \setbox1=\hbox{\printedmanual}%
4276 \setbox0=\hbox{\printednodename}%
4277 \ifdim \wd0 = 0pt
4278 % No printed node name was explicitly given.
4279 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
4280 % Use the node name inside the square brackets.
4281 \def\printednodename{\ignorespaces #1}%
4282 \else
4283 % Use the actual chapter/section title appear inside
4284 % the square brackets. Use the real section title if we have it.
4285 \ifdim \wd1>0pt%
4286 % It is in another manual, so we don't have it.
4287 \def\printednodename{\ignorespaces #1}%
4288 \else
4289 \ifhavexrefs
4290 % We know the real title if we have the xref values.
4291 \def\printednodename{\refx{#1-title}{}}%
4292 \else
4293 % Otherwise just copy the Info node name.
4294 \def\printednodename{\ignorespaces #1}%
4295 \fi%
4300 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
4301 % insert empty discretionaries after hyphens, which means that it will
4302 % not find a line break at a hyphen in a node names. Since some manuals
4303 % are best written with fairly long node names, containing hyphens, this
4304 % is a loss. Therefore, we give the text of the node name again, so it
4305 % is as if TeX is seeing it for the first time.
4306 \ifdim \wd1 > 0pt
4307 \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
4308 \else
4309 % _ (for example) has to be the character _ for the purposes of the
4310 % control sequence corresponding to the node, but it has to expand
4311 % into the usual \leavevmode...\vrule stuff for purposes of
4312 % printing. So we \turnoffactive for the \refx-snt, back on for the
4313 % printing, back off for the \refx-pg.
4314 {\turnoffactive \refx{#1-snt}{}}%
4315 \space [\printednodename],\space
4316 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
4318 \endgroup}
4320 % \dosetq is the interface for calls from other macros
4322 % Use \turnoffactive so that punctuation chars such as underscore
4323 % work in node names.
4324 \def\dosetq #1#2{{\let\folio=0 \turnoffactive
4325 \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
4326 \next}}
4328 % \internalsetq {foo}{page} expands into
4329 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
4330 % When the aux file is read, ' is the escape character
4332 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
4334 % Things to be expanded by \internalsetq
4336 \def\Ypagenumber{\folio}
4338 \def\Ytitle{\thissection}
4340 \def\Ynothing{}
4342 \def\Ysectionnumberandtype{%
4343 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
4344 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
4345 \else \ifnum \subsubsecno=0 %
4346 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
4347 \else %
4348 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
4349 \fi \fi \fi }
4351 \def\Yappendixletterandtype{%
4352 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
4353 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
4354 \else \ifnum \subsubsecno=0 %
4355 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
4356 \else %
4357 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
4358 \fi \fi \fi }
4360 \gdef\xreftie{'tie}
4362 % Use TeX 3.0's \inputlineno to get the line number, for better error
4363 % messages, but if we're using an old version of TeX, don't do anything.
4365 \ifx\inputlineno\thisisundefined
4366 \let\linenumber = \empty % Non-3.0.
4367 \else
4368 \def\linenumber{\the\inputlineno:\space}
4371 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
4372 % If its value is nonempty, SUFFIX is output afterward.
4374 \def\refx#1#2{%
4375 \expandafter\ifx\csname X#1\endcsname\relax
4376 % If not defined, say something at least.
4377 $\langle$un\-de\-fined$\rangle$%
4378 \ifhavexrefs
4379 \message{\linenumber Undefined cross reference `#1'.}%
4380 \else
4381 \ifwarnedxrefs\else
4382 \global\warnedxrefstrue
4383 \message{Cross reference values unknown; you must run TeX again.}%
4386 \else
4387 % It's defined, so just use it.
4388 \csname X#1\endcsname
4390 #2% Output the suffix in any case.
4393 % This is the macro invoked by entries in the aux file.
4394 \def\xrdef #1#2{{%
4395 \catcode`\'=\other
4396 \expandafter\gdef\csname X#1\endcsname{#2}%
4399 % Read the last existing aux file, if any. No error if none exists.
4400 \def\readauxfile{\begingroup
4401 \catcode`\^^@=\other
4402 \catcode`\^\x01=\other
4403 \catcode`\^\x02=\other
4404 \catcode`\^^C=\other
4405 \catcode`\^^D=\other
4406 \catcode`\^^E=\other
4407 \catcode`\^^F=\other
4408 \catcode`\^^G=\other
4409 \catcode`\^^H=\other
4410 \catcode`\^\v=\other
4411 \catcode`\^^L=\other
4412 \catcode`\^^N=\other
4413 \catcode`\^^P=\other
4414 \catcode`\^^Q=\other
4415 \catcode`\^^R=\other
4416 \catcode`\^^S=\other
4417 \catcode`\^^T=\other
4418 \catcode`\^^U=\other
4419 \catcode`\^^V=\other
4420 \catcode`\^^W=\other
4421 \catcode`\^^X=\other
4422 \catcode`\^^Z=\other
4423 \catcode`\^^[=\other
4424 \catcode`\^^\=\other
4425 \catcode`\^^]=\other
4426 \catcode`\^^^=\other
4427 \catcode`\^^_=\other
4428 \catcode`\@=\other
4429 \catcode`\^=\other
4430 % It was suggested to define this as 7, which would allow ^^e4 etc.
4431 % in xref tags, i.e., node names. But since ^^e4 notation isn't
4432 % supported in the main text, it doesn't seem desirable. Furthermore,
4433 % that is not enough: for node names that actually contain a ^
4434 % character, we would end up writing a line like this: 'xrdef {'hat
4435 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
4436 % argument, and \hat is not an expandable control sequence. It could
4437 % all be worked out, but why? Either we support ^^ or we don't.
4439 % The other change necessary for this was to define \auxhat:
4440 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
4441 % and then to call \auxhat in \setq.
4443 \catcode`\~=\other
4444 \catcode`\[=\other
4445 \catcode`\]=\other
4446 \catcode`\"=\other
4447 \catcode`\_=\other
4448 \catcode`\|=\other
4449 \catcode`\<=\other
4450 \catcode`\>=\other
4451 \catcode`\$=\other
4452 \catcode`\#=\other
4453 \catcode`\&=\other
4454 % `\+ does not work, so use 43.
4455 \catcode43=\other
4456 % Make the characters 128-255 be printing characters
4458 \count 1=128
4459 \def\loop{%
4460 \catcode\count 1=\other
4461 \advance\count 1 by 1
4462 \ifnum \count 1<256 \loop \fi
4465 % The aux file uses ' as the escape (for now).
4466 % Turn off \ as an escape so we do not lose on
4467 % entries which were dumped with control sequences in their names.
4468 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
4469 % Reference to such entries still does not work the way one would wish,
4470 % but at least they do not bomb out when the aux file is read in.
4471 \catcode`\{=1
4472 \catcode`\}=2
4473 \catcode`\%=\other
4474 \catcode`\'=0
4475 \catcode`\\=\other
4477 \openin 1 \jobname.aux
4478 \ifeof 1 \else
4479 \closein 1
4480 \input \jobname.aux
4481 \global\havexrefstrue
4482 \global\warnedobstrue
4484 % Open the new aux file. TeX will close it automatically at exit.
4485 \openout\auxfile=\jobname.aux
4486 \endgroup}
4489 % Footnotes.
4491 \newcount \footnoteno
4493 % The trailing space in the following definition for supereject is
4494 % vital for proper filling; pages come out unaligned when you do a
4495 % pagealignmacro call if that space before the closing brace is
4496 % removed. (Generally, numeric constants should always be followed by a
4497 % space to prevent strange expansion errors.)
4498 \def\supereject{\par\penalty -20000\footnoteno =0 }
4500 % @footnotestyle is meaningful for info output only.
4501 \let\footnotestyle=\comment
4503 \let\ptexfootnote=\footnote
4505 {\catcode `\@=11
4507 % Auto-number footnotes. Otherwise like plain.
4508 \gdef\footnote{%
4509 \global\advance\footnoteno by \@ne
4510 \edef\thisfootno{$^{\the\footnoteno}$}%
4512 % In case the footnote comes at the end of a sentence, preserve the
4513 % extra spacing after we do the footnote number.
4514 \let\@sf\empty
4515 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
4517 % Remove inadvertent blank space before typesetting the footnote number.
4518 \unskip
4519 \thisfootno\@sf
4520 \footnotezzz
4523 % Don't bother with the trickery in plain.tex to not require the
4524 % footnote text as a parameter. Our footnotes don't need to be so general.
4526 % Oh yes, they do; otherwise, @ifset and anything else that uses
4527 % \parseargline fail inside footnotes because the tokens are fixed when
4528 % the footnote is read. --karl, 16nov96.
4530 \long\gdef\footnotezzz{\insert\footins\bgroup
4531 % We want to typeset this text as a normal paragraph, even if the
4532 % footnote reference occurs in (for example) a display environment.
4533 % So reset some parameters.
4534 \interlinepenalty\interfootnotelinepenalty
4535 \splittopskip\ht\strutbox % top baseline for broken footnotes
4536 \splitmaxdepth\dp\strutbox
4537 \floatingpenalty\@MM
4538 \leftskip\z@skip
4539 \rightskip\z@skip
4540 \spaceskip\z@skip
4541 \xspaceskip\z@skip
4542 \parindent\defaultparindent
4544 % Hang the footnote text off the number.
4545 \hang
4546 \textindent{\thisfootno}%
4548 % Don't crash into the line above the footnote text. Since this
4549 % expands into a box, it must come within the paragraph, lest it
4550 % provide a place where TeX can split the footnote.
4551 \footstrut
4552 \futurelet\next\fo@t
4554 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
4555 \else\let\next\f@t\fi \next}
4556 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
4557 \def\f@t#1{#1\@foot}
4558 \def\@foot{\strut\egroup}
4560 }%end \catcode `\@=11
4562 % Set the baselineskip to #1, and the lineskip and strut size
4563 % correspondingly. There is no deep meaning behind these magic numbers
4564 % used as factors; they just match (closely enough) what Knuth defined.
4566 \def\lineskipfactor{.08333}
4567 \def\strutheightpercent{.70833}
4568 \def\strutdepthpercent {.29167}
4570 \def\setleading#1{%
4571 \normalbaselineskip = #1\relax
4572 \normallineskip = \lineskipfactor\normalbaselineskip
4573 \normalbaselines
4574 \setbox\strutbox =\hbox{%
4575 \vrule width0pt height\strutheightpercent\baselineskip
4576 depth \strutdepthpercent \baselineskip
4580 % @| inserts a changebar to the left of the current line. It should
4581 % surround any changed text. This approach does *not* work if the
4582 % change spans more than two lines of output. To handle that, we would
4583 % have adopt a much more difficult approach (putting marks into the main
4584 % vertical list for the beginning and end of each change).
4586 \def\|{%
4587 % \vadjust can only be used in horizontal mode.
4588 \leavevmode
4590 % Append this vertical mode material after the current line in the output.
4591 \vadjust{%
4592 % We want to insert a rule with the height and depth of the current
4593 % leading; that is exactly what \strutbox is supposed to record.
4594 \vskip-\baselineskip
4596 % \vadjust-items are inserted at the left edge of the type. So
4597 % the \llap here moves out into the left-hand margin.
4598 \llap{%
4600 % For a thicker or thinner bar, change the `1pt'.
4601 \vrule height\baselineskip width1pt
4603 % This is the space between the bar and the text.
4604 \hskip 12pt
4609 % For a final copy, take out the rectangles
4610 % that mark overfull boxes (in case you have decided
4611 % that the text looks ok even though it passes the margin).
4613 \def\finalout{\overfullrule=0pt}
4615 % @image. We use the macros from epsf.tex to support this.
4616 % If epsf.tex is not installed and @image is used, we complain.
4618 % Check for and read epsf.tex up front. If we read it only at @image
4619 % time, we might be inside a group, and then its definitions would get
4620 % undone and the next image would fail.
4621 \openin 1 = xepsf.tex
4622 \ifeof 1 \else
4623 \closein 1
4624 \def\epsfannounce{\toks0 = }% do not bother showing banner
4625 \input epsf.tex
4628 \newif\ifwarnednoepsf
4629 \newhelp\noepsfhelp{epsf.tex must be installed for images to
4630 work. It is also included in the Texinfo distribution, or you can get
4631 it from ftp://ftp.tug.org/tex/epsf.tex.}
4633 % Only complain once about lack of epsf.tex.
4634 \def\image#1{%
4635 \ifx\epsfbox\undefined
4636 \ifwarnednoepsf \else
4637 \errhelp = \noepsfhelp
4638 \errmessage{epsf.tex not found, images will be ignored}%
4639 \global\warnednoepsftrue
4641 \else
4642 \imagexxx #1,,,\finish
4646 % Arguments to @image:
4647 % #1 is (mandatory) image filename; we tack on .eps extension.
4648 % #2 is (optional) width, #3 is (optional) height.
4649 % #4 is just the usual extra ignored arg for parsing this stuff.
4650 \def\imagexxx#1,#2,#3,#4\finish{%
4651 % \epsfbox itself resets \epsf?size at each figure.
4652 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
4653 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
4654 \epsfbox{#1.eps}%
4657 % End of control word definitions.
4660 \message{and turning on texinfo input format.}
4662 \def\openindices{%
4663 \newindex{cp}%
4664 \newcodeindex{fn}%
4665 \newcodeindex{vr}%
4666 \newcodeindex{tp}%
4667 \newcodeindex{ky}%
4668 \newcodeindex{pg}%
4671 % Set some numeric style parameters, for 8.5 x 11 format.
4673 \hsize = 6in
4674 \hoffset = .25in
4675 \newdimen\defaultparindent \defaultparindent = 15pt
4676 \parindent = \defaultparindent
4677 \parskip 3pt plus 2pt minus 1pt
4678 \setleading{13.2pt}
4679 \advance\topskip by 1.2cm
4681 \chapheadingskip = 15pt plus 4pt minus 2pt
4682 \secheadingskip = 12pt plus 3pt minus 2pt
4683 \subsecheadingskip = 9pt plus 2pt minus 2pt
4685 % Prevent underfull vbox error messages.
4686 \vbadness=10000
4688 % Following George Bush, just get rid of widows and orphans.
4689 \widowpenalty=10000
4690 \clubpenalty=10000
4692 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
4693 % using an old version of TeX, don't do anything. We want the amount of
4694 % stretch added to depend on the line length, hence the dependence on
4695 % \hsize. This makes it come to about 9pt for the 8.5x11 format.
4697 \ifx\emergencystretch\thisisundefined
4698 % Allow us to assign to \emergencystretch anyway.
4699 \def\emergencystretch{\dimen0}%
4700 \else
4701 \emergencystretch = \hsize
4702 \divide\emergencystretch by 45
4705 % Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25)
4706 \def\smallbook{
4707 \global\chapheadingskip = 15pt plus 4pt minus 2pt
4708 \global\secheadingskip = 12pt plus 3pt minus 2pt
4709 \global\subsecheadingskip = 9pt plus 2pt minus 2pt
4711 \global\lispnarrowing = 0.3in
4712 \setleading{12pt}
4713 \advance\topskip by -1cm
4714 \global\parskip 2pt plus 1pt
4715 \global\hsize = 5in
4716 \global\vsize=7.5in
4717 \global\tolerance=700
4718 \global\hfuzz=1pt
4719 \global\contentsrightmargin=0pt
4720 \global\deftypemargin=0pt
4721 \global\defbodyindent=.5cm
4723 \global\pagewidth=\hsize
4724 \global\pageheight=\vsize
4726 \global\let\smalllisp=\smalllispx
4727 \global\let\smallexample=\smalllispx
4728 \global\def\Esmallexample{\Esmalllisp}
4731 % Use @afourpaper to print on European A4 paper.
4732 \def\afourpaper{
4733 \global\tolerance=700
4734 \global\hfuzz=1pt
4735 \setleading{12pt}
4736 \global\parskip 15pt plus 1pt
4738 \global\vsize= 53\baselineskip
4739 \advance\vsize by \topskip
4740 %\global\hsize= 5.85in % A4 wide 10pt
4741 \global\hsize= 6.5in
4742 \global\outerhsize=\hsize
4743 \global\advance\outerhsize by 0.5in
4744 \global\outervsize=\vsize
4745 \global\advance\outervsize by 0.6in
4747 \global\pagewidth=\hsize
4748 \global\pageheight=\vsize
4751 \bindingoffset=0pt
4752 \normaloffset=\hoffset
4753 \pagewidth=\hsize
4754 \pageheight=\vsize
4756 % Allow control of the text dimensions. Parameters in order: textheight;
4757 % textwidth; voffset; hoffset; binding offset; topskip.
4758 % All require a dimension;
4759 % header is additional; added length extends the bottom of the page.
4761 \def\changepagesizes#1#2#3#4#5#6{
4762 \global\vsize= #1
4763 \global\topskip= #6
4764 \advance\vsize by \topskip
4765 \global\voffset= #3
4766 \global\hsize= #2
4767 \global\outerhsize=\hsize
4768 \global\advance\outerhsize by 0.5in
4769 \global\outervsize=\vsize
4770 \global\advance\outervsize by 0.6in
4771 \global\pagewidth=\hsize
4772 \global\pageheight=\vsize
4773 \global\normaloffset= #4
4774 \global\bindingoffset= #5}
4776 % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
4777 % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
4778 \def\afourlatex
4779 {\global\tolerance=700
4780 \global\hfuzz=1pt
4781 \setleading{12pt}
4782 \global\parskip 15pt plus 1pt
4783 \advance\baselineskip by 1.6pt
4784 \changepagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}
4787 % Use @afourwide to print on European A4 paper in wide format.
4788 \def\afourwide{\afourpaper
4789 \changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}}
4791 % Define macros to output various characters with catcode for normal text.
4792 \catcode`\"=\other
4793 \catcode`\~=\other
4794 \catcode`\^=\other
4795 \catcode`\_=\other
4796 \catcode`\|=\other
4797 \catcode`\<=\other
4798 \catcode`\>=\other
4799 \catcode`\+=\other
4800 \def\normaldoublequote{"}
4801 \def\normaltilde{~}
4802 \def\normalcaret{^}
4803 \def\normalunderscore{_}
4804 \def\normalverticalbar{|}
4805 \def\normalless{<}
4806 \def\normalgreater{>}
4807 \def\normalplus{+}
4809 % This macro is used to make a character print one way in ttfont
4810 % where it can probably just be output, and another way in other fonts,
4811 % where something hairier probably needs to be done.
4813 % #1 is what to print if we are indeed using \tt; #2 is what to print
4814 % otherwise. Since all the Computer Modern typewriter fonts have zero
4815 % interword stretch (and shrink), and it is reasonable to expect all
4816 % typewriter fonts to have this, we can check that font parameter.
4818 \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
4820 % Turn off all special characters except @
4821 % (and those which the user can use as if they were ordinary).
4822 % Most of these we simply print from the \tt font, but for some, we can
4823 % use math or other variants that look better in normal text.
4825 \catcode`\"=\active
4826 \def\activedoublequote{{\tt \char '042}}
4827 \let"=\activedoublequote
4828 \catcode`\~=\active
4829 \def~{{\tt \char '176}}
4830 \chardef\hat=`\^
4831 \catcode`\^=\active
4832 \def^{{\tt \hat}}
4834 \catcode`\_=\active
4835 \def_{\ifusingtt\normalunderscore\_}
4836 % Subroutine for the previous macro.
4837 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
4839 \catcode`\|=\active
4840 \def|{{\tt \char '174}}
4841 \chardef \less=`\<
4842 \catcode`\<=\active
4843 \def<{{\tt \less}}
4844 \chardef \gtr=`\>
4845 \catcode`\>=\active
4846 \def>{{\tt \gtr}}
4847 \catcode`\+=\active
4848 \def+{{\tt \char 43}}
4849 %\catcode 27=\active
4850 %\def^^[{$\diamondsuit$}
4852 % Set up an active definition for =, but don't enable it most of the time.
4853 {\catcode`\==\active
4854 \global\def={{\tt \char 61}}}
4856 \catcode`+=\active
4857 \catcode`\_=\active
4859 % If a .fmt file is being used, characters that might appear in a file
4860 % name cannot be active until we have parsed the command line.
4861 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
4862 % \otherifyactive is called near the end of this file.
4863 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
4865 \catcode`\@=0
4867 % \rawbackslashxx output one backslash character in current font
4868 \global\chardef\rawbackslashxx=`\\
4869 %{\catcode`\\=\other
4870 %@gdef@rawbackslashxx{\}}
4872 % \rawbackslash redefines \ as input to do \rawbackslashxx.
4873 {\catcode`\\=\active
4874 @gdef@rawbackslash{@let\=@rawbackslashxx }}
4876 % \normalbackslash outputs one backslash in fixed width font.
4877 \def\normalbackslash{{\tt\rawbackslashxx}}
4879 % Say @foo, not \foo, in error messages.
4880 \escapechar=`\@
4882 % \catcode 17=0 % Define control-q
4883 \catcode`\\=\active
4885 % Used sometimes to turn off (effectively) the active characters
4886 % even after parsing them.
4887 @def@turnoffactive{@let"=@normaldoublequote
4888 @let\=@realbackslash
4889 @let~=@normaltilde
4890 @let^=@normalcaret
4891 @let_=@normalunderscore
4892 @let|=@normalverticalbar
4893 @let<=@normalless
4894 @let>=@normalgreater
4895 @let+=@normalplus}
4897 @def@normalturnoffactive{@let"=@normaldoublequote
4898 @let\=@normalbackslash
4899 @let~=@normaltilde
4900 @let^=@normalcaret
4901 @let_=@normalunderscore
4902 @let|=@normalverticalbar
4903 @let<=@normalless
4904 @let>=@normalgreater
4905 @let+=@normalplus}
4907 % Make _ and + \other characters, temporarily.
4908 % This is canceled by @fixbackslash.
4909 @otherifyactive
4911 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
4912 % That is what \eatinput is for; after that, the `\' should revert to printing
4913 % a backslash.
4915 @gdef@eatinput input texinfo{@fixbackslash}
4916 @global@let\ = @eatinput
4918 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
4919 % the first `\{ in the file would cause an error. This macro tries to fix
4920 % that, assuming it is called before the first `\' could plausibly occur.
4921 % Also back turn on active characters that might appear in the input
4922 % file name, in case not using a pre-dumped format.
4924 @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
4925 @catcode`+=@active @catcode`@_=@active}
4927 %% These look ok in all fonts, so just make them not special. The @rm below
4928 %% makes sure that the current font starts out as the newly loaded cmr10
4929 @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
4931 @textfonts
4934 @c Local variables:
4935 @c page-delimiter: "^\\\\message"
4936 @c End: