comparison man/texinfo.tex @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 74fd4e045ea6
children
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
1 % texinfo.tex -- TeX macros to handle Texinfo files. 1 % texinfo.tex -- TeX macros to handle Texinfo files.
2 % 2 % $Id: texinfo.tex,v 1.5 1998/06/13 04:28:12 steve Exp $
3 % Load plain if necessary, i.e., if running under initex. 3 %
4 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi 4 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98
5 %
6 \def\texinfoversion{1999-09-25.10}
7 %
8 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
9 % Free Software Foundation, Inc. 5 % Free Software Foundation, Inc.
10 % 6 %
11 % This texinfo.tex file is free software; you can redistribute it and/or 7 % This texinfo.tex file is free software; you can redistribute it and/or
12 % modify it under the terms of the GNU General Public License as 8 % modify it under the terms of the GNU General Public License as
13 % published by the Free Software Foundation; either version 2, or (at 9 % published by the Free Software Foundation; either version 2, or (at
27 % You are forbidden to forbid anyone else to use, share and improve 23 % You are forbidden to forbid anyone else to use, share and improve
28 % what you give them. Help stamp out software-hoarding! 24 % what you give them. Help stamp out software-hoarding!
29 % 25 %
30 % Please try the latest version of texinfo.tex before submitting bug 26 % Please try the latest version of texinfo.tex before submitting bug
31 % reports; you can get the latest version from: 27 % reports; you can get the latest version from:
32 % ftp://ftp.gnu.org/gnu/texinfo.tex 28 % ftp://ftp.cs.umb.edu/pub/tex/texinfo.tex
33 % (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) 29 % /home/gd/gnu/doc/texinfo.tex on the GNU machines.
34 % ftp://texinfo.org/tex/texinfo.tex 30 %
35 % ftp://us.ctan.org/macros/texinfo/texinfo.tex 31 % Send bug reports to bug-texinfo@gnu.org.
36 % (and all CTAN mirrors, finger ctan@us.ctan.org for a list). 32 % Please include a precise test case in each bug report,
37 % /home/gd/gnu/doc/texinfo.tex on the GNU machines. 33 % including a complete document with which we can reproduce the problem.
38 % The texinfo.tex in any given Texinfo distribution could well be out 34 %
39 % of date, so if that's what you're using, please check. 35 % Texinfo macros (with @macro) are *not* supported by texinfo.tex. You
40 % Texinfo has a small home page at http://texinfo.org/. 36 % have to run makeinfo -E to expand macros first; the texi2dvi script
41 % 37 % does this.
42 % Send bug reports to bug-texinfo@gnu.org. Please include including a 38
43 % complete document in each bug report with which we can reproduce the 39
44 % problem. Patches are, of course, greatly appreciated. 40 % Make it possible to create a .fmt file just by loading this file:
45 % 41 % if the underlying format is not loaded, start by loading it now.
46 % To process a Texinfo manual with TeX, it's most reliable to use the 42 % Added by gildea November 1993.
47 % texi2dvi shell script that comes with the distribution. For a simple 43 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
48 % manual foo.texi, however, you can get away with this: 44
49 % tex foo.texi 45 % This automatically updates the version number based on RCS.
50 % texindex foo.?? 46 \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
51 % tex foo.texi 47 \deftexinfoversion$Revision: 1.5 $
52 % tex foo.texi 48 \message{Loading texinfo package [Version \texinfoversion]:}
53 % dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps.
54 % The extra runs of TeX get the cross-reference information correct.
55 % Sometimes one run after texindex suffices, and sometimes you need more
56 % than two; texi2dvi does it as many times as necessary.
57 %
58 % It is possible to adapt texinfo.tex for other languages. You can get
59 % the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/.
60
61 \message{Loading texinfo [version \texinfoversion]:}
62 49
63 % If in a .fmt file, print the version number 50 % If in a .fmt file, print the version number
64 % and turn on active characters that we couldn't do earlier because 51 % and turn on active characters that we couldn't do earlier because
65 % they might have appeared in the input file name. 52 % they might have appeared in the input file name.
66 \everyjob{\message{[Texinfo version \texinfoversion]}% 53 \everyjob{\message{[Texinfo version \texinfoversion]}\message{}
67 \catcode`+=\active \catcode`\_=\active} 54 \catcode`+=\active \catcode`\_=\active}
68 55
69 % Save some parts of plain tex whose names we will redefine. 56 % Save some parts of plain tex whose names we will redefine.
57
70 \let\ptexb=\b 58 \let\ptexb=\b
71 \let\ptexbullet=\bullet 59 \let\ptexbullet=\bullet
72 \let\ptexc=\c 60 \let\ptexc=\c
73 \let\ptexcomma=\, 61 \let\ptexcomma=\,
74 \let\ptexdot=\. 62 \let\ptexdot=\.
80 \let\ptexlbrace=\{ 68 \let\ptexlbrace=\{
81 \let\ptexrbrace=\} 69 \let\ptexrbrace=\}
82 \let\ptexstar=\* 70 \let\ptexstar=\*
83 \let\ptext=\t 71 \let\ptext=\t
84 72
85 % We never want plain's outer \+ definition in Texinfo. 73 % Be sure we're in horizontal mode when doing a tie, since we make space
86 % For @tex, we can use \tabalign. 74 % equivalent to this in @example-like environments. Otherwise, a space
87 \let\+ = \relax 75 % at the beginning of a line will start with \penalty -- and
76 % since \penalty is valid in vertical mode, we'd end up putting the
77 % penalty on the vertical list instead of in the new paragraph.
78 {\catcode`@ = 11
79 % Avoid using \@M directly, because that causes trouble
80 % if the definition is written into an index file.
81 \global\let\tiepenalty = \@M
82 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
83 }
84
88 85
89 \message{Basics,} 86 \message{Basics,}
90 \chardef\other=12 87 \chardef\other=12
91 88
92 % If this character appears in an error message or help string, it 89 % If this character appears in an error message or help string, it
93 % starts a new line in the output. 90 % starts a new line in the output.
94 \newlinechar = `^^J 91 \newlinechar = `^^J
95 92
96 % Set up fixed words for English if not already set. 93 % Set up fixed words for English.
97 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi 94 \ifx\putwordChapter\undefined{\gdef\putwordChapter{Chapter}}\fi%
98 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi 95 \def\putwordInfo{Info}%
99 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi 96 \ifx\putwordSee\undefined{\gdef\putwordSee{See}}\fi%
100 \ifx\putwordin\undefined \gdef\putwordin{in}\fi 97 \ifx\putwordsee\undefined{\gdef\putwordsee{see}}\fi%
101 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi 98 \ifx\putwordfile\undefined{\gdef\putwordfile{file}}\fi%
102 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi 99 \ifx\putwordpage\undefined{\gdef\putwordpage{page}}\fi%
103 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi 100 \ifx\putwordsection\undefined{\gdef\putwordsection{section}}\fi%
104 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi 101 \ifx\putwordSection\undefined{\gdef\putwordSection{Section}}\fi%
105 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi 102 \ifx\putwordTableofContents\undefined{\gdef\putwordTableofContents{Table of Contents}}\fi%
106 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi 103 \ifx\putwordShortContents\undefined{\gdef\putwordShortContents{Short Contents}}\fi%
107 \ifx\putwordof\undefined \gdef\putwordof{of}\fi 104 \ifx\putwordAppendix\undefined{\gdef\putwordAppendix{Appendix}}\fi%
108 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
109 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
110 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
111 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
112 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
113 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
114 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
115 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
116 %
117 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
118 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
119 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
120 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
121 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
122 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
123 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
124 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
125 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
126 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
127 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
128 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
129 %
130 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
131 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
132 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
133 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
134 \ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
135 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
136 \ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
137 105
138 % Ignore a token. 106 % Ignore a token.
139 % 107 %
140 \def\gobble#1{} 108 \def\gobble#1{}
141 109
152 % Sometimes it is convenient to have everything in the transcript file 120 % Sometimes it is convenient to have everything in the transcript file
153 % and nothing on the terminal. We don't just call \tracingall here, 121 % and nothing on the terminal. We don't just call \tracingall here,
154 % since that produces some useless output on the terminal. 122 % since that produces some useless output on the terminal.
155 % 123 %
156 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% 124 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
157 \ifx\eTeXversion\undefined
158 \def\loggingall{\tracingcommands2 \tracingstats2 125 \def\loggingall{\tracingcommands2 \tracingstats2
159 \tracingpages1 \tracingoutput1 \tracinglostchars1 126 \tracingpages1 \tracingoutput1 \tracinglostchars1
160 \tracingmacros2 \tracingparagraphs1 \tracingrestores1 127 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
161 \showboxbreadth\maxdimen\showboxdepth\maxdimen 128 \showboxbreadth\maxdimen\showboxdepth\maxdimen
162 }% 129 }%
163 \else
164 \def\loggingall{\tracingcommands3 \tracingstats2
165 \tracingpages1 \tracingoutput1 \tracinglostchars1
166 \tracingmacros2 \tracingparagraphs1 \tracingrestores1
167 \tracingscantokens1 \tracingassigns1 \tracingifs1
168 \tracinggroups1 \tracingnesting2
169 \showboxbreadth\maxdimen\showboxdepth\maxdimen
170 }%
171 \fi
172 130
173 % For @cropmarks command. 131 % For @cropmarks command.
174 % Do @cropmarks to get crop marks. 132 % Do @cropmarks to get crop marks.
175 % 133 %
176 \newif\ifcropmarks 134 \newif\ifcropmarks
177 \let\cropmarks = \cropmarkstrue 135 \let\cropmarks = \cropmarkstrue
178 % 136 %
179 % Dimensions to add cropmarks at corners. 137 % Dimensions to add cropmarks at corners.
180 % Added by P. A. MacKay, 12 Nov. 1986 138 % Added by P. A. MacKay, 12 Nov. 1986
181 % 139 %
182 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines 140 \newdimen\cornerlong \newdimen\cornerthick
183 \newdimen\cornerlong \cornerlong=1pc 141 \newdimen\topandbottommargin
184 \newdimen\cornerthick \cornerthick=.3pt 142 \newdimen\outerhsize \newdimen\outervsize
185 \newdimen\topandbottommargin \topandbottommargin=.75in 143 \cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks
144 \outerhsize=7in
145 %\outervsize=9.5in
146 % Alternative @smallbook page size is 9.25in
147 \outervsize=9.25in
148 \topandbottommargin=.75in
186 149
187 % Main output routine. 150 % Main output routine.
188 \chardef\PAGE = 255 151 \chardef\PAGE = 255
189 \output = {\onepageout{\pagecontents\PAGE}} 152 \output = {\onepageout{\pagecontents\PAGE}}
190 153
214 \normalturnoffactive % \ in index entries must not stay \, e.g., if 177 \normalturnoffactive % \ in index entries must not stay \, e.g., if
215 % the page break happens to be in the middle of an example. 178 % the page break happens to be in the middle of an example.
216 \shipout\vbox{% 179 \shipout\vbox{%
217 \ifcropmarks \vbox to \outervsize\bgroup 180 \ifcropmarks \vbox to \outervsize\bgroup
218 \hsize = \outerhsize 181 \hsize = \outerhsize
219 \vskip-\topandbottommargin 182 \line{\ewtop\hfil\ewtop}%
220 \vtop to0pt{% 183 \nointerlineskip
221 \line{\ewtop\hfil\ewtop}% 184 \line{%
222 \nointerlineskip 185 \vbox{\moveleft\cornerthick\nstop}%
223 \line{% 186 \hfill
224 \vbox{\moveleft\cornerthick\nstop}% 187 \vbox{\moveright\cornerthick\nstop}%
225 \hfill 188 }%
226 \vbox{\moveright\cornerthick\nstop}%
227 }%
228 \vss}%
229 \vskip\topandbottommargin 189 \vskip\topandbottommargin
230 \line\bgroup 190 \line\bgroup
231 \hfil % center the page within the outer (page) hsize. 191 \hfil % center the page within the outer (page) hsize.
232 \ifodd\pageno\hskip\bindingoffset\fi 192 \ifodd\pageno\hskip\bindingoffset\fi
233 \vbox\bgroup 193 \vbox\bgroup
241 % The \baselineskip=24pt in plain's \makefootline has no effect. 201 % The \baselineskip=24pt in plain's \makefootline has no effect.
242 \vskip 2\baselineskip 202 \vskip 2\baselineskip
243 \unvbox\footlinebox 203 \unvbox\footlinebox
244 \fi 204 \fi
245 % 205 %
246 \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
247 %
248 \ifcropmarks 206 \ifcropmarks
249 \egroup % end of \vbox\bgroup 207 \egroup % end of \vbox\bgroup
250 \hfil\egroup % end of (centering) \line\bgroup 208 \hfil\egroup % end of (centering) \line\bgroup
251 \vskip\topandbottommargin plus1fill minus1fill 209 \vskip\topandbottommargin plus1fill minus1fill
252 \boxmaxdepth = \cornerthick 210 \boxmaxdepth = \cornerthick
253 \vbox to0pt{\vss 211 \line{%
254 \line{% 212 \vbox{\moveleft\cornerthick\nsbot}%
255 \vbox{\moveleft\cornerthick\nsbot}% 213 \hfill
256 \hfill 214 \vbox{\moveright\cornerthick\nsbot}%
257 \vbox{\moveright\cornerthick\nsbot}%
258 }%
259 \nointerlineskip
260 \line{\ewbot\hfil\ewbot}%
261 }% 215 }%
216 \nointerlineskip
217 \line{\ewbot\hfil\ewbot}%
262 \egroup % \vbox from first cropmarks clause 218 \egroup % \vbox from first cropmarks clause
263 \fi 219 \fi
264 }% end of \shipout\vbox 220 }% end of \shipout\vbox
265 }% end of group with \turnoffactive 221 }% end of group with \turnoffactive
266 \advancepageno 222 \advancepageno
372 328
373 %% These are used to keep @begin/@end levels from running away 329 %% These are used to keep @begin/@end levels from running away
374 %% Call \inENV within environments (after a \begingroup) 330 %% Call \inENV within environments (after a \begingroup)
375 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} 331 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
376 \def\ENVcheck{% 332 \def\ENVcheck{%
377 \ifENV\errmessage{Still within an environment; press RETURN to continue} 333 \ifENV\errmessage{Still within an environment. Type Return to continue.}
378 \endgroup\fi} % This is not perfect, but it should reduce lossage 334 \endgroup\fi} % This is not perfect, but it should reduce lossage
379 335
380 % @begin foo is the same as @foo, for now. 336 % @begin foo is the same as @foo, for now.
381 \newhelp\EMsimple{Press RETURN to continue.} 337 \newhelp\EMsimple{Type <Return> to continue.}
382 338
383 \outer\def\begin{\parsearg\beginxxx} 339 \outer\def\begin{\parsearg\beginxxx}
384 340
385 \def\beginxxx #1{% 341 \def\beginxxx #1{%
386 \expandafter\ifx\csname #1\endcsname\relax 342 \expandafter\ifx\csname #1\endcsname\relax
435 391
436 %% Simple single-character @ commands 392 %% Simple single-character @ commands
437 393
438 % @@ prints an @ 394 % @@ prints an @
439 % Kludge this until the fonts are right (grr). 395 % Kludge this until the fonts are right (grr).
440 \def\@{{\tt\char64}} 396 \def\@{{\tt \char '100}}
441 397
442 % This is turned off because it was never documented 398 % This is turned off because it was never documented
443 % and you can use @w{...} around a quote to suppress ligatures. 399 % and you can use @w{...} around a quote to suppress ligatures.
444 %% Define @` and @' to be the same as ` and ' 400 %% Define @` and @' to be the same as ` and '
445 %% but suppressing ligatures. 401 %% but suppressing ligatures.
446 %\def\`{{`}} 402 %\def\`{{`}}
447 %\def\'{{'}} 403 %\def\'{{'}}
448 404
449 % Used to generate quoted braces. 405 % Used to generate quoted braces.
450 \def\mylbrace {{\tt\char123}} 406 \def\mylbrace {{\tt \char '173}}
451 \def\myrbrace {{\tt\char125}} 407 \def\myrbrace {{\tt \char '175}}
452 \let\{=\mylbrace 408 \let\{=\mylbrace
453 \let\}=\myrbrace 409 \let\}=\myrbrace
454 \begingroup 410 \begingroup
455 % Definitions to produce actual \{ & \} command in an index. 411 % Definitions to produce actual \{ & \} command in an index.
456 \catcode`\{ = 12 \catcode`\} = 12 412 \catcode`\{ = 12 \catcode`\} = 12
481 \def\temp{#1}% 437 \def\temp{#1}%
482 \ifx\temp\imacro \ptexi 438 \ifx\temp\imacro \ptexi
483 \else\ifx\temp\jmacro \j 439 \else\ifx\temp\jmacro \j
484 \else \errmessage{@dotless can be used only with i or j}% 440 \else \errmessage{@dotless can be used only with i or j}%
485 \fi\fi 441 \fi\fi
486 }
487
488 % Be sure we're in horizontal mode when doing a tie, since we make space
489 % equivalent to this in @example-like environments. Otherwise, a space
490 % at the beginning of a line will start with \penalty -- and
491 % since \penalty is valid in vertical mode, we'd end up putting the
492 % penalty on the vertical list instead of in the new paragraph.
493 {\catcode`@ = 11
494 % Avoid using \@M directly, because that causes trouble
495 % if the definition is written into an index file.
496 \global\let\tiepenalty = \@M
497 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
498 } 442 }
499 443
500 % @: forces normal size whitespace following. 444 % @: forces normal size whitespace following.
501 \def\:{\spacefactor=1000 } 445 \def\:{\spacefactor=1000 }
502 446
592 % Old definition--didn't work. 536 % Old definition--didn't work.
593 %\def\needx #1{\par % 537 %\def\needx #1{\par %
594 %% This method tries to make TeX break the page naturally 538 %% This method tries to make TeX break the page naturally
595 %% if the depth of the box does not fit. 539 %% if the depth of the box does not fit.
596 %{\baselineskip=0pt% 540 %{\baselineskip=0pt%
597 %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak 541 %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
598 %\prevdepth=-1000pt 542 %\prevdepth=-1000pt
599 %}} 543 %}}
600 544
601 \def\needx#1{% 545 \def\needx#1{%
602 % Ensure vertical mode, so we don't make a big box in the middle of a 546 % Go into vertical mode, so we don't make a big box in the middle of a
603 % paragraph. 547 % paragraph.
604 \par 548 \par
605 % 549 %
606 % If the @need value is less than one line space, it's useless. 550 % Don't add any leading before our big empty box, but allow a page
607 \dimen0 = #1\mil 551 % break, since the best break might be right here.
608 \dimen2 = \ht\strutbox 552 \allowbreak
609 \advance\dimen2 by \dp\strutbox 553 \nointerlineskip
610 \ifdim\dimen0 > \dimen2 554 \vtop to #1\mil{\vfil}%
611 % 555 %
612 % Do a \strut just to make the height of this box be normal, so the 556 % TeX does not even consider page breaks if a penalty added to the
613 % normal leading is inserted relative to the preceding line. 557 % main vertical list is 10000 or more. But in order to see if the
614 % And a page break here is fine. 558 % empty box we just added fits on the page, we must make it consider
615 \vtop to #1\mil{\strut\vfil}% 559 % page breaks. On the other hand, we don't want to actually break the
616 % 560 % page after the empty box. So we use a penalty of 9999.
617 % TeX does not even consider page breaks if a penalty added to the 561 %
618 % main vertical list is 10000 or more. But in order to see if the 562 % There is an extremely small chance that TeX will actually break the
619 % empty box we just added fits on the page, we must make it consider 563 % page at this \penalty, if there are no other feasible breakpoints in
620 % page breaks. On the other hand, we don't want to actually break the 564 % sight. (If the user is using lots of big @group commands, which
621 % page after the empty box. So we use a penalty of 9999. 565 % almost-but-not-quite fill up a page, TeX will have a hard time doing
622 % 566 % good page breaking, for example.) However, I could not construct an
623 % There is an extremely small chance that TeX will actually break the 567 % example where a page broke at this \penalty; if it happens in a real
624 % page at this \penalty, if there are no other feasible breakpoints in 568 % document, then we can reconsider our strategy.
625 % sight. (If the user is using lots of big @group commands, which 569 \penalty9999
626 % almost-but-not-quite fill up a page, TeX will have a hard time doing 570 %
627 % good page breaking, for example.) However, I could not construct an 571 % Back up by the size of the box, whether we did a page break or not.
628 % example where a page broke at this \penalty; if it happens in a real 572 \kern -#1\mil
629 % document, then we can reconsider our strategy. 573 %
630 \penalty9999 574 % Do not allow a page break right after this kern.
631 % 575 \nobreak
632 % Back up by the size of the box, whether we did a page break or not.
633 \kern -#1\mil
634 %
635 % Do not allow a page break right after this kern.
636 \nobreak
637 \fi
638 } 576 }
639 577
640 % @br forces paragraph break 578 % @br forces paragraph break
641 579
642 \let\br = \par 580 \let\br = \par
643 581
644 % @dots{} output an ellipsis using the current font. 582 % @dots{} output an ellipsis using the current font.
645 % We do .5em per period so that it has the same spacing in a typewriter 583 % We do .5em per period so that it has the same spacing in a typewriter
646 % font as three actual period characters. 584 % font as three actual period characters.
647 % 585 %
648 \def\dots{% 586 \def\dots{\hbox to 1.5em{%
649 \leavevmode 587 \hskip 0pt plus 0.25fil minus 0.25fil
650 \hbox to 1.5em{% 588 .\hss.\hss.%
651 \hskip 0pt plus 0.25fil minus 0.25fil 589 \hskip 0pt plus 0.5fil minus 0.5fil
652 .\hss.\hss.% 590 }}
653 \hskip 0pt plus 0.5fil minus 0.5fil
654 }%
655 }
656 591
657 % @enddots{} is an end-of-sentence ellipsis. 592 % @enddots{} is an end-of-sentence ellipsis.
658 % 593 %
659 \def\enddots{% 594 \def\enddots{%
660 \leavevmode
661 \hbox to 2em{% 595 \hbox to 2em{%
662 \hskip 0pt plus 0.25fil minus 0.25fil 596 \hskip 0pt plus 0.25fil minus 0.25fil
663 .\hss.\hss.\hss.% 597 .\hss.\hss.\hss.%
664 \hskip 0pt plus 0.5fil minus 0.5fil 598 \hskip 0pt plus 0.5fil minus 0.5fil
665 }% 599 }%
666 \spacefactor=3000 600 \spacefactor=3000
667 } 601 }
668 602
669 603
670 % @page forces the start of a new page 604 % @page forces the start of a new page
671 % 605
672 \def\page{\par\vfill\supereject} 606 \def\page{\par\vfill\supereject}
673 607
674 % @exdent text.... 608 % @exdent text....
675 % outputs text on separate line in roman font, starting at standard page margin 609 % outputs text on separate line in roman font, starting at standard page margin
676 610
733 667
734 % @comment ...line which is ignored... 668 % @comment ...line which is ignored...
735 % @c is the same as @comment 669 % @c is the same as @comment
736 % @ignore ... @end ignore is another way to write a comment 670 % @ignore ... @end ignore is another way to write a comment
737 671
738 \def\comment{\begingroup \catcode`\^^M=\other% 672 \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
739 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% 673 \parsearg \commentxxx}
740 \commentxxx} 674
741 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} 675 \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
742 676
743 \let\c=\comment 677 \let\c=\comment
744 678
745 % @paragraphindent NCHARS 679 % @paragraphindent is defined for the Info formatting commands only.
746 % We'll use ems for NCHARS, close enough. 680 \let\paragraphindent=\comment
747 % We cannot implement @paragraphindent asis, though. 681
748 % 682 % Prevent errors for section commands.
749 \def\asisword{asis} % no translation, these are keywords 683 % Used in @ignore and in failing conditionals.
750 \def\noneword{none} 684 \def\ignoresections{%
751 % 685 \let\chapter=\relax
752 \def\paragraphindent{\parsearg\doparagraphindent} 686 \let\unnumbered=\relax
753 \def\doparagraphindent#1{% 687 \let\top=\relax
754 \def\temp{#1}% 688 \let\unnumberedsec=\relax
755 \ifx\temp\asisword 689 \let\unnumberedsection=\relax
690 \let\unnumberedsubsec=\relax
691 \let\unnumberedsubsection=\relax
692 \let\unnumberedsubsubsec=\relax
693 \let\unnumberedsubsubsection=\relax
694 \let\section=\relax
695 \let\subsec=\relax
696 \let\subsubsec=\relax
697 \let\subsection=\relax
698 \let\subsubsection=\relax
699 \let\appendix=\relax
700 \let\appendixsec=\relax
701 \let\appendixsection=\relax
702 \let\appendixsubsec=\relax
703 \let\appendixsubsection=\relax
704 \let\appendixsubsubsec=\relax
705 \let\appendixsubsubsection=\relax
706 \let\contents=\relax
707 \let\smallbook=\relax
708 \let\titlepage=\relax
709 }
710
711 % Used in nested conditionals, where we have to parse the Texinfo source
712 % and so want to turn off most commands, in case they are used
713 % incorrectly.
714 %
715 \def\ignoremorecommands{%
716 \let\defcodeindex = \relax
717 \let\defcv = \relax
718 \let\deffn = \relax
719 \let\deffnx = \relax
720 \let\defindex = \relax
721 \let\defivar = \relax
722 \let\defmac = \relax
723 \let\defmethod = \relax
724 \let\defop = \relax
725 \let\defopt = \relax
726 \let\defspec = \relax
727 \let\deftp = \relax
728 \let\deftypefn = \relax
729 \let\deftypefun = \relax
730 \let\deftypevar = \relax
731 \let\deftypevr = \relax
732 \let\defun = \relax
733 \let\defvar = \relax
734 \let\defvr = \relax
735 \let\ref = \relax
736 \let\xref = \relax
737 \let\printindex = \relax
738 \let\pxref = \relax
739 \let\settitle = \relax
740 \let\setchapternewpage = \relax
741 \let\setchapterstyle = \relax
742 \let\everyheading = \relax
743 \let\evenheading = \relax
744 \let\oddheading = \relax
745 \let\everyfooting = \relax
746 \let\evenfooting = \relax
747 \let\oddfooting = \relax
748 \let\headings = \relax
749 \let\include = \relax
750 \let\lowersections = \relax
751 \let\down = \relax
752 \let\raisesections = \relax
753 \let\up = \relax
754 \let\set = \relax
755 \let\clear = \relax
756 \let\item = \relax
757 }
758
759 % Ignore @ignore ... @end ignore.
760 %
761 \def\ignore{\doignore{ignore}}
762
763 % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
764 %
765 \def\ifinfo{\doignore{ifinfo}}
766 \def\ifhtml{\doignore{ifhtml}}
767 \def\ifnottex{\doignore{ifnottex}}
768 \def\html{\doignore{html}}
769 \def\menu{\doignore{menu}}
770 \def\direntry{\doignore{direntry}}
771
772 % Also ignore @macro ... @end macro. The user must run texi2dvi,
773 % which runs makeinfo to do macro expansion. Ignore @unmacro, too.
774 \def\macro{\doignore{macro}}
775 \let\unmacro = \comment
776
777
778 % @dircategory CATEGORY -- specify a category of the dir file
779 % which this file should belong to. Ignore this in TeX.
780 \let\dircategory = \comment
781
782 % Ignore text until a line `@end #1'.
783 %
784 \def\doignore#1{\begingroup
785 % Don't complain about control sequences we have declared \outer.
786 \ignoresections
787 %
788 % Define a command to swallow text until we reach `@end #1'.
789 \long\def\doignoretext##1\end #1{\enddoignore}%
790 %
791 % Make sure that spaces turn into tokens that match what \doignoretext wants.
792 \catcode32 = 10
793 %
794 % Ignore braces, too, so mismatched braces don't cause trouble.
795 \catcode`\{ = 9
796 \catcode`\} = 9
797 %
798 % And now expand that command.
799 \doignoretext
800 }
801
802 % What we do to finish off ignored text.
803 %
804 \def\enddoignore{\endgroup\ignorespaces}%
805
806 \newif\ifwarnedobs\warnedobsfalse
807 \def\obstexwarn{%
808 \ifwarnedobs\relax\else
809 % We need to warn folks that they may have trouble with TeX 3.0.
810 % This uses \immediate\write16 rather than \message to get newlines.
811 \immediate\write16{}
812 \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
813 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
814 \immediate\write16{If you are running another version of TeX, relax.}
815 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
816 \immediate\write16{ Then upgrade your TeX installation if you can.}
817 \immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
818 \immediate\write16{If you are stuck with version 3.0, run the}
819 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
820 \immediate\write16{ to use a workaround.}
821 \immediate\write16{}
822 \global\warnedobstrue
823 \fi
824 }
825
826 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
827 % workaround (which requires the file ``dummy.tfm'' to be installed),
828 % uncomment the following line:
829 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
830
831 % Ignore text, except that we keep track of conditional commands for
832 % purposes of nesting, up to an `@end #1' command.
833 %
834 \def\nestedignore#1{%
835 \obstexwarn
836 % We must actually expand the ignored text to look for the @end
837 % command, so that nested ignore constructs work. Thus, we put the
838 % text into a \vbox and then do nothing with the result. To minimize
839 % the change of memory overflow, we follow the approach outlined on
840 % page 401 of the TeXbook: make the current font be a dummy font.
841 %
842 \setbox0 = \vbox\bgroup
843 % Don't complain about control sequences we have declared \outer.
844 \ignoresections
845 %
846 % Define `@end #1' to end the box, which will in turn undefine the
847 % @end command again.
848 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
849 %
850 % We are going to be parsing Texinfo commands. Most cause no
851 % trouble when they are used incorrectly, but some commands do
852 % complicated argument parsing or otherwise get confused, so we
853 % undefine them.
854 %
855 % We can't do anything about stray @-signs, unfortunately;
856 % they'll produce `undefined control sequence' errors.
857 \ignoremorecommands
858 %
859 % Set the current font to be \nullfont, a TeX primitive, and define
860 % all the font commands to also use \nullfont. We don't use
861 % dummy.tfm, as suggested in the TeXbook, because not all sites
862 % might have that installed. Therefore, math mode will still
863 % produce output, but that should be an extremely small amount of
864 % stuff compared to the main input.
865 %
866 \nullfont
867 \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
868 \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
869 \let\tensf = \nullfont
870 % Similarly for index fonts (mostly for their use in
871 % smallexample)
872 \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
873 \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
874 \let\indsf = \nullfont
875 %
876 % Don't complain when characters are missing from the fonts.
877 \tracinglostchars = 0
878 %
879 % Don't bother to do space factor calculations.
880 \frenchspacing
881 %
882 % Don't report underfull hboxes.
883 \hbadness = 10000
884 %
885 % Do minimal line-breaking.
886 \pretolerance = 10000
887 %
888 % Do not execute instructions in @tex
889 \def\tex{\doignore{tex}}%
890 }
891
892 % @set VAR sets the variable VAR to an empty value.
893 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
894 %
895 % Since we want to separate VAR from REST-OF-LINE (which might be
896 % empty), we can't just use \parsearg; we have to insert a space of our
897 % own to delimit the rest of the line, and then take it out again if we
898 % didn't need it. Make sure the catcode of space is correct to avoid
899 % losing inside @example, for instance.
900 %
901 \def\set{\begingroup\catcode` =10
902 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
903 \parsearg\setxxx}
904 \def\setxxx#1{\setyyy#1 \endsetyyy}
905 \def\setyyy#1 #2\endsetyyy{%
906 \def\temp{#2}%
907 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
908 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
909 \fi
910 \endgroup
911 }
912 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
913 % \next or other control sequences that we've defined might get us into
914 % an infinite loop. Consider `@set foo @cite{bar}'.
915 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
916
917 % @clear VAR clears (i.e., unsets) the variable VAR.
918 %
919 \def\clear{\parsearg\clearxxx}
920 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
921
922 % @value{foo} gets the text saved in variable foo.
923 %
924 \def\value{\begingroup
925 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
926 \valuexxx}
927 \def\valuexxx#1{%
928 \expandafter\ifx\csname SET#1\endcsname\relax
929 {\{No value for ``#1''\}}%
756 \else 930 \else
757 \ifx\temp\noneword 931 \csname SET#1\endcsname
758 \defaultparindent = 0pt
759 \else
760 \defaultparindent = #1em
761 \fi
762 \fi 932 \fi
763 \parindent = \defaultparindent 933 \endgroup}
764 } 934
765 935 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
766 % @exampleindent NCHARS 936 % with @set.
767 % We'll use ems for NCHARS like @paragraphindent. 937 %
768 % It seems @exampleindent asis isn't necessary, but 938 \def\ifset{\parsearg\ifsetxxx}
769 % I preserve it to make it similar to @paragraphindent. 939 \def\ifsetxxx #1{%
770 \def\exampleindent{\parsearg\doexampleindent} 940 \expandafter\ifx\csname SET#1\endcsname\relax
771 \def\doexampleindent#1{% 941 \expandafter\ifsetfail
772 \def\temp{#1}%
773 \ifx\temp\asisword
774 \else 942 \else
775 \ifx\temp\noneword 943 \expandafter\ifsetsucceed
776 \lispnarrowing = 0pt
777 \else
778 \lispnarrowing = #1em
779 \fi
780 \fi 944 \fi
781 } 945 }
946 \def\ifsetsucceed{\conditionalsucceed{ifset}}
947 \def\ifsetfail{\nestedignore{ifset}}
948 \defineunmatchedend{ifset}
949
950 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
951 % defined with @set, or has been undefined with @clear.
952 %
953 \def\ifclear{\parsearg\ifclearxxx}
954 \def\ifclearxxx #1{%
955 \expandafter\ifx\csname SET#1\endcsname\relax
956 \expandafter\ifclearsucceed
957 \else
958 \expandafter\ifclearfail
959 \fi
960 }
961 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
962 \def\ifclearfail{\nestedignore{ifclear}}
963 \defineunmatchedend{ifclear}
964
965 % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
966 % following, through the first @end iftex (etc.). Make `@end iftex'
967 % (etc.) valid only after an @iftex.
968 %
969 \def\iftex{\conditionalsucceed{iftex}}
970 \def\ifnothtml{\conditionalsucceed{ifnothtml}}
971 \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
972 \defineunmatchedend{iftex}
973 \defineunmatchedend{ifnothtml}
974 \defineunmatchedend{ifnotinfo}
975
976 % We can't just want to start a group at @iftex (for example) and end it
977 % at @end iftex, since then @set commands inside the conditional have no
978 % effect (they'd get reverted at the end of the group). So we must
979 % define \Eiftex to redefine itself to be its previous value. (We can't
980 % just define it to fail again with an ``unmatched end'' error, since
981 % the @ifset might be nested.)
982 %
983 \def\conditionalsucceed#1{%
984 \edef\temp{%
985 % Remember the current value of \E#1.
986 \let\nece{prevE#1} = \nece{E#1}%
987 %
988 % At the `@end #1', redefine \E#1 to be its previous value.
989 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
990 }%
991 \temp
992 }
993
994 % We need to expand lots of \csname's, but we don't want to expand the
995 % control sequences after we've constructed them.
996 %
997 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
782 998
783 % @asis just yields its argument. Used with @table, for example. 999 % @asis just yields its argument. Used with @table, for example.
784 % 1000 %
785 \def\asis#1{#1} 1001 \def\asis#1{#1}
786 1002
799 1015
800 % @bullet and @minus need the same treatment as @math, just above. 1016 % @bullet and @minus need the same treatment as @math, just above.
801 \def\bullet{\implicitmath\ptexbullet\implicitmath} 1017 \def\bullet{\implicitmath\ptexbullet\implicitmath}
802 \def\minus{\implicitmath-\implicitmath} 1018 \def\minus{\implicitmath-\implicitmath}
803 1019
1020 \def\node{\ENVcheck\parsearg\nodezzz}
1021 \def\nodezzz#1{\nodexxx [#1,]}
1022 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
1023 \let\nwnode=\node
1024 \let\lastnode=\relax
1025
1026 \def\donoderef{\ifx\lastnode\relax\else
1027 \expandafter\expandafter\expandafter\setref{\lastnode}\fi
1028 \global\let\lastnode=\relax}
1029
1030 \def\unnumbnoderef{\ifx\lastnode\relax\else
1031 \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
1032 \global\let\lastnode=\relax}
1033
1034 \def\appendixnoderef{\ifx\lastnode\relax\else
1035 \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
1036 \global\let\lastnode=\relax}
1037
804 % @refill is a no-op. 1038 % @refill is a no-op.
805 \let\refill=\relax 1039 \let\refill=\relax
806
807 % If working on a large document in chapters, it is convenient to
808 % be able to disable indexing, cross-referencing, and contents, for test runs.
809 % This is done with @novalidate (before @setfilename).
810 %
811 \newif\iflinks \linkstrue % by default we want the aux files.
812 \let\novalidate = \linksfalse
813 1040
814 % @setfilename is done at the beginning of every texinfo file. 1041 % @setfilename is done at the beginning of every texinfo file.
815 % So open here the files we need to have open while reading the input. 1042 % So open here the files we need to have open while reading the input.
816 % This makes it possible to make a .fmt file for texinfo. 1043 % This makes it possible to make a .fmt file for texinfo.
817 \def\setfilename{% 1044 \def\setfilename{%
818 \iflinks 1045 \readauxfile
819 \readauxfile 1046 \opencontents
820 \fi % \openindices needs to do some work in any case.
821 \openindices 1047 \openindices
822 \fixbackslash % Turn off hack to swallow `\input texinfo'. 1048 \fixbackslash % Turn off hack to swallow `\input texinfo'.
823 \global\let\setfilename=\comment % Ignore extra @setfilename cmds. 1049 \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
824 % 1050 %
825 % If texinfo.cnf is present on the system, read it. 1051 % If texinfo.cnf is present on the system, read it.
831 \temp 1057 \temp
832 % 1058 %
833 \comment % Ignore the actual filename. 1059 \comment % Ignore the actual filename.
834 } 1060 }
835 1061
836 % Called from \setfilename.
837 %
838 \def\openindices{%
839 \newindex{cp}%
840 \newcodeindex{fn}%
841 \newcodeindex{vr}%
842 \newcodeindex{tp}%
843 \newcodeindex{ky}%
844 \newcodeindex{pg}%
845 }
846
847 % @bye. 1062 % @bye.
848 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} 1063 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
849 1064
850 1065 % \def\macro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\macroxxx}
851 \message{pdf,} 1066 % \def\macroxxx#1#2 \end macro{%
852 % adobe `portable' document format 1067 % \expandafter\gdef\macrotemp#1{#2}%
853 \newcount\tempnum 1068 % \endgroup}
854 \newcount\lnkcount 1069
855 \newtoks\filename 1070 %\def\linemacro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\linemacroxxx}
856 \newcount\filenamelength 1071 %\def\linemacroxxx#1#2 \end linemacro{%
857 \newcount\pgn 1072 %\let\parsearg=\relax
858 \newtoks\toksA 1073 %\edef\macrotempx{\csname M\butfirst\expandafter\string\macrotemp\endcsname}%
859 \newtoks\toksB 1074 %\expandafter\xdef\macrotemp{\parsearg\macrotempx}%
860 \newtoks\toksC 1075 %\expandafter\gdef\macrotempx#1{#2}%
861 \newtoks\toksD 1076 %\endgroup}
862 \newbox\boxA 1077
863 \newcount\countA 1078 %\def\butfirst#1{}
864 \newif\ifpdf
865 \newif\ifpdfmakepagedest
866
867 \ifx\pdfoutput\undefined
868 \pdffalse
869 \let\pdfmkdest = \gobble
870 \let\pdfurl = \gobble
871 \let\endlink = \relax
872 \let\linkcolor = \relax
873 \let\pdfmakeoutlines = \relax
874 \else
875 \pdftrue
876 \pdfoutput = 1
877 \input pdfcolor
878 \def\dopdfimage#1#2#3{%
879 \def\imagewidth{#2}%
880 \def\imageheight{#3}%
881 \ifnum\pdftexversion < 14
882 \pdfimage
883 \else
884 \pdfximage
885 \fi
886 \ifx\empty\imagewidth\else width \imagewidth \fi
887 \ifx\empty\imageheight\else height \imageheight \fi
888 {#1.pdf}%
889 \ifnum\pdftexversion < 14 \else
890 \pdfrefximage \pdflastximage
891 \fi}
892 \def\pdfmkdest#1{\pdfdest name{#1@} xyz}
893 \def\pdfmkpgn#1{#1@}
894 \let\linkcolor = \Cyan
895 \def\endlink{\Black\pdfendlink}
896 % Adding outlines to PDF; macros for calculating structure of outlines
897 % come from Petr Olsak
898 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
899 \else \csname#1\endcsname \fi}
900 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
901 \advance\tempnum by1
902 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
903 \def\pdfmakeoutlines{{%
904 \openin 1 \jobname.toc
905 \ifeof 1\else\bgroup
906 \closein 1
907 \indexnofonts
908 \def\tt{}
909 % thanh's hack / proper braces in bookmarks
910 \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
911 \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
912 %
913 \def\chapentry ##1##2##3{}
914 \def\unnumbchapentry ##1##2{}
915 \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
916 \def\unnumbsecentry ##1##2{}
917 \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
918 \def\unnumbsubsecentry ##1##2{}
919 \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
920 \def\unnumbsubsubsecentry ##1##2{}
921 \input \jobname.toc
922 \def\chapentry ##1##2##3{%
923 \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
924 \def\unnumbchapentry ##1##2{%
925 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
926 \def\secentry ##1##2##3##4{%
927 \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
928 \def\unnumbsecentry ##1##2{%
929 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
930 \def\subsecentry ##1##2##3##4##5{%
931 \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
932 \def\unnumbsubsecentry ##1##2{%
933 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
934 \def\subsubsecentry ##1##2##3##4##5##6{%
935 \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
936 \def\unnumbsubsubsecentry ##1##2{%
937 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
938 \input \jobname.toc
939 \egroup\fi
940 }}
941 \def\makelinks #1,{%
942 \def\params{#1}\def\E{END}%
943 \ifx\params\E
944 \let\nextmakelinks=\relax
945 \else
946 \let\nextmakelinks=\makelinks
947 \ifnum\lnkcount>0,\fi
948 \picknum{#1}%
949 \startlink attr{/Border [0 0 0]}
950 goto name{\pdfmkpgn{\the\pgn}}%
951 \linkcolor #1%
952 \advance\lnkcount by 1%
953 \endlink
954 \fi
955 \nextmakelinks
956 }
957 \def\picknum#1{\expandafter\pn#1}
958 \def\pn#1{%
959 \def\p{#1}%
960 \ifx\p\lbrace
961 \let\nextpn=\ppn
962 \else
963 \let\nextpn=\ppnn
964 \def\first{#1}
965 \fi
966 \nextpn
967 }
968 \def\ppn#1{\pgn=#1\gobble}
969 \def\ppnn{\pgn=\first}
970 \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
971 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
972 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
973 \ifx\PP\D\let\nextsp\relax
974 \else\let\nextsp\skipspaces
975 \ifx\p\space\else\addtokens{\filename}{\PP}%
976 \advance\filenamelength by 1
977 \fi
978 \fi
979 \nextsp}
980 \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
981 \ifnum\pdftexversion < 14
982 \let \startlink \pdfannotlink
983 \else
984 \let \startlink \pdfstartlink
985 \fi
986 \def\pdfurl#1{%
987 \begingroup
988 \normalturnoffactive\def\@{@}%
989 \leavevmode\Red
990 \startlink attr{/Border [0 0 0]}%
991 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
992 % #1
993 \endgroup}
994 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
995 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
996 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
997 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
998 \def\maketoks{%
999 \expandafter\poptoks\the\toksA|ENDTOKS|
1000 \ifx\first0\adn0
1001 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1002 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1003 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1004 \else
1005 \ifnum0=\countA\else\makelink\fi
1006 \ifx\first.\let\next=\done\else
1007 \let\next=\maketoks
1008 \addtokens{\toksB}{\the\toksD}
1009 \ifx\first,\addtokens{\toksB}{\space}\fi
1010 \fi
1011 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1012 \next}
1013 \def\makelink{\addtokens{\toksB}%
1014 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1015 \def\pdflink#1{%
1016 \startlink attr{/Border [0 0 0]} goto name{\mkpgn{#1}}
1017 \linkcolor #1\endlink}
1018 \def\mkpgn#1{#1@}
1019 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1020 \fi % \ifx\pdfoutput
1021 1079
1022 1080
1023 \message{fonts,} 1081 \message{fonts,}
1082
1024 % Font-change commands. 1083 % Font-change commands.
1025 1084
1026 % Texinfo sort of supports the sans serif font style, which plain TeX does not. 1085 % Texinfo supports the sans serif font style, which plain TeX does not.
1027 % So we set up a \sf analogous to plain's \rm, etc. 1086 % So we set up a \sf analogous to plain's \rm, etc.
1028 \newfam\sffam 1087 \newfam\sffam
1029 \def\sf{\fam=\sffam \tensf} 1088 \def\sf{\fam=\sffam \tensf}
1030 \let\li = \sf % Sometimes we call it \li, not \sf. 1089 \let\li = \sf % Sometimes we call it \li, not \sf.
1031 1090
1087 % A few fonts for @defun, etc. 1146 % A few fonts for @defun, etc.
1088 \setfont\defbf\bxshape{10}{\magstep1} %was 1314 1147 \setfont\defbf\bxshape{10}{\magstep1} %was 1314
1089 \setfont\deftt\ttshape{10}{\magstep1} 1148 \setfont\deftt\ttshape{10}{\magstep1}
1090 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} 1149 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
1091 1150
1092 % Fonts for indices, footnotes, small examples (9pt). 1151 % Fonts for indices and small examples (9pt).
1093 \setfont\smallrm\rmshape{9}{1000} 1152 % We actually use the slanted font rather than the italic,
1094 \setfont\smalltt\ttshape{9}{1000} 1153 % because texinfo normally uses the slanted fonts for that.
1095 \setfont\smallbf\bfshape{10}{900} 1154 % Do not make many font distinctions in general in the index, since they
1096 \setfont\smallit\itshape{9}{1000} 1155 % aren't very useful.
1097 \setfont\smallsl\slshape{9}{1000} 1156 \setfont\ninett\ttshape{9}{1000}
1098 \setfont\smallsf\sfshape{9}{1000} 1157 \setfont\indrm\rmshape{9}{1000}
1099 \setfont\smallsc\scshape{10}{900} 1158 \setfont\indit\slshape{9}{1000}
1100 \setfont\smallttsl\ttslshape{10}{900} 1159 \let\indsl=\indit
1101 \font\smalli=cmmi9 1160 \let\indtt=\ninett
1102 \font\smallsy=cmsy9 1161 \let\indttsl=\ninett
1162 \let\indsf=\indrm
1163 \let\indbf=\indrm
1164 \setfont\indsc\scshape{10}{900}
1165 \font\indi=cmmi9
1166 \font\indsy=cmsy9
1103 1167
1104 % Fonts for title page: 1168 % Fonts for title page:
1105 \setfont\titlerm\rmbshape{12}{\magstep3} 1169 \setfont\titlerm\rmbshape{12}{\magstep3}
1106 \setfont\titleit\itbshape{10}{\magstep4} 1170 \setfont\titleit\itbshape{10}{\magstep4}
1107 \setfont\titlesl\slbshape{10}{\magstep4} 1171 \setfont\titlesl\slbshape{10}{\magstep4}
1211 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl 1275 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
1212 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc 1276 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
1213 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl 1277 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
1214 \resetmathfonts \setleading{15pt}} 1278 \resetmathfonts \setleading{15pt}}
1215 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? 1279 \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
1216 \def\smallfonts{% 1280 \def\indexfonts{%
1217 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl 1281 \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
1218 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc 1282 \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
1219 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy 1283 \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
1220 \let\tenttsl=\smallttsl 1284 \resetmathfonts \setleading{12pt}}
1221 \resetmathfonts \setleading{11pt}}
1222 1285
1223 % Set up the default fonts, so we can use them for creating boxes. 1286 % Set up the default fonts, so we can use them for creating boxes.
1224 % 1287 %
1225 \textfonts 1288 \textfonts
1226 1289
1240 %% serif) and @ii for TeX italic 1303 %% serif) and @ii for TeX italic
1241 1304
1242 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction 1305 % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
1243 % unless the following character is such as not to need one. 1306 % unless the following character is such as not to need one.
1244 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} 1307 \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
1245 \def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx} 1308 \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
1246 \def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx}
1247 1309
1248 \let\i=\smartitalic 1310 \let\i=\smartitalic
1249 \let\var=\smartslanted 1311 \let\var=\smartitalic
1250 \let\dfn=\smartslanted 1312 \let\dfn=\smartitalic
1251 \let\emph=\smartitalic 1313 \let\emph=\smartitalic
1252 \let\cite=\smartslanted 1314 \let\cite=\smartitalic
1253 1315
1254 \def\b#1{{\bf #1}} 1316 \def\b#1{{\bf #1}}
1255 \let\strong=\b 1317 \let\strong=\b
1256 1318
1257 % We can't just use \exhyphenpenalty, because that only has effect at 1319 % We can't just use \exhyphenpenalty, because that only has effect at
1265 {\tt \rawbackslash \frenchspacing #1}% 1327 {\tt \rawbackslash \frenchspacing #1}%
1266 \null 1328 \null
1267 } 1329 }
1268 \let\ttfont=\t 1330 \let\ttfont=\t
1269 \def\samp#1{`\tclose{#1}'\null} 1331 \def\samp#1{`\tclose{#1}'\null}
1270 \setfont\keyrm\rmshape{8}{1000} 1332 \setfont\smallrm\rmshape{8}{1000}
1271 \font\keysy=cmsy9 1333 \font\smallsy=cmsy9
1272 \def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% 1334 \def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
1273 \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% 1335 \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
1274 \vbox{\hrule\kern-0.4pt 1336 \vbox{\hrule\kern-0.4pt
1275 \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% 1337 \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
1276 \kern-0.4pt\hrule}% 1338 \kern-0.4pt\hrule}%
1277 \kern-.06em\raise0.4pt\hbox{\angleright}}}} 1339 \kern-.06em\raise0.4pt\hbox{\angleright}}}}
1278 % The old definition, with no lozenge: 1340 % The old definition, with no lozenge:
1279 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} 1341 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1280 \def\ctrl #1{{\tt \rawbackslash \hat}#1} 1342 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
1281 1343
1282 % @file, @option are the same as @samp.
1283 \let\file=\samp 1344 \let\file=\samp
1284 \let\option=\samp
1285 1345
1286 % @code is a modification of @t, 1346 % @code is a modification of @t,
1287 % which makes spaces the same size as normal in the surrounding text. 1347 % which makes spaces the same size as normal in the surrounding text.
1288 \def\tclose#1{% 1348 \def\tclose#1{%
1289 {% 1349 {%
1314 % both hyphenation at - and hyphenation within words. 1374 % both hyphenation at - and hyphenation within words.
1315 % We must therefore turn them both off (\tclose does that) 1375 % We must therefore turn them both off (\tclose does that)
1316 % and arrange explicitly to hyphenate at a dash. 1376 % and arrange explicitly to hyphenate at a dash.
1317 % -- rms. 1377 % -- rms.
1318 { 1378 {
1319 \catcode`\-=\active 1379 \catcode`\-=\active
1320 \catcode`\_=\active 1380 \catcode`\_=\active
1321 % 1381 \catcode`\|=\active
1322 \global\def\code{\begingroup 1382 \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
1323 \catcode`\-=\active \let-\codedash 1383 % The following is used by \doprintindex to insure that long function names
1324 \catcode`\_=\active \let_\codeunder 1384 % wrap around. It is necessary for - and _ to be active before the index is
1325 \codex 1385 % read from the file, as \entry parses the arguments long before \code is
1326 } 1386 % ever called. -- mycroft
1327 % 1387 % _ is always active; and it shouldn't be \let = to an _ that is a
1328 % If we end up with any active - characters when handling the index, 1388 % subscript character anyway. Then, @cindex @samp{_} (for example)
1329 % just treat them as a normal -. 1389 % fails. --karl
1330 \global\def\indexbreaks{\catcode`\-=\active \let-\realdash} 1390 \global\def\indexbreaks{%
1391 \catcode`\-=\active \let-\realdash
1392 }
1331 } 1393 }
1332 1394
1333 \def\realdash{-} 1395 \def\realdash{-}
1334 \def\codedash{-\discretionary{}{}{}} 1396 \def\codedash{-\discretionary{}{}{}}
1335 \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}} 1397 \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
1366 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% 1428 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
1367 \ifx\one\xkey\ifx\threex\three \key{#2}% 1429 \ifx\one\xkey\ifx\threex\three \key{#2}%
1368 \else{\tclose{\kbdfont\look}}\fi 1430 \else{\tclose{\kbdfont\look}}\fi
1369 \else{\tclose{\kbdfont\look}}\fi} 1431 \else{\tclose{\kbdfont\look}}\fi}
1370 1432
1371 % For @url, @env, @command quotes seem unnecessary, so use \code. 1433 % @url. Quotes do not seem necessary, so use \code.
1372 \let\url=\code 1434 \let\url=\code
1373 \let\env=\code 1435
1374 \let\command=\code 1436 % @uref (abbreviation for `urlref') takes an optional second argument
1375 1437 % specifying the text to display. First (mandatory) arg is the url.
1376 % @uref (abbreviation for `urlref') takes an optional (comma-separated) 1438 % Perhaps eventually put in a hypertex \special here.
1377 % second argument specifying the text to display and an optional third 1439 %
1378 % arg as text to display instead of (rather than in addition to) the url 1440 \def\uref#1{\urefxxx #1,,\finish}
1379 % itself. First (mandatory) arg is the url. Perhaps eventually put in 1441 \def\urefxxx#1,#2,#3\finish{%
1380 % a hypertex \special here. 1442 \setbox0 = \hbox{\ignorespaces #2}%
1381 %
1382 \def\uref#1{\douref #1,,,\finish}
1383 \def\douref#1,#2,#3,#4\finish{\begingroup
1384 \unsepspaces
1385 \pdfurl{#1}%
1386 \setbox0 = \hbox{\ignorespaces #3}%
1387 \ifdim\wd0 > 0pt 1443 \ifdim\wd0 > 0pt
1388 \unhbox0 % third arg given, show only that 1444 \unhbox0\ (\code{#1})%
1389 \else 1445 \else
1390 \setbox0 = \hbox{\ignorespaces #2}% 1446 \code{#1}%
1391 \ifdim\wd0 > 0pt
1392 \ifpdf
1393 \unhbox0 % PDF: 2nd arg given, show only it
1394 \else
1395 \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
1396 \fi
1397 \else
1398 \code{#1}% only url given, so show it
1399 \fi
1400 \fi 1447 \fi
1401 \endlink 1448 }
1402 \endgroup} 1449
1403 1450 % rms does not like the angle brackets --karl, 17may97.
1404 % rms does not like angle brackets --karl, 17may97. 1451 % So now @email is just like @uref.
1405 % So now @email is just like @uref, unless we are pdf.
1406 %
1407 %\def\email#1{\angleleft{\tt #1}\angleright} 1452 %\def\email#1{\angleleft{\tt #1}\angleright}
1408 \ifpdf 1453 \let\email=\uref
1409 \def\email#1{\doemail#1,,\finish}
1410 \def\doemail#1,#2,#3\finish{\begingroup
1411 \unsepspaces
1412 \pdfurl{mailto:#1}%
1413 \setbox0 = \hbox{\ignorespaces #2}%
1414 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
1415 \endlink
1416 \endgroup}
1417 \else
1418 \let\email=\uref
1419 \fi
1420 1454
1421 % Check if we are currently using a typewriter font. Since all the 1455 % Check if we are currently using a typewriter font. Since all the
1422 % Computer Modern typewriter fonts have zero interword stretch (and 1456 % Computer Modern typewriter fonts have zero interword stretch (and
1423 % shrink), and it is reasonable to expect all typewriter fonts to have 1457 % shrink), and it is reasonable to expect all typewriter fonts to have
1424 % this property, we can check that font parameter. 1458 % this property, we can check that font parameter.
1425 % 1459 %
1426 \def\ifmonospace{\ifdim\fontdimen3\font=0pt } 1460 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
1427 1461
1428 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the 1462 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
1429 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. 1463 % argument is to make the input look right: @dmn{pt} instead of
1464 % @dmn{}pt.
1430 % 1465 %
1431 \def\dmn#1{\thinspace #1} 1466 \def\dmn#1{\thinspace #1}
1432 1467
1433 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} 1468 \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
1434 1469
1435 % @l was never documented to mean ``switch to the Lisp font'', 1470 % @l was never documented to mean ``switch to the Lisp font'',
1436 % and it is not used as such in any manual I can find. We need it for 1471 % and it is not used as such in any manual I can find. We need it for
1437 % Polish suppressed-l. --karl, 22sep96. 1472 % Polish suppressed-l. --karl, 22sep96.
1438 %\def\l#1{{\li #1}\null} 1473 %\def\l#1{{\li #1}\null}
1439 1474
1440 % Explicit font changes: @r, @sc, undocumented @ii.
1441 \def\r#1{{\rm #1}} % roman font 1475 \def\r#1{{\rm #1}} % roman font
1476 % Use of \lowercase was suggested.
1442 \def\sc#1{{\smallcaps#1}} % smallcaps font 1477 \def\sc#1{{\smallcaps#1}} % smallcaps font
1443 \def\ii#1{{\it #1}} % italic font 1478 \def\ii#1{{\it #1}} % italic font
1444
1445 % @acronym downcases the argument and prints in smallcaps.
1446 \def\acronym#1{{\smallcaps \lowercase{#1}}}
1447 1479
1448 % @pounds{} is a sterling sign. 1480 % @pounds{} is a sterling sign.
1449 \def\pounds{{\it\$}} 1481 \def\pounds{{\it\$}}
1450 1482
1451 1483
1456 1488
1457 % First the title page. Must do @settitle before @titlepage. 1489 % First the title page. Must do @settitle before @titlepage.
1458 \newif\ifseenauthor 1490 \newif\ifseenauthor
1459 \newif\iffinishedtitlepage 1491 \newif\iffinishedtitlepage
1460 1492
1461 % Do an implicit @contents or @shortcontents after @end titlepage if the
1462 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
1463 %
1464 \newif\ifsetcontentsaftertitlepage
1465 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
1466 \newif\ifsetshortcontentsaftertitlepage
1467 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
1468
1469 \def\shorttitlepage{\parsearg\shorttitlepagezzz} 1493 \def\shorttitlepage{\parsearg\shorttitlepagezzz}
1470 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% 1494 \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
1471 \endgroup\page\hbox{}\page} 1495 \endgroup\page\hbox{}\page}
1472 1496
1473 \def\titlepage{\begingroup \parindent=0pt \textfonts 1497 \def\titlepage{\begingroup \parindent=0pt \textfonts
1474 \let\subtitlerm=\tenrm 1498 \let\subtitlerm=\tenrm
1499 % I deinstalled the following change because \cmr12 is undefined.
1500 % This change was not in the ChangeLog anyway. --rms.
1501 % \let\subtitlerm=\cmr12
1475 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% 1502 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
1476 % 1503 %
1477 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% 1504 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
1478 % 1505 %
1479 % Leave some space at the very top of the page. 1506 % Leave some space at the very top of the page.
1518 % because the headline and footline are only empty inside the group. 1545 % because the headline and footline are only empty inside the group.
1519 % If we use the new definition of \page, we always get a blank page 1546 % If we use the new definition of \page, we always get a blank page
1520 % after the title page, which we certainly don't want. 1547 % after the title page, which we certainly don't want.
1521 \oldpage 1548 \oldpage
1522 \endgroup 1549 \endgroup
1523 %
1524 % If they want short, they certainly want long too.
1525 \ifsetshortcontentsaftertitlepage
1526 \shortcontents
1527 \contents
1528 \global\let\shortcontents = \relax
1529 \global\let\contents = \relax
1530 \fi
1531 %
1532 \ifsetcontentsaftertitlepage
1533 \contents
1534 \global\let\contents = \relax
1535 \global\let\shortcontents = \relax
1536 \fi
1537 %
1538 \ifpdf \pdfmakepagedesttrue \fi
1539 %
1540 \HEADINGSon 1550 \HEADINGSon
1541 } 1551 }
1542 1552
1543 \def\finishtitlepage{% 1553 \def\finishtitlepage{%
1544 \vskip4pt \hrule height 2pt width \hsize 1554 \vskip4pt \hrule height 2pt width \hsize
1548 1558
1549 %%% Set up page headings and footings. 1559 %%% Set up page headings and footings.
1550 1560
1551 \let\thispage=\folio 1561 \let\thispage=\folio
1552 1562
1553 \newtoks\evenheadline % headline on even pages 1563 \newtoks \evenheadline % Token sequence for heading line of even pages
1554 \newtoks\oddheadline % headline on odd pages 1564 \newtoks \oddheadline % Token sequence for heading line of odd pages
1555 \newtoks\evenfootline % footline on even pages 1565 \newtoks \evenfootline % Token sequence for footing line of even pages
1556 \newtoks\oddfootline % footline on odd pages 1566 \newtoks \oddfootline % Token sequence for footing line of odd pages
1557 1567
1558 % Now make Tex use those variables 1568 % Now make Tex use those variables
1559 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline 1569 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
1560 \else \the\evenheadline \fi}} 1570 \else \the\evenheadline \fi}}
1561 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline 1571 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
1669 \global\let\contentsalignmacro = \chappager 1679 \global\let\contentsalignmacro = \chappager
1670 } 1680 }
1671 1681
1672 % Subroutines used in generating headings 1682 % Subroutines used in generating headings
1673 % Produces Day Month Year style of output. 1683 % Produces Day Month Year style of output.
1674 \def\today{% 1684 \def\today{\number\day\space
1675 \number\day\space 1685 \ifcase\month\or
1676 \ifcase\month 1686 January\or February\or March\or April\or May\or June\or
1677 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr 1687 July\or August\or September\or October\or November\or December\fi
1678 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug 1688 \space\number\year}
1679 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec 1689
1680 \fi 1690 % Use this if you want the Month Day, Year style of output.
1681 \space\number\year} 1691 %\def\today{\ifcase\month\or
1682 1692 %January\or February\or March\or April\or May\or June\or
1683 % @settitle line... specifies the title of the document, for headings. 1693 %July\or August\or September\or October\or November\or December\fi
1684 % It generates no output of its own. 1694 %\space\number\day, \number\year}
1685 \def\thistitle{\putwordNoTitle} 1695
1696 % @settitle line... specifies the title of the document, for headings
1697 % It generates no output of its own
1698
1699 \def\thistitle{No Title}
1686 \def\settitle{\parsearg\settitlezzz} 1700 \def\settitle{\parsearg\settitlezzz}
1687 \def\settitlezzz #1{\gdef\thistitle{#1}} 1701 \def\settitlezzz #1{\gdef\thistitle{#1}}
1688 1702
1689 1703
1690 \message{tables,} 1704 \message{tables,}
1705
1706 % @tabs -- simple alignment
1707
1708 % These don't work. For one thing, \+ is defined as outer.
1709 % So these macros cannot even be defined.
1710
1711 %\def\tabs{\parsearg\tabszzz}
1712 %\def\tabszzz #1{\settabs\+#1\cr}
1713 %\def\tabline{\parsearg\tablinezzz}
1714 %\def\tablinezzz #1{\+#1\cr}
1715 %\def\&{&}
1716
1691 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). 1717 % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
1692 1718
1693 % default indentation of table text 1719 % default indentation of table text
1694 \newdimen\tableindent \tableindent=.8in 1720 \newdimen\tableindent \tableindent=.8in
1695 % default indentation of @itemize and @enumerate text 1721 % default indentation of @itemize and @enumerate text
1728 \advance\hsize by -\rightskip 1754 \advance\hsize by -\rightskip
1729 \advance\hsize by -\tableindent 1755 \advance\hsize by -\tableindent
1730 \setbox0=\hbox{\itemfont{#1}}% 1756 \setbox0=\hbox{\itemfont{#1}}%
1731 \itemindex{#1}% 1757 \itemindex{#1}%
1732 \nobreak % This prevents a break before @itemx. 1758 \nobreak % This prevents a break before @itemx.
1759 %
1760 % Be sure we are not still in the middle of a paragraph.
1761 %{\parskip = 0in
1762 %\par
1763 %}%
1733 % 1764 %
1734 % If the item text does not fit in the space we have, put it on a line 1765 % If the item text does not fit in the space we have, put it on a line
1735 % by itself, and do not allow a page break either before or after that 1766 % by itself, and do not allow a page break either before or after that
1736 % line. We do not start a paragraph here because then if the next 1767 % line. We do not start a paragraph here because then if the next
1737 % command is, e.g., @kindex, the whatsit would get put into the 1768 % command is, e.g., @kindex, the whatsit would get put into the
1757 \nobreak 1788 \nobreak
1758 \endgroup 1789 \endgroup
1759 \itemxneedsnegativevskipfalse 1790 \itemxneedsnegativevskipfalse
1760 \else 1791 \else
1761 % The item text fits into the space. Start a paragraph, so that the 1792 % The item text fits into the space. Start a paragraph, so that the
1762 % following text (if any) will end up on the same line. 1793 % following text (if any) will end up on the same line. Since that
1794 % text will be indented by \tableindent, we make the item text be in
1795 % a zero-width box.
1763 \noindent 1796 \noindent
1764 % Do this with kerns and \unhbox so that if there is a footnote in 1797 \rlap{\hskip -\tableindent\box0}\ignorespaces%
1765 % the item text, it can migrate to the main vertical list and 1798 \endgroup%
1766 % eventually be printed. 1799 \itemxneedsnegativevskiptrue%
1767 \nobreak\kern-\tableindent
1768 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
1769 \unhbox0
1770 \nobreak\kern\dimen0
1771 \endgroup
1772 \itemxneedsnegativevskiptrue
1773 \fi 1800 \fi
1774 } 1801 }
1775 1802
1776 \def\item{\errmessage{@item while not in a table}} 1803 \def\item{\errmessage{@item while not in a table}}
1777 \def\itemx{\errmessage{@itemx while not in a table}} 1804 \def\itemx{\errmessage{@itemx while not in a table}}
1778 \def\kitem{\errmessage{@kitem while not in a table}} 1805 \def\kitem{\errmessage{@kitem while not in a table}}
1779 \def\kitemx{\errmessage{@kitemx while not in a table}} 1806 \def\kitemx{\errmessage{@kitemx while not in a table}}
1780 \def\xitem{\errmessage{@xitem while not in a table}} 1807 \def\xitem{\errmessage{@xitem while not in a table}}
1781 \def\xitemx{\errmessage{@xitemx while not in a table}} 1808 \def\xitemx{\errmessage{@xitemx while not in a table}}
1782 1809
1783 % Contains a kludge to get @end[description] to work. 1810 %% Contains a kludge to get @end[description] to work
1784 \def\description{\tablez{\dontindex}{1}{}{}{}{}} 1811 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
1785 1812
1786 % @table, @ftable, @vtable.
1787 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} 1813 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
1788 {\obeylines\obeyspaces% 1814 {\obeylines\obeyspaces%
1789 \gdef\tablex #1^^M{% 1815 \gdef\tablex #1^^M{%
1790 \tabley\dontindex#1 \endtabley}} 1816 \tabley\dontindex#1 \endtabley}}
1791 1817
1841 \newcount \itemno 1867 \newcount \itemno
1842 1868
1843 \def\itemize{\parsearg\itemizezzz} 1869 \def\itemize{\parsearg\itemizezzz}
1844 1870
1845 \def\itemizezzz #1{% 1871 \def\itemizezzz #1{%
1846 \begingroup % ended by the @end itemize 1872 \begingroup % ended by the @end itemsize
1847 \itemizey {#1}{\Eitemize} 1873 \itemizey {#1}{\Eitemize}
1848 } 1874 }
1849 1875
1850 \def\itemizey #1#2{% 1876 \def\itemizey #1#2{%
1851 \aboveenvbreak % 1877 \aboveenvbreak %
2054 \multitableparindent=6pt 2080 \multitableparindent=6pt
2055 \multitablecolspace=12pt 2081 \multitablecolspace=12pt
2056 \multitablelinespace=0pt 2082 \multitablelinespace=0pt
2057 2083
2058 % Macros used to set up halign preamble: 2084 % Macros used to set up halign preamble:
2059 % 2085 %
2060 \let\endsetuptable\relax 2086 \let\endsetuptable\relax
2061 \def\xendsetuptable{\endsetuptable} 2087 \def\xendsetuptable{\endsetuptable}
2062 \let\columnfractions\relax 2088 \let\columnfractions\relax
2063 \def\xcolumnfractions{\columnfractions} 2089 \def\xcolumnfractions{\columnfractions}
2064 \newif\ifsetpercent 2090 \newif\ifsetpercent
2065 2091
2066 % #1 is the part of the @columnfraction before the decimal point, which 2092 % 2/1/96, to allow fractions to be given with more than one digit.
2067 % is presumably either 0 or the empty string (but we don't check, we 2093 \def\pickupwholefraction#1 {\global\advance\colcount by1 %
2068 % just throw it away). #2 is the decimal part, which we use as the 2094 \expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
2069 % percent of \hsize for this column. 2095 \setuptable}
2070 \def\pickupwholefraction#1.#2 {%
2071 \global\advance\colcount by 1
2072 \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
2073 \setuptable
2074 }
2075 2096
2076 \newcount\colcount 2097 \newcount\colcount
2077 \def\setuptable#1{% 2098 \def\setuptable#1{\def\firstarg{#1}%
2078 \def\firstarg{#1}% 2099 \ifx\firstarg\xendsetuptable\let\go\relax%
2079 \ifx\firstarg\xendsetuptable 2100 \else
2080 \let\go = \relax 2101 \ifx\firstarg\xcolumnfractions\global\setpercenttrue%
2081 \else 2102 \else
2082 \ifx\firstarg\xcolumnfractions 2103 \ifsetpercent
2083 \global\setpercenttrue 2104 \let\go\pickupwholefraction % In this case arg of setuptable
2105 % is the decimal point before the
2106 % number given in percent of hsize.
2107 % We don't need this so we don't use it.
2084 \else 2108 \else
2085 \ifsetpercent 2109 \global\advance\colcount by1
2086 \let\go\pickupwholefraction 2110 \setbox0=\hbox{#1 }% Add a normal word space as a separator;
2087 \else 2111 % typically that is always in the input, anyway.
2088 \global\advance\colcount by 1 2112 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2089 \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator;
2090 % typically that is always in the input, anyway.
2091 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
2092 \fi
2093 \fi
2094 \ifx\go\pickupwholefraction
2095 % Put the argument back for the \pickupwholefraction call, so
2096 % we'll always have a period there to be parsed.
2097 \def\go{\pickupwholefraction#1}%
2098 \else
2099 \let\go = \setuptable
2100 \fi% 2113 \fi%
2101 \fi 2114 \fi%
2102 \go 2115 \ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
2103 } 2116 \fi\go}
2104 2117
2105 % This used to have \hskip1sp. But then the space in a template line is 2118 % multitable syntax
2106 % not enough. That is bad. So let's go back to just & until we 2119 \def\tab{&\hskip1sp\relax} % 2/2/96
2107 % encounter the problem it was intended to solve again. 2120 % tiny skip here makes sure this column space is
2108 % --karl, nathan@acm.org, 20apr99. 2121 % maintained, even if it is never used.
2109 \def\tab{&}
2110 2122
2111 % @multitable ... @end multitable definitions: 2123 % @multitable ... @end multitable definitions:
2112 % 2124
2113 \def\multitable{\parsearg\dotable} 2125 \def\multitable{\parsearg\dotable}
2114 \def\dotable#1{\bgroup 2126 \def\dotable#1{\bgroup
2115 \vskip\parskip 2127 \vskip\parskip
2116 \let\item\crcr 2128 \let\item\crcr
2117 \tolerance=9500 2129 \tolerance=9500
2146 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname 2158 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
2147 % 2159 %
2148 % In order to keep entries from bumping into each other 2160 % In order to keep entries from bumping into each other
2149 % we will add a \leftskip of \multitablecolspace to all columns after 2161 % we will add a \leftskip of \multitablecolspace to all columns after
2150 % the first one. 2162 % the first one.
2151 % 2163 %
2152 % If a template has been used, we will add \multitablecolspace 2164 % If a template has been used, we will add \multitablecolspace
2153 % to the width of each template entry. 2165 % to the width of each template entry.
2154 % 2166 %
2155 % If the user has set preamble in terms of percent of \hsize we will 2167 % If the user has set preamble in terms of percent of \hsize we will
2156 % use that dimension as the width of the column, and the \leftskip 2168 % use that dimension as the width of the column, and the \leftskip
2157 % will keep entries from bumping into each other. Table will start at 2169 % will keep entries from bumping into each other. Table will start at
2158 % left margin and final column will justify at right margin. 2170 % left margin and final column will justify at right margin.
2159 % 2171 %
2160 % Make sure we don't inherit \rightskip from the outer environment. 2172 % Make sure we don't inherit \rightskip from the outer environment.
2161 \rightskip=0pt 2173 \rightskip=0pt
2162 \ifnum\colcount=1 2174 \ifnum\colcount=1
2163 % The first column will be indented with the surrounding text. 2175 % The first column will be indented with the surrounding text.
2164 \advance\hsize by\leftskip 2176 \advance\hsize by\leftskip
2185 2197
2186 \def\setmultitablespacing{% test to see if user has set \multitablelinespace. 2198 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
2187 % If so, do nothing. If not, give it an appropriate dimension based on 2199 % If so, do nothing. If not, give it an appropriate dimension based on
2188 % current baselineskip. 2200 % current baselineskip.
2189 \ifdim\multitablelinespace=0pt 2201 \ifdim\multitablelinespace=0pt
2190 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
2191 \global\advance\multitablelinespace by-\ht0
2192 %% strut to put in table in case some entry doesn't have descenders, 2202 %% strut to put in table in case some entry doesn't have descenders,
2193 %% to keep lines equally spaced 2203 %% to keep lines equally spaced
2194 \let\multistrut = \strut 2204 \let\multistrut = \strut
2195 \else
2196 %% FIXME: what is \box0 supposed to be?
2197 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2198 width0pt\relax} \fi
2199 %% Test to see if parskip is larger than space between lines of 2205 %% Test to see if parskip is larger than space between lines of
2200 %% table. If not, do nothing. 2206 %% table. If not, do nothing.
2201 %% If so, set to same dimension as multitablelinespace. 2207 %% If so, set to same dimension as multitablelinespace.
2208 \else
2209 \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
2210 width0pt\relax} \fi
2202 \ifdim\multitableparskip>\multitablelinespace 2211 \ifdim\multitableparskip>\multitablelinespace
2203 \global\multitableparskip=\multitablelinespace 2212 \global\multitableparskip=\multitablelinespace
2204 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller 2213 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2205 %% than skip between lines in the table. 2214 %% than skip between lines in the table.
2206 \fi% 2215 \fi%
2209 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller 2218 \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
2210 %% than skip between lines in the table. 2219 %% than skip between lines in the table.
2211 \fi} 2220 \fi}
2212 2221
2213 2222
2214 \message{conditionals,}
2215 % Prevent errors for section commands.
2216 % Used in @ignore and in failing conditionals.
2217 \def\ignoresections{%
2218 \let\chapter=\relax
2219 \let\unnumbered=\relax
2220 \let\top=\relax
2221 \let\unnumberedsec=\relax
2222 \let\unnumberedsection=\relax
2223 \let\unnumberedsubsec=\relax
2224 \let\unnumberedsubsection=\relax
2225 \let\unnumberedsubsubsec=\relax
2226 \let\unnumberedsubsubsection=\relax
2227 \let\section=\relax
2228 \let\subsec=\relax
2229 \let\subsubsec=\relax
2230 \let\subsection=\relax
2231 \let\subsubsection=\relax
2232 \let\appendix=\relax
2233 \let\appendixsec=\relax
2234 \let\appendixsection=\relax
2235 \let\appendixsubsec=\relax
2236 \let\appendixsubsection=\relax
2237 \let\appendixsubsubsec=\relax
2238 \let\appendixsubsubsection=\relax
2239 \let\contents=\relax
2240 \let\smallbook=\relax
2241 \let\titlepage=\relax
2242 }
2243
2244 % Used in nested conditionals, where we have to parse the Texinfo source
2245 % and so want to turn off most commands, in case they are used
2246 % incorrectly.
2247 %
2248 \def\ignoremorecommands{%
2249 \let\defcodeindex = \relax
2250 \let\defcv = \relax
2251 \let\deffn = \relax
2252 \let\deffnx = \relax
2253 \let\defindex = \relax
2254 \let\defivar = \relax
2255 \let\defmac = \relax
2256 \let\defmethod = \relax
2257 \let\defop = \relax
2258 \let\defopt = \relax
2259 \let\defspec = \relax
2260 \let\deftp = \relax
2261 \let\deftypefn = \relax
2262 \let\deftypefun = \relax
2263 \let\deftypeivar = \relax
2264 \let\deftypeop = \relax
2265 \let\deftypevar = \relax
2266 \let\deftypevr = \relax
2267 \let\defun = \relax
2268 \let\defvar = \relax
2269 \let\defvr = \relax
2270 \let\ref = \relax
2271 \let\xref = \relax
2272 \let\printindex = \relax
2273 \let\pxref = \relax
2274 \let\settitle = \relax
2275 \let\setchapternewpage = \relax
2276 \let\setchapterstyle = \relax
2277 \let\everyheading = \relax
2278 \let\evenheading = \relax
2279 \let\oddheading = \relax
2280 \let\everyfooting = \relax
2281 \let\evenfooting = \relax
2282 \let\oddfooting = \relax
2283 \let\headings = \relax
2284 \let\include = \relax
2285 \let\lowersections = \relax
2286 \let\down = \relax
2287 \let\raisesections = \relax
2288 \let\up = \relax
2289 \let\set = \relax
2290 \let\clear = \relax
2291 \let\item = \relax
2292 }
2293
2294 % Ignore @ignore ... @end ignore.
2295 %
2296 \def\ignore{\doignore{ignore}}
2297
2298 % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
2299 %
2300 \def\ifinfo{\doignore{ifinfo}}
2301 \def\ifhtml{\doignore{ifhtml}}
2302 \def\ifnottex{\doignore{ifnottex}}
2303 \def\html{\doignore{html}}
2304 \def\menu{\doignore{menu}}
2305 \def\direntry{\doignore{direntry}}
2306
2307 % @dircategory CATEGORY -- specify a category of the dir file
2308 % which this file should belong to. Ignore this in TeX.
2309 \let\dircategory = \comment
2310
2311 % Ignore text until a line `@end #1'.
2312 %
2313 \def\doignore#1{\begingroup
2314 % Don't complain about control sequences we have declared \outer.
2315 \ignoresections
2316 %
2317 % Define a command to swallow text until we reach `@end #1'.
2318 % This @ is a catcode 12 token (that is the normal catcode of @ in
2319 % this texinfo.tex file). We change the catcode of @ below to match.
2320 \long\def\doignoretext##1@end #1{\enddoignore}%
2321 %
2322 % Make sure that spaces turn into tokens that match what \doignoretext wants.
2323 \catcode32 = 10
2324 %
2325 % Ignore braces, too, so mismatched braces don't cause trouble.
2326 \catcode`\{ = 9
2327 \catcode`\} = 9
2328 %
2329 % We must not have @c interpreted as a control sequence.
2330 \catcode`\@ = 12
2331 %
2332 % Make the letter c a comment character so that the rest of the line
2333 % will be ignored. This way, the document can have (for example)
2334 % @c @end ifinfo
2335 % and the @end ifinfo will be properly ignored.
2336 % (We've just changed @ to catcode 12.)
2337 \catcode`\c = 14
2338 %
2339 % And now expand that command.
2340 \doignoretext
2341 }
2342
2343 % What we do to finish off ignored text.
2344 %
2345 \def\enddoignore{\endgroup\ignorespaces}%
2346
2347 \newif\ifwarnedobs\warnedobsfalse
2348 \def\obstexwarn{%
2349 \ifwarnedobs\relax\else
2350 % We need to warn folks that they may have trouble with TeX 3.0.
2351 % This uses \immediate\write16 rather than \message to get newlines.
2352 \immediate\write16{}
2353 \immediate\write16{WARNING: for users of Unix TeX 3.0!}
2354 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
2355 \immediate\write16{If you are running another version of TeX, relax.}
2356 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
2357 \immediate\write16{ Then upgrade your TeX installation if you can.}
2358 \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
2359 \immediate\write16{If you are stuck with version 3.0, run the}
2360 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
2361 \immediate\write16{ to use a workaround.}
2362 \immediate\write16{}
2363 \global\warnedobstrue
2364 \fi
2365 }
2366
2367 % **In TeX 3.0, setting text in \nullfont hangs tex. For a
2368 % workaround (which requires the file ``dummy.tfm'' to be installed),
2369 % uncomment the following line:
2370 %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
2371
2372 % Ignore text, except that we keep track of conditional commands for
2373 % purposes of nesting, up to an `@end #1' command.
2374 %
2375 \def\nestedignore#1{%
2376 \obstexwarn
2377 % We must actually expand the ignored text to look for the @end
2378 % command, so that nested ignore constructs work. Thus, we put the
2379 % text into a \vbox and then do nothing with the result. To minimize
2380 % the change of memory overflow, we follow the approach outlined on
2381 % page 401 of the TeXbook: make the current font be a dummy font.
2382 %
2383 \setbox0 = \vbox\bgroup
2384 % Don't complain about control sequences we have declared \outer.
2385 \ignoresections
2386 %
2387 % Define `@end #1' to end the box, which will in turn undefine the
2388 % @end command again.
2389 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
2390 %
2391 % We are going to be parsing Texinfo commands. Most cause no
2392 % trouble when they are used incorrectly, but some commands do
2393 % complicated argument parsing or otherwise get confused, so we
2394 % undefine them.
2395 %
2396 % We can't do anything about stray @-signs, unfortunately;
2397 % they'll produce `undefined control sequence' errors.
2398 \ignoremorecommands
2399 %
2400 % Set the current font to be \nullfont, a TeX primitive, and define
2401 % all the font commands to also use \nullfont. We don't use
2402 % dummy.tfm, as suggested in the TeXbook, because not all sites
2403 % might have that installed. Therefore, math mode will still
2404 % produce output, but that should be an extremely small amount of
2405 % stuff compared to the main input.
2406 %
2407 \nullfont
2408 \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont
2409 \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont
2410 \let\tensf=\nullfont
2411 % Similarly for index fonts (mostly for their use in smallexample).
2412 \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont
2413 \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont
2414 \let\smallsf=\nullfont
2415 %
2416 % Don't complain when characters are missing from the fonts.
2417 \tracinglostchars = 0
2418 %
2419 % Don't bother to do space factor calculations.
2420 \frenchspacing
2421 %
2422 % Don't report underfull hboxes.
2423 \hbadness = 10000
2424 %
2425 % Do minimal line-breaking.
2426 \pretolerance = 10000
2427 %
2428 % Do not execute instructions in @tex
2429 \def\tex{\doignore{tex}}%
2430 % Do not execute macro definitions.
2431 % `c' is a comment character, so the word `macro' will get cut off.
2432 \def\macro{\doignore{ma}}%
2433 }
2434
2435 % @set VAR sets the variable VAR to an empty value.
2436 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
2437 %
2438 % Since we want to separate VAR from REST-OF-LINE (which might be
2439 % empty), we can't just use \parsearg; we have to insert a space of our
2440 % own to delimit the rest of the line, and then take it out again if we
2441 % didn't need it. Make sure the catcode of space is correct to avoid
2442 % losing inside @example, for instance.
2443 %
2444 \def\set{\begingroup\catcode` =10
2445 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
2446 \parsearg\setxxx}
2447 \def\setxxx#1{\setyyy#1 \endsetyyy}
2448 \def\setyyy#1 #2\endsetyyy{%
2449 \def\temp{#2}%
2450 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
2451 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
2452 \fi
2453 \endgroup
2454 }
2455 % Can't use \xdef to pre-expand #2 and save some time, since \temp or
2456 % \next or other control sequences that we've defined might get us into
2457 % an infinite loop. Consider `@set foo @cite{bar}'.
2458 \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
2459
2460 % @clear VAR clears (i.e., unsets) the variable VAR.
2461 %
2462 \def\clear{\parsearg\clearxxx}
2463 \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
2464
2465 % @value{foo} gets the text saved in variable foo.
2466 {
2467 \catcode`\_ = \active
2468 %
2469 % We might end up with active _ or - characters in the argument if
2470 % we're called from @code, as @code{@value{foo-bar_}}. So \let any
2471 % such active characters to their normal equivalents.
2472 \gdef\value{\begingroup
2473 \catcode`\-=12 \catcode`\_=12
2474 \indexbreaks \let_\normalunderscore
2475 \valuexxx}
2476 }
2477 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
2478
2479 % We have this subroutine so that we can handle at least some @value's
2480 % properly in indexes (we \let\value to this in \indexdummies). Ones
2481 % whose names contain - or _ still won't work, but we can't do anything
2482 % about that. The command has to be fully expandable, since the result
2483 % winds up in the index file. This means that if the variable's value
2484 % contains other Texinfo commands, it's almost certain it will fail
2485 % (although perhaps we could fix that with sufficient work to do a
2486 % one-level expansion on the result, instead of complete).
2487 %
2488 \def\expandablevalue#1{%
2489 \expandafter\ifx\csname SET#1\endcsname\relax
2490 {[No value for ``#1'']}%
2491 \else
2492 \csname SET#1\endcsname
2493 \fi
2494 }
2495
2496 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
2497 % with @set.
2498 %
2499 \def\ifset{\parsearg\ifsetxxx}
2500 \def\ifsetxxx #1{%
2501 \expandafter\ifx\csname SET#1\endcsname\relax
2502 \expandafter\ifsetfail
2503 \else
2504 \expandafter\ifsetsucceed
2505 \fi
2506 }
2507 \def\ifsetsucceed{\conditionalsucceed{ifset}}
2508 \def\ifsetfail{\nestedignore{ifset}}
2509 \defineunmatchedend{ifset}
2510
2511 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
2512 % defined with @set, or has been undefined with @clear.
2513 %
2514 \def\ifclear{\parsearg\ifclearxxx}
2515 \def\ifclearxxx #1{%
2516 \expandafter\ifx\csname SET#1\endcsname\relax
2517 \expandafter\ifclearsucceed
2518 \else
2519 \expandafter\ifclearfail
2520 \fi
2521 }
2522 \def\ifclearsucceed{\conditionalsucceed{ifclear}}
2523 \def\ifclearfail{\nestedignore{ifclear}}
2524 \defineunmatchedend{ifclear}
2525
2526 % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
2527 % following, through the first @end iftex (etc.). Make `@end iftex'
2528 % (etc.) valid only after an @iftex.
2529 %
2530 \def\iftex{\conditionalsucceed{iftex}}
2531 \def\ifnothtml{\conditionalsucceed{ifnothtml}}
2532 \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
2533 \defineunmatchedend{iftex}
2534 \defineunmatchedend{ifnothtml}
2535 \defineunmatchedend{ifnotinfo}
2536
2537 % We can't just want to start a group at @iftex (for example) and end it
2538 % at @end iftex, since then @set commands inside the conditional have no
2539 % effect (they'd get reverted at the end of the group). So we must
2540 % define \Eiftex to redefine itself to be its previous value. (We can't
2541 % just define it to fail again with an ``unmatched end'' error, since
2542 % the @ifset might be nested.)
2543 %
2544 \def\conditionalsucceed#1{%
2545 \edef\temp{%
2546 % Remember the current value of \E#1.
2547 \let\nece{prevE#1} = \nece{E#1}%
2548 %
2549 % At the `@end #1', redefine \E#1 to be its previous value.
2550 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
2551 }%
2552 \temp
2553 }
2554
2555 % We need to expand lots of \csname's, but we don't want to expand the
2556 % control sequences after we've constructed them.
2557 %
2558 \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
2559
2560 % @defininfoenclose.
2561 \let\definfoenclose=\comment
2562
2563
2564 \message{indexing,} 2223 \message{indexing,}
2565 % Index generation facilities 2224 % Index generation facilities
2566 2225
2567 % Define \newwrite to be identical to plain tex's \newwrite 2226 % Define \newwrite to be identical to plain tex's \newwrite
2568 % except not \outer, so it can be used within \newindex. 2227 % except not \outer, so it can be used within \newindex.
2574 % \fooindex ...rest of line... puts an entry in the index foo. 2233 % \fooindex ...rest of line... puts an entry in the index foo.
2575 % It also defines \fooindfile to be the number of the output channel for 2234 % It also defines \fooindfile to be the number of the output channel for
2576 % the file that accumulates this index. The file's extension is foo. 2235 % the file that accumulates this index. The file's extension is foo.
2577 % The name of an index should be no more than 2 characters long 2236 % The name of an index should be no more than 2 characters long
2578 % for the sake of vms. 2237 % for the sake of vms.
2579 % 2238
2580 \def\newindex#1{% 2239 \def\newindex #1{
2581 \iflinks 2240 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
2582 \expandafter\newwrite \csname#1indfile\endcsname 2241 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2583 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file 2242 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2584 \fi 2243 \noexpand\doindex {#1}}
2585 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
2586 \noexpand\doindex{#1}}
2587 } 2244 }
2588 2245
2589 % @defindex foo == \newindex{foo} 2246 % @defindex foo == \newindex{foo}
2590 2247
2591 \def\defindex{\parsearg\newindex} 2248 \def\defindex{\parsearg\newindex}
2592 2249
2593 % Define @defcodeindex, like @defindex except put all entries in @code. 2250 % Define @defcodeindex, like @defindex except put all entries in @code.
2594 2251
2595 \def\newcodeindex#1{% 2252 \def\newcodeindex #1{
2596 \iflinks 2253 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
2597 \expandafter\newwrite \csname#1indfile\endcsname 2254 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
2598 \openout \csname#1indfile\endcsname \jobname.#1 2255 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2599 \fi 2256 \noexpand\docodeindex {#1}}
2600 \expandafter\xdef\csname#1index\endcsname{%
2601 \noexpand\docodeindex{#1}}
2602 } 2257 }
2603 2258
2604 \def\defcodeindex{\parsearg\newcodeindex} 2259 \def\defcodeindex{\parsearg\newcodeindex}
2605 2260
2606 % @synindex foo bar makes index foo feed into index bar. 2261 % @synindex foo bar makes index foo feed into index bar.
2607 % Do this instead of @defindex foo if you don't want it as a separate index. 2262 % Do this instead of @defindex foo if you don't want it as a separate index.
2608 % The \closeout helps reduce unnecessary open files; the limit on the 2263 \def\synindex #1 #2 {%
2609 % Acorn RISC OS is a mere 16 files. 2264 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2610 \def\synindex#1 #2 {% 2265 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2611 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname 2266 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2612 \expandafter\closeout\csname#1indfile\endcsname 2267 \noexpand\doindex {#2}}%
2613 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2614 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2615 \noexpand\doindex{#2}}%
2616 } 2268 }
2617 2269
2618 % @syncodeindex foo bar similar, but put all entries made for index foo 2270 % @syncodeindex foo bar similar, but put all entries made for index foo
2619 % inside @code. 2271 % inside @code.
2620 \def\syncodeindex#1 #2 {% 2272 \def\syncodeindex #1 #2 {%
2621 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname 2273 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2622 \expandafter\closeout\csname#1indfile\endcsname 2274 \expandafter\let\csname#1indfile\endcsname=\synindexfoo
2623 \expandafter\let\csname#1indfile\endcsname=\synindexfoo 2275 \expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
2624 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex 2276 \noexpand\docodeindex {#2}}%
2625 \noexpand\docodeindex{#2}}%
2626 } 2277 }
2627 2278
2628 % Define \doindex, the driver for all \fooindex macros. 2279 % Define \doindex, the driver for all \fooindex macros.
2629 % Argument #1 is generated by the calling \fooindex macro, 2280 % Argument #1 is generated by the calling \fooindex macro,
2630 % and it is "foo", the name of the index. 2281 % and it is "foo", the name of the index.
2641 % like the previous two, but they put @code around the argument. 2292 % like the previous two, but they put @code around the argument.
2642 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} 2293 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
2643 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} 2294 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
2644 2295
2645 \def\indexdummies{% 2296 \def\indexdummies{%
2646 \def\ { }%
2647 % Take care of the plain tex accent commands. 2297 % Take care of the plain tex accent commands.
2648 \def\"{\realbackslash "}% 2298 \def\"{\realbackslash "}%
2649 \def\`{\realbackslash `}% 2299 \def\`{\realbackslash `}%
2650 \def\'{\realbackslash '}% 2300 \def\'{\realbackslash '}%
2651 \def\^{\realbackslash ^}% 2301 \def\^{\realbackslash ^}%
2671 \def\ss{\realbackslash ss}% 2321 \def\ss{\realbackslash ss}%
2672 % Take care of texinfo commands likely to appear in an index entry. 2322 % Take care of texinfo commands likely to appear in an index entry.
2673 % (Must be a way to avoid doing expansion at all, and thus not have to 2323 % (Must be a way to avoid doing expansion at all, and thus not have to
2674 % laboriously list every single command here.) 2324 % laboriously list every single command here.)
2675 \def\@{@}% will be @@ when we switch to @ as escape char. 2325 \def\@{@}% will be @@ when we switch to @ as escape char.
2676 % Need these in case \tex is in effect and \{ is a \delimiter again. 2326 %\let\{ = \lbracecmd
2677 % But can't use \lbracecmd and \rbracecmd because texindex assumes 2327 %\let\} = \rbracecmd
2678 % braces and backslashes are used only as delimiters.
2679 \let\{ = \mylbrace
2680 \let\} = \myrbrace
2681 \def\_{{\realbackslash _}}% 2328 \def\_{{\realbackslash _}}%
2682 \def\w{\realbackslash w }% 2329 \def\w{\realbackslash w }%
2683 \def\bf{\realbackslash bf }% 2330 \def\bf{\realbackslash bf }%
2684 %\def\rm{\realbackslash rm }% 2331 %\def\rm{\realbackslash rm }%
2685 \def\sl{\realbackslash sl }% 2332 \def\sl{\realbackslash sl }%
2686 \def\sf{\realbackslash sf}% 2333 \def\sf{\realbackslash sf}%
2687 \def\tt{\realbackslash tt}% 2334 \def\tt{\realbackslash tt}%
2688 \def\gtr{\realbackslash gtr}% 2335 \def\gtr{\realbackslash gtr}%
2689 \def\less{\realbackslash less}% 2336 \def\less{\realbackslash less}%
2690 \def\hat{\realbackslash hat}% 2337 \def\hat{\realbackslash hat}%
2338 %\def\char{\realbackslash char}%
2691 \def\TeX{\realbackslash TeX}% 2339 \def\TeX{\realbackslash TeX}%
2692 \def\dots{\realbackslash dots }% 2340 \def\dots{\realbackslash dots }%
2693 \def\result{\realbackslash result}% 2341 \def\result{\realbackslash result}%
2694 \def\equiv{\realbackslash equiv}% 2342 \def\equiv{\realbackslash equiv}%
2695 \def\expansion{\realbackslash expansion}% 2343 \def\expansion{\realbackslash expansion}%
2697 \def\error{\realbackslash error}% 2345 \def\error{\realbackslash error}%
2698 \def\point{\realbackslash point}% 2346 \def\point{\realbackslash point}%
2699 \def\copyright{\realbackslash copyright}% 2347 \def\copyright{\realbackslash copyright}%
2700 \def\tclose##1{\realbackslash tclose {##1}}% 2348 \def\tclose##1{\realbackslash tclose {##1}}%
2701 \def\code##1{\realbackslash code {##1}}% 2349 \def\code##1{\realbackslash code {##1}}%
2702 \def\uref##1{\realbackslash uref {##1}}%
2703 \def\url##1{\realbackslash url {##1}}%
2704 \def\env##1{\realbackslash env {##1}}%
2705 \def\command##1{\realbackslash command {##1}}%
2706 \def\option##1{\realbackslash option {##1}}%
2707 \def\dotless##1{\realbackslash dotless {##1}}% 2350 \def\dotless##1{\realbackslash dotless {##1}}%
2708 \def\samp##1{\realbackslash samp {##1}}% 2351 \def\samp##1{\realbackslash samp {##1}}%
2709 \def\,##1{\realbackslash ,{##1}}% 2352 \def\,##1{\realbackslash ,{##1}}%
2710 \def\t##1{\realbackslash t {##1}}% 2353 \def\t##1{\realbackslash t {##1}}%
2711 \def\r##1{\realbackslash r {##1}}% 2354 \def\r##1{\realbackslash r {##1}}%
2717 \def\file##1{\realbackslash file {##1}}% 2360 \def\file##1{\realbackslash file {##1}}%
2718 \def\var##1{\realbackslash var {##1}}% 2361 \def\var##1{\realbackslash var {##1}}%
2719 \def\kbd##1{\realbackslash kbd {##1}}% 2362 \def\kbd##1{\realbackslash kbd {##1}}%
2720 \def\dfn##1{\realbackslash dfn {##1}}% 2363 \def\dfn##1{\realbackslash dfn {##1}}%
2721 \def\emph##1{\realbackslash emph {##1}}% 2364 \def\emph##1{\realbackslash emph {##1}}%
2722 \def\acronym##1{\realbackslash acronym {##1}}% 2365 \def\value##1{\realbackslash value {##1}}%
2723 %
2724 % Handle some cases of @value -- where the variable name does not
2725 % contain - or _, and the value does not contain any
2726 % (non-fully-expandable) commands.
2727 \let\value = \expandablevalue
2728 %
2729 \unsepspaces 2366 \unsepspaces
2730 % Turn off macro expansion
2731 \turnoffmacros
2732 } 2367 }
2733 2368
2734 % If an index command is used in an @example environment, any spaces 2369 % If an index command is used in an @example environment, any spaces
2735 % therein should become regular spaces in the raw index file, not the 2370 % therein should become regular spaces in the raw index file, not the
2736 % expansion of \tie (\\leavevmode \penalty \@M \ ). 2371 % expansion of \tie (\\leavevmode \penalty \@M \ ).
2783 %Don't no-op \tt, since it isn't a user-level command 2418 %Don't no-op \tt, since it isn't a user-level command
2784 % and is used in the definitions of the active chars like <, >, |... 2419 % and is used in the definitions of the active chars like <, >, |...
2785 %\let\tt=\indexdummyfont 2420 %\let\tt=\indexdummyfont
2786 \let\tclose=\indexdummyfont 2421 \let\tclose=\indexdummyfont
2787 \let\code=\indexdummyfont 2422 \let\code=\indexdummyfont
2788 \let\url=\indexdummyfont
2789 \let\uref=\indexdummyfont
2790 \let\env=\indexdummyfont
2791 \let\acronym=\indexdummyfont
2792 \let\command=\indexdummyfont
2793 \let\option=\indexdummyfont
2794 \let\file=\indexdummyfont 2423 \let\file=\indexdummyfont
2795 \let\samp=\indexdummyfont 2424 \let\samp=\indexdummyfont
2796 \let\kbd=\indexdummyfont 2425 \let\kbd=\indexdummyfont
2797 \let\key=\indexdummyfont 2426 \let\key=\indexdummyfont
2798 \let\var=\indexdummyfont 2427 \let\var=\indexdummyfont
2804 % To define \realbackslash, we must make \ not be an escape. 2433 % To define \realbackslash, we must make \ not be an escape.
2805 % We must first make another character (@) an escape 2434 % We must first make another character (@) an escape
2806 % so we do not become unable to do a definition. 2435 % so we do not become unable to do a definition.
2807 2436
2808 {\catcode`\@=0 \catcode`\\=\other 2437 {\catcode`\@=0 \catcode`\\=\other
2809 @gdef@realbackslash{\}} 2438 @gdef@realbackslash{\}}
2810 2439
2811 \let\indexbackslash=0 %overridden during \printindex. 2440 \let\indexbackslash=0 %overridden during \printindex.
2812 \let\SETmarginindex=\relax % put index entries in margin (undocumented)? 2441
2813 2442 \let\SETmarginindex=\relax %initialize!
2814 % For \ifx comparisons. 2443 % workhorse for all \fooindexes
2815 \def\emptymacro{\empty} 2444 % #1 is name of index, #2 is stuff to put there
2816 2445 \def\doind #1#2{%
2817 % Most index entries go through here, but \dosubind is the general case.
2818 %
2819 \def\doind#1#2{\dosubind{#1}{#2}\empty}
2820
2821 % Workhorse for all \fooindexes.
2822 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
2823 % \empty if called from \doind, as we usually are. The main exception
2824 % is with defuns, which call us directly.
2825 %
2826 \def\dosubind#1#2#3{%
2827 % Put the index entry in the margin if desired. 2446 % Put the index entry in the margin if desired.
2828 \ifx\SETmarginindex\relax\else 2447 \ifx\SETmarginindex\relax\else
2829 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% 2448 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
2830 \fi 2449 \fi
2831 {% 2450 {%
2832 \count255=\lastpenalty 2451 \count255=\lastpenalty
2833 {% 2452 {%
2834 \indexdummies % Must do this here, since \bf, etc expand at this stage 2453 \indexdummies % Must do this here, since \bf, etc expand at this stage
2835 \escapechar=`\\ 2454 \escapechar=`\\
2836 {% 2455 {%
2837 \let\folio = 0% We will expand all macros now EXCEPT \folio. 2456 \let\folio=0% We will expand all macros now EXCEPT \folio.
2838 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now 2457 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
2839 % so it will be output as is; and it will print as backslash. 2458 % so it will be output as is; and it will print as backslash.
2840 % 2459 %
2841 \def\thirdarg{#3}% 2460 % First process the index-string with all font commands turned off
2461 % to get the string to sort by.
2462 {\indexnofonts \xdef\indexsorttmp{#2}}%
2842 % 2463 %
2843 % If third arg is present, precede it with space in sort key. 2464 % Now produce the complete index entry, with both the sort key and the
2844 \ifx\thirdarg\emptymacro 2465 % original text, including any font commands.
2845 \let\subentry = \empty
2846 \else
2847 \def\subentry{ #3}%
2848 \fi
2849 %
2850 % First process the index entry with all font commands turned
2851 % off to get the string to sort by.
2852 {\indexnofonts \xdef\indexsorttmp{#2\subentry}}%
2853 %
2854 % Now the real index entry with the fonts.
2855 \toks0 = {#2}% 2466 \toks0 = {#2}%
2856 %
2857 % If third (subentry) arg is present, add it to the index
2858 % string. And include a space.
2859 \ifx\thirdarg\emptymacro \else
2860 \toks0 = \expandafter{\the\toks0 \space #3}%
2861 \fi
2862 %
2863 % Set up the complete index entry, with both the sort key
2864 % and the original text, including any font commands. We write
2865 % three arguments to \entry to the .?? file, texindex reduces to
2866 % two when writing the .??s sorted result.
2867 \edef\temp{% 2467 \edef\temp{%
2868 \write\csname#1indfile\endcsname{% 2468 \write\csname#1indfile\endcsname{%
2869 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% 2469 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
2870 }% 2470 }%
2871 % 2471 \temp
2872 % If a skip is the last thing on the list now, preserve it
2873 % by backing up by \lastskip, doing the \write, then inserting
2874 % the skip again. Otherwise, the whatsit generated by the
2875 % \write will make \lastskip zero. The result is that sequences
2876 % like this:
2877 % @end defun
2878 % @tindex whatever
2879 % @defun ...
2880 % will have extra space inserted, because the \medbreak in the
2881 % start of the @defun won't see the skip inserted by the @end of
2882 % the previous defun.
2883 %
2884 % But don't do any of this if we're not in vertical mode. We
2885 % don't want to do a \vskip and prematurely end a paragraph.
2886 %
2887 % Avoid page breaks due to these extra skips, too.
2888 %
2889 \iflinks
2890 \ifvmode
2891 \skip0 = \lastskip
2892 \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi
2893 \fi
2894 %
2895 \temp % do the write
2896 %
2897 %
2898 \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
2899 \fi
2900 }% 2472 }%
2901 }% 2473 }%
2902 \penalty\count255 2474 \penalty\count255
2903 }% 2475 }%
2904 } 2476 }
2477
2478 \def\dosubind #1#2#3{%
2479 {\count10=\lastpenalty %
2480 {\indexdummies % Must do this here, since \bf, etc expand at this stage
2481 \escapechar=`\\%
2482 {\let\folio=0%
2483 \def\rawbackslashxx{\indexbackslash}%
2484 %
2485 % Now process the index-string once, with all font commands turned off,
2486 % to get the string to sort the index by.
2487 {\indexnofonts
2488 \xdef\temp1{#2 #3}%
2489 }%
2490 % Now produce the complete index entry. We process the index-string again,
2491 % this time with font commands expanded, to get what to print in the index.
2492 \edef\temp{%
2493 \write \csname#1indfile\endcsname{%
2494 \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
2495 \temp }%
2496 }\penalty\count10}}
2905 2497
2906 % The index entry written in the file actually looks like 2498 % The index entry written in the file actually looks like
2907 % \entry {sortstring}{page}{topic} 2499 % \entry {sortstring}{page}{topic}
2908 % or 2500 % or
2909 % \entry {sortstring}{page}{topic}{subtopic} 2501 % \entry {sortstring}{page}{topic}{subtopic}
2940 % 2532 %
2941 \def\printindex{\parsearg\doprintindex} 2533 \def\printindex{\parsearg\doprintindex}
2942 \def\doprintindex#1{\begingroup 2534 \def\doprintindex#1{\begingroup
2943 \dobreak \chapheadingskip{10000}% 2535 \dobreak \chapheadingskip{10000}%
2944 % 2536 %
2945 \smallfonts \rm 2537 \indexfonts \rm
2946 \tolerance = 9500 2538 \tolerance = 9500
2947 \indexbreaks 2539 \indexbreaks
2948 % 2540 %
2949 % See if the index file exists and is nonempty. 2541 % See if the index file exists and is nonempty.
2950 % Change catcode of @ here so that if the index file contains 2542 % Change catcode of @ here so that if the index file contains
2956 \ifeof 1 2548 \ifeof 1
2957 % \enddoublecolumns gets confused if there is no text in the index, 2549 % \enddoublecolumns gets confused if there is no text in the index,
2958 % and it loses the chapter title and the aux file entries for the 2550 % and it loses the chapter title and the aux file entries for the
2959 % index. The easiest way to prevent this problem is to make sure 2551 % index. The easiest way to prevent this problem is to make sure
2960 % there is some text. 2552 % there is some text.
2961 \putwordIndexNonexistent 2553 (Index is nonexistent)
2962 \else 2554 \else
2963 % 2555 %
2964 % If the index file exists but is empty, then \openin leaves \ifeof 2556 % If the index file exists but is empty, then \openin leaves \ifeof
2965 % false. We have to make TeX try to read something from the file, so 2557 % false. We have to make TeX try to read something from the file, so
2966 % it can discover if there is anything in it. 2558 % it can discover if there is anything in it.
2967 \read 1 to \temp 2559 \read 1 to \temp
2968 \ifeof 1 2560 \ifeof 1
2969 \putwordIndexIsEmpty 2561 (Index is empty)
2970 \else 2562 \else
2971 % Index files are almost Texinfo source, but we use \ as the escape 2563 % Index files are almost Texinfo source, but we use \ as the escape
2972 % character. It would be better to use @, but that's too big a change 2564 % character. It would be better to use @, but that's too big a change
2973 % to make right now. 2565 % to make right now.
2974 \def\indexbackslash{\rawbackslashxx}% 2566 \def\indexbackslash{\rawbackslashxx}%
2983 \endgroup} 2575 \endgroup}
2984 2576
2985 % These macros are used by the sorted index file itself. 2577 % These macros are used by the sorted index file itself.
2986 % Change them to control the appearance of the index. 2578 % Change them to control the appearance of the index.
2987 2579
2988 \def\initial#1{{% 2580 % Same as \bigskipamount except no shrink.
2989 % Some minor font changes for the special characters. 2581 % \balancecolumns gets confused if there is any shrink.
2990 \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt 2582 \newskip\initialskipamount \initialskipamount 12pt plus4pt
2991 % 2583
2992 % Remove any glue we may have, we'll be inserting our own. 2584 \def\initial #1{%
2993 \removelastskip 2585 {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
2994 % 2586 \ifdim\lastskip<\initialskipamount
2995 % We like breaks before the index initials, so insert a bonus. 2587 \removelastskip \penalty-200 \vskip \initialskipamount\fi
2996 \penalty -300 2588 \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
2997 %
2998 % Typeset the initial. Making this add up to a whole number of
2999 % baselineskips increases the chance of the dots lining up from column
3000 % to column. It still won't often be perfect, because of the stretch
3001 % we need before each entry, but it's better.
3002 %
3003 % No shrink because it confuses \balancecolumns.
3004 \vskip 1.67\baselineskip plus .5\baselineskip
3005 \leftline{\secbf #1}%
3006 \vskip .33\baselineskip plus .1\baselineskip
3007 %
3008 % Do our best not to break after the initial.
3009 \nobreak
3010 }}
3011 2589
3012 % This typesets a paragraph consisting of #1, dot leaders, and then #2 2590 % This typesets a paragraph consisting of #1, dot leaders, and then #2
3013 % flush to the right margin. It is used for index and table of contents 2591 % flush to the right margin. It is used for index and table of contents
3014 % entries. The paragraph is indented by \leftskip. 2592 % entries. The paragraph is indented by \leftskip.
3015 % 2593 %
3016 \def\entry#1#2{\begingroup 2594 \def\entry #1#2{\begingroup
3017 % 2595 %
3018 % Start a new paragraph if necessary, so our assignments below can't 2596 % Start a new paragraph if necessary, so our assignments below can't
3019 % affect previous text. 2597 % affect previous text.
3020 \par 2598 \par
3021 % 2599 %
3034 % indentation looks wrong when the entry text itself is broken across 2612 % indentation looks wrong when the entry text itself is broken across
3035 % lines. So we use a small indentation and put up with long leaders. 2613 % lines. So we use a small indentation and put up with long leaders.
3036 % 2614 %
3037 % \hangafter is reset to 1 (which is the value we want) at the start 2615 % \hangafter is reset to 1 (which is the value we want) at the start
3038 % of each paragraph, so we need not do anything with that. 2616 % of each paragraph, so we need not do anything with that.
3039 \hangindent = 2em 2617 \hangindent=2em
3040 % 2618 %
3041 % When the entry text needs to be broken, just fill out the first line 2619 % When the entry text needs to be broken, just fill out the first line
3042 % with blank space. 2620 % with blank space.
3043 \rightskip = 0pt plus1fil 2621 \rightskip = 0pt plus1fil
3044 %
3045 % A bit of stretch before each entry for the benefit of balancing columns.
3046 \vskip 0pt plus1pt
3047 % 2622 %
3048 % Start a ``paragraph'' for the index entry so the line breaking 2623 % Start a ``paragraph'' for the index entry so the line breaking
3049 % parameters we've set above will have an effect. 2624 % parameters we've set above will have an effect.
3050 \noindent 2625 \noindent
3051 % 2626 %
3067 \null\nobreak\indexdotfill % Have leaders before the page number. 2642 \null\nobreak\indexdotfill % Have leaders before the page number.
3068 % 2643 %
3069 % The `\ ' here is removed by the implicit \unskip that TeX does as 2644 % The `\ ' here is removed by the implicit \unskip that TeX does as
3070 % part of (the primitive) \par. Without it, a spurious underfull 2645 % part of (the primitive) \par. Without it, a spurious underfull
3071 % \hbox ensues. 2646 % \hbox ensues.
3072 \ifpdf 2647 \ #2% The page number ends the paragraph.
3073 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
3074 \else
3075 \ #2% The page number ends the paragraph.
3076 \fi
3077 \fi% 2648 \fi%
3078 \par 2649 \par
3079 \endgroup} 2650 \endgroup}
3080 2651
3081 % Like \dotfill except takes at least 1 em. 2652 % Like \dotfill except takes at least 1 em.
3100 \newbox\partialpage 2671 \newbox\partialpage
3101 \newdimen\doublecolumnhsize 2672 \newdimen\doublecolumnhsize
3102 2673
3103 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns 2674 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
3104 % Grab any single-column material above us. 2675 % Grab any single-column material above us.
3105 \output = {% 2676 \output = {\global\setbox\partialpage = \vbox{%
3106 % 2677 %
3107 % Here is a possibility not foreseen in manmac: if we accumulate a 2678 % Here is a possibility not foreseen in manmac: if we accumulate a
3108 % whole lot of material, we might end up calling this \output 2679 % whole lot of material, we might end up calling this \output
3109 % routine twice in a row (see the doublecol-lose test, which is 2680 % routine twice in a row (see the doublecol-lose test, which is
3110 % essentially a couple of indexes with @setchapternewpage off). In 2681 % essentially a couple of indexes with @setchapternewpage off). In
3111 % that case we just ship out what is in \partialpage with the normal 2682 % that case, we must prevent the second \partialpage from
3112 % output routine. Generally, \partialpage will be empty when this 2683 % simply overwriting the first, causing us to lose the page.
3113 % runs and this will be a no-op. See the indexspread.tex test case. 2684 % This will preserve it until a real output routine can ship it
3114 \ifvoid\partialpage \else 2685 % out. Generally, \partialpage will be empty when this runs and
3115 \onepageout{\pagecontents\partialpage}% 2686 % this will be a no-op.
3116 \fi 2687 \unvbox\partialpage
3117 % 2688 %
3118 \global\setbox\partialpage = \vbox{% 2689 % Unvbox the main output page.
3119 % Unvbox the main output page. 2690 \unvbox255
3120 \unvbox\PAGE 2691 \kern-\topskip \kern\baselineskip
3121 \kern-\topskip \kern\baselineskip 2692 }}%
3122 }% 2693 \eject
3123 }%
3124 \eject % run that output routine to set \partialpage
3125 % 2694 %
3126 % Use the double-column output routine for subsequent pages. 2695 % Use the double-column output routine for subsequent pages.
3127 \output = {\doublecolumnout}% 2696 \output = {\doublecolumnout}%
3128 % 2697 %
3129 % Change the page size parameters. We could do this once outside this 2698 % Change the page size parameters. We could do this once outside this
3147 \divide\doublecolumnhsize by 2 2716 \divide\doublecolumnhsize by 2
3148 \hsize = \doublecolumnhsize 2717 \hsize = \doublecolumnhsize
3149 % 2718 %
3150 % Double the \vsize as well. (We don't need a separate register here, 2719 % Double the \vsize as well. (We don't need a separate register here,
3151 % since nobody clobbers \vsize.) 2720 % since nobody clobbers \vsize.)
3152 \advance\vsize by -\ht\partialpage
3153 \vsize = 2\vsize 2721 \vsize = 2\vsize
3154 } 2722 }
3155
3156 % The double-column output routine for all double-column pages except
3157 % the last.
3158 %
3159 \def\doublecolumnout{% 2723 \def\doublecolumnout{%
3160 \splittopskip=\topskip \splitmaxdepth=\maxdepth 2724 \splittopskip=\topskip \splitmaxdepth=\maxdepth
3161 % Get the available space for the double columns -- the normal 2725 % Get the available space for the double columns -- the normal
3162 % (undoubled) page height minus any material left over from the 2726 % (undoubled) page height minus any material left over from the
3163 % previous page. 2727 % previous page.
3164 \dimen@ = \vsize 2728 \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
3165 \divide\dimen@ by 2
3166 %
3167 % box0 will be the left-hand column, box2 the right. 2729 % box0 will be the left-hand column, box2 the right.
3168 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ 2730 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
3169 \onepageout\pagesofar 2731 \onepageout\pagesofar
3170 \unvbox255 2732 \unvbox255
3171 \penalty\outputpenalty 2733 \penalty\outputpenalty
3172 } 2734 }
3173 \def\pagesofar{% 2735 \def\pagesofar{%
3174 % Re-output the contents of the output page -- any previous material, 2736 % Re-output the contents of the output page -- any previous material,
3175 % followed by the two boxes we just split, in box0 and box2. 2737 % followed by the two boxes we just split.
3176 \unvbox\partialpage 2738 \unvbox\partialpage
3177 %
3178 \hsize = \doublecolumnhsize 2739 \hsize = \doublecolumnhsize
3179 \wd0=\hsize \wd2=\hsize 2740 \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}%
3180 \hbox to\pagewidth{\box0\hfil\box2}%
3181 } 2741 }
3182 \def\enddoublecolumns{% 2742 \def\enddoublecolumns{%
3183 \output = {% 2743 \output = {\balancecolumns}\eject % split what we have
3184 % Split the last of the double-column material. Leave it on the
3185 % current page, no automatic page break.
3186 \balancecolumns
3187 %
3188 % If we end up splitting too much material for the current page,
3189 % though, there will be another page break right after this \output
3190 % invocation ends. Having called \balancecolumns once, we do not
3191 % want to call it again. Therefore, reset \output to its normal
3192 % definition right away. (We hope \balancecolumns will never be
3193 % called on to balance too much material, but if it is, this makes
3194 % the output somewhat more palatable.)
3195 \global\output = {\onepageout{\pagecontents\PAGE}}%
3196 }%
3197 \eject
3198 \endgroup % started in \begindoublecolumns 2744 \endgroup % started in \begindoublecolumns
3199 % 2745 %
3200 % \pagegoal was set to the doubled \vsize above, since we restarted 2746 % Back to normal single-column typesetting, but take account of the
3201 % the current page. We're now back to normal single-column 2747 % fact that we just accumulated some stuff on the output page.
3202 % typesetting, so reset \pagegoal to the normal \vsize (after the
3203 % \endgroup where \vsize got restored).
3204 \pagegoal = \vsize 2748 \pagegoal = \vsize
3205 } 2749 }
3206 \def\balancecolumns{% 2750 \def\balancecolumns{%
3207 % Called at the end of the double column material. 2751 % Called at the end of the double column material.
3208 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. 2752 \setbox0 = \vbox{\unvbox255}%
3209 \dimen@ = \ht0 2753 \dimen@ = \ht0
3210 \advance\dimen@ by \topskip 2754 \advance\dimen@ by \topskip
3211 \advance\dimen@ by-\baselineskip 2755 \advance\dimen@ by-\baselineskip
3212 \divide\dimen@ by 2 % target to split to 2756 \divide\dimen@ by 2
3213 %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
3214 \splittopskip = \topskip 2757 \splittopskip = \topskip
3215 % Loop until we get a decent breakpoint. 2758 % Loop until we get a decent breakpoint.
3216 {% 2759 {\vbadness=10000 \loop
3217 \vbadness = 10000 2760 \global\setbox3=\copy0
3218 \loop 2761 \global\setbox1=\vsplit3 to\dimen@
3219 \global\setbox3 = \copy0 2762 \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt
3220 \global\setbox1 = \vsplit3 to \dimen@ 2763 \repeat}%
3221 \ifdim\ht3>\dimen@
3222 \global\advance\dimen@ by 1pt
3223 \repeat
3224 }%
3225 %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
3226 \setbox0=\vbox to\dimen@{\unvbox1}% 2764 \setbox0=\vbox to\dimen@{\unvbox1}%
3227 \setbox2=\vbox to\dimen@{\unvbox3}% 2765 \setbox2=\vbox to\dimen@{\unvbox3}%
3228 %
3229 \pagesofar 2766 \pagesofar
3230 } 2767 }
3231 \catcode`\@ = \other 2768 \catcode`\@ = \other
3232 2769
3233 2770
3234 \message{sectioning,} 2771 \message{sectioning,}
3235 % Chapters, sections, etc. 2772 % Define chapters, sections, etc.
3236 2773
3237 \newcount\chapno 2774 \newcount\chapno
3238 \newcount\secno \secno=0 2775 \newcount\secno \secno=0
3239 \newcount\subsecno \subsecno=0 2776 \newcount\subsecno \subsecno=0
3240 \newcount\subsubsecno \subsubsecno=0 2777 \newcount\subsubsecno \subsubsecno=0
3241 2778
3242 % This counter is funny since it counts through charcodes of letters A, B, ... 2779 % This counter is funny since it counts through charcodes of letters A, B, ...
3243 \newcount\appendixno \appendixno = `\@ 2780 \newcount\appendixno \appendixno = `\@
3244 % \def\appendixletter{\char\the\appendixno} 2781 \def\appendixletter{\char\the\appendixno}
3245 % We do the following for the sake of pdftex, which needs the actual 2782
3246 % letter in the expansion, not just typeset. 2783 \newwrite\contentsfile
3247 \def\appendixletter{% 2784 % This is called from \setfilename.
3248 \ifnum\appendixno=`A A% 2785 \def\opencontents{\openout\contentsfile = \jobname.toc }
3249 \else\ifnum\appendixno=`B B%
3250 \else\ifnum\appendixno=`C C%
3251 \else\ifnum\appendixno=`D D%
3252 \else\ifnum\appendixno=`E E%
3253 \else\ifnum\appendixno=`F F%
3254 \else\ifnum\appendixno=`G G%
3255 \else\ifnum\appendixno=`H H%
3256 \else\ifnum\appendixno=`I I%
3257 \else\ifnum\appendixno=`J J%
3258 \else\ifnum\appendixno=`K K%
3259 \else\ifnum\appendixno=`L L%
3260 \else\ifnum\appendixno=`M M%
3261 \else\ifnum\appendixno=`N N%
3262 \else\ifnum\appendixno=`O O%
3263 \else\ifnum\appendixno=`P P%
3264 \else\ifnum\appendixno=`Q Q%
3265 \else\ifnum\appendixno=`R R%
3266 \else\ifnum\appendixno=`S S%
3267 \else\ifnum\appendixno=`T T%
3268 \else\ifnum\appendixno=`U U%
3269 \else\ifnum\appendixno=`V V%
3270 \else\ifnum\appendixno=`W W%
3271 \else\ifnum\appendixno=`X X%
3272 \else\ifnum\appendixno=`Y Y%
3273 \else\ifnum\appendixno=`Z Z%
3274 % The \the is necessary, despite appearances, because \appendixletter is
3275 % expanded while writing the .toc file. \char\appendixno is not
3276 % expandable, thus it is written literally, thus all appendixes come out
3277 % with the same letter (or @) in the toc without it.
3278 \else\char\the\appendixno
3279 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
3280 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
3281 2786
3282 % Each @chapter defines this as the name of the chapter. 2787 % Each @chapter defines this as the name of the chapter.
3283 % page headings and footings can use it. @section does likewise. 2788 % page headings and footings can use it. @section does likewise
3284 \def\thischapter{} 2789
3285 \def\thissection{} 2790 \def\thischapter{} \def\thissection{}
2791 \def\seccheck#1{\ifnum \pageno<0
2792 \errmessage{@#1 not allowed after generating table of contents}%
2793 \fi}
2794
2795 \def\chapternofonts{%
2796 \let\rawbackslash=\relax
2797 \let\frenchspacing=\relax
2798 \def\result{\realbackslash result}%
2799 \def\equiv{\realbackslash equiv}%
2800 \def\expansion{\realbackslash expansion}%
2801 \def\print{\realbackslash print}%
2802 \def\TeX{\realbackslash TeX}%
2803 \def\dots{\realbackslash dots}%
2804 \def\result{\realbackslash result}%
2805 \def\equiv{\realbackslash equiv}%
2806 \def\expansion{\realbackslash expansion}%
2807 \def\print{\realbackslash print}%
2808 \def\error{\realbackslash error}%
2809 \def\point{\realbackslash point}%
2810 \def\copyright{\realbackslash copyright}%
2811 \def\tt{\realbackslash tt}%
2812 \def\bf{\realbackslash bf}%
2813 \def\w{\realbackslash w}%
2814 \def\less{\realbackslash less}%
2815 \def\gtr{\realbackslash gtr}%
2816 \def\hat{\realbackslash hat}%
2817 \def\char{\realbackslash char}%
2818 \def\tclose##1{\realbackslash tclose{##1}}%
2819 \def\code##1{\realbackslash code{##1}}%
2820 \def\samp##1{\realbackslash samp{##1}}%
2821 \def\r##1{\realbackslash r{##1}}%
2822 \def\b##1{\realbackslash b{##1}}%
2823 \def\key##1{\realbackslash key{##1}}%
2824 \def\file##1{\realbackslash file{##1}}%
2825 \def\kbd##1{\realbackslash kbd{##1}}%
2826 % These are redefined because @smartitalic wouldn't work inside xdef.
2827 \def\i##1{\realbackslash i{##1}}%
2828 \def\cite##1{\realbackslash cite{##1}}%
2829 \def\var##1{\realbackslash var{##1}}%
2830 \def\emph##1{\realbackslash emph{##1}}%
2831 \def\dfn##1{\realbackslash dfn{##1}}%
2832 }
3286 2833
3287 \newcount\absseclevel % used to calculate proper heading level 2834 \newcount\absseclevel % used to calculate proper heading level
3288 \newcount\secbase\secbase=0 % @raise/lowersections modify this count 2835 \newcount\secbase\secbase=0 % @raise/lowersections modify this count
3289 2836
3290 % @raisesections: treat @section as chapter, @subsection as section, etc. 2837 % @raisesections: treat @section as chapter, @subsection as section, etc.
3352 \unnumberedsubsubseczzz{#2} 2899 \unnumberedsubsubseczzz{#2}
3353 \fi 2900 \fi
3354 \fi 2901 \fi
3355 } 2902 }
3356 2903
3357 % @chapter, @appendix, @unnumbered. 2904
3358 \def\thischaptername{No Chapter Title} 2905 \def\thischaptername{No Chapter Title}
3359 \outer\def\chapter{\parsearg\chapteryyy} 2906 \outer\def\chapter{\parsearg\chapteryyy}
3360 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz 2907 \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
3361 \def\chapterzzz #1{% 2908 \def\chapterzzz #1{\seccheck{chapter}%
3362 \secno=0 \subsecno=0 \subsubsecno=0 2909 \secno=0 \subsecno=0 \subsubsecno=0
3363 \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% 2910 \global\advance \chapno by 1 \message{\putwordChapter \the\chapno}%
3364 \chapmacro {#1}{\the\chapno}% 2911 \chapmacro {#1}{\the\chapno}%
3365 \gdef\thissection{#1}% 2912 \gdef\thissection{#1}%
3366 \gdef\thischaptername{#1}% 2913 \gdef\thischaptername{#1}%
3367 % We don't substitute the actual chapter name into \thischapter 2914 % We don't substitute the actual chapter name into \thischapter
3368 % because we don't want its macros evaluated now. 2915 % because we don't want its macros evaluated now.
3369 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% 2916 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
2917 {\chapternofonts%
3370 \toks0 = {#1}% 2918 \toks0 = {#1}%
3371 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% 2919 \edef\temp{{\realbackslash chapentry{\the\toks0}{\the\chapno}{\noexpand\folio}}}%
3372 {\the\chapno}}}% 2920 \escapechar=`\\%
3373 \temp 2921 \write \contentsfile \temp %
3374 \donoderef 2922 \donoderef %
3375 \global\let\section = \numberedsec 2923 \global\let\section = \numberedsec
3376 \global\let\subsection = \numberedsubsec 2924 \global\let\subsection = \numberedsubsec
3377 \global\let\subsubsection = \numberedsubsubsec 2925 \global\let\subsubsection = \numberedsubsubsec
3378 } 2926 }}
3379 2927
3380 \outer\def\appendix{\parsearg\appendixyyy} 2928 \outer\def\appendix{\parsearg\appendixyyy}
3381 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz 2929 \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
3382 \def\appendixzzz #1{% 2930 \def\appendixzzz #1{\seccheck{appendix}%
3383 \secno=0 \subsecno=0 \subsubsecno=0 2931 \secno=0 \subsecno=0 \subsubsecno=0
3384 \global\advance \appendixno by 1 2932 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
3385 \message{\putwordAppendix\space \appendixletter}%
3386 \chapmacro {#1}{\putwordAppendix{} \appendixletter}% 2933 \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
3387 \gdef\thissection{#1}% 2934 \gdef\thissection{#1}%
3388 \gdef\thischaptername{#1}% 2935 \gdef\thischaptername{#1}%
3389 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% 2936 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
2937 {\chapternofonts%
3390 \toks0 = {#1}% 2938 \toks0 = {#1}%
3391 \edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% 2939 \edef\temp{{\realbackslash chapentry{\the\toks0}%
3392 {\putwordAppendix{} \appendixletter}}}% 2940 {\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
3393 \temp 2941 \escapechar=`\\%
3394 \appendixnoderef 2942 \write \contentsfile \temp %
2943 \appendixnoderef %
3395 \global\let\section = \appendixsec 2944 \global\let\section = \appendixsec
3396 \global\let\subsection = \appendixsubsec 2945 \global\let\subsection = \appendixsubsec
3397 \global\let\subsubsection = \appendixsubsubsec 2946 \global\let\subsubsection = \appendixsubsubsec
3398 } 2947 }}
3399 2948
3400 % @centerchap is like @unnumbered, but the heading is centered. 2949 % @centerchap is like @unnumbered, but the heading is centered.
3401 \outer\def\centerchap{\parsearg\centerchapyyy} 2950 \outer\def\centerchap{\parsearg\centerchapyyy}
3402 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} 2951 \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
3403 2952
3404 % @top is like @unnumbered.
3405 \outer\def\top{\parsearg\unnumberedyyy} 2953 \outer\def\top{\parsearg\unnumberedyyy}
3406
3407 \outer\def\unnumbered{\parsearg\unnumberedyyy} 2954 \outer\def\unnumbered{\parsearg\unnumberedyyy}
3408 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz 2955 \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
3409 \def\unnumberedzzz #1{% 2956 \def\unnumberedzzz #1{\seccheck{unnumbered}%
3410 \secno=0 \subsecno=0 \subsubsecno=0 2957 \secno=0 \subsecno=0 \subsubsecno=0
3411 % 2958 %
3412 % This used to be simply \message{#1}, but TeX fully expands the 2959 % This used to be simply \message{#1}, but TeX fully expands the
3413 % argument to \message. Therefore, if #1 contained @-commands, TeX 2960 % argument to \message. Therefore, if #1 contained @-commands, TeX
3414 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX 2961 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
3416 % to be executed, not expanded). 2963 % to be executed, not expanded).
3417 % 2964 %
3418 % Anyway, we don't want the fully-expanded definition of @cite to appear 2965 % Anyway, we don't want the fully-expanded definition of @cite to appear
3419 % as a result of the \message, we just want `@cite' itself. We use 2966 % as a result of the \message, we just want `@cite' itself. We use
3420 % \the<toks register> to achieve this: TeX expands \the<toks> only once, 2967 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
3421 % simply yielding the contents of <toks register>. (We also do this for 2968 % simply yielding the contents of the <toks register>.
3422 % the toc entries.)
3423 \toks0 = {#1}\message{(\the\toks0)}% 2969 \toks0 = {#1}\message{(\the\toks0)}%
3424 % 2970 %
3425 \unnumbchapmacro {#1}% 2971 \unnumbchapmacro {#1}%
3426 \gdef\thischapter{#1}\gdef\thissection{#1}% 2972 \gdef\thischapter{#1}\gdef\thissection{#1}%
2973 {\chapternofonts%
3427 \toks0 = {#1}% 2974 \toks0 = {#1}%
3428 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}% 2975 \edef\temp{{\realbackslash unnumbchapentry{\the\toks0}{\noexpand\folio}}}%
3429 \temp 2976 \escapechar=`\\%
3430 \unnumbnoderef 2977 \write \contentsfile \temp %
2978 \unnumbnoderef %
3431 \global\let\section = \unnumberedsec 2979 \global\let\section = \unnumberedsec
3432 \global\let\subsection = \unnumberedsubsec 2980 \global\let\subsection = \unnumberedsubsec
3433 \global\let\subsubsection = \unnumberedsubsubsec 2981 \global\let\subsubsection = \unnumberedsubsubsec
3434 } 2982 }}
3435 2983
3436 % Sections.
3437 \outer\def\numberedsec{\parsearg\secyyy} 2984 \outer\def\numberedsec{\parsearg\secyyy}
3438 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz 2985 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
3439 \def\seczzz #1{% 2986 \def\seczzz #1{\seccheck{section}%
3440 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % 2987 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3441 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% 2988 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
2989 {\chapternofonts%
3442 \toks0 = {#1}% 2990 \toks0 = {#1}%
3443 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% 2991 \edef\temp{{\realbackslash secentry %
3444 {\the\chapno}{\the\secno}}}% 2992 {\the\toks0}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
3445 \temp 2993 \escapechar=`\\%
3446 \donoderef 2994 \write \contentsfile \temp %
3447 \nobreak 2995 \donoderef %
3448 } 2996 \penalty 10000 %
2997 }}
3449 2998
3450 \outer\def\appendixsection{\parsearg\appendixsecyyy} 2999 \outer\def\appendixsection{\parsearg\appendixsecyyy}
3451 \outer\def\appendixsec{\parsearg\appendixsecyyy} 3000 \outer\def\appendixsec{\parsearg\appendixsecyyy}
3452 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz 3001 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
3453 \def\appendixsectionzzz #1{% 3002 \def\appendixsectionzzz #1{\seccheck{appendixsection}%
3454 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % 3003 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
3455 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% 3004 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
3005 {\chapternofonts%
3456 \toks0 = {#1}% 3006 \toks0 = {#1}%
3457 \edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% 3007 \edef\temp{{\realbackslash secentry %
3458 {\appendixletter}{\the\secno}}}% 3008 {\the\toks0}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
3459 \temp 3009 \escapechar=`\\%
3460 \appendixnoderef 3010 \write \contentsfile \temp %
3461 \nobreak 3011 \appendixnoderef %
3462 } 3012 \penalty 10000 %
3013 }}
3463 3014
3464 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} 3015 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
3465 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz 3016 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
3466 \def\unnumberedseczzz #1{% 3017 \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
3467 \plainsecheading {#1}\gdef\thissection{#1}% 3018 \plainsecheading {#1}\gdef\thissection{#1}%
3019 {\chapternofonts%
3468 \toks0 = {#1}% 3020 \toks0 = {#1}%
3469 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}% 3021 \edef\temp{{\realbackslash unnumbsecentry{\the\toks0}{\noexpand\folio}}}%
3470 \temp 3022 \escapechar=`\\%
3471 \unnumbnoderef 3023 \write \contentsfile \temp %
3472 \nobreak 3024 \unnumbnoderef %
3473 } 3025 \penalty 10000 %
3474 3026 }}
3475 % Subsections. 3027
3476 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} 3028 \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
3477 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz 3029 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
3478 \def\numberedsubseczzz #1{% 3030 \def\numberedsubseczzz #1{\seccheck{subsection}%
3479 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % 3031 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3480 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% 3032 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
3033 {\chapternofonts%
3481 \toks0 = {#1}% 3034 \toks0 = {#1}%
3482 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% 3035 \edef\temp{{\realbackslash subsecentry %
3483 {\the\chapno}{\the\secno}{\the\subsecno}}}% 3036 {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
3484 \temp 3037 \escapechar=`\\%
3485 \donoderef 3038 \write \contentsfile \temp %
3486 \nobreak 3039 \donoderef %
3487 } 3040 \penalty 10000 %
3041 }}
3488 3042
3489 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} 3043 \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
3490 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz 3044 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
3491 \def\appendixsubseczzz #1{% 3045 \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
3492 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % 3046 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
3493 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% 3047 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
3048 {\chapternofonts%
3494 \toks0 = {#1}% 3049 \toks0 = {#1}%
3495 \edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% 3050 \edef\temp{{\realbackslash subsecentry %
3496 {\appendixletter}{\the\secno}{\the\subsecno}}}% 3051 {\the\toks0}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
3497 \temp 3052 \escapechar=`\\%
3498 \appendixnoderef 3053 \write \contentsfile \temp %
3499 \nobreak 3054 \appendixnoderef %
3500 } 3055 \penalty 10000 %
3056 }}
3501 3057
3502 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} 3058 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
3503 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz 3059 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
3504 \def\unnumberedsubseczzz #1{% 3060 \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
3505 \plainsubsecheading {#1}\gdef\thissection{#1}% 3061 \plainsubsecheading {#1}\gdef\thissection{#1}%
3062 {\chapternofonts%
3506 \toks0 = {#1}% 3063 \toks0 = {#1}%
3507 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry% 3064 \edef\temp{{\realbackslash unnumbsubsecentry{\the\toks0}{\noexpand\folio}}}%
3508 {\the\toks0}}}% 3065 \escapechar=`\\%
3509 \temp 3066 \write \contentsfile \temp %
3510 \unnumbnoderef 3067 \unnumbnoderef %
3511 \nobreak 3068 \penalty 10000 %
3512 } 3069 }}
3513 3070
3514 % Subsubsections.
3515 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} 3071 \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
3516 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz 3072 \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
3517 \def\numberedsubsubseczzz #1{% 3073 \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
3518 \gdef\thissection{#1}\global\advance \subsubsecno by 1 % 3074 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3519 \subsubsecheading {#1} 3075 \subsubsecheading {#1}
3520 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% 3076 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3077 {\chapternofonts%
3521 \toks0 = {#1}% 3078 \toks0 = {#1}%
3522 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% 3079 \edef\temp{{\realbackslash subsubsecentry{\the\toks0}
3523 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% 3080 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
3524 \temp 3081 {\noexpand\folio}}}%
3525 \donoderef 3082 \escapechar=`\\%
3526 \nobreak 3083 \write \contentsfile \temp %
3527 } 3084 \donoderef %
3085 \penalty 10000 %
3086 }}
3528 3087
3529 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} 3088 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
3530 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz 3089 \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
3531 \def\appendixsubsubseczzz #1{% 3090 \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
3532 \gdef\thissection{#1}\global\advance \subsubsecno by 1 % 3091 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
3533 \subsubsecheading {#1} 3092 \subsubsecheading {#1}
3534 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% 3093 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
3094 {\chapternofonts%
3535 \toks0 = {#1}% 3095 \toks0 = {#1}%
3536 \edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% 3096 \edef\temp{{\realbackslash subsubsecentry{\the\toks0}%
3537 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% 3097 {\appendixletter}
3538 \temp 3098 {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
3539 \appendixnoderef 3099 \escapechar=`\\%
3540 \nobreak 3100 \write \contentsfile \temp %
3541 } 3101 \appendixnoderef %
3102 \penalty 10000 %
3103 }}
3542 3104
3543 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} 3105 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
3544 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz 3106 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
3545 \def\unnumberedsubsubseczzz #1{% 3107 \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
3546 \plainsubsubsecheading {#1}\gdef\thissection{#1}% 3108 \plainsubsubsecheading {#1}\gdef\thissection{#1}%
3109 {\chapternofonts%
3547 \toks0 = {#1}% 3110 \toks0 = {#1}%
3548 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry% 3111 \edef\temp{{\realbackslash unnumbsubsubsecentry{\the\toks0}{\noexpand\folio}}}%
3549 {\the\toks0}}}% 3112 \escapechar=`\\%
3550 \temp 3113 \write \contentsfile \temp %
3551 \unnumbnoderef 3114 \unnumbnoderef %
3552 \nobreak 3115 \penalty 10000 %
3553 } 3116 }}
3554 3117
3555 % These are variants which are not "outer", so they can appear in @ifinfo. 3118 % These are variants which are not "outer", so they can appear in @ifinfo.
3556 % Actually, they should now be obsolete; ordinary section commands should work. 3119 % Actually, they should now be obsolete; ordinary section commands should work.
3557 \def\infotop{\parsearg\unnumberedzzz} 3120 \def\infotop{\parsearg\unnumberedzzz}
3558 \def\infounnumbered{\parsearg\unnumberedzzz} 3121 \def\infounnumbered{\parsearg\unnumberedzzz}
3577 \global\let\subsection = \numberedsubsec 3140 \global\let\subsection = \numberedsubsec
3578 \global\let\subsubsection = \numberedsubsubsec 3141 \global\let\subsubsection = \numberedsubsubsec
3579 3142
3580 % Define @majorheading, @heading and @subheading 3143 % Define @majorheading, @heading and @subheading
3581 3144
3582 % NOTE on use of \vbox for chapter headings, section headings, and such: 3145 % NOTE on use of \vbox for chapter headings, section headings, and
3146 % such:
3583 % 1) We use \vbox rather than the earlier \line to permit 3147 % 1) We use \vbox rather than the earlier \line to permit
3584 % overlong headings to fold. 3148 % overlong headings to fold.
3585 % 2) \hyphenpenalty is set to 10000 because hyphenation in a 3149 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
3586 % heading is obnoxious; this forbids it. 3150 % heading is obnoxious; this forbids it.
3587 % 3) Likewise, headings look best if no \parindent is used, and 3151 % 3) Likewise, headings look best if no \parindent is used, and
3624 \def\chappager{\par\vfill\supereject} 3188 \def\chappager{\par\vfill\supereject}
3625 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} 3189 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
3626 3190
3627 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} 3191 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
3628 3192
3629 \def\CHAPPAGoff{% 3193 \def\CHAPPAGoff{
3630 \global\let\contentsalignmacro = \chappager 3194 \global\let\contentsalignmacro = \chappager
3631 \global\let\pchapsepmacro=\chapbreak 3195 \global\let\pchapsepmacro=\chapbreak
3632 \global\let\pagealignmacro=\chappager} 3196 \global\let\pagealignmacro=\chappager}
3633 3197
3634 \def\CHAPPAGon{% 3198 \def\CHAPPAGon{
3635 \global\let\contentsalignmacro = \chappager 3199 \global\let\contentsalignmacro = \chappager
3636 \global\let\pchapsepmacro=\chappager 3200 \global\let\pchapsepmacro=\chappager
3637 \global\let\pagealignmacro=\chappager 3201 \global\let\pagealignmacro=\chappager
3638 \global\def\HEADINGSon{\HEADINGSsingle}} 3202 \global\def\HEADINGSon{\HEADINGSsingle}}
3639 3203
3683 \CHAPFplain % The default 3247 \CHAPFplain % The default
3684 3248
3685 \def\unnchfopen #1{% 3249 \def\unnchfopen #1{%
3686 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 3250 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3687 \parindent=0pt\raggedright 3251 \parindent=0pt\raggedright
3688 \rm #1\hfill}}\bigskip \par\nobreak 3252 \rm #1\hfill}}\bigskip \par\penalty 10000 %
3689 } 3253 }
3690 3254
3691 \def\chfopen #1#2{\chapoddpage {\chapfonts 3255 \def\chfopen #1#2{\chapoddpage {\chapfonts
3692 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% 3256 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
3693 \par\penalty 5000 % 3257 \par\penalty 5000 %
3694 } 3258 }
3695 3259
3696 \def\centerchfopen #1{% 3260 \def\centerchfopen #1{%
3697 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 3261 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
3698 \parindent=0pt 3262 \parindent=0pt
3699 \hfill {\rm #1}\hfill}}\bigskip \par\nobreak 3263 \hfill {\rm #1}\hfill}}\bigskip \par\penalty 10000 %
3700 } 3264 }
3701 3265
3702 \def\CHAPFopen{ 3266 \def\CHAPFopen{
3703 \global\let\chapmacro=\chfopen 3267 \global\let\chapmacro=\chfopen
3704 \global\let\unnumbchapmacro=\unnchfopen 3268 \global\let\unnumbchapmacro=\unnchfopen
3747 }% 3311 }%
3748 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak 3312 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
3749 } 3313 }
3750 3314
3751 3315
3752 \message{toc,} 3316 \message{toc printing,}
3753 % Table of contents. 3317 % Finish up the main text and prepare to read what we've written
3754 \newwrite\tocfile 3318 % to \contentsfile.
3755
3756 % Write an entry to the toc file, opening it if necessary.
3757 % Called from @chapter, etc. We supply {\folio} at the end of the
3758 % argument, which will end up as the last argument to the \...entry macro.
3759 %
3760 % We open the .toc file here instead of at @setfilename or any other
3761 % given time so that @contents can be put in the document anywhere.
3762 %
3763 \newif\iftocfileopened
3764 \def\writetocentry#1{%
3765 \iftocfileopened\else
3766 \immediate\openout\tocfile = \jobname.toc
3767 \global\tocfileopenedtrue
3768 \fi
3769 \iflinks \write\tocfile{#1{\folio}}\fi
3770 }
3771 3319
3772 \newskip\contentsrightmargin \contentsrightmargin=1in 3320 \newskip\contentsrightmargin \contentsrightmargin=1in
3773 \newcount\savepageno
3774 \newcount\lastnegativepageno \lastnegativepageno = -1
3775
3776 % Finish up the main text and prepare to read what we've written
3777 % to \tocfile.
3778 %
3779 \def\startcontents#1{% 3321 \def\startcontents#1{%
3780 % If @setchapternewpage on, and @headings double, the contents should 3322 % If @setchapternewpage on, and @headings double, the contents should
3781 % start on an odd page, unlike chapters. Thus, we maintain 3323 % start on an odd page, unlike chapters. Thus, we maintain
3782 % \contentsalignmacro in parallel with \pagealignmacro. 3324 % \contentsalignmacro in parallel with \pagealignmacro.
3783 % From: Torbjorn Granlund <tege@matematik.su.se> 3325 % From: Torbjorn Granlund <tege@matematik.su.se>
3784 \contentsalignmacro 3326 \contentsalignmacro
3785 \immediate\closeout\tocfile 3327 \immediate\closeout \contentsfile
3786 % 3328 \ifnum \pageno>0
3329 \pageno = -1 % Request roman numbered pages.
3330 \fi
3787 % Don't need to put `Contents' or `Short Contents' in the headline. 3331 % Don't need to put `Contents' or `Short Contents' in the headline.
3788 % It is abundantly clear what they are. 3332 % It is abundantly clear what they are.
3789 \unnumbchapmacro{#1}\def\thischapter{}% 3333 \unnumbchapmacro{#1}\def\thischapter{}%
3790 \savepageno = \pageno
3791 \begingroup % Set up to handle contents files properly. 3334 \begingroup % Set up to handle contents files properly.
3792 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 3335 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
3793 % We can't do this, because then an actual ^ in a section 3336 % We can't do this, because then an actual ^ in a section
3794 % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. 3337 % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
3795 %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi 3338 %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
3796 \raggedbottom % Worry more about breakpoints than the bottom. 3339 \raggedbottom % Worry more about breakpoints than the bottom.
3797 \advance\hsize by -\contentsrightmargin % Don't use the full line length. 3340 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
3798 %
3799 % Roman numerals for page numbers.
3800 \ifnum \pageno>0 \pageno = \lastnegativepageno \fi
3801 } 3341 }
3802 3342
3803 3343
3804 % Normal (long) toc. 3344 % Normal (long) toc.
3805 \def\contents{% 3345 \outer\def\contents{%
3806 \startcontents{\putwordTOC}% 3346 \startcontents{\putwordTableofContents}%
3807 \openin 1 \jobname.toc 3347 \input \jobname.toc
3808 \ifeof 1 \else
3809 \closein 1
3810 \input \jobname.toc
3811 \fi
3812 \vfill \eject
3813 \contentsalignmacro % in case @setchapternewpage odd is in effect
3814 \pdfmakeoutlines
3815 \endgroup 3348 \endgroup
3816 \lastnegativepageno = \pageno 3349 \vfill \eject
3817 \pageno = \savepageno
3818 } 3350 }
3819 3351
3820 % And just the chapters. 3352 % And just the chapters.
3821 \def\summarycontents{% 3353 \outer\def\summarycontents{%
3822 \startcontents{\putwordShortTOC}% 3354 \startcontents{\putwordShortContents}%
3823 % 3355 %
3824 \let\chapentry = \shortchapentry 3356 \let\chapentry = \shortchapentry
3825 \let\unnumbchapentry = \shortunnumberedentry 3357 \let\unnumbchapentry = \shortunnumberedentry
3826 % We want a true roman here for the page numbers. 3358 % We want a true roman here for the page numbers.
3827 \secfonts 3359 \secfonts
3833 \def\unnumbsecentry ##1##2{} 3365 \def\unnumbsecentry ##1##2{}
3834 \def\subsecentry ##1##2##3##4##5{} 3366 \def\subsecentry ##1##2##3##4##5{}
3835 \def\unnumbsubsecentry ##1##2{} 3367 \def\unnumbsubsecentry ##1##2{}
3836 \def\subsubsecentry ##1##2##3##4##5##6{} 3368 \def\subsubsecentry ##1##2##3##4##5##6{}
3837 \def\unnumbsubsubsecentry ##1##2{} 3369 \def\unnumbsubsubsecentry ##1##2{}
3838 \openin 1 \jobname.toc 3370 \input \jobname.toc
3839 \ifeof 1 \else
3840 \closein 1
3841 \input \jobname.toc
3842 \fi
3843 \vfill \eject
3844 \contentsalignmacro % in case @setchapternewpage odd is in effect
3845 \endgroup 3371 \endgroup
3846 \lastnegativepageno = \pageno 3372 \vfill \eject
3847 \pageno = \savepageno
3848 } 3373 }
3849 \let\shortcontents = \summarycontents 3374 \let\shortcontents = \summarycontents
3850
3851 \ifpdf
3852 \pdfcatalog{/PageMode /UseOutlines}%
3853 \fi
3854 3375
3855 % These macros generate individual entries in the table of contents. 3376 % These macros generate individual entries in the table of contents.
3856 % The first argument is the chapter or section name. 3377 % The first argument is the chapter or section name.
3857 % The last argument is the page number. 3378 % The last argument is the page number.
3858 % The arguments in between are the chapter number, section number, ... 3379 % The arguments in between are the chapter number, section number, ...
3860 % Chapter-level things, for both the long and short contents. 3381 % Chapter-level things, for both the long and short contents.
3861 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} 3382 \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3862 3383
3863 % See comments in \dochapentry re vbox and related settings 3384 % See comments in \dochapentry re vbox and related settings
3864 \def\shortchapentry#1#2#3{% 3385 \def\shortchapentry#1#2#3{%
3865 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}% 3386 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
3866 } 3387 }
3867 3388
3868 % Typeset the label for a chapter or appendix for the short contents. 3389 % Typeset the label for a chapter or appendix for the short contents.
3869 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter. 3390 % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
3870 % We could simplify the code here by writing out an \appendixentry 3391 % We could simplify the code here by writing out an \appendixentry
3871 % command in the toc file for appendices, instead of using \chapentry 3392 % command in the toc file for appendices, instead of using \chapentry
3872 % for both, but it doesn't seem worth it. 3393 % for both, but it doesn't seem worth it.
3873 % 3394 \setbox0 = \hbox{\shortcontrm \putwordAppendix }
3874 \newdimen\shortappendixwidth 3395 \newdimen\shortappendixwidth \shortappendixwidth = \wd0
3875 % 3396
3876 \def\shortchaplabel#1{% 3397 \def\shortchaplabel#1{%
3877 % Compute width of word "Appendix", may change with language.
3878 \setbox0 = \hbox{\shortcontrm \putwordAppendix}%
3879 \shortappendixwidth = \wd0
3880 %
3881 % We typeset #1 in a box of constant width, regardless of the text of 3398 % We typeset #1 in a box of constant width, regardless of the text of
3882 % #1, so the chapter titles will come out aligned. 3399 % #1, so the chapter titles will come out aligned.
3883 \setbox0 = \hbox{#1}% 3400 \setbox0 = \hbox{#1}%
3884 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi 3401 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3885 % 3402 %
3890 \advance\dimen0 by 1.1em 3407 \advance\dimen0 by 1.1em
3891 \hbox to \dimen0{#1\hfil}% 3408 \hbox to \dimen0{#1\hfil}%
3892 } 3409 }
3893 3410
3894 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} 3411 \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3895 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}} 3412 \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
3896 3413
3897 % Sections. 3414 % Sections.
3898 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} 3415 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3899 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}} 3416 \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
3900 3417
3917 % if at all possible; hence the \penalty. 3434 % if at all possible; hence the \penalty.
3918 \def\dochapentry#1#2{% 3435 \def\dochapentry#1#2{%
3919 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip 3436 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
3920 \begingroup 3437 \begingroup
3921 \chapentryfonts 3438 \chapentryfonts
3922 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 3439 \tocentry{#1}{\dopageno{#2}}%
3923 \endgroup 3440 \endgroup
3924 \nobreak\vskip .25\baselineskip plus.1\baselineskip 3441 \nobreak\vskip .25\baselineskip plus.1\baselineskip
3925 } 3442 }
3926 3443
3927 \def\dosecentry#1#2{\begingroup 3444 \def\dosecentry#1#2{\begingroup
3928 \secentryfonts \leftskip=\tocindent 3445 \secentryfonts \leftskip=\tocindent
3929 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 3446 \tocentry{#1}{\dopageno{#2}}%
3930 \endgroup} 3447 \endgroup}
3931 3448
3932 \def\dosubsecentry#1#2{\begingroup 3449 \def\dosubsecentry#1#2{\begingroup
3933 \subsecentryfonts \leftskip=2\tocindent 3450 \subsecentryfonts \leftskip=2\tocindent
3934 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 3451 \tocentry{#1}{\dopageno{#2}}%
3935 \endgroup} 3452 \endgroup}
3936 3453
3937 \def\dosubsubsecentry#1#2{\begingroup 3454 \def\dosubsubsecentry#1#2{\begingroup
3938 \subsubsecentryfonts \leftskip=3\tocindent 3455 \subsubsecentryfonts \leftskip=3\tocindent
3939 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 3456 \tocentry{#1}{\dopageno{#2}}%
3940 \endgroup} 3457 \endgroup}
3941 3458
3942 % Final typesetting of a toc entry; we use the same \entry macro as for 3459 % Final typesetting of a toc entry; we use the same \entry macro as for
3943 % the index entries, but we want to suppress hyphenation here. (We 3460 % the index entries, but we want to suppress hyphenation here. (We
3944 % can't do that in the \entry macro, since index entries might consist 3461 % can't do that in the \entry macro, since index entries might consist
3962 \let\subsecentryfonts = \textfonts 3479 \let\subsecentryfonts = \textfonts
3963 \let\subsubsecentryfonts = \textfonts 3480 \let\subsubsecentryfonts = \textfonts
3964 3481
3965 3482
3966 \message{environments,} 3483 \message{environments,}
3967 % @foo ... @end foo.
3968 3484
3969 % Since these characters are used in examples, it should be an even number of 3485 % Since these characters are used in examples, it should be an even number of
3970 % \tt widths. Each \tt character is 1en, so two makes it 1em. 3486 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3971 % Furthermore, these definitions must come after we define our fonts. 3487 % Furthermore, these definitions must come after we define our fonts.
3972 \newbox\dblarrowbox \newbox\longdblarrowbox 3488 \newbox\dblarrowbox \newbox\longdblarrowbox
4035 \let\dots=\ptexdots 3551 \let\dots=\ptexdots
4036 \let\equiv=\ptexequiv 3552 \let\equiv=\ptexequiv
4037 \let\!=\ptexexclam 3553 \let\!=\ptexexclam
4038 \let\i=\ptexi 3554 \let\i=\ptexi
4039 \let\{=\ptexlbrace 3555 \let\{=\ptexlbrace
4040 \let\+=\tabalign
4041 \let\}=\ptexrbrace 3556 \let\}=\ptexrbrace
4042 \let\*=\ptexstar 3557 \let\*=\ptexstar
4043 \let\t=\ptext 3558 \let\t=\ptext
4044 % 3559 %
4045 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% 3560 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
4087 \let\afterenvbreak = \aboveenvbreak 3602 \let\afterenvbreak = \aboveenvbreak
4088 3603
4089 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. 3604 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
4090 \let\nonarrowing=\relax 3605 \let\nonarrowing=\relax
4091 3606
4092 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around 3607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4093 % environment contents. 3608 % \cartouche: draw rectangle w/rounded corners around argument
4094 \font\circle=lcircle10 3609 \font\circle=lcircle10
4095 \newdimen\circthick 3610 \newdimen\circthick
4096 \newdimen\cartouter\newdimen\cartinner 3611 \newdimen\cartouter\newdimen\cartinner
4097 \newskip\normbskip\newskip\normpskip\newskip\normlskip 3612 \newskip\normbskip\newskip\normpskip\newskip\normlskip
4098 \circthick=\fontdimen8\circle 3613 \circthick=\fontdimen8\circle
4115 \lskip=\leftskip \rskip=\rightskip 3630 \lskip=\leftskip \rskip=\rightskip
4116 \leftskip=0pt\rightskip=0pt %we want these *outside*. 3631 \leftskip=0pt\rightskip=0pt %we want these *outside*.
4117 \cartinner=\hsize \advance\cartinner by-\lskip 3632 \cartinner=\hsize \advance\cartinner by-\lskip
4118 \advance\cartinner by-\rskip 3633 \advance\cartinner by-\rskip
4119 \cartouter=\hsize 3634 \cartouter=\hsize
4120 \advance\cartouter by 18.4pt % allow for 3pt kerns on either 3635 \advance\cartouter by 18pt % allow for 3pt kerns on either
4121 % side, and for 6pt waste from 3636 % side, and for 6pt waste from
4122 % each corner char, and rule thickness 3637 % each corner char
4123 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip 3638 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
4124 % Flag to tell @lisp, etc., not to narrow margin. 3639 % Flag to tell @lisp, etc., not to narrow margin.
4125 \let\nonarrowing=\comment 3640 \let\nonarrowing=\comment
4126 \vbox\bgroup 3641 \vbox\bgroup
4127 \baselineskip=0pt\parskip=0pt\lineskip=0pt 3642 \baselineskip=0pt\parskip=0pt\lineskip=0pt
4171 \let\exdent=\nofillexdent 3686 \let\exdent=\nofillexdent
4172 \let\nonarrowing=\relax 3687 \let\nonarrowing=\relax
4173 \fi 3688 \fi
4174 } 3689 }
4175 3690
4176 % Define the \E... control sequence only if we are inside the particular 3691 % To ending an @example-like environment, we first end the paragraph
4177 % environment, so the error checking in \end will work. 3692 % (via \afterenvbreak's vertical glue), and then the group. That way we
4178 % 3693 % keep the zero \parskip that the environments set -- \parskip glue
4179 % To end an @example-like environment, we first end the paragraph (via 3694 % will be inserted at the beginning of the next paragraph in the
4180 % \afterenvbreak's vertical glue), and then the group. That way we keep 3695 % document, after the environment.
4181 % the zero \parskip that the environments set -- \parskip glue will be 3696 %
4182 % inserted at the beginning of the next paragraph in the document, after 3697 \def\nonfillfinish{\afterenvbreak\endgroup}%
4183 % the environment. 3698
4184 %
4185 \def\nonfillfinish{\afterenvbreak\endgroup}
4186
4187 % @lisp: indented, narrowed, typewriter font.
4188 \def\lisp{\begingroup 3699 \def\lisp{\begingroup
4189 \nonfillstart 3700 \nonfillstart
4190 \let\Elisp = \nonfillfinish 3701 \let\Elisp = \nonfillfinish
4191 \tt 3702 \tt
4192 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. 3703 % Make @kbd do something special, if requested.
4193 \gobble % eat return 3704 \let\kbdfont\kbdexamplefont
4194 } 3705 \rawbackslash % have \ input char produce \ char from current font
4195 3706 \gobble
4196 % @example: Same as @lisp. 3707 }
3708
3709 % Define the \E... control sequence only if we are inside the
3710 % environment, so the error checking in \end will work.
3711 %
3712 % We must call \lisp last in the definition, since it reads the
3713 % return following the @example (or whatever) command.
3714 %
4197 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} 3715 \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
4198 3716 \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
4199 % @small... is usually equivalent to the non-small (@smallbook 3717 \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
4200 % redefines). We must call \example (or whatever) last in the 3718
4201 % definition, since it reads the return following the @example (or 3719 % @smallexample and @smalllisp. This is not used unless the @smallbook
4202 % whatever) command. 3720 % command is given. Originally contributed by Pavel@xerox.
4203 % 3721 %
4204 % This actually allows (for example) @end display inside an
4205 % @smalldisplay. Too bad, but makeinfo will catch the error anyway.
4206 %
4207 \def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display}
4208 \def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp}
4209 \def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format}
4210 \def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
4211
4212 % Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
4213 % Originally contributed by Pavel@xerox.
4214 \def\smalllispx{\begingroup 3722 \def\smalllispx{\begingroup
4215 \def\Esmalllisp{\nonfillfinish\endgroup}% 3723 \nonfillstart
4216 \def\Esmallexample{\nonfillfinish\endgroup}% 3724 \let\Esmalllisp = \nonfillfinish
4217 \smallfonts 3725 \let\Esmallexample = \nonfillfinish
4218 \lisp 3726 %
4219 } 3727 % Smaller fonts for small examples.
4220 3728 \indexfonts \tt
4221 % @display: same as @lisp except keep current font. 3729 \rawbackslash % make \ output the \ character from the current font (tt)
3730 \gobble
3731 }
3732
3733 % This is @display; same as @lisp except use roman font.
4222 % 3734 %
4223 \def\display{\begingroup 3735 \def\display{\begingroup
4224 \nonfillstart 3736 \nonfillstart
4225 \let\Edisplay = \nonfillfinish 3737 \let\Edisplay = \nonfillfinish
4226 \gobble 3738 \gobble
4227 } 3739 }
4228 3740
4229 % @smalldisplay (when @smallbook): @display plus smaller fonts. 3741 % This is @format; same as @display except don't narrow margins.
4230 %
4231 \def\smalldisplayx{\begingroup
4232 \def\Esmalldisplay{\nonfillfinish\endgroup}%
4233 \smallfonts \rm
4234 \display
4235 }
4236
4237 % @format: same as @display except don't narrow margins.
4238 % 3742 %
4239 \def\format{\begingroup 3743 \def\format{\begingroup
4240 \let\nonarrowing = t 3744 \let\nonarrowing = t
4241 \nonfillstart 3745 \nonfillstart
4242 \let\Eformat = \nonfillfinish 3746 \let\Eformat = \nonfillfinish
4243 \gobble 3747 \gobble
4244 } 3748 }
4245 3749
4246 % @smallformat (when @smallbook): @format plus smaller fonts. 3750 % @flushleft (same as @format) and @flushright.
4247 % 3751 %
4248 \def\smallformatx{\begingroup 3752 \def\flushleft{\begingroup
4249 \def\Esmallformat{\nonfillfinish\endgroup}% 3753 \let\nonarrowing = t
4250 \smallfonts \rm 3754 \nonfillstart
4251 \format 3755 \let\Eflushleft = \nonfillfinish
4252 } 3756 \gobble
4253 3757 }
4254 % @flushleft (same as @format).
4255 %
4256 \def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
4257
4258 % @flushright.
4259 %
4260 \def\flushright{\begingroup 3758 \def\flushright{\begingroup
4261 \let\nonarrowing = t 3759 \let\nonarrowing = t
4262 \nonfillstart 3760 \nonfillstart
4263 \let\Eflushright = \nonfillfinish 3761 \let\Eflushright = \nonfillfinish
4264 \advance\leftskip by 0pt plus 1fill 3762 \advance\leftskip by 0pt plus 1fill
4265 \gobble 3763 \gobble}
4266 }
4267 3764
4268 % @quotation does normal linebreaking (hence we can't use \nonfillstart) 3765 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
4269 % and narrows the margins. 3766 % and narrows the margins.
4270 % 3767 %
4271 \def\quotation{% 3768 \def\quotation{%
4284 \exdentamount = \lispnarrowing 3781 \exdentamount = \lispnarrowing
4285 \let\nonarrowing = \relax 3782 \let\nonarrowing = \relax
4286 \fi 3783 \fi
4287 } 3784 }
4288 3785
4289
4290 \message{defuns,} 3786 \message{defuns,}
4291 % @defun etc. 3787 % Define formatter for defuns
4292 3788 % First, allow user to change definition object font (\df) internally
4293 % Allow user to change definition object font (\df) internally
4294 \def\setdeffont #1 {\csname DEF#1\endcsname} 3789 \def\setdeffont #1 {\csname DEF#1\endcsname}
4295 3790
4296 \newskip\defbodyindent \defbodyindent=.4in 3791 \newskip\defbodyindent \defbodyindent=.4in
4297 \newskip\defargsindent \defargsindent=50pt 3792 \newskip\defargsindent \defargsindent=50pt
4298 \newskip\deftypemargin \deftypemargin=12pt 3793 \newskip\deftypemargin \deftypemargin=12pt
4342 } % End of definition inside \activeparens 3837 } % End of definition inside \activeparens
4343 %% These parens (in \boldbrax) actually are a little bolder than the 3838 %% These parens (in \boldbrax) actually are a little bolder than the
4344 %% contained text. This is especially needed for [ and ] 3839 %% contained text. This is especially needed for [ and ]
4345 \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } 3840 \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
4346 \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } 3841 \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
4347 \let\ampnr = \& 3842 \def\ampnr{\&}
4348 \def\lbrb{{\bf\char`\[}} 3843 \def\lbrb{{\bf\char`\[}}
4349 \def\rbrb{{\bf\char`\]}} 3844 \def\rbrb{{\bf\char`\]}}
4350
4351 % Active &'s sneak into the index arguments, so make sure it's defined.
4352 {
4353 \catcode`& = 13
4354 \global\let& = \ampnr
4355 }
4356 3845
4357 % First, defname, which formats the header line itself. 3846 % First, defname, which formats the header line itself.
4358 % #1 should be the function name. 3847 % #1 should be the function name.
4359 % #2 should be the type of definition, such as "Function". 3848 % #2 should be the type of definition, such as "Function".
4360 3849
4361 \def\defname #1#2{% 3850 \def\defname #1#2{%
4362 % Get the values of \leftskip and \rightskip as they were 3851 % Get the values of \leftskip and \rightskip as they were
4363 % outside the @def... 3852 % outside the @def...
4364 \dimen2=\leftskip 3853 \dimen2=\leftskip
4365 \advance\dimen2 by -\defbodyindent 3854 \advance\dimen2 by -\defbodyindent
4366 \noindent 3855 \dimen3=\rightskip
3856 \advance\dimen3 by -\defbodyindent
3857 \noindent %
4367 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% 3858 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
4368 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line 3859 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
4369 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations 3860 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
4370 \parshape 2 0in \dimen0 \defargsindent \dimen1 3861 \parshape 2 0in \dimen0 \defargsindent \dimen1 %
4371 % Now output arg 2 ("Function" or some such) 3862 % Now output arg 2 ("Function" or some such)
4372 % ending at \deftypemargin from the right margin, 3863 % ending at \deftypemargin from the right margin,
4373 % but stuck inside a box of width 0 so it does not interfere with linebreaking 3864 % but stuck inside a box of width 0 so it does not interfere with linebreaking
4374 {% Adjust \hsize to exclude the ambient margins, 3865 {% Adjust \hsize to exclude the ambient margins,
4375 % so that \rightline will obey them. 3866 % so that \rightline will obey them.
4376 \advance \hsize by -\dimen2 3867 \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
4377 \rlap{\rightline{{\rm #2}\hskip -1.25pc }}}% 3868 \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
4378 % Make all lines underfull and no complaints: 3869 % Make all lines underfull and no complaints:
4379 \tolerance=10000 \hbadness=10000 3870 \tolerance=10000 \hbadness=10000
4380 \advance\leftskip by -\defbodyindent 3871 \advance\leftskip by -\defbodyindent
4381 \exdentamount=\defbodyindent 3872 \exdentamount=\defbodyindent
4382 {\df #1}\enskip % Generate function name 3873 {\df #1}\enskip % Generate function name
4393 % Define the end token that this defining construct specifies 3884 % Define the end token that this defining construct specifies
4394 % so that it will exit this group. 3885 % so that it will exit this group.
4395 \def#1{\endgraf\endgroup\medbreak}% 3886 \def#1{\endgraf\endgroup\medbreak}%
4396 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}% 3887 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
4397 \parindent=0in 3888 \parindent=0in
4398 \advance\leftskip by \defbodyindent 3889 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4399 \exdentamount=\defbodyindent 3890 \exdentamount=\defbodyindent
4400 \begingroup % 3891 \begingroup %
4401 \catcode 61=\active % 61 is `=' 3892 \catcode 61=\active % 61 is `='
4402 \obeylines\activeparens\spacesplit#3} 3893 \obeylines\activeparens\spacesplit#3}
4403 3894
4404 % #1 is the \E... control sequence to end the definition (which we define). 3895 \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
4405 % #2 is the \...x control sequence for consecutive fns (which we define).
4406 % #3 is the control sequence to call to resume processing.
4407 % #4, delimited by the space, is the class name.
4408 %
4409 \def\defmethparsebody#1#2#3#4 {\begingroup\inENV %
4410 \medbreak % 3896 \medbreak %
4411 % Define the end token that this defining construct specifies 3897 % Define the end token that this defining construct specifies
4412 % so that it will exit this group. 3898 % so that it will exit this group.
4413 \def#1{\endgraf\endgroup\medbreak}% 3899 \def#1{\endgraf\endgroup\medbreak}%
4414 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% 3900 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
4415 \parindent=0in 3901 \parindent=0in
4416 \advance\leftskip by \defbodyindent 3902 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4417 \exdentamount=\defbodyindent 3903 \exdentamount=\defbodyindent
4418 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}} 3904 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
4419
4420 % Used for @deftypemethod and @deftypeivar.
4421 % #1 is the \E... control sequence to end the definition (which we define).
4422 % #2 is the \...x control sequence for consecutive fns (which we define).
4423 % #3 is the control sequence to call to resume processing.
4424 % #4, delimited by a space, is the class name.
4425 % #5 is the method's return type.
4426 %
4427 \def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV
4428 \medbreak
4429 \def#1{\endgraf\endgroup\medbreak}%
4430 \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}%
4431 \parindent=0in
4432 \advance\leftskip by \defbodyindent
4433 \exdentamount=\defbodyindent
4434 \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}}
4435
4436 % Used for @deftypeop. The change from \deftypemethparsebody is an
4437 % extra argument at the beginning which is the `category', instead of it
4438 % being the hardwired string `Method' or `Instance Variable'. We have
4439 % to account for this both in the \...x definition and in parsing the
4440 % input at hand. Thus also need a control sequence (passed as #5) for
4441 % the \E... definition to assign the category name to.
4442 %
4443 \def\deftypeopparsebody#1#2#3#4#5 #6 {\begingroup\inENV
4444 \medbreak
4445 \def#1{\endgraf\endgroup\medbreak}%
4446 \def#2##1 ##2 ##3 {%
4447 \def#4{##1}%
4448 \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}%
4449 \parindent=0in
4450 \advance\leftskip by \defbodyindent
4451 \exdentamount=\defbodyindent
4452 \begingroup\obeylines\activeparens\spacesplit{#3{#5}{#6}}}
4453 3905
4454 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % 3906 \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
4455 \medbreak % 3907 \medbreak %
4456 % Define the end token that this defining construct specifies 3908 % Define the end token that this defining construct specifies
4457 % so that it will exit this group. 3909 % so that it will exit this group.
4458 \def#1{\endgraf\endgroup\medbreak}% 3910 \def#1{\endgraf\endgroup\medbreak}%
4459 \def#2##1 ##2 {\def#4{##1}% 3911 \def#2##1 ##2 {\def#4{##1}%
4460 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% 3912 \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
4461 \parindent=0in 3913 \parindent=0in
4462 \advance\leftskip by \defbodyindent 3914 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4463 \exdentamount=\defbodyindent 3915 \exdentamount=\defbodyindent
4464 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}} 3916 \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
4465 3917
4466 % These parsing functions are similar to the preceding ones 3918 % These parsing functions are similar to the preceding ones
4467 % except that they do not make parens into active characters. 3919 % except that they do not make parens into active characters.
4472 % Define the end token that this defining construct specifies 3924 % Define the end token that this defining construct specifies
4473 % so that it will exit this group. 3925 % so that it will exit this group.
4474 \def#1{\endgraf\endgroup\medbreak}% 3926 \def#1{\endgraf\endgroup\medbreak}%
4475 \def#2{\begingroup\obeylines\spacesplit#3}% 3927 \def#2{\begingroup\obeylines\spacesplit#3}%
4476 \parindent=0in 3928 \parindent=0in
4477 \advance\leftskip by \defbodyindent 3929 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4478 \exdentamount=\defbodyindent 3930 \exdentamount=\defbodyindent
4479 \begingroup % 3931 \begingroup %
4480 \catcode 61=\active % 3932 \catcode 61=\active %
4481 \obeylines\spacesplit#3} 3933 \obeylines\spacesplit#3}
4482 3934
4489 % Define the end token that this defining construct specifies 3941 % Define the end token that this defining construct specifies
4490 % so that it will exit this group. 3942 % so that it will exit this group.
4491 \def#1{\endgraf\endgroup\medbreak}% 3943 \def#1{\endgraf\endgroup\medbreak}%
4492 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% 3944 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
4493 \parindent=0in 3945 \parindent=0in
4494 \advance\leftskip by \defbodyindent 3946 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4495 \exdentamount=\defbodyindent 3947 \exdentamount=\defbodyindent
4496 \begingroup\obeylines 3948 \begingroup\obeylines
4497 } 3949 }
4498 3950
4499 \def\defvrparsebody#1#2#3#4 {% 3951 \def\defvrparsebody#1#2#3#4 {%
4534 % so that it will exit this group. 3986 % so that it will exit this group.
4535 \def#1{\endgraf\endgroup\medbreak}% 3987 \def#1{\endgraf\endgroup\medbreak}%
4536 \def#2##1 ##2 {\def#4{##1}% 3988 \def#2##1 ##2 {\def#4{##1}%
4537 \begingroup\obeylines\spacesplit{#3{##2}}}% 3989 \begingroup\obeylines\spacesplit{#3{##2}}}%
4538 \parindent=0in 3990 \parindent=0in
4539 \advance\leftskip by \defbodyindent 3991 \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
4540 \exdentamount=\defbodyindent 3992 \exdentamount=\defbodyindent
4541 \begingroup\obeylines\spacesplit{#3{#5}}} 3993 \begingroup\obeylines\spacesplit{#3{#5}}}
4542 3994
4543 % Split up #2 at the first space token. 3995 % Split up #2 at the first space token.
4544 % call #1 with two arguments: 3996 % call #1 with two arguments:
4558 % Define @defun. 4010 % Define @defun.
4559 4011
4560 % First, define the processing that is wanted for arguments of \defun 4012 % First, define the processing that is wanted for arguments of \defun
4561 % Use this to expand the args and terminate the paragraph they make up 4013 % Use this to expand the args and terminate the paragraph they make up
4562 4014
4563 \def\defunargs#1{\functionparens \sl 4015 \def\defunargs #1{\functionparens \sl
4564 % Expand, preventing hyphenation at `-' chars. 4016 % Expand, preventing hyphenation at `-' chars.
4565 % Note that groups don't affect changes in \hyphenchar. 4017 % Note that groups don't affect changes in \hyphenchar.
4566 % Set the font temporarily and use \font in case \setfont made \tensl a macro. 4018 \hyphenchar\tensl=0
4567 {\tensl\hyphenchar\font=0}%
4568 #1% 4019 #1%
4569 {\tensl\hyphenchar\font=45}% 4020 \hyphenchar\tensl=45
4570 \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% 4021 \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
4571 \interlinepenalty=10000 4022 \interlinepenalty=10000
4572 \advance\rightskip by 0pt plus 1fil 4023 \advance\rightskip by 0pt plus 1fil
4573 \endgraf\nobreak\vskip -\parskip\nobreak 4024 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
4574 } 4025 }
4575 4026
4576 \def\deftypefunargs #1{% 4027 \def\deftypefunargs #1{%
4577 % Expand, preventing hyphenation at `-' chars. 4028 % Expand, preventing hyphenation at `-' chars.
4578 % Note that groups don't affect changes in \hyphenchar. 4029 % Note that groups don't affect changes in \hyphenchar.
4579 % Use \boldbraxnoamp, not \functionparens, so that & is not special. 4030 % Use \boldbraxnoamp, not \functionparens, so that & is not special.
4580 \boldbraxnoamp 4031 \boldbraxnoamp
4581 \tclose{#1}% avoid \code because of side effects on active chars 4032 \tclose{#1}% avoid \code because of side effects on active chars
4582 \interlinepenalty=10000 4033 \interlinepenalty=10000
4583 \advance\rightskip by 0pt plus 1fil 4034 \advance\rightskip by 0pt plus 1fil
4584 \endgraf\nobreak\vskip -\parskip\nobreak 4035 \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
4585 } 4036 }
4586 4037
4587 % Do complete processing of one @defun or @defunx line already parsed. 4038 % Do complete processing of one @defun or @defunx line already parsed.
4588 4039
4589 % @deffn Command forward-char nchars 4040 % @deffn Command forward-char nchars
4598 % @defun == @deffn Function 4049 % @defun == @deffn Function
4599 4050
4600 \def\defun{\defparsebody\Edefun\defunx\defunheader} 4051 \def\defun{\defparsebody\Edefun\defunx\defunheader}
4601 4052
4602 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index 4053 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4603 \begingroup\defname {#1}{\putwordDeffunc}% 4054 \begingroup\defname {#1}{Function}%
4604 \defunargs {#2}\endgroup % 4055 \defunargs {#2}\endgroup %
4605 \catcode 61=\other % Turn off change made in \defparsebody 4056 \catcode 61=\other % Turn off change made in \defparsebody
4606 } 4057 }
4607 4058
4608 % @deftypefun int foobar (int @var{foo}, float @var{bar}) 4059 % @deftypefun int foobar (int @var{foo}, float @var{bar})
4612 % #1 is the data type. #2 is the name and args. 4063 % #1 is the data type. #2 is the name and args.
4613 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} 4064 \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
4614 % #1 is the data type, #2 the name, #3 the args. 4065 % #1 is the data type, #2 the name, #3 the args.
4615 \def\deftypefunheaderx #1#2 #3\relax{% 4066 \def\deftypefunheaderx #1#2 #3\relax{%
4616 \doind {fn}{\code{#2}}% Make entry in function index 4067 \doind {fn}{\code{#2}}% Make entry in function index
4617 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}% 4068 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
4618 \deftypefunargs {#3}\endgroup % 4069 \deftypefunargs {#3}\endgroup %
4619 \catcode 61=\other % Turn off change made in \defparsebody 4070 \catcode 61=\other % Turn off change made in \defparsebody
4620 } 4071 }
4621 4072
4622 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) 4073 % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
4643 % @defmac == @deffn Macro 4094 % @defmac == @deffn Macro
4644 4095
4645 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} 4096 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
4646 4097
4647 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index 4098 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4648 \begingroup\defname {#1}{\putwordDefmac}% 4099 \begingroup\defname {#1}{Macro}%
4649 \defunargs {#2}\endgroup % 4100 \defunargs {#2}\endgroup %
4650 \catcode 61=\other % Turn off change made in \defparsebody 4101 \catcode 61=\other % Turn off change made in \defparsebody
4651 } 4102 }
4652 4103
4653 % @defspec == @deffn Special Form 4104 % @defspec == @deffn Special Form
4654 4105
4655 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} 4106 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
4656 4107
4657 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index 4108 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
4658 \begingroup\defname {#1}{\putwordDefspec}% 4109 \begingroup\defname {#1}{Special Form}%
4659 \defunargs {#2}\endgroup % 4110 \defunargs {#2}\endgroup %
4660 \catcode 61=\other % Turn off change made in \defparsebody 4111 \catcode 61=\other % Turn off change made in \defparsebody
4661 } 4112 }
4662 4113
4663 % @defop CATEGORY CLASS OPERATION ARG... 4114 % This definition is run if you use @defunx
4664 % 4115 % anywhere other than immediately after a @defun or @defunx.
4116
4117 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
4118 \def\defunx #1 {\errmessage{@defunx in invalid context}}
4119 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
4120 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
4121 \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
4122 \def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}}
4123 \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
4124
4125 % @defmethod, and so on
4126
4127 % @defop {Funny Method} foo-class frobnicate argument
4128
4665 \def\defop #1 {\def\defoptype{#1}% 4129 \def\defop #1 {\def\defoptype{#1}%
4666 \defopparsebody\Edefop\defopx\defopheader\defoptype} 4130 \defopparsebody\Edefop\defopx\defopheader\defoptype}
4667 % 4131
4668 \def\defopheader#1#2#3{% 4132 \def\defopheader #1#2#3{%
4669 \dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index 4133 \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
4670 \begingroup\defname {#2}{\defoptype\ \putwordon\ #1}% 4134 \begingroup\defname {#2}{\defoptype{} on #1}%
4671 \defunargs {#3}\endgroup % 4135 \defunargs {#3}\endgroup %
4672 } 4136 }
4673 4137
4674 % @deftypeop CATEGORY CLASS TYPE OPERATION ARG... 4138 % @deftypemethod foo-class return-type foo-method args
4675 %
4676 \def\deftypeop #1 {\def\deftypeopcategory{#1}%
4677 \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
4678 \deftypeopcategory}
4679 %
4680 % #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
4681 \def\deftypeopheader#1#2#3#4{%
4682 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
4683 \begingroup
4684 \defname{\defheaderxcond#2\relax$$$#3}
4685 {\deftypeopcategory\ \putwordon\ \code{#1}}%
4686 \deftypefunargs{#4}%
4687 \endgroup
4688 }
4689
4690 % @deftypemethod CLASS TYPE METHOD ARG...
4691 % 4139 %
4692 \def\deftypemethod{% 4140 \def\deftypemethod{%
4693 \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} 4141 \defmethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
4694 % 4142 %
4695 % #1 is the class name, #2 the data type, #3 the method name, #4 the args. 4143 % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
4696 \def\deftypemethodheader#1#2#3#4{% 4144 \def\deftypemethodheader#1#2#3#4{%
4697 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index 4145 \deftypefnheaderx{Method on #1}{#2}#3 #4\relax
4698 \begingroup
4699 \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}%
4700 \deftypefunargs{#4}%
4701 \endgroup
4702 }
4703
4704 % @deftypeivar CLASS TYPE VARNAME
4705 %
4706 \def\deftypeivar{%
4707 \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
4708 %
4709 % #1 is the class name, #2 the data type, #3 the variable name.
4710 \def\deftypeivarheader#1#2#3{%
4711 \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
4712 \begingroup
4713 \defname{#3}{\putwordInstanceVariableof\ \code{#1}}%
4714 \defvarargs{#3}%
4715 \endgroup
4716 } 4146 }
4717 4147
4718 % @defmethod == @defop Method 4148 % @defmethod == @defop Method
4719 % 4149
4720 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} 4150 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
4721 % 4151
4722 % #1 is the class name, #2 the method name, #3 the args. 4152 \def\defmethodheader #1#2#3{%
4723 \def\defmethodheader#1#2#3{% 4153 \dosubind {fn}{\code{#2}}{on #1}% entry in function index
4724 \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index 4154 \begingroup\defname {#2}{Method on #1}%
4725 \begingroup 4155 \defunargs {#3}\endgroup %
4726 \defname{#2}{\putwordMethodon\ \code{#1}}%
4727 \defunargs{#3}%
4728 \endgroup
4729 } 4156 }
4730 4157
4731 % @defcv {Class Option} foo-class foo-flag 4158 % @defcv {Class Option} foo-class foo-flag
4732 4159
4733 \def\defcv #1 {\def\defcvtype{#1}% 4160 \def\defcv #1 {\def\defcvtype{#1}%
4734 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} 4161 \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
4735 4162
4736 \def\defcvarheader #1#2#3{% 4163 \def\defcvarheader #1#2#3{%
4737 \dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index 4164 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4738 \begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}% 4165 \begingroup\defname {#2}{\defcvtype{} of #1}%
4739 \defvarargs {#3}\endgroup % 4166 \defvarargs {#3}\endgroup %
4740 } 4167 }
4741 4168
4742 % @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME 4169 % @defivar == @defcv {Instance Variable}
4743 % 4170
4744 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} 4171 \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
4745 % 4172
4746 \def\defivarheader#1#2#3{% 4173 \def\defivarheader #1#2#3{%
4747 \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index 4174 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
4748 \begingroup 4175 \begingroup\defname {#2}{Instance Variable of #1}%
4749 \defname{#2}{\putwordInstanceVariableof\ #1}% 4176 \defvarargs {#3}\endgroup %
4750 \defvarargs{#3}% 4177 }
4751 \endgroup 4178
4752 } 4179 % These definitions are run if you use @defmethodx, etc.,
4753 4180 % anywhere other than immediately after a @defmethod, etc.
4754 % @defvar 4181
4182 \def\defopx #1 {\errmessage{@defopx in invalid context}}
4183 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
4184 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
4185 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
4186
4187 % Now @defvar
4188
4755 % First, define the processing that is wanted for arguments of @defvar. 4189 % First, define the processing that is wanted for arguments of @defvar.
4756 % This is actually simple: just print them in roman. 4190 % This is actually simple: just print them in roman.
4757 % This must expand the args and terminate the paragraph they make up 4191 % This must expand the args and terminate the paragraph they make up
4758 \def\defvarargs #1{\normalparens #1% 4192 \def\defvarargs #1{\normalparens #1%
4759 \interlinepenalty=10000 4193 \interlinepenalty=10000
4760 \endgraf\nobreak\vskip -\parskip\nobreak} 4194 \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
4761 4195
4762 % @defvr Counter foo-count 4196 % @defvr Counter foo-count
4763 4197
4764 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} 4198 \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
4765 4199
4769 % @defvar == @defvr Variable 4203 % @defvar == @defvr Variable
4770 4204
4771 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} 4205 \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
4772 4206
4773 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index 4207 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4774 \begingroup\defname {#1}{\putwordDefvar}% 4208 \begingroup\defname {#1}{Variable}%
4775 \defvarargs {#2}\endgroup % 4209 \defvarargs {#2}\endgroup %
4776 } 4210 }
4777 4211
4778 % @defopt == @defvr {User Option} 4212 % @defopt == @defvr {User Option}
4779 4213
4780 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} 4214 \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
4781 4215
4782 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index 4216 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
4783 \begingroup\defname {#1}{\putwordDefopt}% 4217 \begingroup\defname {#1}{User Option}%
4784 \defvarargs {#2}\endgroup % 4218 \defvarargs {#2}\endgroup %
4785 } 4219 }
4786 4220
4787 % @deftypevar int foobar 4221 % @deftypevar int foobar
4788 4222
4790 4224
4791 % #1 is the data type. #2 is the name, perhaps followed by text that 4225 % #1 is the data type. #2 is the name, perhaps followed by text that
4792 % is actually part of the data type, which should not be put into the index. 4226 % is actually part of the data type, which should not be put into the index.
4793 \def\deftypevarheader #1#2{% 4227 \def\deftypevarheader #1#2{%
4794 \dovarind#2 \relax% Make entry in variables index 4228 \dovarind#2 \relax% Make entry in variables index
4795 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}% 4229 \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
4796 \interlinepenalty=10000 4230 \interlinepenalty=10000
4797 \endgraf\nobreak\vskip -\parskip\nobreak 4231 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
4798 \endgroup} 4232 \endgroup}
4799 \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} 4233 \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
4800 4234
4801 % @deftypevr {Global Flag} int enable 4235 % @deftypevr {Global Flag} int enable
4802 4236
4803 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} 4237 \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
4804 4238
4805 \def\deftypevrheader #1#2#3{\dovarind#3 \relax% 4239 \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
4806 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1} 4240 \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
4807 \interlinepenalty=10000 4241 \interlinepenalty=10000
4808 \endgraf\nobreak\vskip -\parskip\nobreak 4242 \endgraf\penalty 10000\vskip -\parskip\penalty 10000
4809 \endgroup} 4243 \endgroup}
4244
4245 % This definition is run if you use @defvarx
4246 % anywhere other than immediately after a @defvar or @defvarx.
4247
4248 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
4249 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
4250 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
4251 \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
4252 \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
4810 4253
4811 % Now define @deftp 4254 % Now define @deftp
4812 % Args are printed in bold, a slight difference from @defvar. 4255 % Args are printed in bold, a slight difference from @defvar.
4813 4256
4814 \def\deftpargs #1{\bf \defvarargs{#1}} 4257 \def\deftpargs #1{\bf \defvarargs{#1}}
4818 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} 4261 \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
4819 4262
4820 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% 4263 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4821 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} 4264 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4822 4265
4823 % These definitions are used if you use @defunx (etc.) 4266 % This definition is run if you use @deftpx, etc
4824 % anywhere other than immediately after a @defun or @defunx. 4267 % anywhere other than immediately after a @deftp, etc.
4825 % 4268
4826 \def\defcvx#1 {\errmessage{@defcvx in invalid context}} 4269 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
4827 \def\deffnx#1 {\errmessage{@deffnx in invalid context}} 4270
4828 \def\defivarx#1 {\errmessage{@defivarx in invalid context}} 4271
4829 \def\defmacx#1 {\errmessage{@defmacx in invalid context}} 4272 \message{cross reference,}
4830 \def\defmethodx#1 {\errmessage{@defmethodx in invalid context}} 4273 % Define cross-reference macros
4831 \def\defoptx #1 {\errmessage{@defoptx in invalid context}} 4274 \newwrite \auxfile
4832 \def\defopx#1 {\errmessage{@defopx in invalid context}} 4275
4833 \def\defspecx#1 {\errmessage{@defspecx in invalid context}} 4276 \newif\ifhavexrefs % True if xref values are known.
4834 \def\deftpx#1 {\errmessage{@deftpx in invalid context}}
4835 \def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
4836 \def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
4837 \def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
4838 \def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
4839 \def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
4840 \def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
4841 \def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
4842 \def\defunx#1 {\errmessage{@defunx in invalid context}}
4843 \def\defvarx#1 {\errmessage{@defvarx in invalid context}}
4844 \def\defvrx#1 {\errmessage{@defvrx in invalid context}}
4845
4846
4847 \message{macros,}
4848 % @macro.
4849
4850 % To do this right we need a feature of e-TeX, \scantokens,
4851 % which we arrange to emulate with a temporary file in ordinary TeX.
4852 \ifx\eTeXversion\undefined
4853 \newwrite\macscribble
4854 \def\scanmacro#1{%
4855 \begingroup \newlinechar`\^^M
4856 % Undo catcode changes of \startcontents and \doprintindex
4857 \catcode`\@=0 \catcode`\\=12 \escapechar=`\@
4858 % Append \endinput to make sure that TeX does not see the ending newline.
4859 \toks0={#1\endinput}%
4860 \immediate\openout\macscribble=\jobname.tmp
4861 \immediate\write\macscribble{\the\toks0}%
4862 \immediate\closeout\macscribble
4863 \let\xeatspaces\eatspaces
4864 \input \jobname.tmp
4865 \endgroup
4866 }
4867 \else
4868 \def\scanmacro#1{%
4869 \begingroup \newlinechar`\^^M
4870 % Undo catcode changes of \startcontents and \doprintindex
4871 \catcode`\@=0 \catcode`\\=12 \escapechar=`\@
4872 \let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
4873 \fi
4874
4875 \newcount\paramno % Count of parameters
4876 \newtoks\macname % Macro name
4877 \newif\ifrecursive % Is it recursive?
4878 \def\macrolist{} % List of all defined macros in the form
4879 % \do\macro1\do\macro2...
4880
4881 % Utility routines.
4882 % Thisdoes \let #1 = #2, except with \csnames.
4883 \def\cslet#1#2{%
4884 \expandafter\expandafter
4885 \expandafter\let
4886 \expandafter\expandafter
4887 \csname#1\endcsname
4888 \csname#2\endcsname}
4889
4890 % Trim leading and trailing spaces off a string.
4891 % Concepts from aro-bend problem 15 (see CTAN).
4892 {\catcode`\@=11
4893 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
4894 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
4895 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
4896 \def\unbrace#1{#1}
4897 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
4898 }
4899
4900 % Trim a single trailing ^^M off a string.
4901 {\catcode`\^^M=12\catcode`\Q=3%
4902 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
4903 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
4904 \gdef\eatcrb#1Q#2Q{#1}%
4905 }
4906
4907 % Macro bodies are absorbed as an argument in a context where
4908 % all characters are catcode 10, 11 or 12, except \ which is active
4909 % (as in normal texinfo). It is necessary to change the definition of \.
4910
4911 % It's necessary to have hard CRs when the macro is executed. This is
4912 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
4913 % body, and then making it the \newlinechar in \scanmacro.
4914
4915 \def\macrobodyctxt{%
4916 \catcode`\~=12
4917 \catcode`\^=12
4918 \catcode`\_=12
4919 \catcode`\|=12
4920 \catcode`\<=12
4921 \catcode`\>=12
4922 \catcode`\+=12
4923 \catcode`\{=12
4924 \catcode`\}=12
4925 \catcode`\@=12
4926 \catcode`\^^M=12
4927 \usembodybackslash}
4928
4929 \def\macroargctxt{%
4930 \catcode`\~=12
4931 \catcode`\^=12
4932 \catcode`\_=12
4933 \catcode`\|=12
4934 \catcode`\<=12
4935 \catcode`\>=12
4936 \catcode`\+=12
4937 \catcode`\@=12
4938 \catcode`\\=12}
4939
4940 % \mbodybackslash is the definition of \ in @macro bodies.
4941 % It maps \foo\ => \csname macarg.foo\endcsname => #N
4942 % where N is the macro parameter number.
4943 % We define \csname macarg.\endcsname to be \realbackslash, so
4944 % \\ in macro replacement text gets you a backslash.
4945
4946 {\catcode`@=0 @catcode`@\=@active
4947 @gdef@usembodybackslash{@let\=@mbodybackslash}
4948 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
4949 }
4950 \expandafter\def\csname macarg.\endcsname{\realbackslash}
4951
4952 \def\macro{\recursivefalse\parsearg\macroxxx}
4953 \def\rmacro{\recursivetrue\parsearg\macroxxx}
4954
4955 \def\macroxxx#1{%
4956 \getargs{#1}% now \macname is the macname and \argl the arglist
4957 \ifx\argl\empty % no arguments
4958 \paramno=0%
4959 \else
4960 \expandafter\parsemargdef \argl;%
4961 \fi
4962 \if1\csname ismacro.\the\macname\endcsname
4963 \message{Warning: redefining \the\macname}%
4964 \else
4965 \expandafter\ifx\csname \the\macname\endcsname \relax
4966 \else \errmessage{The name \the\macname\space is reserved}\fi
4967 \global\cslet{macsave.\the\macname}{\the\macname}%
4968 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
4969 % Add the macroname to \macrolist
4970 \toks0 = \expandafter{\macrolist\do}%
4971 \xdef\macrolist{\the\toks0
4972 \expandafter\noexpand\csname\the\macname\endcsname}%
4973 \fi
4974 \begingroup \macrobodyctxt
4975 \ifrecursive \expandafter\parsermacbody
4976 \else \expandafter\parsemacbody
4977 \fi}
4978
4979 \def\unmacro{\parsearg\unmacroxxx}
4980 \def\unmacroxxx#1{%
4981 \if1\csname ismacro.#1\endcsname
4982 \global\cslet{#1}{macsave.#1}%
4983 \global\expandafter\let \csname ismacro.#1\endcsname=0%
4984 % Remove the macro name from \macrolist
4985 \begingroup
4986 \edef\tempa{\expandafter\noexpand\csname#1\endcsname}%
4987 \def\do##1{%
4988 \def\tempb{##1}%
4989 \ifx\tempa\tempb
4990 % remove this
4991 \else
4992 \toks0 = \expandafter{\newmacrolist\do}%
4993 \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}%
4994 \fi}%
4995 \def\newmacrolist{}%
4996 % Execute macro list to define \newmacrolist
4997 \macrolist
4998 \global\let\macrolist\newmacrolist
4999 \endgroup
5000 \else
5001 \errmessage{Macro #1 not defined}%
5002 \fi
5003 }
5004
5005 % This makes use of the obscure feature that if the last token of a
5006 % <parameter list> is #, then the preceding argument is delimited by
5007 % an opening brace, and that opening brace is not consumed.
5008 \def\getargs#1{\getargsxxx#1{}}
5009 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
5010 \def\getmacname #1 #2\relax{\macname={#1}}
5011 \def\getmacargs#1{\def\argl{#1}}
5012
5013 % Parse the optional {params} list. Set up \paramno and \paramlist
5014 % so \defmacro knows what to do. Define \macarg.blah for each blah
5015 % in the params list, to be ##N where N is the position in that list.
5016 % That gets used by \mbodybackslash (above).
5017
5018 % We need to get `macro parameter char #' into several definitions.
5019 % The technique used is stolen from LaTeX: let \hash be something
5020 % unexpandable, insert that wherever you need a #, and then redefine
5021 % it to # just before using the token list produced.
5022 %
5023 % The same technique is used to protect \eatspaces till just before
5024 % the macro is used.
5025
5026 \def\parsemargdef#1;{\paramno=0\def\paramlist{}%
5027 \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
5028 \def\parsemargdefxxx#1,{%
5029 \if#1;\let\next=\relax
5030 \else \let\next=\parsemargdefxxx
5031 \advance\paramno by 1%
5032 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
5033 {\xeatspaces{\hash\the\paramno}}%
5034 \edef\paramlist{\paramlist\hash\the\paramno,}%
5035 \fi\next}
5036
5037 % These two commands read recursive and nonrecursive macro bodies.
5038 % (They're different since rec and nonrec macros end differently.)
5039
5040 \long\def\parsemacbody#1@end macro%
5041 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
5042 \long\def\parsermacbody#1@end rmacro%
5043 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
5044
5045 % This defines the macro itself. There are six cases: recursive and
5046 % nonrecursive macros of zero, one, and many arguments.
5047 % Much magic with \expandafter here.
5048 % \xdef is used so that macro definitions will survive the file
5049 % they're defined in; @include reads the file inside a group.
5050 \def\defmacro{%
5051 \let\hash=##% convert placeholders to macro parameter chars
5052 \ifrecursive
5053 \ifcase\paramno
5054 % 0
5055 \expandafter\xdef\csname\the\macname\endcsname{%
5056 \noexpand\scanmacro{\temp}}%
5057 \or % 1
5058 \expandafter\xdef\csname\the\macname\endcsname{%
5059 \bgroup\noexpand\macroargctxt
5060 \noexpand\braceorline
5061 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
5062 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
5063 \egroup\noexpand\scanmacro{\temp}}%
5064 \else % many
5065 \expandafter\xdef\csname\the\macname\endcsname{%
5066 \bgroup\noexpand\macroargctxt
5067 \noexpand\csname\the\macname xx\endcsname}%
5068 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
5069 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
5070 \expandafter\expandafter
5071 \expandafter\xdef
5072 \expandafter\expandafter
5073 \csname\the\macname xxx\endcsname
5074 \paramlist{\egroup\noexpand\scanmacro{\temp}}%
5075 \fi
5076 \else
5077 \ifcase\paramno
5078 % 0
5079 \expandafter\xdef\csname\the\macname\endcsname{%
5080 \noexpand\norecurse{\the\macname}%
5081 \noexpand\scanmacro{\temp}\egroup}%
5082 \or % 1
5083 \expandafter\xdef\csname\the\macname\endcsname{%
5084 \bgroup\noexpand\macroargctxt
5085 \noexpand\braceorline
5086 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
5087 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
5088 \egroup
5089 \noexpand\norecurse{\the\macname}%
5090 \noexpand\scanmacro{\temp}\egroup}%
5091 \else % many
5092 \expandafter\xdef\csname\the\macname\endcsname{%
5093 \bgroup\noexpand\macroargctxt
5094 \expandafter\noexpand\csname\the\macname xx\endcsname}%
5095 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
5096 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
5097 \expandafter\expandafter
5098 \expandafter\xdef
5099 \expandafter\expandafter
5100 \csname\the\macname xxx\endcsname
5101 \paramlist{%
5102 \egroup
5103 \noexpand\norecurse{\the\macname}%
5104 \noexpand\scanmacro{\temp}\egroup}%
5105 \fi
5106 \fi}
5107
5108 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
5109
5110 % \braceorline decides whether the next nonwhitespace character is a
5111 % {. If so it reads up to the closing }, if not, it reads the whole
5112 % line. Whatever was read is then fed to the next control sequence
5113 % as an argument (by \parsebrace or \parsearg)
5114 \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
5115 \def\braceorlinexxx{%
5116 \ifx\nchar\bgroup\else
5117 \expandafter\parsearg
5118 \fi \next}
5119
5120 % We mant to disable all macros during \shipout so that they are not
5121 % expanded by \write.
5122 \def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
5123 \edef\next{\macrolist}\expandafter\endgroup\next}
5124
5125
5126 % @alias.
5127 % We need some trickery to remove the optional spaces around the equal
5128 % sign. Just make them active and then expand them all to nothing.
5129 \def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
5130 \def\aliasxxx #1{\aliasyyy#1\relax}
5131 \def\aliasyyy #1=#2\relax{\ignoreactivespaces
5132 \edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
5133 \expandafter\noexpand\csname#2\endcsname}%
5134 \expandafter\endgroup\next}
5135
5136
5137 \message{cross references,}
5138 % @xref etc.
5139
5140 \newwrite\auxfile
5141
5142 \newif\ifhavexrefs % True if xref values are known.
5143 \newif\ifwarnedxrefs % True if we warned once that they aren't known. 4277 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
5144 4278
5145 % @inforef is relatively simple. 4279 % @inforef is simple.
5146 \def\inforef #1{\inforefzzz #1,,,,**} 4280 \def\inforef #1{\inforefzzz #1,,,,**}
5147 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, 4281 \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
5148 node \samp{\ignorespaces#1{}}} 4282 node \samp{\ignorespaces#1{}}}
5149 4283
5150 % @node's job is to define \lastnode. 4284 % \setref{foo} defines a cross-reference point named foo.
5151 \def\node{\ENVcheck\parsearg\nodezzz} 4285
5152 \def\nodezzz#1{\nodexxx [#1,]} 4286 \def\setref#1{%
5153 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}} 4287 \dosetq{#1-title}{Ytitle}%
5154 \let\nwnode=\node 4288 \dosetq{#1-pg}{Ypagenumber}%
5155 \let\lastnode=\relax 4289 \dosetq{#1-snt}{Ysectionnumberandtype}}
5156 4290
5157 % The sectioning commands (@chapter, etc.) call these. 4291 \def\unnumbsetref#1{%
5158 \def\donoderef{% 4292 \dosetq{#1-title}{Ytitle}%
5159 \ifx\lastnode\relax\else 4293 \dosetq{#1-pg}{Ypagenumber}%
5160 \expandafter\expandafter\expandafter\setref{\lastnode}% 4294 \dosetq{#1-snt}{Ynothing}}
5161 {Ysectionnumberandtype}% 4295
5162 \global\let\lastnode=\relax 4296 \def\appendixsetref#1{%
5163 \fi 4297 \dosetq{#1-title}{Ytitle}%
5164 } 4298 \dosetq{#1-pg}{Ypagenumber}%
5165 \def\unnumbnoderef{% 4299 \dosetq{#1-snt}{Yappendixletterandtype}}
5166 \ifx\lastnode\relax\else 4300
5167 \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}% 4301 % \xref, \pxref, and \ref generate cross-references to specified points.
5168 \global\let\lastnode=\relax 4302 % For \xrefX, #1 is the node name, #2 the name of the Info
5169 \fi 4303 % cross-reference, #3 the printed node name, #4 the name of the Info
5170 } 4304 % file, #5 the name of the printed manual. All but the node name can be
5171 \def\appendixnoderef{% 4305 % omitted.
5172 \ifx\lastnode\relax\else
5173 \expandafter\expandafter\expandafter\setref{\lastnode}%
5174 {Yappendixletterandtype}%
5175 \global\let\lastnode=\relax
5176 \fi
5177 }
5178
5179
5180 % @anchor{NAME} -- define xref target at arbitrary point.
5181 %
5182 \newcount\savesfregister
5183 \gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
5184 \gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
5185 \gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
5186
5187 % \setref{NAME}{SNT} defines a cross-reference point NAME, namely
5188 % NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have
5189 % to set \indexdummies so commands such as @code in a section title
5190 % aren't expanded. It would be nicer not to expand the titles in the
5191 % first place, but there's so many layers that that is hard to do.
5192 %
5193 \def\setref#1#2{{%
5194 \indexdummies
5195 \pdfmkdest{#1}%
5196 \dosetq{#1-title}{Ytitle}%
5197 \dosetq{#1-pg}{Ypagenumber}%
5198 \dosetq{#1-snt}{#2}%
5199 }}
5200
5201 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
5202 % the node name, #2 the name of the Info cross-reference, #3 the printed
5203 % node name, #4 the name of the Info file, #5 the name of the printed
5204 % manual. All but the node name can be omitted.
5205 % 4306 %
5206 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} 4307 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
5207 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} 4308 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
5208 \def\ref#1{\xrefX[#1,,,,,,,]} 4309 \def\ref#1{\xrefX[#1,,,,,,,]}
5209 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup 4310 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
5210 \unsepspaces
5211 \def\printedmanual{\ignorespaces #5}% 4311 \def\printedmanual{\ignorespaces #5}%
5212 \def\printednodename{\ignorespaces #3}% 4312 \def\printednodename{\ignorespaces #3}%
5213 \setbox1=\hbox{\printedmanual}% 4313 \setbox1=\hbox{\printedmanual}%
5214 \setbox0=\hbox{\printednodename}% 4314 \setbox0=\hbox{\printednodename}%
5215 \ifdim \wd0 = 0pt 4315 \ifdim \wd0 = 0pt
5218 % Use the node name inside the square brackets. 4318 % Use the node name inside the square brackets.
5219 \def\printednodename{\ignorespaces #1}% 4319 \def\printednodename{\ignorespaces #1}%
5220 \else 4320 \else
5221 % Use the actual chapter/section title appear inside 4321 % Use the actual chapter/section title appear inside
5222 % the square brackets. Use the real section title if we have it. 4322 % the square brackets. Use the real section title if we have it.
5223 \ifdim \wd1 > 0pt 4323 \ifdim \wd1>0pt%
5224 % It is in another manual, so we don't have it. 4324 % It is in another manual, so we don't have it.
5225 \def\printednodename{\ignorespaces #1}% 4325 \def\printednodename{\ignorespaces #1}%
5226 \else 4326 \else
5227 \ifhavexrefs 4327 \ifhavexrefs
5228 % We know the real title if we have the xref values. 4328 % We know the real title if we have the xref values.
5239 % insert empty discretionaries after hyphens, which means that it will 4339 % insert empty discretionaries after hyphens, which means that it will
5240 % not find a line break at a hyphen in a node names. Since some manuals 4340 % not find a line break at a hyphen in a node names. Since some manuals
5241 % are best written with fairly long node names, containing hyphens, this 4341 % are best written with fairly long node names, containing hyphens, this
5242 % is a loss. Therefore, we give the text of the node name again, so it 4342 % is a loss. Therefore, we give the text of the node name again, so it
5243 % is as if TeX is seeing it for the first time. 4343 % is as if TeX is seeing it for the first time.
5244 \ifpdf
5245 \leavevmode
5246 \getfilename{#4}%
5247 \ifnum\filenamelength>0
5248 \startlink attr{/Border [0 0 0]}%
5249 goto file{\the\filename.pdf} name{#1@}%
5250 \else
5251 \startlink attr{/Border [0 0 0]}%
5252 goto name{#1@}%
5253 \fi
5254 \linkcolor
5255 \fi
5256 %
5257 \ifdim \wd1 > 0pt 4344 \ifdim \wd1 > 0pt
5258 \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}% 4345 \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
5259 \else 4346 \else
5260 % _ (for example) has to be the character _ for the purposes of the 4347 % _ (for example) has to be the character _ for the purposes of the
5261 % control sequence corresponding to the node, but it has to expand 4348 % control sequence corresponding to the node, but it has to expand
5262 % into the usual \leavevmode...\vrule stuff for purposes of 4349 % into the usual \leavevmode...\vrule stuff for purposes of
5263 % printing. So we \turnoffactive for the \refx-snt, back on for the 4350 % printing. So we \turnoffactive for the \refx-snt, back on for the
5264 % printing, back off for the \refx-pg. 4351 % printing, back off for the \refx-pg.
5265 {\normalturnoffactive 4352 {\turnoffactive \refx{#1-snt}{}}%
5266 % Only output a following space if the -snt ref is nonempty; for 4353 \space [\printednodename],\space
5267 % @unnumbered and @anchor, it won't be.
5268 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
5269 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
5270 }%
5271 % [mynode],
5272 [\printednodename],\space
5273 % page 3
5274 \turnoffactive \putwordpage\tie\refx{#1-pg}{}% 4354 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
5275 \fi 4355 \fi
5276 \endlink
5277 \endgroup} 4356 \endgroup}
5278 4357
5279 % \dosetq is the interface for calls from other macros 4358 % \dosetq is the interface for calls from other macros
5280 4359
5281 % Use \normalturnoffactive so that punctuation chars such as underscore 4360 % Use \turnoffactive so that punctuation chars such as underscore
5282 % and backslash work in node names. (\turnoffactive doesn't do \.) 4361 % work in node names.
5283 \def\dosetq#1#2{% 4362 \def\dosetq #1#2{{\let\folio=0 \turnoffactive
5284 {\let\folio=0% 4363 \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
5285 \normalturnoffactive 4364 \next}}
5286 \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
5287 \iflinks
5288 \next
5289 \fi
5290 }%
5291 }
5292 4365
5293 % \internalsetq {foo}{page} expands into 4366 % \internalsetq {foo}{page} expands into
5294 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} 4367 % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
5295 % When the aux file is read, ' is the escape character 4368 % When the aux file is read, ' is the escape character
5296 4369
5338 4411
5339 \def\refx#1#2{% 4412 \def\refx#1#2{%
5340 \expandafter\ifx\csname X#1\endcsname\relax 4413 \expandafter\ifx\csname X#1\endcsname\relax
5341 % If not defined, say something at least. 4414 % If not defined, say something at least.
5342 \angleleft un\-de\-fined\angleright 4415 \angleleft un\-de\-fined\angleright
5343 \iflinks 4416 \ifhavexrefs
5344 \ifhavexrefs 4417 \message{\linenumber Undefined cross reference `#1'.}%
5345 \message{\linenumber Undefined cross reference `#1'.}% 4418 \else
5346 \else 4419 \ifwarnedxrefs\else
5347 \ifwarnedxrefs\else 4420 \global\warnedxrefstrue
5348 \global\warnedxrefstrue 4421 \message{Cross reference values unknown; you must run TeX again.}%
5349 \message{Cross reference values unknown; you must run TeX again.}%
5350 \fi
5351 \fi 4422 \fi
5352 \fi 4423 \fi
5353 \else 4424 \else
5354 % It's defined, so just use it. 4425 % It's defined, so just use it.
5355 \csname X#1\endcsname 4426 \csname X#1\endcsname
5356 \fi 4427 \fi
5357 #2% Output the suffix in any case. 4428 #2% Output the suffix in any case.
5358 } 4429 }
5359 4430
5360 % This is the macro invoked by entries in the aux file. 4431 % This is the macro invoked by entries in the aux file.
5361 % 4432 %
5362 \def\xrdef#1{\begingroup 4433 \def\xrdef#1{\begingroup
5363 % Reenable \ as an escape while reading the second argument. 4434 % Reenable \ as an escape while reading the second argument.
5364 \catcode`\\ = 0 4435 \catcode`\\ = 0
5365 \afterassignment\endgroup 4436 \afterassignment\endgroup
5366 \expandafter\gdef\csname X#1\endcsname 4437 \expandafter\gdef\csname X#1\endcsname
5419 \catcode`\<=\other 4490 \catcode`\<=\other
5420 \catcode`\>=\other 4491 \catcode`\>=\other
5421 \catcode`\$=\other 4492 \catcode`\$=\other
5422 \catcode`\#=\other 4493 \catcode`\#=\other
5423 \catcode`\&=\other 4494 \catcode`\&=\other
5424 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off 4495 % `\+ does not work, so use 43.
4496 \catcode43=\other
5425 % Make the characters 128-255 be printing characters 4497 % Make the characters 128-255 be printing characters
5426 {% 4498 {%
5427 \count 1=128 4499 \count 1=128
5428 \def\loop{% 4500 \def\loop{%
5429 \catcode\count 1=\other 4501 \catcode\count 1=\other
5508 \rightskip\z@skip 4580 \rightskip\z@skip
5509 \spaceskip\z@skip 4581 \spaceskip\z@skip
5510 \xspaceskip\z@skip 4582 \xspaceskip\z@skip
5511 \parindent\defaultparindent 4583 \parindent\defaultparindent
5512 % 4584 %
5513 \smallfonts \rm
5514 %
5515 % Hang the footnote text off the number. 4585 % Hang the footnote text off the number.
5516 \hang 4586 \hang
5517 \textindent{\thisfootno}% 4587 \textindent{\thisfootno}%
5518 % 4588 %
5519 % Don't crash into the line above the footnote text. Since this 4589 % Don't crash into the line above the footnote text. Since this
5524 } 4594 }
5525 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t 4595 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
5526 \else\let\next\f@t\fi \next} 4596 \else\let\next\f@t\fi \next}
5527 \def\f@@t{\bgroup\aftergroup\@foot\let\next} 4597 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
5528 \def\f@t#1{#1\@foot} 4598 \def\f@t#1{#1\@foot}
5529 \def\@foot{\strut\par\egroup} 4599 \def\@foot{\strut\egroup}
5530 4600
5531 }%end \catcode `\@=11 4601 }%end \catcode `\@=11
5532 4602
5533 % Set the baselineskip to #1, and the lineskip and strut size 4603 % Set the baselineskip to #1, and the lineskip and strut size
5534 % correspondingly. There is no deep meaning behind these magic numbers 4604 % correspondingly. There is no deep meaning behind these magic numbers
5583 % 4653 %
5584 \def\finalout{\overfullrule=0pt} 4654 \def\finalout{\overfullrule=0pt}
5585 4655
5586 % @image. We use the macros from epsf.tex to support this. 4656 % @image. We use the macros from epsf.tex to support this.
5587 % If epsf.tex is not installed and @image is used, we complain. 4657 % If epsf.tex is not installed and @image is used, we complain.
5588 % 4658 %
5589 % Check for and read epsf.tex up front. If we read it only at @image 4659 % Check for and read epsf.tex up front. If we read it only at @image
5590 % time, we might be inside a group, and then its definitions would get 4660 % time, we might be inside a group, and then its definitions would get
5591 % undone and the next image would fail. 4661 % undone and the next image would fail.
5592 \openin 1 = epsf.tex 4662 \openin 1 = epsf.tex
5593 \ifeof 1 \else 4663 \ifeof 1 \else
5594 \closein 1 4664 \closein 1
5595 % Do not bother showing banner with post-v2.7 epsf.tex (available in 4665 \def\epsfannounce{\toks0 = }% do not bother showing banner
5596 % doc/epsf.tex until it shows up on ctan).
5597 \def\epsfannounce{\toks0 = }%
5598 \input epsf.tex 4666 \input epsf.tex
5599 \fi 4667 \fi
5600 % 4668 %
5601 % We will only complain once about lack of epsf.tex.
5602 \newif\ifwarnednoepsf 4669 \newif\ifwarnednoepsf
5603 \newhelp\noepsfhelp{epsf.tex must be installed for images to 4670 \newhelp\noepsfhelp{epsf.tex must be installed for images to
5604 work. It is also included in the Texinfo distribution, or you can get 4671 work. It is also included in the Texinfo distribution, or you can get
5605 it from ftp://tug.org/tex/epsf.tex.} 4672 it from ftp://ftp.tug.org/tex/epsf.tex.}
5606 % 4673 %
4674 % Only complain once about lack of epsf.tex.
5607 \def\image#1{% 4675 \def\image#1{%
5608 \ifx\epsfbox\undefined 4676 \ifx\epsfbox\undefined
5609 \ifwarnednoepsf \else 4677 \ifwarnednoepsf \else
5610 \errhelp = \noepsfhelp 4678 \errhelp = \noepsfhelp
5611 \errmessage{epsf.tex not found, images will be ignored}% 4679 \errmessage{epsf.tex not found, images will be ignored}%
5619 % Arguments to @image: 4687 % Arguments to @image:
5620 % #1 is (mandatory) image filename; we tack on .eps extension. 4688 % #1 is (mandatory) image filename; we tack on .eps extension.
5621 % #2 is (optional) width, #3 is (optional) height. 4689 % #2 is (optional) width, #3 is (optional) height.
5622 % #4 is just the usual extra ignored arg for parsing this stuff. 4690 % #4 is just the usual extra ignored arg for parsing this stuff.
5623 \def\imagexxx#1,#2,#3,#4\finish{% 4691 \def\imagexxx#1,#2,#3,#4\finish{%
5624 \ifpdf 4692 % \epsfbox itself resets \epsf?size at each figure.
5625 \centerline{\dopdfimage{#1}{#2}{#3}}% 4693 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
5626 \else 4694 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
5627 % \epsfbox itself resets \epsf?size at each figure. 4695 \epsfbox{#1.eps}%
5628 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi 4696 }
5629 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi 4697
5630 \begingroup 4698 % End of control word definitions.
5631 \catcode`\^^M = 5 % in case we're inside an example 4699
5632 % If the image is by itself, center it. 4700
5633 \ifvmode 4701 \message{and turning on texinfo input format.}
5634 \nobreak\bigskip 4702
5635 % Usually we'll have text after the image which will insert 4703 \def\openindices{%
5636 % \parskip glue, so insert it here too to equalize the space 4704 \newindex{cp}%
5637 % above and below. 4705 \newcodeindex{fn}%
5638 \nobreak\vskip\parskip 4706 \newcodeindex{vr}%
5639 \nobreak 4707 \newcodeindex{tp}%
5640 \centerline{\epsfbox{#1.eps}}% 4708 \newcodeindex{ky}%
5641 \bigbreak 4709 \newcodeindex{pg}%
5642 \else 4710 }
5643 % In the middle of a paragraph, no extra space. 4711
5644 \epsfbox{#1.eps}% 4712 % Set some numeric style parameters, for 8.5 x 11 format.
5645 \fi 4713
5646 \endgroup 4714 \hsize = 6in
5647 \fi 4715 \hoffset = .25in
5648 }
5649
5650
5651 \message{localization,}
5652 % and i18n.
5653
5654 % @documentlanguage is usually given very early, just after
5655 % @setfilename. If done too late, it may not override everything
5656 % properly. Single argument is the language abbreviation.
5657 % It would be nice if we could set up a hyphenation file here.
5658 %
5659 \def\documentlanguage{\parsearg\dodocumentlanguage}
5660 \def\dodocumentlanguage#1{%
5661 \tex % read txi-??.tex file in plain TeX.
5662 % Read the file if it exists.
5663 \openin 1 txi-#1.tex
5664 \ifeof1
5665 \errhelp = \nolanghelp
5666 \errmessage{Cannot read language file txi-#1.tex}%
5667 \let\temp = \relax
5668 \else
5669 \def\temp{\input txi-#1.tex }%
5670 \fi
5671 \temp
5672 \endgroup
5673 }
5674 \newhelp\nolanghelp{The given language definition file cannot be found or
5675 is empty. Maybe you need to install it? In the current directory
5676 should work if nowhere else does.}
5677
5678
5679 % @documentencoding should change something in TeX eventually, most
5680 % likely, but for now just recognize it.
5681 \let\documentencoding = \comment
5682
5683
5684 % Page size parameters.
5685 %
5686 \newdimen\defaultparindent \defaultparindent = 15pt 4716 \newdimen\defaultparindent \defaultparindent = 15pt
4717 \parindent = \defaultparindent
4718 \parskip 3pt plus 2pt minus 1pt
4719 \setleading{13.2pt}
4720 \advance\topskip by 1.2cm
5687 4721
5688 \chapheadingskip = 15pt plus 4pt minus 2pt 4722 \chapheadingskip = 15pt plus 4pt minus 2pt
5689 \secheadingskip = 12pt plus 3pt minus 2pt 4723 \secheadingskip = 12pt plus 3pt minus 2pt
5690 \subsecheadingskip = 9pt plus 2pt minus 2pt 4724 \subsecheadingskip = 9pt plus 2pt minus 2pt
5691 4725
5692 % Prevent underfull vbox error messages. 4726 % Prevent underfull vbox error messages.
5693 \vbadness = 10000 4727 \vbadness=10000
5694
5695 % Don't be so finicky about underfull hboxes, either.
5696 \hbadness = 2000
5697 4728
5698 % Following George Bush, just get rid of widows and orphans. 4729 % Following George Bush, just get rid of widows and orphans.
5699 \widowpenalty=10000 4730 \widowpenalty=10000
5700 \clubpenalty=10000 4731 \clubpenalty=10000
5701 4732
5702 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're 4733 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
5703 % using an old version of TeX, don't do anything. We want the amount of 4734 % using an old version of TeX, don't do anything. We want the amount of
5704 % stretch added to depend on the line length, hence the dependence on 4735 % stretch added to depend on the line length, hence the dependence on
5705 % \hsize. We call this whenever the paper size is set. 4736 % \hsize. This makes it come to about 9pt for the 8.5x11 format.
5706 % 4737 %
5707 \def\setemergencystretch{% 4738 \ifx\emergencystretch\thisisundefined
5708 \ifx\emergencystretch\thisisundefined 4739 % Allow us to assign to \emergencystretch anyway.
5709 % Allow us to assign to \emergencystretch anyway. 4740 \def\emergencystretch{\dimen0}%
5710 \def\emergencystretch{\dimen0}% 4741 \else
5711 \else 4742 \emergencystretch = \hsize
5712 \emergencystretch = .15\hsize 4743 \divide\emergencystretch by 45
5713 \fi 4744 \fi
5714 } 4745
5715 4746 % Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25)
5716 % Parameters in order: 1) textheight; 2) textwidth; 3) voffset; 4747 \def\smallbook{
5717 % 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can 4748 \global\chapheadingskip = 15pt plus 4pt minus 2pt
5718 % set \parskip and call \setleading for \baselineskip. 4749 \global\secheadingskip = 12pt plus 3pt minus 2pt
5719 % 4750 \global\subsecheadingskip = 9pt plus 2pt minus 2pt
5720 \def\internalpagesizes#1#2#3#4#5#6{% 4751 %
5721 \voffset = #3\relax 4752 \global\lispnarrowing = 0.3in
5722 \topskip = #6\relax 4753 \setleading{12pt}
5723 \splittopskip = \topskip 4754 \advance\topskip by -1cm
5724 % 4755 \global\parskip 2pt plus 1pt
5725 \vsize = #1\relax 4756 \global\hsize = 5in
5726 \advance\vsize by \topskip 4757 \global\vsize=7.5in
5727 \outervsize = \vsize 4758 \global\tolerance=700
5728 \advance\outervsize by 2\topandbottommargin 4759 \global\hfuzz=1pt
5729 \pageheight = \vsize 4760 \global\contentsrightmargin=0pt
5730 % 4761 \global\deftypemargin=0pt
5731 \hsize = #2\relax 4762 \global\defbodyindent=.5cm
5732 \outerhsize = \hsize 4763 %
5733 \advance\outerhsize by 0.5in 4764 \global\pagewidth=\hsize
5734 \pagewidth = \hsize 4765 \global\pageheight=\vsize
5735 % 4766 %
5736 \normaloffset = #4\relax 4767 \global\let\smalllisp=\smalllispx
5737 \bindingoffset = #5\relax 4768 \global\let\smallexample=\smalllispx
5738 % 4769 \global\def\Esmallexample{\Esmalllisp}
5739 \parindent = \defaultparindent 4770 }
5740 \setemergencystretch
5741 }
5742
5743 % @letterpaper (the default).
5744 \def\letterpaper{{\globaldefs = 1
5745 \parskip = 3pt plus 2pt minus 1pt
5746 \setleading{13.2pt}%
5747 %
5748 % If page is nothing but text, make it come out even.
5749 \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}%
5750 }}
5751
5752 % Use @smallbook to reset parameters for 7x9.5 (or so) format.
5753 \def\smallbook{{\globaldefs = 1
5754 \parskip = 2pt plus 1pt
5755 \setleading{12pt}%
5756 %
5757 \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}%
5758 %
5759 \lispnarrowing = 0.3in
5760 \tolerance = 700
5761 \hfuzz = 1pt
5762 \contentsrightmargin = 0pt
5763 \deftypemargin = 0pt
5764 \defbodyindent = .5cm
5765 %
5766 \let\smalldisplay = \smalldisplayx
5767 \let\smallexample = \smalllispx
5768 \let\smallformat = \smallformatx
5769 \let\smalllisp = \smalllispx
5770 }}
5771 4771
5772 % Use @afourpaper to print on European A4 paper. 4772 % Use @afourpaper to print on European A4 paper.
5773 \def\afourpaper{{\globaldefs = 1 4773 \def\afourpaper{
5774 \setleading{12pt}% 4774 \global\tolerance=700
5775 \parskip = 3pt plus 2pt minus 1pt 4775 \global\hfuzz=1pt
5776 % 4776 \setleading{12pt}
5777 \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}% 4777 \global\parskip 15pt plus 1pt
5778 % 4778
5779 \tolerance = 700 4779 \global\vsize= 53\baselineskip
5780 \hfuzz = 1pt 4780 \advance\vsize by \topskip
5781 }} 4781 %\global\hsize= 5.85in % A4 wide 10pt
4782 \global\hsize= 6.5in
4783 \global\outerhsize=\hsize
4784 \global\advance\outerhsize by 0.5in
4785 \global\outervsize=\vsize
4786 \global\advance\outervsize by 0.6in
4787
4788 \global\pagewidth=\hsize
4789 \global\pageheight=\vsize
4790 }
4791
4792 \bindingoffset=0pt
4793 \normaloffset=\hoffset
4794 \pagewidth=\hsize
4795 \pageheight=\vsize
4796
4797 % Allow control of the text dimensions. Parameters in order: textheight;
4798 % textwidth; voffset; hoffset; binding offset; topskip.
4799 % All require a dimension;
4800 % header is additional; added length extends the bottom of the page.
4801
4802 \def\changepagesizes#1#2#3#4#5#6{
4803 \global\vsize= #1
4804 \global\topskip= #6
4805 \advance\vsize by \topskip
4806 \global\voffset= #3
4807 \global\hsize= #2
4808 \global\outerhsize=\hsize
4809 \global\advance\outerhsize by 0.5in
4810 \global\outervsize=\vsize
4811 \global\advance\outervsize by 0.6in
4812 \global\pagewidth=\hsize
4813 \global\pageheight=\vsize
4814 \global\normaloffset= #4
4815 \global\bindingoffset= #5}
5782 4816
5783 % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin 4817 % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
5784 % 29mm, hence bottom margin 28mm, nominal side margin 3cm. 4818 % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
5785 \def\afourlatex{{\globaldefs = 1 4819 \def\afourlatex
5786 \setleading{13.6pt}% 4820 {\global\tolerance=700
5787 % 4821 \global\hfuzz=1pt
5788 \afourpaper 4822 \setleading{12pt}
5789 \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}% 4823 \global\parskip 15pt plus 1pt
5790 % 4824 \advance\baselineskip by 1.6pt
5791 \globaldefs = 0 4825 \changepagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}
5792 }} 4826 }
5793 4827
5794 % Use @afourwide to print on European A4 paper in wide format. 4828 % Use @afourwide to print on European A4 paper in wide format.
5795 \def\afourwide{% 4829 \def\afourwide{\afourpaper
5796 \afourpaper 4830 \changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}}
5797 \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
5798 %
5799 \globaldefs = 0
5800 }
5801
5802 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
5803 % Perhaps we should allow setting the margins, \topskip, \parskip,
5804 % and/or leading, also. Or perhaps we should compute them somehow.
5805 %
5806 \def\pagesizes{\parsearg\pagesizesxxx}
5807 \def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
5808 \def\pagesizesyyy#1,#2,#3\finish{{%
5809 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
5810 \globaldefs = 1
5811 %
5812 \parskip = 3pt plus 2pt minus 1pt
5813 \setleading{13.2pt}%
5814 %
5815 \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}%
5816 }}
5817
5818 % Set default to letter.
5819 %
5820 \letterpaper
5821
5822
5823 \message{and turning on texinfo input format.}
5824 4831
5825 % Define macros to output various characters with catcode for normal text. 4832 % Define macros to output various characters with catcode for normal text.
5826 \catcode`\"=\other 4833 \catcode`\"=\other
5827 \catcode`\~=\other 4834 \catcode`\~=\other
5828 \catcode`\^=\other 4835 \catcode`\^=\other
5829 \catcode`\_=\other 4836 \catcode`\_=\other
5830 \catcode`\|=\other 4837 \catcode`\|=\other
5831 \catcode`\<=\other 4838 \catcode`\<=\other
5832 \catcode`\>=\other 4839 \catcode`\>=\other
5833 \catcode`\+=\other 4840 \catcode`\+=\other
5834 \catcode`\$=\other
5835 \def\normaldoublequote{"} 4841 \def\normaldoublequote{"}
5836 \def\normaltilde{~} 4842 \def\normaltilde{~}
5837 \def\normalcaret{^} 4843 \def\normalcaret{^}
5838 \def\normalunderscore{_} 4844 \def\normalunderscore{_}
5839 \def\normalverticalbar{|} 4845 \def\normalverticalbar{|}
5840 \def\normalless{<} 4846 \def\normalless{<}
5841 \def\normalgreater{>} 4847 \def\normalgreater{>}
5842 \def\normalplus{+} 4848 \def\normalplus{+}
5843 \def\normaldollar{$}
5844 4849
5845 % This macro is used to make a character print one way in ttfont 4850 % This macro is used to make a character print one way in ttfont
5846 % where it can probably just be output, and another way in other fonts, 4851 % where it can probably just be output, and another way in other fonts,
5847 % where something hairier probably needs to be done. 4852 % where something hairier probably needs to be done.
5848 % 4853 %
5849 % #1 is what to print if we are indeed using \tt; #2 is what to print 4854 % #1 is what to print if we are indeed using \tt; #2 is what to print
5850 % otherwise. Since all the Computer Modern typewriter fonts have zero 4855 % otherwise. Since all the Computer Modern typewriter fonts have zero
5851 % interword stretch (and shrink), and it is reasonable to expect all 4856 % interword stretch (and shrink), and it is reasonable to expect all
5852 % typewriter fonts to have this, we can check that font parameter. 4857 % typewriter fonts to have this, we can check that font parameter.
5853 % 4858 %
5854 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} 4859 \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
5855
5856 % Same as above, but check for italic font. Actually this also catches
5857 % non-italic slanted fonts since it is impossible to distinguish them from
5858 % italic fonts. But since this is only used by $ and it uses \sl anyway
5859 % this is not a problem.
5860 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
5861 4860
5862 % Turn off all special characters except @ 4861 % Turn off all special characters except @
5863 % (and those which the user can use as if they were ordinary). 4862 % (and those which the user can use as if they were ordinary).
5864 % Most of these we simply print from the \tt font, but for some, we can 4863 % Most of these we simply print from the \tt font, but for some, we can
5865 % use math or other variants that look better in normal text. 4864 % use math or other variants that look better in normal text.
5866 4865
5867 \catcode`\"=\active 4866 \catcode`\"=\active
5868 \def\activedoublequote{{\tt\char34}} 4867 \def\activedoublequote{{\tt \char '042}}
5869 \let"=\activedoublequote 4868 \let"=\activedoublequote
5870 \catcode`\~=\active 4869 \catcode`\~=\active
5871 \def~{{\tt\char126}} 4870 \def~{{\tt \char '176}}
5872 \chardef\hat=`\^ 4871 \chardef\hat=`\^
5873 \catcode`\^=\active 4872 \catcode`\^=\active
5874 \def^{{\tt \hat}} 4873 \def^{{\tt \hat}}
5875 4874
5876 \catcode`\_=\active 4875 \catcode`\_=\active
5877 \def_{\ifusingtt\normalunderscore\_} 4876 \def_{\ifusingtt\normalunderscore\_}
5878 % Subroutine for the previous macro. 4877 % Subroutine for the previous macro.
5879 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} 4878 \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
5880 4879
5881 \catcode`\|=\active 4880 \catcode`\|=\active
5882 \def|{{\tt\char124}} 4881 \def|{{\tt \char '174}}
5883 \chardef \less=`\< 4882 \chardef \less=`\<
5884 \catcode`\<=\active 4883 \catcode`\<=\active
5885 \def<{{\tt \less}} 4884 \def<{{\tt \less}}
5886 \chardef \gtr=`\> 4885 \chardef \gtr=`\>
5887 \catcode`\>=\active 4886 \catcode`\>=\active
5888 \def>{{\tt \gtr}} 4887 \def>{{\tt \gtr}}
5889 \catcode`\+=\active 4888 \catcode`\+=\active
5890 \def+{{\tt \char 43}} 4889 \def+{{\tt \char 43}}
5891 \catcode`\$=\active
5892 \def${\ifusingit{{\sl\$}}\normaldollar}
5893 %\catcode 27=\active 4890 %\catcode 27=\active
5894 %\def^^[{$\diamondsuit$} 4891 %\def^^[{$\diamondsuit$}
5895 4892
5896 % Set up an active definition for =, but don't enable it most of the time. 4893 % Set up an active definition for =, but don't enable it most of the time.
5897 {\catcode`\==\active 4894 {\catcode`\==\active
5917 {\catcode`\\=\active 4914 {\catcode`\\=\active
5918 @gdef@rawbackslash{@let\=@rawbackslashxx }} 4915 @gdef@rawbackslash{@let\=@rawbackslashxx }}
5919 4916
5920 % \normalbackslash outputs one backslash in fixed width font. 4917 % \normalbackslash outputs one backslash in fixed width font.
5921 \def\normalbackslash{{\tt\rawbackslashxx}} 4918 \def\normalbackslash{{\tt\rawbackslashxx}}
4919
4920 % Say @foo, not \foo, in error messages.
4921 \escapechar=`\@
5922 4922
5923 % \catcode 17=0 % Define control-q 4923 % \catcode 17=0 % Define control-q
5924 \catcode`\\=\active 4924 \catcode`\\=\active
5925 4925
5926 % Used sometimes to turn off (effectively) the active characters 4926 % Used sometimes to turn off (effectively) the active characters
5931 @let^=@normalcaret 4931 @let^=@normalcaret
5932 @let_=@normalunderscore 4932 @let_=@normalunderscore
5933 @let|=@normalverticalbar 4933 @let|=@normalverticalbar
5934 @let<=@normalless 4934 @let<=@normalless
5935 @let>=@normalgreater 4935 @let>=@normalgreater
5936 @let+=@normalplus 4936 @let+=@normalplus}
5937 @let$=@normaldollar}
5938 4937
5939 @def@normalturnoffactive{@let"=@normaldoublequote 4938 @def@normalturnoffactive{@let"=@normaldoublequote
5940 @let\=@normalbackslash 4939 @let\=@normalbackslash
5941 @let~=@normaltilde 4940 @let~=@normaltilde
5942 @let^=@normalcaret 4941 @let^=@normalcaret
5943 @let_=@normalunderscore 4942 @let_=@normalunderscore
5944 @let|=@normalverticalbar 4943 @let|=@normalverticalbar
5945 @let<=@normalless 4944 @let<=@normalless
5946 @let>=@normalgreater 4945 @let>=@normalgreater
5947 @let+=@normalplus 4946 @let+=@normalplus}
5948 @let$=@normaldollar}
5949 4947
5950 % Make _ and + \other characters, temporarily. 4948 % Make _ and + \other characters, temporarily.
5951 % This is canceled by @fixbackslash. 4949 % This is canceled by @fixbackslash.
5952 @otherifyactive 4950 @otherifyactive
5953 4951
5962 % the first `\{ in the file would cause an error. This macro tries to fix 4960 % the first `\{ in the file would cause an error. This macro tries to fix
5963 % that, assuming it is called before the first `\' could plausibly occur. 4961 % that, assuming it is called before the first `\' could plausibly occur.
5964 % Also back turn on active characters that might appear in the input 4962 % Also back turn on active characters that might appear in the input
5965 % file name, in case not using a pre-dumped format. 4963 % file name, in case not using a pre-dumped format.
5966 % 4964 %
5967 @gdef@fixbackslash{% 4965 @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
5968 @ifx\@eatinput @let\ = @normalbackslash @fi 4966 @catcode`+=@active @catcode`@_=@active}
5969 @catcode`+=@active 4967
5970 @catcode`@_=@active 4968 %% These look ok in all fonts, so just make them not special. The @rm below
5971 } 4969 %% makes sure that the current font starts out as the newly loaded cmr10
5972 4970 @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
5973 % Say @foo, not \foo, in error messages. 4971
5974 @escapechar = `@@
5975
5976 % These look ok in all fonts, so just make them not special.
5977 @catcode`@& = @other
5978 @catcode`@# = @other
5979 @catcode`@% = @other
5980
5981 @c Set initial fonts.
5982 @textfonts 4972 @textfonts
5983 @rm 4973 @rm
5984 4974
5985
5986 @c Local variables: 4975 @c Local variables:
5987 @c eval: (add-hook 'write-file-hooks 'time-stamp)
5988 @c page-delimiter: "^\\\\message" 4976 @c page-delimiter: "^\\\\message"
5989 @c time-stamp-start: "def\\\\texinfoversion{"
5990 @c time-stamp-format: "%:y-%02m-%02d.%02H"
5991 @c time-stamp-end: "}"
5992 @c End: 4977 @c End: