Include tests/defs in distribution
[automake.git] / lib / texinfo.tex
blob0385dec30d9c1a3bf523b010d8964c0e78f7a945
1 %% TeX macros to handle texinfo files
3 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 1994 Free Software Foundation, Inc.
5 %This texinfo.tex file is free software; you can redistribute it and/or
6 %modify it under the terms of the GNU General Public License as
7 %published by the Free Software Foundation; either version 2, or (at
8 %your option) any later version.
10 %This texinfo.tex file is distributed in the hope that it will be
11 %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 %General Public License for more details.
15 %You should have received a copy of the GNU General Public License
16 %along with this texinfo.tex file; see the file COPYING. If not, write
17 %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
18 %USA.
21 %In other words, you are welcome to use, share and improve this program.
22 %You are forbidden to forbid anyone else to use, share and improve
23 %what you give them. Help stamp out software-hoarding!
26 % Send bug reports to bug-texinfo@prep.ai.mit.edu.
27 % Please include a *precise* test case in each bug report.
30 % Make it possible to create a .fmt file just by loading this file:
31 % if the underlying format is not loaded, start by loading it now.
32 % Added by gildea November 1993.
33 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
35 % This automatically updates the version number based on RCS.
36 \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
37 \deftexinfoversion$Revision: 1.2 $
38 \message{Loading texinfo package [Version \texinfoversion]:}
40 % If in a .fmt file, print the version number
41 % and turn on active characters that we couldn't do earlier because
42 % they might have appeared in the input file name.
43 \everyjob{\message{[Texinfo version \texinfoversion]}\message{}
44 \catcode`+=\active \catcode`\_=\active}
46 % Save some parts of plain tex whose names we will redefine.
48 \let\ptextilde=\~
49 \let\ptexlbrace=\{
50 \let\ptexrbrace=\}
51 \let\ptexdots=\dots
52 \let\ptexdot=\.
53 \let\ptexstar=\*
54 \let\ptexend=\end
55 \let\ptexbullet=\bullet
56 \let\ptexb=\b
57 \let\ptexc=\c
58 \let\ptexi=\i
59 \let\ptext=\t
60 \let\ptexl=\l
61 \let\ptexL=\L
63 % Be sure we're in horizontal mode when doing a tie, since we make space
64 % equivalent to this in @example-like environments. Otherwise, a space
65 % at the beginning of a line will start with \penalty -- and
66 % since \penalty is valid in vertical mode, we'd end up putting the
67 % penalty on the vertical list instead of in the new paragraph.
68 {\catcode`@ = 11
69 % Avoid using \@M directly, because that causes trouble
70 % if the definition is written into an index file.
71 \global\let\tiepenalty = \@M
72 \gdef\tie{\lvvmode\penalty\tiepenalty\ }
74 \let\~ = \tie % And make it available as @~.
76 \message{Basics,}
77 \chardef\other=12
79 % If this character appears in an error message or help string, it
80 % starts a new line in the output.
81 \newlinechar = `^^J
83 % Set up fixed words for English.
84 \ifx\putwordChapter\undefined{\gdef\putwordChapter{Chapter}}\fi%
85 \def\putwordInfo{Info}%
86 \ifx\putwordSee\undefined{\gdef\putwordSee{See}}\fi%
87 \ifx\putwordsee\undefined{\gdef\putwordsee{see}}\fi%
88 \ifx\putwordfile\undefined{\gdef\putwordfile{file}}\fi%
89 \ifx\putwordpage\undefined{\gdef\putwordpage{page}}\fi%
90 \ifx\putwordsection\undefined{\gdef\putwordsection{section}}\fi%
91 \ifx\putwordSection\undefined{\gdef\putwordSection{Section}}\fi%
92 \ifx\putwordTableofContents\undefined{\gdef\putwordTableofContents{Table of Contents}}\fi%
93 \ifx\putwordShortContents\undefined{\gdef\putwordShortContents{Short Contents}}\fi%
94 \ifx\putwordAppendix\undefined{\gdef\putwordAppendix{Appendix}}\fi%
96 % Ignore a token.
98 \def\gobble#1{}
100 \hyphenation{ap-pen-dix}
101 \hyphenation{mini-buf-fer mini-buf-fers}
102 \hyphenation{eshell}
104 % Margin to add to right of even pages, to left of odd pages.
105 \newdimen \bindingoffset \bindingoffset=0pt
106 \newdimen \normaloffset \normaloffset=\hoffset
107 \newdimen\pagewidth \newdimen\pageheight
108 \pagewidth=\hsize \pageheight=\vsize
110 % Sometimes it is convenient to have everything in the transcript file
111 % and nothing on the terminal. We don't just call \tracingall here,
112 % since that produces some useless output on the terminal.
114 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
115 \def\loggingall{\tracingcommands2 \tracingstats2
116 \tracingpages1 \tracingoutput1 \tracinglostchars1
117 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
118 \showboxbreadth\maxdimen\showboxdepth\maxdimen
121 %---------------------Begin change-----------------------
123 %%%% For @cropmarks command.
124 % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
126 \newdimen\cornerlong \newdimen\cornerthick
127 \newdimen \topandbottommargin
128 \newdimen \outerhsize \newdimen \outervsize
129 \cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks
130 \outerhsize=7in
131 %\outervsize=9.5in
132 % Alternative @smallbook page size is 9.25in
133 \outervsize=9.25in
134 \topandbottommargin=.75in
136 %---------------------End change-----------------------
138 % \onepageout takes a vbox as an argument. Note that \pagecontents
139 % does insertions itself, but you have to call it yourself.
140 \chardef\PAGE=255 \output={\onepageout{\pagecontents\PAGE}}
141 \def\onepageout#1{\hoffset=\normaloffset
142 \ifodd\pageno \advance\hoffset by \bindingoffset
143 \else \advance\hoffset by -\bindingoffset\fi
144 {\escapechar=`\\\relax % makes sure backslash is used in output files.
145 \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
146 {\let\hsize=\pagewidth \makefootline}}}%
147 \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
149 %%%% For @cropmarks command %%%%
151 % Here is a modification of the main output routine for Near East Publications
152 % This provides right-angle cropmarks at all four corners.
153 % The contents of the page are centerlined into the cropmarks,
154 % and any desired binding offset is added as an \hskip on either
155 % site of the centerlined box. (P. A. MacKay, 12 November, 1986)
157 \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
158 {\escapechar=`\\\relax % makes sure backslash is used in output files.
159 \shipout
160 \vbox to \outervsize{\hsize=\outerhsize
161 \vbox{\line{\ewtop\hfill\ewtop}}
162 \nointerlineskip
163 \line{\vbox{\moveleft\cornerthick\nstop}
164 \hfill
165 \vbox{\moveright\cornerthick\nstop}}
166 \vskip \topandbottommargin
167 \centerline{\ifodd\pageno\hskip\bindingoffset\fi
168 \vbox{
169 {\let\hsize=\pagewidth \makeheadline}
170 \pagebody{#1}
171 {\let\hsize=\pagewidth \makefootline}}
172 \ifodd\pageno\else\hskip\bindingoffset\fi}
173 \vskip \topandbottommargin plus1fill minus1fill
174 \boxmaxdepth\cornerthick
175 \line{\vbox{\moveleft\cornerthick\nsbot}
176 \hfill
177 \vbox{\moveright\cornerthick\nsbot}}
178 \nointerlineskip
179 \vbox{\line{\ewbot\hfill\ewbot}}
181 \advancepageno
182 \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
184 % Do @cropmarks to get crop marks
185 \def\cropmarks{\let\onepageout=\croppageout }
187 \newinsert\margin \dimen\margin=\maxdimen
189 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
190 {\catcode`\@ =11
191 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
192 % marginal hacks, juha@viisa.uucp (Juha Takala)
193 \ifvoid\margin\else % marginal info is present
194 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
195 \dimen@=\dp#1 \unvbox#1
196 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
197 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
201 % Here are the rules for the cropmarks. Note that they are
202 % offset so that the space between them is truly \outerhsize or \outervsize
203 % (P. A. MacKay, 12 November, 1986)
205 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
206 \def\nstop{\vbox
207 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
208 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
209 \def\nsbot{\vbox
210 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
212 % Parse an argument, then pass it to #1. The argument is the rest of
213 % the input line (except we remove a trailing comment). #1 should be a
214 % macro which expects an ordinary undelimited TeX argument.
216 \def\parsearg#1{%
217 \let\next = #1%
218 \begingroup
219 \obeylines
220 \futurelet\temp\parseargx
223 % If the next token is an obeyed space (from an @example environment or
224 % the like), remove it and recurse. Otherwise, we're done.
225 \def\parseargx{%
226 % \obeyedspace is defined far below, after the definition of \sepspaces.
227 \ifx\obeyedspace\temp
228 \expandafter\parseargdiscardspace
229 \else
230 \expandafter\parseargline
234 % Remove a single space (as the delimiter token to the macro call).
235 {\obeyspaces %
236 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
238 {\obeylines %
239 \gdef\parseargline#1^^M{%
240 \endgroup % End of the group started in \parsearg.
242 % First remove any @c comment, then any @comment.
243 % Result of each macro is put in \toks0.
244 \argremovec #1\c\relax %
245 \expandafter\argremovecomment \the\toks0 \comment\relax %
247 % Call the caller's macro, saved as \next in \parsearg.
248 \expandafter\next\expandafter{\the\toks0}%
252 % Since all \c{,omment} does is throw away the argument, we can let TeX
253 % do that for us. The \relax here is matched by the \relax in the call
254 % in \parseargline; it could be more or less anything, its purpose is
255 % just to delimit the argument to the \c.
256 \def\argremovec#1\c#2\relax{\toks0 = {#1}}
257 \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
259 % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
260 % @end itemize @c foo
261 % will have two active spaces as part of the argument with the
262 % `itemize'. Here we remove all active spaces from #1, and assign the
263 % result to \toks0.
265 % This loses if there are any *other* active characters besides spaces
266 % in the argument -- _ ^ +, for example -- since they get expanded.
267 % Fortunately, Texinfo does not define any such commands. (If it ever
268 % does, the catcode of the characters in questionwill have to be changed
269 % here.) But this means we cannot call \removeactivespaces as part of
270 % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
271 % that \parsearg gets might well have any character at all in it.
273 \def\removeactivespaces#1{%
274 \begingroup
275 \ignoreactivespaces
276 \edef\temp{#1}%
277 \global\toks0 = \expandafter{\temp}%
278 \endgroup
281 % Change the active space to expand to nothing.
283 \begingroup
284 \obeyspaces
285 \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
286 \endgroup
289 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
291 %% These are used to keep @begin/@end levels from running away
292 %% Call \inENV within environments (after a \begingroup)
293 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
294 \def\ENVcheck{%
295 \ifENV\errmessage{Still within an environment. Type Return to continue.}
296 \endgroup\fi} % This is not perfect, but it should reduce lossage
298 % @begin foo is the same as @foo, for now.
299 \newhelp\EMsimple{Type <Return> to continue.}
301 \outer\def\begin{\parsearg\beginxxx}
303 \def\beginxxx #1{%
304 \expandafter\ifx\csname #1\endcsname\relax
305 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
306 \csname #1\endcsname\fi}
308 % @end foo executes the definition of \Efoo.
310 \def\end{\parsearg\endxxx}
311 \def\endxxx #1{%
312 \removeactivespaces{#1}%
313 \edef\endthing{\the\toks0}%
315 \expandafter\ifx\csname E\endthing\endcsname\relax
316 \expandafter\ifx\csname \endthing\endcsname\relax
317 % There's no \foo, i.e., no ``environment'' foo.
318 \errhelp = \EMsimple
319 \errmessage{Undefined command `@end \endthing'}%
320 \else
321 \unmatchedenderror\endthing
323 \else
324 % Everything's ok; the right environment has been started.
325 \csname E\endthing\endcsname
329 % There is an environment #1, but it hasn't been started. Give an error.
331 \def\unmatchedenderror#1{%
332 \errhelp = \EMsimple
333 \errmessage{This `@end #1' doesn't have a matching `@#1'}%
336 % Define the control sequence \E#1 to give an unmatched @end error.
338 \def\defineunmatchedend#1{%
339 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
343 % Single-spacing is done by various environments (specifically, in
344 % \nonfillstart and \quotations).
345 \newskip\singlespaceskip \singlespaceskip = 12.5pt
346 \def\singlespace{%
347 % Why was this kern here? It messes up equalizing space above and below
348 % environments. --karl, 6may93
349 %{\advance \baselineskip by -\singlespaceskip
350 %\kern \baselineskip}%
351 \setleading \singlespaceskip
354 %% Simple single-character @ commands
356 % @@ prints an @
357 % Kludge this until the fonts are right (grr).
358 \def\@{{\tt \char '100}}
360 % This is turned off because it was never documented
361 % and you can use @w{...} around a quote to suppress ligatures.
362 %% Define @` and @' to be the same as ` and '
363 %% but suppressing ligatures.
364 %\def\`{{`}}
365 %\def\'{{'}}
367 % Used to generate quoted braces.
369 \def\mylbrace {{\tt \char '173}}
370 \def\myrbrace {{\tt \char '175}}
371 \let\{=\mylbrace
372 \let\}=\myrbrace
374 % @: forces normal size whitespace following.
375 \def\:{\spacefactor=1000 }
377 % @* forces a line break.
378 \def\*{\hfil\break\hbox{}\ignorespaces}
380 % @. is an end-of-sentence period.
381 \def\.{.\spacefactor=3000 }
383 % @enddots{} is an end-of-sentence ellipsis.
384 \gdef\enddots{$\mathinner{\ldotp\ldotp\ldotp\ldotp}$\spacefactor=3000}
386 % @! is an end-of-sentence bang.
387 \gdef\!{!\spacefactor=3000 }
389 % @? is an end-of-sentence query.
390 \gdef\?{?\spacefactor=3000 }
392 % @w prevents a word break. Without the \leavevmode, @w at the
393 % beginning of a paragraph, when TeX is still in vertical mode, would
394 % produce a whole line of output instead of starting the paragraph.
395 \def\w#1{\leavevmode\hbox{#1}}
397 % @group ... @end group forces ... to be all on one page, by enclosing
398 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
399 % to keep its height that of a normal line. According to the rules for
400 % \topskip (p.114 of the TeXbook), the glue inserted is
401 % max (\topskip - \ht (first item), 0). If that height is large,
402 % therefore, no glue is inserted, and the space between the headline and
403 % the text is small, which looks bad.
405 \def\group{\begingroup
406 \ifnum\catcode13=\active \else
407 \errhelp = \groupinvalidhelp
408 \errmessage{@group invalid in context where filling is enabled}%
411 % The \vtop we start below produces a box with normal height and large
412 % depth; thus, TeX puts \baselineskip glue before it, and (when the
413 % next line of text is done) \lineskip glue after it. (See p.82 of
414 % the TeXbook.) Thus, space below is not quite equal to space
415 % above. But it's pretty close.
416 \def\Egroup{%
417 \egroup % End the \vtop.
418 \endgroup % End the \group.
421 \vtop\bgroup
422 % We have to put a strut on the last line in case the @group is in
423 % the midst of an example, rather than completely enclosing it.
424 % Otherwise, the interline space between the last line of the group
425 % and the first line afterwards is too small. But we can't put the
426 % strut in \Egroup, since there it would be on a line by itself.
427 % Hence this just inserts a strut at the beginning of each line.
428 \everypar = {\strut}%
430 % Since we have a strut on every line, we don't need any of TeX's
431 % normal interline spacing.
432 \offinterlineskip
434 % OK, but now we have to do something about blank
435 % lines in the input in @example-like environments, which normally
436 % just turn into \lisppar, which will insert no space now that we've
437 % turned off the interline space. Simplest is to make them be an
438 % empty paragraph.
439 \ifx\par\lisppar
440 \edef\par{\leavevmode \par}%
442 % Reset ^^M's definition to new definition of \par.
443 \obeylines
446 % Do @comment since we are called inside an environment such as
447 % @example, where each end-of-line in the input causes an
448 % end-of-line in the output. We don't want the end-of-line after
449 % the `@group' to put extra space in the output. Since @group
450 % should appear on a line by itself (according to the Texinfo
451 % manual), we don't worry about eating any user text.
452 \comment
455 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
456 % message, so this ends up printing `@group can only ...'.
458 \newhelp\groupinvalidhelp{%
459 group can only be used in environments such as @example,^^J%
460 where each line of input produces a line of output.}
462 % @need space-in-mils
463 % forces a page break if there is not space-in-mils remaining.
465 \newdimen\mil \mil=0.001in
467 \def\need{\parsearg\needx}
469 % Old definition--didn't work.
470 %\def\needx #1{\par %
471 %% This method tries to make TeX break the page naturally
472 %% if the depth of the box does not fit.
473 %{\baselineskip=0pt%
474 %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
475 %\prevdepth=-1000pt
478 \def\needx#1{%
479 % Go into vertical mode, so we don't make a big box in the middle of a
480 % paragraph.
481 \par
483 % Don't add any leading before our big empty box, but allow a page
484 % break, since the best break might be right here.
485 \allowbreak
486 \nointerlineskip
487 \vtop to #1\mil{\vfil}%
489 % TeX does not even consider page breaks if a penalty added to the
490 % main vertical list is 10000 or more. But in order to see if the
491 % empty box we just added fits on the page, we must make it consider
492 % page breaks. On the other hand, we don't want to actually break the
493 % page after the empty box. So we use a penalty of 9999.
495 % There is an extremely small chance that TeX will actually break the
496 % page at this \penalty, if there are no other feasible breakpoints in
497 % sight. (If the user is using lots of big @group commands, which
498 % almost-but-not-quite fill up a page, TeX will have a hard time doing
499 % good page breaking, for example.) However, I could not construct an
500 % example where a page broke at this \penalty; if it happens in a real
501 % document, then we can reconsider our strategy.
502 \penalty9999
504 % Back up by the size of the box, whether we did a page break or not.
505 \kern -#1\mil
507 % Do not allow a page break right after this kern.
508 \nobreak
511 % @br forces paragraph break
513 \let\br = \par
515 % @dots{} output some dots
517 \def\dots{$\ldots$}
519 % @page forces the start of a new page
521 \def\page{\par\vfill\supereject}
523 % @exdent text....
524 % outputs text on separate line in roman font, starting at standard page margin
526 % This records the amount of indent in the innermost environment.
527 % That's how much \exdent should take out.
528 \newskip\exdentamount
530 % This defn is used inside fill environments such as @defun.
531 \def\exdent{\parsearg\exdentyyy}
532 \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
534 % This defn is used inside nofill environments such as @example.
535 \def\nofillexdent{\parsearg\nofillexdentyyy}
536 \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
537 \leftline{\hskip\leftskip{\rm#1}}}}
539 %\hbox{{\rm#1}}\hfil\break}}
541 % @include file insert text of that file as input.
543 \def\include{\parsearg\includezzz}
544 %Use \input\thisfile to avoid blank after \input, which may be an active
545 %char (in which case the blank would become the \input argument).
546 %The grouping keeps the value of \thisfile correct even when @include
547 %is nested.
548 \def\includezzz #1{\begingroup
549 \def\thisfile{#1}\input\thisfile
550 \endgroup}
552 \def\thisfile{}
554 % @center line outputs that line, centered
556 \def\center{\parsearg\centerzzz}
557 \def\centerzzz #1{{\advance\hsize by -\leftskip
558 \advance\hsize by -\rightskip
559 \centerline{#1}}}
561 % @sp n outputs n lines of vertical space
563 \def\sp{\parsearg\spxxx}
564 \def\spxxx #1{\par \vskip #1\baselineskip}
566 % @comment ...line which is ignored...
567 % @c is the same as @comment
568 % @ignore ... @end ignore is another way to write a comment
570 \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
571 \parsearg \commentxxx}
573 \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
575 \let\c=\comment
577 % Prevent errors for section commands.
578 % Used in @ignore and in failing conditionals.
579 \def\ignoresections{%
580 \let\chapter=\relax
581 \let\unnumbered=\relax
582 \let\top=\relax
583 \let\unnumberedsec=\relax
584 \let\unnumberedsection=\relax
585 \let\unnumberedsubsec=\relax
586 \let\unnumberedsubsection=\relax
587 \let\unnumberedsubsubsec=\relax
588 \let\unnumberedsubsubsection=\relax
589 \let\section=\relax
590 \let\subsec=\relax
591 \let\subsubsec=\relax
592 \let\subsection=\relax
593 \let\subsubsection=\relax
594 \let\appendix=\relax
595 \let\appendixsec=\relax
596 \let\appendixsection=\relax
597 \let\appendixsubsec=\relax
598 \let\appendixsubsection=\relax
599 \let\appendixsubsubsec=\relax
600 \let\appendixsubsubsection=\relax
601 \let\contents=\relax
602 \let\smallbook=\relax
603 \let\titlepage=\relax
606 % Used in nested conditionals, where we have to parse the Texinfo source
607 % and so want to turn off most commands, in case they are used
608 % incorrectly.
610 \def\ignoremorecommands{%
611 \let\defcv = \relax
612 \let\deffn = \relax
613 \let\deffnx = \relax
614 \let\defindex = \relax
615 \let\defivar = \relax
616 \let\defmac = \relax
617 \let\defmethod = \relax
618 \let\defop = \relax
619 \let\defopt = \relax
620 \let\defspec = \relax
621 \let\deftp = \relax
622 \let\deftypefn = \relax
623 \let\deftypefun = \relax
624 \let\deftypevar = \relax
625 \let\deftypevr = \relax
626 \let\defun = \relax
627 \let\defvar = \relax
628 \let\defvr = \relax
629 \let\ref = \relax
630 \let\xref = \relax
631 \let\printindex = \relax
632 \let\pxref = \relax
633 \let\settitle = \relax
634 \let\include = \relax
635 \let\lowersections = \relax
636 \let\down = \relax
637 \let\raisesections = \relax
638 \let\up = \relax
639 \let\set = \relax
640 \let\clear = \relax
641 \let\item = \relax
642 \let\message = \relax
645 % Ignore @ignore ... @end ignore.
647 \def\ignore{\doignore{ignore}}
649 % Also ignore @ifinfo, @ifhtml, @html, @menu, and @direntry text.
651 \def\ifinfo{\doignore{ifinfo}}
652 \def\ifhtml{\doignore{ifhtml}}
653 \def\html{\doignore{html}}
654 \def\menu{\doignore{menu}}
655 \def\direntry{\doignore{direntry}}
657 % Ignore text until a line `@end #1'.
659 \def\doignore#1{\begingroup
660 % Don't complain about control sequences we have declared \outer.
661 \ignoresections
663 % Define a command to swallow text until we reach `@end #1'.
664 \long\def\doignoretext##1\end #1{\enddoignore}%
666 % Make sure that spaces turn into tokens that match what \doignoretext wants.
667 \catcode32 = 10
669 % And now expand that command.
670 \doignoretext
673 % What we do to finish off ignored text.
675 \def\enddoignore{\endgroup\ignorespaces}%
677 \newif\ifwarnedobs\warnedobsfalse
678 \def\obstexwarn{%
679 \ifwarnedobs\relax\else
680 % We need to warn folks that they may have trouble with TeX 3.0.
681 % This uses \immediate\write16 rather than \message to get newlines.
682 \immediate\write16{}
683 \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
684 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
685 \immediate\write16{If you are running another version of TeX, relax.}
686 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
687 \immediate\write16{ Then upgrade your TeX installation if you can.}
688 \immediate\write16{If you are stuck with version 3.0, run the}
689 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
690 \immediate\write16{ to use a workaround.}
691 \immediate\write16{}
692 \warnedobstrue
696 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
697 % workaround (which requires the file ``dummy.tfm'' to be installed),
698 % uncomment the following line:
699 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
701 % Ignore text, except that we keep track of conditional commands for
702 % purposes of nesting, up to an `@end #1' command.
704 \def\nestedignore#1{%
705 \obstexwarn
706 % We must actually expand the ignored text to look for the @end
707 % command, so that nested ignore constructs work. Thus, we put the
708 % text into a \vbox and then do nothing with the result. To minimize
709 % the change of memory overflow, we follow the approach outlined on
710 % page 401 of the TeXbook: make the current font be a dummy font.
712 \setbox0 = \vbox\bgroup
713 % Don't complain about control sequences we have declared \outer.
714 \ignoresections
716 % Define `@end #1' to end the box, which will in turn undefine the
717 % @end command again.
718 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
720 % We are going to be parsing Texinfo commands. Most cause no
721 % trouble when they are used incorrectly, but some commands do
722 % complicated argument parsing or otherwise get confused, so we
723 % undefine them.
725 % We can't do anything about stray @-signs, unfortunately;
726 % they'll produce `undefined control sequence' errors.
727 \ignoremorecommands
729 % Set the current font to be \nullfont, a TeX primitive, and define
730 % all the font commands to also use \nullfont. We don't use
731 % dummy.tfm, as suggested in the TeXbook, because not all sites
732 % might have that installed. Therefore, math mode will still
733 % produce output, but that should be an extremely small amount of
734 % stuff compared to the main input.
736 \nullfont
737 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
738 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
739 \let\tensf = \nullfont
740 % Similarly for index fonts (mostly for their use in
741 % smallexample)
742 \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
743 \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
744 \let\indsf = \nullfont
746 % Don't complain when characters are missing from the fonts.
747 \tracinglostchars = 0
749 % Don't bother to do space factor calculations.
750 \frenchspacing
752 % Don't report underfull hboxes.
753 \hbadness = 10000
755 % Do minimal line-breaking.
756 \pretolerance = 10000
758 % Do not execute instructions in @tex
759 \def\tex{\doignore{tex}}
762 % @set VAR sets the variable VAR to an empty value.
763 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
765 % Since we want to separate VAR from REST-OF-LINE (which might be
766 % empty), we can't just use \parsearg; we have to insert a space of our
767 % own to delimit the rest of the line, and then take it out again if we
768 % didn't need it.
770 \def\set{\parsearg\setxxx}
771 \def\setxxx#1{\setyyy#1 \endsetyyy}
772 \def\setyyy#1 #2\endsetyyy{%
773 \def\temp{#2}%
774 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
775 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
778 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
779 % \next or other control sequences that we've defined might get us into
780 % an infinite loop. Consider `@set foo @cite{bar}'.
781 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
783 % @clear VAR clears (i.e., unsets) the variable VAR.
785 \def\clear{\parsearg\clearxxx}
786 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
788 % @value{foo} gets the text saved in variable foo.
790 \def\value#1{\expandafter
791 \ifx\csname SET#1\endcsname\relax
792 {\{No value for ``#1''\}}
793 \else \csname SET#1\endcsname \fi}
795 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
796 % with @set.
798 \def\ifset{\parsearg\ifsetxxx}
799 \def\ifsetxxx #1{%
800 \expandafter\ifx\csname SET#1\endcsname\relax
801 \expandafter\ifsetfail
802 \else
803 \expandafter\ifsetsucceed
806 \def\ifsetsucceed{\conditionalsucceed{ifset}}
807 \def\ifsetfail{\nestedignore{ifset}}
808 \defineunmatchedend{ifset}
810 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
811 % defined with @set, or has been undefined with @clear.
813 \def\ifclear{\parsearg\ifclearxxx}
814 \def\ifclearxxx #1{%
815 \expandafter\ifx\csname SET#1\endcsname\relax
816 \expandafter\ifclearsucceed
817 \else
818 \expandafter\ifclearfail
821 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
822 \def\ifclearfail{\nestedignore{ifclear}}
823 \defineunmatchedend{ifclear}
825 % @iftex always succeeds; we read the text following, through @end
826 % iftex). But `@end iftex' should be valid only after an @iftex.
828 \def\iftex{\conditionalsucceed{iftex}}
829 \defineunmatchedend{iftex}
831 % We can't just want to start a group at @iftex (for example) and end it
832 % at @end iftex, since then @set commands inside the conditional have no
833 % effect (they'd get reverted at the end of the group). So we must
834 % define \Eiftex to redefine itself to be its previous value. (We can't
835 % just define it to fail again with an ``unmatched end'' error, since
836 % the @ifset might be nested.)
838 \def\conditionalsucceed#1{%
839 \edef\temp{%
840 % Remember the current value of \E#1.
841 \let\nece{prevE#1} = \nece{E#1}%
843 % At the `@end #1', redefine \E#1 to be its previous value.
844 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
846 \temp
849 % We need to expand lots of \csname's, but we don't want to expand the
850 % control sequences after we've constructed them.
852 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
854 % @asis just yields its argument. Used with @table, for example.
856 \def\asis#1{#1}
858 % @math means output in math mode.
859 % We don't use $'s directly in the definition of \math because control
860 % sequences like \math are expanded when the toc file is written. Then,
861 % we read the toc file back, the $'s will be normal characters (as they
862 % should be, according to the definition of Texinfo). So we must use a
863 % control sequence to switch into and out of math mode.
865 % This isn't quite enough for @math to work properly in indices, but it
866 % seems unlikely it will ever be needed there.
868 \let\implicitmath = $
869 \def\math#1{\implicitmath #1\implicitmath}
871 % @bullet and @minus need the same treatment as @math, just above.
872 \def\bullet{\implicitmath\ptexbullet\implicitmath}
873 \def\minus{\implicitmath-\implicitmath}
875 \def\node{\ENVcheck\parsearg\nodezzz}
876 \def\nodezzz#1{\nodexxx [#1,]}
877 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
878 \let\nwnode=\node
879 \let\lastnode=\relax
881 \def\donoderef{\ifx\lastnode\relax\else
882 \expandafter\expandafter\expandafter\setref{\lastnode}\fi
883 \global\let\lastnode=\relax}
885 \def\unnumbnoderef{\ifx\lastnode\relax\else
886 \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
887 \global\let\lastnode=\relax}
889 \def\appendixnoderef{\ifx\lastnode\relax\else
890 \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
891 \global\let\lastnode=\relax}
893 \let\refill=\relax
895 % @setfilename is done at the beginning of every texinfo file.
896 % So open here the files we need to have open while reading the input.
897 % This makes it possible to make a .fmt file for texinfo.
898 \def\setfilename{%
899 \readauxfile
900 \opencontents
901 \openindices
902 \fixbackslash % Turn off hack to swallow `\input texinfo'.
903 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
904 \comment % Ignore the actual filename.
907 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
909 \def\inforef #1{\inforefzzz #1,,,,**}
910 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
911 node \samp{\ignorespaces#1{}}}
913 \message{fonts,}
915 % Font-change commands.
917 % Texinfo supports the sans serif font style, which plain TeX does not.
918 % So we set up a \sf analogous to plain's \rm, etc.
919 \newfam\sffam
920 \def\sf{\fam=\sffam \tensf}
921 \let\li = \sf % Sometimes we call it \li, not \sf.
923 %% Try out Computer Modern fonts at \magstephalf
924 \let\mainmagstep=\magstephalf
926 % Set the font macro #1 to the font named #2, adding on the
927 % specified font prefix (normally `cm').
928 \def\setfont#1#2{\font#1=\fontprefix#2}
930 % Use cm as the default font prefix.
931 % To specify the font prefix, you must define \fontprefix
932 % before you read in texinfo.tex.
933 \ifx\fontprefix\undefined
934 \def\fontprefix{cm}
937 \ifx\bigger\relax
938 \let\mainmagstep=\magstep1
939 \setfont\textrm{r12}
940 \setfont\texttt{tt12}
941 \else
942 \setfont\textrm{r10 scaled \mainmagstep}
943 \setfont\texttt{tt10 scaled \mainmagstep}
945 % Instead of cmb10, you many want to use cmbx10.
946 % cmbx10 is a prettier font on its own, but cmb10
947 % looks better when embedded in a line with cmr10.
948 \setfont\textbf{b10 scaled \mainmagstep}
949 \setfont\textit{ti10 scaled \mainmagstep}
950 \setfont\textsl{sl10 scaled \mainmagstep}
951 \setfont\textsf{ss10 scaled \mainmagstep}
952 \setfont\textsc{csc10 scaled \mainmagstep}
953 \font\texti=cmmi10 scaled \mainmagstep
954 \font\textsy=cmsy10 scaled \mainmagstep
956 % A few fonts for @defun, etc.
957 \setfont\defbf{bx10 scaled \magstep1} %was 1314
958 \setfont\deftt{tt10 scaled \magstep1}
959 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
961 % Fonts for indices and small examples.
962 % We actually use the slanted font rather than the italic,
963 % because texinfo normally uses the slanted fonts for that.
964 % Do not make many font distinctions in general in the index, since they
965 % aren't very useful.
966 \setfont\ninett{tt9}
967 \setfont\indrm{r9}
968 \setfont\indit{sl9}
969 \let\indsl=\indit
970 \let\indtt=\ninett
971 \let\indsf=\indrm
972 \let\indbf=\indrm
973 \setfont\indsc{csc10 at 9pt}
974 \font\indi=cmmi9
975 \font\indsy=cmsy9
977 % Fonts for headings
978 \setfont\chaprm{bx12 scaled \magstep2}
979 \setfont\chapit{ti12 scaled \magstep2}
980 \setfont\chapsl{sl12 scaled \magstep2}
981 \setfont\chaptt{tt12 scaled \magstep2}
982 \setfont\chapsf{ss12 scaled \magstep2}
983 \let\chapbf=\chaprm
984 \setfont\chapsc{csc10 scaled\magstep3}
985 \font\chapi=cmmi12 scaled \magstep2
986 \font\chapsy=cmsy10 scaled \magstep3
988 \setfont\secrm{bx12 scaled \magstep1}
989 \setfont\secit{ti12 scaled \magstep1}
990 \setfont\secsl{sl12 scaled \magstep1}
991 \setfont\sectt{tt12 scaled \magstep1}
992 \setfont\secsf{ss12 scaled \magstep1}
993 \setfont\secbf{bx12 scaled \magstep1}
994 \setfont\secsc{csc10 scaled\magstep2}
995 \font\seci=cmmi12 scaled \magstep1
996 \font\secsy=cmsy10 scaled \magstep2
998 % \setfont\ssecrm{bx10 scaled \magstep1} % This size an font looked bad.
999 % \setfont\ssecit{cmti10 scaled \magstep1} % The letters were too crowded.
1000 % \setfont\ssecsl{sl10 scaled \magstep1}
1001 % \setfont\ssectt{tt10 scaled \magstep1}
1002 % \setfont\ssecsf{ss10 scaled \magstep1}
1004 %\setfont\ssecrm{b10 scaled 1315} % Note the use of cmb rather than cmbx.
1005 %\setfont\ssecit{ti10 scaled 1315} % Also, the size is a little larger than
1006 %\setfont\ssecsl{sl10 scaled 1315} % being scaled magstep1.
1007 %\setfont\ssectt{tt10 scaled 1315}
1008 %\setfont\ssecsf{ss10 scaled 1315}
1010 %\let\ssecbf=\ssecrm
1012 \setfont\ssecrm{bx12 scaled \magstephalf}
1013 \setfont\ssecit{ti12 scaled \magstephalf}
1014 \setfont\ssecsl{sl12 scaled \magstephalf}
1015 \setfont\ssectt{tt12 scaled \magstephalf}
1016 \setfont\ssecsf{ss12 scaled \magstephalf}
1017 \setfont\ssecbf{bx12 scaled \magstephalf}
1018 \setfont\ssecsc{csc10 scaled \magstep1}
1019 \font\sseci=cmmi12 scaled \magstephalf
1020 \font\ssecsy=cmsy10 scaled \magstep1
1021 % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
1022 % but that is not a standard magnification.
1024 % Fonts for title page:
1025 \setfont\titlerm{bx12 scaled \magstep3}
1026 \let\authorrm = \secrm
1028 % In order for the font changes to affect most math symbols and letters,
1029 % we have to define the \textfont of the standard families. Since
1030 % texinfo doesn't allow for producing subscripts and superscripts, we
1031 % don't bother to reset \scriptfont and \scriptscriptfont (which would
1032 % also require loading a lot more fonts).
1034 \def\resetmathfonts{%
1035 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1036 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1037 \textfont\ttfam = \tentt \textfont\sffam = \tensf
1041 % The font-changing commands redefine the meanings of \tenSTYLE, instead
1042 % of just \STYLE. We do this so that font changes will continue to work
1043 % in math mode, where it is the current \fam that is relevant in most
1044 % cases, not the current. Plain TeX does, for example,
1045 % \def\bf{\fam=\bffam \tenbf} By redefining \tenbf, we obviate the need
1046 % to redefine \bf itself.
1047 \def\textfonts{%
1048 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
1049 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
1050 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
1051 \resetmathfonts}
1052 \def\chapfonts{%
1053 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
1054 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
1055 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
1056 \resetmathfonts}
1057 \def\secfonts{%
1058 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
1059 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
1060 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
1061 \resetmathfonts}
1062 \def\subsecfonts{%
1063 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1064 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1065 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
1066 \resetmathfonts}
1067 \def\indexfonts{%
1068 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
1069 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
1070 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
1071 \resetmathfonts}
1073 % Set up the default fonts, so we can use them for creating boxes.
1075 \textfonts
1077 % Count depth in font-changes, for error checks
1078 \newcount\fontdepth \fontdepth=0
1080 % Fonts for short table of contents.
1081 \setfont\shortcontrm{r12}
1082 \setfont\shortcontbf{bx12}
1083 \setfont\shortcontsl{sl12}
1085 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
1086 %% serif) and @ii for TeX italic
1088 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1089 % unless the following character is such as not to need one.
1090 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1091 \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
1093 \let\i=\smartitalic
1094 \let\var=\smartitalic
1095 \let\dfn=\smartitalic
1096 \let\emph=\smartitalic
1097 \let\cite=\smartitalic
1099 \def\b#1{{\bf #1}}
1100 \let\strong=\b
1102 % We can't just use \exhyphenpenalty, because that only has effect at
1103 % the end of a paragraph. Restore normal hyphenation at the end of the
1104 % group within which \nohyphenation is presumably called.
1106 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
1107 \def\restorehyphenation{\hyphenchar\font = `- }
1109 \def\t#1{%
1110 {\tt \rawbackslash \frenchspacing #1}%
1111 \null
1113 \let\ttfont=\t
1114 \def\samp #1{`\tclose{#1}'\null}
1115 \def\key #1{{\tt \nohyphenation \uppercase{#1}}\null}
1116 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1118 \let\file=\samp
1120 % @code is a modification of @t,
1121 % which makes spaces the same size as normal in the surrounding text.
1122 \def\tclose#1{%
1124 % Change normal interword space to be same as for the current font.
1125 \spaceskip = \fontdimen2\font
1127 % Switch to typewriter.
1130 % But `\ ' produces the large typewriter interword space.
1131 \def\ {{\spaceskip = 0pt{} }}%
1133 % Turn off hyphenation.
1134 \nohyphenation
1136 \rawbackslash
1137 \frenchspacing
1140 \null
1143 % We *must* turn on hyphenation at `-' and `_' in \code.
1144 % Otherwise, it is too hard to avoid overful hboxes
1145 % in the Emacs manual, the Library manual, etc.
1147 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
1148 % both hyphenation at - and hyphenation within words.
1149 % We must therefore turn them both off (\tclose does that)
1150 % and arrange explicitly to hyphenate an a dash.
1151 % -- rms.
1153 \catcode`\-=\active
1154 \catcode`\_=\active
1155 \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
1156 % The following is used by \doprintindex to insure that long function names
1157 % wrap around. It is necessary for - and _ to be active before the index is
1158 % read from the file, as \entry parses the arguments long before \code is
1159 % ever called. -- mycroft
1160 \global\def\indexbreaks{\catcode`\-=\active \let-\realdash \catcode`\_=\active \let_\realunder}
1163 \def\realdash{-}
1164 \def\realunder{_}
1165 \def\codedash{-\discretionary{}{}{}}
1166 \def\codeunder{\normalunderscore\discretionary{}{}{}}
1167 \def\codex #1{\tclose{#1}\endgroup}
1169 %\let\exp=\tclose %Was temporary
1171 % @kbd is like @code, except that if the argument is just one @key command,
1172 % then @kbd has no effect.
1174 \def\xkey{\key}
1175 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1176 \ifx\one\xkey\ifx\threex\three \key{#2}%
1177 \else\tclose{\look}\fi
1178 \else\tclose{\look}\fi}
1180 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1181 % argument is to make the input look right: @dmn{pt} instead of
1182 % @dmn{}pt.
1184 \def\dmn#1{\thinspace #1}
1186 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1188 \def\l#1{{\li #1}\null} %
1190 \def\r#1{{\rm #1}} % roman font
1191 % Use of \lowercase was suggested.
1192 \def\sc#1{{\smallcaps#1}} % smallcaps font
1193 \def\ii#1{{\it #1}} % italic font
1195 \message{page headings,}
1197 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
1198 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
1200 % First the title page. Must do @settitle before @titlepage.
1201 \def\titlefont#1{{\titlerm #1}}
1203 \newif\ifseenauthor
1204 \newif\iffinishedtitlepage
1206 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1207 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1208 \endgroup\page\hbox{}\page}
1210 \def\titlepage{\begingroup \parindent=0pt \textfonts
1211 \let\subtitlerm=\tenrm
1212 % I deinstalled the following change because \cmr12 is undefined.
1213 % This change was not in the ChangeLog anyway. --rms.
1214 % \let\subtitlerm=\cmr12
1215 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1217 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1219 % Leave some space at the very top of the page.
1220 \vglue\titlepagetopglue
1222 % Now you can print the title using @title.
1223 \def\title{\parsearg\titlezzz}%
1224 \def\titlezzz##1{\leftline{\titlefont{##1}}
1225 % print a rule at the page bottom also.
1226 \finishedtitlepagefalse
1227 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
1228 % No rule at page bottom unless we print one at the top with @title.
1229 \finishedtitlepagetrue
1231 % Now you can put text using @subtitle.
1232 \def\subtitle{\parsearg\subtitlezzz}%
1233 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
1235 % @author should come last, but may come many times.
1236 \def\author{\parsearg\authorzzz}%
1237 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
1238 {\authorfont \leftline{##1}}}%
1240 % Most title ``pages'' are actually two pages long, with space
1241 % at the top of the second. We don't want the ragged left on the second.
1242 \let\oldpage = \page
1243 \def\page{%
1244 \iffinishedtitlepage\else
1245 \finishtitlepage
1247 \oldpage
1248 \let\page = \oldpage
1249 \hbox{}}%
1250 % \def\page{\oldpage \hbox{}}
1253 \def\Etitlepage{%
1254 \iffinishedtitlepage\else
1255 \finishtitlepage
1257 % It is important to do the page break before ending the group,
1258 % because the headline and footline are only empty inside the group.
1259 % If we use the new definition of \page, we always get a blank page
1260 % after the title page, which we certainly don't want.
1261 \oldpage
1262 \endgroup
1263 \HEADINGSon
1266 \def\finishtitlepage{%
1267 \vskip4pt \hrule height 2pt width \hsize
1268 \vskip\titlepagebottomglue
1269 \finishedtitlepagetrue
1272 %%% Set up page headings and footings.
1274 \let\thispage=\folio
1276 \newtoks \evenheadline % Token sequence for heading line of even pages
1277 \newtoks \oddheadline % Token sequence for heading line of odd pages
1278 \newtoks \evenfootline % Token sequence for footing line of even pages
1279 \newtoks \oddfootline % Token sequence for footing line of odd pages
1281 % Now make Tex use those variables
1282 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1283 \else \the\evenheadline \fi}}
1284 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1285 \else \the\evenfootline \fi}\HEADINGShook}
1286 \let\HEADINGShook=\relax
1288 % Commands to set those variables.
1289 % For example, this is what @headings on does
1290 % @evenheading @thistitle|@thispage|@thischapter
1291 % @oddheading @thischapter|@thispage|@thistitle
1292 % @evenfooting @thisfile||
1293 % @oddfooting ||@thisfile
1295 \def\evenheading{\parsearg\evenheadingxxx}
1296 \def\oddheading{\parsearg\oddheadingxxx}
1297 \def\everyheading{\parsearg\everyheadingxxx}
1299 \def\evenfooting{\parsearg\evenfootingxxx}
1300 \def\oddfooting{\parsearg\oddfootingxxx}
1301 \def\everyfooting{\parsearg\everyfootingxxx}
1303 {\catcode`\@=0 %
1305 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
1306 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
1307 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1309 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
1310 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
1311 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1313 \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
1314 \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
1315 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
1316 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1318 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
1319 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
1320 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1322 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
1323 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
1324 \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1326 \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
1327 \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
1328 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
1329 \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
1331 }% unbind the catcode of @.
1333 % @headings double turns headings on for double-sided printing.
1334 % @headings single turns headings on for single-sided printing.
1335 % @headings off turns them off.
1336 % @headings on same as @headings double, retained for compatibility.
1337 % @headings after turns on double-sided headings after this page.
1338 % @headings doubleafter turns on double-sided headings after this page.
1339 % @headings singleafter turns on single-sided headings after this page.
1340 % By default, they are off.
1342 \def\headings #1 {\csname HEADINGS#1\endcsname}
1344 \def\HEADINGSoff{
1345 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
1346 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
1347 \HEADINGSoff
1348 % When we turn headings on, set the page number to 1.
1349 % For double-sided printing, put current file name in lower left corner,
1350 % chapter name on inside top of right hand pages, document
1351 % title on inside top of left hand pages, and page numbers on outside top
1352 % edge of all pages.
1353 \def\HEADINGSdouble{
1354 %\pagealignmacro
1355 \global\pageno=1
1356 \global\evenfootline={\hfil}
1357 \global\oddfootline={\hfil}
1358 \global\evenheadline={\line{\folio\hfil\thistitle}}
1359 \global\oddheadline={\line{\thischapter\hfil\folio}}
1361 % For single-sided printing, chapter title goes across top left of page,
1362 % page number on top right.
1363 \def\HEADINGSsingle{
1364 %\pagealignmacro
1365 \global\pageno=1
1366 \global\evenfootline={\hfil}
1367 \global\oddfootline={\hfil}
1368 \global\evenheadline={\line{\thischapter\hfil\folio}}
1369 \global\oddheadline={\line{\thischapter\hfil\folio}}
1371 \def\HEADINGSon{\HEADINGSdouble}
1373 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
1374 \let\HEADINGSdoubleafter=\HEADINGSafter
1375 \def\HEADINGSdoublex{%
1376 \global\evenfootline={\hfil}
1377 \global\oddfootline={\hfil}
1378 \global\evenheadline={\line{\folio\hfil\thistitle}}
1379 \global\oddheadline={\line{\thischapter\hfil\folio}}
1382 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
1383 \def\HEADINGSsinglex{%
1384 \global\evenfootline={\hfil}
1385 \global\oddfootline={\hfil}
1386 \global\evenheadline={\line{\thischapter\hfil\folio}}
1387 \global\oddheadline={\line{\thischapter\hfil\folio}}
1390 % Subroutines used in generating headings
1391 % Produces Day Month Year style of output.
1392 \def\today{\number\day\space
1393 \ifcase\month\or
1394 January\or February\or March\or April\or May\or June\or
1395 July\or August\or September\or October\or November\or December\fi
1396 \space\number\year}
1398 % Use this if you want the Month Day, Year style of output.
1399 %\def\today{\ifcase\month\or
1400 %January\or February\or March\or April\or May\or June\or
1401 %July\or August\or September\or October\or November\or December\fi
1402 %\space\number\day, \number\year}
1404 % @settitle line... specifies the title of the document, for headings
1405 % It generates no output of its own
1407 \def\thistitle{No Title}
1408 \def\settitle{\parsearg\settitlezzz}
1409 \def\settitlezzz #1{\gdef\thistitle{#1}}
1411 \message{tables,}
1413 % @tabs -- simple alignment
1415 % These don't work. For one thing, \+ is defined as outer.
1416 % So these macros cannot even be defined.
1418 %\def\tabs{\parsearg\tabszzz}
1419 %\def\tabszzz #1{\settabs\+#1\cr}
1420 %\def\tabline{\parsearg\tablinezzz}
1421 %\def\tablinezzz #1{\+#1\cr}
1422 %\def\&{&}
1424 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1426 % default indentation of table text
1427 \newdimen\tableindent \tableindent=.8in
1428 % default indentation of @itemize and @enumerate text
1429 \newdimen\itemindent \itemindent=.3in
1430 % margin between end of table item and start of table text.
1431 \newdimen\itemmargin \itemmargin=.1in
1433 % used internally for \itemindent minus \itemmargin
1434 \newdimen\itemmax
1436 % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
1437 % these defs.
1438 % They also define \itemindex
1439 % to index the item name in whatever manner is desired (perhaps none).
1441 \newif\ifitemxneedsnegativevskip
1443 \def\itemxpar{\par\ifitemxneedsnegativevskip\vskip-\parskip\nobreak\fi}
1445 \def\internalBitem{\smallbreak \parsearg\itemzzz}
1446 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
1448 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
1449 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
1451 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
1452 \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
1454 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
1455 \itemzzz {#1}}
1457 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
1458 \itemzzz {#1}}
1460 \def\itemzzz #1{\begingroup %
1461 \advance\hsize by -\rightskip
1462 \advance\hsize by -\tableindent
1463 \setbox0=\hbox{\itemfont{#1}}%
1464 \itemindex{#1}%
1465 \nobreak % This prevents a break before @itemx.
1467 % Be sure we are not still in the middle of a paragraph.
1468 %{\parskip = 0in
1469 %\par
1472 % If the item text does not fit in the space we have, put it on a line
1473 % by itself, and do not allow a page break either before or after that
1474 % line. We do not start a paragraph here because then if the next
1475 % command is, e.g., @kindex, the whatsit would get put into the
1476 % horizontal list on a line by itself, resulting in extra blank space.
1477 \ifdim \wd0>\itemmax
1479 % Make this a paragraph so we get the \parskip glue and wrapping,
1480 % but leave it ragged-right.
1481 \begingroup
1482 \advance\leftskip by-\tableindent
1483 \advance\hsize by\tableindent
1484 \advance\rightskip by0pt plus1fil
1485 \leavevmode\unhbox0\par
1486 \endgroup
1488 % We're going to be starting a paragraph, but we don't want the
1489 % \parskip glue -- logically it's part of the @item we just started.
1490 \nobreak \vskip-\parskip
1492 % Stop a page break at the \parskip glue coming up. Unfortunately
1493 % we can't prevent a possible page break at the following
1494 % \baselineskip glue.
1495 \nobreak
1496 \endgroup
1497 \itemxneedsnegativevskipfalse
1498 \else
1499 % The item text fits into the space. Start a paragraph, so that the
1500 % following text (if any) will end up on the same line. Since that
1501 % text will be indented by \tableindent, we make the item text be in
1502 % a zero-width box.
1503 \noindent
1504 \rlap{\hskip -\tableindent\box0}\ignorespaces%
1505 \endgroup%
1506 \itemxneedsnegativevskiptrue%
1510 \def\item{\errmessage{@item while not in a table}}
1511 \def\itemx{\errmessage{@itemx while not in a table}}
1512 \def\kitem{\errmessage{@kitem while not in a table}}
1513 \def\kitemx{\errmessage{@kitemx while not in a table}}
1514 \def\xitem{\errmessage{@xitem while not in a table}}
1515 \def\xitemx{\errmessage{@xitemx while not in a table}}
1517 %% Contains a kludge to get @end[description] to work
1518 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1520 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1521 {\obeylines\obeyspaces%
1522 \gdef\tablex #1^^M{%
1523 \tabley\dontindex#1 \endtabley}}
1525 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
1526 {\obeylines\obeyspaces%
1527 \gdef\ftablex #1^^M{%
1528 \tabley\fnitemindex#1 \endtabley
1529 \def\Eftable{\endgraf\afterenvbreak\endgroup}%
1530 \let\Etable=\relax}}
1532 \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
1533 {\obeylines\obeyspaces%
1534 \gdef\vtablex #1^^M{%
1535 \tabley\vritemindex#1 \endtabley
1536 \def\Evtable{\endgraf\afterenvbreak\endgroup}%
1537 \let\Etable=\relax}}
1539 \def\dontindex #1{}
1540 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
1541 \def\vritemindex #1{\doind {vr}{\code{#1}}}%
1543 {\obeyspaces %
1544 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
1545 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
1547 \def\tablez #1#2#3#4#5#6{%
1548 \aboveenvbreak %
1549 \begingroup %
1550 \def\Edescription{\Etable}% Necessary kludge.
1551 \let\itemindex=#1%
1552 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
1553 \ifnum 0#4>0 \tableindent=#4\mil \fi %
1554 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
1555 \def\itemfont{#2}%
1556 \itemmax=\tableindent %
1557 \advance \itemmax by -\itemmargin %
1558 \advance \leftskip by \tableindent %
1559 \exdentamount=\tableindent
1560 \parindent = 0pt
1561 \parskip = \smallskipamount
1562 \ifdim \parskip=0pt \parskip=2pt \fi%
1563 \def\Etable{\endgraf\afterenvbreak\endgroup}%
1564 \let\item = \internalBitem %
1565 \let\itemx = \internalBitemx %
1566 \let\kitem = \internalBkitem %
1567 \let\kitemx = \internalBkitemx %
1568 \let\xitem = \internalBxitem %
1569 \let\xitemx = \internalBxitemx %
1572 % This is the counter used by @enumerate, which is really @itemize
1574 \newcount \itemno
1576 \def\itemize{\parsearg\itemizezzz}
1578 \def\itemizezzz #1{%
1579 \begingroup % ended by the @end itemsize
1580 \itemizey {#1}{\Eitemize}
1583 \def\itemizey #1#2{%
1584 \aboveenvbreak %
1585 \itemmax=\itemindent %
1586 \advance \itemmax by -\itemmargin %
1587 \advance \leftskip by \itemindent %
1588 \exdentamount=\itemindent
1589 \parindent = 0pt %
1590 \parskip = \smallskipamount %
1591 \ifdim \parskip=0pt \parskip=2pt \fi%
1592 \def#2{\endgraf\afterenvbreak\endgroup}%
1593 \def\itemcontents{#1}%
1594 \let\item=\itemizeitem}
1596 % Set sfcode to normal for the chars that usually have another value.
1597 % These are `.?!:;,'
1598 \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
1599 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
1601 % \splitoff TOKENS\endmark defines \first to be the first token in
1602 % TOKENS, and \rest to be the remainder.
1604 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
1606 % Allow an optional argument of an uppercase letter, lowercase letter,
1607 % or number, to specify the first label in the enumerated list. No
1608 % argument is the same as `1'.
1610 \def\enumerate{\parsearg\enumeratezzz}
1611 \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
1612 \def\enumeratey #1 #2\endenumeratey{%
1613 \begingroup % ended by the @end enumerate
1615 % If we were given no argument, pretend we were given `1'.
1616 \def\thearg{#1}%
1617 \ifx\thearg\empty \def\thearg{1}\fi
1619 % Detect if the argument is a single token. If so, it might be a
1620 % letter. Otherwise, the only valid thing it can be is a number.
1621 % (We will always have one token, because of the test we just made.
1622 % This is a good thing, since \splitoff doesn't work given nothing at
1623 % all -- the first parameter is undelimited.)
1624 \expandafter\splitoff\thearg\endmark
1625 \ifx\rest\empty
1626 % Only one token in the argument. It could still be anything.
1627 % A ``lowercase letter'' is one whose \lccode is nonzero.
1628 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
1629 % not equal to itself.
1630 % Otherwise, we assume it's a number.
1632 % We need the \relax at the end of the \ifnum lines to stop TeX from
1633 % continuing to look for a <number>.
1635 \ifnum\lccode\expandafter`\thearg=0\relax
1636 \numericenumerate % a number (we hope)
1637 \else
1638 % It's a letter.
1639 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
1640 \lowercaseenumerate % lowercase letter
1641 \else
1642 \uppercaseenumerate % uppercase letter
1645 \else
1646 % Multiple tokens in the argument. We hope it's a number.
1647 \numericenumerate
1651 % An @enumerate whose labels are integers. The starting integer is
1652 % given in \thearg.
1654 \def\numericenumerate{%
1655 \itemno = \thearg
1656 \startenumeration{\the\itemno}%
1659 % The starting (lowercase) letter is in \thearg.
1660 \def\lowercaseenumerate{%
1661 \itemno = \expandafter`\thearg
1662 \startenumeration{%
1663 % Be sure we're not beyond the end of the alphabet.
1664 \ifnum\itemno=0
1665 \errmessage{No more lowercase letters in @enumerate; get a bigger
1666 alphabet}%
1668 \char\lccode\itemno
1672 % The starting (uppercase) letter is in \thearg.
1673 \def\uppercaseenumerate{%
1674 \itemno = \expandafter`\thearg
1675 \startenumeration{%
1676 % Be sure we're not beyond the end of the alphabet.
1677 \ifnum\itemno=0
1678 \errmessage{No more uppercase letters in @enumerate; get a bigger
1679 alphabet}
1681 \char\uccode\itemno
1685 % Call itemizey, adding a period to the first argument and supplying the
1686 % common last two arguments. Also subtract one from the initial value in
1687 % \itemno, since @item increments \itemno.
1689 \def\startenumeration#1{%
1690 \advance\itemno by -1
1691 \itemizey{#1.}\Eenumerate\flushcr
1694 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
1695 % to @enumerate.
1697 \def\alphaenumerate{\enumerate{a}}
1698 \def\capsenumerate{\enumerate{A}}
1699 \def\Ealphaenumerate{\Eenumerate}
1700 \def\Ecapsenumerate{\Eenumerate}
1702 % Definition of @item while inside @itemize.
1704 \def\itemizeitem{%
1705 \advance\itemno by 1
1706 {\let\par=\endgraf \smallbreak}%
1707 \ifhmode \errmessage{\in hmode at itemizeitem}\fi
1708 {\parskip=0in \hskip 0pt
1709 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
1710 \vadjust{\penalty 1200}}%
1711 \flushcr}
1713 % @multitable macros
1714 % Amy Hendrickson, 8/18/94
1716 % @multitable ... @endmultitable will make as many columns as desired.
1717 % Contents of each column will wrap at width given in preamble. Width
1718 % can be specified either with sample text given in a template line,
1719 % or in percent of \hsize, the current width of text on page.
1721 % Table can continue over pages but will only break between lines.
1723 % To make preamble:
1725 % Either define widths of columns in terms of percent of \hsize:
1726 % @multitable @percentofhsize .2 .3 .5
1727 % @item ...
1729 % Numbers following @percentofhsize are the percent of the total
1730 % current hsize to be used for each column. You may use as many
1731 % columns as desired.
1733 % Or use a template:
1734 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
1735 % @item ...
1736 % using the widest term desired in each column.
1739 % Each new table line starts with @item, each subsequent new column
1740 % starts with @tab. Empty columns may be produced by supplying @tab's
1741 % with nothing between them for as many times as empty columns are needed,
1742 % ie, @tab@tab@tab will produce two empty columns.
1744 % @item, @tab, @multicolumn or @endmulticolumn do not need to be on their
1745 % own lines, but it will not hurt if they are.
1747 % Sample multitable:
1749 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
1750 % @item first col stuff @tab second col stuff @tab third col
1751 % @item
1752 % first col stuff
1753 % @tab
1754 % second col stuff
1755 % @tab
1756 % third col
1757 % @item first col stuff @tab second col stuff
1758 % @tab Many paragraphs of text may be used in any column.
1760 % They will wrap at the width determined by the template.
1761 % @item@tab@tab This will be in third column.
1762 % @endmultitable
1764 % Default dimensions may be reset by user.
1765 % @intableparskip will set vertical space between paragraphs in table.
1766 % @intableparindent will set paragraph indent in table.
1767 % @spacebetweencols will set horizontal space to be left between columns.
1768 % @spacebetweenlines will set vertical space to be left between lines.
1770 %%%%
1771 % Dimensions
1773 \newdimen\intableparskip
1774 \newdimen\intableparindent
1775 \newdimen\spacebetweencols
1776 \newdimen\spacebetweenlines
1777 \intableparskip=0pt
1778 \intableparindent=6pt
1779 \spacebetweencols=12pt
1780 \spacebetweenlines=12pt
1782 %%%%
1783 % Macros used to set up halign preamble:
1784 \let\endsetuptable\relax
1785 \def\xendsetuptable{\endsetuptable}
1786 \let\percentofhsize\relax
1787 \def\xpercentofhsize{\percentofhsize}
1788 \newif\ifsetpercent
1790 \newcount\colcount
1791 \def\setuptable#1{\def\firstarg{#1}%
1792 \ifx\firstarg\xendsetuptable\let\go\relax%
1793 \else
1794 \ifx\firstarg\xpercentofhsize\global\setpercenttrue%
1795 \else
1796 \ifsetpercent
1797 \if#1.\else%
1798 \global\advance\colcount by1 %
1799 \expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
1801 \else
1802 \global\advance\colcount by1
1803 \setbox0=\hbox{#1}%
1804 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
1805 \fi%
1806 \fi%
1807 \let\go\setuptable%
1808 \fi\go}
1809 %%%%
1810 % multitable syntax
1811 \def\tab{&}
1813 %%%%
1814 % @multitable ... @endmultitable definitions:
1816 \def\multitable#1\item{\bgroup
1817 \let\item\cr
1818 \tolerance=9500
1819 \hbadness=9500
1820 \parskip=\intableparskip
1821 \parindent=\intableparindent
1822 \overfullrule=0pt
1823 \global\colcount=0\relax%
1824 \def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}%
1825 % To parse everything between @multitable and @item :
1826 \def\one{#1}\expandafter\setuptable\one\endsetuptable
1827 % Need to reset this to 0 after \setuptable.
1828 \global\colcount=0\relax%
1830 % This preamble sets up a generic column definition, which will
1831 % be used as many times as user calls for columns.
1832 % \vtop will set a single line and will also let text wrap and
1833 % continue for many paragraphs if desired.
1834 \halign\bgroup&\global\advance\colcount by 1\relax%
1835 \vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
1836 % In order to keep entries from bumping into each other
1837 % we will add a \leftskip of \spacebetweencols to all columns after
1838 % the first one.
1839 % If a template has been used, we will add \spacebetweencols
1840 % to the width of each template entry.
1841 % If user has set preamble in terms of percent of \hsize
1842 % we will use that dimension as the width of the column, and
1843 % the \leftskip will keep entries from bumping into each other.
1844 % Table will start at left margin and final column will justify at
1845 % right margin.
1846 \ifnum\colcount=1
1847 \else
1848 \ifsetpercent
1849 \else
1850 % If user has <not> set preamble in terms of percent of \hsize
1851 % we will advance \hsize by \spacebetweencols
1852 \advance\hsize by \spacebetweencols
1854 % In either case we will make \leftskip=\spacebetweencols:
1855 \leftskip=\spacebetweencols
1857 \noindent##}\cr%
1858 % \everycr will reset column counter, \colcount, at the end of
1859 % each line. Every column entry will cause \colcount to advance by one.
1860 % The table preamble
1861 % looks at the current \colcount to find the correct column width.
1862 \global\everycr{\noalign{\nointerlineskip\vskip\spacebetweenlines
1863 \filbreak%% keeps underfull box messages off when table breaks over pages.
1864 \global\colcount=0\relax}}}
1866 \message{indexing,}
1867 % Index generation facilities
1869 % Define \newwrite to be identical to plain tex's \newwrite
1870 % except not \outer, so it can be used within \newindex.
1871 {\catcode`\@=11
1872 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
1874 % \newindex {foo} defines an index named foo.
1875 % It automatically defines \fooindex such that
1876 % \fooindex ...rest of line... puts an entry in the index foo.
1877 % It also defines \fooindfile to be the number of the output channel for
1878 % the file that accumulates this index. The file's extension is foo.
1879 % The name of an index should be no more than 2 characters long
1880 % for the sake of vms.
1882 \def\newindex #1{
1883 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
1884 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
1885 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1886 \noexpand\doindex {#1}}
1889 % @defindex foo == \newindex{foo}
1891 \def\defindex{\parsearg\newindex}
1893 % Define @defcodeindex, like @defindex except put all entries in @code.
1895 \def\newcodeindex #1{
1896 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
1897 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
1898 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1899 \noexpand\docodeindex {#1}}
1902 \def\defcodeindex{\parsearg\newcodeindex}
1904 % @synindex foo bar makes index foo feed into index bar.
1905 % Do this instead of @defindex foo if you don't want it as a separate index.
1906 \def\synindex #1 #2 {%
1907 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
1908 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
1909 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1910 \noexpand\doindex {#2}}%
1913 % @syncodeindex foo bar similar, but put all entries made for index foo
1914 % inside @code.
1915 \def\syncodeindex #1 #2 {%
1916 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
1917 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
1918 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
1919 \noexpand\docodeindex {#2}}%
1922 % Define \doindex, the driver for all \fooindex macros.
1923 % Argument #1 is generated by the calling \fooindex macro,
1924 % and it is "foo", the name of the index.
1926 % \doindex just uses \parsearg; it calls \doind for the actual work.
1927 % This is because \doind is more useful to call from other macros.
1929 % There is also \dosubind {index}{topic}{subtopic}
1930 % which makes an entry in a two-level index such as the operation index.
1932 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
1933 \def\singleindexer #1{\doind{\indexname}{#1}}
1935 % like the previous two, but they put @code around the argument.
1936 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
1937 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
1939 \def\indexdummies{%
1940 % Take care of the plain tex accent commands.
1941 \def\"{\realbackslash "}%
1942 \def\`{\realbackslash `}%
1943 \def\'{\realbackslash '}%
1944 \def\^{\realbackslash ^}%
1945 \def\~{\realbackslash ~}%
1946 \def\={\realbackslash =}%
1947 \def\b{\realbackslash b}%
1948 \def\c{\realbackslash c}%
1949 \def\d{\realbackslash d}%
1950 \def\u{\realbackslash u}%
1951 \def\v{\realbackslash v}%
1952 \def\H{\realbackslash H}%
1953 % Take care of the plain tex special European modified letters.
1954 \def\oe{\realbackslash oe}%
1955 \def\ae{\realbackslash ae}%
1956 \def\aa{\realbackslash aa}%
1957 \def\OE{\realbackslash OE}%
1958 \def\AE{\realbackslash AE}%
1959 \def\AA{\realbackslash AA}%
1960 \def\o{\realbackslash o}%
1961 \def\O{\realbackslash O}%
1962 \def\l{\realbackslash l}%
1963 \def\L{\realbackslash L}%
1964 \def\ss{\realbackslash ss}%
1965 % Take care of texinfo commands likely to appear in an index entry.
1966 \def\_{{\realbackslash _}}%
1967 \def\w{\realbackslash w }%
1968 \def\bf{\realbackslash bf }%
1969 \def\rm{\realbackslash rm }%
1970 \def\sl{\realbackslash sl }%
1971 \def\sf{\realbackslash sf}%
1972 \def\tt{\realbackslash tt}%
1973 \def\gtr{\realbackslash gtr}%
1974 \def\less{\realbackslash less}%
1975 \def\hat{\realbackslash hat}%
1976 \def\char{\realbackslash char}%
1977 \def\TeX{\realbackslash TeX}%
1978 \def\dots{\realbackslash dots }%
1979 \def\copyright{\realbackslash copyright }%
1980 \def\tclose##1{\realbackslash tclose {##1}}%
1981 \def\code##1{\realbackslash code {##1}}%
1982 \def\samp##1{\realbackslash samp {##1}}%
1983 \def\t##1{\realbackslash r {##1}}%
1984 \def\r##1{\realbackslash r {##1}}%
1985 \def\i##1{\realbackslash i {##1}}%
1986 \def\b##1{\realbackslash b {##1}}%
1987 \def\cite##1{\realbackslash cite {##1}}%
1988 \def\key##1{\realbackslash key {##1}}%
1989 \def\file##1{\realbackslash file {##1}}%
1990 \def\var##1{\realbackslash var {##1}}%
1991 \def\kbd##1{\realbackslash kbd {##1}}%
1992 \def\dfn##1{\realbackslash dfn {##1}}%
1993 \def\emph##1{\realbackslash emph {##1}}%
1994 \unsepspaces
1997 % If an index command is used in an @example environment, any spaces
1998 % therein should become regular spaces in the raw index file, not the
1999 % expansion of \tie (\\leavevmode \penalty \@M \ ).
2000 {\obeyspaces
2001 \gdef\unsepspaces{\obeyspaces\let =\space}}
2003 % \indexnofonts no-ops all font-change commands.
2004 % This is used when outputting the strings to sort the index by.
2005 \def\indexdummyfont#1{#1}
2006 \def\indexdummytex{TeX}
2007 \def\indexdummydots{...}
2009 \def\indexnofonts{%
2010 % Just ignore accents.
2011 \let\"=\indexdummyfont
2012 \let\`=\indexdummyfont
2013 \let\'=\indexdummyfont
2014 \let\^=\indexdummyfont
2015 \let\~=\indexdummyfont
2016 \let\==\indexdummyfont
2017 \let\b=\indexdummyfont
2018 \let\c=\indexdummyfont
2019 \let\d=\indexdummyfont
2020 \let\u=\indexdummyfont
2021 \let\v=\indexdummyfont
2022 \let\H=\indexdummyfont
2023 % Take care of the plain tex special European modified letters.
2024 \def\oe{oe}%
2025 \def\ae{ae}%
2026 \def\aa{aa}%
2027 \def\OE{OE}%
2028 \def\AE{AE}%
2029 \def\AA{AA}%
2030 \def\o{o}%
2031 \def\O{O}%
2032 \def\l{l}%
2033 \def\L{L}%
2034 \def\ss{ss}%
2035 \let\w=\indexdummyfont
2036 \let\t=\indexdummyfont
2037 \let\r=\indexdummyfont
2038 \let\i=\indexdummyfont
2039 \let\b=\indexdummyfont
2040 \let\emph=\indexdummyfont
2041 \let\strong=\indexdummyfont
2042 \let\cite=\indexdummyfont
2043 \let\sc=\indexdummyfont
2044 %Don't no-op \tt, since it isn't a user-level command
2045 % and is used in the definitions of the active chars like <, >, |...
2046 %\let\tt=\indexdummyfont
2047 \let\tclose=\indexdummyfont
2048 \let\code=\indexdummyfont
2049 \let\file=\indexdummyfont
2050 \let\samp=\indexdummyfont
2051 \let\kbd=\indexdummyfont
2052 \let\key=\indexdummyfont
2053 \let\var=\indexdummyfont
2054 \let\TeX=\indexdummytex
2055 \let\dots=\indexdummydots
2058 % To define \realbackslash, we must make \ not be an escape.
2059 % We must first make another character (@) an escape
2060 % so we do not become unable to do a definition.
2062 {\catcode`\@=0 \catcode`\\=\other
2063 @gdef@realbackslash{\}}
2065 \let\indexbackslash=0 %overridden during \printindex.
2067 \let\SETmarginindex=\relax %initialize!
2068 % workhorse for all \fooindexes
2069 % #1 is name of index, #2 is stuff to put there
2070 \def\doind #1#2{%
2071 % Put the index entry in the margin if desired.
2072 \ifx\SETmarginindex\relax\else%
2073 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2074 \fi%
2075 {\count10=\lastpenalty %
2076 {\indexdummies % Must do this here, since \bf, etc expand at this stage
2077 \escapechar=`\\%
2078 {\let\folio=0% Expand all macros now EXCEPT \folio
2079 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2080 % so it will be output as is; and it will print as backslash in the indx.
2082 % Now process the index-string once, with all font commands turned off,
2083 % to get the string to sort the index by.
2084 {\indexnofonts
2085 \xdef\temp1{#2}%
2087 % Now produce the complete index entry. We process the index-string again,
2088 % this time with font commands expanded, to get what to print in the index.
2089 \edef\temp{%
2090 \write \csname#1indfile\endcsname{%
2091 \realbackslash entry {\temp1}{\folio}{#2}}}%
2092 \temp }%
2093 }\penalty\count10}}
2095 \def\dosubind #1#2#3{%
2096 {\count10=\lastpenalty %
2097 {\indexdummies % Must do this here, since \bf, etc expand at this stage
2098 \escapechar=`\\%
2099 {\let\folio=0%
2100 \def\rawbackslashxx{\indexbackslash}%
2102 % Now process the index-string once, with all font commands turned off,
2103 % to get the string to sort the index by.
2104 {\indexnofonts
2105 \xdef\temp1{#2 #3}%
2107 % Now produce the complete index entry. We process the index-string again,
2108 % this time with font commands expanded, to get what to print in the index.
2109 \edef\temp{%
2110 \write \csname#1indfile\endcsname{%
2111 \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
2112 \temp }%
2113 }\penalty\count10}}
2115 % The index entry written in the file actually looks like
2116 % \entry {sortstring}{page}{topic}
2117 % or
2118 % \entry {sortstring}{page}{topic}{subtopic}
2119 % The texindex program reads in these files and writes files
2120 % containing these kinds of lines:
2121 % \initial {c}
2122 % before the first topic whose initial is c
2123 % \entry {topic}{pagelist}
2124 % for a topic that is used without subtopics
2125 % \primary {topic}
2126 % for the beginning of a topic that is used with subtopics
2127 % \secondary {subtopic}{pagelist}
2128 % for each subtopic.
2130 % Define the user-accessible indexing commands
2131 % @findex, @vindex, @kindex, @cindex.
2133 \def\findex {\fnindex}
2134 \def\kindex {\kyindex}
2135 \def\cindex {\cpindex}
2136 \def\vindex {\vrindex}
2137 \def\tindex {\tpindex}
2138 \def\pindex {\pgindex}
2140 \def\cindexsub {\begingroup\obeylines\cindexsub}
2141 {\obeylines %
2142 \gdef\cindexsub "#1" #2^^M{\endgroup %
2143 \dosubind{cp}{#2}{#1}}}
2145 % Define the macros used in formatting output of the sorted index material.
2147 % This is what you call to cause a particular index to get printed.
2148 % Write
2149 % @unnumbered Function Index
2150 % @printindex fn
2152 \def\printindex{\parsearg\doprintindex}
2154 \def\doprintindex#1{%
2155 \tex
2156 \dobreak \chapheadingskip {10000}
2157 \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
2158 \catcode`\$=\other
2159 \catcode`\~=\other
2160 \indexbreaks
2162 % The following don't help, since the chars were translated
2163 % when the raw index was written, and their fonts were discarded
2164 % due to \indexnofonts.
2165 %\catcode`\"=\active
2166 %\catcode`\^=\active
2167 %\catcode`\_=\active
2168 %\catcode`\|=\active
2169 %\catcode`\<=\active
2170 %\catcode`\>=\active
2172 \def\indexbackslash{\rawbackslashxx}
2173 \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
2174 \begindoublecolumns
2176 % See if the index file exists and is nonempty.
2177 \openin 1 \jobname.#1s
2178 \ifeof 1
2179 % \enddoublecolumns gets confused if there is no text in the index,
2180 % and it loses the chapter title and the aux file entries for the
2181 % index. The easiest way to prevent this problem is to make sure
2182 % there is some text.
2183 (Index is nonexistent)
2184 \else
2186 % If the index file exists but is empty, then \openin leaves \ifeof
2187 % false. We have to make TeX try to read something from the file, so
2188 % it can discover if there is anything in it.
2189 \read 1 to \temp
2190 \ifeof 1
2191 (Index is empty)
2192 \else
2193 \input \jobname.#1s
2196 \closein 1
2197 \enddoublecolumns
2198 \Etex
2201 % These macros are used by the sorted index file itself.
2202 % Change them to control the appearance of the index.
2204 % Same as \bigskipamount except no shrink.
2205 % \balancecolumns gets confused if there is any shrink.
2206 \newskip\initialskipamount \initialskipamount 12pt plus4pt
2208 \def\initial #1{%
2209 {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2210 \ifdim\lastskip<\initialskipamount
2211 \removelastskip \penalty-200 \vskip \initialskipamount\fi
2212 \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
2214 % This typesets a paragraph consisting of #1, dot leaders, and then #2
2215 % flush to the right margin. It is used for index and table of contents
2216 % entries. The paragraph is indented by \leftskip.
2218 \def\entry #1#2{\begingroup
2220 % Start a new paragraph if necessary, so our assignments below can't
2221 % affect previous text.
2222 \par
2224 % Do not fill out the last line with white space.
2225 \parfillskip = 0in
2227 % No extra space above this paragraph.
2228 \parskip = 0in
2230 % Do not prefer a separate line ending with a hyphen to fewer lines.
2231 \finalhyphendemerits = 0
2233 % \hangindent is only relevant when the entry text and page number
2234 % don't both fit on one line. In that case, bob suggests starting the
2235 % dots pretty far over on the line. Unfortunately, a large
2236 % indentation looks wrong when the entry text itself is broken across
2237 % lines. So we use a small indentation and put up with long leaders.
2239 % \hangafter is reset to 1 (which is the value we want) at the start
2240 % of each paragraph, so we need not do anything with that.
2241 \hangindent=2em
2243 % When the entry text needs to be broken, just fill out the first line
2244 % with blank space.
2245 \rightskip = 0pt plus1fil
2247 % Start a ``paragraph'' for the index entry so the line breaking
2248 % parameters we've set above will have an effect.
2249 \noindent
2251 % Insert the text of the index entry. TeX will do line-breaking on it.
2253 % The following is kludged to not output a line of dots in the index if
2254 % there are no page numbers. The next person who breaks this will be
2255 % cursed by a Unix daemon.
2256 \def\tempa{{\rm }}%
2257 \def\tempb{#2}%
2258 \edef\tempc{\tempa}%
2259 \edef\tempd{\tempb}%
2260 \ifx\tempc\tempd\ \else%
2262 % If we must, put the page number on a line of its own, and fill out
2263 % this line with blank space. (The \hfil is overwhelmed with the
2264 % fill leaders glue in \indexdotfill if the page number does fit.)
2265 \hfil\penalty50
2266 \null\nobreak\indexdotfill % Have leaders before the page number.
2268 % The `\ ' here is removed by the implicit \unskip that TeX does as
2269 % part of (the primitive) \par. Without it, a spurious underfull
2270 % \hbox ensues.
2271 \ #2% The page number ends the paragraph.
2272 \fi%
2273 \par
2274 \endgroup}
2276 % Like \dotfill except takes at least 1 em.
2277 \def\indexdotfill{\cleaders
2278 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
2280 \def\primary #1{\line{#1\hfil}}
2282 \newskip\secondaryindent \secondaryindent=0.5cm
2284 \def\secondary #1#2{
2285 {\parfillskip=0in \parskip=0in
2286 \hangindent =1in \hangafter=1
2287 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
2290 %% Define two-column mode, which is used in indexes.
2291 %% Adapted from the TeXbook, page 416.
2292 \catcode `\@=11
2294 \newbox\partialpage
2296 \newdimen\doublecolumnhsize
2298 \def\begindoublecolumns{\begingroup
2299 % Grab any single-column material above us.
2300 \output = {\global\setbox\partialpage
2301 =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
2302 \eject
2304 % Now switch to the double-column output routine.
2305 \output={\doublecolumnout}%
2307 % Change the page size parameters. We could do this once outside this
2308 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
2309 % format, but then we repeat the same computation. Repeating a couple
2310 % of assignments once per index is clearly meaningless for the
2311 % execution time, so we may as well do it once.
2313 % First we halve the line length, less a little for the gutter between
2314 % the columns. We compute the gutter based on the line length, so it
2315 % changes automatically with the paper format. The magic constant
2316 % below is chosen so that the gutter has the same value (well, +- <
2317 % 1pt) as it did when we hard-coded it.
2319 % We put the result in a separate register, \doublecolumhsize, so we
2320 % can restore it in \pagesofar, after \hsize itself has (potentially)
2321 % been clobbered.
2323 \doublecolumnhsize = \hsize
2324 \advance\doublecolumnhsize by -.04154\hsize
2325 \divide\doublecolumnhsize by 2
2326 \hsize = \doublecolumnhsize
2328 % Double the \vsize as well. (We don't need a separate register here,
2329 % since nobody clobbers \vsize.)
2330 \vsize = 2\vsize
2331 \doublecolumnpagegoal
2334 \def\enddoublecolumns{\eject \endgroup \pagegoal=\vsize \unvbox\partialpage}
2336 \def\doublecolumnsplit{\splittopskip=\topskip \splitmaxdepth=\maxdepth
2337 \global\dimen@=\pageheight \global\advance\dimen@ by-\ht\partialpage
2338 \global\setbox1=\vsplit255 to\dimen@ \global\setbox0=\vbox{\unvbox1}
2339 \global\setbox3=\vsplit255 to\dimen@ \global\setbox2=\vbox{\unvbox3}
2340 \ifdim\ht0>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
2341 \ifdim\ht2>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
2343 \def\doublecolumnpagegoal{%
2344 \dimen@=\vsize \advance\dimen@ by-2\ht\partialpage \global\pagegoal=\dimen@
2346 \def\pagesofar{\unvbox\partialpage %
2347 \hsize=\doublecolumnhsize % have to restore this since output routine
2348 \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
2349 \def\doublecolumnout{%
2350 \setbox5=\copy255
2351 {\vbadness=10000 \doublecolumnsplit}
2352 \ifvbox255
2353 \setbox0=\vtop to\dimen@{\unvbox0}
2354 \setbox2=\vtop to\dimen@{\unvbox2}
2355 \onepageout\pagesofar \unvbox255 \penalty\outputpenalty
2356 \else
2357 \setbox0=\vbox{\unvbox5}
2358 \ifvbox0
2359 \dimen@=\ht0 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
2360 \divide\dimen@ by2 \splittopskip=\topskip \splitmaxdepth=\maxdepth
2361 {\vbadness=10000
2362 \loop \global\setbox5=\copy0
2363 \setbox1=\vsplit5 to\dimen@
2364 \setbox3=\vsplit5 to\dimen@
2365 \ifvbox5 \global\advance\dimen@ by1pt \repeat
2366 \setbox0=\vbox to\dimen@{\unvbox1}
2367 \setbox2=\vbox to\dimen@{\unvbox3}
2368 \global\setbox\partialpage=\vbox{\pagesofar}
2369 \doublecolumnpagegoal
2375 \catcode `\@=\other
2376 \message{sectioning,}
2377 % Define chapters, sections, etc.
2379 \newcount \chapno
2380 \newcount \secno \secno=0
2381 \newcount \subsecno \subsecno=0
2382 \newcount \subsubsecno \subsubsecno=0
2384 % This counter is funny since it counts through charcodes of letters A, B, ...
2385 \newcount \appendixno \appendixno = `\@
2386 \def\appendixletter{\char\the\appendixno}
2388 \newwrite \contentsfile
2389 % This is called from \setfilename.
2390 \def\opencontents{\openout \contentsfile = \jobname.toc}
2392 % Each @chapter defines this as the name of the chapter.
2393 % page headings and footings can use it. @section does likewise
2395 \def\thischapter{} \def\thissection{}
2396 \def\seccheck#1{\if \pageno<0 %
2397 \errmessage{@#1 not allowed after generating table of contents}\fi
2401 \def\chapternofonts{%
2402 \let\rawbackslash=\relax%
2403 \let\frenchspacing=\relax%
2404 \def\result{\realbackslash result}
2405 \def\equiv{\realbackslash equiv}
2406 \def\expansion{\realbackslash expansion}
2407 \def\print{\realbackslash print}
2408 \def\TeX{\realbackslash TeX}
2409 \def\dots{\realbackslash dots}
2410 \def\copyright{\realbackslash copyright}
2411 \def\tt{\realbackslash tt}
2412 \def\bf{\realbackslash bf }
2413 \def\w{\realbackslash w}
2414 \def\less{\realbackslash less}
2415 \def\gtr{\realbackslash gtr}
2416 \def\hat{\realbackslash hat}
2417 \def\char{\realbackslash char}
2418 \def\tclose##1{\realbackslash tclose {##1}}
2419 \def\code##1{\realbackslash code {##1}}
2420 \def\samp##1{\realbackslash samp {##1}}
2421 \def\r##1{\realbackslash r {##1}}
2422 \def\b##1{\realbackslash b {##1}}
2423 \def\key##1{\realbackslash key {##1}}
2424 \def\file##1{\realbackslash file {##1}}
2425 \def\kbd##1{\realbackslash kbd {##1}}
2426 % These are redefined because @smartitalic wouldn't work inside xdef.
2427 \def\i##1{\realbackslash i {##1}}
2428 \def\cite##1{\realbackslash cite {##1}}
2429 \def\var##1{\realbackslash var {##1}}
2430 \def\emph##1{\realbackslash emph {##1}}
2431 \def\dfn##1{\realbackslash dfn {##1}}
2434 \newcount\absseclevel % used to calculate proper heading level
2435 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
2437 % @raisesections: treat @section as chapter, @subsection as section, etc.
2438 \def\raisesections{\global\advance\secbase by -1}
2439 \let\up=\raisesections % original BFox name
2441 % @lowersections: treat @chapter as section, @section as subsection, etc.
2442 \def\lowersections{\global\advance\secbase by 1}
2443 \let\down=\lowersections % original BFox name
2445 % Choose a numbered-heading macro
2446 % #1 is heading level if unmodified by @raisesections or @lowersections
2447 % #2 is text for heading
2448 \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2449 \ifcase\absseclevel
2450 \chapterzzz{#2}
2452 \seczzz{#2}
2454 \numberedsubseczzz{#2}
2456 \numberedsubsubseczzz{#2}
2457 \else
2458 \ifnum \absseclevel<0
2459 \chapterzzz{#2}
2460 \else
2461 \numberedsubsubseczzz{#2}
2466 % like \numhead, but chooses appendix heading levels
2467 \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2468 \ifcase\absseclevel
2469 \appendixzzz{#2}
2471 \appendixsectionzzz{#2}
2473 \appendixsubseczzz{#2}
2475 \appendixsubsubseczzz{#2}
2476 \else
2477 \ifnum \absseclevel<0
2478 \appendixzzz{#2}
2479 \else
2480 \appendixsubsubseczzz{#2}
2485 % like \numhead, but chooses numberless heading levels
2486 \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
2487 \ifcase\absseclevel
2488 \unnumberedzzz{#2}
2490 \unnumberedseczzz{#2}
2492 \unnumberedsubseczzz{#2}
2494 \unnumberedsubsubseczzz{#2}
2495 \else
2496 \ifnum \absseclevel<0
2497 \unnumberedzzz{#2}
2498 \else
2499 \unnumberedsubsubseczzz{#2}
2505 \def\thischaptername{No Chapter Title}
2506 \outer\def\chapter{\parsearg\chapteryyy}
2507 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
2508 \def\chapterzzz #1{\seccheck{chapter}%
2509 \secno=0 \subsecno=0 \subsubsecno=0
2510 \global\advance \chapno by 1 \message{\putwordChapter \the\chapno}%
2511 \chapmacro {#1}{\the\chapno}%
2512 \gdef\thissection{#1}%
2513 \gdef\thischaptername{#1}%
2514 % We don't substitute the actual chapter name into \thischapter
2515 % because we don't want its macros evaluated now.
2516 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
2517 {\chapternofonts%
2518 \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
2519 \escapechar=`\\%
2520 \write \contentsfile \temp %
2521 \donoderef %
2522 \global\let\section = \numberedsec
2523 \global\let\subsection = \numberedsubsec
2524 \global\let\subsubsection = \numberedsubsubsec
2527 \outer\def\appendix{\parsearg\appendixyyy}
2528 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
2529 \def\appendixzzz #1{\seccheck{appendix}%
2530 \secno=0 \subsecno=0 \subsubsecno=0
2531 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
2532 \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
2533 \gdef\thissection{#1}%
2534 \gdef\thischaptername{#1}%
2535 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
2536 {\chapternofonts%
2537 \edef\temp{{\realbackslash chapentry
2538 {#1}{\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
2539 \escapechar=`\\%
2540 \write \contentsfile \temp %
2541 \appendixnoderef %
2542 \global\let\section = \appendixsec
2543 \global\let\subsection = \appendixsubsec
2544 \global\let\subsubsection = \appendixsubsubsec
2547 \outer\def\top{\parsearg\unnumberedyyy}
2548 \outer\def\unnumbered{\parsearg\unnumberedyyy}
2549 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
2550 \def\unnumberedzzz #1{\seccheck{unnumbered}%
2551 \secno=0 \subsecno=0 \subsubsecno=0
2553 % This used to be simply \message{#1}, but TeX fully expands the
2554 % argument to \message. Therefore, if #1 contained @-commands, TeX
2555 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
2556 % expanded @cite (which turns out to cause errors because \cite is meant
2557 % to be executed, not expanded).
2559 % Anyway, we don't want the fully-expanded definition of @cite to appear
2560 % as a result of the \message, we just want `@cite' itself. We use
2561 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
2562 % simply yielding the contents of the <toks register>.
2563 \toks0 = {#1}\message{(\the\toks0)}%
2565 \unnumbchapmacro {#1}%
2566 \gdef\thischapter{#1}\gdef\thissection{#1}%
2567 {\chapternofonts%
2568 \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
2569 \escapechar=`\\%
2570 \write \contentsfile \temp %
2571 \unnumbnoderef %
2572 \global\let\section = \unnumberedsec
2573 \global\let\subsection = \unnumberedsubsec
2574 \global\let\subsubsection = \unnumberedsubsubsec
2577 \outer\def\numberedsec{\parsearg\secyyy}
2578 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
2579 \def\seczzz #1{\seccheck{section}%
2580 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
2581 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
2582 {\chapternofonts%
2583 \edef\temp{{\realbackslash secentry %
2584 {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
2585 \escapechar=`\\%
2586 \write \contentsfile \temp %
2587 \donoderef %
2588 \penalty 10000 %
2591 \outer\def\appendixsection{\parsearg\appendixsecyyy}
2592 \outer\def\appendixsec{\parsearg\appendixsecyyy}
2593 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
2594 \def\appendixsectionzzz #1{\seccheck{appendixsection}%
2595 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
2596 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
2597 {\chapternofonts%
2598 \edef\temp{{\realbackslash secentry %
2599 {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
2600 \escapechar=`\\%
2601 \write \contentsfile \temp %
2602 \appendixnoderef %
2603 \penalty 10000 %
2606 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
2607 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
2608 \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
2609 \plainsecheading {#1}\gdef\thissection{#1}%
2610 {\chapternofonts%
2611 \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
2612 \escapechar=`\\%
2613 \write \contentsfile \temp %
2614 \unnumbnoderef %
2615 \penalty 10000 %
2618 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
2619 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
2620 \def\numberedsubseczzz #1{\seccheck{subsection}%
2621 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
2622 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
2623 {\chapternofonts%
2624 \edef\temp{{\realbackslash subsecentry %
2625 {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
2626 \escapechar=`\\%
2627 \write \contentsfile \temp %
2628 \donoderef %
2629 \penalty 10000 %
2632 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
2633 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
2634 \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
2635 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
2636 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
2637 {\chapternofonts%
2638 \edef\temp{{\realbackslash subsecentry %
2639 {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
2640 \escapechar=`\\%
2641 \write \contentsfile \temp %
2642 \appendixnoderef %
2643 \penalty 10000 %
2646 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
2647 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
2648 \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
2649 \plainsecheading {#1}\gdef\thissection{#1}%
2650 {\chapternofonts%
2651 \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
2652 \escapechar=`\\%
2653 \write \contentsfile \temp %
2654 \unnumbnoderef %
2655 \penalty 10000 %
2658 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
2659 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
2660 \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
2661 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
2662 \subsubsecheading {#1}
2663 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
2664 {\chapternofonts%
2665 \edef\temp{{\realbackslash subsubsecentry %
2666 {#1}
2667 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
2668 {\noexpand\folio}}}%
2669 \escapechar=`\\%
2670 \write \contentsfile \temp %
2671 \donoderef %
2672 \penalty 10000 %
2675 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
2676 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
2677 \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
2678 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
2679 \subsubsecheading {#1}
2680 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
2681 {\chapternofonts%
2682 \edef\temp{{\realbackslash subsubsecentry{#1}%
2683 {\appendixletter}
2684 {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
2685 \escapechar=`\\%
2686 \write \contentsfile \temp %
2687 \appendixnoderef %
2688 \penalty 10000 %
2691 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
2692 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
2693 \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
2694 \plainsecheading {#1}\gdef\thissection{#1}%
2695 {\chapternofonts%
2696 \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
2697 \escapechar=`\\%
2698 \write \contentsfile \temp %
2699 \unnumbnoderef %
2700 \penalty 10000 %
2703 % These are variants which are not "outer", so they can appear in @ifinfo.
2704 % Actually, they should now be obsolete; ordinary section commands should work.
2705 \def\infotop{\parsearg\unnumberedzzz}
2706 \def\infounnumbered{\parsearg\unnumberedzzz}
2707 \def\infounnumberedsec{\parsearg\unnumberedseczzz}
2708 \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
2709 \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
2711 \def\infoappendix{\parsearg\appendixzzz}
2712 \def\infoappendixsec{\parsearg\appendixseczzz}
2713 \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
2714 \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
2716 \def\infochapter{\parsearg\chapterzzz}
2717 \def\infosection{\parsearg\sectionzzz}
2718 \def\infosubsection{\parsearg\subsectionzzz}
2719 \def\infosubsubsection{\parsearg\subsubsectionzzz}
2721 % These macros control what the section commands do, according
2722 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
2723 % Define them by default for a numbered chapter.
2724 \global\let\section = \numberedsec
2725 \global\let\subsection = \numberedsubsec
2726 \global\let\subsubsection = \numberedsubsubsec
2728 % Define @majorheading, @heading and @subheading
2730 % NOTE on use of \vbox for chapter headings, section headings, and
2731 % such:
2732 % 1) We use \vbox rather than the earlier \line to permit
2733 % overlong headings to fold.
2734 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
2735 % heading is obnoxious; this forbids it.
2736 % 3) Likewise, headings look best if no \parindent is used, and
2737 % if justification is not attempted. Hence \raggedright.
2740 \def\majorheading{\parsearg\majorheadingzzz}
2741 \def\majorheadingzzz #1{%
2742 {\advance\chapheadingskip by 10pt \chapbreak }%
2743 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2744 \parindent=0pt\raggedright
2745 \rm #1\hfill}}\bigskip \par\penalty 200}
2747 \def\chapheading{\parsearg\chapheadingzzz}
2748 \def\chapheadingzzz #1{\chapbreak %
2749 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2750 \parindent=0pt\raggedright
2751 \rm #1\hfill}}\bigskip \par\penalty 200}
2753 \def\heading{\parsearg\secheadingi}
2755 \def\subheading{\parsearg\subsecheadingi}
2757 \def\subsubheading{\parsearg\subsubsecheadingi}
2759 % These macros generate a chapter, section, etc. heading only
2760 % (including whitespace, linebreaking, etc. around it),
2761 % given all the information in convenient, parsed form.
2763 %%% Args are the skip and penalty (usually negative)
2764 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
2766 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
2768 %%% Define plain chapter starts, and page on/off switching for it
2769 % Parameter controlling skip before chapter headings (if needed)
2771 \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
2773 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
2774 \def\chappager{\par\vfill\supereject}
2775 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
2777 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
2779 \def\CHAPPAGoff{
2780 \global\let\pchapsepmacro=\chapbreak
2781 \global\let\pagealignmacro=\chappager}
2783 \def\CHAPPAGon{
2784 \global\let\pchapsepmacro=\chappager
2785 \global\let\pagealignmacro=\chappager
2786 \global\def\HEADINGSon{\HEADINGSsingle}}
2788 \def\CHAPPAGodd{
2789 \global\let\pchapsepmacro=\chapoddpage
2790 \global\let\pagealignmacro=\chapoddpage
2791 \global\def\HEADINGSon{\HEADINGSdouble}}
2793 \CHAPPAGon
2795 \def\CHAPFplain{
2796 \global\let\chapmacro=\chfplain
2797 \global\let\unnumbchapmacro=\unnchfplain}
2799 \def\chfplain #1#2{%
2800 \pchapsepmacro
2802 \chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2803 \parindent=0pt\raggedright
2804 \rm #2\enspace #1}%
2806 \bigskip
2807 \penalty5000
2810 \def\unnchfplain #1{%
2811 \pchapsepmacro %
2812 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2813 \parindent=0pt\raggedright
2814 \rm #1\hfill}}\bigskip \par\penalty 10000 %
2816 \CHAPFplain % The default
2818 \def\unnchfopen #1{%
2819 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2820 \parindent=0pt\raggedright
2821 \rm #1\hfill}}\bigskip \par\penalty 10000 %
2824 \def\chfopen #1#2{\chapoddpage {\chapfonts
2825 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
2826 \par\penalty 5000 %
2829 \def\CHAPFopen{
2830 \global\let\chapmacro=\chfopen
2831 \global\let\unnumbchapmacro=\unnchfopen}
2833 % Parameter controlling skip before section headings.
2835 \newskip \subsecheadingskip \subsecheadingskip = 17pt plus 8pt minus 4pt
2836 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
2838 \newskip \secheadingskip \secheadingskip = 21pt plus 8pt minus 4pt
2839 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
2841 % @paragraphindent is defined for the Info formatting commands only.
2842 \let\paragraphindent=\comment
2844 % Section fonts are the base font at magstep2, which produces
2845 % a size a bit more than 14 points in the default situation.
2847 \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
2848 \def\plainsecheading #1{\secheadingi {#1}}
2849 \def\secheadingi #1{{\advance \secheadingskip by \parskip %
2850 \secheadingbreak}%
2851 {\secfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2852 \parindent=0pt\raggedright
2853 \rm #1\hfill}}%
2854 \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
2857 % Subsection fonts are the base font at magstep1,
2858 % which produces a size of 12 points.
2860 \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
2861 \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
2862 \subsecheadingbreak}%
2863 {\subsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2864 \parindent=0pt\raggedright
2865 \rm #1\hfill}}%
2866 \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
2868 \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
2869 % Perhaps make sssec fonts scaled
2870 % magstep half
2871 \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
2872 \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
2873 \subsecheadingbreak}%
2874 {\subsubsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
2875 \parindent=0pt\raggedright
2876 \rm #1\hfill}}%
2877 \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
2880 \message{toc printing,}
2882 % Finish up the main text and prepare to read what we've written
2883 % to \contentsfile.
2885 \newskip\contentsrightmargin \contentsrightmargin=1in
2886 \def\startcontents#1{%
2887 \pagealignmacro
2888 \immediate\closeout \contentsfile
2889 \ifnum \pageno>0
2890 \pageno = -1 % Request roman numbered pages.
2892 % Don't need to put `Contents' or `Short Contents' in the headline.
2893 % It is abundantly clear what they are.
2894 \unnumbchapmacro{#1}\def\thischapter{}%
2895 \begingroup % Set up to handle contents files properly.
2896 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
2897 \catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
2898 \raggedbottom % Worry more about breakpoints than the bottom.
2899 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
2903 % Normal (long) toc.
2904 \outer\def\contents{%
2905 \startcontents{\putwordTableofContents}%
2906 \input \jobname.toc
2907 \endgroup
2908 \vfill \eject
2911 % And just the chapters.
2912 \outer\def\summarycontents{%
2913 \startcontents{\putwordShortContents}%
2915 \let\chapentry = \shortchapentry
2916 \let\unnumbchapentry = \shortunnumberedentry
2917 % We want a true roman here for the page numbers.
2918 \secfonts
2919 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
2921 \advance\baselineskip by 1pt % Open it up a little.
2922 \def\secentry ##1##2##3##4{}
2923 \def\unnumbsecentry ##1##2{}
2924 \def\subsecentry ##1##2##3##4##5{}
2925 \def\unnumbsubsecentry ##1##2{}
2926 \def\subsubsecentry ##1##2##3##4##5##6{}
2927 \def\unnumbsubsubsecentry ##1##2{}
2928 \input \jobname.toc
2929 \endgroup
2930 \vfill \eject
2932 \let\shortcontents = \summarycontents
2934 % These macros generate individual entries in the table of contents.
2935 % The first argument is the chapter or section name.
2936 % The last argument is the page number.
2937 % The arguments in between are the chapter number, section number, ...
2939 % Chapter-level things, for both the long and short contents.
2940 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
2942 % See comments in \dochapentry re vbox and related settings
2943 \def\shortchapentry#1#2#3{%
2944 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
2947 % Typeset the label for a chapter or appendix for the short contents.
2948 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
2949 % We could simplify the code here by writing out an \appendixentry
2950 % command in the toc file for appendices, instead of using \chapentry
2951 % for both, but it doesn't seem worth it.
2952 \setbox0 = \hbox{\shortcontrm \putwordAppendix }
2953 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
2955 \def\shortchaplabel#1{%
2956 % We typeset #1 in a box of constant width, regardless of the text of
2957 % #1, so the chapter titles will come out aligned.
2958 \setbox0 = \hbox{#1}%
2959 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
2961 % This space should be plenty, since a single number is .5em, and the
2962 % widest letter (M) is 1em, at least in the Computer Modern fonts.
2963 % (This space doesn't include the extra space that gets added after
2964 % the label; that gets put in in \shortchapentry above.)
2965 \advance\dimen0 by 1.1em
2966 \hbox to \dimen0{#1\hfil}%
2969 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
2970 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
2972 % Sections.
2973 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
2974 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
2976 % Subsections.
2977 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
2978 \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
2980 % And subsubsections.
2981 \def\subsubsecentry#1#2#3#4#5#6{%
2982 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
2983 \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
2986 % This parameter controls the indentation of the various levels.
2987 \newdimen\tocindent \tocindent = 3pc
2989 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
2990 % page number.
2992 % If the toc has to be broken over pages, we would want to be at chapters
2993 % if at all possible; hence the \penalty.
2994 \def\dochapentry#1#2{%
2995 \penalty-300 \vskip\baselineskip
2996 \begingroup
2997 \chapentryfonts
2998 \tocentry{#1}{\dopageno{#2}}%
2999 \endgroup
3000 \nobreak\vskip .25\baselineskip
3003 \def\dosecentry#1#2{\begingroup
3004 \secentryfonts \leftskip=\tocindent
3005 \tocentry{#1}{\dopageno{#2}}%
3006 \endgroup}
3008 \def\dosubsecentry#1#2{\begingroup
3009 \subsecentryfonts \leftskip=2\tocindent
3010 \tocentry{#1}{\dopageno{#2}}%
3011 \endgroup}
3013 \def\dosubsubsecentry#1#2{\begingroup
3014 \subsubsecentryfonts \leftskip=3\tocindent
3015 \tocentry{#1}{\dopageno{#2}}%
3016 \endgroup}
3018 % Final typesetting of a toc entry; we use the same \entry macro as for
3019 % the index entries, but we want to suppress hyphenation here. (We
3020 % can't do that in the \entry macro, since index entries might consist
3021 % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
3023 % \turnoffactive is for the sake of @" used for umlauts.
3024 \def\tocentry#1#2{\begingroup
3025 \hyphenpenalty = 10000
3026 \entry{\turnoffactive #1}{\turnoffactive #2}%
3027 \endgroup}
3029 % Space between chapter (or whatever) number and the title.
3030 \def\labelspace{\hskip1em \relax}
3032 \def\dopageno#1{{\rm #1}}
3033 \def\doshortpageno#1{{\rm #1}}
3035 \def\chapentryfonts{\secfonts \rm}
3036 \def\secentryfonts{\textfonts}
3037 \let\subsecentryfonts = \textfonts
3038 \let\subsubsecentryfonts = \textfonts
3041 \message{environments,}
3043 % Since these characters are used in examples, it should be an even number of
3044 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3045 % Furthermore, these definitions must come after we define our fonts.
3046 \newbox\dblarrowbox \newbox\longdblarrowbox
3047 \newbox\pushcharbox \newbox\bullbox
3048 \newbox\equivbox \newbox\errorbox
3050 \let\ptexequiv = \equiv
3052 %{\tentt
3053 %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
3054 %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
3055 %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
3056 %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
3057 % Adapted from the manmac format (p.420 of TeXbook)
3058 %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
3059 % depth .1ex\hfil}
3062 \def\point{$\star$}
3064 \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3065 \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
3066 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3068 \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3070 % Adapted from the TeXbook's \boxit.
3071 {\tentt \global\dimen0 = 3em}% Width of the box.
3072 \dimen2 = .55pt % Thickness of rules
3073 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3074 \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
3076 \global\setbox\errorbox=\hbox to \dimen0{\hfil
3077 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3078 \advance\hsize by -2\dimen2 % Rules.
3079 \vbox{
3080 \hrule height\dimen2
3081 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3082 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3083 \kern3pt\vrule width\dimen2}% Space to right.
3084 \hrule height\dimen2}
3085 \hfil}
3087 % The @error{} command.
3088 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3090 % @tex ... @end tex escapes into raw Tex temporarily.
3091 % One exception: @ is still an escape character, so that @end tex works.
3092 % But \@ or @@ will get a plain tex @ character.
3094 \def\tex{\begingroup
3095 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
3096 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
3097 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
3098 \catcode `\%=14
3099 \catcode 43=12
3100 \catcode`\"=12
3101 \catcode`\==12
3102 \catcode`\|=12
3103 \catcode`\<=12
3104 \catcode`\>=12
3105 \escapechar=`\\
3107 \let\~=\ptextilde
3108 \let\{=\ptexlbrace
3109 \let\}=\ptexrbrace
3110 \let\.=\ptexdot
3111 \let\*=\ptexstar
3112 \let\dots=\ptexdots
3113 \def\@{@}%
3114 \let\bullet=\ptexbullet
3115 \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
3116 \let\L=\ptexL
3118 \let\Etex=\endgroup}
3120 % Define @lisp ... @endlisp.
3121 % @lisp does a \begingroup so it can rebind things,
3122 % including the definition of @endlisp (which normally is erroneous).
3124 % Amount to narrow the margins by for @lisp.
3125 \newskip\lispnarrowing \lispnarrowing=0.4in
3127 % This is the definition that ^^M gets inside @lisp, @example, and other
3128 % such environments. \null is better than a space, since it doesn't
3129 % have any width.
3130 \def\lisppar{\null\endgraf}
3132 % Make each space character in the input produce a normal interword
3133 % space in the output. Don't allow a line break at this space, as this
3134 % is used only in environments like @example, where each line of input
3135 % should produce a line of output anyway.
3137 {\obeyspaces %
3138 \gdef\sepspaces{\obeyspaces\let =\tie}}
3140 % Define \obeyedspace to be our active space, whatever it is. This is
3141 % for use in \parsearg.
3142 {\sepspaces%
3143 \global\let\obeyedspace= }
3145 % This space is always present above and below environments.
3146 \newskip\envskipamount \envskipamount = 0pt
3148 % Make spacing and below environment symmetrical. We use \parskip here
3149 % to help in doing that, since in @example-like environments \parskip
3150 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
3151 % start of the next paragraph will insert \parskip
3153 \def\aboveenvbreak{{\advance\envskipamount by \parskip
3154 \endgraf \ifdim\lastskip<\envskipamount
3155 \removelastskip \penalty-50 \vskip\envskipamount \fi}}
3157 \let\afterenvbreak = \aboveenvbreak
3159 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
3160 \let\nonarrowing=\relax
3162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3163 % \cartouche: draw rectangle w/rounded corners around argument
3164 \font\circle=lcircle10
3165 \newdimen\circthick
3166 \newdimen\cartouter\newdimen\cartinner
3167 \newskip\normbskip\newskip\normpskip\newskip\normlskip
3168 \circthick=\fontdimen8\circle
3170 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
3171 \def\ctr{{\hskip 6pt\circle\char'010}}
3172 \def\cbl{{\circle\char'012\hskip -6pt}}
3173 \def\cbr{{\hskip 6pt\circle\char'011}}
3174 \def\carttop{\hbox to \cartouter{\hskip\lskip
3175 \ctl\leaders\hrule height\circthick\hfil\ctr
3176 \hskip\rskip}}
3177 \def\cartbot{\hbox to \cartouter{\hskip\lskip
3178 \cbl\leaders\hrule height\circthick\hfil\cbr
3179 \hskip\rskip}}
3181 \newskip\lskip\newskip\rskip
3183 \long\def\cartouche{%
3184 \begingroup
3185 \lskip=\leftskip \rskip=\rightskip
3186 \leftskip=0pt\rightskip=0pt %we want these *outside*.
3187 \cartinner=\hsize \advance\cartinner by-\lskip
3188 \advance\cartinner by-\rskip
3189 \cartouter=\hsize
3190 \advance\cartouter by 18pt % allow for 3pt kerns on either
3191 % side, and for 6pt waste from
3192 % each corner char
3193 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
3194 % Flag to tell @lisp, etc., not to narrow margin.
3195 \let\nonarrowing=\comment
3196 \vbox\bgroup
3197 \baselineskip=0pt\parskip=0pt\lineskip=0pt
3198 \carttop
3199 \hbox\bgroup
3200 \hskip\lskip
3201 \vrule\kern3pt
3202 \vbox\bgroup
3203 \hsize=\cartinner
3204 \kern3pt
3205 \begingroup
3206 \baselineskip=\normbskip
3207 \lineskip=\normlskip
3208 \parskip=\normpskip
3209 \vskip -\parskip
3210 \def\Ecartouche{%
3211 \endgroup
3212 \kern3pt
3213 \egroup
3214 \kern3pt\vrule
3215 \hskip\rskip
3216 \egroup
3217 \cartbot
3218 \egroup
3219 \endgroup
3223 % This macro is called at the beginning of all the @example variants,
3224 % inside a group.
3225 \def\nonfillstart{%
3226 \aboveenvbreak
3227 \inENV % This group ends at the end of the body
3228 \hfuzz = 12pt % Don't be fussy
3229 \sepspaces % Make spaces be word-separators rather than space tokens.
3230 \singlespace
3231 \let\par = \lisppar % don't ignore blank lines
3232 \obeylines % each line of input is a line of output
3233 \parskip = 0pt
3234 \parindent = 0pt
3235 \emergencystretch = 0pt % don't try to avoid overfull boxes
3236 % @cartouche defines \nonarrowing to inhibit narrowing
3237 % at next level down.
3238 \ifx\nonarrowing\relax
3239 \advance \leftskip by \lispnarrowing
3240 \exdentamount=\lispnarrowing
3241 \let\exdent=\nofillexdent
3242 \let\nonarrowing=\relax
3246 % To ending an @example-like environment, we first end the paragraph
3247 % (via \afterenvbreak's vertical glue), and then the group. That way we
3248 % keep the zero \parskip that the environments set -- \parskip glue
3249 % will be inserted at the beginning of the next paragraph in the
3250 % document, after the environment.
3252 \def\nonfillfinish{\afterenvbreak\endgroup}%
3254 % This macro is
3255 \def\lisp{\begingroup
3256 \nonfillstart
3257 \let\Elisp = \nonfillfinish
3259 \rawbackslash % have \ input char produce \ char from current font
3260 \gobble
3263 % Define the \E... control sequence only if we are inside the
3264 % environment, so the error checking in \end will work.
3266 % We must call \lisp last in the definition, since it reads the
3267 % return following the @example (or whatever) command.
3269 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
3270 \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
3271 \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
3273 % @smallexample and @smalllisp. This is not used unless the @smallbook
3274 % command is given. Originally contributed by Pavel@xerox.
3276 \def\smalllispx{\begingroup
3277 \nonfillstart
3278 \let\Esmalllisp = \nonfillfinish
3279 \let\Esmallexample = \nonfillfinish
3281 % Smaller interline space and fonts for small examples.
3282 \setleading{10pt}%
3283 \indexfonts \tt
3284 \rawbackslash % make \ output the \ character from the current font (tt)
3285 \gobble
3288 % This is @display; same as @lisp except use roman font.
3290 \def\display{\begingroup
3291 \nonfillstart
3292 \let\Edisplay = \nonfillfinish
3293 \gobble
3296 % This is @format; same as @display except don't narrow margins.
3298 \def\format{\begingroup
3299 \let\nonarrowing = t
3300 \nonfillstart
3301 \let\Eformat = \nonfillfinish
3302 \gobble
3305 % @flushleft (same as @format) and @flushright.
3307 \def\flushleft{\begingroup
3308 \let\nonarrowing = t
3309 \nonfillstart
3310 \let\Eflushleft = \nonfillfinish
3311 \gobble
3313 \def\flushright{\begingroup
3314 \let\nonarrowing = t
3315 \nonfillstart
3316 \let\Eflushright = \nonfillfinish
3317 \advance\leftskip by 0pt plus 1fill
3318 \gobble}
3320 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
3321 % and narrows the margins.
3323 \def\quotation{%
3324 \begingroup\inENV %This group ends at the end of the @quotation body
3325 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
3326 \singlespace
3327 \parindent=0pt
3328 % We have retained a nonzero parskip for the environment, since we're
3329 % doing normal filling. So to avoid extra space below the environment...
3330 \def\Equotation{\parskip = 0pt \nonfillfinish}%
3332 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
3333 \ifx\nonarrowing\relax
3334 \advance\leftskip by \lispnarrowing
3335 \advance\rightskip by \lispnarrowing
3336 \exdentamount = \lispnarrowing
3337 \let\nonarrowing = \relax
3341 \message{defuns,}
3342 % Define formatter for defuns
3343 % First, allow user to change definition object font (\df) internally
3344 \def\setdeffont #1 {\csname DEF#1\endcsname}
3346 \newskip\defbodyindent \defbodyindent=.4in
3347 \newskip\defargsindent \defargsindent=50pt
3348 \newskip\deftypemargin \deftypemargin=12pt
3349 \newskip\deflastargmargin \deflastargmargin=18pt
3351 \newcount\parencount
3352 % define \functionparens, which makes ( and ) and & do special things.
3353 % \functionparens affects the group it is contained in.
3354 \def\activeparens{%
3355 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
3356 \catcode`\[=\active \catcode`\]=\active}
3358 % Make control sequences which act like normal parenthesis chars.
3359 \let\lparen = ( \let\rparen = )
3361 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
3363 % Be sure that we always have a definition for `(', etc. For example,
3364 % if the fn name has parens in it, \boldbrax will not be in effect yet,
3365 % so TeX would otherwise complain about undefined control sequence.
3366 \global\let(=\lparen \global\let)=\rparen
3367 \global\let[=\lbrack \global\let]=\rbrack
3369 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
3370 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
3371 % This is used to turn on special parens
3372 % but make & act ordinary (given that it's active).
3373 \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
3375 % Definitions of (, ) and & used in args for functions.
3376 % This is the definition of ( outside of all parentheses.
3377 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
3378 \global\advance\parencount by 1 }
3380 % This is the definition of ( when already inside a level of parens.
3381 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
3383 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
3384 % also in that case restore the outer-level definition of (.
3385 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
3386 \global\advance \parencount by -1 }
3387 % If we encounter &foo, then turn on ()-hacking afterwards
3388 \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
3390 \gdef\normalparens{\boldbrax\let&=\ampnr}
3391 } % End of definition inside \activeparens
3392 %% These parens (in \boldbrax) actually are a little bolder than the
3393 %% contained text. This is especially needed for [ and ]
3394 \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
3395 \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
3397 % First, defname, which formats the header line itself.
3398 % #1 should be the function name.
3399 % #2 should be the type of definition, such as "Function".
3401 \def\defname #1#2{%
3402 % Get the values of \leftskip and \rightskip as they were
3403 % outside the @def...
3404 \dimen2=\leftskip
3405 \advance\dimen2 by -\defbodyindent
3406 \dimen3=\rightskip
3407 \advance\dimen3 by -\defbodyindent
3408 \noindent %
3409 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
3410 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
3411 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
3412 \parshape 2 0in \dimen0 \defargsindent \dimen1 %
3413 % Now output arg 2 ("Function" or some such)
3414 % ending at \deftypemargin from the right margin,
3415 % but stuck inside a box of width 0 so it does not interfere with linebreaking
3416 {% Adjust \hsize to exclude the ambient margins,
3417 % so that \rightline will obey them.
3418 \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
3419 \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
3420 % Make all lines underfull and no complaints:
3421 \tolerance=10000 \hbadness=10000
3422 \advance\leftskip by -\defbodyindent
3423 \exdentamount=\defbodyindent
3424 {\df #1}\enskip % Generate function name
3427 % Actually process the body of a definition
3428 % #1 should be the terminating control sequence, such as \Edefun.
3429 % #2 should be the "another name" control sequence, such as \defunx.
3430 % #3 should be the control sequence that actually processes the header,
3431 % such as \defunheader.
3433 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3434 \medbreak %
3435 % Define the end token that this defining construct specifies
3436 % so that it will exit this group.
3437 \def#1{\endgraf\endgroup\medbreak}%
3438 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
3439 \parindent=0in
3440 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3441 \exdentamount=\defbodyindent
3442 \begingroup %
3443 \catcode 61=\active % 61 is `='
3444 \obeylines\activeparens\spacesplit#3}
3446 \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
3447 \medbreak %
3448 % Define the end token that this defining construct specifies
3449 % so that it will exit this group.
3450 \def#1{\endgraf\endgroup\medbreak}%
3451 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
3452 \parindent=0in
3453 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3454 \exdentamount=\defbodyindent
3455 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
3457 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
3458 \medbreak %
3459 % Define the end token that this defining construct specifies
3460 % so that it will exit this group.
3461 \def#1{\endgraf\endgroup\medbreak}%
3462 \def#2##1 ##2 {\def#4{##1}%
3463 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
3464 \parindent=0in
3465 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3466 \exdentamount=\defbodyindent
3467 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
3469 % These parsing functions are similar to the preceding ones
3470 % except that they do not make parens into active characters.
3471 % These are used for "variables" since they have no arguments.
3473 \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
3474 \medbreak %
3475 % Define the end token that this defining construct specifies
3476 % so that it will exit this group.
3477 \def#1{\endgraf\endgroup\medbreak}%
3478 \def#2{\begingroup\obeylines\spacesplit#3}%
3479 \parindent=0in
3480 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3481 \exdentamount=\defbodyindent
3482 \begingroup %
3483 \catcode 61=\active %
3484 \obeylines\spacesplit#3}
3486 % This is used for \def{tp,vr}parsebody. It could probably be used for
3487 % some of the others, too, with some judicious conditionals.
3489 \def\parsebodycommon#1#2#3{%
3490 \begingroup\inENV %
3491 \medbreak %
3492 % Define the end token that this defining construct specifies
3493 % so that it will exit this group.
3494 \def#1{\endgraf\endgroup\medbreak}%
3495 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
3496 \parindent=0in
3497 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3498 \exdentamount=\defbodyindent
3499 \begingroup\obeylines
3502 \def\defvrparsebody#1#2#3#4 {%
3503 \parsebodycommon{#1}{#2}{#3}%
3504 \spacesplit{#3{#4}}%
3507 % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
3508 % type is just `struct', because we lose the braces in `{struct
3509 % termios}' when \spacesplit reads its undelimited argument. Sigh.
3510 % \let\deftpparsebody=\defvrparsebody
3512 % So, to get around this, we put \empty in with the type name. That
3513 % way, TeX won't find exactly `{...}' as an undelimited argument, and
3514 % won't strip off the braces.
3516 \def\deftpparsebody #1#2#3#4 {%
3517 \parsebodycommon{#1}{#2}{#3}%
3518 \spacesplit{\parsetpheaderline{#3{#4}}}\empty
3521 % Fine, but then we have to eventually remove the \empty *and* the
3522 % braces (if any). That's what this does, putting the result in \tptemp.
3524 \def\removeemptybraces\empty#1\relax{\def\tptemp{#1}}%
3526 % After \spacesplit has done its work, this is called -- #1 is the final
3527 % thing to call, #2 the type name (which starts with \empty), and #3
3528 % (which might be empty) the arguments.
3530 \def\parsetpheaderline#1#2#3{%
3531 \removeemptybraces#2\relax
3532 #1{\tptemp}{#3}%
3535 \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
3536 \medbreak %
3537 % Define the end token that this defining construct specifies
3538 % so that it will exit this group.
3539 \def#1{\endgraf\endgroup\medbreak}%
3540 \def#2##1 ##2 {\def#4{##1}%
3541 \begingroup\obeylines\spacesplit{#3{##2}}}%
3542 \parindent=0in
3543 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
3544 \exdentamount=\defbodyindent
3545 \begingroup\obeylines\spacesplit{#3{#5}}}
3547 % Split up #2 at the first space token.
3548 % call #1 with two arguments:
3549 % the first is all of #2 before the space token,
3550 % the second is all of #2 after that space token.
3551 % If #2 contains no space token, all of it is passed as the first arg
3552 % and the second is passed as empty.
3554 {\obeylines
3555 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
3556 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
3557 \ifx\relax #3%
3558 #1{#2}{}\else #1{#2}{#3#4}\fi}}
3560 % So much for the things common to all kinds of definitions.
3562 % Define @defun.
3564 % First, define the processing that is wanted for arguments of \defun
3565 % Use this to expand the args and terminate the paragraph they make up
3567 \def\defunargs #1{\functionparens \sl
3568 % Expand, preventing hyphenation at `-' chars.
3569 % Note that groups don't affect changes in \hyphenchar.
3570 \hyphenchar\tensl=0
3572 \hyphenchar\tensl=45
3573 \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
3574 \interlinepenalty=10000
3575 \advance\rightskip by 0pt plus 1fil
3576 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
3579 \def\deftypefunargs #1{%
3580 % Expand, preventing hyphenation at `-' chars.
3581 % Note that groups don't affect changes in \hyphenchar.
3582 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
3583 \boldbraxnoamp
3584 \tclose{#1}% avoid \code because of side effects on active chars
3585 \interlinepenalty=10000
3586 \advance\rightskip by 0pt plus 1fil
3587 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
3590 % Do complete processing of one @defun or @defunx line already parsed.
3592 % @deffn Command forward-char nchars
3594 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
3596 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
3597 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
3598 \catcode 61=\other % Turn off change made in \defparsebody
3601 % @defun == @deffn Function
3603 \def\defun{\defparsebody\Edefun\defunx\defunheader}
3605 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3606 \begingroup\defname {#1}{Function}%
3607 \defunargs {#2}\endgroup %
3608 \catcode 61=\other % Turn off change made in \defparsebody
3611 % @deftypefun int foobar (int @var{foo}, float @var{bar})
3613 \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
3615 % #1 is the data type. #2 is the name and args.
3616 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
3617 % #1 is the data type, #2 the name, #3 the args.
3618 \def\deftypefunheaderx #1#2 #3\relax{%
3619 \doind {fn}{\code{#2}}% Make entry in function index
3620 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
3621 \deftypefunargs {#3}\endgroup %
3622 \catcode 61=\other % Turn off change made in \defparsebody
3625 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
3627 \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
3629 % \defheaderxcond#1\relax$$$
3630 % puts #1 in @code, followed by a space, but does nothing if #1 is null.
3631 \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
3633 % #1 is the classification. #2 is the data type. #3 is the name and args.
3634 \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
3635 % #1 is the classification, #2 the data type, #3 the name, #4 the args.
3636 \def\deftypefnheaderx #1#2#3 #4\relax{%
3637 \doind {fn}{\code{#3}}% Make entry in function index
3638 \begingroup
3639 \normalparens % notably, turn off `&' magic, which prevents
3640 % at least some C++ text from working
3641 \defname {\defheaderxcond#2\relax$$$#3}{#1}%
3642 \deftypefunargs {#4}\endgroup %
3643 \catcode 61=\other % Turn off change made in \defparsebody
3646 % @defmac == @deffn Macro
3648 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
3650 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3651 \begingroup\defname {#1}{Macro}%
3652 \defunargs {#2}\endgroup %
3653 \catcode 61=\other % Turn off change made in \defparsebody
3656 % @defspec == @deffn Special Form
3658 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
3660 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
3661 \begingroup\defname {#1}{Special Form}%
3662 \defunargs {#2}\endgroup %
3663 \catcode 61=\other % Turn off change made in \defparsebody
3666 % This definition is run if you use @defunx
3667 % anywhere other than immediately after a @defun or @defunx.
3669 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
3670 \def\defunx #1 {\errmessage{@defunx in invalid context}}
3671 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
3672 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
3673 \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
3674 \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
3676 % @defmethod, and so on
3678 % @defop {Funny Method} foo-class frobnicate argument
3680 \def\defop #1 {\def\defoptype{#1}%
3681 \defopparsebody\Edefop\defopx\defopheader\defoptype}
3683 \def\defopheader #1#2#3{%
3684 \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
3685 \begingroup\defname {#2}{\defoptype{} on #1}%
3686 \defunargs {#3}\endgroup %
3689 % @defmethod == @defop Method
3691 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
3693 \def\defmethodheader #1#2#3{%
3694 \dosubind {fn}{\code{#2}}{on #1}% entry in function index
3695 \begingroup\defname {#2}{Method on #1}%
3696 \defunargs {#3}\endgroup %
3699 % @defcv {Class Option} foo-class foo-flag
3701 \def\defcv #1 {\def\defcvtype{#1}%
3702 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
3704 \def\defcvarheader #1#2#3{%
3705 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
3706 \begingroup\defname {#2}{\defcvtype{} of #1}%
3707 \defvarargs {#3}\endgroup %
3710 % @defivar == @defcv {Instance Variable}
3712 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
3714 \def\defivarheader #1#2#3{%
3715 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
3716 \begingroup\defname {#2}{Instance Variable of #1}%
3717 \defvarargs {#3}\endgroup %
3720 % These definitions are run if you use @defmethodx, etc.,
3721 % anywhere other than immediately after a @defmethod, etc.
3723 \def\defopx #1 {\errmessage{@defopx in invalid context}}
3724 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
3725 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
3726 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
3728 % Now @defvar
3730 % First, define the processing that is wanted for arguments of @defvar.
3731 % This is actually simple: just print them in roman.
3732 % This must expand the args and terminate the paragraph they make up
3733 \def\defvarargs #1{\normalparens #1%
3734 \interlinepenalty=10000
3735 \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
3737 % @defvr Counter foo-count
3739 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
3741 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
3742 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
3744 % @defvar == @defvr Variable
3746 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
3748 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
3749 \begingroup\defname {#1}{Variable}%
3750 \defvarargs {#2}\endgroup %
3753 % @defopt == @defvr {User Option}
3755 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
3757 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
3758 \begingroup\defname {#1}{User Option}%
3759 \defvarargs {#2}\endgroup %
3762 % @deftypevar int foobar
3764 \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
3766 % #1 is the data type. #2 is the name.
3767 \def\deftypevarheader #1#2{%
3768 \doind {vr}{\code{#2}}% Make entry in variables index
3769 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
3770 \interlinepenalty=10000
3771 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
3772 \endgroup}
3774 % @deftypevr {Global Flag} int enable
3776 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
3778 \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
3779 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
3780 \interlinepenalty=10000
3781 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
3782 \endgroup}
3784 % This definition is run if you use @defvarx
3785 % anywhere other than immediately after a @defvar or @defvarx.
3787 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
3788 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
3789 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
3790 \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
3791 \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
3793 % Now define @deftp
3794 % Args are printed in bold, a slight difference from @defvar.
3796 \def\deftpargs #1{\bf \defvarargs{#1}}
3798 % @deftp Class window height width ...
3800 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
3802 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
3803 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
3805 % This definition is run if you use @deftpx, etc
3806 % anywhere other than immediately after a @deftp, etc.
3808 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
3810 \message{cross reference,}
3811 % Define cross-reference macros
3812 \newwrite \auxfile
3814 \newif\ifhavexrefs % True if xref values are known.
3815 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
3817 % \setref{foo} defines a cross-reference point named foo.
3819 \def\setref#1{%
3820 \dosetq{#1-title}{Ytitle}%
3821 \dosetq{#1-pg}{Ypagenumber}%
3822 \dosetq{#1-snt}{Ysectionnumberandtype}}
3824 \def\unnumbsetref#1{%
3825 \dosetq{#1-title}{Ytitle}%
3826 \dosetq{#1-pg}{Ypagenumber}%
3827 \dosetq{#1-snt}{Ynothing}}
3829 \def\appendixsetref#1{%
3830 \dosetq{#1-title}{Ytitle}%
3831 \dosetq{#1-pg}{Ypagenumber}%
3832 \dosetq{#1-snt}{Yappendixletterandtype}}
3834 % \xref, \pxref, and \ref generate cross-references to specified points.
3835 % For \xrefX, #1 is the node name, #2 the name of the Info
3836 % cross-reference, #3 the printed node name, #4 the name of the Info
3837 % file, #5 the name of the printed manual. All but the node name can be
3838 % omitted.
3840 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
3841 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
3842 \def\ref#1{\xrefX[#1,,,,,,,]}
3843 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
3844 \def\printedmanual{\ignorespaces #5}%
3845 \def\printednodename{\ignorespaces #3}%
3846 \setbox1=\hbox{\printedmanual}%
3847 \setbox0=\hbox{\printednodename}%
3848 \ifdim \wd0 = 0pt
3849 % No printed node name was explicitly given.
3850 \ifx\SETxref-automatic-section-title\thisisundefined
3851 % Use the node name inside the square brackets.
3852 \def\printednodename{\ignorespaces #1}%
3853 \else
3854 % Use the actual chapter/section title appear inside
3855 % the square brackets. Use the real section title if we have it.
3856 \ifdim \wd1>0pt%
3857 % It is in another manual, so we don't have it.
3858 \def\printednodename{\ignorespaces #1}%
3859 \else
3860 \ifhavexrefs
3861 % We know the real title if we have the xref values.
3862 \def\printednodename{\refx{#1-title}{}}%
3863 \else
3864 % Otherwise just copy the Info node name.
3865 \def\printednodename{\ignorespaces #1}%
3866 \fi%
3871 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
3872 % insert empty discretionaries after hyphens, which means that it will
3873 % not find a line break at a hyphen in a node names. Since some manuals
3874 % are best written with fairly long node names, containing hyphens, this
3875 % is a loss. Therefore, we give the text of the node name again, so it
3876 % is as if TeX is seeing it for the first time.
3877 \ifdim \wd1 > 0pt
3878 \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
3879 \else
3880 % _ (for example) has to be the character _ for the purposes of the
3881 % control sequence corresponding to the node, but it has to expand
3882 % into the usual \leavevmode...\vrule stuff for purposes of
3883 % printing. So we \turnoffactive for the \refx-snt, back on for the
3884 % printing, back off for the \refx-pg.
3885 {\turnoffactive \refx{#1-snt}{}}%
3886 \space [\printednodename],\space
3887 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
3889 \endgroup}
3891 % \dosetq is the interface for calls from other macros
3893 % Use \turnoffactive so that punctuation chars such as underscore
3894 % work in node names.
3895 \def\dosetq #1#2{{\let\folio=0 \turnoffactive \auxhat%
3896 \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
3897 \next}}
3899 % \internalsetq {foo}{page} expands into
3900 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
3901 % When the aux file is read, ' is the escape character
3903 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
3905 % Things to be expanded by \internalsetq
3907 \def\Ypagenumber{\folio}
3909 \def\Ytitle{\thissection}
3911 \def\Ynothing{}
3913 \def\Ysectionnumberandtype{%
3914 \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
3915 \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
3916 \else \ifnum \subsubsecno=0 %
3917 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
3918 \else %
3919 \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
3920 \fi \fi \fi }
3922 \def\Yappendixletterandtype{%
3923 \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
3924 \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
3925 \else \ifnum \subsubsecno=0 %
3926 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
3927 \else %
3928 \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
3929 \fi \fi \fi }
3931 \gdef\xreftie{'tie}
3933 % Use TeX 3.0's \inputlineno to get the line number, for better error
3934 % messages, but if we're using an old version of TeX, don't do anything.
3936 \ifx\inputlineno\thisisundefined
3937 \let\linenumber = \empty % Non-3.0.
3938 \else
3939 \def\linenumber{\the\inputlineno:\space}
3942 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
3943 % If its value is nonempty, SUFFIX is output afterward.
3945 \def\refx#1#2{%
3946 \expandafter\ifx\csname X#1\endcsname\relax
3947 % If not defined, say something at least.
3948 $\langle$un\-de\-fined$\rangle$%
3949 \ifhavexrefs
3950 \message{\linenumber Undefined cross reference `#1'.}%
3951 \else
3952 \ifwarnedxrefs\else
3953 \global\warnedxrefstrue
3954 \message{Cross reference values unknown; you must run TeX again.}%
3957 \else
3958 % It's defined, so just use it.
3959 \csname X#1\endcsname
3961 #2% Output the suffix in any case.
3964 % Read the last existing aux file, if any. No error if none exists.
3966 % This is the macro invoked by entries in the aux file.
3967 \def\xrdef #1#2{
3968 {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
3970 \def\readauxfile{%
3971 \begingroup
3972 \catcode `\^^@=\other
3973 \catcode `\\x01=\other
3974 \catcode `\\x02=\other
3975 \catcode `\^^C=\other
3976 \catcode `\^^D=\other
3977 \catcode `\^^E=\other
3978 \catcode `\^^F=\other
3979 \catcode `\^^G=\other
3980 \catcode `\^^H=\other
3981 \catcode `\\v=\other
3982 \catcode `\^^L=\other
3983 \catcode `\\x0e=\other
3984 \catcode `\\x0f=\other
3985 \catcode `\\x10=\other
3986 \catcode `\\x11=\other
3987 \catcode `\\x12=\other
3988 \catcode `\\x13=\other
3989 \catcode `\\x14=\other
3990 \catcode `\\x15=\other
3991 \catcode `\\x16=\other
3992 \catcode `\\x17=\other
3993 \catcode `\\x18=\other
3994 \catcode `\\x19=\other
3995 \catcode 26=\other
3996 \catcode `\^^[=\other
3997 \catcode `\^^\=\other
3998 \catcode `\^^]=\other
3999 \catcode `\^^^=\other
4000 \catcode `\^^_=\other
4001 \catcode `\@=\other
4002 \catcode `\^=\other
4003 \catcode `\~=\other
4004 \catcode `\[=\other
4005 \catcode `\]=\other
4006 \catcode`\"=\other
4007 \catcode`\_=\other
4008 \catcode`\|=\other
4009 \catcode`\<=\other
4010 \catcode`\>=\other
4011 \catcode `\$=\other
4012 \catcode `\#=\other
4013 \catcode `\&=\other
4014 % `\+ does not work, so use 43.
4015 \catcode 43=\other
4016 % Make the characters 128-255 be printing characters
4018 \count 1=128
4019 \def\loop{%
4020 \catcode\count 1=\other
4021 \advance\count 1 by 1
4022 \ifnum \count 1<256 \loop \fi
4025 % the aux file uses ' as the escape.
4026 % Turn off \ as an escape so we do not lose on
4027 % entries which were dumped with control sequences in their names.
4028 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
4029 % Reference to such entries still does not work the way one would wish,
4030 % but at least they do not bomb out when the aux file is read in.
4031 \catcode `\{=1 \catcode `\}=2
4032 \catcode `\%=\other
4033 \catcode `\'=0
4034 \catcode`\^=7 % to make ^^e4 etc usable in xref tags
4035 \catcode `\\=\other
4036 \openin 1 \jobname.aux
4037 \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
4038 \global\warnedobstrue
4040 % Open the new aux file. Tex will close it automatically at exit.
4041 \openout \auxfile=\jobname.aux
4042 \endgroup}
4045 % Footnotes.
4047 \newcount \footnoteno
4049 % The trailing space in the following definition for supereject is
4050 % vital for proper filling; pages come out unaligned when you do a
4051 % pagealignmacro call if that space before the closing brace is
4052 % removed.
4053 \def\supereject{\par\penalty -20000\footnoteno =0 }
4055 % @footnotestyle is meaningful for info output only..
4056 \let\footnotestyle=\comment
4058 \let\ptexfootnote=\footnote
4060 {\catcode `\@=11
4062 % Auto-number footnotes. Otherwise like plain.
4063 \gdef\footnote{%
4064 \global\advance\footnoteno by \@ne
4065 \edef\thisfootno{$^{\the\footnoteno}$}%
4067 % In case the footnote comes at the end of a sentence, preserve the
4068 % extra spacing after we do the footnote number.
4069 \let\@sf\empty
4070 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
4072 % Remove inadvertent blank space before typesetting the footnote number.
4073 \unskip
4074 \thisfootno\@sf
4075 \footnotezzz
4078 % Don't bother with the trickery in plain.tex to not require the
4079 % footnote text as a parameter. Our footnotes don't need to be so general.
4081 \long\gdef\footnotezzz#1{\insert\footins{%
4082 % We want to typeset this text as a normal paragraph, even if the
4083 % footnote reference occurs in (for example) a display environment.
4084 % So reset some parameters.
4085 \interlinepenalty\interfootnotelinepenalty
4086 \splittopskip\ht\strutbox % top baseline for broken footnotes
4087 \splitmaxdepth\dp\strutbox
4088 \floatingpenalty\@MM
4089 \leftskip\z@skip
4090 \rightskip\z@skip
4091 \spaceskip\z@skip
4092 \xspaceskip\z@skip
4093 \parindent\defaultparindent
4095 % Hang the footnote text off the number.
4096 \hang
4097 \textindent{\thisfootno}%
4099 % Don't crash into the line above the footnote text. Since this
4100 % expands into a box, it must come within the paragraph, lest it
4101 % provide a place where TeX can split the footnote.
4102 \footstrut
4103 #1\strut}%
4106 }%end \catcode `\@=11
4108 % Set the baselineskip to #1, and the lineskip and strut size
4109 % correspondingly. There is no deep meaning behind these magic numbers
4110 % used as factors; they just match (closely enough) what Knuth defined.
4112 \def\lineskipfactor{.08333}
4113 \def\strutheightpercent{.70833}
4114 \def\strutdepthpercent {.29167}
4116 \def\setleading#1{%
4117 \normalbaselineskip = #1\relax
4118 \normallineskip = \lineskipfactor\normalbaselineskip
4119 \normalbaselines
4120 \setbox\strutbox =\hbox{%
4121 \vrule width0pt height\strutheightpercent\baselineskip
4122 depth \strutdepthpercent \baselineskip
4126 % @| inserts a changebar to the left of the current line. It should
4127 % surround any changed text. This approach does *not* work if the
4128 % change spans more than two lines of output. To handle that, we would
4129 % have adopt a much more difficult approach (putting marks into the main
4130 % vertical list for the beginning and end of each change).
4132 \def\|{%
4133 % \vadjust can only be used in horizontal mode.
4134 \leavevmode
4136 % Append this vertical mode material after the current line in the output.
4137 \vadjust{%
4138 % We want to insert a rule with the height and depth of the current
4139 % leading; that is exactly what \strutbox is supposed to record.
4140 \vskip-\baselineskip
4142 % \vadjust-items are inserted at the left edge of the type. So
4143 % the \llap here moves out into the left-hand margin.
4144 \llap{%
4146 % For a thicker or thinner bar, change the `1pt'.
4147 \vrule height\baselineskip width1pt
4149 % This is the space between the bar and the text.
4150 \hskip 12pt
4155 % For a final copy, take out the rectangles
4156 % that mark overfull boxes (in case you have decided
4157 % that the text looks ok even though it passes the margin).
4159 \def\finalout{\overfullrule=0pt}
4162 % End of control word definitions.
4164 \message{and turning on texinfo input format.}
4166 \def\openindices{%
4167 \newindex{cp}%
4168 \newcodeindex{fn}%
4169 \newcodeindex{vr}%
4170 \newcodeindex{tp}%
4171 \newcodeindex{ky}%
4172 \newcodeindex{pg}%
4175 % Set some numeric style parameters, for 8.5 x 11 format.
4177 %\hsize = 6.5in
4178 \newdimen\defaultparindent \defaultparindent = 15pt
4179 \parindent = \defaultparindent
4180 \parskip 18pt plus 1pt
4181 \setleading{15pt}
4182 \advance\topskip by 1.2cm
4184 % Prevent underfull vbox error messages.
4185 \vbadness=10000
4187 % Following George Bush, just get rid of widows and orphans.
4188 \widowpenalty=10000
4189 \clubpenalty=10000
4191 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
4192 % using an old version of TeX, don't do anything. We want the amount of
4193 % stretch added to depend on the line length, hence the dependence on
4194 % \hsize. This makes it come to about 9pt for the 8.5x11 format.
4196 \ifx\emergencystretch\thisisundefined
4197 % Allow us to assign to \emergencystretch anyway.
4198 \def\emergencystretch{\dimen0}%
4199 \else
4200 \emergencystretch = \hsize
4201 \divide\emergencystretch by 45
4204 % Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25)
4205 \def\smallbook{
4207 % These values for secheadingskip and subsecheadingskip are
4208 % experiments. RJC 7 Aug 1992
4209 \global\secheadingskip = 17pt plus 6pt minus 3pt
4210 \global\subsecheadingskip = 14pt plus 6pt minus 3pt
4212 \global\lispnarrowing = 0.3in
4213 \setleading{12pt}
4214 \advance\topskip by -1cm
4215 \global\parskip 3pt plus 1pt
4216 \global\hsize = 5in
4217 \global\vsize=7.5in
4218 \global\tolerance=700
4219 \global\hfuzz=1pt
4220 \global\contentsrightmargin=0pt
4221 \global\deftypemargin=0pt
4222 \global\defbodyindent=.5cm
4224 \global\pagewidth=\hsize
4225 \global\pageheight=\vsize
4227 \global\let\smalllisp=\smalllispx
4228 \global\let\smallexample=\smalllispx
4229 \global\def\Esmallexample{\Esmalllisp}
4232 % Use @afourpaper to print on European A4 paper.
4233 \def\afourpaper{
4234 \global\tolerance=700
4235 \global\hfuzz=1pt
4236 \setleading{12pt}
4237 \global\parskip 15pt plus 1pt
4239 \global\vsize= 53\baselineskip
4240 \advance\vsize by \topskip
4241 %\global\hsize= 5.85in % A4 wide 10pt
4242 \global\hsize= 6.5in
4243 \global\outerhsize=\hsize
4244 \global\advance\outerhsize by 0.5in
4245 \global\outervsize=\vsize
4246 \global\advance\outervsize by 0.6in
4248 \global\pagewidth=\hsize
4249 \global\pageheight=\vsize
4252 % Allow control of the text dimensions. Parameters in order: textheight;
4253 % textwidth; \voffset; \hoffset (!); binding offset. All require a dimension;
4254 % header is additional; added length extends the bottom of the page.
4256 \def\changepagesizes#1#2#3#4#5{
4257 \global\vsize= #1
4258 \advance\vsize by \topskip
4259 \global\voffset= #3
4260 \global\hsize= #2
4261 \global\outerhsize=\hsize
4262 \global\advance\outerhsize by 0.5in
4263 \global\outervsize=\vsize
4264 \global\advance\outervsize by 0.6in
4265 \global\pagewidth=\hsize
4266 \global\pageheight=\vsize
4267 \global\normaloffset= #4
4268 \global\bindingoffset= #5}
4270 % This layout is compatible with Latex on A4 paper.
4272 \def\afourlatex{\changepagesizes{22cm}{15cm}{7mm}{4.6mm}{5mm}}
4274 % Use @afourwide to print on European A4 paper in wide format.
4275 \def\afourwide{\afourpaper
4276 \changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}}
4278 % Define macros to output various characters with catcode for normal text.
4279 \catcode`\"=\other
4280 \catcode`\~=\other
4281 \catcode`\^=\other
4282 \catcode`\_=\other
4283 \catcode`\|=\other
4284 \catcode`\<=\other
4285 \catcode`\>=\other
4286 \catcode`\+=\other
4287 \def\normaldoublequote{"}
4288 \def\normaltilde{~}
4289 \def\normalcaret{^}
4290 \def\normalunderscore{_}
4291 \def\normalverticalbar{|}
4292 \def\normalless{<}
4293 \def\normalgreater{>}
4294 \def\normalplus{+}
4296 % This macro is used to make a character print one way in ttfont
4297 % where it can probably just be output, and another way in other fonts,
4298 % where something hairier probably needs to be done.
4300 % #1 is what to print if we are indeed using \tt; #2 is what to print
4301 % otherwise. Since all the Computer Modern typewriter fonts have zero
4302 % interword stretch (and shrink), and it is reasonable to expect all
4303 % typewriter fonts to have this, we can check that font parameter.
4305 \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
4307 % Turn off all special characters except @
4308 % (and those which the user can use as if they were ordinary).
4309 % Most of these we simply print from the \tt font, but for some, we can
4310 % use math or other variants that look better in normal text.
4312 \catcode`\"=\active
4313 \def\activedoublequote{{\tt \char '042}}
4314 \let"=\activedoublequote
4315 \catcode`\~=\active
4316 \def~{{\tt \char '176}}
4317 \chardef\hat=`\^
4318 \catcode`\^=\active
4319 \def\auxhat{\def^{'hat}}
4320 \def^{{\tt \hat}}
4322 \catcode`\_=\active
4323 \def_{\ifusingtt\normalunderscore\_}
4324 % Subroutine for the previous macro.
4325 \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
4327 % \lvvmode is equivalent in function to \leavevmode.
4328 % Using \leavevmode runs into trouble when written out to
4329 % an index file due to the expansion of \leavevmode into ``\unhbox
4330 % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
4331 % magic tricks with @.
4332 \def\lvvmode{\vbox to 0pt{}}
4334 \catcode`\|=\active
4335 \def|{{\tt \char '174}}
4336 \chardef \less=`\<
4337 \catcode`\<=\active
4338 \def<{{\tt \less}}
4339 \chardef \gtr=`\>
4340 \catcode`\>=\active
4341 \def>{{\tt \gtr}}
4342 \catcode`\+=\active
4343 \def+{{\tt \char 43}}
4344 %\catcode 27=\active
4345 %\def^^[{$\diamondsuit$}
4347 % Set up an active definition for =, but don't enable it most of the time.
4348 {\catcode`\==\active
4349 \global\def={{\tt \char 61}}}
4351 \catcode`+=\active
4352 \catcode`\_=\active
4354 % If a .fmt file is being used, characters that might appear in a file
4355 % name cannot be active until we have parsed the command line.
4356 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
4357 % \otherifyactive is called near the end of this file.
4358 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
4360 \catcode`\@=0
4362 % \rawbackslashxx output one backslash character in current font
4363 \global\chardef\rawbackslashxx=`\\
4364 %{\catcode`\\=\other
4365 %@gdef@rawbackslashxx{\}}
4367 % \rawbackslash redefines \ as input to do \rawbackslashxx.
4368 {\catcode`\\=\active
4369 @gdef@rawbackslash{@let\=@rawbackslashxx }}
4371 % \normalbackslash outputs one backslash in fixed width font.
4372 \def\normalbackslash{{\tt\rawbackslashxx}}
4374 % Say @foo, not \foo, in error messages.
4375 \escapechar=`\@
4377 % \catcode 17=0 % Define control-q
4378 \catcode`\\=\active
4380 % Used sometimes to turn off (effectively) the active characters
4381 % even after parsing them.
4382 @def@turnoffactive{@let"=@normaldoublequote
4383 @let\=@realbackslash
4384 @let~=@normaltilde
4385 @let^=@normalcaret
4386 @let_=@normalunderscore
4387 @let|=@normalverticalbar
4388 @let<=@normalless
4389 @let>=@normalgreater
4390 @let+=@normalplus}
4392 @def@normalturnoffactive{@let"=@normaldoublequote
4393 @let\=@normalbackslash
4394 @let~=@normaltilde
4395 @let^=@normalcaret
4396 @let_=@normalunderscore
4397 @let|=@normalverticalbar
4398 @let<=@normalless
4399 @let>=@normalgreater
4400 @let+=@normalplus}
4402 % Make _ and + \other characters, temporarily.
4403 % This is canceled by @fixbackslash.
4404 @otherifyactive
4406 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
4407 % That is what \eatinput is for; after that, the `\' should revert to printing
4408 % a backslash.
4410 @gdef@eatinput input texinfo{@fixbackslash}
4411 @global@let\ = @eatinput
4413 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
4414 % the first `\{ in the file would cause an error. This macro tries to fix
4415 % that, assuming it is called before the first `\' could plausibly occur.
4416 % Also back turn on active characters that might appear in the input
4417 % file name, in case not using a pre-dumped format.
4419 @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
4420 @catcode`+=@active @catcode`@_=@active}
4422 %% These look ok in all fonts, so just make them not special. The @rm below
4423 %% makes sure that the current font starts out as the newly loaded cmr10
4424 @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
4426 @textfonts
4429 @c Local variables:
4430 @c page-delimiter: "^\\\\message"
4431 @c End: