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