comparison man/texinfo.tex @ 398:74fd4e045ea6 r21-2-29

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