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