3 |
% Load plain if necessary, i.e., if running under initex. |
% Load plain if necessary, i.e., if running under initex. |
4 |
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi |
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi |
5 |
% |
% |
6 |
\def\texinfoversion{1999-03-31.13}% |
\def\texinfoversion{2004-11-25.16} |
7 |
% |
% |
8 |
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 |
% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, |
9 |
% Free Software Foundation, Inc. |
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software |
10 |
|
% Foundation, Inc. |
11 |
% |
% |
12 |
% This texinfo.tex file is free software; you can redistribute it and/or |
% This texinfo.tex file is free software; you can redistribute it and/or |
13 |
% modify it under the terms of the GNU General Public License as |
% modify it under the terms of the GNU General Public License as |
21 |
% |
% |
22 |
% You should have received a copy of the GNU General Public License |
% You should have received a copy of the GNU General Public License |
23 |
% along with this texinfo.tex file; see the file COPYING. If not, write |
% along with this texinfo.tex file; see the file COPYING. If not, write |
24 |
% to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
25 |
% Boston, MA 02110-1301 USA. |
% Boston, MA 02111-1307, USA. |
26 |
% |
% |
27 |
% In other words, you are welcome to use, share and improve this program. |
% As a special exception, when this file is read by TeX when processing |
28 |
% You are forbidden to forbid anyone else to use, share and improve |
% a Texinfo source document, you may use the result without |
29 |
% what you give them. Help stamp out software-hoarding! |
% restriction. (This has been our intent since Texinfo was invented.) |
30 |
% |
% |
31 |
% Please try the latest version of texinfo.tex before submitting bug |
% Please try the latest version of texinfo.tex before submitting bug |
32 |
% reports; you can get the latest version from: |
% reports; you can get the latest version from: |
33 |
% ftp://ftp.gnu.org/pub/gnu/texinfo.tex |
% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or |
|
% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) |
|
34 |
% ftp://tug.org/tex/texinfo.tex |
% ftp://tug.org/tex/texinfo.tex |
35 |
% ftp://ctan.org/macros/texinfo/texinfo.tex |
% (and all CTAN mirrors, see http://www.ctan.org). |
36 |
% (and all CTAN mirrors, finger ctan@ctan.org for a list). |
% The texinfo.tex in any given distribution could well be out |
|
% /home/gd/gnu/doc/texinfo.tex on the GNU machines. |
|
|
% The texinfo.tex in any given Texinfo distribution could well be out |
|
37 |
% of date, so if that's what you're using, please check. |
% of date, so if that's what you're using, please check. |
|
% There is a small home page for Texinfo at http://texinfo.org/. |
|
38 |
% |
% |
39 |
% Send bug reports to bug-texinfo@gnu.org. Please include including a |
% Send bug reports to bug-texinfo@gnu.org. Please include including a |
40 |
% complete document in each bug report with which we can reproduce the |
% complete document in each bug report with which we can reproduce the |
47 |
% texindex foo.?? |
% texindex foo.?? |
48 |
% tex foo.texi |
% tex foo.texi |
49 |
% tex foo.texi |
% tex foo.texi |
50 |
% dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps. |
% dvips foo.dvi -o # or whatever; this makes foo.ps. |
51 |
% The extra runs of TeX get the cross-reference information correct. |
% The extra TeX runs get the cross-reference information correct. |
52 |
% Sometimes one run after texindex suffices, and sometimes you need more |
% Sometimes one run after texindex suffices, and sometimes you need more |
53 |
% than two; texi2dvi does it as many times as necessary. |
% than two; texi2dvi does it as many times as necessary. |
54 |
% |
% |
55 |
% It is possible to adapt texinfo.tex for other languages. You can get |
% It is possible to adapt texinfo.tex for other languages, to some |
56 |
% the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/. |
% extent. You can get the existing language-specific files from the |
57 |
|
% full Texinfo distribution. |
58 |
|
% |
59 |
|
% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. |
60 |
|
|
61 |
|
|
62 |
\message{Loading texinfo [version \texinfoversion]:} |
\message{Loading texinfo [version \texinfoversion]:} |
63 |
|
|
67 |
\everyjob{\message{[Texinfo version \texinfoversion]}% |
\everyjob{\message{[Texinfo version \texinfoversion]}% |
68 |
\catcode`+=\active \catcode`\_=\active} |
\catcode`+=\active \catcode`\_=\active} |
69 |
|
|
70 |
% Save some parts of plain tex whose names we will redefine. |
\message{Basics,} |
71 |
|
\chardef\other=12 |
72 |
|
|
73 |
|
% We never want plain's \outer definition of \+ in Texinfo. |
74 |
|
% For @tex, we can use \tabalign. |
75 |
|
\let\+ = \relax |
76 |
|
|
77 |
|
% Save some plain tex macros whose names we will redefine. |
78 |
\let\ptexb=\b |
\let\ptexb=\b |
79 |
\let\ptexbullet=\bullet |
\let\ptexbullet=\bullet |
80 |
\let\ptexc=\c |
\let\ptexc=\c |
84 |
\let\ptexend=\end |
\let\ptexend=\end |
85 |
\let\ptexequiv=\equiv |
\let\ptexequiv=\equiv |
86 |
\let\ptexexclam=\! |
\let\ptexexclam=\! |
87 |
|
\let\ptexfootnote=\footnote |
88 |
|
\let\ptexgtr=> |
89 |
|
\let\ptexhat=^ |
90 |
\let\ptexi=\i |
\let\ptexi=\i |
91 |
|
\let\ptexindent=\indent |
92 |
|
\let\ptexinsert=\insert |
93 |
\let\ptexlbrace=\{ |
\let\ptexlbrace=\{ |
94 |
|
\let\ptexless=< |
95 |
|
\let\ptexnewwrite\newwrite |
96 |
|
\let\ptexnoindent=\noindent |
97 |
|
\let\ptexplus=+ |
98 |
\let\ptexrbrace=\} |
\let\ptexrbrace=\} |
99 |
|
\let\ptexslash=\/ |
100 |
\let\ptexstar=\* |
\let\ptexstar=\* |
101 |
\let\ptext=\t |
\let\ptext=\t |
102 |
|
|
|
% We never want plain's outer \+ definition in Texinfo. |
|
|
% For @tex, we can use \tabalign. |
|
|
\let\+ = \relax |
|
|
|
|
|
|
|
|
\message{Basics,} |
|
|
\chardef\other=12 |
|
|
|
|
103 |
% If this character appears in an error message or help string, it |
% If this character appears in an error message or help string, it |
104 |
% starts a new line in the output. |
% starts a new line in the output. |
105 |
\newlinechar = `^^J |
\newlinechar = `^^J |
106 |
|
|
107 |
|
% Use TeX 3.0's \inputlineno to get the line number, for better error |
108 |
|
% messages, but if we're using an old version of TeX, don't do anything. |
109 |
|
% |
110 |
|
\ifx\inputlineno\thisisundefined |
111 |
|
\let\linenumber = \empty % Pre-3.0. |
112 |
|
\else |
113 |
|
\def\linenumber{l.\the\inputlineno:\space} |
114 |
|
\fi |
115 |
|
|
116 |
% Set up fixed words for English if not already set. |
% Set up fixed words for English if not already set. |
117 |
\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi |
\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi |
118 |
\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi |
\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi |
151 |
\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi |
\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi |
152 |
\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi |
\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi |
153 |
\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi |
\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi |
|
\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi |
|
154 |
\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi |
\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi |
155 |
\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi |
|
156 |
|
% In some macros, we cannot use the `\? notation---the left quote is |
157 |
|
% in some cases the escape char. |
158 |
|
\chardef\colonChar = `\: |
159 |
|
\chardef\commaChar = `\, |
160 |
|
\chardef\dotChar = `\. |
161 |
|
\chardef\exclamChar= `\! |
162 |
|
\chardef\questChar = `\? |
163 |
|
\chardef\semiChar = `\; |
164 |
|
\chardef\underChar = `\_ |
165 |
|
|
166 |
|
\chardef\spaceChar = `\ % |
167 |
|
\chardef\spacecat = 10 |
168 |
|
\def\spaceisspace{\catcode\spaceChar=\spacecat} |
169 |
|
|
170 |
% Ignore a token. |
% Ignore a token. |
171 |
% |
% |
172 |
\def\gobble#1{} |
\def\gobble#1{} |
173 |
|
|
174 |
\hyphenation{ap-pen-dix} |
% The following is used inside several \edef's. |
175 |
\hyphenation{mini-buf-fer mini-buf-fers} |
\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} |
176 |
\hyphenation{eshell} |
|
177 |
\hyphenation{white-space} |
% Hyphenation fixes. |
178 |
|
\hyphenation{ |
179 |
|
Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script |
180 |
|
ap-pen-dix bit-map bit-maps |
181 |
|
data-base data-bases eshell fall-ing half-way long-est man-u-script |
182 |
|
man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm |
183 |
|
par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces |
184 |
|
spell-ing spell-ings |
185 |
|
stand-alone strong-est time-stamp time-stamps which-ever white-space |
186 |
|
wide-spread wrap-around |
187 |
|
} |
188 |
|
|
189 |
% Margin to add to right of even pages, to left of odd pages. |
% Margin to add to right of even pages, to left of odd pages. |
190 |
\newdimen \bindingoffset |
\newdimen\bindingoffset |
191 |
\newdimen \normaloffset |
\newdimen\normaloffset |
192 |
\newdimen\pagewidth \newdimen\pageheight |
\newdimen\pagewidth \newdimen\pageheight |
193 |
|
|
194 |
|
% For a final copy, take out the rectangles |
195 |
|
% that mark overfull boxes (in case you have decided |
196 |
|
% that the text looks ok even though it passes the margin). |
197 |
|
% |
198 |
|
\def\finalout{\overfullrule=0pt} |
199 |
|
|
200 |
|
% @| inserts a changebar to the left of the current line. It should |
201 |
|
% surround any changed text. This approach does *not* work if the |
202 |
|
% change spans more than two lines of output. To handle that, we would |
203 |
|
% have adopt a much more difficult approach (putting marks into the main |
204 |
|
% vertical list for the beginning and end of each change). |
205 |
|
% |
206 |
|
\def\|{% |
207 |
|
% \vadjust can only be used in horizontal mode. |
208 |
|
\leavevmode |
209 |
|
% |
210 |
|
% Append this vertical mode material after the current line in the output. |
211 |
|
\vadjust{% |
212 |
|
% We want to insert a rule with the height and depth of the current |
213 |
|
% leading; that is exactly what \strutbox is supposed to record. |
214 |
|
\vskip-\baselineskip |
215 |
|
% |
216 |
|
% \vadjust-items are inserted at the left edge of the type. So |
217 |
|
% the \llap here moves out into the left-hand margin. |
218 |
|
\llap{% |
219 |
|
% |
220 |
|
% For a thicker or thinner bar, change the `1pt'. |
221 |
|
\vrule height\baselineskip width1pt |
222 |
|
% |
223 |
|
% This is the space between the bar and the text. |
224 |
|
\hskip 12pt |
225 |
|
}% |
226 |
|
}% |
227 |
|
} |
228 |
|
|
229 |
% Sometimes it is convenient to have everything in the transcript file |
% Sometimes it is convenient to have everything in the transcript file |
230 |
% and nothing on the terminal. We don't just call \tracingall here, |
% and nothing on the terminal. We don't just call \tracingall here, |
231 |
% since that produces some useless output on the terminal. |
% since that produces some useless output on the terminal. We also make |
232 |
|
% some effort to order the tracing commands to reduce output in the log |
233 |
|
% file; cf. trace.sty in LaTeX. |
234 |
% |
% |
235 |
\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% |
\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% |
236 |
\ifx\eTeXversion\undefined |
\def\loggingall{% |
237 |
\def\loggingall{\tracingcommands2 \tracingstats2 |
\tracingstats2 |
238 |
\tracingpages1 \tracingoutput1 \tracinglostchars1 |
\tracingpages1 |
239 |
\tracingmacros2 \tracingparagraphs1 \tracingrestores1 |
\tracinglostchars2 % 2 gives us more in etex |
240 |
\showboxbreadth\maxdimen\showboxdepth\maxdimen |
\tracingparagraphs1 |
241 |
}% |
\tracingoutput1 |
242 |
\else |
\tracingmacros2 |
243 |
\def\loggingall{\tracingcommands3 \tracingstats2 |
\tracingrestores1 |
244 |
\tracingpages1 \tracingoutput1 \tracinglostchars1 |
\showboxbreadth\maxdimen \showboxdepth\maxdimen |
245 |
\tracingmacros2 \tracingparagraphs1 \tracingrestores1 |
\ifx\eTeXversion\undefined\else % etex gives us more logging |
246 |
\tracingscantokens1 \tracingassigns1 \tracingifs1 |
\tracingscantokens1 |
247 |
\tracinggroups1 \tracingnesting2 |
\tracingifs1 |
248 |
\showboxbreadth\maxdimen\showboxdepth\maxdimen |
\tracinggroups1 |
249 |
|
\tracingnesting2 |
250 |
|
\tracingassigns1 |
251 |
|
\fi |
252 |
|
\tracingcommands3 % 3 gives us more in etex |
253 |
|
\errorcontextlines16 |
254 |
}% |
}% |
255 |
\fi |
|
256 |
|
% add check for \lastpenalty to plain's definitions. If the last thing |
257 |
|
% we did was a \nobreak, we don't want to insert more space. |
258 |
|
% |
259 |
|
\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount |
260 |
|
\removelastskip\penalty-50\smallskip\fi\fi} |
261 |
|
\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount |
262 |
|
\removelastskip\penalty-100\medskip\fi\fi} |
263 |
|
\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount |
264 |
|
\removelastskip\penalty-200\bigskip\fi\fi} |
265 |
|
|
266 |
% For @cropmarks command. |
% For @cropmarks command. |
267 |
% Do @cropmarks to get crop marks. |
% Do @cropmarks to get crop marks. |
307 |
\normalturnoffactive % \ in index entries must not stay \, e.g., if |
\normalturnoffactive % \ in index entries must not stay \, e.g., if |
308 |
% the page break happens to be in the middle of an example. |
% the page break happens to be in the middle of an example. |
309 |
\shipout\vbox{% |
\shipout\vbox{% |
310 |
|
% Do this early so pdf references go to the beginning of the page. |
311 |
|
\ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi |
312 |
|
% |
313 |
\ifcropmarks \vbox to \outervsize\bgroup |
\ifcropmarks \vbox to \outervsize\bgroup |
314 |
\hsize = \outerhsize |
\hsize = \outerhsize |
315 |
\vskip-\topandbottommargin |
\vskip-\topandbottommargin |
356 |
\egroup % \vbox from first cropmarks clause |
\egroup % \vbox from first cropmarks clause |
357 |
\fi |
\fi |
358 |
}% end of \shipout\vbox |
}% end of \shipout\vbox |
359 |
}% end of group with \turnoffactive |
}% end of group with \normalturnoffactive |
360 |
\advancepageno |
\advancepageno |
361 |
\ifnum\outputpenalty>-20000 \else\dosupereject\fi |
\ifnum\outputpenalty>-20000 \else\dosupereject\fi |
362 |
} |
} |
389 |
% the input line (except we remove a trailing comment). #1 should be a |
% the input line (except we remove a trailing comment). #1 should be a |
390 |
% macro which expects an ordinary undelimited TeX argument. |
% macro which expects an ordinary undelimited TeX argument. |
391 |
% |
% |
392 |
\def\parsearg#1{% |
\def\parsearg{\parseargusing{}} |
393 |
\let\next = #1% |
\def\parseargusing#1#2{% |
394 |
|
\def\next{#2}% |
395 |
\begingroup |
\begingroup |
396 |
\obeylines |
\obeylines |
397 |
\futurelet\temp\parseargx |
\spaceisspace |
398 |
} |
#1% |
399 |
|
\parseargline\empty% Insert the \empty token, see \finishparsearg below. |
|
% If the next token is an obeyed space (from an @example environment or |
|
|
% the like), remove it and recurse. Otherwise, we're done. |
|
|
\def\parseargx{% |
|
|
% \obeyedspace is defined far below, after the definition of \sepspaces. |
|
|
\ifx\obeyedspace\temp |
|
|
\expandafter\parseargdiscardspace |
|
|
\else |
|
|
\expandafter\parseargline |
|
|
\fi |
|
400 |
} |
} |
401 |
|
|
|
% Remove a single space (as the delimiter token to the macro call). |
|
|
{\obeyspaces % |
|
|
\gdef\parseargdiscardspace {\futurelet\temp\parseargx}} |
|
|
|
|
402 |
{\obeylines % |
{\obeylines % |
403 |
\gdef\parseargline#1^^M{% |
\gdef\parseargline#1^^M{% |
404 |
\endgroup % End of the group started in \parsearg. |
\endgroup % End of the group started in \parsearg. |
405 |
% |
\argremovecomment #1\comment\ArgTerm% |
|
% First remove any @c comment, then any @comment. |
|
|
% Result of each macro is put in \toks0. |
|
|
\argremovec #1\c\relax % |
|
|
\expandafter\argremovecomment \the\toks0 \comment\relax % |
|
|
% |
|
|
% Call the caller's macro, saved as \next in \parsearg. |
|
|
\expandafter\next\expandafter{\the\toks0}% |
|
406 |
}% |
}% |
407 |
} |
} |
408 |
|
|
409 |
% Since all \c{,omment} does is throw away the argument, we can let TeX |
% First remove any @comment, then any @c comment. |
410 |
% do that for us. The \relax here is matched by the \relax in the call |
\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} |
411 |
% in \parseargline; it could be more or less anything, its purpose is |
\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} |
|
% just to delimit the argument to the \c. |
|
|
\def\argremovec#1\c#2\relax{\toks0 = {#1}} |
|
|
\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} |
|
412 |
|
|
413 |
% \argremovec{,omment} might leave us with trailing spaces, though; e.g., |
% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space. |
414 |
|
% |
415 |
|
% \argremovec might leave us with trailing space, e.g., |
416 |
% @end itemize @c foo |
% @end itemize @c foo |
417 |
% will have two active spaces as part of the argument with the |
% This space token undergoes the same procedure and is eventually removed |
418 |
% `itemize'. Here we remove all active spaces from #1, and assign the |
% by \finishparsearg. |
|
% result to \toks0. |
|
|
% |
|
|
% This loses if there are any *other* active characters besides spaces |
|
|
% in the argument -- _ ^ +, for example -- since they get expanded. |
|
|
% Fortunately, Texinfo does not define any such commands. (If it ever |
|
|
% does, the catcode of the characters in questionwill have to be changed |
|
|
% here.) But this means we cannot call \removeactivespaces as part of |
|
|
% \argremovec{,omment}, since @c uses \parsearg, and thus the argument |
|
|
% that \parsearg gets might well have any character at all in it. |
|
419 |
% |
% |
420 |
\def\removeactivespaces#1{% |
\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} |
421 |
\begingroup |
\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} |
422 |
\ignoreactivespaces |
\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% |
423 |
\edef\temp{#1}% |
\def\temp{#3}% |
424 |
\global\toks0 = \expandafter{\temp}% |
\ifx\temp\empty |
425 |
\endgroup |
% We cannot use \next here, as it holds the macro to run; |
426 |
|
% thus we reuse \temp. |
427 |
|
\let\temp\finishparsearg |
428 |
|
\else |
429 |
|
\let\temp\argcheckspaces |
430 |
|
\fi |
431 |
|
% Put the space token in: |
432 |
|
\temp#1 #3\ArgTerm |
433 |
} |
} |
434 |
|
|
435 |
% Change the active space to expand to nothing. |
% If a _delimited_ argument is enclosed in braces, they get stripped; so |
436 |
|
% to get _exactly_ the rest of the line, we had to prevent such situation. |
437 |
|
% We prepended an \empty token at the very beginning and we expand it now, |
438 |
|
% just before passing the control to \next. |
439 |
|
% (Similarily, we have to think about #3 of \argcheckspacesY above: it is |
440 |
|
% either the null string, or it ends with \^^M---thus there is no danger |
441 |
|
% that a pair of braces would be stripped. |
442 |
% |
% |
443 |
\begingroup |
% But first, we have to remove the trailing space token. |
444 |
\obeyspaces |
% |
445 |
\gdef\ignoreactivespaces{\obeyspaces\let =\empty} |
\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} |
|
\endgroup |
|
446 |
|
|
447 |
|
% \parseargdef\foo{...} |
448 |
|
% is roughly equivalent to |
449 |
|
% \def\foo{\parsearg\Xfoo} |
450 |
|
% \def\Xfoo#1{...} |
451 |
|
% |
452 |
|
% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my |
453 |
|
% favourite TeX trick. --kasal, 16nov03 |
454 |
|
|
455 |
\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} |
\def\parseargdef#1{% |
456 |
|
\expandafter \doparseargdef \csname\string#1\endcsname #1% |
457 |
|
} |
458 |
|
\def\doparseargdef#1#2{% |
459 |
|
\def#2{\parsearg#1}% |
460 |
|
\def#1##1% |
461 |
|
} |
462 |
|
|
463 |
%% These are used to keep @begin/@end levels from running away |
% Several utility definitions with active space: |
464 |
%% Call \inENV within environments (after a \begingroup) |
{ |
465 |
\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} |
\obeyspaces |
466 |
\def\ENVcheck{% |
\gdef\obeyedspace{ } |
|
\ifENV\errmessage{Still within an environment; press RETURN to continue} |
|
|
\endgroup\fi} % This is not perfect, but it should reduce lossage |
|
467 |
|
|
468 |
% @begin foo is the same as @foo, for now. |
% Make each space character in the input produce a normal interword |
469 |
\newhelp\EMsimple{Press RETURN to continue.} |
% space in the output. Don't allow a line break at this space, as this |
470 |
|
% is used only in environments like @example, where each line of input |
471 |
|
% should produce a line of output anyway. |
472 |
|
% |
473 |
|
\gdef\sepspaces{\obeyspaces\let =\tie} |
474 |
|
|
475 |
|
% If an index command is used in an @example environment, any spaces |
476 |
|
% therein should become regular spaces in the raw index file, not the |
477 |
|
% expansion of \tie (\leavevmode \penalty \@M \ ). |
478 |
|
\gdef\unsepspaces{\let =\space} |
479 |
|
} |
480 |
|
|
|
\outer\def\begin{\parsearg\beginxxx} |
|
481 |
|
|
482 |
\def\beginxxx #1{% |
\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} |
|
\expandafter\ifx\csname #1\endcsname\relax |
|
|
{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else |
|
|
\csname #1\endcsname\fi} |
|
483 |
|
|
484 |
% @end foo executes the definition of \Efoo. |
% Define the framework for environments in texinfo.tex. It's used like this: |
485 |
% |
% |
486 |
\def\end{\parsearg\endxxx} |
% \envdef\foo{...} |
487 |
\def\endxxx #1{% |
% \def\Efoo{...} |
488 |
\removeactivespaces{#1}% |
% |
489 |
\edef\endthing{\the\toks0}% |
% It's the responsibility of \envdef to insert \begingroup before the |
490 |
% |
% actual body; @end closes the group after calling \Efoo. \envdef also |
491 |
\expandafter\ifx\csname E\endthing\endcsname\relax |
% defines \thisenv, so the current environment is known; @end checks |
492 |
\expandafter\ifx\csname \endthing\endcsname\relax |
% whether the environment name matches. The \checkenv macro can also be |
493 |
% There's no \foo, i.e., no ``environment'' foo. |
% used to check whether the current environment is the one expected. |
494 |
\errhelp = \EMsimple |
% |
495 |
\errmessage{Undefined command `@end \endthing'}% |
% Non-false conditionals (@iftex, @ifset) don't fit into this, so they |
496 |
\else |
% are not treated as enviroments; they don't open a group. (The |
497 |
\unmatchedenderror\endthing |
% implementation of @end takes care not to call \endgroup in this |
498 |
\fi |
% special case.) |
499 |
|
|
500 |
|
|
501 |
|
% At runtime, environments start with this: |
502 |
|
\def\startenvironment#1{\begingroup\def\thisenv{#1}} |
503 |
|
% initialize |
504 |
|
\let\thisenv\empty |
505 |
|
|
506 |
|
% ... but they get defined via ``\envdef\foo{...}'': |
507 |
|
\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} |
508 |
|
\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} |
509 |
|
|
510 |
|
% Check whether we're in the right environment: |
511 |
|
\def\checkenv#1{% |
512 |
|
\def\temp{#1}% |
513 |
|
\ifx\thisenv\temp |
514 |
\else |
\else |
515 |
% Everything's ok; the right environment has been started. |
\badenverr |
|
\csname E\endthing\endcsname |
|
516 |
\fi |
\fi |
517 |
} |
} |
518 |
|
|
519 |
% There is an environment #1, but it hasn't been started. Give an error. |
% Evironment mismatch, #1 expected: |
520 |
% |
\def\badenverr{% |
|
\def\unmatchedenderror#1{% |
|
521 |
\errhelp = \EMsimple |
\errhelp = \EMsimple |
522 |
\errmessage{This `@end #1' doesn't have a matching `@#1'}% |
\errmessage{This command can appear only \inenvironment\temp, |
523 |
|
not \inenvironment\thisenv}% |
524 |
|
} |
525 |
|
\def\inenvironment#1{% |
526 |
|
\ifx#1\empty |
527 |
|
out of any environment% |
528 |
|
\else |
529 |
|
in environment \expandafter\string#1% |
530 |
|
\fi |
531 |
} |
} |
532 |
|
|
533 |
% Define the control sequence \E#1 to give an unmatched @end error. |
% @end foo executes the definition of \Efoo. |
534 |
|
% But first, it executes a specialized version of \checkenv |
535 |
% |
% |
536 |
\def\defineunmatchedend#1{% |
\parseargdef\end{% |
537 |
\expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% |
\if 1\csname iscond.#1\endcsname |
538 |
|
\else |
539 |
|
% The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 |
540 |
|
\expandafter\checkenv\csname#1\endcsname |
541 |
|
\csname E#1\endcsname |
542 |
|
\endgroup |
543 |
|
\fi |
544 |
} |
} |
545 |
|
|
546 |
|
\newhelp\EMsimple{Press RETURN to continue.} |
547 |
|
|
|
% Single-spacing is done by various environments (specifically, in |
|
|
% \nonfillstart and \quotations). |
|
|
\newskip\singlespaceskip \singlespaceskip = 12.5pt |
|
|
\def\singlespace{% |
|
|
% Why was this kern here? It messes up equalizing space above and below |
|
|
% environments. --karl, 6may93 |
|
|
%{\advance \baselineskip by -\singlespaceskip |
|
|
%\kern \baselineskip}% |
|
|
\setleading \singlespaceskip |
|
|
} |
|
548 |
|
|
549 |
%% Simple single-character @ commands |
%% Simple single-character @ commands |
550 |
|
|
565 |
\let\{=\mylbrace |
\let\{=\mylbrace |
566 |
\let\}=\myrbrace |
\let\}=\myrbrace |
567 |
\begingroup |
\begingroup |
568 |
% Definitions to produce actual \{ & \} command in an index. |
% Definitions to produce \{ and \} commands for indices, |
569 |
\catcode`\{ = 12 \catcode`\} = 12 |
% and @{ and @} for the aux file. |
570 |
|
\catcode`\{ = \other \catcode`\} = \other |
571 |
\catcode`\[ = 1 \catcode`\] = 2 |
\catcode`\[ = 1 \catcode`\] = 2 |
572 |
\catcode`\@ = 0 \catcode`\\ = 12 |
\catcode`\! = 0 \catcode`\\ = \other |
573 |
@gdef@lbracecmd[\{]% |
!gdef!lbracecmd[\{]% |
574 |
@gdef@rbracecmd[\}]% |
!gdef!rbracecmd[\}]% |
575 |
@endgroup |
!gdef!lbraceatcmd[@{]% |
576 |
|
!gdef!rbraceatcmd[@}]% |
577 |
|
!endgroup |
578 |
|
|
579 |
|
% @comma{} to avoid , parsing problems. |
580 |
|
\let\comma = , |
581 |
|
|
582 |
% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent |
% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent |
583 |
% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. |
% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. |
584 |
\let\, = \c |
\let\, = \c |
585 |
\let\dotaccent = \. |
\let\dotaccent = \. |
586 |
\def\ringaccent#1{{\accent23 #1}} |
\def\ringaccent#1{{\accent23 #1}} |
588 |
\let\ubaraccent = \b |
\let\ubaraccent = \b |
589 |
\let\udotaccent = \d |
\let\udotaccent = \d |
590 |
|
|
591 |
% Other special characters: @questiondown @exclamdown |
% Other special characters: @questiondown @exclamdown @ordf @ordm |
592 |
% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. |
% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. |
593 |
\def\questiondown{?`} |
\def\questiondown{?`} |
594 |
\def\exclamdown{!`} |
\def\exclamdown{!`} |
595 |
|
\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} |
596 |
|
\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} |
597 |
|
|
598 |
% Dotless i and dotless j, used for accents. |
% Dotless i and dotless j, used for accents. |
599 |
\def\imacro{i} |
\def\imacro{i} |
606 |
\fi\fi |
\fi\fi |
607 |
} |
} |
608 |
|
|
609 |
|
% The \TeX{} logo, as in plain, but resetting the spacing so that a |
610 |
|
% period following counts as ending a sentence. (Idea found in latex.) |
611 |
|
% |
612 |
|
\edef\TeX{\TeX \spacefactor=1000 } |
613 |
|
|
614 |
|
% @LaTeX{} logo. Not quite the same results as the definition in |
615 |
|
% latex.ltx, since we use a different font for the raised A; it's most |
616 |
|
% convenient for us to use an explicitly smaller font, rather than using |
617 |
|
% the \scriptstyle font (since we don't reset \scriptstyle and |
618 |
|
% \scriptscriptstyle). |
619 |
|
% |
620 |
|
\def\LaTeX{% |
621 |
|
L\kern-.36em |
622 |
|
{\setbox0=\hbox{T}% |
623 |
|
\vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% |
624 |
|
\kern-.15em |
625 |
|
\TeX |
626 |
|
} |
627 |
|
|
628 |
% Be sure we're in horizontal mode when doing a tie, since we make space |
% Be sure we're in horizontal mode when doing a tie, since we make space |
629 |
% equivalent to this in @example-like environments. Otherwise, a space |
% equivalent to this in @example-like environments. Otherwise, a space |
630 |
% at the beginning of a line will start with \penalty -- and |
% at the beginning of a line will start with \penalty -- and |
643 |
% @* forces a line break. |
% @* forces a line break. |
644 |
\def\*{\hfil\break\hbox{}\ignorespaces} |
\def\*{\hfil\break\hbox{}\ignorespaces} |
645 |
|
|
646 |
|
% @/ allows a line break. |
647 |
|
\let\/=\allowbreak |
648 |
|
|
649 |
% @. is an end-of-sentence period. |
% @. is an end-of-sentence period. |
650 |
\def\.{.\spacefactor=3000 } |
\def\.{.\spacefactor=3000 } |
651 |
|
|
668 |
% therefore, no glue is inserted, and the space between the headline and |
% therefore, no glue is inserted, and the space between the headline and |
669 |
% the text is small, which looks bad. |
% the text is small, which looks bad. |
670 |
% |
% |
671 |
\def\group{\begingroup |
% Another complication is that the group might be very large. This can |
672 |
\ifnum\catcode13=\active \else |
% cause the glue on the previous page to be unduly stretched, because it |
673 |
|
% does not have much material. In this case, it's better to add an |
674 |
|
% explicit \vfill so that the extra space is at the bottom. The |
675 |
|
% threshold for doing this is if the group is more than \vfilllimit |
676 |
|
% percent of a page (\vfilllimit can be changed inside of @tex). |
677 |
|
% |
678 |
|
\newbox\groupbox |
679 |
|
\def\vfilllimit{0.7} |
680 |
|
% |
681 |
|
\envdef\group{% |
682 |
|
\ifnum\catcode`\^^M=\active \else |
683 |
\errhelp = \groupinvalidhelp |
\errhelp = \groupinvalidhelp |
684 |
\errmessage{@group invalid in context where filling is enabled}% |
\errmessage{@group invalid in context where filling is enabled}% |
685 |
\fi |
\fi |
686 |
|
\startsavinginserts |
687 |
% |
% |
688 |
% The \vtop we start below produces a box with normal height and large |
\setbox\groupbox = \vtop\bgroup |
|
% depth; thus, TeX puts \baselineskip glue before it, and (when the |
|
|
% next line of text is done) \lineskip glue after it. (See p.82 of |
|
|
% the TeXbook.) Thus, space below is not quite equal to space |
|
|
% above. But it's pretty close. |
|
|
\def\Egroup{% |
|
|
\egroup % End the \vtop. |
|
|
\endgroup % End the \group. |
|
|
}% |
|
|
% |
|
|
\vtop\bgroup |
|
|
% We have to put a strut on the last line in case the @group is in |
|
|
% the midst of an example, rather than completely enclosing it. |
|
|
% Otherwise, the interline space between the last line of the group |
|
|
% and the first line afterwards is too small. But we can't put the |
|
|
% strut in \Egroup, since there it would be on a line by itself. |
|
|
% Hence this just inserts a strut at the beginning of each line. |
|
|
\everypar = {\strut}% |
|
|
% |
|
|
% Since we have a strut on every line, we don't need any of TeX's |
|
|
% normal interline spacing. |
|
|
\offinterlineskip |
|
|
% |
|
|
% OK, but now we have to do something about blank |
|
|
% lines in the input in @example-like environments, which normally |
|
|
% just turn into \lisppar, which will insert no space now that we've |
|
|
% turned off the interline space. Simplest is to make them be an |
|
|
% empty paragraph. |
|
|
\ifx\par\lisppar |
|
|
\edef\par{\leavevmode \par}% |
|
|
% |
|
|
% Reset ^^M's definition to new definition of \par. |
|
|
\obeylines |
|
|
\fi |
|
|
% |
|
689 |
% Do @comment since we are called inside an environment such as |
% Do @comment since we are called inside an environment such as |
690 |
% @example, where each end-of-line in the input causes an |
% @example, where each end-of-line in the input causes an |
691 |
% end-of-line in the output. We don't want the end-of-line after |
% end-of-line in the output. We don't want the end-of-line after |
695 |
\comment |
\comment |
696 |
} |
} |
697 |
% |
% |
698 |
|
% The \vtop produces a box with normal height and large depth; thus, TeX puts |
699 |
|
% \baselineskip glue before it, and (when the next line of text is done) |
700 |
|
% \lineskip glue after it. Thus, space below is not quite equal to space |
701 |
|
% above. But it's pretty close. |
702 |
|
\def\Egroup{% |
703 |
|
% To get correct interline space between the last line of the group |
704 |
|
% and the first line afterwards, we have to propagate \prevdepth. |
705 |
|
\endgraf % Not \par, as it may have been set to \lisppar. |
706 |
|
\global\dimen1 = \prevdepth |
707 |
|
\egroup % End the \vtop. |
708 |
|
% \dimen0 is the vertical size of the group's box. |
709 |
|
\dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox |
710 |
|
% \dimen2 is how much space is left on the page (more or less). |
711 |
|
\dimen2 = \pageheight \advance\dimen2 by -\pagetotal |
712 |
|
% if the group doesn't fit on the current page, and it's a big big |
713 |
|
% group, force a page break. |
714 |
|
\ifdim \dimen0 > \dimen2 |
715 |
|
\ifdim \pagetotal < \vfilllimit\pageheight |
716 |
|
\page |
717 |
|
\fi |
718 |
|
\fi |
719 |
|
\box\groupbox |
720 |
|
\prevdepth = \dimen1 |
721 |
|
\checkinserts |
722 |
|
} |
723 |
|
% |
724 |
% TeX puts in an \escapechar (i.e., `@') at the beginning of the help |
% TeX puts in an \escapechar (i.e., `@') at the beginning of the help |
725 |
% message, so this ends up printing `@group can only ...'. |
% message, so this ends up printing `@group can only ...'. |
726 |
% |
% |
733 |
|
|
734 |
\newdimen\mil \mil=0.001in |
\newdimen\mil \mil=0.001in |
735 |
|
|
|
\def\need{\parsearg\needx} |
|
|
|
|
736 |
% Old definition--didn't work. |
% Old definition--didn't work. |
737 |
%\def\needx #1{\par % |
%\parseargdef\need{\par % |
738 |
%% This method tries to make TeX break the page naturally |
%% This method tries to make TeX break the page naturally |
739 |
%% if the depth of the box does not fit. |
%% if the depth of the box does not fit. |
740 |
%{\baselineskip=0pt% |
%{\baselineskip=0pt% |
742 |
%\prevdepth=-1000pt |
%\prevdepth=-1000pt |
743 |
%}} |
%}} |
744 |
|
|
745 |
\def\needx#1{% |
\parseargdef\need{% |
746 |
% Go into vertical mode, so we don't make a big box in the middle of a |
% Ensure vertical mode, so we don't make a big box in the middle of a |
747 |
% paragraph. |
% paragraph. |
748 |
\par |
\par |
749 |
% |
% |
750 |
% Don't add any leading before our big empty box, but allow a page |
% If the @need value is less than one line space, it's useless. |
751 |
% break, since the best break might be right here. |
\dimen0 = #1\mil |
752 |
\allowbreak |
\dimen2 = \ht\strutbox |
753 |
\nointerlineskip |
\advance\dimen2 by \dp\strutbox |
754 |
\vtop to #1\mil{\vfil}% |
\ifdim\dimen0 > \dimen2 |
755 |
% |
% |
756 |
% TeX does not even consider page breaks if a penalty added to the |
% Do a \strut just to make the height of this box be normal, so the |
757 |
% main vertical list is 10000 or more. But in order to see if the |
% normal leading is inserted relative to the preceding line. |
758 |
% empty box we just added fits on the page, we must make it consider |
% And a page break here is fine. |
759 |
% page breaks. On the other hand, we don't want to actually break the |
\vtop to #1\mil{\strut\vfil}% |
760 |
% page after the empty box. So we use a penalty of 9999. |
% |
761 |
% |
% TeX does not even consider page breaks if a penalty added to the |
762 |
% There is an extremely small chance that TeX will actually break the |
% main vertical list is 10000 or more. But in order to see if the |
763 |
% page at this \penalty, if there are no other feasible breakpoints in |
% empty box we just added fits on the page, we must make it consider |
764 |
% sight. (If the user is using lots of big @group commands, which |
% page breaks. On the other hand, we don't want to actually break the |
765 |
% almost-but-not-quite fill up a page, TeX will have a hard time doing |
% page after the empty box. So we use a penalty of 9999. |
766 |
% good page breaking, for example.) However, I could not construct an |
% |
767 |
% example where a page broke at this \penalty; if it happens in a real |
% There is an extremely small chance that TeX will actually break the |
768 |
% document, then we can reconsider our strategy. |
% page at this \penalty, if there are no other feasible breakpoints in |
769 |
\penalty9999 |
% sight. (If the user is using lots of big @group commands, which |
770 |
% |
% almost-but-not-quite fill up a page, TeX will have a hard time doing |
771 |
% Back up by the size of the box, whether we did a page break or not. |
% good page breaking, for example.) However, I could not construct an |
772 |
\kern -#1\mil |
% example where a page broke at this \penalty; if it happens in a real |
773 |
% |
% document, then we can reconsider our strategy. |
774 |
% Do not allow a page break right after this kern. |
\penalty9999 |
775 |
\nobreak |
% |
776 |
|
% Back up by the size of the box, whether we did a page break or not. |
777 |
|
\kern -#1\mil |
778 |
|
% |
779 |
|
% Do not allow a page break right after this kern. |
780 |
|
\nobreak |
781 |
|
\fi |
782 |
} |
} |
783 |
|
|
784 |
% @br forces paragraph break |
% @br forces paragraph break (and is undocumented). |
785 |
|
|
786 |
\let\br = \par |
\let\br = \par |
787 |
|
|
788 |
% @dots{} output an ellipsis using the current font. |
% @page forces the start of a new page. |
|
% We do .5em per period so that it has the same spacing in a typewriter |
|
|
% font as three actual period characters. |
|
|
% |
|
|
\def\dots{% |
|
|
\leavevmode |
|
|
\hbox to 1.5em{% |
|
|
\hskip 0pt plus 0.25fil minus 0.25fil |
|
|
.\hss.\hss.% |
|
|
\hskip 0pt plus 0.5fil minus 0.5fil |
|
|
}% |
|
|
} |
|
|
|
|
|
% @enddots{} is an end-of-sentence ellipsis. |
|
|
% |
|
|
\def\enddots{% |
|
|
\leavevmode |
|
|
\hbox to 2em{% |
|
|
\hskip 0pt plus 0.25fil minus 0.25fil |
|
|
.\hss.\hss.\hss.% |
|
|
\hskip 0pt plus 0.5fil minus 0.5fil |
|
|
}% |
|
|
\spacefactor=3000 |
|
|
} |
|
|
|
|
|
|
|
|
% @page forces the start of a new page |
|
789 |
% |
% |
790 |
\def\page{\par\vfill\supereject} |
\def\page{\par\vfill\supereject} |
791 |
|
|
797 |
\newskip\exdentamount |
\newskip\exdentamount |
798 |
|
|
799 |
% This defn is used inside fill environments such as @defun. |
% This defn is used inside fill environments such as @defun. |
800 |
\def\exdent{\parsearg\exdentyyy} |
\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} |
|
\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} |
|
801 |
|
|
802 |
% This defn is used inside nofill environments such as @example. |
% This defn is used inside nofill environments such as @example. |
803 |
\def\nofillexdent{\parsearg\nofillexdentyyy} |
\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount |
804 |
\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount |
\leftline{\hskip\leftskip{\rm#1}}}} |
805 |
\leftline{\hskip\leftskip{\rm#1}}}} |
|
806 |
|
% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current |
807 |
% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph. |
% paragraph. For more general purposes, use the \margin insertion |
808 |
|
% class. WHICH is `l' or `r'. |
809 |
\def\inmargin#1{% |
% |
|
\strut\vadjust{\nobreak\kern-\strutdepth |
|
|
\vtop to \strutdepth{\baselineskip\strutdepth\vss |
|
|
\llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}} |
|
810 |
\newskip\inmarginspacing \inmarginspacing=1cm |
\newskip\inmarginspacing \inmarginspacing=1cm |
811 |
\def\strutdepth{\dp\strutbox} |
\def\strutdepth{\dp\strutbox} |
812 |
|
% |
813 |
%\hbox{{\rm#1}}\hfil\break}} |
\def\doinmargin#1#2{\strut\vadjust{% |
814 |
|
\nobreak |
815 |
|
\kern-\strutdepth |
816 |
|
\vtop to \strutdepth{% |
817 |
|
\baselineskip=\strutdepth |
818 |
|
\vss |
819 |
|
% if you have multiple lines of stuff to put here, you'll need to |
820 |
|
% make the vbox yourself of the appropriate size. |
821 |
|
\ifx#1l% |
822 |
|
\llap{\ignorespaces #2\hskip\inmarginspacing}% |
823 |
|
\else |
824 |
|
\rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% |
825 |
|
\fi |
826 |
|
\null |
827 |
|
}% |
828 |
|
}} |
829 |
|
\def\inleftmargin{\doinmargin l} |
830 |
|
\def\inrightmargin{\doinmargin r} |
831 |
|
% |
832 |
|
% @inmargin{TEXT [, RIGHT-TEXT]} |
833 |
|
% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; |
834 |
|
% else use TEXT for both). |
835 |
|
% |
836 |
|
\def\inmargin#1{\parseinmargin #1,,\finish} |
837 |
|
\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. |
838 |
|
\setbox0 = \hbox{\ignorespaces #2}% |
839 |
|
\ifdim\wd0 > 0pt |
840 |
|
\def\lefttext{#1}% have both texts |
841 |
|
\def\righttext{#2}% |
842 |
|
\else |
843 |
|
\def\lefttext{#1}% have only one text |
844 |
|
\def\righttext{#1}% |
845 |
|
\fi |
846 |
|
% |
847 |
|
\ifodd\pageno |
848 |
|
\def\temp{\inrightmargin\righttext}% odd page -> outside is right margin |
849 |
|
\else |
850 |
|
\def\temp{\inleftmargin\lefttext}% |
851 |
|
\fi |
852 |
|
\temp |
853 |
|
} |
854 |
|
|
855 |
% @include file insert text of that file as input. |
% @include file insert text of that file as input. |
856 |
% Allow normal characters that we make active in the argument (a file name). |
% |
857 |
\def\include{\begingroup |
\def\include{\parseargusing\filenamecatcodes\includezzz} |
858 |
\catcode`\\=12 |
\def\includezzz#1{% |
859 |
\catcode`~=12 |
\pushthisfilestack |
|
\catcode`^=12 |
|
|
\catcode`_=12 |
|
|
\catcode`|=12 |
|
|
\catcode`<=12 |
|
|
\catcode`>=12 |
|
|
\catcode`+=12 |
|
|
\parsearg\includezzz} |
|
|
% Restore active chars for included file. |
|
|
\def\includezzz#1{\endgroup\begingroup |
|
|
% Read the included file in a group so nested @include's work. |
|
860 |
\def\thisfile{#1}% |
\def\thisfile{#1}% |
861 |
\input\thisfile |
{% |
862 |
\endgroup} |
\makevalueexpandable |
863 |
|
\def\temp{\input #1 }% |
864 |
|
\expandafter |
865 |
|
}\temp |
866 |
|
\popthisfilestack |
867 |
|
} |
868 |
|
\def\filenamecatcodes{% |
869 |
|
\catcode`\\=\other |
870 |
|
\catcode`~=\other |
871 |
|
\catcode`^=\other |
872 |
|
\catcode`_=\other |
873 |
|
\catcode`|=\other |
874 |
|
\catcode`<=\other |
875 |
|
\catcode`>=\other |
876 |
|
\catcode`+=\other |
877 |
|
\catcode`-=\other |
878 |
|
} |
879 |
|
|
880 |
\def\thisfile{} |
\def\pushthisfilestack{% |
881 |
|
\expandafter\pushthisfilestackX\popthisfilestack\StackTerm |
882 |
|
} |
883 |
|
\def\pushthisfilestackX{% |
884 |
|
\expandafter\pushthisfilestackY\thisfile\StackTerm |
885 |
|
} |
886 |
|
\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% |
887 |
|
\gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% |
888 |
|
} |
889 |
|
|
890 |
% @center line outputs that line, centered |
\def\popthisfilestack{\errthisfilestackempty} |
891 |
|
\def\errthisfilestackempty{\errmessage{Internal error: |
892 |
|
the stack of filenames is empty.}} |
893 |
|
|
894 |
\def\center{\parsearg\centerzzz} |
\def\thisfile{} |
895 |
\def\centerzzz #1{{\advance\hsize by -\leftskip |
|
896 |
\advance\hsize by -\rightskip |
% @center line |
897 |
\centerline{#1}}} |
% outputs that line, centered. |
898 |
|
% |
899 |
|
\parseargdef\center{% |
900 |
|
\ifhmode |
901 |
|
\let\next\centerH |
902 |
|
\else |
903 |
|
\let\next\centerV |
904 |
|
\fi |
905 |
|
\next{\hfil \ignorespaces#1\unskip \hfil}% |
906 |
|
} |
907 |
|
\def\centerH#1{% |
908 |
|
{% |
909 |
|
\hfil\break |
910 |
|
\advance\hsize by -\leftskip |
911 |
|
\advance\hsize by -\rightskip |
912 |
|
\line{#1}% |
913 |
|
\break |
914 |
|
}% |
915 |
|
} |
916 |
|
\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} |
917 |
|
|
918 |
% @sp n outputs n lines of vertical space |
% @sp n outputs n lines of vertical space |
919 |
|
|
920 |
\def\sp{\parsearg\spxxx} |
\parseargdef\sp{\vskip #1\baselineskip} |
|
\def\spxxx #1{\vskip #1\baselineskip} |
|
921 |
|
|
922 |
% @comment ...line which is ignored... |
% @comment ...line which is ignored... |
923 |
% @c is the same as @comment |
% @c is the same as @comment |
932 |
|
|
933 |
% @paragraphindent NCHARS |
% @paragraphindent NCHARS |
934 |
% We'll use ems for NCHARS, close enough. |
% We'll use ems for NCHARS, close enough. |
935 |
% We cannot implement @paragraphindent asis, though. |
% NCHARS can also be the word `asis' or `none'. |
936 |
% |
% We cannot feasibly implement @paragraphindent asis, though. |
937 |
|
% |
938 |
\def\asisword{asis} % no translation, these are keywords |
\def\asisword{asis} % no translation, these are keywords |
939 |
\def\noneword{none} |
\def\noneword{none} |
940 |
% |
% |
941 |
\def\paragraphindent{\parsearg\doparagraphindent} |
\parseargdef\paragraphindent{% |
|
\def\doparagraphindent#1{% |
|
942 |
\def\temp{#1}% |
\def\temp{#1}% |
943 |
\ifx\temp\asisword |
\ifx\temp\asisword |
944 |
\else |
\else |
955 |
% We'll use ems for NCHARS like @paragraphindent. |
% We'll use ems for NCHARS like @paragraphindent. |
956 |
% It seems @exampleindent asis isn't necessary, but |
% It seems @exampleindent asis isn't necessary, but |
957 |
% I preserve it to make it similar to @paragraphindent. |
% I preserve it to make it similar to @paragraphindent. |
958 |
\def\exampleindent{\parsearg\doexampleindent} |
\parseargdef\exampleindent{% |
|
\def\doexampleindent#1{% |
|
959 |
\def\temp{#1}% |
\def\temp{#1}% |
960 |
\ifx\temp\asisword |
\ifx\temp\asisword |
961 |
\else |
\else |
967 |
\fi |
\fi |
968 |
} |
} |
969 |
|
|
970 |
|
% @firstparagraphindent WORD |
971 |
|
% If WORD is `none', then suppress indentation of the first paragraph |
972 |
|
% after a section heading. If WORD is `insert', then do indent at such |
973 |
|
% paragraphs. |
974 |
|
% |
975 |
|
% The paragraph indentation is suppressed or not by calling |
976 |
|
% \suppressfirstparagraphindent, which the sectioning commands do. |
977 |
|
% We switch the definition of this back and forth according to WORD. |
978 |
|
% By default, we suppress indentation. |
979 |
|
% |
980 |
|
\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} |
981 |
|
\def\insertword{insert} |
982 |
|
% |
983 |
|
\parseargdef\firstparagraphindent{% |
984 |
|
\def\temp{#1}% |
985 |
|
\ifx\temp\noneword |
986 |
|
\let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent |
987 |
|
\else\ifx\temp\insertword |
988 |
|
\let\suppressfirstparagraphindent = \relax |
989 |
|
\else |
990 |
|
\errhelp = \EMsimple |
991 |
|
\errmessage{Unknown @firstparagraphindent option `\temp'}% |
992 |
|
\fi\fi |
993 |
|
} |
994 |
|
|
995 |
|
% Here is how we actually suppress indentation. Redefine \everypar to |
996 |
|
% \kern backwards by \parindent, and then reset itself to empty. |
997 |
|
% |
998 |
|
% We also make \indent itself not actually do anything until the next |
999 |
|
% paragraph. |
1000 |
|
% |
1001 |
|
\gdef\dosuppressfirstparagraphindent{% |
1002 |
|
\gdef\indent{% |
1003 |
|
\restorefirstparagraphindent |
1004 |
|
\indent |
1005 |
|
}% |
1006 |
|
\gdef\noindent{% |
1007 |
|
\restorefirstparagraphindent |
1008 |
|
\noindent |
1009 |
|
}% |
1010 |
|
\global\everypar = {% |
1011 |
|
\kern -\parindent |
1012 |
|
\restorefirstparagraphindent |
1013 |
|
}% |
1014 |
|
} |
1015 |
|
|
1016 |
|
\gdef\restorefirstparagraphindent{% |
1017 |
|
\global \let \indent = \ptexindent |
1018 |
|
\global \let \noindent = \ptexnoindent |
1019 |
|
\global \everypar = {}% |
1020 |
|
} |
1021 |
|
|
1022 |
|
|
1023 |
% @asis just yields its argument. Used with @table, for example. |
% @asis just yields its argument. Used with @table, for example. |
1024 |
% |
% |
1025 |
\def\asis#1{#1} |
\def\asis#1{#1} |
1026 |
|
|
1027 |
% @math means output in math mode. |
% @math outputs its argument in math mode. |
|
% We don't use $'s directly in the definition of \math because control |
|
|
% sequences like \math are expanded when the toc file is written. Then, |
|
|
% we read the toc file back, the $'s will be normal characters (as they |
|
|
% should be, according to the definition of Texinfo). So we must use a |
|
|
% control sequence to switch into and out of math mode. |
|
1028 |
% |
% |
1029 |
% This isn't quite enough for @math to work properly in indices, but it |
% One complication: _ usually means subscripts, but it could also mean |
1030 |
% seems unlikely it will ever be needed there. |
% an actual _ character, as in @math{@var{some_variable} + 1}. So make |
1031 |
|
% _ active, and distinguish by seeing if the current family is \slfam, |
1032 |
|
% which is what @var uses. |
1033 |
|
{ |
1034 |
|
\catcode\underChar = \active |
1035 |
|
\gdef\mathunderscore{% |
1036 |
|
\catcode\underChar=\active |
1037 |
|
\def_{\ifnum\fam=\slfam \_\else\sb\fi}% |
1038 |
|
} |
1039 |
|
} |
1040 |
|
% Another complication: we want \\ (and @\) to output a \ character. |
1041 |
|
% FYI, plain.tex uses \\ as a temporary control sequence (why?), but |
1042 |
|
% this is not advertised and we don't care. Texinfo does not |
1043 |
|
% otherwise define @\. |
1044 |
|
% |
1045 |
|
% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. |
1046 |
|
\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} |
1047 |
|
% |
1048 |
|
\def\math{% |
1049 |
|
\tex |
1050 |
|
\mathunderscore |
1051 |
|
\let\\ = \mathbackslash |
1052 |
|
\mathactive |
1053 |
|
$\finishmath |
1054 |
|
} |
1055 |
|
\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. |
1056 |
|
|
1057 |
|
% Some active characters (such as <) are spaced differently in math. |
1058 |
|
% We have to reset their definitions in case the @math was an argument |
1059 |
|
% to a command which sets the catcodes (such as @item or @section). |
1060 |
% |
% |
1061 |
\let\implicitmath = $ |
{ |
1062 |
\def\math#1{\implicitmath #1\implicitmath} |
\catcode`^ = \active |
1063 |
|
\catcode`< = \active |
1064 |
|
\catcode`> = \active |
1065 |
|
\catcode`+ = \active |
1066 |
|
\gdef\mathactive{% |
1067 |
|
\let^ = \ptexhat |
1068 |
|
\let< = \ptexless |
1069 |
|
\let> = \ptexgtr |
1070 |
|
\let+ = \ptexplus |
1071 |
|
} |
1072 |
|
} |
1073 |
|
|
1074 |
% @bullet and @minus need the same treatment as @math, just above. |
% @bullet and @minus need the same treatment as @math, just above. |
1075 |
\def\bullet{\implicitmath\ptexbullet\implicitmath} |
\def\bullet{$\ptexbullet$} |
1076 |
\def\minus{\implicitmath-\implicitmath} |
\def\minus{$-$} |
1077 |
|
|
1078 |
|
% @dots{} outputs an ellipsis using the current font. |
1079 |
|
% We do .5em per period so that it has the same spacing in a typewriter |
1080 |
|
% font as three actual period characters. |
1081 |
|
% |
1082 |
|
\def\dots{% |
1083 |
|
\leavevmode |
1084 |
|
\hbox to 1.5em{% |
1085 |
|
\hskip 0pt plus 0.25fil |
1086 |
|
.\hfil.\hfil.% |
1087 |
|
\hskip 0pt plus 0.5fil |
1088 |
|
}% |
1089 |
|
} |
1090 |
|
|
1091 |
|
% @enddots{} is an end-of-sentence ellipsis. |
1092 |
|
% |
1093 |
|
\def\enddots{% |
1094 |
|
\dots |
1095 |
|
\spacefactor=3000 |
1096 |
|
} |
1097 |
|
|
1098 |
|
% @comma{} is so commas can be inserted into text without messing up |
1099 |
|
% Texinfo's parsing. |
1100 |
|
% |
1101 |
|
\let\comma = , |
1102 |
|
|
1103 |
% @refill is a no-op. |
% @refill is a no-op. |
1104 |
\let\refill=\relax |
\let\refill=\relax |
1114 |
% So open here the files we need to have open while reading the input. |
% So open here the files we need to have open while reading the input. |
1115 |
% This makes it possible to make a .fmt file for texinfo. |
% This makes it possible to make a .fmt file for texinfo. |
1116 |
\def\setfilename{% |
\def\setfilename{% |
1117 |
|
\fixbackslash % Turn off hack to swallow `\input texinfo'. |
1118 |
\iflinks |
\iflinks |
1119 |
\readauxfile |
\tryauxfile |
1120 |
|
% Open the new aux file. TeX will close it automatically at exit. |
1121 |
|
\immediate\openout\auxfile=\jobname.aux |
1122 |
\fi % \openindices needs to do some work in any case. |
\fi % \openindices needs to do some work in any case. |
1123 |
\openindices |
\openindices |
1124 |
\fixbackslash % Turn off hack to swallow `\input texinfo'. |
\let\setfilename=\comment % Ignore extra @setfilename cmds. |
|
\global\let\setfilename=\comment % Ignore extra @setfilename cmds. |
|
1125 |
% |
% |
1126 |
% If texinfo.cnf is present on the system, read it. |
% If texinfo.cnf is present on the system, read it. |
1127 |
% Useful for site-wide @afourpaper, etc. |
% Useful for site-wide @afourpaper, etc. |
|
% Just to be on the safe side, close the input stream before the \input. |
|
1128 |
\openin 1 texinfo.cnf |
\openin 1 texinfo.cnf |
1129 |
\ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi |
\ifeof 1 \else \input texinfo.cnf \fi |
1130 |
\closein1 |
\closein 1 |
|
\temp |
|
1131 |
% |
% |
1132 |
\comment % Ignore the actual filename. |
\comment % Ignore the actual filename. |
1133 |
} |
} |
1147 |
\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} |
\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} |
1148 |
|
|
1149 |
|
|
1150 |
|
\message{pdf,} |
1151 |
|
% adobe `portable' document format |
1152 |
|
\newcount\tempnum |
1153 |
|
\newcount\lnkcount |
1154 |
|
\newtoks\filename |
1155 |
|
\newcount\filenamelength |
1156 |
|
\newcount\pgn |
1157 |
|
\newtoks\toksA |
1158 |
|
\newtoks\toksB |
1159 |
|
\newtoks\toksC |
1160 |
|
\newtoks\toksD |
1161 |
|
\newbox\boxA |
1162 |
|
\newcount\countA |
1163 |
|
\newif\ifpdf |
1164 |
|
\newif\ifpdfmakepagedest |
1165 |
|
|
1166 |
|
% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 |
1167 |
|
% can be set). So we test for \relax and 0 as well as \undefined, |
1168 |
|
% borrowed from ifpdf.sty. |
1169 |
|
\ifx\pdfoutput\undefined |
1170 |
|
\else |
1171 |
|
\ifx\pdfoutput\relax |
1172 |
|
\else |
1173 |
|
\ifcase\pdfoutput |
1174 |
|
\else |
1175 |
|
\pdftrue |
1176 |
|
\fi |
1177 |
|
\fi |
1178 |
|
\fi |
1179 |
|
% |
1180 |
|
\ifpdf |
1181 |
|
\input pdfcolor |
1182 |
|
\pdfcatalog{/PageMode /UseOutlines}% |
1183 |
|
\def\dopdfimage#1#2#3{% |
1184 |
|
\def\imagewidth{#2}% |
1185 |
|
\def\imageheight{#3}% |
1186 |
|
% without \immediate, pdftex seg faults when the same image is |
1187 |
|
% included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) |
1188 |
|
\ifnum\pdftexversion < 14 |
1189 |
|
\immediate\pdfimage |
1190 |
|
\else |
1191 |
|
\immediate\pdfximage |
1192 |
|
\fi |
1193 |
|
\ifx\empty\imagewidth\else width \imagewidth \fi |
1194 |
|
\ifx\empty\imageheight\else height \imageheight \fi |
1195 |
|
\ifnum\pdftexversion<13 |
1196 |
|
#1.pdf% |
1197 |
|
\else |
1198 |
|
{#1.pdf}% |
1199 |
|
\fi |
1200 |
|
\ifnum\pdftexversion < 14 \else |
1201 |
|
\pdfrefximage \pdflastximage |
1202 |
|
\fi} |
1203 |
|
\def\pdfmkdest#1{{% |
1204 |
|
% We have to set dummies so commands such as @code in a section title |
1205 |
|
% aren't expanded. |
1206 |
|
\atdummies |
1207 |
|
\normalturnoffactive |
1208 |
|
\pdfdest name{#1} xyz% |
1209 |
|
}} |
1210 |
|
\def\pdfmkpgn#1{#1} |
1211 |
|
\let\linkcolor = \Blue % was Cyan, but that seems light? |
1212 |
|
\def\endlink{\Black\pdfendlink} |
1213 |
|
% Adding outlines to PDF; macros for calculating structure of outlines |
1214 |
|
% come from Petr Olsak |
1215 |
|
\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% |
1216 |
|
\else \csname#1\endcsname \fi} |
1217 |
|
\def\advancenumber#1{\tempnum=\expnumber{#1}\relax |
1218 |
|
\advance\tempnum by 1 |
1219 |
|
\expandafter\xdef\csname#1\endcsname{\the\tempnum}} |
1220 |
|
% |
1221 |
|
% #1 is the section text. #2 is the pdf expression for the number |
1222 |
|
% of subentries (or empty, for subsubsections). #3 is the node |
1223 |
|
% text, which might be empty if this toc entry had no |
1224 |
|
% corresponding node. #4 is the page number. |
1225 |
|
% |
1226 |
|
\def\dopdfoutline#1#2#3#4{% |
1227 |
|
% Generate a link to the node text if that exists; else, use the |
1228 |
|
% page number. We could generate a destination for the section |
1229 |
|
% text in the case where a section has no node, but it doesn't |
1230 |
|
% seem worthwhile, since most documents are normally structured. |
1231 |
|
\def\pdfoutlinedest{#3}% |
1232 |
|
\ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}\fi |
1233 |
|
% |
1234 |
|
\pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{#1}% |
1235 |
|
} |
1236 |
|
% |
1237 |
|
\def\pdfmakeoutlines{% |
1238 |
|
\begingroup |
1239 |
|
% Thanh's hack / proper braces in bookmarks |
1240 |
|
\edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace |
1241 |
|
\edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace |
1242 |
|
% |
1243 |
|
% Read toc silently, to get counts of subentries for \pdfoutline. |
1244 |
|
\def\numchapentry##1##2##3##4{% |
1245 |
|
\def\thischapnum{##2}% |
1246 |
|
\def\thissecnum{0}% |
1247 |
|
\def\thissubsecnum{0}% |
1248 |
|
}% |
1249 |
|
\def\numsecentry##1##2##3##4{% |
1250 |
|
\advancenumber{chap\thischapnum}% |
1251 |
|
\def\thissecnum{##2}% |
1252 |
|
\def\thissubsecnum{0}% |
1253 |
|
}% |
1254 |
|
\def\numsubsecentry##1##2##3##4{% |
1255 |
|
\advancenumber{sec\thissecnum}% |
1256 |
|
\def\thissubsecnum{##2}% |
1257 |
|
}% |
1258 |
|
\def\numsubsubsecentry##1##2##3##4{% |
1259 |
|
\advancenumber{subsec\thissubsecnum}% |
1260 |
|
}% |
1261 |
|
\def\thischapnum{0}% |
1262 |
|
\def\thissecnum{0}% |
1263 |
|
\def\thissubsecnum{0}% |
1264 |
|
% |
1265 |
|
% use \def rather than \let here because we redefine \chapentry et |
1266 |
|
% al. a second time, below. |
1267 |
|
\def\appentry{\numchapentry}% |
1268 |
|
\def\appsecentry{\numsecentry}% |
1269 |
|
\def\appsubsecentry{\numsubsecentry}% |
1270 |
|
\def\appsubsubsecentry{\numsubsubsecentry}% |
1271 |
|
\def\unnchapentry{\numchapentry}% |
1272 |
|
\def\unnsecentry{\numsecentry}% |
1273 |
|
\def\unnsubsecentry{\numsubsecentry}% |
1274 |
|
\def\unnsubsubsecentry{\numsubsubsecentry}% |
1275 |
|
\input \jobname.toc |
1276 |
|
% |
1277 |
|
% Read toc second time, this time actually producing the outlines. |
1278 |
|
% The `-' means take the \expnumber as the absolute number of |
1279 |
|
% subentries, which we calculated on our first read of the .toc above. |
1280 |
|
% |
1281 |
|
% We use the node names as the destinations. |
1282 |
|
\def\numchapentry##1##2##3##4{% |
1283 |
|
\dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% |
1284 |
|
\def\numsecentry##1##2##3##4{% |
1285 |
|
\dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% |
1286 |
|
\def\numsubsecentry##1##2##3##4{% |
1287 |
|
\dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% |
1288 |
|
\def\numsubsubsecentry##1##2##3##4{% count is always zero |
1289 |
|
\dopdfoutline{##1}{}{##3}{##4}}% |
1290 |
|
% |
1291 |
|
% PDF outlines are displayed using system fonts, instead of |
1292 |
|
% document fonts. Therefore we cannot use special characters, |
1293 |
|
% since the encoding is unknown. For example, the eogonek from |
1294 |
|
% Latin 2 (0xea) gets translated to a | character. Info from |
1295 |
|
% Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. |
1296 |
|
% |
1297 |
|
% xx to do this right, we have to translate 8-bit characters to |
1298 |
|
% their "best" equivalent, based on the @documentencoding. Right |
1299 |
|
% now, I guess we'll just let the pdf reader have its way. |
1300 |
|
\indexnofonts |
1301 |
|
\turnoffactive |
1302 |
|
\input \jobname.toc |
1303 |
|
\endgroup |
1304 |
|
} |
1305 |
|
% |
1306 |
|
\def\makelinks #1,{% |
1307 |
|
\def\params{#1}\def\E{END}% |
1308 |
|
\ifx\params\E |
1309 |
|
\let\nextmakelinks=\relax |
1310 |
|
\else |
1311 |
|
\let\nextmakelinks=\makelinks |
1312 |
|
\ifnum\lnkcount>0,\fi |
1313 |
|
\picknum{#1}% |
1314 |
|
\startlink attr{/Border [0 0 0]} |
1315 |
|
goto name{\pdfmkpgn{\the\pgn}}% |
1316 |
|
\linkcolor #1% |
1317 |
|
\advance\lnkcount by 1% |
1318 |
|
\endlink |
1319 |
|
\fi |
1320 |
|
\nextmakelinks |
1321 |
|
} |
1322 |
|
\def\picknum#1{\expandafter\pn#1} |
1323 |
|
\def\pn#1{% |
1324 |
|
\def\p{#1}% |
1325 |
|
\ifx\p\lbrace |
1326 |
|
\let\nextpn=\ppn |
1327 |
|
\else |
1328 |
|
\let\nextpn=\ppnn |
1329 |
|
\def\first{#1} |
1330 |
|
\fi |
1331 |
|
\nextpn |
1332 |
|
} |
1333 |
|
\def\ppn#1{\pgn=#1\gobble} |
1334 |
|
\def\ppnn{\pgn=\first} |
1335 |
|
\def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} |
1336 |
|
\def\skipspaces#1{\def\PP{#1}\def\D{|}% |
1337 |
|
\ifx\PP\D\let\nextsp\relax |
1338 |
|
\else\let\nextsp\skipspaces |
1339 |
|
\ifx\p\space\else\addtokens{\filename}{\PP}% |
1340 |
|
\advance\filenamelength by 1 |
1341 |
|
\fi |
1342 |
|
\fi |
1343 |
|
\nextsp} |
1344 |
|
\def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} |
1345 |
|
\ifnum\pdftexversion < 14 |
1346 |
|
\let \startlink \pdfannotlink |
1347 |
|
\else |
1348 |
|
\let \startlink \pdfstartlink |
1349 |
|
\fi |
1350 |
|
\def\pdfurl#1{% |
1351 |
|
\begingroup |
1352 |
|
\normalturnoffactive\def\@{@}% |
1353 |
|
\makevalueexpandable |
1354 |
|
\leavevmode\Red |
1355 |
|
\startlink attr{/Border [0 0 0]}% |
1356 |
|
user{/Subtype /Link /A << /S /URI /URI (#1) >>}% |
1357 |
|
\endgroup} |
1358 |
|
\def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} |
1359 |
|
\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} |
1360 |
|
\def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} |
1361 |
|
\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} |
1362 |
|
\def\maketoks{% |
1363 |
|
\expandafter\poptoks\the\toksA|ENDTOKS|\relax |
1364 |
|
\ifx\first0\adn0 |
1365 |
|
\else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 |
1366 |
|
\else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 |
1367 |
|
\else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 |
1368 |
|
\else |
1369 |
|
\ifnum0=\countA\else\makelink\fi |
1370 |
|
\ifx\first.\let\next=\done\else |
1371 |
|
\let\next=\maketoks |
1372 |
|
\addtokens{\toksB}{\the\toksD} |
1373 |
|
\ifx\first,\addtokens{\toksB}{\space}\fi |
1374 |
|
\fi |
1375 |
|
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi |
1376 |
|
\next} |
1377 |
|
\def\makelink{\addtokens{\toksB}% |
1378 |
|
{\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} |
1379 |
|
\def\pdflink#1{% |
1380 |
|
\startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} |
1381 |
|
\linkcolor #1\endlink} |
1382 |
|
\def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} |
1383 |
|
\else |
1384 |
|
\let\pdfmkdest = \gobble |
1385 |
|
\let\pdfurl = \gobble |
1386 |
|
\let\endlink = \relax |
1387 |
|
\let\linkcolor = \relax |
1388 |
|
\let\pdfmakeoutlines = \relax |
1389 |
|
\fi % \ifx\pdfoutput |
1390 |
|
|
1391 |
|
|
1392 |
\message{fonts,} |
\message{fonts,} |
1393 |
% Font-change commands. |
|
1394 |
|
% Change the current font style to #1, remembering it in \curfontstyle. |
1395 |
|
% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in |
1396 |
|
% italics, not bold italics. |
1397 |
|
% |
1398 |
|
\def\setfontstyle#1{% |
1399 |
|
\def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. |
1400 |
|
\csname ten#1\endcsname % change the current font |
1401 |
|
} |
1402 |
|
|
1403 |
|
% Select #1 fonts with the current style. |
1404 |
|
% |
1405 |
|
\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} |
1406 |
|
|
1407 |
|
\def\rm{\fam=0 \setfontstyle{rm}} |
1408 |
|
\def\it{\fam=\itfam \setfontstyle{it}} |
1409 |
|
\def\sl{\fam=\slfam \setfontstyle{sl}} |
1410 |
|
\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} |
1411 |
|
\def\tt{\fam=\ttfam \setfontstyle{tt}} |
1412 |
|
|
1413 |
% Texinfo sort of supports the sans serif font style, which plain TeX does not. |
% Texinfo sort of supports the sans serif font style, which plain TeX does not. |
1414 |
% So we set up a \sf analogous to plain's \rm, etc. |
% So we set up a \sf. |
1415 |
\newfam\sffam |
\newfam\sffam |
1416 |
\def\sf{\fam=\sffam \tensf} |
\def\sf{\fam=\sffam \setfontstyle{sf}} |
1417 |
\let\li = \sf % Sometimes we call it \li, not \sf. |
\let\li = \sf % Sometimes we call it \li, not \sf. |
1418 |
|
|
1419 |
% We don't need math for this one. |
% We don't need math for this font style. |
1420 |
\def\ttsl{\tenttsl} |
\def\ttsl{\setfontstyle{ttsl}} |
1421 |
|
|
1422 |
% Use Computer Modern fonts at \magstephalf (11pt). |
% Default leading. |
1423 |
\newcount\mainmagstep |
\newdimen\textleading \textleading = 13.2pt |
1424 |
\mainmagstep=\magstephalf |
|
1425 |
|
% Set the baselineskip to #1, and the lineskip and strut size |
1426 |
|
% correspondingly. There is no deep meaning behind these magic numbers |
1427 |
|
% used as factors; they just match (closely enough) what Knuth defined. |
1428 |
|
% |
1429 |
|
\def\lineskipfactor{.08333} |
1430 |
|
\def\strutheightpercent{.70833} |
1431 |
|
\def\strutdepthpercent {.29167} |
1432 |
|
% |
1433 |
|
\def\setleading#1{% |
1434 |
|
\normalbaselineskip = #1\relax |
1435 |
|
\normallineskip = \lineskipfactor\normalbaselineskip |
1436 |
|
\normalbaselines |
1437 |
|
\setbox\strutbox =\hbox{% |
1438 |
|
\vrule width0pt height\strutheightpercent\baselineskip |
1439 |
|
depth \strutdepthpercent \baselineskip |
1440 |
|
}% |
1441 |
|
} |
1442 |
|
|
1443 |
% Set the font macro #1 to the font named #2, adding on the |
% Set the font macro #1 to the font named #2, adding on the |
1444 |
% specified font prefix (normally `cm'). |
% specified font prefix (normally `cm'). |
1468 |
\def\scshape{csc} |
\def\scshape{csc} |
1469 |
\def\scbshape{csc} |
\def\scbshape{csc} |
1470 |
|
|
1471 |
\ifx\bigger\relax |
% Text fonts (11.2pt, magstep1). |
1472 |
\let\mainmagstep=\magstep1 |
\def\textnominalsize{11pt} |
1473 |
\setfont\textrm\rmshape{12}{1000} |
\edef\mainmagstep{\magstephalf} |
|
\setfont\texttt\ttshape{12}{1000} |
|
|
\else |
|
1474 |
\setfont\textrm\rmshape{10}{\mainmagstep} |
\setfont\textrm\rmshape{10}{\mainmagstep} |
1475 |
\setfont\texttt\ttshape{10}{\mainmagstep} |
\setfont\texttt\ttshape{10}{\mainmagstep} |
|
\fi |
|
|
% Instead of cmb10, you many want to use cmbx10. |
|
|
% cmbx10 is a prettier font on its own, but cmb10 |
|
|
% looks better when embedded in a line with cmr10. |
|
1476 |
\setfont\textbf\bfshape{10}{\mainmagstep} |
\setfont\textbf\bfshape{10}{\mainmagstep} |
1477 |
\setfont\textit\itshape{10}{\mainmagstep} |
\setfont\textit\itshape{10}{\mainmagstep} |
1478 |
\setfont\textsl\slshape{10}{\mainmagstep} |
\setfont\textsl\slshape{10}{\mainmagstep} |
1482 |
\font\texti=cmmi10 scaled \mainmagstep |
\font\texti=cmmi10 scaled \mainmagstep |
1483 |
\font\textsy=cmsy10 scaled \mainmagstep |
\font\textsy=cmsy10 scaled \mainmagstep |
1484 |
|
|
1485 |
% A few fonts for @defun, etc. |
% A few fonts for @defun names and args. |
1486 |
\setfont\defbf\bxshape{10}{\magstep1} %was 1314 |
\setfont\defbf\bfshape{10}{\magstep1} |
1487 |
\setfont\deftt\ttshape{10}{\magstep1} |
\setfont\deftt\ttshape{10}{\magstep1} |
1488 |
\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} |
\setfont\defttsl\ttslshape{10}{\magstep1} |
1489 |
|
\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} |
1490 |
|
|
1491 |
|
% Fonts for indices, footnotes, small examples (9pt). |
1492 |
|
\def\smallnominalsize{9pt} |
1493 |
|
\setfont\smallrm\rmshape{9}{1000} |
1494 |
|
\setfont\smalltt\ttshape{9}{1000} |
1495 |
|
\setfont\smallbf\bfshape{10}{900} |
1496 |
|
\setfont\smallit\itshape{9}{1000} |
1497 |
|
\setfont\smallsl\slshape{9}{1000} |
1498 |
|
\setfont\smallsf\sfshape{9}{1000} |
1499 |
|
\setfont\smallsc\scshape{10}{900} |
1500 |
|
\setfont\smallttsl\ttslshape{10}{900} |
1501 |
|
\font\smalli=cmmi9 |
1502 |
|
\font\smallsy=cmsy9 |
1503 |
|
|
1504 |
% Fonts for indices and small examples (9pt). |
% Fonts for small examples (8pt). |
1505 |
% We actually use the slanted font rather than the italic, |
\def\smallernominalsize{8pt} |
1506 |
% because texinfo normally uses the slanted fonts for that. |
\setfont\smallerrm\rmshape{8}{1000} |
1507 |
% Do not make many font distinctions in general in the index, since they |
\setfont\smallertt\ttshape{8}{1000} |
1508 |
% aren't very useful. |
\setfont\smallerbf\bfshape{10}{800} |
1509 |
\setfont\ninett\ttshape{9}{1000} |
\setfont\smallerit\itshape{8}{1000} |
1510 |
\setfont\ninettsl\ttslshape{10}{900} |
\setfont\smallersl\slshape{8}{1000} |
1511 |
\setfont\indrm\rmshape{9}{1000} |
\setfont\smallersf\sfshape{8}{1000} |
1512 |
\setfont\indit\itshape{9}{1000} |
\setfont\smallersc\scshape{10}{800} |
1513 |
\setfont\indsl\slshape{9}{1000} |
\setfont\smallerttsl\ttslshape{10}{800} |
1514 |
\let\indtt=\ninett |
\font\smalleri=cmmi8 |
1515 |
\let\indttsl=\ninettsl |
\font\smallersy=cmsy8 |
|
\let\indsf=\indrm |
|
|
\let\indbf=\indrm |
|
|
\setfont\indsc\scshape{10}{900} |
|
|
\font\indi=cmmi9 |
|
|
\font\indsy=cmsy9 |
|
1516 |
|
|
1517 |
% Fonts for title page: |
% Fonts for title page (20.4pt): |
1518 |
|
\def\titlenominalsize{20pt} |
1519 |
\setfont\titlerm\rmbshape{12}{\magstep3} |
\setfont\titlerm\rmbshape{12}{\magstep3} |
1520 |
\setfont\titleit\itbshape{10}{\magstep4} |
\setfont\titleit\itbshape{10}{\magstep4} |
1521 |
\setfont\titlesl\slbshape{10}{\magstep4} |
\setfont\titlesl\slbshape{10}{\magstep4} |
1527 |
\font\titlei=cmmi12 scaled \magstep3 |
\font\titlei=cmmi12 scaled \magstep3 |
1528 |
\font\titlesy=cmsy10 scaled \magstep4 |
\font\titlesy=cmsy10 scaled \magstep4 |
1529 |
\def\authorrm{\secrm} |
\def\authorrm{\secrm} |
1530 |
|
\def\authortt{\sectt} |
1531 |
|
|
1532 |
% Chapter (and unnumbered) fonts (17.28pt). |
% Chapter (and unnumbered) fonts (17.28pt). |
1533 |
|
\def\chapnominalsize{17pt} |
1534 |
\setfont\chaprm\rmbshape{12}{\magstep2} |
\setfont\chaprm\rmbshape{12}{\magstep2} |
1535 |
\setfont\chapit\itbshape{10}{\magstep3} |
\setfont\chapit\itbshape{10}{\magstep3} |
1536 |
\setfont\chapsl\slbshape{10}{\magstep3} |
\setfont\chapsl\slbshape{10}{\magstep3} |
1543 |
\font\chapsy=cmsy10 scaled \magstep3 |
\font\chapsy=cmsy10 scaled \magstep3 |
1544 |
|
|
1545 |
% Section fonts (14.4pt). |
% Section fonts (14.4pt). |
1546 |
|
\def\secnominalsize{14pt} |
1547 |
\setfont\secrm\rmbshape{12}{\magstep1} |
\setfont\secrm\rmbshape{12}{\magstep1} |
1548 |
\setfont\secit\itbshape{10}{\magstep2} |
\setfont\secit\itbshape{10}{\magstep2} |
1549 |
\setfont\secsl\slbshape{10}{\magstep2} |
\setfont\secsl\slbshape{10}{\magstep2} |
1555 |
\font\seci=cmmi12 scaled \magstep1 |
\font\seci=cmmi12 scaled \magstep1 |
1556 |
\font\secsy=cmsy10 scaled \magstep2 |
\font\secsy=cmsy10 scaled \magstep2 |
1557 |
|
|
|
% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad. |
|
|
% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded. |
|
|
% \setfont\ssecsl\slshape{10}{\magstep1} |
|
|
% \setfont\ssectt\ttshape{10}{\magstep1} |
|
|
% \setfont\ssecsf\sfshape{10}{\magstep1} |
|
|
|
|
|
%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx. |
|
|
%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than |
|
|
%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1. |
|
|
%\setfont\ssectt\ttshape{10}{1315} |
|
|
%\setfont\ssecsf\sfshape{10}{1315} |
|
|
|
|
|
%\let\ssecbf=\ssecrm |
|
|
|
|
1558 |
% Subsection fonts (13.15pt). |
% Subsection fonts (13.15pt). |
1559 |
|
\def\ssecnominalsize{13pt} |
1560 |
\setfont\ssecrm\rmbshape{12}{\magstephalf} |
\setfont\ssecrm\rmbshape{12}{\magstephalf} |
1561 |
\setfont\ssecit\itbshape{10}{1315} |
\setfont\ssecit\itbshape{10}{1315} |
1562 |
\setfont\ssecsl\slbshape{10}{1315} |
\setfont\ssecsl\slbshape{10}{1315} |
1564 |
\setfont\ssecttsl\ttslshape{10}{1315} |
\setfont\ssecttsl\ttslshape{10}{1315} |
1565 |
\setfont\ssecsf\sfbshape{12}{\magstephalf} |
\setfont\ssecsf\sfbshape{12}{\magstephalf} |
1566 |
\let\ssecbf\ssecrm |
\let\ssecbf\ssecrm |
1567 |
\setfont\ssecsc\scbshape{10}{\magstep1} |
\setfont\ssecsc\scbshape{10}{1315} |
1568 |
\font\sseci=cmmi12 scaled \magstephalf |
\font\sseci=cmmi12 scaled \magstephalf |
1569 |
\font\ssecsy=cmsy10 scaled 1315 |
\font\ssecsy=cmsy10 scaled 1315 |
1570 |
% The smallcaps and symbol fonts should actually be scaled \magstep1.5, |
|
1571 |
% but that is not a standard magnification. |
% Reduced fonts for @acro in text (10pt). |
1572 |
|
\def\reducednominalsize{10pt} |
1573 |
|
\setfont\reducedrm\rmshape{10}{1000} |
1574 |
|
\setfont\reducedtt\ttshape{10}{1000} |
1575 |
|
\setfont\reducedbf\bfshape{10}{1000} |
1576 |
|
\setfont\reducedit\itshape{10}{1000} |
1577 |
|
\setfont\reducedsl\slshape{10}{1000} |
1578 |
|
\setfont\reducedsf\sfshape{10}{1000} |
1579 |
|
\setfont\reducedsc\scshape{10}{1000} |
1580 |
|
\setfont\reducedttsl\ttslshape{10}{1000} |
1581 |
|
\font\reducedi=cmmi10 |
1582 |
|
\font\reducedsy=cmsy10 |
1583 |
|
|
1584 |
% In order for the font changes to affect most math symbols and letters, |
% In order for the font changes to affect most math symbols and letters, |
1585 |
% we have to define the \textfont of the standard families. Since |
% we have to define the \textfont of the standard families. Since |
1586 |
% texinfo doesn't allow for producing subscripts and superscripts, we |
% texinfo doesn't allow for producing subscripts and superscripts except |
1587 |
% don't bother to reset \scriptfont and \scriptscriptfont (which would |
% in the main text, we don't bother to reset \scriptfont and |
1588 |
% also require loading a lot more fonts). |
% \scriptscriptfont (which would also require loading a lot more fonts). |
1589 |
% |
% |
1590 |
\def\resetmathfonts{% |
\def\resetmathfonts{% |
1591 |
\textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy |
\textfont0=\tenrm \textfont1=\teni \textfont2=\tensy |
1592 |
\textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf |
\textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf |
1593 |
\textfont\ttfam = \tentt \textfont\sffam = \tensf |
\textfont\ttfam=\tentt \textfont\sffam=\tensf |
1594 |
} |
} |
1595 |
|
|
|
|
|
1596 |
% The font-changing commands redefine the meanings of \tenSTYLE, instead |
% The font-changing commands redefine the meanings of \tenSTYLE, instead |
1597 |
% of just \STYLE. We do this so that font changes will continue to work |
% of just \STYLE. We do this because \STYLE needs to also set the |
1598 |
% in math mode, where it is the current \fam that is relevant in most |
% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire |
1599 |
% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam |
% \tenSTYLE to set the current font. |
1600 |
% \tenbf}, for example. By redefining \tenbf, we obviate the need to |
% |
1601 |
% redefine \bf itself. |
% Each font-changing command also sets the names \lsize (one size lower) |
1602 |
|
% and \lllsize (three sizes lower). These relative commands are used in |
1603 |
|
% the LaTeX logo and acronyms. |
1604 |
|
% |
1605 |
|
% This all needs generalizing, badly. |
1606 |
|
% |
1607 |
\def\textfonts{% |
\def\textfonts{% |
1608 |
\let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl |
\let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl |
1609 |
\let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc |
\let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc |
1610 |
\let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl |
\let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy |
1611 |
\resetmathfonts} |
\let\tenttsl=\textttsl |
1612 |
|
\def\curfontsize{text}% |
1613 |
|
\def\lsize{reduced}\def\lllsize{smaller}% |
1614 |
|
\resetmathfonts \setleading{\textleading}} |
1615 |
\def\titlefonts{% |
\def\titlefonts{% |
1616 |
\let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl |
\let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl |
1617 |
\let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc |
\let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc |
1618 |
\let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy |
\let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy |
1619 |
\let\tenttsl=\titlettsl |
\let\tenttsl=\titlettsl |
1620 |
|
\def\curfontsize{title}% |
1621 |
|
\def\lsize{chap}\def\lllsize{subsec}% |
1622 |
\resetmathfonts \setleading{25pt}} |
\resetmathfonts \setleading{25pt}} |
1623 |
\def\titlefont#1{{\titlefonts\rm #1}} |
\def\titlefont#1{{\titlefonts\rm #1}} |
1624 |
\def\chapfonts{% |
\def\chapfonts{% |
1625 |
\let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl |
\let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl |
1626 |
\let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc |
\let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc |
1627 |
\let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl |
\let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy |
1628 |
|
\let\tenttsl=\chapttsl |
1629 |
|
\def\curfontsize{chap}% |
1630 |
|
\def\lsize{sec}\def\lllsize{text}% |
1631 |
\resetmathfonts \setleading{19pt}} |
\resetmathfonts \setleading{19pt}} |
1632 |
\def\secfonts{% |
\def\secfonts{% |
1633 |
\let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl |
\let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl |
1634 |
\let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc |
\let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc |
1635 |
\let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl |
\let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy |
1636 |
|
\let\tenttsl=\secttsl |
1637 |
|
\def\curfontsize{sec}% |
1638 |
|
\def\lsize{subsec}\def\lllsize{reduced}% |
1639 |
\resetmathfonts \setleading{16pt}} |
\resetmathfonts \setleading{16pt}} |
1640 |
\def\subsecfonts{% |
\def\subsecfonts{% |
1641 |
\let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl |
\let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl |
1642 |
\let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc |
\let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc |
1643 |
\let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl |
\let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy |
1644 |
|
\let\tenttsl=\ssecttsl |
1645 |
|
\def\curfontsize{ssec}% |
1646 |
|
\def\lsize{text}\def\lllsize{small}% |
1647 |
\resetmathfonts \setleading{15pt}} |
\resetmathfonts \setleading{15pt}} |
1648 |
\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? |
\let\subsubsecfonts = \subsecfonts |
1649 |
\def\indexfonts{% |
\def\reducedfonts{% |
1650 |
\let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl |
\let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl |
1651 |
\let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc |
\let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc |
1652 |
\let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl |
\let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy |
1653 |
\resetmathfonts \setleading{12pt}} |
\let\tenttsl=\reducedttsl |
1654 |
|
\def\curfontsize{reduced}% |
1655 |
|
\def\lsize{small}\def\lllsize{smaller}% |
1656 |
|
\resetmathfonts \setleading{10.5pt}} |
1657 |
|
\def\smallfonts{% |
1658 |
|
\let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl |
1659 |
|
\let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc |
1660 |
|
\let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy |
1661 |
|
\let\tenttsl=\smallttsl |
1662 |
|
\def\curfontsize{small}% |
1663 |
|
\def\lsize{smaller}\def\lllsize{smaller}% |
1664 |
|
\resetmathfonts \setleading{10.5pt}} |
1665 |
|
\def\smallerfonts{% |
1666 |
|
\let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl |
1667 |
|
\let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc |
1668 |
|
\let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy |
1669 |
|
\let\tenttsl=\smallerttsl |
1670 |
|
\def\curfontsize{smaller}% |
1671 |
|
\def\lsize{smaller}\def\lllsize{smaller}% |
1672 |
|
\resetmathfonts \setleading{9.5pt}} |
1673 |
|
|
1674 |
|
% Set the fonts to use with the @small... environments. |
1675 |
|
\let\smallexamplefonts = \smallfonts |
1676 |
|
|
1677 |
|
% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample |
1678 |
|
% can fit this many characters: |
1679 |
|
% 8.5x11=86 smallbook=72 a4=90 a5=69 |
1680 |
|
% If we use \scriptfonts (8pt), then we can fit this many characters: |
1681 |
|
% 8.5x11=90+ smallbook=80 a4=90+ a5=77 |
1682 |
|
% For me, subjectively, the few extra characters that fit aren't worth |
1683 |
|
% the additional smallness of 8pt. So I'm making the default 9pt. |
1684 |
|
% |
1685 |
|
% By the way, for comparison, here's what fits with @example (10pt): |
1686 |
|
% 8.5x11=71 smallbook=60 a4=75 a5=58 |
1687 |
|
% |
1688 |
|
% I wish the USA used A4 paper. |
1689 |
|
% --karl, 24jan03. |
1690 |
|
|
1691 |
|
|
1692 |
% Set up the default fonts, so we can use them for creating boxes. |
% Set up the default fonts, so we can use them for creating boxes. |
1693 |
% |
% |
1694 |
\textfonts |
\textfonts \rm |
1695 |
|
|
1696 |
% Define these so they can be easily changed for other fonts. |
% Define these so they can be easily changed for other fonts. |
1697 |
\def\angleleft{$\langle$} |
\def\angleleft{$\langle$} |
1702 |
|
|
1703 |
% Fonts for short table of contents. |
% Fonts for short table of contents. |
1704 |
\setfont\shortcontrm\rmshape{12}{1000} |
\setfont\shortcontrm\rmshape{12}{1000} |
1705 |
\setfont\shortcontbf\bxshape{12}{1000} |
\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 |
1706 |
\setfont\shortcontsl\slshape{12}{1000} |
\setfont\shortcontsl\slshape{12}{1000} |
1707 |
|
\setfont\shortconttt\ttshape{12}{1000} |
1708 |
|
|
1709 |
%% Add scribe-like font environments, plus @l for inline lisp (usually sans |
%% Add scribe-like font environments, plus @l for inline lisp (usually sans |
1710 |
%% serif) and @ii for TeX italic |
%% serif) and @ii for TeX italic |
1711 |
|
|
1712 |
% \smartitalic{ARG} outputs arg in italics, followed by an italic correction |
% \smartitalic{ARG} outputs arg in italics, followed by an italic correction |
1713 |
% unless the following character is such as not to need one. |
% unless the following character is such as not to need one. |
1714 |
\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} |
\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else |
1715 |
\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx} |
\ptexslash\fi\fi\fi} |
1716 |
\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx} |
\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} |
1717 |
|
\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} |
1718 |
|
|
1719 |
|
% like \smartslanted except unconditionally uses \ttsl. |
1720 |
|
% @var is set to this for defun arguments. |
1721 |
|
\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} |
1722 |
|
|
1723 |
|
% like \smartslanted except unconditionally use \sl. We never want |
1724 |
|
% ttsl for book titles, do we? |
1725 |
|
\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} |
1726 |
|
|
1727 |
\let\i=\smartitalic |
\let\i=\smartitalic |
1728 |
|
\let\slanted=\smartslanted |
1729 |
\let\var=\smartslanted |
\let\var=\smartslanted |
1730 |
\let\dfn=\smartslanted |
\let\dfn=\smartslanted |
1731 |
\let\emph=\smartitalic |
\let\emph=\smartitalic |
|
\let\cite=\smartslanted |
|
1732 |
|
|
1733 |
|
% @b, explicit bold. |
1734 |
\def\b#1{{\bf #1}} |
\def\b#1{{\bf #1}} |
1735 |
\let\strong=\b |
\let\strong=\b |
1736 |
|
|
1737 |
|
% @sansserif, explicit sans. |
1738 |
|
\def\sansserif#1{{\sf #1}} |
1739 |
|
|
1740 |
% We can't just use \exhyphenpenalty, because that only has effect at |
% We can't just use \exhyphenpenalty, because that only has effect at |
1741 |
% the end of a paragraph. Restore normal hyphenation at the end of the |
% the end of a paragraph. Restore normal hyphenation at the end of the |
1742 |
% group within which \nohyphenation is presumably called. |
% group within which \nohyphenation is presumably called. |
1744 |
\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} |
\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} |
1745 |
\def\restorehyphenation{\hyphenchar\font = `- } |
\def\restorehyphenation{\hyphenchar\font = `- } |
1746 |
|
|
1747 |
|
% Set sfcode to normal for the chars that usually have another value. |
1748 |
|
% Can't use plain's \frenchspacing because it uses the `\x notation, and |
1749 |
|
% sometimes \x has an active definition that messes things up. |
1750 |
|
% |
1751 |
|
\catcode`@=11 |
1752 |
|
\def\frenchspacing{% |
1753 |
|
\sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m |
1754 |
|
\sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m |
1755 |
|
} |
1756 |
|
\catcode`@=\other |
1757 |
|
|
1758 |
\def\t#1{% |
\def\t#1{% |
1759 |
{\tt \rawbackslash \frenchspacing #1}% |
{\tt \rawbackslash \frenchspacing #1}% |
1760 |
\null |
\null |
1761 |
} |
} |
|
\let\ttfont=\t |
|
1762 |
\def\samp#1{`\tclose{#1}'\null} |
\def\samp#1{`\tclose{#1}'\null} |
1763 |
\setfont\smallrm\rmshape{8}{1000} |
\setfont\keyrm\rmshape{8}{1000} |
1764 |
\font\smallsy=cmsy9 |
\font\keysy=cmsy9 |
1765 |
\def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{% |
\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% |
1766 |
\raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% |
\raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% |
1767 |
\vbox{\hrule\kern-0.4pt |
\vbox{\hrule\kern-0.4pt |
1768 |
\hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% |
\hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% |
1799 |
\null |
\null |
1800 |
} |
} |
1801 |
|
|
1802 |
% We *must* turn on hyphenation at `-' and `_' in \code. |
% We *must* turn on hyphenation at `-' and `_' in @code. |
1803 |
% Otherwise, it is too hard to avoid overfull hboxes |
% Otherwise, it is too hard to avoid overfull hboxes |
1804 |
% in the Emacs manual, the Library manual, etc. |
% in the Emacs manual, the Library manual, etc. |
1805 |
|
|
1817 |
\catcode`\_=\active \let_\codeunder |
\catcode`\_=\active \let_\codeunder |
1818 |
\codex |
\codex |
1819 |
} |
} |
|
% |
|
|
% If we end up with any active - characters when handling the index, |
|
|
% just treat them as a normal -. |
|
|
\global\def\indexbreaks{\catcode`\-=\active \let-\realdash} |
|
1820 |
} |
} |
1821 |
|
|
1822 |
\def\realdash{-} |
\def\realdash{-} |
1823 |
\def\codedash{-\discretionary{}{}{}} |
\def\codedash{-\discretionary{}{}{}} |
1824 |
\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}} |
\def\codeunder{% |
1825 |
|
% this is all so @math{@code{var_name}+1} can work. In math mode, _ |
1826 |
|
% is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) |
1827 |
|
% will therefore expand the active definition of _, which is us |
1828 |
|
% (inside @code that is), therefore an endless loop. |
1829 |
|
\ifusingtt{\ifmmode |
1830 |
|
\mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. |
1831 |
|
\else\normalunderscore \fi |
1832 |
|
\discretionary{}{}{}}% |
1833 |
|
{\_}% |
1834 |
|
} |
1835 |
\def\codex #1{\tclose{#1}\endgroup} |
\def\codex #1{\tclose{#1}\endgroup} |
1836 |
|
|
|
%\let\exp=\tclose %Was temporary |
|
|
|
|
1837 |
% @kbd is like @code, except that if the argument is just one @key command, |
% @kbd is like @code, except that if the argument is just one @key command, |
1838 |
% then @kbd has no effect. |
% then @kbd has no effect. |
1839 |
|
|
1840 |
% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), |
% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), |
1841 |
% `example' (@kbd uses ttsl only inside of @example and friends), |
% `example' (@kbd uses ttsl only inside of @example and friends), |
1842 |
% or `code' (@kbd uses normal tty font always). |
% or `code' (@kbd uses normal tty font always). |
1843 |
\def\kbdinputstyle{\parsearg\kbdinputstylexxx} |
\parseargdef\kbdinputstyle{% |
|
\def\kbdinputstylexxx#1{% |
|
1844 |
\def\arg{#1}% |
\def\arg{#1}% |
1845 |
\ifx\arg\worddistinct |
\ifx\arg\worddistinct |
1846 |
\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% |
\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% |
1848 |
\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% |
\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% |
1849 |
\else\ifx\arg\wordcode |
\else\ifx\arg\wordcode |
1850 |
\gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% |
\gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% |
1851 |
|
\else |
1852 |
|
\errhelp = \EMsimple |
1853 |
|
\errmessage{Unknown @kbdinputstyle option `\arg'}% |
1854 |
\fi\fi\fi |
\fi\fi\fi |
1855 |
} |
} |
1856 |
\def\worddistinct{distinct} |
\def\worddistinct{distinct} |
1857 |
\def\wordexample{example} |
\def\wordexample{example} |
1858 |
\def\wordcode{code} |
\def\wordcode{code} |
1859 |
|
|
1860 |
% Default is kbdinputdistinct. (Too much of a hassle to call the macro, |
% Default is `distinct.' |
1861 |
% the catcodes are wrong for parsearg to work.) |
\kbdinputstyle distinct |
|
\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} |
|
1862 |
|
|
1863 |
\def\xkey{\key} |
\def\xkey{\key} |
1864 |
\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% |
\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% |
1866 |
\else{\tclose{\kbdfont\look}}\fi |
\else{\tclose{\kbdfont\look}}\fi |
1867 |
\else{\tclose{\kbdfont\look}}\fi} |
\else{\tclose{\kbdfont\look}}\fi} |
1868 |
|
|
1869 |
% For @url, @env, @command quotes seem unnecessary, so use \code. |
% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. |
1870 |
\let\url=\code |
\let\indicateurl=\code |
1871 |
\let\env=\code |
\let\env=\code |
1872 |
\let\command=\code |
\let\command=\code |
1873 |
|
|
1878 |
% a hypertex \special here. |
% a hypertex \special here. |
1879 |
% |
% |
1880 |
\def\uref#1{\douref #1,,,\finish} |
\def\uref#1{\douref #1,,,\finish} |
1881 |
\def\douref#1,#2,#3,#4\finish{% |
\def\douref#1,#2,#3,#4\finish{\begingroup |
1882 |
|
\unsepspaces |
1883 |
|
\pdfurl{#1}% |
1884 |
\setbox0 = \hbox{\ignorespaces #3}% |
\setbox0 = \hbox{\ignorespaces #3}% |
1885 |
\ifdim\wd0 > 0pt |
\ifdim\wd0 > 0pt |
1886 |
\unhbox0 % third arg given, show only that |
\unhbox0 % third arg given, show only that |
1887 |
\else |
\else |
1888 |
\setbox0 = \hbox{\ignorespaces #2}% |
\setbox0 = \hbox{\ignorespaces #2}% |
1889 |
\ifdim\wd0 > 0pt |
\ifdim\wd0 > 0pt |
1890 |
\unhbox0\ (\code{#1})% second arg given, show both it and url |
\ifpdf |
1891 |
|
\unhbox0 % PDF: 2nd arg given, show only it |
1892 |
|
\else |
1893 |
|
\unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url |
1894 |
|
\fi |
1895 |
\else |
\else |
1896 |
\code{#1}% only url given, so show it |
\code{#1}% only url given, so show it |
1897 |
\fi |
\fi |
1898 |
\fi |
\fi |
1899 |
} |
\endlink |
1900 |
|
\endgroup} |
1901 |
|
|
1902 |
|
% @url synonym for @uref, since that's how everyone uses it. |
1903 |
|
% |
1904 |
|
\let\url=\uref |
1905 |
|
|
1906 |
% rms does not like the angle brackets --karl, 17may97. |
% rms does not like angle brackets --karl, 17may97. |
1907 |
% So now @email is just like @uref. |
% So now @email is just like @uref, unless we are pdf. |
1908 |
|
% |
1909 |
%\def\email#1{\angleleft{\tt #1}\angleright} |
%\def\email#1{\angleleft{\tt #1}\angleright} |
1910 |
\let\email=\uref |
\ifpdf |
1911 |
|
\def\email#1{\doemail#1,,\finish} |
1912 |
|
\def\doemail#1,#2,#3\finish{\begingroup |
1913 |
|
\unsepspaces |
1914 |
|
\pdfurl{mailto:#1}% |
1915 |
|
\setbox0 = \hbox{\ignorespaces #2}% |
1916 |
|
\ifdim\wd0>0pt\unhbox0\else\code{#1}\fi |
1917 |
|
\endlink |
1918 |
|
\endgroup} |
1919 |
|
\else |
1920 |
|
\let\email=\uref |
1921 |
|
\fi |
1922 |
|
|
1923 |
% Check if we are currently using a typewriter font. Since all the |
% Check if we are currently using a typewriter font. Since all the |
1924 |
% Computer Modern typewriter fonts have zero interword stretch (and |
% Computer Modern typewriter fonts have zero interword stretch (and |
1944 |
\def\sc#1{{\smallcaps#1}} % smallcaps font |
\def\sc#1{{\smallcaps#1}} % smallcaps font |
1945 |
\def\ii#1{{\it #1}} % italic font |
\def\ii#1{{\it #1}} % italic font |
1946 |
|
|
1947 |
% @acronym downcases the argument and prints in smallcaps. |
% @acronym for "FBI", "NATO", and the like. |
1948 |
\def\acronym#1{{\smallcaps \lowercase{#1}}} |
% We print this one point size smaller, since it's intended for |
1949 |
|
% all-uppercase. |
1950 |
|
% |
1951 |
|
\def\acronym#1{\doacronym #1,,\finish} |
1952 |
|
\def\doacronym#1,#2,#3\finish{% |
1953 |
|
{\selectfonts\lsize #1}% |
1954 |
|
\def\temp{#2}% |
1955 |
|
\ifx\temp\empty \else |
1956 |
|
\space ({\unsepspaces \ignorespaces \temp \unskip})% |
1957 |
|
\fi |
1958 |
|
} |
1959 |
|
|
1960 |
% @pounds{} is a sterling sign. |
% @abbr for "Comput. J." and the like. |
1961 |
|
% No font change, but don't do end-of-sentence spacing. |
1962 |
|
% |
1963 |
|
\def\abbr#1{\doabbr #1,,\finish} |
1964 |
|
\def\doabbr#1,#2,#3\finish{% |
1965 |
|
{\frenchspacing #1}% |
1966 |
|
\def\temp{#2}% |
1967 |
|
\ifx\temp\empty \else |
1968 |
|
\space ({\unsepspaces \ignorespaces \temp \unskip})% |
1969 |
|
\fi |
1970 |
|
} |
1971 |
|
|
1972 |
|
% @pounds{} is a sterling sign, which Knuth put in the CM italic font. |
1973 |
|
% |
1974 |
\def\pounds{{\it\$}} |
\def\pounds{{\it\$}} |
1975 |
|
|
1976 |
|
% @euro{} comes from a separate font, depending on the current style. |
1977 |
|
% We use the free feym* fonts from the eurosym package by Henrik |
1978 |
|
% Theiling, which support regular, slanted, bold and bold slanted (and |
1979 |
|
% "outlined" (blackboard board, sort of) versions, which we don't need). |
1980 |
|
% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. |
1981 |
|
% |
1982 |
|
% Although only regular is the truly official Euro symbol, we ignore |
1983 |
|
% that. The Euro is designed to be slightly taller than the regular |
1984 |
|
% font height. |
1985 |
|
% |
1986 |
|
% feymr - regular |
1987 |
|
% feymo - slanted |
1988 |
|
% feybr - bold |
1989 |
|
% feybo - bold slanted |
1990 |
|
% |
1991 |
|
% There is no good (free) typewriter version, to my knowledge. |
1992 |
|
% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. |
1993 |
|
% Hmm. |
1994 |
|
% |
1995 |
|
% Also doesn't work in math. Do we need to do math with euro symbols? |
1996 |
|
% Hope not. |
1997 |
|
% |
1998 |
|
% |
1999 |
|
\def\euro{{\eurofont e}} |
2000 |
|
\def\eurofont{% |
2001 |
|
% We set the font at each command, rather than predefining it in |
2002 |
|
% \textfonts and the other font-switching commands, so that |
2003 |
|
% installations which never need the symbold don't have to have the |
2004 |
|
% font installed. |
2005 |
|
% |
2006 |
|
% There is only one designed size (nominal 10pt), so we always scale |
2007 |
|
% that to the current nominal size. |
2008 |
|
% |
2009 |
|
% By the way, simply using "at 1em" works for cmr10 and the like, but |
2010 |
|
% does not work for cmbx10 and other extended/shrunken fonts. |
2011 |
|
% |
2012 |
|
\def\eurosize{\csname\curfontsize nominalsize\endcsname}% |
2013 |
|
% |
2014 |
|
\ifx\curfontstyle\bfstylename |
2015 |
|
% bold: |
2016 |
|
\font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize |
2017 |
|
\else |
2018 |
|
% regular: |
2019 |
|
\font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize |
2020 |
|
\fi |
2021 |
|
\thiseurofont |
2022 |
|
} |
2023 |
|
|
2024 |
|
% @registeredsymbol - R in a circle. The font for the R should really |
2025 |
|
% be smaller yet, but lllsize is the best we can do for now. |
2026 |
|
% Adapted from the plain.tex definition of \copyright. |
2027 |
|
% |
2028 |
|
\def\registeredsymbol{% |
2029 |
|
$^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% |
2030 |
|
\hfil\crcr\Orb}}% |
2031 |
|
}$% |
2032 |
|
} |
2033 |
|
|
2034 |
|
% Laurent Siebenmann reports \Orb undefined with: |
2035 |
|
% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 |
2036 |
|
% so we'll define it if necessary. |
2037 |
|
% |
2038 |
|
\ifx\Orb\undefined |
2039 |
|
\def\Orb{\mathhexbox20D} |
2040 |
|
\fi |
2041 |
|
|
2042 |
|
|
2043 |
\message{page headings,} |
\message{page headings,} |
2044 |
|
|
2057 |
\newif\ifsetshortcontentsaftertitlepage |
\newif\ifsetshortcontentsaftertitlepage |
2058 |
\let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue |
\let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue |
2059 |
|
|
2060 |
\def\shorttitlepage{\parsearg\shorttitlepagezzz} |
\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% |
|
\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% |
|
2061 |
\endgroup\page\hbox{}\page} |
\endgroup\page\hbox{}\page} |
2062 |
|
|
2063 |
\def\titlepage{\begingroup \parindent=0pt \textfonts |
\envdef\titlepage{% |
2064 |
\let\subtitlerm=\tenrm |
% Open one extra group, as we want to close it in the middle of \Etitlepage. |
2065 |
\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% |
\begingroup |
2066 |
% |
\parindent=0pt \textfonts |
2067 |
\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% |
% Leave some space at the very top of the page. |
2068 |
% |
\vglue\titlepagetopglue |
2069 |
% Leave some space at the very top of the page. |
% No rule at page bottom unless we print one at the top with @title. |
2070 |
\vglue\titlepagetopglue |
\finishedtitlepagetrue |
2071 |
% |
% |
2072 |
% Now you can print the title using @title. |
% Most title ``pages'' are actually two pages long, with space |
2073 |
\def\title{\parsearg\titlezzz}% |
% at the top of the second. We don't want the ragged left on the second. |
2074 |
\def\titlezzz##1{\leftline{\titlefonts\rm ##1} |
\let\oldpage = \page |
2075 |
% print a rule at the page bottom also. |
\def\page{% |
|
\finishedtitlepagefalse |
|
|
\vskip4pt \hrule height 4pt width \hsize \vskip4pt}% |
|
|
% No rule at page bottom unless we print one at the top with @title. |
|
|
\finishedtitlepagetrue |
|
|
% |
|
|
% Now you can put text using @subtitle. |
|
|
\def\subtitle{\parsearg\subtitlezzz}% |
|
|
\def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% |
|
|
% |
|
|
% @author should come last, but may come many times. |
|
|
\def\author{\parsearg\authorzzz}% |
|
|
\def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi |
|
|
{\authorfont \leftline{##1}}}% |
|
|
% |
|
|
% Most title ``pages'' are actually two pages long, with space |
|
|
% at the top of the second. We don't want the ragged left on the second. |
|
|
\let\oldpage = \page |
|
|
\def\page{% |
|
2076 |
\iffinishedtitlepage\else |
\iffinishedtitlepage\else |
2077 |
\finishtitlepage |
\finishtitlepage |
2078 |
\fi |
\fi |
|
\oldpage |
|
2079 |
\let\page = \oldpage |
\let\page = \oldpage |
2080 |
\hbox{}}% |
\page |
2081 |
% \def\page{\oldpage \hbox{}} |
\null |
2082 |
|
}% |
2083 |
} |
} |
2084 |
|
|
2085 |
\def\Etitlepage{% |
\def\Etitlepage{% |
2086 |
\iffinishedtitlepage\else |
\iffinishedtitlepage\else |
2087 |
\finishtitlepage |
\finishtitlepage |
2088 |
\fi |
\fi |
2089 |
% It is important to do the page break before ending the group, |
% It is important to do the page break before ending the group, |
2090 |
% because the headline and footline are only empty inside the group. |
% because the headline and footline are only empty inside the group. |
2091 |
% If we use the new definition of \page, we always get a blank page |
% If we use the new definition of \page, we always get a blank page |
2092 |
% after the title page, which we certainly don't want. |
% after the title page, which we certainly don't want. |
2093 |
\oldpage |
\oldpage |
2094 |
\endgroup |
\endgroup |
2095 |
% |
% |
2096 |
% If they want short, they certainly want long too. |
% Need this before the \...aftertitlepage checks so that if they are |
2097 |
\ifsetshortcontentsaftertitlepage |
% in effect the toc pages will come out with page numbers. |
2098 |
\shortcontents |
\HEADINGSon |
2099 |
\contents |
% |
2100 |
\global\let\shortcontents = \relax |
% If they want short, they certainly want long too. |
2101 |
\global\let\contents = \relax |
\ifsetshortcontentsaftertitlepage |
2102 |
\fi |
\shortcontents |
2103 |
% |
\contents |
2104 |
\ifsetcontentsaftertitlepage |
\global\let\shortcontents = \relax |
2105 |
\contents |
\global\let\contents = \relax |
2106 |
\global\let\contents = \relax |
\fi |
2107 |
\global\let\shortcontents = \relax |
% |
2108 |
\fi |
\ifsetcontentsaftertitlepage |
2109 |
% |
\contents |
2110 |
\HEADINGSon |
\global\let\contents = \relax |
2111 |
|
\global\let\shortcontents = \relax |
2112 |
|
\fi |
2113 |
} |
} |
2114 |
|
|
2115 |
\def\finishtitlepage{% |
\def\finishtitlepage{% |
2116 |
\vskip4pt \hrule height 2pt width \hsize |
\vskip4pt \hrule height 2pt width \hsize |
2117 |
\vskip\titlepagebottomglue |
\vskip\titlepagebottomglue |
2118 |
\finishedtitlepagetrue |
\finishedtitlepagetrue |
2119 |
} |
} |
2120 |
|
|
2121 |
|
%%% Macros to be used within @titlepage: |
2122 |
|
|
2123 |
|
\let\subtitlerm=\tenrm |
2124 |
|
\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} |
2125 |
|
|
2126 |
|
\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines |
2127 |
|
\let\tt=\authortt} |
2128 |
|
|
2129 |
|
\parseargdef\title{% |
2130 |
|
\checkenv\titlepage |
2131 |
|
\leftline{\titlefonts\rm #1} |
2132 |
|
% print a rule at the page bottom also. |
2133 |
|
\finishedtitlepagefalse |
2134 |
|
\vskip4pt \hrule height 4pt width \hsize \vskip4pt |
2135 |
|
} |
2136 |
|
|
2137 |
|
\parseargdef\subtitle{% |
2138 |
|
\checkenv\titlepage |
2139 |
|
{\subtitlefont \rightline{#1}}% |
2140 |
|
} |
2141 |
|
|
2142 |
|
% @author should come last, but may come many times. |
2143 |
|
% It can also be used inside @quotation. |
2144 |
|
% |
2145 |
|
\parseargdef\author{% |
2146 |
|
\def\temp{\quotation}% |
2147 |
|
\ifx\thisenv\temp |
2148 |
|
\def\quotationauthor{#1}% printed in \Equotation. |
2149 |
|
\else |
2150 |
|
\checkenv\titlepage |
2151 |
|
\ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi |
2152 |
|
{\authorfont \leftline{#1}}% |
2153 |
|
\fi |
2154 |
|
} |
2155 |
|
|
2156 |
|
|
2157 |
%%% Set up page headings and footings. |
%%% Set up page headings and footings. |
2158 |
|
|
2159 |
\let\thispage=\folio |
\let\thispage=\folio |
2163 |
\newtoks\evenfootline % footline on even pages |
\newtoks\evenfootline % footline on even pages |
2164 |
\newtoks\oddfootline % footline on odd pages |
\newtoks\oddfootline % footline on odd pages |
2165 |
|
|
2166 |
% Now make Tex use those variables |
% Now make TeX use those variables |
2167 |
\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline |
\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline |
2168 |
\else \the\evenheadline \fi}} |
\else \the\evenheadline \fi}} |
2169 |
\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline |
\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline |
2177 |
% @evenfooting @thisfile|| |
% @evenfooting @thisfile|| |
2178 |
% @oddfooting ||@thisfile |
% @oddfooting ||@thisfile |
2179 |
|
|
|
\def\evenheading{\parsearg\evenheadingxxx} |
|
|
\def\oddheading{\parsearg\oddheadingxxx} |
|
|
\def\everyheading{\parsearg\everyheadingxxx} |
|
|
|
|
|
\def\evenfooting{\parsearg\evenfootingxxx} |
|
|
\def\oddfooting{\parsearg\oddfootingxxx} |
|
|
\def\everyfooting{\parsearg\everyfootingxxx} |
|
|
|
|
|
{\catcode`\@=0 % |
|
2180 |
|
|
2181 |
\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} |
\def\evenheading{\parsearg\evenheadingxxx} |
2182 |
\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% |
\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} |
2183 |
|
\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% |
2184 |
\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} |
\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} |
2185 |
|
|
2186 |
\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} |
\def\oddheading{\parsearg\oddheadingxxx} |
2187 |
\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% |
\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} |
2188 |
|
\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% |
2189 |
\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} |
\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} |
2190 |
|
|
2191 |
\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% |
\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% |
2192 |
|
|
2193 |
\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} |
\def\evenfooting{\parsearg\evenfootingxxx} |
2194 |
\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% |
\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} |
2195 |
|
\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% |
2196 |
\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} |
\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} |
2197 |
|
|
2198 |
\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} |
\def\oddfooting{\parsearg\oddfootingxxx} |
2199 |
\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% |
\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} |
2200 |
|
\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% |
2201 |
\global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% |
\global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% |
2202 |
% |
% |
2203 |
% Leave some space for the footline. Hopefully ok to assume |
% Leave some space for the footline. Hopefully ok to assume |
2206 |
\global\advance\vsize by -\baselineskip |
\global\advance\vsize by -\baselineskip |
2207 |
} |
} |
2208 |
|
|
2209 |
\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} |
\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} |
2210 |
% |
|
|
}% unbind the catcode of @. |
|
2211 |
|
|
2212 |
% @headings double turns headings on for double-sided printing. |
% @headings double turns headings on for double-sided printing. |
2213 |
% @headings single turns headings on for single-sided printing. |
% @headings single turns headings on for single-sided printing. |
2221 |
|
|
2222 |
\def\headings #1 {\csname HEADINGS#1\endcsname} |
\def\headings #1 {\csname HEADINGS#1\endcsname} |
2223 |
|
|
2224 |
\def\HEADINGSoff{ |
\def\HEADINGSoff{% |
2225 |
\global\evenheadline={\hfil} \global\evenfootline={\hfil} |
\global\evenheadline={\hfil} \global\evenfootline={\hfil} |
2226 |
\global\oddheadline={\hfil} \global\oddfootline={\hfil}} |
\global\oddheadline={\hfil} \global\oddfootline={\hfil}} |
2227 |
\HEADINGSoff |
\HEADINGSoff |
2230 |
% chapter name on inside top of right hand pages, document |
% chapter name on inside top of right hand pages, document |
2231 |
% title on inside top of left hand pages, and page numbers on outside top |
% title on inside top of left hand pages, and page numbers on outside top |
2232 |
% edge of all pages. |
% edge of all pages. |
2233 |
\def\HEADINGSdouble{ |
\def\HEADINGSdouble{% |
2234 |
\global\pageno=1 |
\global\pageno=1 |
2235 |
\global\evenfootline={\hfil} |
\global\evenfootline={\hfil} |
2236 |
\global\oddfootline={\hfil} |
\global\oddfootline={\hfil} |
2242 |
|
|
2243 |
% For single-sided printing, chapter title goes across top left of page, |
% For single-sided printing, chapter title goes across top left of page, |
2244 |
% page number on top right. |
% page number on top right. |
2245 |
\def\HEADINGSsingle{ |
\def\HEADINGSsingle{% |
2246 |
\global\pageno=1 |
\global\pageno=1 |
2247 |
\global\evenfootline={\hfil} |
\global\evenfootline={\hfil} |
2248 |
\global\oddfootline={\hfil} |
\global\oddfootline={\hfil} |
2272 |
} |
} |
2273 |
|
|
2274 |
% Subroutines used in generating headings |
% Subroutines used in generating headings |
2275 |
% Produces Day Month Year style of output. |
% This produces Day Month Year style of output. |
2276 |
|
% Only define if not already defined, in case a txi-??.tex file has set |
2277 |
|
% up a different format (e.g., txi-cs.tex does this). |
2278 |
|
\ifx\today\undefined |
2279 |
\def\today{% |
\def\today{% |
2280 |
\number\day\space |
\number\day\space |
2281 |
\ifcase\month |
\ifcase\month |
2284 |
\or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec |
\or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec |
2285 |
\fi |
\fi |
2286 |
\space\number\year} |
\space\number\year} |
2287 |
|
\fi |
2288 |
|
|
2289 |
% @settitle line... specifies the title of the document, for headings. |
% @settitle line... specifies the title of the document, for headings. |
2290 |
% It generates no output of its own. |
% It generates no output of its own. |
2291 |
\def\thistitle{\putwordNoTitle} |
\def\thistitle{\putwordNoTitle} |
2292 |
\def\settitle{\parsearg\settitlezzz} |
\def\settitle{\parsearg{\gdef\thistitle}} |
|
\def\settitlezzz #1{\gdef\thistitle{#1}} |
|
2293 |
|
|
2294 |
|
|
2295 |
\message{tables,} |
\message{tables,} |
2296 |
% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). |
% Tables -- @table, @ftable, @vtable, @item(x). |
2297 |
|
|
2298 |
% default indentation of table text |
% default indentation of table text |
2299 |
\newdimen\tableindent \tableindent=.8in |
\newdimen\tableindent \tableindent=.8in |
2305 |
% used internally for \itemindent minus \itemmargin |
% used internally for \itemindent minus \itemmargin |
2306 |
\newdimen\itemmax |
\newdimen\itemmax |
2307 |
|
|
2308 |
% Note @table, @vtable, and @vtable define @item, @itemx, etc., with |
% Note @table, @ftable, and @vtable define @item, @itemx, etc., with |
2309 |
% these defs. |
% these defs. |
2310 |
% They also define \itemindex |
% They also define \itemindex |
2311 |
% to index the item name in whatever manner is desired (perhaps none). |
% to index the item name in whatever manner is desired (perhaps none). |
2317 |
\def\internalBitem{\smallbreak \parsearg\itemzzz} |
\def\internalBitem{\smallbreak \parsearg\itemzzz} |
2318 |
\def\internalBitemx{\itemxpar \parsearg\itemzzz} |
\def\internalBitemx{\itemxpar \parsearg\itemzzz} |
2319 |
|
|
|
\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} |
|
|
\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} |
|
|
|
|
|
\def\internalBkitem{\smallbreak \parsearg\kitemzzz} |
|
|
\def\internalBkitemx{\itemxpar \parsearg\kitemzzz} |
|
|
|
|
|
\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% |
|
|
\itemzzz {#1}} |
|
|
|
|
|
\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% |
|
|
\itemzzz {#1}} |
|
|
|
|
2320 |
\def\itemzzz #1{\begingroup % |
\def\itemzzz #1{\begingroup % |
2321 |
\advance\hsize by -\rightskip |
\advance\hsize by -\rightskip |
2322 |
\advance\hsize by -\tableindent |
\advance\hsize by -\tableindent |
2323 |
\setbox0=\hbox{\itemfont{#1}}% |
\setbox0=\hbox{\itemindicate{#1}}% |
2324 |
\itemindex{#1}% |
\itemindex{#1}% |
2325 |
\nobreak % This prevents a break before @itemx. |
\nobreak % This prevents a break before @itemx. |
2326 |
% |
% |
2344 |
% \parskip glue -- logically it's part of the @item we just started. |
% \parskip glue -- logically it's part of the @item we just started. |
2345 |
\nobreak \vskip-\parskip |
\nobreak \vskip-\parskip |
2346 |
% |
% |
2347 |
% Stop a page break at the \parskip glue coming up. Unfortunately |
% Stop a page break at the \parskip glue coming up. However, if |
2348 |
% we can't prevent a possible page break at the following |
% what follows is an environment such as @example, there will be no |
2349 |
% \baselineskip glue. |
% \parskip glue; then the negative vskip we just inserted would |
2350 |
\nobreak |
% cause the example and the item to crash together. So we use this |
2351 |
|
% bizarre value of 10001 as a signal to \aboveenvbreak to insert |
2352 |
|
% \parskip glue after all. Section titles are handled this way also. |
2353 |
|
% |
2354 |
|
\penalty 10001 |
2355 |
\endgroup |
\endgroup |
2356 |
\itemxneedsnegativevskipfalse |
\itemxneedsnegativevskipfalse |
2357 |
\else |
\else |
2370 |
\fi |
\fi |
2371 |
} |
} |
2372 |
|
|
2373 |
\def\item{\errmessage{@item while not in a table}} |
\def\item{\errmessage{@item while not in a list environment}} |
2374 |
\def\itemx{\errmessage{@itemx while not in a table}} |
\def\itemx{\errmessage{@itemx while not in a list environment}} |
|
\def\kitem{\errmessage{@kitem while not in a table}} |
|
|
\def\kitemx{\errmessage{@kitemx while not in a table}} |
|
|
\def\xitem{\errmessage{@xitem while not in a table}} |
|
|
\def\xitemx{\errmessage{@xitemx while not in a table}} |
|
|
|
|
|
% Contains a kludge to get @end[description] to work. |
|
|
\def\description{\tablez{\dontindex}{1}{}{}{}{}} |
|
2375 |
|
|
2376 |
% @table, @ftable, @vtable. |
% @table, @ftable, @vtable. |
2377 |
\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} |
\envdef\table{% |
2378 |
{\obeylines\obeyspaces% |
\let\itemindex\gobble |
2379 |
\gdef\tablex #1^^M{% |
\tablecheck{table}% |
2380 |
\tabley\dontindex#1 \endtabley}} |
} |
2381 |
|
\envdef\ftable{% |
2382 |
\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} |
\def\itemindex ##1{\doind {fn}{\code{##1}}}% |
2383 |
{\obeylines\obeyspaces% |
\tablecheck{ftable}% |
2384 |
\gdef\ftablex #1^^M{% |
} |
2385 |
\tabley\fnitemindex#1 \endtabley |
\envdef\vtable{% |
2386 |
\def\Eftable{\endgraf\afterenvbreak\endgroup}% |
\def\itemindex ##1{\doind {vr}{\code{##1}}}% |
2387 |
\let\Etable=\relax}} |
\tablecheck{vtable}% |
|
|
|
|
\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} |
|
|
{\obeylines\obeyspaces% |
|
|
\gdef\vtablex #1^^M{% |
|
|
\tabley\vritemindex#1 \endtabley |
|
|
\def\Evtable{\endgraf\afterenvbreak\endgroup}% |
|
|
\let\Etable=\relax}} |
|
|
|
|
|
\def\dontindex #1{} |
|
|
\def\fnitemindex #1{\doind {fn}{\code{#1}}}% |
|
|
\def\vritemindex #1{\doind {vr}{\code{#1}}}% |
|
|
|
|
|
{\obeyspaces % |
|
|
\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% |
|
|
\tablez{#1}{#2}{#3}{#4}{#5}{#6}}} |
|
|
|
|
|
\def\tablez #1#2#3#4#5#6{% |
|
|
\aboveenvbreak % |
|
|
\begingroup % |
|
|
\def\Edescription{\Etable}% Necessary kludge. |
|
|
\let\itemindex=#1% |
|
|
\ifnum 0#3>0 \advance \leftskip by #3\mil \fi % |
|
|
\ifnum 0#4>0 \tableindent=#4\mil \fi % |
|
|
\ifnum 0#5>0 \advance \rightskip by #5\mil \fi % |
|
|
\def\itemfont{#2}% |
|
|
\itemmax=\tableindent % |
|
|
\advance \itemmax by -\itemmargin % |
|
|
\advance \leftskip by \tableindent % |
|
|
\exdentamount=\tableindent |
|
|
\parindent = 0pt |
|
|
\parskip = \smallskipamount |
|
|
\ifdim \parskip=0pt \parskip=2pt \fi% |
|
|
\def\Etable{\endgraf\afterenvbreak\endgroup}% |
|
|
\let\item = \internalBitem % |
|
|
\let\itemx = \internalBitemx % |
|
|
\let\kitem = \internalBkitem % |
|
|
\let\kitemx = \internalBkitemx % |
|
|
\let\xitem = \internalBxitem % |
|
|
\let\xitemx = \internalBxitemx % |
|
2388 |
} |
} |
2389 |
|
\def\tablecheck#1{% |
2390 |
|
\ifnum \the\catcode`\^^M=\active |
2391 |
|
\endgroup |
2392 |
|
\errmessage{This command won't work in this context; perhaps the problem is |
2393 |
|
that we are \inenvironment\thisenv}% |
2394 |
|
\def\next{\doignore{#1}}% |
2395 |
|
\else |
2396 |
|
\let\next\tablex |
2397 |
|
\fi |
2398 |
|
\next |
2399 |
|
} |
2400 |
|
\def\tablex#1{% |
2401 |
|
\def\itemindicate{#1}% |
2402 |
|
\parsearg\tabley |
2403 |
|
} |
2404 |
|
\def\tabley#1{% |
2405 |
|
{% |
2406 |
|
\makevalueexpandable |
2407 |
|
\edef\temp{\noexpand\tablez #1\space\space\space}% |
2408 |
|
\expandafter |
2409 |
|
}\temp \endtablez |
2410 |
|
} |
2411 |
|
\def\tablez #1 #2 #3 #4\endtablez{% |
2412 |
|
\aboveenvbreak |
2413 |
|
\ifnum 0#1>0 \advance \leftskip by #1\mil \fi |
2414 |
|
\ifnum 0#2>0 \tableindent=#2\mil \fi |
2415 |
|
\ifnum 0#3>0 \advance \rightskip by #3\mil \fi |
2416 |
|
\itemmax=\tableindent |
2417 |
|
\advance \itemmax by -\itemmargin |
2418 |
|
\advance \leftskip by \tableindent |
2419 |
|
\exdentamount=\tableindent |
2420 |
|
\parindent = 0pt |
2421 |
|
\parskip = \smallskipamount |
2422 |
|
\ifdim \parskip=0pt \parskip=2pt \fi |
2423 |
|
\let\item = \internalBitem |
2424 |
|
\let\itemx = \internalBitemx |
2425 |
|
} |
2426 |
|
\def\Etable{\endgraf\afterenvbreak} |
2427 |
|
\let\Eftable\Etable |
2428 |
|
\let\Evtable\Etable |
2429 |
|
\let\Eitemize\Etable |
2430 |
|
\let\Eenumerate\Etable |
2431 |
|
|
2432 |
% This is the counter used by @enumerate, which is really @itemize |
% This is the counter used by @enumerate, which is really @itemize |
2433 |
|
|
2434 |
\newcount \itemno |
\newcount \itemno |
2435 |
|
|
2436 |
\def\itemize{\parsearg\itemizezzz} |
\envdef\itemize{\parsearg\doitemize} |
2437 |
|
|
2438 |
\def\itemizezzz #1{% |
\def\doitemize#1{% |
2439 |
\begingroup % ended by the @end itemize |
\aboveenvbreak |
2440 |
\itemizey {#1}{\Eitemize} |
\itemmax=\itemindent |
2441 |
} |
\advance\itemmax by -\itemmargin |
2442 |
|
\advance\leftskip by \itemindent |
2443 |
\def\itemizey #1#2{% |
\exdentamount=\itemindent |
2444 |
\aboveenvbreak % |
\parindent=0pt |
2445 |
\itemmax=\itemindent % |
\parskip=\smallskipamount |
2446 |
\advance \itemmax by -\itemmargin % |
\ifdim\parskip=0pt \parskip=2pt \fi |
2447 |
\advance \leftskip by \itemindent % |
\def\itemcontents{#1}% |
2448 |
\exdentamount=\itemindent |
% @itemize with no arg is equivalent to @itemize @bullet. |
2449 |
\parindent = 0pt % |
\ifx\itemcontents\empty\def\itemcontents{\bullet}\fi |
2450 |
\parskip = \smallskipamount % |
\let\item=\itemizeitem |
2451 |
\ifdim \parskip=0pt \parskip=2pt \fi% |
} |
|
\def#2{\endgraf\afterenvbreak\endgroup}% |
|
|
\def\itemcontents{#1}% |
|
|
\let\item=\itemizeitem} |
|
2452 |
|
|
2453 |
% Set sfcode to normal for the chars that usually have another value. |
% Definition of @item while inside @itemize and @enumerate. |
2454 |
% These are `.?!:;,' |
% |
2455 |
\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 |
\def\itemizeitem{% |
2456 |
\sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } |
\advance\itemno by 1 % for enumerations |
2457 |
|
{\let\par=\endgraf \smallbreak}% reasonable place to break |
2458 |
|
{% |
2459 |
|
% If the document has an @itemize directly after a section title, a |
2460 |
|
% \nobreak will be last on the list, and \sectionheading will have |
2461 |
|
% done a \vskip-\parskip. In that case, we don't want to zero |
2462 |
|
% parskip, or the item text will crash with the heading. On the |
2463 |
|
% other hand, when there is normal text preceding the item (as there |
2464 |
|
% usually is), we do want to zero parskip, or there would be too much |
2465 |
|
% space. In that case, we won't have a \nobreak before. At least |
2466 |
|
% that's the theory. |
2467 |
|
\ifnum\lastpenalty<10000 \parskip=0in \fi |
2468 |
|
\noindent |
2469 |
|
\hbox to 0pt{\hss \itemcontents \kern\itemmargin}% |
2470 |
|
\vadjust{\penalty 1200}}% not good to break after first line of item. |
2471 |
|
\flushcr |
2472 |
|
} |
2473 |
|
|
2474 |
% \splitoff TOKENS\endmark defines \first to be the first token in |
% \splitoff TOKENS\endmark defines \first to be the first token in |
2475 |
% TOKENS, and \rest to be the remainder. |
% TOKENS, and \rest to be the remainder. |
2480 |
% or number, to specify the first label in the enumerated list. No |
% or number, to specify the first label in the enumerated list. No |
2481 |
% argument is the same as `1'. |
% argument is the same as `1'. |
2482 |
% |
% |
2483 |
\def\enumerate{\parsearg\enumeratezzz} |
\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} |
|
\def\enumeratezzz #1{\enumeratey #1 \endenumeratey} |
|
2484 |
\def\enumeratey #1 #2\endenumeratey{% |
\def\enumeratey #1 #2\endenumeratey{% |
|
\begingroup % ended by the @end enumerate |
|
|
% |
|
2485 |
% If we were given no argument, pretend we were given `1'. |
% If we were given no argument, pretend we were given `1'. |
2486 |
\def\thearg{#1}% |
\def\thearg{#1}% |
2487 |
\ifx\thearg\empty \def\thearg{1}\fi |
\ifx\thearg\empty \def\thearg{1}\fi |
2552 |
}% |
}% |
2553 |
} |
} |
2554 |
|
|
2555 |
% Call itemizey, adding a period to the first argument and supplying the |
% Call \doitemize, adding a period to the first argument and supplying the |
2556 |
% common last two arguments. Also subtract one from the initial value in |
% common last two arguments. Also subtract one from the initial value in |
2557 |
% \itemno, since @item increments \itemno. |
% \itemno, since @item increments \itemno. |
2558 |
% |
% |
2559 |
\def\startenumeration#1{% |
\def\startenumeration#1{% |
2560 |
\advance\itemno by -1 |
\advance\itemno by -1 |
2561 |
\itemizey{#1.}\Eenumerate\flushcr |
\doitemize{#1.}\flushcr |
2562 |
} |
} |
2563 |
|
|
2564 |
% @alphaenumerate and @capsenumerate are abbreviations for giving an arg |
% @alphaenumerate and @capsenumerate are abbreviations for giving an arg |
2569 |
\def\Ealphaenumerate{\Eenumerate} |
\def\Ealphaenumerate{\Eenumerate} |
2570 |
\def\Ecapsenumerate{\Eenumerate} |
\def\Ecapsenumerate{\Eenumerate} |
2571 |
|
|
|
% Definition of @item while inside @itemize. |
|
|
|
|
|
\def\itemizeitem{% |
|
|
\advance\itemno by 1 |
|
|
{\let\par=\endgraf \smallbreak}% |
|
|
\ifhmode \errmessage{In hmode at itemizeitem}\fi |
|
|
{\parskip=0in \hskip 0pt |
|
|
\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% |
|
|
\vadjust{\penalty 1200}}% |
|
|
\flushcr} |
|
2572 |
|
|
2573 |
% @multitable macros |
% @multitable macros |
2574 |
% Amy Hendrickson, 8/18/94, 3/6/96 |
% Amy Hendrickson, 8/18/94, 3/6/96 |
2595 |
% @multitable {Column 1 template} {Column 2 template} {Column 3 template} |
% @multitable {Column 1 template} {Column 2 template} {Column 3 template} |
2596 |
% @item ... |
% @item ... |
2597 |
% using the widest term desired in each column. |
% using the widest term desired in each column. |
|
% |
|
|
% For those who want to use more than one line's worth of words in |
|
|
% the preamble, break the line within one argument and it |
|
|
% will parse correctly, i.e., |
|
|
% |
|
|
% @multitable {Column 1 template} {Column 2 template} {Column 3 |
|
|
% template} |
|
|
% Not: |
|
|
% @multitable {Column 1 template} {Column 2 template} |
|
|
% {Column 3 template} |
|
2598 |
|
|
2599 |
% Each new table line starts with @item, each subsequent new column |
% Each new table line starts with @item, each subsequent new column |
2600 |
% starts with @tab. Empty columns may be produced by supplying @tab's |
% starts with @tab. Empty columns may be produced by supplying @tab's |
2601 |
% with nothing between them for as many times as empty columns are needed, |
% with nothing between them for as many times as empty columns are needed, |
2602 |
% ie, @tab@tab@tab will produce two empty columns. |
% ie, @tab@tab@tab will produce two empty columns. |
2603 |
|
|
2604 |
% @item, @tab, @multitable or @end multitable do not need to be on their |
% @item, @tab do not need to be on their own lines, but it will not hurt |
2605 |
% own lines, but it will not hurt if they are. |
% if they are. |
2606 |
|
|
2607 |
% Sample multitable: |
% Sample multitable: |
2608 |
|
|
2646 |
\def\xcolumnfractions{\columnfractions} |
\def\xcolumnfractions{\columnfractions} |
2647 |
\newif\ifsetpercent |
\newif\ifsetpercent |
2648 |
|
|
2649 |
% #1 is the part of the @columnfraction before the decimal point, which |
% #1 is the @columnfraction, usually a decimal number like .5, but might |
2650 |
% is presumably either 0 or the empty string (but we don't check, we |
% be just 1. We just use it, whatever it is. |
2651 |
% just throw it away). #2 is the decimal part, which we use as the |
% |
2652 |
% percent of \hsize for this column. |
\def\pickupwholefraction#1 {% |
|
\def\pickupwholefraction#1.#2 {% |
|
2653 |
\global\advance\colcount by 1 |
\global\advance\colcount by 1 |
2654 |
\expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}% |
\expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% |
2655 |
\setuptable |
\setuptable |
2656 |
} |
} |
2657 |
|
|
2668 |
\let\go\pickupwholefraction |
\let\go\pickupwholefraction |
2669 |
\else |
\else |
2670 |
\global\advance\colcount by 1 |
\global\advance\colcount by 1 |
2671 |
\setbox0=\hbox{#1\unskip }% Add a normal word space as a separator; |
\setbox0=\hbox{#1\unskip\space}% Add a normal word space as a |
2672 |
% typically that is always in the input, anyway. |
% separator; typically that is always in the input, anyway. |
2673 |
\expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% |
\expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% |
2674 |
\fi |
\fi |
2675 |
\fi |
\fi |
2684 |
\go |
\go |
2685 |
} |
} |
2686 |
|
|
2687 |
% multitable syntax |
% multitable-only commands. |
2688 |
\def\tab{&\hskip1sp\relax} % 2/2/96 |
% |
2689 |
% tiny skip here makes sure this column space is |
% @headitem starts a heading row, which we typeset in bold. |
2690 |
% maintained, even if it is never used. |
% Assignments have to be global since we are inside the implicit group |
2691 |
|
% of an alignment entry. Note that \everycr resets \everytab. |
2692 |
|
\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% |
2693 |
|
% |
2694 |
|
% A \tab used to include \hskip1sp. But then the space in a template |
2695 |
|
% line is not enough. That is bad. So let's go back to just `&' until |
2696 |
|
% we encounter the problem it was intended to solve again. |
2697 |
|
% --karl, nathan@acm.org, 20apr99. |
2698 |
|
\def\tab{\checkenv\multitable &\the\everytab}% |
2699 |
|
|
2700 |
% @multitable ... @end multitable definitions: |
% @multitable ... @end multitable definitions: |
2701 |
% |
% |
2702 |
\def\multitable{\parsearg\dotable} |
\newtoks\everytab % insert after every tab. |
2703 |
\def\dotable#1{\bgroup |
% |
2704 |
|
\envdef\multitable{% |
2705 |
\vskip\parskip |
\vskip\parskip |
2706 |
\let\item\crcr |
\startsavinginserts |
2707 |
|
% |
2708 |
|
% @item within a multitable starts a normal row. |
2709 |
|
% We use \def instead of \let so that if one of the multitable entries |
2710 |
|
% contains an @itemize, we don't choke on the \item (seen as \crcr aka |
2711 |
|
% \endtemplate) expanding \doitemize. |
2712 |
|
\def\item{\crcr}% |
2713 |
|
% |
2714 |
\tolerance=9500 |
\tolerance=9500 |
2715 |
\hbadness=9500 |
\hbadness=9500 |
2716 |
\setmultitablespacing |
\setmultitablespacing |
2718 |
\parindent=\multitableparindent |
\parindent=\multitableparindent |
2719 |
\overfullrule=0pt |
\overfullrule=0pt |
2720 |
\global\colcount=0 |
\global\colcount=0 |
|
\def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}% |
|
2721 |
% |
% |
2722 |
|
\everycr = {% |
2723 |
|
\noalign{% |
2724 |
|
\global\everytab={}% |
2725 |
|
\global\colcount=0 % Reset the column counter. |
2726 |
|
% Check for saved footnotes, etc. |
2727 |
|
\checkinserts |
2728 |
|
% Keeps underfull box messages off when table breaks over pages. |
2729 |
|
%\filbreak |
2730 |
|
% Maybe so, but it also creates really weird page breaks when the |
2731 |
|
% table breaks over pages. Wouldn't \vfil be better? Wait until the |
2732 |
|
% problem manifests itself, so it can be fixed for real --karl. |
2733 |
|
}% |
2734 |
|
}% |
2735 |
|
% |
2736 |
|
\parsearg\domultitable |
2737 |
|
} |
2738 |
|
\def\domultitable#1{% |
2739 |
% To parse everything between @multitable and @item: |
% To parse everything between @multitable and @item: |
2740 |
\setuptable#1 \endsetuptable |
\setuptable#1 \endsetuptable |
2741 |
% |
% |
|
% \everycr will reset column counter, \colcount, at the end of |
|
|
% each line. Every column entry will cause \colcount to advance by one. |
|
|
% The table preamble |
|
|
% looks at the current \colcount to find the correct column width. |
|
|
\everycr{\noalign{% |
|
|
% |
|
|
% \filbreak%% keeps underfull box messages off when table breaks over pages. |
|
|
% Maybe so, but it also creates really weird page breaks when the table |
|
|
% breaks over pages. Wouldn't \vfil be better? Wait until the problem |
|
|
% manifests itself, so it can be fixed for real --karl. |
|
|
\global\colcount=0\relax}}% |
|
|
% |
|
2742 |
% This preamble sets up a generic column definition, which will |
% This preamble sets up a generic column definition, which will |
2743 |
% be used as many times as user calls for columns. |
% be used as many times as user calls for columns. |
2744 |
% \vtop will set a single line and will also let text wrap and |
% \vtop will set a single line and will also let text wrap and |
2745 |
% continue for many paragraphs if desired. |
% continue for many paragraphs if desired. |
2746 |
\halign\bgroup&\global\advance\colcount by 1\relax |
\halign\bgroup &% |
2747 |
\multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname |
\global\advance\colcount by 1 |
2748 |
% |
\multistrut |
2749 |
% In order to keep entries from bumping into each other |
\vtop{% |
2750 |
% we will add a \leftskip of \multitablecolspace to all columns after |
% Use the current \colcount to find the correct column width: |
2751 |
% the first one. |
\hsize=\expandafter\csname col\the\colcount\endcsname |
2752 |
% |
% |
2753 |
% If a template has been used, we will add \multitablecolspace |
% In order to keep entries from bumping into each other |
2754 |
% to the width of each template entry. |
% we will add a \leftskip of \multitablecolspace to all columns after |
2755 |
% |
% the first one. |
2756 |
% If the user has set preamble in terms of percent of \hsize we will |
% |
2757 |
% use that dimension as the width of the column, and the \leftskip |
% If a template has been used, we will add \multitablecolspace |
2758 |
% will keep entries from bumping into each other. Table will start at |
% to the width of each template entry. |
2759 |
% left margin and final column will justify at right margin. |
% |
2760 |
% |
% If the user has set preamble in terms of percent of \hsize we will |
2761 |
% Make sure we don't inherit \rightskip from the outer environment. |
% use that dimension as the width of the column, and the \leftskip |
2762 |
\rightskip=0pt |
% will keep entries from bumping into each other. Table will start at |
2763 |
\ifnum\colcount=1 |
% left margin and final column will justify at right margin. |
2764 |
% The first column will be indented with the surrounding text. |
% |
2765 |
\advance\hsize by\leftskip |
% Make sure we don't inherit \rightskip from the outer environment. |
2766 |
\else |
\rightskip=0pt |
2767 |
\ifsetpercent \else |
\ifnum\colcount=1 |
2768 |
% If user has not set preamble in terms of percent of \hsize |
% The first column will be indented with the surrounding text. |
2769 |
% we will advance \hsize by \multitablecolspace. |
\advance\hsize by\leftskip |
2770 |
\advance\hsize by \multitablecolspace |
\else |
2771 |
\fi |
\ifsetpercent \else |
2772 |
% In either case we will make \leftskip=\multitablecolspace: |
% If user has not set preamble in terms of percent of \hsize |
2773 |
\leftskip=\multitablecolspace |
% we will advance \hsize by \multitablecolspace. |
2774 |
\fi |
\advance\hsize by \multitablecolspace |
2775 |
% Ignoring space at the beginning and end avoids an occasional spurious |
\fi |
2776 |
% blank line, when TeX decides to break the line at the space before the |
% In either case we will make \leftskip=\multitablecolspace: |
2777 |
% box from the multistrut, so the strut ends up on a line by itself. |
\leftskip=\multitablecolspace |
2778 |
% For example: |
\fi |
2779 |
% @multitable @columnfractions .11 .89 |
% Ignoring space at the beginning and end avoids an occasional spurious |
2780 |
% @item @code{#} |
% blank line, when TeX decides to break the line at the space before the |
2781 |
% @tab Legal holiday which is valid in major parts of the whole country. |
% box from the multistrut, so the strut ends up on a line by itself. |
2782 |
% Is automatically provided with highlighting sequences respectively marking |
% For example: |
2783 |
% characters. |
% @multitable @columnfractions .11 .89 |
2784 |
\noindent\ignorespaces##\unskip\multistrut}\cr |
% @item @code{#} |
2785 |
} |
% @tab Legal holiday which is valid in major parts of the whole country. |
2786 |
|
% Is automatically provided with highlighting sequences respectively |
2787 |
\def\setmultitablespacing{% test to see if user has set \multitablelinespace. |
% marking characters. |
2788 |
% If so, do nothing. If not, give it an appropriate dimension based on |
\noindent\ignorespaces##\unskip\multistrut |
2789 |
% current baselineskip. |
}\cr |
2790 |
|
} |
2791 |
|
\def\Emultitable{% |
2792 |
|
\crcr |
2793 |
|
\egroup % end the \halign |
2794 |
|
\global\setpercentfalse |
2795 |
|
} |
2796 |
|
|
2797 |
|
\def\setmultitablespacing{% |
2798 |
|
\def\multistrut{\strut}% just use the standard line spacing |
2799 |
|
% |
2800 |
|
% Compute \multitablelinespace (if not defined by user) for use in |
2801 |
|
% \multitableparskip calculation. We used define \multistrut based on |
2802 |
|
% this, but (ironically) that caused the spacing to be off. |
2803 |
|
% See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. |
2804 |
\ifdim\multitablelinespace=0pt |
\ifdim\multitablelinespace=0pt |
2805 |
%% strut to put in table in case some entry doesn't have descenders, |
\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip |
2806 |
%% to keep lines equally spaced |
\global\advance\multitablelinespace by-\ht0 |
2807 |
\let\multistrut = \strut |
\fi |
2808 |
%% Test to see if parskip is larger than space between lines of |
%% Test to see if parskip is larger than space between lines of |
2809 |
%% table. If not, do nothing. |
%% table. If not, do nothing. |
2810 |
%% If so, set to same dimension as multitablelinespace. |
%% If so, set to same dimension as multitablelinespace. |
|
\else |
|
|
\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 |
|
|
width0pt\relax} \fi |
|
2811 |
\ifdim\multitableparskip>\multitablelinespace |
\ifdim\multitableparskip>\multitablelinespace |
2812 |
\global\multitableparskip=\multitablelinespace |
\global\multitableparskip=\multitablelinespace |
2813 |
\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller |
\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller |
2821 |
|
|
2822 |
|
|
2823 |
\message{conditionals,} |
\message{conditionals,} |
|
% Prevent errors for section commands. |
|
|
% Used in @ignore and in failing conditionals. |
|
|
\def\ignoresections{% |
|
|
\let\chapter=\relax |
|
|
\let\unnumbered=\relax |
|
|
\let\top=\relax |
|
|
\let\unnumberedsec=\relax |
|
|
\let\unnumberedsection=\relax |
|
|
\let\unnumberedsubsec=\relax |
|
|
\let\unnumberedsubsection=\relax |
|
|
\let\unnumberedsubsubsec=\relax |
|
|
\let\unnumberedsubsubsection=\relax |
|
|
\let\section=\relax |
|
|
\let\subsec=\relax |
|
|
\let\subsubsec=\relax |
|
|
\let\subsection=\relax |
|
|
\let\subsubsection=\relax |
|
|
\let\appendix=\relax |
|
|
\let\appendixsec=\relax |
|
|
\let\appendixsection=\relax |
|
|
\let\appendixsubsec=\relax |
|
|
\let\appendixsubsection=\relax |
|
|
\let\appendixsubsubsec=\relax |
|
|
\let\appendixsubsubsection=\relax |
|
|
\let\contents=\relax |
|
|
\let\smallbook=\relax |
|
|
\let\titlepage=\relax |
|
|
} |
|
|
|
|
|
% Used in nested conditionals, where we have to parse the Texinfo source |
|
|
% and so want to turn off most commands, in case they are used |
|
|
% incorrectly. |
|
|
% |
|
|
\def\ignoremorecommands{% |
|
|
\let\defcodeindex = \relax |
|
|
\let\defcv = \relax |
|
|
\let\deffn = \relax |
|
|
\let\deffnx = \relax |
|
|
\let\defindex = \relax |
|
|
\let\defivar = \relax |
|
|
\let\defmac = \relax |
|
|
\let\defmethod = \relax |
|
|
\let\defop = \relax |
|
|
\let\defopt = \relax |
|
|
\let\defspec = \relax |
|
|
\let\deftp = \relax |
|
|
\let\deftypefn = \relax |
|
|
\let\deftypefun = \relax |
|
|
\let\deftypeivar = \relax |
|
|
\let\deftypevar = \relax |
|
|
\let\deftypevr = \relax |
|
|
\let\defun = \relax |
|
|
\let\defvar = \relax |
|
|
\let\defvr = \relax |
|
|
\let\ref = \relax |
|
|
\let\xref = \relax |
|
|
\let\printindex = \relax |
|
|
\let\pxref = \relax |
|
|
\let\settitle = \relax |
|
|
\let\setchapternewpage = \relax |
|
|
\let\setchapterstyle = \relax |
|
|
\let\everyheading = \relax |
|
|
\let\evenheading = \relax |
|
|
\let\oddheading = \relax |
|
|
\let\everyfooting = \relax |
|
|
\let\evenfooting = \relax |
|
|
\let\oddfooting = \relax |
|
|
\let\headings = \relax |
|
|
\let\include = \relax |
|
|
\let\lowersections = \relax |
|
|
\let\down = \relax |
|
|
\let\raisesections = \relax |
|
|
\let\up = \relax |
|
|
\let\set = \relax |
|
|
\let\clear = \relax |
|
|
\let\item = \relax |
|
|
} |
|
2824 |
|
|
2825 |
% Ignore @ignore ... @end ignore. |
% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, |
2826 |
% |
% @ifnotxml always succeed. They currently do nothing; we don't |
2827 |
\def\ignore{\doignore{ignore}} |
% attempt to check whether the conditionals are properly nested. But we |
2828 |
|
% have to remember that they are conditionals, so that @end doesn't |
2829 |
|
% attempt to close an environment group. |
2830 |
|
% |
2831 |
|
\def\makecond#1{% |
2832 |
|
\expandafter\let\csname #1\endcsname = \relax |
2833 |
|
\expandafter\let\csname iscond.#1\endcsname = 1 |
2834 |
|
} |
2835 |
|
\makecond{iftex} |
2836 |
|
\makecond{ifnotdocbook} |
2837 |
|
\makecond{ifnothtml} |
2838 |
|
\makecond{ifnotinfo} |
2839 |
|
\makecond{ifnotplaintext} |
2840 |
|
\makecond{ifnotxml} |
2841 |
|
|
2842 |
% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text. |
% Ignore @ignore, @ifhtml, @ifinfo, and the like. |
2843 |
% |
% |
2844 |
\def\ifinfo{\doignore{ifinfo}} |
\def\direntry{\doignore{direntry}} |
2845 |
|
\def\documentdescription{\doignore{documentdescription}} |
2846 |
|
\def\docbook{\doignore{docbook}} |
2847 |
|
\def\html{\doignore{html}} |
2848 |
|
\def\ifdocbook{\doignore{ifdocbook}} |
2849 |
\def\ifhtml{\doignore{ifhtml}} |
\def\ifhtml{\doignore{ifhtml}} |
2850 |
|
\def\ifinfo{\doignore{ifinfo}} |
2851 |
\def\ifnottex{\doignore{ifnottex}} |
\def\ifnottex{\doignore{ifnottex}} |
2852 |
\def\html{\doignore{html}} |
\def\ifplaintext{\doignore{ifplaintext}} |
2853 |
|
\def\ifxml{\doignore{ifxml}} |
2854 |
|
\def\ignore{\doignore{ignore}} |
2855 |
\def\menu{\doignore{menu}} |
\def\menu{\doignore{menu}} |
2856 |
\def\direntry{\doignore{direntry}} |
\def\xml{\doignore{xml}} |
2857 |
|
|
2858 |
% @dircategory CATEGORY -- specify a category of the dir file |
% Ignore text until a line `@end #1', keeping track of nested conditionals. |
|
% which this file should belong to. Ignore this in TeX. |
|
|
\let\dircategory = \comment |
|
|
|
|
|
% Ignore text until a line `@end #1'. |
|
2859 |
% |
% |
2860 |
|
% A count to remember the depth of nesting. |
2861 |
|
\newcount\doignorecount |
2862 |
|
|
2863 |
\def\doignore#1{\begingroup |
\def\doignore#1{\begingroup |
2864 |
% Don't complain about control sequences we have declared \outer. |
% Scan in ``verbatim'' mode: |
2865 |
\ignoresections |
\catcode`\@ = \other |
2866 |
% |
\catcode`\{ = \other |
2867 |
% Define a command to swallow text until we reach `@end #1'. |
\catcode`\} = \other |
|
% This @ is a catcode 12 token (that is the normal catcode of @ in |
|
|
% this texinfo.tex file). We change the catcode of @ below to match. |
|
|
\long\def\doignoretext##1@end #1{\enddoignore}% |
|
2868 |
% |
% |
2869 |
% Make sure that spaces turn into tokens that match what \doignoretext wants. |
% Make sure that spaces turn into tokens that match what \doignoretext wants. |
2870 |
\catcode32 = 10 |
\spaceisspace |
2871 |
% |
% |
2872 |
% Ignore braces, too, so mismatched braces don't cause trouble. |
% Count number of #1's that we've seen. |
2873 |
\catcode`\{ = 9 |
\doignorecount = 0 |
2874 |
\catcode`\} = 9 |
% |
2875 |
% |
% Swallow text until we reach the matching `@end #1'. |
2876 |
% We must not have @c interpreted as a control sequence. |
\dodoignore{#1}% |
2877 |
\catcode`\@ = 12 |
} |
2878 |
% |
|
2879 |
% Make the letter c a comment character so that the rest of the line |
{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. |
2880 |
% will be ignored. This way, the document can have (for example) |
\obeylines % |
2881 |
% @c @end ifinfo |
% |
2882 |
% and the @end ifinfo will be properly ignored. |
\gdef\dodoignore#1{% |
2883 |
% (We've just changed @ to catcode 12.) |
% #1 contains the command name as a string, e.g., `ifinfo'. |
|
\catcode`\c = 14 |
|
|
% |
|
|
% And now expand that command. |
|
|
\doignoretext |
|
|
} |
|
|
|
|
|
% What we do to finish off ignored text. |
|
|
% |
|
|
\def\enddoignore{\endgroup\ignorespaces}% |
|
|
|
|
|
\newif\ifwarnedobs\warnedobsfalse |
|
|
\def\obstexwarn{% |
|
|
\ifwarnedobs\relax\else |
|
|
% We need to warn folks that they may have trouble with TeX 3.0. |
|
|
% This uses \immediate\write16 rather than \message to get newlines. |
|
|
\immediate\write16{} |
|
|
\immediate\write16{WARNING: for users of Unix TeX 3.0!} |
|
|
\immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} |
|
|
\immediate\write16{If you are running another version of TeX, relax.} |
|
|
\immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} |
|
|
\immediate\write16{ Then upgrade your TeX installation if you can.} |
|
|
\immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)} |
|
|
\immediate\write16{If you are stuck with version 3.0, run the} |
|
|
\immediate\write16{ script ``tex3patch'' from the Texinfo distribution} |
|
|
\immediate\write16{ to use a workaround.} |
|
|
\immediate\write16{} |
|
|
\global\warnedobstrue |
|
|
\fi |
|
|
} |
|
|
|
|
|
% **In TeX 3.0, setting text in \nullfont hangs tex. For a |
|
|
% workaround (which requires the file ``dummy.tfm'' to be installed), |
|
|
% uncomment the following line: |
|
|
%%%%%\font\nullfont=dummy\let\obstexwarn=\relax |
|
|
|
|
|
% Ignore text, except that we keep track of conditional commands for |
|
|
% purposes of nesting, up to an `@end #1' command. |
|
|
% |
|
|
\def\nestedignore#1{% |
|
|
\obstexwarn |
|
|
% We must actually expand the ignored text to look for the @end |
|
|
% command, so that nested ignore constructs work. Thus, we put the |
|
|
% text into a \vbox and then do nothing with the result. To minimize |
|
|
% the change of memory overflow, we follow the approach outlined on |
|
|
% page 401 of the TeXbook: make the current font be a dummy font. |
|
|
% |
|
|
\setbox0 = \vbox\bgroup |
|
|
% Don't complain about control sequences we have declared \outer. |
|
|
\ignoresections |
|
|
% |
|
|
% Define `@end #1' to end the box, which will in turn undefine the |
|
|
% @end command again. |
|
|
\expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% |
|
|
% |
|
|
% We are going to be parsing Texinfo commands. Most cause no |
|
|
% trouble when they are used incorrectly, but some commands do |
|
|
% complicated argument parsing or otherwise get confused, so we |
|
|
% undefine them. |
|
|
% |
|
|
% We can't do anything about stray @-signs, unfortunately; |
|
|
% they'll produce `undefined control sequence' errors. |
|
|
\ignoremorecommands |
|
|
% |
|
|
% Set the current font to be \nullfont, a TeX primitive, and define |
|
|
% all the font commands to also use \nullfont. We don't use |
|
|
% dummy.tfm, as suggested in the TeXbook, because not all sites |
|
|
% might have that installed. Therefore, math mode will still |
|
|
% produce output, but that should be an extremely small amount of |
|
|
% stuff compared to the main input. |
|
|
% |
|
|
\nullfont |
|
|
\let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont |
|
|
\let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont |
|
|
\let\tensf = \nullfont |
|
|
% Similarly for index fonts (mostly for their use in |
|
|
% smallexample) |
|
|
\let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont |
|
|
\let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont |
|
|
\let\indsf = \nullfont |
|
|
% |
|
|
% Don't complain when characters are missing from the fonts. |
|
|
\tracinglostchars = 0 |
|
|
% |
|
|
% Don't bother to do space factor calculations. |
|
|
\frenchspacing |
|
|
% |
|
|
% Don't report underfull hboxes. |
|
|
\hbadness = 10000 |
|
2884 |
% |
% |
2885 |
% Do minimal line-breaking. |
% Define a command to find the next `@end #1', which must be on a line |
2886 |
\pretolerance = 10000 |
% by itself. |
2887 |
|
\long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}% |
2888 |
|
% And this command to find another #1 command, at the beginning of a |
2889 |
|
% line. (Otherwise, we would consider a line `@c @ifset', for |
2890 |
|
% example, to count as an @ifset for nesting.) |
2891 |
|
\long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% |
2892 |
% |
% |
2893 |
% Do not execute instructions in @tex |
% And now expand that command. |
2894 |
\def\tex{\doignore{tex}}% |
\obeylines % |
2895 |
% Do not execute macro definitions. |
\doignoretext ^^M% |
2896 |
% `c' is a comment character, so the word `macro' will get cut off. |
}% |
|
\def\macro{\doignore{ma}}% |
|
2897 |
} |
} |
2898 |
|
|
2899 |
|
\def\doignoreyyy#1{% |
2900 |
|
\def\temp{#1}% |
2901 |
|
\ifx\temp\empty % Nothing found. |
2902 |
|
\let\next\doignoretextzzz |
2903 |
|
\else % Found a nested condition, ... |
2904 |
|
\advance\doignorecount by 1 |
2905 |
|
\let\next\doignoretextyyy % ..., look for another. |
2906 |
|
% If we're here, #1 ends with ^^M\ifinfo (for example). |
2907 |
|
\fi |
2908 |
|
\next #1% the token \_STOP_ is present just after this macro. |
2909 |
|
} |
2910 |
|
|
2911 |
|
% We have to swallow the remaining "\_STOP_". |
2912 |
|
% |
2913 |
|
\def\doignoretextzzz#1{% |
2914 |
|
\ifnum\doignorecount = 0 % We have just found the outermost @end. |
2915 |
|
\let\next\enddoignore |
2916 |
|
\else % Still inside a nested condition. |
2917 |
|
\advance\doignorecount by -1 |
2918 |
|
\let\next\doignoretext % Look for the next @end. |
2919 |
|
\fi |
2920 |
|
\next |
2921 |
|
} |
2922 |
|
|
2923 |
|
% Finish off ignored text. |
2924 |
|
\def\enddoignore{\endgroup\ignorespaces} |
2925 |
|
|
2926 |
|
|
2927 |
% @set VAR sets the variable VAR to an empty value. |
% @set VAR sets the variable VAR to an empty value. |
2928 |
% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. |
% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. |
2929 |
% |
% |
2930 |
% Since we want to separate VAR from REST-OF-LINE (which might be |
% Since we want to separate VAR from REST-OF-LINE (which might be |
2931 |
% empty), we can't just use \parsearg; we have to insert a space of our |
% empty), we can't just use \parsearg; we have to insert a space of our |
2932 |
% own to delimit the rest of the line, and then take it out again if we |
% own to delimit the rest of the line, and then take it out again if we |
2933 |
% didn't need it. Make sure the catcode of space is correct to avoid |
% didn't need it. |
2934 |
% losing inside @example, for instance. |
% We rely on the fact that \parsearg sets \catcode`\ =10. |
2935 |
% |
% |
2936 |
\def\set{\begingroup\catcode` =10 |
\parseargdef\set{\setyyy#1 \endsetyyy} |
|
\catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. |
|
|
\parsearg\setxxx} |
|
|
\def\setxxx#1{\setyyy#1 \endsetyyy} |
|
2937 |
\def\setyyy#1 #2\endsetyyy{% |
\def\setyyy#1 #2\endsetyyy{% |
2938 |
\def\temp{#2}% |
{% |
2939 |
\ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty |
\makevalueexpandable |
2940 |
\else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. |
\def\temp{#2}% |
2941 |
\fi |
\edef\next{\gdef\makecsname{SET#1}}% |
2942 |
\endgroup |
\ifx\temp\empty |
2943 |
|
\next{}% |
2944 |
|
\else |
2945 |
|
\setzzz#2\endsetzzz |
2946 |
|
\fi |
2947 |
|
}% |
2948 |
} |
} |
2949 |
% Can't use \xdef to pre-expand #2 and save some time, since \temp or |
% Remove the trailing space \setxxx inserted. |
2950 |
% \next or other control sequences that we've defined might get us into |
\def\setzzz#1 \endsetzzz{\next{#1}} |
|
% an infinite loop. Consider `@set foo @cite{bar}'. |
|
|
\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} |
|
2951 |
|
|
2952 |
% @clear VAR clears (i.e., unsets) the variable VAR. |
% @clear VAR clears (i.e., unsets) the variable VAR. |
2953 |
% |
% |
2954 |
\def\clear{\parsearg\clearxxx} |
\parseargdef\clear{% |
2955 |
\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} |
{% |
2956 |
|
\makevalueexpandable |
2957 |
|
\global\expandafter\let\csname SET#1\endcsname=\relax |
2958 |
|
}% |
2959 |
|
} |
2960 |
|
|
2961 |
% @value{foo} gets the text saved in variable foo. |
% @value{foo} gets the text saved in variable foo. |
2962 |
|
\def\value{\begingroup\makevalueexpandable\valuexxx} |
2963 |
|
\def\valuexxx#1{\expandablevalue{#1}\endgroup} |
2964 |
{ |
{ |
2965 |
\catcode`\_ = \active |
\catcode`\- = \active \catcode`\_ = \active |
2966 |
% |
% |
2967 |
% We might end up with active _ or - characters in the argument if |
\gdef\makevalueexpandable{% |
2968 |
% we're called from @code, as @code{@value{foo-bar_}}. So \let any |
\let\value = \expandablevalue |
2969 |
% such active characters to their normal equivalents. |
% We don't want these characters active, ... |
2970 |
\gdef\value{\begingroup |
\catcode`\-=\other \catcode`\_=\other |
2971 |
\catcode`\-=12 \catcode`\_=12 |
% ..., but we might end up with active ones in the argument if |
2972 |
\indexbreaks \let_\normalunderscore |
% we're called from @code, as @code{@value{foo-bar_}}, though. |
2973 |
\valuexxx} |
% So \let them to their normal equivalents. |
2974 |
|
\let-\realdash \let_\normalunderscore |
2975 |
|
} |
2976 |
} |
} |
|
\def\valuexxx#1{\expandablevalue{#1}\endgroup} |
|
2977 |
|
|
2978 |
% We have this subroutine so that we can handle at least some @value's |
% We have this subroutine so that we can handle at least some @value's |
2979 |
% properly in indexes (we \let\value to this in \indexdummies). Ones |
% properly in indexes (we call \makevalueexpandable in \indexdummies). |
2980 |
% whose names contain - or _ still won't work, but we can't do anything |
% The command has to be fully expandable (if the variable is set), since |
2981 |
% about that. The command has to be fully expandable, since the result |
% the result winds up in the index file. This means that if the |
2982 |
% winds up in the index file. This means that if the variable's value |
% variable's value contains other Texinfo commands, it's almost certain |
2983 |
% contains other Texinfo commands, it's almost certain it will fail |
% it will fail (although perhaps we could fix that with sufficient work |
2984 |
% (although perhaps we could fix that with sufficient work to do a |
% to do a one-level expansion on the result, instead of complete). |
|
% one-level expansion on the result, instead of complete). |
|
2985 |
% |
% |
2986 |
\def\expandablevalue#1{% |
\def\expandablevalue#1{% |
2987 |
\expandafter\ifx\csname SET#1\endcsname\relax |
\expandafter\ifx\csname SET#1\endcsname\relax |
2988 |
{[No value for ``#1'']}% |
{[No value for ``#1'']}% |
2989 |
|
\message{Variable `#1', used in @value, is not set.}% |
2990 |
\else |
\else |
2991 |
\csname SET#1\endcsname |
\csname SET#1\endcsname |
2992 |
\fi |
\fi |
2995 |
% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined |
% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined |
2996 |
% with @set. |
% with @set. |
2997 |
% |
% |
2998 |
\def\ifset{\parsearg\ifsetxxx} |
% To get special treatment of `@end ifset,' call \makeond and the redefine. |
2999 |
\def\ifsetxxx #1{% |
% |
3000 |
\expandafter\ifx\csname SET#1\endcsname\relax |
\makecond{ifset} |
3001 |
\expandafter\ifsetfail |
\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} |
3002 |
\else |
\def\doifset#1#2{% |
3003 |
\expandafter\ifsetsucceed |
{% |
3004 |
\fi |
\makevalueexpandable |
3005 |
|
\let\next=\empty |
3006 |
|
\expandafter\ifx\csname SET#2\endcsname\relax |
3007 |
|
#1% If not set, redefine \next. |
3008 |
|
\fi |
3009 |
|
\expandafter |
3010 |
|
}\next |
3011 |
} |
} |
3012 |
\def\ifsetsucceed{\conditionalsucceed{ifset}} |
\def\ifsetfail{\doignore{ifset}} |
|
\def\ifsetfail{\nestedignore{ifset}} |
|
|
\defineunmatchedend{ifset} |
|
3013 |
|
|
3014 |
% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been |
% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been |
3015 |
% defined with @set, or has been undefined with @clear. |
% defined with @set, or has been undefined with @clear. |
3016 |
% |
% |
3017 |
\def\ifclear{\parsearg\ifclearxxx} |
% The `\else' inside the `\doifset' parameter is a trick to reuse the |
3018 |
\def\ifclearxxx #1{% |
% above code: if the variable is not set, do nothing, if it is set, |
3019 |
\expandafter\ifx\csname SET#1\endcsname\relax |
% then redefine \next to \ifclearfail. |
3020 |
\expandafter\ifclearsucceed |
% |
3021 |
\else |
\makecond{ifclear} |
3022 |
\expandafter\ifclearfail |
\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} |
3023 |
\fi |
\def\ifclearfail{\doignore{ifclear}} |
|
} |
|
|
\def\ifclearsucceed{\conditionalsucceed{ifclear}} |
|
|
\def\ifclearfail{\nestedignore{ifclear}} |
|
|
\defineunmatchedend{ifclear} |
|
|
|
|
|
% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text |
|
|
% following, through the first @end iftex (etc.). Make `@end iftex' |
|
|
% (etc.) valid only after an @iftex. |
|
|
% |
|
|
\def\iftex{\conditionalsucceed{iftex}} |
|
|
\def\ifnothtml{\conditionalsucceed{ifnothtml}} |
|
|
\def\ifnotinfo{\conditionalsucceed{ifnotinfo}} |
|
|
\defineunmatchedend{iftex} |
|
|
\defineunmatchedend{ifnothtml} |
|
|
\defineunmatchedend{ifnotinfo} |
|
|
|
|
|
% We can't just want to start a group at @iftex (for example) and end it |
|
|
% at @end iftex, since then @set commands inside the conditional have no |
|
|
% effect (they'd get reverted at the end of the group). So we must |
|
|
% define \Eiftex to redefine itself to be its previous value. (We can't |
|
|
% just define it to fail again with an ``unmatched end'' error, since |
|
|
% the @ifset might be nested.) |
|
|
% |
|
|
\def\conditionalsucceed#1{% |
|
|
\edef\temp{% |
|
|
% Remember the current value of \E#1. |
|
|
\let\nece{prevE#1} = \nece{E#1}% |
|
|
% |
|
|
% At the `@end #1', redefine \E#1 to be its previous value. |
|
|
\def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% |
|
|
}% |
|
|
\temp |
|
|
} |
|
3024 |
|
|
3025 |
% We need to expand lots of \csname's, but we don't want to expand the |
% @dircategory CATEGORY -- specify a category of the dir file |
3026 |
% control sequences after we've constructed them. |
% which this file should belong to. Ignore this in TeX. |
3027 |
% |
\let\dircategory=\comment |
|
\def\nece#1{\expandafter\noexpand\csname#1\endcsname} |
|
3028 |
|
|
3029 |
% @defininfoenclose. |
% @defininfoenclose. |
3030 |
\let\definfoenclose=\comment |
\let\definfoenclose=\comment |
3034 |
% Index generation facilities |
% Index generation facilities |
3035 |
|
|
3036 |
% Define \newwrite to be identical to plain tex's \newwrite |
% Define \newwrite to be identical to plain tex's \newwrite |
3037 |
% except not \outer, so it can be used within \newindex. |
% except not \outer, so it can be used within macros and \if's. |
3038 |
{\catcode`\@=11 |
\edef\newwrite{\makecsname{ptexnewwrite}} |
|
\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} |
|
3039 |
|
|
3040 |
% \newindex {foo} defines an index named foo. |
% \newindex {foo} defines an index named foo. |
3041 |
% It automatically defines \fooindex such that |
% It automatically defines \fooindex such that |
3055 |
} |
} |
3056 |
|
|
3057 |
% @defindex foo == \newindex{foo} |
% @defindex foo == \newindex{foo} |
3058 |
|
% |
3059 |
\def\defindex{\parsearg\newindex} |
\def\defindex{\parsearg\newindex} |
3060 |
|
|
3061 |
% Define @defcodeindex, like @defindex except put all entries in @code. |
% Define @defcodeindex, like @defindex except put all entries in @code. |
3062 |
|
% |
3063 |
|
\def\defcodeindex{\parsearg\newcodeindex} |
3064 |
|
% |
3065 |
\def\newcodeindex#1{% |
\def\newcodeindex#1{% |
3066 |
\iflinks |
\iflinks |
3067 |
\expandafter\newwrite \csname#1indfile\endcsname |
\expandafter\newwrite \csname#1indfile\endcsname |
3068 |
\openout \csname#1indfile\endcsname \jobname.#1 |
\openout \csname#1indfile\endcsname \jobname.#1 |
3069 |
\fi |
\fi |
3070 |
\expandafter\xdef\csname#1index\endcsname{% |
\expandafter\xdef\csname#1index\endcsname{% |
3071 |
\noexpand\docodeindex{#1}} |
\noexpand\docodeindex{#1}}% |
3072 |
} |
} |
3073 |
|
|
|
\def\defcodeindex{\parsearg\newcodeindex} |
|
3074 |
|
|
3075 |
% @synindex foo bar makes index foo feed into index bar. |
% @synindex foo bar makes index foo feed into index bar. |
3076 |
% Do this instead of @defindex foo if you don't want it as a separate index. |
% Do this instead of @defindex foo if you don't want it as a separate index. |
3077 |
% The \closeout helps reduce unnecessary open files; the limit on the |
% |
|
% Acorn RISC OS is a mere 16 files. |
|
|
\def\synindex#1 #2 {% |
|
|
\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname |
|
|
\expandafter\closeout\csname#1indfile\endcsname |
|
|
\expandafter\let\csname#1indfile\endcsname=\synindexfoo |
|
|
\expandafter\xdef\csname#1index\endcsname{% define \xxxindex |
|
|
\noexpand\doindex{#2}}% |
|
|
} |
|
|
|
|
3078 |
% @syncodeindex foo bar similar, but put all entries made for index foo |
% @syncodeindex foo bar similar, but put all entries made for index foo |
3079 |
% inside @code. |
% inside @code. |
3080 |
\def\syncodeindex#1 #2 {% |
% |
3081 |
\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname |
\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} |
3082 |
\expandafter\closeout\csname#1indfile\endcsname |
\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} |
3083 |
\expandafter\let\csname#1indfile\endcsname=\synindexfoo |
|
3084 |
\expandafter\xdef\csname#1index\endcsname{% define \xxxindex |
% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), |
3085 |
\noexpand\docodeindex{#2}}% |
% #3 the target index (bar). |
3086 |
|
\def\dosynindex#1#2#3{% |
3087 |
|
% Only do \closeout if we haven't already done it, else we'll end up |
3088 |
|
% closing the target index. |
3089 |
|
\expandafter \ifx\csname donesynindex#2\endcsname \undefined |
3090 |
|
% The \closeout helps reduce unnecessary open files; the limit on the |
3091 |
|
% Acorn RISC OS is a mere 16 files. |
3092 |
|
\expandafter\closeout\csname#2indfile\endcsname |
3093 |
|
\expandafter\let\csname\donesynindex#2\endcsname = 1 |
3094 |
|
\fi |
3095 |
|
% redefine \fooindfile: |
3096 |
|
\expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname |
3097 |
|
\expandafter\let\csname#2indfile\endcsname=\temp |
3098 |
|
% redefine \fooindex: |
3099 |
|
\expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% |
3100 |
} |
} |
3101 |
|
|
3102 |
% Define \doindex, the driver for all \fooindex macros. |
% Define \doindex, the driver for all \fooindex macros. |
3116 |
\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} |
\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} |
3117 |
\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} |
\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} |
3118 |
|
|
3119 |
|
% Take care of Texinfo commands that can appear in an index entry. |
3120 |
|
% Since there are some commands we want to expand, and others we don't, |
3121 |
|
% we have to laboriously prevent expansion for those that we don't. |
3122 |
|
% |
3123 |
\def\indexdummies{% |
\def\indexdummies{% |
3124 |
\def\ { }% |
\def\@{@}% change to @@ when we switch to @ as escape char in index files. |
3125 |
% Take care of the plain tex accent commands. |
\def\ {\realbackslash\space }% |
3126 |
\def\"{\realbackslash "}% |
% Need these in case \tex is in effect and \{ is a \delimiter again. |
3127 |
\def\`{\realbackslash `}% |
% But can't use \lbracecmd and \rbracecmd because texindex assumes |
3128 |
\def\'{\realbackslash '}% |
% braces and backslashes are used only as delimiters. |
3129 |
\def\^{\realbackslash ^}% |
\let\{ = \mylbrace |
3130 |
\def\~{\realbackslash ~}% |
\let\} = \myrbrace |
3131 |
\def\={\realbackslash =}% |
% |
3132 |
\def\b{\realbackslash b}% |
% \definedummyword defines \#1 as \realbackslash #1\space, thus |
3133 |
\def\c{\realbackslash c}% |
% effectively preventing its expansion. This is used only for control |
3134 |
\def\d{\realbackslash d}% |
% words, not control letters, because the \space would be incorrect |
3135 |
\def\u{\realbackslash u}% |
% for control characters, but is needed to separate the control word |
3136 |
\def\v{\realbackslash v}% |
% from whatever follows. |
3137 |
\def\H{\realbackslash H}% |
% |
3138 |
% Take care of the plain tex special European modified letters. |
% For control letters, we have \definedummyletter, which omits the |
3139 |
\def\oe{\realbackslash oe}% |
% space. |
3140 |
\def\ae{\realbackslash ae}% |
% |
3141 |
\def\aa{\realbackslash aa}% |
% These can be used both for control words that take an argument and |
3142 |
\def\OE{\realbackslash OE}% |
% those that do not. If it is followed by {arg} in the input, then |
3143 |
\def\AE{\realbackslash AE}% |
% that will dutifully get written to the index (or wherever). |
3144 |
\def\AA{\realbackslash AA}% |
% |
3145 |
\def\o{\realbackslash o}% |
\def\definedummyword##1{% |
3146 |
\def\O{\realbackslash O}% |
\expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}% |
3147 |
\def\l{\realbackslash l}% |
}% |
3148 |
\def\L{\realbackslash L}% |
\def\definedummyletter##1{% |
3149 |
\def\ss{\realbackslash ss}% |
\expandafter\def\csname ##1\endcsname{\realbackslash ##1}% |
3150 |
% Take care of texinfo commands likely to appear in an index entry. |
}% |
3151 |
% (Must be a way to avoid doing expansion at all, and thus not have to |
\let\definedummyaccent\definedummyletter |
3152 |
% laboriously list every single command here.) |
% |
3153 |
\def\@{@}% will be @@ when we switch to @ as escape char. |
% Do the redefinitions. |
3154 |
% Need these in case \tex is in effect and \{ is a \delimiter again. |
\commondummies |
3155 |
% But can't use \lbracecmd and \rbracecmd because texindex assumes |
} |
|
% braces and backslashes are used only as delimiters. |
|
|
\let\{ = \mylbrace |
|
|
\let\} = \myrbrace |
|
|
\def\_{{\realbackslash _}}% |
|
|
\def\w{\realbackslash w }% |
|
|
\def\bf{\realbackslash bf }% |
|
|
%\def\rm{\realbackslash rm }% |
|
|
\def\sl{\realbackslash sl }% |
|
|
\def\sf{\realbackslash sf}% |
|
|
\def\tt{\realbackslash tt}% |
|
|
\def\gtr{\realbackslash gtr}% |
|
|
\def\less{\realbackslash less}% |
|
|
\def\hat{\realbackslash hat}% |
|
|
\def\TeX{\realbackslash TeX}% |
|
|
\def\dots{\realbackslash dots }% |
|
|
\def\result{\realbackslash result}% |
|
|
\def\equiv{\realbackslash equiv}% |
|
|
\def\expansion{\realbackslash expansion}% |
|
|
\def\print{\realbackslash print}% |
|
|
\def\error{\realbackslash error}% |
|
|
\def\point{\realbackslash point}% |
|
|
\def\copyright{\realbackslash copyright}% |
|
|
\def\tclose##1{\realbackslash tclose {##1}}% |
|
|
\def\code##1{\realbackslash code {##1}}% |
|
|
\def\uref##1{\realbackslash uref {##1}}% |
|
|
\def\url##1{\realbackslash url {##1}}% |
|
|
\def\env##1{\realbackslash env {##1}}% |
|
|
\def\command##1{\realbackslash command {##1}}% |
|
|
\def\option##1{\realbackslash option {##1}}% |
|
|
\def\dotless##1{\realbackslash dotless {##1}}% |
|
|
\def\samp##1{\realbackslash samp {##1}}% |
|
|
\def\,##1{\realbackslash ,{##1}}% |
|
|
\def\t##1{\realbackslash t {##1}}% |
|
|
\def\r##1{\realbackslash r {##1}}% |
|
|
\def\i##1{\realbackslash i {##1}}% |
|
|
\def\b##1{\realbackslash b {##1}}% |
|
|
\def\sc##1{\realbackslash sc {##1}}% |
|
|
\def\cite##1{\realbackslash cite {##1}}% |
|
|
\def\key##1{\realbackslash key {##1}}% |
|
|
\def\file##1{\realbackslash file {##1}}% |
|
|
\def\var##1{\realbackslash var {##1}}% |
|
|
\def\kbd##1{\realbackslash kbd {##1}}% |
|
|
\def\dfn##1{\realbackslash dfn {##1}}% |
|
|
\def\emph##1{\realbackslash emph {##1}}% |
|
|
\def\acronym##1{\realbackslash acronym {##1}}% |
|
|
% |
|
|
% Handle some cases of @value -- where the variable name does not |
|
|
% contain - or _, and the value does not contain any |
|
|
% (non-fully-expandable) commands. |
|
|
\let\value = \expandablevalue |
|
|
% |
|
|
\unsepspaces |
|
|
% Turn off macro expansion |
|
|
\turnoffmacros |
|
|
} |
|
|
|
|
|
% If an index command is used in an @example environment, any spaces |
|
|
% therein should become regular spaces in the raw index file, not the |
|
|
% expansion of \tie (\\leavevmode \penalty \@M \ ). |
|
|
{\obeyspaces |
|
|
\gdef\unsepspaces{\obeyspaces\let =\space}} |
|
|
|
|
|
% \indexnofonts no-ops all font-change commands. |
|
|
% This is used when outputting the strings to sort the index by. |
|
|
\def\indexdummyfont#1{#1} |
|
|
\def\indexdummytex{TeX} |
|
|
\def\indexdummydots{...} |
|
3156 |
|
|
3157 |
\def\indexnofonts{% |
% For the aux file, @ is the escape character. So we want to redefine |
3158 |
% Just ignore accents. |
% everything using @ instead of \realbackslash. When everything uses |
3159 |
\let\,=\indexdummyfont |
% @, this will be simpler. |
3160 |
\let\"=\indexdummyfont |
% |
3161 |
\let\`=\indexdummyfont |
\def\atdummies{% |
3162 |
\let\'=\indexdummyfont |
\def\@{@@}% |
3163 |
\let\^=\indexdummyfont |
\def\ {@ }% |
3164 |
\let\~=\indexdummyfont |
\let\{ = \lbraceatcmd |
3165 |
\let\==\indexdummyfont |
\let\} = \rbraceatcmd |
3166 |
\let\b=\indexdummyfont |
% |
3167 |
\let\c=\indexdummyfont |
% (See comments in \indexdummies.) |
3168 |
\let\d=\indexdummyfont |
\def\definedummyword##1{% |
3169 |
\let\u=\indexdummyfont |
\expandafter\def\csname ##1\endcsname{@##1\space}% |
3170 |
\let\v=\indexdummyfont |
}% |
3171 |
\let\H=\indexdummyfont |
\def\definedummyletter##1{% |
3172 |
\let\dotless=\indexdummyfont |
\expandafter\def\csname ##1\endcsname{@##1}% |
3173 |
% Take care of the plain tex special European modified letters. |
}% |
3174 |
\def\oe{oe}% |
\let\definedummyaccent\definedummyletter |
3175 |
\def\ae{ae}% |
% |
3176 |
\def\aa{aa}% |
% Do the redefinitions. |
3177 |
\def\OE{OE}% |
\commondummies |
3178 |
\def\AE{AE}% |
} |
|
\def\AA{AA}% |
|
|
\def\o{o}% |
|
|
\def\O{O}% |
|
|
\def\l{l}% |
|
|
\def\L{L}% |
|
|
\def\ss{ss}% |
|
|
\let\w=\indexdummyfont |
|
|
\let\t=\indexdummyfont |
|
|
\let\r=\indexdummyfont |
|
|
\let\i=\indexdummyfont |
|
|
\let\b=\indexdummyfont |
|
|
\let\emph=\indexdummyfont |
|
|
\let\strong=\indexdummyfont |
|
|
\let\cite=\indexdummyfont |
|
|
\let\sc=\indexdummyfont |
|
|
%Don't no-op \tt, since it isn't a user-level command |
|
|
% and is used in the definitions of the active chars like <, >, |... |
|
|
%\let\tt=\indexdummyfont |
|
|
\let\tclose=\indexdummyfont |
|
|
\let\code=\indexdummyfont |
|
|
\let\url=\indexdummyfont |
|
|
\let\uref=\indexdummyfont |
|
|
\let\env=\indexdummyfont |
|
|
\let\command=\indexdummyfont |
|
|
\let\option=\indexdummyfont |
|
|
\let\file=\indexdummyfont |
|
|
\let\samp=\indexdummyfont |
|
|
\let\kbd=\indexdummyfont |
|
|
\let\key=\indexdummyfont |
|
|
\let\var=\indexdummyfont |
|
|
\let\TeX=\indexdummytex |
|
|
\let\dots=\indexdummydots |
|
|
\def\@{@}% |
|
|
} |
|
|
|
|
|
% To define \realbackslash, we must make \ not be an escape. |
|
|
% We must first make another character (@) an escape |
|
|
% so we do not become unable to do a definition. |
|
3179 |
|
|
3180 |
{\catcode`\@=0 \catcode`\\=\other |
% Called from \indexdummies and \atdummies. \definedummyword and |
3181 |
@gdef@realbackslash{\}} |
% \definedummyletter must be defined first. |
3182 |
|
% |
3183 |
|
\def\commondummies{% |
3184 |
|
% |
3185 |
|
\normalturnoffactive |
3186 |
|
% |
3187 |
|
\commondummiesnofonts |
3188 |
|
% |
3189 |
|
\definedummyletter{_}% |
3190 |
|
% |
3191 |
|
% Non-English letters. |
3192 |
|
\definedummyword{AA}% |
3193 |
|
\definedummyword{AE}% |
3194 |
|
\definedummyword{L}% |
3195 |
|
\definedummyword{OE}% |
3196 |
|
\definedummyword{O}% |
3197 |
|
\definedummyword{aa}% |
3198 |
|
\definedummyword{ae}% |
3199 |
|
\definedummyword{l}% |
3200 |
|
\definedummyword{oe}% |
3201 |
|
\definedummyword{o}% |
3202 |
|
\definedummyword{ss}% |
3203 |
|
\definedummyword{exclamdown}% |
3204 |
|
\definedummyword{questiondown}% |
3205 |
|
\definedummyword{ordf}% |
3206 |
|
\definedummyword{ordm}% |
3207 |
|
% |
3208 |
|
% Although these internal commands shouldn't show up, sometimes they do. |
3209 |
|
\definedummyword{bf}% |
3210 |
|
\definedummyword{gtr}% |
3211 |
|
\definedummyword{hat}% |
3212 |
|
\definedummyword{less}% |
3213 |
|
\definedummyword{sf}% |
3214 |
|
\definedummyword{sl}% |
3215 |
|
\definedummyword{tclose}% |
3216 |
|
\definedummyword{tt}% |
3217 |
|
% |
3218 |
|
\definedummyword{LaTeX}% |
3219 |
|
\definedummyword{TeX}% |
3220 |
|
% |
3221 |
|
% Assorted special characters. |
3222 |
|
\definedummyword{bullet}% |
3223 |
|
\definedummyword{comma}% |
3224 |
|
\definedummyword{copyright}% |
3225 |
|
\definedummyword{registeredsymbol}% |
3226 |
|
\definedummyword{dots}% |
3227 |
|
\definedummyword{enddots}% |
3228 |
|
\definedummyword{equiv}% |
3229 |
|
\definedummyword{error}% |
3230 |
|
\definedummyword{euro}% |
3231 |
|
\definedummyword{expansion}% |
3232 |
|
\definedummyword{minus}% |
3233 |
|
\definedummyword{pounds}% |
3234 |
|
\definedummyword{point}% |
3235 |
|
\definedummyword{print}% |
3236 |
|
\definedummyword{result}% |
3237 |
|
% |
3238 |
|
% Handle some cases of @value -- where it does not contain any |
3239 |
|
% (non-fully-expandable) commands. |
3240 |
|
\makevalueexpandable |
3241 |
|
% |
3242 |
|
% Normal spaces, not active ones. |
3243 |
|
\unsepspaces |
3244 |
|
% |
3245 |
|
% No macro expansion. |
3246 |
|
\turnoffmacros |
3247 |
|
} |
3248 |
|
|
3249 |
|
% \commondummiesnofonts: common to \commondummies and \indexnofonts. |
3250 |
|
% |
3251 |
|
% Better have this without active chars. |
3252 |
|
{ |
3253 |
|
\catcode`\~=\other |
3254 |
|
\gdef\commondummiesnofonts{% |
3255 |
|
% Control letters and accents. |
3256 |
|
\definedummyletter{!}% |
3257 |
|
\definedummyaccent{"}% |
3258 |
|
\definedummyaccent{'}% |
3259 |
|
\definedummyletter{*}% |
3260 |
|
\definedummyaccent{,}% |
3261 |
|
\definedummyletter{.}% |
3262 |
|
\definedummyletter{/}% |
3263 |
|
\definedummyletter{:}% |
3264 |
|
\definedummyaccent{=}% |
3265 |
|
\definedummyletter{?}% |
3266 |
|
\definedummyaccent{^}% |
3267 |
|
\definedummyaccent{`}% |
3268 |
|
\definedummyaccent{~}% |
3269 |
|
\definedummyword{u}% |
3270 |
|
\definedummyword{v}% |
3271 |
|
\definedummyword{H}% |
3272 |
|
\definedummyword{dotaccent}% |
3273 |
|
\definedummyword{ringaccent}% |
3274 |
|
\definedummyword{tieaccent}% |
3275 |
|
\definedummyword{ubaraccent}% |
3276 |
|
\definedummyword{udotaccent}% |
3277 |
|
\definedummyword{dotless}% |
3278 |
|
% |
3279 |
|
% Texinfo font commands. |
3280 |
|
\definedummyword{b}% |
3281 |
|
\definedummyword{i}% |
3282 |
|
\definedummyword{r}% |
3283 |
|
\definedummyword{sc}% |
3284 |
|
\definedummyword{t}% |
3285 |
|
% |
3286 |
|
% Commands that take arguments. |
3287 |
|
\definedummyword{acronym}% |
3288 |
|
\definedummyword{cite}% |
3289 |
|
\definedummyword{code}% |
3290 |
|
\definedummyword{command}% |
3291 |
|
\definedummyword{dfn}% |
3292 |
|
\definedummyword{emph}% |
3293 |
|
\definedummyword{env}% |
3294 |
|
\definedummyword{file}% |
3295 |
|
\definedummyword{kbd}% |
3296 |
|
\definedummyword{key}% |
3297 |
|
\definedummyword{math}% |
3298 |
|
\definedummyword{option}% |
3299 |
|
\definedummyword{samp}% |
3300 |
|
\definedummyword{strong}% |
3301 |
|
\definedummyword{tie}% |
3302 |
|
\definedummyword{uref}% |
3303 |
|
\definedummyword{url}% |
3304 |
|
\definedummyword{var}% |
3305 |
|
\definedummyword{verb}% |
3306 |
|
\definedummyword{w}% |
3307 |
|
} |
3308 |
|
} |
3309 |
|
|
3310 |
|
% \indexnofonts is used when outputting the strings to sort the index |
3311 |
|
% by, and when constructing control sequence names. It eliminates all |
3312 |
|
% control sequences and just writes whatever the best ASCII sort string |
3313 |
|
% would be for a given command (usually its argument). |
3314 |
|
% |
3315 |
|
\def\indexnofonts{% |
3316 |
|
% Accent commands should become @asis. |
3317 |
|
\def\definedummyaccent##1{% |
3318 |
|
\expandafter\let\csname ##1\endcsname\asis |
3319 |
|
}% |
3320 |
|
% We can just ignore other control letters. |
3321 |
|
\def\definedummyletter##1{% |
3322 |
|
\expandafter\def\csname ##1\endcsname{}% |
3323 |
|
}% |
3324 |
|
% Hopefully, all control words can become @asis. |
3325 |
|
\let\definedummyword\definedummyaccent |
3326 |
|
% |
3327 |
|
\commondummiesnofonts |
3328 |
|
% |
3329 |
|
% Don't no-op \tt, since it isn't a user-level command |
3330 |
|
% and is used in the definitions of the active chars like <, >, |, etc. |
3331 |
|
% Likewise with the other plain tex font commands. |
3332 |
|
%\let\tt=\asis |
3333 |
|
% |
3334 |
|
\def\ { }% |
3335 |
|
\def\@{@}% |
3336 |
|
% how to handle braces? |
3337 |
|
\def\_{\normalunderscore}% |
3338 |
|
% |
3339 |
|
% Non-English letters. |
3340 |
|
\def\AA{AA}% |
3341 |
|
\def\AE{AE}% |
3342 |
|
\def\L{L}% |
3343 |
|
\def\OE{OE}% |
3344 |
|
\def\O{O}% |
3345 |
|
\def\aa{aa}% |
3346 |
|
\def\ae{ae}% |
3347 |
|
\def\l{l}% |
3348 |
|
\def\oe{oe}% |
3349 |
|
\def\o{o}% |
3350 |
|
\def\ss{ss}% |
3351 |
|
\def\exclamdown{!}% |
3352 |
|
\def\questiondown{?}% |
3353 |
|
\def\ordf{a}% |
3354 |
|
\def\ordm{o}% |
3355 |
|
% |
3356 |
|
\def\LaTeX{LaTeX}% |
3357 |
|
\def\TeX{TeX}% |
3358 |
|
% |
3359 |
|
% Assorted special characters. |
3360 |
|
% (The following {} will end up in the sort string, but that's ok.) |
3361 |
|
\def\bullet{bullet}% |
3362 |
|
\def\comma{,}% |
3363 |
|
\def\copyright{copyright}% |
3364 |
|
\def\registeredsymbol{R}% |
3365 |
|
\def\dots{...}% |
3366 |
|
\def\enddots{...}% |
3367 |
|
\def\equiv{==}% |
3368 |
|
\def\error{error}% |
3369 |
|
\def\euro{euro}% |
3370 |
|
\def\expansion{==>}% |
3371 |
|
\def\minus{-}% |
3372 |
|
\def\pounds{pounds}% |
3373 |
|
\def\point{.}% |
3374 |
|
\def\print{-|}% |
3375 |
|
\def\result{=>}% |
3376 |
|
% |
3377 |
|
% Don't write macro names. |
3378 |
|
\emptyusermacros |
3379 |
|
} |
3380 |
|
|
3381 |
\let\indexbackslash=0 %overridden during \printindex. |
\let\indexbackslash=0 %overridden during \printindex. |
3382 |
\let\SETmarginindex=\relax % put index entries in margin (undocumented)? |
\let\SETmarginindex=\relax % put index entries in margin (undocumented)? |
3383 |
|
|
|
% For \ifx comparisons. |
|
|
\def\emptymacro{\empty} |
|
|
|
|
3384 |
% Most index entries go through here, but \dosubind is the general case. |
% Most index entries go through here, but \dosubind is the general case. |
3385 |
% |
% #1 is the index name, #2 is the entry text. |
3386 |
\def\doind#1#2{\dosubind{#1}{#2}\empty} |
\def\doind#1#2{\dosubind{#1}{#2}{}} |
3387 |
|
|
3388 |
% Workhorse for all \fooindexes. |
% Workhorse for all \fooindexes. |
3389 |
% #1 is name of index, #2 is stuff to put there, #3 is subentry -- |
% #1 is name of index, #2 is stuff to put there, #3 is subentry -- |
3390 |
% \empty if called from \doind, as we usually are. The main exception |
% empty if called from \doind, as we usually are (the main exception |
3391 |
% is with defuns, which call us directly. |
% is with most defuns, which call us directly). |
3392 |
% |
% |
3393 |
\def\dosubind#1#2#3{% |
\def\dosubind#1#2#3{% |
3394 |
|
\iflinks |
3395 |
|
{% |
3396 |
|
% Store the main index entry text (including the third arg). |
3397 |
|
\toks0 = {#2}% |
3398 |
|
% If third arg is present, precede it with a space. |
3399 |
|
\def\thirdarg{#3}% |
3400 |
|
\ifx\thirdarg\empty \else |
3401 |
|
\toks0 = \expandafter{\the\toks0 \space #3}% |
3402 |
|
\fi |
3403 |
|
% |
3404 |
|
\edef\writeto{\csname#1indfile\endcsname}% |
3405 |
|
% |
3406 |
|
\ifvmode |
3407 |
|
\dosubindsanitize |
3408 |
|
\else |
3409 |
|
\dosubindwrite |
3410 |
|
\fi |
3411 |
|
}% |
3412 |
|
\fi |
3413 |
|
} |
3414 |
|
|
3415 |
|
% Write the entry in \toks0 to the index file: |
3416 |
|
% |
3417 |
|
\def\dosubindwrite{% |
3418 |
% Put the index entry in the margin if desired. |
% Put the index entry in the margin if desired. |
3419 |
\ifx\SETmarginindex\relax\else |
\ifx\SETmarginindex\relax\else |
3420 |
\insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% |
\insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% |
3421 |
\fi |
\fi |
3422 |
{% |
% |
3423 |
\count255=\lastpenalty |
% Remember, we are within a group. |
3424 |
{% |
\indexdummies % Must do this here, since \bf, etc expand at this stage |
3425 |
\indexdummies % Must do this here, since \bf, etc expand at this stage |
\escapechar=`\\ |
3426 |
\escapechar=`\\ |
\def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now |
3427 |
{% |
% so it will be output as is; and it will print as backslash. |
3428 |
\let\folio = 0% We will expand all macros now EXCEPT \folio. |
% |
3429 |
\def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now |
% Process the index entry with all font commands turned off, to |
3430 |
% so it will be output as is; and it will print as backslash. |
% get the string to sort by. |
3431 |
% |
{\indexnofonts |
3432 |
\def\thirdarg{#3}% |
\edef\temp{\the\toks0}% need full expansion |
3433 |
% |
\xdef\indexsorttmp{\temp}% |
3434 |
% If third arg is present, precede it with space in sort key. |
}% |
3435 |
\ifx\thirdarg\emptymacro |
% |
3436 |
\let\subentry = \empty |
% Set up the complete index entry, with both the sort key and |
3437 |
\else |
% the original text, including any font commands. We write |
3438 |
\def\subentry{ #3}% |
% three arguments to \entry to the .?? file (four in the |
3439 |
\fi |
% subentry case), texindex reduces to two when writing the .??s |
3440 |
% |
% sorted result. |
3441 |
% First process the index entry with all font commands turned |
\edef\temp{% |
3442 |
% off to get the string to sort by. |
\write\writeto{% |
3443 |
{\indexnofonts \xdef\indexsorttmp{#2\subentry}}% |
\string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% |
|
% |
|
|
% Now the real index entry with the fonts. |
|
|
\toks0 = {#2}% |
|
|
% |
|
|
% If third (subentry) arg is present, add it to the index |
|
|
% string. And include a space. |
|
|
\ifx\thirdarg\emptymacro \else |
|
|
\toks0 = \expandafter{\the\toks0 \space #3}% |
|
|
\fi |
|
|
% |
|
|
% Set up the complete index entry, with both the sort key |
|
|
% and the original text, including any font commands. We write |
|
|
% three arguments to \entry to the .?? file, texindex reduces to |
|
|
% two when writing the .??s sorted result. |
|
|
\edef\temp{% |
|
|
\write\csname#1indfile\endcsname{% |
|
|
\realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% |
|
|
}% |
|
|
% |
|
|
% If a skip is the last thing on the list now, preserve it |
|
|
% by backing up by \lastskip, doing the \write, then inserting |
|
|
% the skip again. Otherwise, the whatsit generated by the |
|
|
% \write will make \lastskip zero. The result is that sequences |
|
|
% like this: |
|
|
% @end defun |
|
|
% @tindex whatever |
|
|
% @defun ... |
|
|
% will have extra space inserted, because the \medbreak in the |
|
|
% start of the @defun won't see the skip inserted by the @end of |
|
|
% the previous defun. |
|
|
% |
|
|
% But don't do any of this if we're not in vertical mode. We |
|
|
% don't want to do a \vskip and prematurely end a paragraph. |
|
|
% |
|
|
% Avoid page breaks due to these extra skips, too. |
|
|
% |
|
|
\iflinks |
|
|
\ifvmode |
|
|
\skip0 = \lastskip |
|
|
\ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi |
|
|
\fi |
|
|
% |
|
|
\temp % do the write |
|
|
% |
|
|
% |
|
|
\ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi |
|
|
\fi |
|
|
}% |
|
|
}% |
|
|
\penalty\count255 |
|
3444 |
}% |
}% |
3445 |
|
\temp |
3446 |
|
} |
3447 |
|
|
3448 |
|
% Take care of unwanted page breaks: |
3449 |
|
% |
3450 |
|
% If a skip is the last thing on the list now, preserve it |
3451 |
|
% by backing up by \lastskip, doing the \write, then inserting |
3452 |
|
% the skip again. Otherwise, the whatsit generated by the |
3453 |
|
% \write will make \lastskip zero. The result is that sequences |
3454 |
|
% like this: |
3455 |
|
% @end defun |
3456 |
|
% @tindex whatever |
3457 |
|
% @defun ... |
3458 |
|
% will have extra space inserted, because the \medbreak in the |
3459 |
|
% start of the @defun won't see the skip inserted by the @end of |
3460 |
|
% the previous defun. |
3461 |
|
% |
3462 |
|
% But don't do any of this if we're not in vertical mode. We |
3463 |
|
% don't want to do a \vskip and prematurely end a paragraph. |
3464 |
|
% |
3465 |
|
% Avoid page breaks due to these extra skips, too. |
3466 |
|
% |
3467 |
|
% But wait, there is a catch there: |
3468 |
|
% We'll have to check whether \lastskip is zero skip. \ifdim is not |
3469 |
|
% sufficient for this purpose, as it ignores stretch and shrink parts |
3470 |
|
% of the skip. The only way seems to be to check the textual |
3471 |
|
% representation of the skip. |
3472 |
|
% |
3473 |
|
% The following is almost like \def\zeroskipmacro{0.0pt} except that |
3474 |
|
% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). |
3475 |
|
% |
3476 |
|
\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} |
3477 |
|
% |
3478 |
|
% ..., ready, GO: |
3479 |
|
% |
3480 |
|
\def\dosubindsanitize{% |
3481 |
|
% \lastskip and \lastpenalty cannot both be nonzero simultaneously. |
3482 |
|
\skip0 = \lastskip |
3483 |
|
\edef\lastskipmacro{\the\lastskip}% |
3484 |
|
\count255 = \lastpenalty |
3485 |
|
% |
3486 |
|
% If \lastskip is nonzero, that means the last item was a |
3487 |
|
% skip. And since a skip is discardable, that means this |
3488 |
|
% -\skip0 glue we're inserting is preceded by a |
3489 |
|
% non-discardable item, therefore it is not a potential |
3490 |
|
% breakpoint, therefore no \nobreak needed. |
3491 |
|
\ifx\lastskipmacro\zeroskipmacro |
3492 |
|
\else |
3493 |
|
\vskip-\skip0 |
3494 |
|
\fi |
3495 |
|
% |
3496 |
|
\dosubindwrite |
3497 |
|
% |
3498 |
|
\ifx\lastskipmacro\zeroskipmacro |
3499 |
|
% If \lastskip was zero, perhaps the last item was a penalty, and |
3500 |
|
% perhaps it was >=10000, e.g., a \nobreak. In that case, we want |
3501 |
|
% to re-insert the same penalty (values >10000 are used for various |
3502 |
|
% signals); since we just inserted a non-discardable item, any |
3503 |
|
% following glue (such as a \parskip) would be a breakpoint. For example: |
3504 |
|
% |
3505 |
|
% @deffn deffn-whatever |
3506 |
|
% @vindex index-whatever |
3507 |
|
% Description. |
3508 |
|
% would allow a break between the index-whatever whatsit |
3509 |
|
% and the "Description." paragraph. |
3510 |
|
\ifnum\count255>9999 \penalty\count255 \fi |
3511 |
|
\else |
3512 |
|
% On the other hand, if we had a nonzero \lastskip, |
3513 |
|
% this make-up glue would be preceded by a non-discardable item |
3514 |
|
% (the whatsit from the \write), so we must insert a \nobreak. |
3515 |
|
\nobreak\vskip\skip0 |
3516 |
|
\fi |
3517 |
} |
} |
3518 |
|
|
3519 |
% The index entry written in the file actually looks like |
% The index entry written in the file actually looks like |
3551 |
% @printindex causes a particular index (the ??s file) to get printed. |
% @printindex causes a particular index (the ??s file) to get printed. |
3552 |
% It does not print any chapter heading (usually an @unnumbered). |
% It does not print any chapter heading (usually an @unnumbered). |
3553 |
% |
% |
3554 |
\def\printindex{\parsearg\doprintindex} |
\parseargdef\printindex{\begingroup |
|
\def\doprintindex#1{\begingroup |
|
3555 |
\dobreak \chapheadingskip{10000}% |
\dobreak \chapheadingskip{10000}% |
3556 |
% |
% |
3557 |
\indexfonts \rm |
\smallfonts \rm |
3558 |
\tolerance = 9500 |
\tolerance = 9500 |
3559 |
\indexbreaks |
\everypar = {}% don't want the \kern\-parindent from indentation suppression. |
3560 |
% |
% |
3561 |
% See if the index file exists and is nonempty. |
% See if the index file exists and is nonempty. |
3562 |
% Change catcode of @ here so that if the index file contains |
% Change catcode of @ here so that if the index file contains |
3583 |
% Index files are almost Texinfo source, but we use \ as the escape |
% Index files are almost Texinfo source, but we use \ as the escape |
3584 |
% character. It would be better to use @, but that's too big a change |
% character. It would be better to use @, but that's too big a change |
3585 |
% to make right now. |
% to make right now. |
3586 |
\def\indexbackslash{\rawbackslashxx}% |
\def\indexbackslash{\backslashcurfont}% |
3587 |
\catcode`\\ = 0 |
\catcode`\\ = 0 |
3588 |
\escapechar = `\\ |
\escapechar = `\\ |
3589 |
\begindoublecolumns |
\begindoublecolumns |
3605 |
\removelastskip |
\removelastskip |
3606 |
% |
% |
3607 |
% We like breaks before the index initials, so insert a bonus. |
% We like breaks before the index initials, so insert a bonus. |
3608 |
\penalty -300 |
\nobreak |
3609 |
|
\vskip 0pt plus 3\baselineskip |
3610 |
|
\penalty 0 |
3611 |
|
\vskip 0pt plus -3\baselineskip |
3612 |
% |
% |
3613 |
% Typeset the initial. Making this add up to a whole number of |
% Typeset the initial. Making this add up to a whole number of |
3614 |
% baselineskips increases the chance of the dots lining up from column |
% baselineskips increases the chance of the dots lining up from column |
3618 |
% No shrink because it confuses \balancecolumns. |
% No shrink because it confuses \balancecolumns. |
3619 |
\vskip 1.67\baselineskip plus .5\baselineskip |
\vskip 1.67\baselineskip plus .5\baselineskip |
3620 |
\leftline{\secbf #1}% |
\leftline{\secbf #1}% |
|
\vskip .33\baselineskip plus .1\baselineskip |
|
|
% |
|
3621 |
% Do our best not to break after the initial. |
% Do our best not to break after the initial. |
3622 |
\nobreak |
\nobreak |
3623 |
|
\vskip .33\baselineskip plus .1\baselineskip |
3624 |
}} |
}} |
3625 |
|
|
3626 |
% This typesets a paragraph consisting of #1, dot leaders, and then #2 |
% \entry typesets a paragraph consisting of the text (#1), dot leaders, and |
3627 |
% flush to the right margin. It is used for index and table of contents |
% then page number (#2) flushed to the right margin. It is used for index |
3628 |
% entries. The paragraph is indented by \leftskip. |
% and table of contents entries. The paragraph is indented by \leftskip. |
3629 |
% |
% |
3630 |
\def\entry#1#2{\begingroup |
% A straightforward implementation would start like this: |
3631 |
% |
% \def\entry#1#2{... |
3632 |
% Start a new paragraph if necessary, so our assignments below can't |
% But this frozes the catcodes in the argument, and can cause problems to |
3633 |
% affect previous text. |
% @code, which sets - active. This problem was fixed by a kludge--- |
3634 |
\par |
% ``-'' was active throughout whole index, but this isn't really right. |
3635 |
% |
% |
3636 |
% Do not fill out the last line with white space. |
% The right solution is to prevent \entry from swallowing the whole text. |
3637 |
\parfillskip = 0in |
% --kasal, 21nov03 |
3638 |
% |
\def\entry{% |
3639 |
% No extra space above this paragraph. |
\begingroup |
3640 |
\parskip = 0in |
% |
3641 |
% |
% Start a new paragraph if necessary, so our assignments below can't |
3642 |
% Do not prefer a separate line ending with a hyphen to fewer lines. |
% affect previous text. |
3643 |
\finalhyphendemerits = 0 |
\par |
3644 |
% |
% |
3645 |
% \hangindent is only relevant when the entry text and page number |
% Do not fill out the last line with white space. |
3646 |
% don't both fit on one line. In that case, bob suggests starting the |
\parfillskip = 0in |
3647 |
% dots pretty far over on the line. Unfortunately, a large |
% |
3648 |
% indentation looks wrong when the entry text itself is broken across |
% No extra space above this paragraph. |
3649 |
% lines. So we use a small indentation and put up with long leaders. |
\parskip = 0in |
3650 |
% |
% |
3651 |
% \hangafter is reset to 1 (which is the value we want) at the start |
% Do not prefer a separate line ending with a hyphen to fewer lines. |
3652 |
% of each paragraph, so we need not do anything with that. |
\finalhyphendemerits = 0 |
3653 |
\hangindent = 2em |
% |
3654 |
% |
% \hangindent is only relevant when the entry text and page number |
3655 |
% When the entry text needs to be broken, just fill out the first line |
% don't both fit on one line. In that case, bob suggests starting the |
3656 |
% with blank space. |
% dots pretty far over on the line. Unfortunately, a large |
3657 |
\rightskip = 0pt plus1fil |
% indentation looks wrong when the entry text itself is broken across |
3658 |
% |
% lines. So we use a small indentation and put up with long leaders. |
3659 |
% A bit of stretch before each entry for the benefit of balancing columns. |
% |
3660 |
\vskip 0pt plus1pt |
% \hangafter is reset to 1 (which is the value we want) at the start |
3661 |
% |
% of each paragraph, so we need not do anything with that. |
3662 |
% Start a ``paragraph'' for the index entry so the line breaking |
\hangindent = 2em |
3663 |
% parameters we've set above will have an effect. |
% |
3664 |
\noindent |
% When the entry text needs to be broken, just fill out the first line |
3665 |
% |
% with blank space. |
3666 |
% Insert the text of the index entry. TeX will do line-breaking on it. |
\rightskip = 0pt plus1fil |
3667 |
#1% |
% |
3668 |
% The following is kludged to not output a line of dots in the index if |
% A bit of stretch before each entry for the benefit of balancing |
3669 |
% there are no page numbers. The next person who breaks this will be |
% columns. |
3670 |
% cursed by a Unix daemon. |
\vskip 0pt plus1pt |
3671 |
\def\tempa{{\rm }}% |
% |
3672 |
\def\tempb{#2}% |
% Swallow the left brace of the text (first parameter): |
3673 |
\edef\tempc{\tempa}% |
\afterassignment\doentry |
3674 |
\edef\tempd{\tempb}% |
\let\temp = |
3675 |
\ifx\tempc\tempd\ \else% |
} |
3676 |
% |
\def\doentry{% |
3677 |
% If we must, put the page number on a line of its own, and fill out |
\bgroup % Instead of the swallowed brace. |
3678 |
% this line with blank space. (The \hfil is overwhelmed with the |
\noindent |
3679 |
% fill leaders glue in \indexdotfill if the page number does fit.) |
\aftergroup\finishentry |
3680 |
\hfil\penalty50 |
% And now comes the text of the entry. |
3681 |
\null\nobreak\indexdotfill % Have leaders before the page number. |
} |
3682 |
% |
\def\finishentry#1{% |
3683 |
% The `\ ' here is removed by the implicit \unskip that TeX does as |
% #1 is the page number. |
3684 |
% part of (the primitive) \par. Without it, a spurious underfull |
% |
3685 |
% \hbox ensues. |
% The following is kludged to not output a line of dots in the index if |
3686 |
\ #2% The page number ends the paragraph. |
% there are no page numbers. The next person who breaks this will be |
3687 |
\fi% |
% cursed by a Unix daemon. |
3688 |
\par |
\def\tempa{{\rm }}% |
3689 |
\endgroup} |
\def\tempb{#1}% |
3690 |
|
\edef\tempc{\tempa}% |
3691 |
|
\edef\tempd{\tempb}% |
3692 |
|
\ifx\tempc\tempd |
3693 |
|
\ % |
3694 |
|
\else |
3695 |
|
% |
3696 |
|
% If we must, put the page number on a line of its own, and fill out |
3697 |
|
% this line with blank space. (The \hfil is overwhelmed with the |
3698 |
|
% fill leaders glue in \indexdotfill if the page number does fit.) |
3699 |
|
\hfil\penalty50 |
3700 |
|
\null\nobreak\indexdotfill % Have leaders before the page number. |
3701 |
|
% |
3702 |
|
% The `\ ' here is removed by the implicit \unskip that TeX does as |
3703 |
|
% part of (the primitive) \par. Without it, a spurious underfull |
3704 |
|
% \hbox ensues. |
3705 |
|
\ifpdf |
3706 |
|
\pdfgettoks#1.% |
3707 |
|
\ \the\toksA |
3708 |
|
\else |
3709 |
|
\ #1% |
3710 |
|
\fi |
3711 |
|
\fi |
3712 |
|
\par |
3713 |
|
\endgroup |
3714 |
|
} |
3715 |
|
|
3716 |
% Like \dotfill except takes at least 1 em. |
% Like \dotfill except takes at least 1 em. |
3717 |
\def\indexdotfill{\cleaders |
\def\indexdotfill{\cleaders |
3720 |
\def\primary #1{\line{#1\hfil}} |
\def\primary #1{\line{#1\hfil}} |
3721 |
|
|
3722 |
\newskip\secondaryindent \secondaryindent=0.5cm |
\newskip\secondaryindent \secondaryindent=0.5cm |
3723 |
|
\def\secondary#1#2{{% |
3724 |
\def\secondary #1#2{ |
\parfillskip=0in |
3725 |
{\parfillskip=0in \parskip=0in |
\parskip=0in |
3726 |
\hangindent =1in \hangafter=1 |
\hangindent=1in |
3727 |
\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par |
\hangafter=1 |
3728 |
|
\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill |
3729 |
|
\ifpdf |
3730 |
|
\pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. |
3731 |
|
\else |
3732 |
|
#2 |
3733 |
|
\fi |
3734 |
|
\par |
3735 |
}} |
}} |
3736 |
|
|
3737 |
% Define two-column mode, which we use to typeset indexes. |
% Define two-column mode, which we use to typeset indexes. |
3791 |
% |
% |
3792 |
% Double the \vsize as well. (We don't need a separate register here, |
% Double the \vsize as well. (We don't need a separate register here, |
3793 |
% since nobody clobbers \vsize.) |
% since nobody clobbers \vsize.) |
|
\advance\vsize by -\ht\partialpage |
|
3794 |
\vsize = 2\vsize |
\vsize = 2\vsize |
3795 |
} |
} |
3796 |
|
|
3804 |
% previous page. |
% previous page. |
3805 |
\dimen@ = \vsize |
\dimen@ = \vsize |
3806 |
\divide\dimen@ by 2 |
\divide\dimen@ by 2 |
3807 |
|
\advance\dimen@ by -\ht\partialpage |
3808 |
% |
% |
3809 |
% box0 will be the left-hand column, box2 the right. |
% box0 will be the left-hand column, box2 the right. |
3810 |
\setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ |
\setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ |
3812 |
\unvbox255 |
\unvbox255 |
3813 |
\penalty\outputpenalty |
\penalty\outputpenalty |
3814 |
} |
} |
3815 |
|
% |
3816 |
|
% Re-output the contents of the output page -- any previous material, |
3817 |
|
% followed by the two boxes we just split, in box0 and box2. |
3818 |
\def\pagesofar{% |
\def\pagesofar{% |
|
% Re-output the contents of the output page -- any previous material, |
|
|
% followed by the two boxes we just split, in box0 and box2. |
|
3819 |
\unvbox\partialpage |
\unvbox\partialpage |
3820 |
% |
% |
3821 |
\hsize = \doublecolumnhsize |
\hsize = \doublecolumnhsize |
3822 |
\wd0=\hsize \wd2=\hsize |
\wd0=\hsize \wd2=\hsize |
3823 |
\hbox to\pagewidth{\box0\hfil\box2}% |
\hbox to\pagewidth{\box0\hfil\box2}% |
3824 |
} |
} |
3825 |
|
% |
3826 |
|
% All done with double columns. |
3827 |
\def\enddoublecolumns{% |
\def\enddoublecolumns{% |
3828 |
\output = {% |
\output = {% |
3829 |
% Split the last of the double-column material. Leave it on the |
% Split the last of the double-column material. Leave it on the |
3848 |
% \endgroup where \vsize got restored). |
% \endgroup where \vsize got restored). |
3849 |
\pagegoal = \vsize |
\pagegoal = \vsize |
3850 |
} |
} |
3851 |
|
% |
3852 |
|
% Called at the end of the double column material. |
3853 |
\def\balancecolumns{% |
\def\balancecolumns{% |
|
% Called at the end of the double column material. |
|
3854 |
\setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. |
\setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. |
3855 |
\dimen@ = \ht0 |
\dimen@ = \ht0 |
3856 |
\advance\dimen@ by \topskip |
\advance\dimen@ by \topskip |
3878 |
|
|
3879 |
|
|
3880 |
\message{sectioning,} |
\message{sectioning,} |
3881 |
% Define chapters, sections, etc. |
% Chapters, sections, etc. |
3882 |
|
|
3883 |
|
% \unnumberedno is an oxymoron, of course. But we count the unnumbered |
3884 |
|
% sections so that we can refer to them unambiguously in the pdf |
3885 |
|
% outlines by their "section number". We avoid collisions with chapter |
3886 |
|
% numbers by starting them at 10000. (If a document ever has 10000 |
3887 |
|
% chapters, we're in trouble anyway, I'm sure.) |
3888 |
|
\newcount\unnumberedno \unnumberedno = 10000 |
3889 |
\newcount\chapno |
\newcount\chapno |
3890 |
\newcount\secno \secno=0 |
\newcount\secno \secno=0 |
3891 |
\newcount\subsecno \subsecno=0 |
\newcount\subsecno \subsecno=0 |
3893 |
|
|
3894 |
% This counter is funny since it counts through charcodes of letters A, B, ... |
% This counter is funny since it counts through charcodes of letters A, B, ... |
3895 |
\newcount\appendixno \appendixno = `\@ |
\newcount\appendixno \appendixno = `\@ |
3896 |
\def\appendixletter{\char\appendixno} |
% |
3897 |
|
% \def\appendixletter{\char\the\appendixno} |
3898 |
|
% We do the following ugly conditional instead of the above simple |
3899 |
|
% construct for the sake of pdftex, which needs the actual |
3900 |
|
% letter in the expansion, not just typeset. |
3901 |
|
% |
3902 |
|
\def\appendixletter{% |
3903 |
|
\ifnum\appendixno=`A A% |
3904 |
|
\else\ifnum\appendixno=`B B% |
3905 |
|
\else\ifnum\appendixno=`C C% |
3906 |
|
\else\ifnum\appendixno=`D D% |
3907 |
|
\else\ifnum\appendixno=`E E% |
3908 |
|
\else\ifnum\appendixno=`F F% |
3909 |
|
\else\ifnum\appendixno=`G G% |
3910 |
|
\else\ifnum\appendixno=`H H% |
3911 |
|
\else\ifnum\appendixno=`I I% |
3912 |
|
\else\ifnum\appendixno=`J J% |
3913 |
|
\else\ifnum\appendixno=`K K% |
3914 |
|
\else\ifnum\appendixno=`L L% |
3915 |
|
\else\ifnum\appendixno=`M M% |
3916 |
|
\else\ifnum\appendixno=`N N% |
3917 |
|
\else\ifnum\appendixno=`O O% |
3918 |
|
\else\ifnum\appendixno=`P P% |
3919 |
|
\else\ifnum\appendixno=`Q Q% |
3920 |
|
\else\ifnum\appendixno=`R R% |
3921 |
|
\else\ifnum\appendixno=`S S% |
3922 |
|
\else\ifnum\appendixno=`T T% |
3923 |
|
\else\ifnum\appendixno=`U U% |
3924 |
|
\else\ifnum\appendixno=`V V% |
3925 |
|
\else\ifnum\appendixno=`W W% |
3926 |
|
\else\ifnum\appendixno=`X X% |
3927 |
|
\else\ifnum\appendixno=`Y Y% |
3928 |
|
\else\ifnum\appendixno=`Z Z% |
3929 |
|
% The \the is necessary, despite appearances, because \appendixletter is |
3930 |
|
% expanded while writing the .toc file. \char\appendixno is not |
3931 |
|
% expandable, thus it is written literally, thus all appendixes come out |
3932 |
|
% with the same letter (or @) in the toc without it. |
3933 |
|
\else\char\the\appendixno |
3934 |
|
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi |
3935 |
|
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} |
3936 |
|
|
3937 |
% Each @chapter defines this as the name of the chapter. |
% Each @chapter defines this as the name of the chapter. |
3938 |
% page headings and footings can use it. @section does likewise. |
% page headings and footings can use it. @section does likewise. |
3939 |
|
% However, they are not reliable, because we don't use marks. |
3940 |
\def\thischapter{} |
\def\thischapter{} |
3941 |
\def\thissection{} |
\def\thissection{} |
3942 |
|
|
3943 |
\newcount\absseclevel % used to calculate proper heading level |
\newcount\absseclevel % used to calculate proper heading level |
3944 |
\newcount\secbase\secbase=0 % @raise/lowersections modify this count |
\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count |
3945 |
|
|
3946 |
% @raisesections: treat @section as chapter, @subsection as section, etc. |
% @raisesections: treat @section as chapter, @subsection as section, etc. |
3947 |
\def\raisesections{\global\advance\secbase by -1} |
\def\raisesections{\global\advance\secbase by -1} |
3951 |
\def\lowersections{\global\advance\secbase by 1} |
\def\lowersections{\global\advance\secbase by 1} |
3952 |
\let\down=\lowersections % original BFox name |
\let\down=\lowersections % original BFox name |
3953 |
|
|
3954 |
% Choose a numbered-heading macro |
% we only have subsub. |
3955 |
% #1 is heading level if unmodified by @raisesections or @lowersections |
\chardef\maxseclevel = 3 |
3956 |
% #2 is text for heading |
% |
3957 |
\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 |
% A numbered section within an unnumbered changes to unnumbered too. |
3958 |
\ifcase\absseclevel |
% To achive this, remember the "biggest" unnum. sec. we are currently in: |
3959 |
\chapterzzz{#2} |
\chardef\unmlevel = \maxseclevel |
3960 |
\or |
% |
3961 |
\seczzz{#2} |
% Trace whether the current chapter is an appendix or not: |
3962 |
\or |
% \chapheadtype is "N" or "A", unnumbered chapters are ignored. |
3963 |
\numberedsubseczzz{#2} |
\def\chapheadtype{N} |
3964 |
\or |
|
3965 |
\numberedsubsubseczzz{#2} |
% Choose a heading macro |
3966 |
\else |
% #1 is heading type |
3967 |
\ifnum \absseclevel<0 |
% #2 is heading level |
3968 |
\chapterzzz{#2} |
% #3 is text for heading |
3969 |
|
\def\genhead#1#2#3{% |
3970 |
|
% Compute the abs. sec. level: |
3971 |
|
\absseclevel=#2 |
3972 |
|
\advance\absseclevel by \secbase |
3973 |
|
% Make sure \absseclevel doesn't fall outside the range: |
3974 |
|
\ifnum \absseclevel < 0 |
3975 |
|
\absseclevel = 0 |
3976 |
\else |
\else |
3977 |
\numberedsubsubseczzz{#2} |
\ifnum \absseclevel > 3 |
3978 |
|
\absseclevel = 3 |
3979 |
|
\fi |
3980 |
\fi |
\fi |
3981 |
\fi |
% The heading type: |
3982 |
} |
\def\headtype{#1}% |
3983 |
|
\if \headtype U% |
3984 |
% like \numhead, but chooses appendix heading levels |
\ifnum \absseclevel < \unmlevel |
3985 |
\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 |
\chardef\unmlevel = \absseclevel |
3986 |
\ifcase\absseclevel |
\fi |
|
\appendixzzz{#2} |
|
|
\or |
|
|
\appendixsectionzzz{#2} |
|
|
\or |
|
|
\appendixsubseczzz{#2} |
|
|
\or |
|
|
\appendixsubsubseczzz{#2} |
|
|
\else |
|
|
\ifnum \absseclevel<0 |
|
|
\appendixzzz{#2} |
|
3987 |
\else |
\else |
3988 |
\appendixsubsubseczzz{#2} |
% Check for appendix sections: |
3989 |
|
\ifnum \absseclevel = 0 |
3990 |
|
\edef\chapheadtype{\headtype}% |
3991 |
|
\else |
3992 |
|
\if \headtype A\if \chapheadtype N% |
3993 |
|
\errmessage{@appendix... within a non-appendix chapter}% |
3994 |
|
\fi\fi |
3995 |
|
\fi |
3996 |
|
% Check for numbered within unnumbered: |
3997 |
|
\ifnum \absseclevel > \unmlevel |
3998 |
|
\def\headtype{U}% |
3999 |
|
\else |
4000 |
|
\chardef\unmlevel = 3 |
4001 |
|
\fi |
4002 |
\fi |
\fi |
4003 |
\fi |
% Now print the heading: |
4004 |
} |
\if \headtype U% |
4005 |
|
\ifcase\absseclevel |
4006 |
% like \numhead, but chooses numberless heading levels |
\unnumberedzzz{#3}% |
4007 |
\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 |
\or \unnumberedseczzz{#3}% |
4008 |
\ifcase\absseclevel |
\or \unnumberedsubseczzz{#3}% |
4009 |
\unnumberedzzz{#2} |
\or \unnumberedsubsubseczzz{#3}% |
4010 |
\or |
\fi |
|
\unnumberedseczzz{#2} |
|
|
\or |
|
|
\unnumberedsubseczzz{#2} |
|
|
\or |
|
|
\unnumberedsubsubseczzz{#2} |
|
|
\else |
|
|
\ifnum \absseclevel<0 |
|
|
\unnumberedzzz{#2} |
|
4011 |
\else |
\else |
4012 |
\unnumberedsubsubseczzz{#2} |
\if \headtype A% |
4013 |
|
\ifcase\absseclevel |
4014 |
|
\appendixzzz{#3}% |
4015 |
|
\or \appendixsectionzzz{#3}% |
4016 |
|
\or \appendixsubseczzz{#3}% |
4017 |
|
\or \appendixsubsubseczzz{#3}% |
4018 |
|
\fi |
4019 |
|
\else |
4020 |
|
\ifcase\absseclevel |
4021 |
|
\chapterzzz{#3}% |
4022 |
|
\or \seczzz{#3}% |
4023 |
|
\or \numberedsubseczzz{#3}% |
4024 |
|
\or \numberedsubsubseczzz{#3}% |
4025 |
|
\fi |
4026 |
|
\fi |
4027 |
\fi |
\fi |
4028 |
\fi |
\suppressfirstparagraphindent |
4029 |
} |
} |
4030 |
|
|
4031 |
% @chapter, @appendix, @unnumbered. |
% an interface: |
4032 |
\def\thischaptername{No Chapter Title} |
\def\numhead{\genhead N} |
4033 |
\outer\def\chapter{\parsearg\chapteryyy} |
\def\apphead{\genhead A} |
4034 |
\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz |
\def\unnmhead{\genhead U} |
4035 |
\def\chapterzzz #1{% |
|
4036 |
\secno=0 \subsecno=0 \subsubsecno=0 |
% @chapter, @appendix, @unnumbered. Increment top-level counter, reset |
4037 |
\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% |
% all lower-level sectioning counters to zero. |
4038 |
\chapmacro {#1}{\the\chapno}% |
% |
4039 |
\gdef\thissection{#1}% |
% Also set \chaplevelprefix, which we prepend to @float sequence numbers |
4040 |
\gdef\thischaptername{#1}% |
% (e.g., figures), q.v. By default (before any chapter), that is empty. |
4041 |
% We don't substitute the actual chapter name into \thischapter |
\let\chaplevelprefix = \empty |
4042 |
% because we don't want its macros evaluated now. |
% |
4043 |
\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% |
\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz |
4044 |
\toks0 = {#1}% |
\def\chapterzzz#1{% |
4045 |
\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% |
% section resetting is \global in case the chapter is in a group, such |
4046 |
{\the\chapno}}}% |
% as an @include file. |
4047 |
\temp |
\global\secno=0 \global\subsecno=0 \global\subsubsecno=0 |
4048 |
\donoderef |
\global\advance\chapno by 1 |
4049 |
\global\let\section = \numberedsec |
% |
4050 |
\global\let\subsection = \numberedsubsec |
% Used for \float. |
4051 |
\global\let\subsubsection = \numberedsubsubsec |
\gdef\chaplevelprefix{\the\chapno.}% |
4052 |
} |
\resetallfloatnos |
4053 |
|
% |
4054 |
\outer\def\appendix{\parsearg\appendixyyy} |
\message{\putwordChapter\space \the\chapno}% |
4055 |
\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz |
% |
4056 |
\def\appendixzzz #1{% |
% Write the actual heading. |
4057 |
\secno=0 \subsecno=0 \subsubsecno=0 |
\chapmacro{#1}{Ynumbered}{\the\chapno}% |
4058 |
\global\advance \appendixno by 1 |
% |
4059 |
\message{\putwordAppendix\space \appendixletter}% |
% So @section and the like are numbered underneath this chapter. |
4060 |
\chapmacro {#1}{\putwordAppendix{} \appendixletter}% |
\global\let\section = \numberedsec |
4061 |
\gdef\thissection{#1}% |
\global\let\subsection = \numberedsubsec |
4062 |
\gdef\thischaptername{#1}% |
\global\let\subsubsection = \numberedsubsubsec |
|
\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% |
|
|
\toks0 = {#1}% |
|
|
\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% |
|
|
{\putwordAppendix{} \appendixletter}}}% |
|
|
\temp |
|
|
\appendixnoderef |
|
|
\global\let\section = \appendixsec |
|
|
\global\let\subsection = \appendixsubsec |
|
|
\global\let\subsubsection = \appendixsubsubsec |
|
4063 |
} |
} |
4064 |
|
|
4065 |
% @centerchap is like @unnumbered, but the heading is centered. |
\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz |
4066 |
\outer\def\centerchap{\parsearg\centerchapyyy} |
\def\appendixzzz#1{% |
4067 |
\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} |
\global\secno=0 \global\subsecno=0 \global\subsubsecno=0 |
4068 |
|
\global\advance\appendixno by 1 |
4069 |
|
\gdef\chaplevelprefix{\appendixletter.}% |
4070 |
|
\resetallfloatnos |
4071 |
|
% |
4072 |
|
\def\appendixnum{\putwordAppendix\space \appendixletter}% |
4073 |
|
\message{\appendixnum}% |
4074 |
|
% |
4075 |
|
\chapmacro{#1}{Yappendix}{\appendixletter}% |
4076 |
|
% |
4077 |
|
\global\let\section = \appendixsec |
4078 |
|
\global\let\subsection = \appendixsubsec |
4079 |
|
\global\let\subsubsection = \appendixsubsubsec |
4080 |
|
} |
4081 |
|
|
4082 |
% @top is like @unnumbered. |
\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz |
4083 |
\outer\def\top{\parsearg\unnumberedyyy} |
\def\unnumberedzzz#1{% |
4084 |
|
\global\secno=0 \global\subsecno=0 \global\subsubsecno=0 |
4085 |
|
\global\advance\unnumberedno by 1 |
4086 |
|
% |
4087 |
|
% Since an unnumbered has no number, no prefix for figures. |
4088 |
|
\global\let\chaplevelprefix = \empty |
4089 |
|
\resetallfloatnos |
4090 |
|
% |
4091 |
|
% This used to be simply \message{#1}, but TeX fully expands the |
4092 |
|
% argument to \message. Therefore, if #1 contained @-commands, TeX |
4093 |
|
% expanded them. For example, in `@unnumbered The @cite{Book}', TeX |
4094 |
|
% expanded @cite (which turns out to cause errors because \cite is meant |
4095 |
|
% to be executed, not expanded). |
4096 |
|
% |
4097 |
|
% Anyway, we don't want the fully-expanded definition of @cite to appear |
4098 |
|
% as a result of the \message, we just want `@cite' itself. We use |
4099 |
|
% \the<toks register> to achieve this: TeX expands \the<toks> only once, |
4100 |
|
% simply yielding the contents of <toks register>. (We also do this for |
4101 |
|
% the toc entries.) |
4102 |
|
\toks0 = {#1}% |
4103 |
|
\message{(\the\toks0)}% |
4104 |
|
% |
4105 |
|
\chapmacro{#1}{Ynothing}{\the\unnumberedno}% |
4106 |
|
% |
4107 |
|
\global\let\section = \unnumberedsec |
4108 |
|
\global\let\subsection = \unnumberedsubsec |
4109 |
|
\global\let\subsubsection = \unnumberedsubsubsec |
4110 |
|
} |
4111 |
|
|
4112 |
\outer\def\unnumbered{\parsearg\unnumberedyyy} |
% @centerchap is like @unnumbered, but the heading is centered. |
4113 |
\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz |
\outer\parseargdef\centerchap{% |
4114 |
\def\unnumberedzzz #1{% |
% Well, we could do the following in a group, but that would break |
4115 |
\secno=0 \subsecno=0 \subsubsecno=0 |
% an assumption that \chapmacro is called at the outermost level. |
4116 |
% |
% Thus we are safer this way: --kasal, 24feb04 |
4117 |
% This used to be simply \message{#1}, but TeX fully expands the |
\let\centerparametersmaybe = \centerparameters |
4118 |
% argument to \message. Therefore, if #1 contained @-commands, TeX |
\unnmhead0{#1}% |
4119 |
% expanded them. For example, in `@unnumbered The @cite{Book}', TeX |
\let\centerparametersmaybe = \relax |
|
% expanded @cite (which turns out to cause errors because \cite is meant |
|
|
% to be executed, not expanded). |
|
|
% |
|
|
% Anyway, we don't want the fully-expanded definition of @cite to appear |
|
|
% as a result of the \message, we just want `@cite' itself. We use |
|
|
% \the<toks register> to achieve this: TeX expands \the<toks> only once, |
|
|
% simply yielding the contents of <toks register>. (We also do this for |
|
|
% the toc entries.) |
|
|
\toks0 = {#1}\message{(\the\toks0)}% |
|
|
% |
|
|
\unnumbchapmacro {#1}% |
|
|
\gdef\thischapter{#1}\gdef\thissection{#1}% |
|
|
\toks0 = {#1}% |
|
|
\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}% |
|
|
\temp |
|
|
\unnumbnoderef |
|
|
\global\let\section = \unnumberedsec |
|
|
\global\let\subsection = \unnumberedsubsec |
|
|
\global\let\subsubsection = \unnumberedsubsubsec |
|
4120 |
} |
} |
4121 |
|
|
4122 |
|
% @top is like @unnumbered. |
4123 |
|
\let\top\unnumbered |
4124 |
|
|
4125 |
% Sections. |
% Sections. |
4126 |
\outer\def\numberedsec{\parsearg\secyyy} |
\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz |
4127 |
\def\secyyy #1{\numhead1{#1}} % normally calls seczzz |
\def\seczzz#1{% |
4128 |
\def\seczzz #1{% |
\global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 |
4129 |
\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % |
\sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% |
4130 |
\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% |
} |
4131 |
\toks0 = {#1}% |
|
4132 |
\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% |
\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz |
4133 |
{\the\chapno}{\the\secno}}}% |
\def\appendixsectionzzz#1{% |
4134 |
\temp |
\global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 |
4135 |
\donoderef |
\sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% |
4136 |
\nobreak |
} |
4137 |
} |
\let\appendixsec\appendixsection |
4138 |
|
|
4139 |
\outer\def\appendixsection{\parsearg\appendixsecyyy} |
\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz |
4140 |
\outer\def\appendixsec{\parsearg\appendixsecyyy} |
\def\unnumberedseczzz#1{% |
4141 |
\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz |
\global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 |
4142 |
\def\appendixsectionzzz #1{% |
\sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% |
|
\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % |
|
|
\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% |
|
|
\toks0 = {#1}% |
|
|
\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% |
|
|
{\appendixletter}{\the\secno}}}% |
|
|
\temp |
|
|
\appendixnoderef |
|
|
\nobreak |
|
|
} |
|
|
|
|
|
\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} |
|
|
\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz |
|
|
\def\unnumberedseczzz #1{% |
|
|
\plainsecheading {#1}\gdef\thissection{#1}% |
|
|
\toks0 = {#1}% |
|
|
\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}% |
|
|
\temp |
|
|
\unnumbnoderef |
|
|
\nobreak |
|
4143 |
} |
} |
4144 |
|
|
4145 |
% Subsections. |
% Subsections. |
4146 |
\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} |
\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz |
4147 |
\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz |
\def\numberedsubseczzz#1{% |
4148 |
\def\numberedsubseczzz #1{% |
\global\subsubsecno=0 \global\advance\subsecno by 1 |
4149 |
\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % |
\sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% |
4150 |
\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% |
} |
4151 |
\toks0 = {#1}% |
|
4152 |
\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% |
\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz |
4153 |
{\the\chapno}{\the\secno}{\the\subsecno}}}% |
\def\appendixsubseczzz#1{% |
4154 |
\temp |
\global\subsubsecno=0 \global\advance\subsecno by 1 |
4155 |
\donoderef |
\sectionheading{#1}{subsec}{Yappendix}% |
4156 |
\nobreak |
{\appendixletter.\the\secno.\the\subsecno}% |
4157 |
} |
} |
4158 |
|
|
4159 |
\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} |
\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz |
4160 |
\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz |
\def\unnumberedsubseczzz#1{% |
4161 |
\def\appendixsubseczzz #1{% |
\global\subsubsecno=0 \global\advance\subsecno by 1 |
4162 |
\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % |
\sectionheading{#1}{subsec}{Ynothing}% |
4163 |
\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% |
{\the\unnumberedno.\the\secno.\the\subsecno}% |
|
\toks0 = {#1}% |
|
|
\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% |
|
|
{\appendixletter}{\the\secno}{\the\subsecno}}}% |
|
|
\temp |
|
|
\appendixnoderef |
|
|
\nobreak |
|
|
} |
|
|
|
|
|
\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} |
|
|
\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz |
|
|
\def\unnumberedsubseczzz #1{% |
|
|
\plainsubsecheading {#1}\gdef\thissection{#1}% |
|
|
\toks0 = {#1}% |
|
|
\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry% |
|
|
{\the\toks0}}}% |
|
|
\temp |
|
|
\unnumbnoderef |
|
|
\nobreak |
|
4164 |
} |
} |
4165 |
|
|
4166 |
% Subsubsections. |
% Subsubsections. |
4167 |
\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} |
\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz |
4168 |
\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz |
\def\numberedsubsubseczzz#1{% |
4169 |
\def\numberedsubsubseczzz #1{% |
\global\advance\subsubsecno by 1 |
4170 |
\gdef\thissection{#1}\global\advance \subsubsecno by 1 % |
\sectionheading{#1}{subsubsec}{Ynumbered}% |
4171 |
\subsubsecheading {#1} |
{\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% |
4172 |
{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% |
} |
4173 |
\toks0 = {#1}% |
|
4174 |
\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% |
\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz |
4175 |
{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% |
\def\appendixsubsubseczzz#1{% |
4176 |
\temp |
\global\advance\subsubsecno by 1 |
4177 |
\donoderef |
\sectionheading{#1}{subsubsec}{Yappendix}% |
4178 |
\nobreak |
{\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% |
4179 |
} |
} |
4180 |
|
|
4181 |
\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} |
\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz |
4182 |
\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz |
\def\unnumberedsubsubseczzz#1{% |
4183 |
\def\appendixsubsubseczzz #1{% |
\global\advance\subsubsecno by 1 |
4184 |
\gdef\thissection{#1}\global\advance \subsubsecno by 1 % |
\sectionheading{#1}{subsubsec}{Ynothing}% |
4185 |
\subsubsecheading {#1} |
{\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% |
4186 |
{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% |
} |
|
\toks0 = {#1}% |
|
|
\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% |
|
|
{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% |
|
|
\temp |
|
|
\appendixnoderef |
|
|
\nobreak |
|
|
} |
|
|
|
|
|
\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} |
|
|
\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz |
|
|
\def\unnumberedsubsubseczzz #1{% |
|
|
\plainsubsubsecheading {#1}\gdef\thissection{#1}% |
|
|
\toks0 = {#1}% |
|
|
\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry% |
|
|
{\the\toks0}}}% |
|
|
\temp |
|
|
\unnumbnoderef |
|
|
\nobreak |
|
|
} |
|
|
|
|
|
% These are variants which are not "outer", so they can appear in @ifinfo. |
|
|
% Actually, they should now be obsolete; ordinary section commands should work. |
|
|
\def\infotop{\parsearg\unnumberedzzz} |
|
|
\def\infounnumbered{\parsearg\unnumberedzzz} |
|
|
\def\infounnumberedsec{\parsearg\unnumberedseczzz} |
|
|
\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} |
|
|
\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} |
|
|
|
|
|
\def\infoappendix{\parsearg\appendixzzz} |
|
|
\def\infoappendixsec{\parsearg\appendixseczzz} |
|
|
\def\infoappendixsubsec{\parsearg\appendixsubseczzz} |
|
|
\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} |
|
|
|
|
|
\def\infochapter{\parsearg\chapterzzz} |
|
|
\def\infosection{\parsearg\sectionzzz} |
|
|
\def\infosubsection{\parsearg\subsectionzzz} |
|
|
\def\infosubsubsection{\parsearg\subsubsectionzzz} |
|
4187 |
|
|
4188 |
% These macros control what the section commands do, according |
% These macros control what the section commands do, according |
4189 |
% to what kind of chapter we are in (ordinary, appendix, or unnumbered). |
% to what kind of chapter we are in (ordinary, appendix, or unnumbered). |
4190 |
% Define them by default for a numbered chapter. |
% Define them by default for a numbered chapter. |
4191 |
\global\let\section = \numberedsec |
\let\section = \numberedsec |
4192 |
\global\let\subsection = \numberedsubsec |
\let\subsection = \numberedsubsec |
4193 |
\global\let\subsubsection = \numberedsubsubsec |
\let\subsubsection = \numberedsubsubsec |
4194 |
|
|
4195 |
% Define @majorheading, @heading and @subheading |
% Define @majorheading, @heading and @subheading |
4196 |
|
|
4203 |
% if justification is not attempted. Hence \raggedright. |
% if justification is not attempted. Hence \raggedright. |
4204 |
|
|
4205 |
|
|
4206 |
\def\majorheading{\parsearg\majorheadingzzz} |
\def\majorheading{% |
4207 |
\def\majorheadingzzz #1{% |
{\advance\chapheadingskip by 10pt \chapbreak }% |
4208 |
{\advance\chapheadingskip by 10pt \chapbreak }% |
\parsearg\chapheadingzzz |
4209 |
{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 |
} |
4210 |
\parindent=0pt\raggedright |
|
4211 |
\rm #1\hfill}}\bigskip \par\penalty 200} |
\def\chapheading{\chapbreak \parsearg\chapheadingzzz} |
4212 |
|
\def\chapheadingzzz#1{% |
4213 |
\def\chapheading{\parsearg\chapheadingzzz} |
{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 |
4214 |
\def\chapheadingzzz #1{\chapbreak % |
\parindent=0pt\raggedright |
4215 |
{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 |
\rm #1\hfill}}% |
4216 |
\parindent=0pt\raggedright |
\bigskip \par\penalty 200\relax |
4217 |
\rm #1\hfill}}\bigskip \par\penalty 200} |
\suppressfirstparagraphindent |
4218 |
|
} |
4219 |
|
|
4220 |
% @heading, @subheading, @subsubheading. |
% @heading, @subheading, @subsubheading. |
4221 |
\def\heading{\parsearg\plainsecheading} |
\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} |
4222 |
\def\subheading{\parsearg\plainsubsecheading} |
\suppressfirstparagraphindent} |
4223 |
\def\subsubheading{\parsearg\plainsubsubsecheading} |
\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} |
4224 |
|
\suppressfirstparagraphindent} |
4225 |
|
\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} |
4226 |
|
\suppressfirstparagraphindent} |
4227 |
|
|
4228 |
% These macros generate a chapter, section, etc. heading only |
% These macros generate a chapter, section, etc. heading only |
4229 |
% (including whitespace, linebreaking, etc. around it), |
% (including whitespace, linebreaking, etc. around it), |
4232 |
%%% Args are the skip and penalty (usually negative) |
%%% Args are the skip and penalty (usually negative) |
4233 |
\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} |
\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} |
4234 |
|
|
|
\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} |
|
|
|
|
4235 |
%%% Define plain chapter starts, and page on/off switching for it |
%%% Define plain chapter starts, and page on/off switching for it |
4236 |
% Parameter controlling skip before chapter headings (if needed) |
% Parameter controlling skip before chapter headings (if needed) |
4237 |
|
|
4254 |
\global\let\pagealignmacro=\chappager |
\global\let\pagealignmacro=\chappager |
4255 |
\global\def\HEADINGSon{\HEADINGSsingle}} |
\global\def\HEADINGSon{\HEADINGSsingle}} |
4256 |
|
|
4257 |
\def\CHAPPAGodd{ |
\def\CHAPPAGodd{% |
4258 |
\global\let\contentsalignmacro = \chapoddpage |
\global\let\contentsalignmacro = \chapoddpage |
4259 |
\global\let\pchapsepmacro=\chapoddpage |
\global\let\pchapsepmacro=\chapoddpage |
4260 |
\global\let\pagealignmacro=\chapoddpage |
\global\let\pagealignmacro=\chapoddpage |
4262 |
|
|
4263 |
\CHAPPAGon |
\CHAPPAGon |
4264 |
|
|
4265 |
\def\CHAPFplain{ |
% Chapter opening. |
4266 |
\global\let\chapmacro=\chfplain |
% |
4267 |
\global\let\unnumbchapmacro=\unnchfplain |
% #1 is the text, #2 is the section type (Ynumbered, Ynothing, |
4268 |
\global\let\centerchapmacro=\centerchfplain} |
% Yappendix, Yomitfromtoc), #3 the chapter number. |
4269 |
|
% |
4270 |
% Plain chapter opening. |
% To test against our argument. |
4271 |
% #1 is the text, #2 the chapter number or empty if unnumbered. |
\def\Ynothingkeyword{Ynothing} |
4272 |
\def\chfplain#1#2{% |
\def\Yomitfromtockeyword{Yomitfromtoc} |
4273 |
|
\def\Yappendixkeyword{Yappendix} |
4274 |
|
% |
4275 |
|
\def\chapmacro#1#2#3{% |
4276 |
\pchapsepmacro |
\pchapsepmacro |
4277 |
{% |
{% |
4278 |
\chapfonts \rm |
\chapfonts \rm |
4279 |
\def\chapnum{#2}% |
% |
4280 |
\setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% |
% Have to define \thissection before calling \donoderef, because the |
4281 |
|
% xref code eventually uses it. On the other hand, it has to be called |
4282 |
|
% after \pchapsepmacro, or the headline will change too soon. |
4283 |
|
\gdef\thissection{#1}% |
4284 |
|
\gdef\thischaptername{#1}% |
4285 |
|
% |
4286 |
|
% Only insert the separating space if we have a chapter/appendix |
4287 |
|
% number, and don't print the unnumbered ``number''. |
4288 |
|
\def\temptype{#2}% |
4289 |
|
\ifx\temptype\Ynothingkeyword |
4290 |
|
\setbox0 = \hbox{}% |
4291 |
|
\def\toctype{unnchap}% |
4292 |
|
\def\thischapter{#1}% |
4293 |
|
\else\ifx\temptype\Yomitfromtockeyword |
4294 |
|
\setbox0 = \hbox{}% contents like unnumbered, but no toc entry |
4295 |
|
\def\toctype{omit}% |
4296 |
|
\xdef\thischapter{}% |
4297 |
|
\else\ifx\temptype\Yappendixkeyword |
4298 |
|
\setbox0 = \hbox{\putwordAppendix{} #3\enspace}% |
4299 |
|
\def\toctype{app}% |
4300 |
|
% We don't substitute the actual chapter name into \thischapter |
4301 |
|
% because we don't want its macros evaluated now. And we don't |
4302 |
|
% use \thissection because that changes with each section. |
4303 |
|
% |
4304 |
|
\xdef\thischapter{\putwordAppendix{} \appendixletter: |
4305 |
|
\noexpand\thischaptername}% |
4306 |
|
\else |
4307 |
|
\setbox0 = \hbox{#3\enspace}% |
4308 |
|
\def\toctype{numchap}% |
4309 |
|
\xdef\thischapter{\putwordChapter{} \the\chapno: |
4310 |
|
\noexpand\thischaptername}% |
4311 |
|
\fi\fi\fi |
4312 |
|
% |
4313 |
|
% Write the toc entry for this chapter. Must come before the |
4314 |
|
% \donoderef, because we include the current node name in the toc |
4315 |
|
% entry, and \donoderef resets it to empty. |
4316 |
|
\writetocentry{\toctype}{#1}{#3}% |
4317 |
|
% |
4318 |
|
% For pdftex, we have to write out the node definition (aka, make |
4319 |
|
% the pdfdest) after any page break, but before the actual text has |
4320 |
|
% been typeset. If the destination for the pdf outline is after the |
4321 |
|
% text, then jumping from the outline may wind up with the text not |
4322 |
|
% being visible, for instance under high magnification. |
4323 |
|
\donoderef{#2}% |
4324 |
|
% |
4325 |
|
% Typeset the actual heading. |
4326 |
\vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright |
\vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright |
4327 |
\hangindent = \wd0 \centerparametersmaybe |
\hangindent=\wd0 \centerparametersmaybe |
4328 |
\unhbox0 #1\par}% |
\unhbox0 #1\par}% |
4329 |
}% |
}% |
4330 |
\nobreak\bigskip % no page break after a chapter title |
\nobreak\bigskip % no page break after a chapter title |
4331 |
\nobreak |
\nobreak |
4332 |
} |
} |
4333 |
|
|
|
% Plain opening for unnumbered. |
|
|
\def\unnchfplain#1{\chfplain{#1}{}} |
|
|
|
|
4334 |
% @centerchap -- centered and unnumbered. |
% @centerchap -- centered and unnumbered. |
4335 |
\let\centerparametersmaybe = \relax |
\let\centerparametersmaybe = \relax |
4336 |
\def\centerchfplain#1{{% |
\def\centerparameters{% |
4337 |
\def\centerparametersmaybe{% |
\advance\rightskip by 3\rightskip |
4338 |
\advance\rightskip by 3\rightskip |
\leftskip = \rightskip |
4339 |
\leftskip = \rightskip |
\parfillskip = 0pt |
4340 |
\parfillskip = 0pt |
} |
|
}% |
|
|
\chfplain{#1}{}% |
|
|
}} |
|
4341 |
|
|
|
\CHAPFplain % The default |
|
4342 |
|
|
4343 |
|
% I don't think this chapter style is supported any more, so I'm not |
4344 |
|
% updating it with the new noderef stuff. We'll see. --karl, 11aug03. |
4345 |
|
% |
4346 |
|
\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} |
4347 |
|
% |
4348 |
\def\unnchfopen #1{% |
\def\unnchfopen #1{% |
4349 |
\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 |
\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 |
4350 |
\parindent=0pt\raggedright |
\parindent=0pt\raggedright |
4351 |
\rm #1\hfill}}\bigskip \par\nobreak |
\rm #1\hfill}}\bigskip \par\nobreak |
4352 |
} |
} |
|
|
|
4353 |
\def\chfopen #1#2{\chapoddpage {\chapfonts |
\def\chfopen #1#2{\chapoddpage {\chapfonts |
4354 |
\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% |
\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% |
4355 |
\par\penalty 5000 % |
\par\penalty 5000 % |
4356 |
} |
} |
|
|
|
4357 |
\def\centerchfopen #1{% |
\def\centerchfopen #1{% |
4358 |
\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 |
\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 |
4359 |
\parindent=0pt |
\parindent=0pt |
4360 |
\hfill {\rm #1}\hfill}}\bigskip \par\nobreak |
\hfill {\rm #1}\hfill}}\bigskip \par\nobreak |
4361 |
} |
} |
4362 |
|
\def\CHAPFopen{% |
4363 |
|
\global\let\chapmacro=\chfopen |
4364 |
|
\global\let\centerchapmacro=\centerchfopen} |
4365 |
|
|
|
\def\CHAPFopen{ |
|
|
\global\let\chapmacro=\chfopen |
|
|
\global\let\unnumbchapmacro=\unnchfopen |
|
|
\global\let\centerchapmacro=\centerchfopen} |
|
4366 |
|
|
4367 |
|
% Section titles. These macros combine the section number parts and |
4368 |
% Section titles. |
% call the generic \sectionheading to do the printing. |
4369 |
|
% |
4370 |
\newskip\secheadingskip |
\newskip\secheadingskip |
4371 |
\def\secheadingbreak{\dobreak \secheadingskip {-1000}} |
\def\secheadingbreak{\dobreak \secheadingskip{-1000}} |
|
\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} |
|
|
\def\plainsecheading#1{\sectionheading{sec}{}{#1}} |
|
4372 |
|
|
4373 |
% Subsection titles. |
% Subsection titles. |
4374 |
\newskip \subsecheadingskip |
\newskip\subsecheadingskip |
4375 |
\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} |
\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} |
|
\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} |
|
|
\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} |
|
4376 |
|
|
4377 |
% Subsubsection titles. |
% Subsubsection titles. |
4378 |
\let\subsubsecheadingskip = \subsecheadingskip |
\def\subsubsecheadingskip{\subsecheadingskip} |
4379 |
\let\subsubsecheadingbreak = \subsecheadingbreak |
\def\subsubsecheadingbreak{\subsecheadingbreak} |
|
\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} |
|
|
\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} |
|
4380 |
|
|
4381 |
|
|
4382 |
% Print any size section title. |
% Print any size, any type, section title. |
4383 |
% |
% |
4384 |
% #1 is the section type (sec/subsec/subsubsec), #2 is the section |
% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is |
4385 |
% number (maybe empty), #3 the text. |
% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the |
4386 |
\def\sectionheading#1#2#3{% |
% section number. |
4387 |
{% |
% |
4388 |
\expandafter\advance\csname #1headingskip\endcsname by \parskip |
\def\sectionheading#1#2#3#4{% |
|
\csname #1headingbreak\endcsname |
|
|
}% |
|
4389 |
{% |
{% |
4390 |
% Switch to the right set of fonts. |
% Switch to the right set of fonts. |
4391 |
\csname #1fonts\endcsname \rm |
\csname #2fonts\endcsname \rm |
4392 |
% |
% |
4393 |
% Only insert the separating space if we have a section number. |
% Insert space above the heading. |
4394 |
\def\secnum{#2}% |
\csname #2headingbreak\endcsname |
|
\setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% |
|
4395 |
% |
% |
4396 |
|
% Only insert the space after the number if we have a section number. |
4397 |
|
\def\sectionlevel{#2}% |
4398 |
|
\def\temptype{#3}% |
4399 |
|
% |
4400 |
|
\ifx\temptype\Ynothingkeyword |
4401 |
|
\setbox0 = \hbox{}% |
4402 |
|
\def\toctype{unn}% |
4403 |
|
\gdef\thissection{#1}% |
4404 |
|
\else\ifx\temptype\Yomitfromtockeyword |
4405 |
|
% for @headings -- no section number, don't include in toc, |
4406 |
|
% and don't redefine \thissection. |
4407 |
|
\setbox0 = \hbox{}% |
4408 |
|
\def\toctype{omit}% |
4409 |
|
\let\sectionlevel=\empty |
4410 |
|
\else\ifx\temptype\Yappendixkeyword |
4411 |
|
\setbox0 = \hbox{#4\enspace}% |
4412 |
|
\def\toctype{app}% |
4413 |
|
\gdef\thissection{#1}% |
4414 |
|
\else |
4415 |
|
\setbox0 = \hbox{#4\enspace}% |
4416 |
|
\def\toctype{num}% |
4417 |
|
\gdef\thissection{#1}% |
4418 |
|
\fi\fi\fi |
4419 |
|
% |
4420 |
|
% Write the toc entry (before \donoderef). See comments in \chfplain. |
4421 |
|
\writetocentry{\toctype\sectionlevel}{#1}{#4}% |
4422 |
|
% |
4423 |
|
% Write the node reference (= pdf destination for pdftex). |
4424 |
|
% Again, see comments in \chfplain. |
4425 |
|
\donoderef{#3}% |
4426 |
|
% |
4427 |
|
% Output the actual section heading. |
4428 |
\vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright |
\vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright |
4429 |
\hangindent = \wd0 % zero if no section number |
\hangindent=\wd0 % zero if no section number |
4430 |
\unhbox0 #3}% |
\unhbox0 #1}% |
4431 |
}% |
}% |
4432 |
\ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak |
% Add extra space after the heading -- half of whatever came above it. |
4433 |
|
% Don't allow stretch, though. |
4434 |
|
\kern .5 \csname #2headingskip\endcsname |
4435 |
|
% |
4436 |
|
% Do not let the kern be a potential breakpoint, as it would be if it |
4437 |
|
% was followed by glue. |
4438 |
|
\nobreak |
4439 |
|
% |
4440 |
|
% We'll almost certainly start a paragraph next, so don't let that |
4441 |
|
% glue accumulate. (Not a breakpoint because it's preceded by a |
4442 |
|
% discardable item.) |
4443 |
|
\vskip-\parskip |
4444 |
|
% |
4445 |
|
% This is purely so the last item on the list is a known \penalty > |
4446 |
|
% 10000. This is so \startdefun can avoid allowing breakpoints after |
4447 |
|
% section headings. Otherwise, it would insert a valid breakpoint between: |
4448 |
|
% |
4449 |
|
% @section sec-whatever |
4450 |
|
% @deffn def-whatever |
4451 |
|
\penalty 10001 |
4452 |
} |
} |
4453 |
|
|
4454 |
|
|
4455 |
\message{toc,} |
\message{toc,} |
4456 |
|
% Table of contents. |
4457 |
\newwrite\tocfile |
\newwrite\tocfile |
4458 |
|
|
4459 |
% Write an entry to the toc file, opening it if necessary. |
% Write an entry to the toc file, opening it if necessary. |
4460 |
% Called from @chapter, etc. We supply {\folio} at the end of the |
% Called from @chapter, etc. |
|
% argument, which will end up as the last argument to the \...entry macro. |
|
4461 |
% |
% |
4462 |
% We open the .toc file here instead of at @setfilename or any other |
% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} |
4463 |
% given time so that @contents can be put in the document anywhere. |
% We append the current node name (if any) and page number as additional |
4464 |
|
% arguments for the \{chap,sec,...}entry macros which will eventually |
4465 |
|
% read this. The node name is used in the pdf outlines as the |
4466 |
|
% destination to jump to. |
4467 |
|
% |
4468 |
|
% We open the .toc file for writing here instead of at @setfilename (or |
4469 |
|
% any other fixed time) so that @contents can be anywhere in the document. |
4470 |
|
% But if #1 is `omit', then we don't do anything. This is used for the |
4471 |
|
% table of contents chapter openings themselves. |
4472 |
% |
% |
4473 |
\newif\iftocfileopened |
\newif\iftocfileopened |
4474 |
\def\writetocentry#1{% |
\def\omitkeyword{omit}% |
4475 |
\iftocfileopened\else |
% |
4476 |
\immediate\openout\tocfile = \jobname.toc |
\def\writetocentry#1#2#3{% |
4477 |
\global\tocfileopenedtrue |
\edef\writetoctype{#1}% |
4478 |
|
\ifx\writetoctype\omitkeyword \else |
4479 |
|
\iftocfileopened\else |
4480 |
|
\immediate\openout\tocfile = \jobname.toc |
4481 |
|
\global\tocfileopenedtrue |
4482 |
|
\fi |
4483 |
|
% |
4484 |
|
\iflinks |
4485 |
|
\toks0 = {#2}% |
4486 |
|
\toks2 = \expandafter{\lastnode}% |
4487 |
|
\edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}{#3}% |
4488 |
|
{\the\toks2}{\noexpand\folio}}}% |
4489 |
|
\temp |
4490 |
|
\fi |
4491 |
\fi |
\fi |
4492 |
\iflinks \write\tocfile{#1{\folio}}\fi |
% |
4493 |
|
% Tell \shipout to create a pdf destination on each page, if we're |
4494 |
|
% writing pdf. These are used in the table of contents. We can't |
4495 |
|
% just write one on every page because the title pages are numbered |
4496 |
|
% 1 and 2 (the page numbers aren't printed), and so are the first |
4497 |
|
% two pages of the document. Thus, we'd have two destinations named |
4498 |
|
% `1', and two named `2'. |
4499 |
|
\ifpdf \global\pdfmakepagedesttrue \fi |
4500 |
} |
} |
4501 |
|
|
4502 |
\newskip\contentsrightmargin \contentsrightmargin=1in |
\newskip\contentsrightmargin \contentsrightmargin=1in |
4503 |
\newcount\savepageno |
\newcount\savepageno |
4504 |
\newcount\lastnegativepageno \lastnegativepageno = -1 |
\newcount\lastnegativepageno \lastnegativepageno = -1 |
4505 |
|
|
4506 |
% Finish up the main text and prepare to read what we've written |
% Prepare to read what we've written to \tocfile. |
|
% to \tocfile. |
|
4507 |
% |
% |
4508 |
\def\startcontents#1{% |
\def\startcontents#1{% |
4509 |
% If @setchapternewpage on, and @headings double, the contents should |
% If @setchapternewpage on, and @headings double, the contents should |
4510 |
% start on an odd page, unlike chapters. Thus, we maintain |
% start on an odd page, unlike chapters. Thus, we maintain |
4511 |
% \contentsalignmacro in parallel with \pagealignmacro. |
% \contentsalignmacro in parallel with \pagealignmacro. |
4512 |
% From: Torbjorn Granlund <tege@matematik.su.se> |
% From: Torbjorn Granlund <tege@matematik.su.se> |
4513 |
\contentsalignmacro |
\contentsalignmacro |
4514 |
\immediate\closeout\tocfile |
\immediate\closeout\tocfile |
4515 |
% |
% |
4516 |
% Don't need to put `Contents' or `Short Contents' in the headline. |
% Don't need to put `Contents' or `Short Contents' in the headline. |
4517 |
% It is abundantly clear what they are. |
% It is abundantly clear what they are. |
4518 |
\unnumbchapmacro{#1}\def\thischapter{}% |
\def\thischapter{}% |
4519 |
\savepageno = \pageno |
\chapmacro{#1}{Yomitfromtoc}{}% |
4520 |
\begingroup % Set up to handle contents files properly. |
% |
4521 |
\catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 |
\savepageno = \pageno |
4522 |
% We can't do this, because then an actual ^ in a section |
\begingroup % Set up to handle contents files properly. |
4523 |
% title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. |
\catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 |
4524 |
%\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi |
% We can't do this, because then an actual ^ in a section |
4525 |
\raggedbottom % Worry more about breakpoints than the bottom. |
% title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. |
4526 |
\advance\hsize by -\contentsrightmargin % Don't use the full line length. |
%\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi |
4527 |
% |
\raggedbottom % Worry more about breakpoints than the bottom. |
4528 |
% Roman numerals for page numbers. |
\advance\hsize by -\contentsrightmargin % Don't use the full line length. |
4529 |
\ifnum \pageno>0 \pageno = \lastnegativepageno \fi |
% |
4530 |
|
% Roman numerals for page numbers. |
4531 |
|
\ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi |
4532 |
} |
} |
4533 |
|
|
4534 |
|
|
4535 |
% Normal (long) toc. |
% Normal (long) toc. |
4536 |
\def\contents{% |
\def\contents{% |
4537 |
\startcontents{\putwordTOC}% |
\startcontents{\putwordTOC}% |
4538 |
\openin 1 \jobname.toc |
\openin 1 \jobname.toc |
4539 |
\ifeof 1 \else |
\ifeof 1 \else |
4540 |
\closein 1 |
\input \jobname.toc |
4541 |
\input \jobname.toc |
\fi |
4542 |
\fi |
\vfill \eject |
4543 |
\vfill \eject |
\contentsalignmacro % in case @setchapternewpage odd is in effect |
4544 |
\contentsalignmacro % in case @setchapternewpage odd is in effect |
\ifeof 1 \else |
4545 |
\endgroup |
\pdfmakeoutlines |
4546 |
\lastnegativepageno = \pageno |
\fi |
4547 |
\pageno = \savepageno |
\closein 1 |
4548 |
|
\endgroup |
4549 |
|
\lastnegativepageno = \pageno |
4550 |
|
\global\pageno = \savepageno |
4551 |
} |
} |
4552 |
|
|
4553 |
% And just the chapters. |
% And just the chapters. |
4554 |
\def\summarycontents{% |
\def\summarycontents{% |
4555 |
\startcontents{\putwordShortTOC}% |
\startcontents{\putwordShortTOC}% |
4556 |
% |
% |
4557 |
\let\chapentry = \shortchapentry |
\let\numchapentry = \shortchapentry |
4558 |
\let\unnumbchapentry = \shortunnumberedentry |
\let\appentry = \shortchapentry |
4559 |
% We want a true roman here for the page numbers. |
\let\unnchapentry = \shortunnchapentry |
4560 |
\secfonts |
% We want a true roman here for the page numbers. |
4561 |
\let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl |
\secfonts |
4562 |
\rm |
\let\rm=\shortcontrm \let\bf=\shortcontbf |
4563 |
\hyphenpenalty = 10000 |
\let\sl=\shortcontsl \let\tt=\shortconttt |
4564 |
\advance\baselineskip by 1pt % Open it up a little. |
\rm |
4565 |
\def\secentry ##1##2##3##4{} |
\hyphenpenalty = 10000 |
4566 |
\def\unnumbsecentry ##1##2{} |
\advance\baselineskip by 1pt % Open it up a little. |
4567 |
\def\subsecentry ##1##2##3##4##5{} |
\def\numsecentry##1##2##3##4{} |
4568 |
\def\unnumbsubsecentry ##1##2{} |
\let\appsecentry = \numsecentry |
4569 |
\def\subsubsecentry ##1##2##3##4##5##6{} |
\let\unnsecentry = \numsecentry |
4570 |
\def\unnumbsubsubsecentry ##1##2{} |
\let\numsubsecentry = \numsecentry |
4571 |
\openin 1 \jobname.toc |
\let\appsubsecentry = \numsecentry |
4572 |
\ifeof 1 \else |
\let\unnsubsecentry = \numsecentry |
4573 |
\closein 1 |
\let\numsubsubsecentry = \numsecentry |
4574 |
\input \jobname.toc |
\let\appsubsubsecentry = \numsecentry |
4575 |
\fi |
\let\unnsubsubsecentry = \numsecentry |
4576 |
\vfill \eject |
\openin 1 \jobname.toc |
4577 |
\contentsalignmacro % in case @setchapternewpage odd is in effect |
\ifeof 1 \else |
4578 |
\endgroup |
\input \jobname.toc |
4579 |
\lastnegativepageno = \pageno |
\fi |
4580 |
\pageno = \savepageno |
\closein 1 |
4581 |
|
\vfill \eject |
4582 |
|
\contentsalignmacro % in case @setchapternewpage odd is in effect |
4583 |
|
\endgroup |
4584 |
|
\lastnegativepageno = \pageno |
4585 |
|
\global\pageno = \savepageno |
4586 |
} |
} |
4587 |
\let\shortcontents = \summarycontents |
\let\shortcontents = \summarycontents |
4588 |
|
|
4589 |
|
% Typeset the label for a chapter or appendix for the short contents. |
4590 |
|
% The arg is, e.g., `A' for an appendix, or `3' for a chapter. |
4591 |
|
% |
4592 |
|
\def\shortchaplabel#1{% |
4593 |
|
% This space should be enough, since a single number is .5em, and the |
4594 |
|
% widest letter (M) is 1em, at least in the Computer Modern fonts. |
4595 |
|
% But use \hss just in case. |
4596 |
|
% (This space doesn't include the extra space that gets added after |
4597 |
|
% the label; that gets put in by \shortchapentry above.) |
4598 |
|
% |
4599 |
|
% We'd like to right-justify chapter numbers, but that looks strange |
4600 |
|
% with appendix letters. And right-justifying numbers and |
4601 |
|
% left-justifying letters looks strange when there is less than 10 |
4602 |
|
% chapters. Have to read the whole toc once to know how many chapters |
4603 |
|
% there are before deciding ... |
4604 |
|
\hbox to 1em{#1\hss}% |
4605 |
|
} |
4606 |
|
|
4607 |
% These macros generate individual entries in the table of contents. |
% These macros generate individual entries in the table of contents. |
4608 |
% The first argument is the chapter or section name. |
% The first argument is the chapter or section name. |
4609 |
% The last argument is the page number. |
% The last argument is the page number. |
4610 |
% The arguments in between are the chapter number, section number, ... |
% The arguments in between are the chapter number, section number, ... |
4611 |
|
|
4612 |
% Chapter-level things, for both the long and short contents. |
% Chapters, in the main contents. |
4613 |
\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} |
\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} |
4614 |
|
% |
4615 |
% See comments in \dochapentry re vbox and related settings |
% Chapters, in the short toc. |
4616 |
\def\shortchapentry#1#2#3{% |
% See comments in \dochapentry re vbox and related settings. |
4617 |
\tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}% |
\def\shortchapentry#1#2#3#4{% |
4618 |
|
\tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% |
4619 |
} |
} |
4620 |
|
|
4621 |
% Typeset the label for a chapter or appendix for the short contents. |
% Appendices, in the main contents. |
4622 |
% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter. |
% Need the word Appendix, and a fixed-size box. |
4623 |
% We could simplify the code here by writing out an \appendixentry |
% |
4624 |
% command in the toc file for appendices, instead of using \chapentry |
\def\appendixbox#1{% |
4625 |
% for both, but it doesn't seem worth it. |
% We use M since it's probably the widest letter. |
4626 |
\setbox0 = \hbox{\shortcontrm \putwordAppendix } |
\setbox0 = \hbox{\putwordAppendix{} M}% |
4627 |
\newdimen\shortappendixwidth \shortappendixwidth = \wd0 |
\hbox to \wd0{\putwordAppendix{} #1\hss}} |
4628 |
|
% |
4629 |
\def\shortchaplabel#1{% |
\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} |
|
% We typeset #1 in a box of constant width, regardless of the text of |
|
|
% #1, so the chapter titles will come out aligned. |
|
|
\setbox0 = \hbox{#1}% |
|
|
\dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi |
|
|
% |
|
|
% This space should be plenty, since a single number is .5em, and the |
|
|
% widest letter (M) is 1em, at least in the Computer Modern fonts. |
|
|
% (This space doesn't include the extra space that gets added after |
|
|
% the label; that gets put in by \shortchapentry above.) |
|
|
\advance\dimen0 by 1.1em |
|
|
\hbox to \dimen0{#1\hfil}% |
|
|
} |
|
4630 |
|
|
4631 |
\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} |
% Unnumbered chapters. |
4632 |
\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}} |
\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} |
4633 |
|
\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} |
4634 |
|
|
4635 |
% Sections. |
% Sections. |
4636 |
\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} |
\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} |
4637 |
\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}} |
\let\appsecentry=\numsecentry |
4638 |
|
\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} |
4639 |
|
|
4640 |
% Subsections. |
% Subsections. |
4641 |
\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} |
\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} |
4642 |
\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}} |
\let\appsubsecentry=\numsubsecentry |
4643 |
|
\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} |
4644 |
|
|
4645 |
% And subsubsections. |
% And subsubsections. |
4646 |
\def\subsubsecentry#1#2#3#4#5#6{% |
\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} |
4647 |
\dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} |
\let\appsubsubsecentry=\numsubsubsecentry |
4648 |
\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}} |
\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} |
4649 |
|
|
4650 |
% This parameter controls the indentation of the various levels. |
% This parameter controls the indentation of the various levels. |
4651 |
\newdimen\tocindent \tocindent = 3pc |
% Same as \defaultparindent. |
4652 |
|
\newdimen\tocindent \tocindent = 15pt |
4653 |
|
|
4654 |
% Now for the actual typesetting. In all these, #1 is the text and #2 is the |
% Now for the actual typesetting. In all these, #1 is the text and #2 is the |
4655 |
% page number. |
% page number. |
4660 |
\penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip |
\penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip |
4661 |
\begingroup |
\begingroup |
4662 |
\chapentryfonts |
\chapentryfonts |
4663 |
\tocentry{#1}{\dopageno{#2}}% |
\tocentry{#1}{\dopageno\bgroup#2\egroup}% |
4664 |
\endgroup |
\endgroup |
4665 |
\nobreak\vskip .25\baselineskip plus.1\baselineskip |
\nobreak\vskip .25\baselineskip plus.1\baselineskip |
4666 |
} |
} |
4667 |
|
|
4668 |
\def\dosecentry#1#2{\begingroup |
\def\dosecentry#1#2{\begingroup |
4669 |
\secentryfonts \leftskip=\tocindent |
\secentryfonts \leftskip=\tocindent |
4670 |
\tocentry{#1}{\dopageno{#2}}% |
\tocentry{#1}{\dopageno\bgroup#2\egroup}% |
4671 |
\endgroup} |
\endgroup} |
4672 |
|
|
4673 |
\def\dosubsecentry#1#2{\begingroup |
\def\dosubsecentry#1#2{\begingroup |
4674 |
\subsecentryfonts \leftskip=2\tocindent |
\subsecentryfonts \leftskip=2\tocindent |
4675 |
\tocentry{#1}{\dopageno{#2}}% |
\tocentry{#1}{\dopageno\bgroup#2\egroup}% |
4676 |
\endgroup} |
\endgroup} |
4677 |
|
|
4678 |
\def\dosubsubsecentry#1#2{\begingroup |
\def\dosubsubsecentry#1#2{\begingroup |
4679 |
\subsubsecentryfonts \leftskip=3\tocindent |
\subsubsecentryfonts \leftskip=3\tocindent |
4680 |
\tocentry{#1}{\dopageno{#2}}% |
\tocentry{#1}{\dopageno\bgroup#2\egroup}% |
4681 |
\endgroup} |
\endgroup} |
4682 |
|
|
4683 |
% Final typesetting of a toc entry; we use the same \entry macro as for |
% We use the same \entry macro as for the index entries. |
4684 |
% the index entries, but we want to suppress hyphenation here. (We |
\let\tocentry = \entry |
|
% can't do that in the \entry macro, since index entries might consist |
|
|
% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) |
|
|
\def\tocentry#1#2{\begingroup |
|
|
\vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks |
|
|
% Do not use \turnoffactive in these arguments. Since the toc is |
|
|
% typeset in cmr, so characters such as _ would come out wrong; we |
|
|
% have to do the usual translation tricks. |
|
|
\entry{#1}{#2}% |
|
|
\endgroup} |
|
4685 |
|
|
4686 |
% Space between chapter (or whatever) number and the title. |
% Space between chapter (or whatever) number and the title. |
4687 |
\def\labelspace{\hskip1em \relax} |
\def\labelspace{\hskip1em \relax} |
4691 |
|
|
4692 |
\def\chapentryfonts{\secfonts \rm} |
\def\chapentryfonts{\secfonts \rm} |
4693 |
\def\secentryfonts{\textfonts} |
\def\secentryfonts{\textfonts} |
4694 |
\let\subsecentryfonts = \textfonts |
\def\subsecentryfonts{\textfonts} |
4695 |
\let\subsubsecentryfonts = \textfonts |
\def\subsubsecentryfonts{\textfonts} |
4696 |
|
|
4697 |
|
|
4698 |
\message{environments,} |
\message{environments,} |
4699 |
|
% @foo ... @end foo. |
4700 |
|
|
4701 |
|
% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. |
4702 |
|
% |
4703 |
% Since these characters are used in examples, it should be an even number of |
% Since these characters are used in examples, it should be an even number of |
4704 |
% \tt widths. Each \tt character is 1en, so two makes it 1em. |
% \tt widths. Each \tt character is 1en, so two makes it 1em. |
4705 |
% Furthermore, these definitions must come after we define our fonts. |
% |
|
\newbox\dblarrowbox \newbox\longdblarrowbox |
|
|
\newbox\pushcharbox \newbox\bullbox |
|
|
\newbox\equivbox \newbox\errorbox |
|
|
|
|
|
%{\tentt |
|
|
%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil} |
|
|
%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil} |
|
|
%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil} |
|
|
%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil} |
|
|
% Adapted from the manmac format (p.420 of TeXbook) |
|
|
%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex |
|
|
% depth .1ex\hfil} |
|
|
%} |
|
|
|
|
|
% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. |
|
4706 |
\def\point{$\star$} |
\def\point{$\star$} |
4707 |
\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} |
\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} |
4708 |
\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} |
\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} |
4709 |
\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} |
\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} |
4710 |
\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} |
\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} |
4711 |
|
|
4712 |
|
% The @error{} command. |
4713 |
% Adapted from the TeXbook's \boxit. |
% Adapted from the TeXbook's \boxit. |
4714 |
|
% |
4715 |
|
\newbox\errorbox |
4716 |
|
% |
4717 |
{\tentt \global\dimen0 = 3em}% Width of the box. |
{\tentt \global\dimen0 = 3em}% Width of the box. |
4718 |
\dimen2 = .55pt % Thickness of rules |
\dimen2 = .55pt % Thickness of rules |
4719 |
% The text. (`r' is open on the right, `e' somewhat less so on the left.) |
% The text. (`r' is open on the right, `e' somewhat less so on the left.) |
4720 |
\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} |
\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} |
4721 |
|
% |
4722 |
\global\setbox\errorbox=\hbox to \dimen0{\hfil |
\setbox\errorbox=\hbox to \dimen0{\hfil |
4723 |
\hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. |
\hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. |
4724 |
\advance\hsize by -2\dimen2 % Rules. |
\advance\hsize by -2\dimen2 % Rules. |
4725 |
\vbox{ |
\vbox{% |
4726 |
\hrule height\dimen2 |
\hrule height\dimen2 |
4727 |
\hbox{\vrule width\dimen2 \kern3pt % Space to left of text. |
\hbox{\vrule width\dimen2 \kern3pt % Space to left of text. |
4728 |
\vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. |
\vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. |
4729 |
\kern3pt\vrule width\dimen2}% Space to right. |
\kern3pt\vrule width\dimen2}% Space to right. |
4730 |
\hrule height\dimen2} |
\hrule height\dimen2} |
4731 |
\hfil} |
\hfil} |
4732 |
|
% |
|
% The @error{} command. |
|
4733 |
\def\error{\leavevmode\lower.7ex\copy\errorbox} |
\def\error{\leavevmode\lower.7ex\copy\errorbox} |
4734 |
|
|
4735 |
% @tex ... @end tex escapes into raw Tex temporarily. |
% @tex ... @end tex escapes into raw Tex temporarily. |
4736 |
% One exception: @ is still an escape character, so that @end tex works. |
% One exception: @ is still an escape character, so that @end tex works. |
4737 |
% But \@ or @@ will get a plain tex @ character. |
% But \@ or @@ will get a plain tex @ character. |
4738 |
|
|
4739 |
\def\tex{\begingroup |
\envdef\tex{% |
4740 |
\catcode `\\=0 \catcode `\{=1 \catcode `\}=2 |
\catcode `\\=0 \catcode `\{=1 \catcode `\}=2 |
4741 |
\catcode `\$=3 \catcode `\&=4 \catcode `\#=6 |
\catcode `\$=3 \catcode `\&=4 \catcode `\#=6 |
4742 |
\catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie |
\catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie |
4743 |
\catcode `\%=14 |
\catcode `\%=14 |
4744 |
\catcode 43=12 % plus |
\catcode `\+=\other |
4745 |
\catcode`\"=12 |
\catcode `\"=\other |
4746 |
\catcode`\==12 |
\catcode `\|=\other |
4747 |
\catcode`\|=12 |
\catcode `\<=\other |
4748 |
\catcode`\<=12 |
\catcode `\>=\other |
|
\catcode`\>=12 |
|
4749 |
\escapechar=`\\ |
\escapechar=`\\ |
4750 |
% |
% |
4751 |
\let\b=\ptexb |
\let\b=\ptexb |
4757 |
\let\equiv=\ptexequiv |
\let\equiv=\ptexequiv |
4758 |
\let\!=\ptexexclam |
\let\!=\ptexexclam |
4759 |
\let\i=\ptexi |
\let\i=\ptexi |
4760 |
|
\let\indent=\ptexindent |
4761 |
|
\let\noindent=\ptexnoindent |
4762 |
\let\{=\ptexlbrace |
\let\{=\ptexlbrace |
4763 |
\let\+=\tabalign |
\let\+=\tabalign |
4764 |
\let\}=\ptexrbrace |
\let\}=\ptexrbrace |
4765 |
|
\let\/=\ptexslash |
4766 |
\let\*=\ptexstar |
\let\*=\ptexstar |
4767 |
\let\t=\ptext |
\let\t=\ptext |
4768 |
% |
% |
4769 |
\def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% |
\def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% |
4770 |
\def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% |
\def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% |
4771 |
\def\@{@}% |
\def\@{@}% |
4772 |
\let\Etex=\endgroup} |
} |
4773 |
|
% There is no need to define \Etex. |
4774 |
|
|
4775 |
% Define @lisp ... @endlisp. |
% Define @lisp ... @end lisp. |
4776 |
% @lisp does a \begingroup so it can rebind things, |
% @lisp environment forms a group so it can rebind things, |
4777 |
% including the definition of @endlisp (which normally is erroneous). |
% including the definition of @end lisp (which normally is erroneous). |
4778 |
|
|
4779 |
% Amount to narrow the margins by for @lisp. |
% Amount to narrow the margins by for @lisp. |
4780 |
\newskip\lispnarrowing \lispnarrowing=0.4in |
\newskip\lispnarrowing \lispnarrowing=0.4in |
4784 |
% have any width. |
% have any width. |
4785 |
\def\lisppar{\null\endgraf} |
\def\lisppar{\null\endgraf} |
4786 |
|
|
|
% Make each space character in the input produce a normal interword |
|
|
% space in the output. Don't allow a line break at this space, as this |
|
|
% is used only in environments like @example, where each line of input |
|
|
% should produce a line of output anyway. |
|
|
% |
|
|
{\obeyspaces % |
|
|
\gdef\sepspaces{\obeyspaces\let =\tie}} |
|
|
|
|
|
% Define \obeyedspace to be our active space, whatever it is. This is |
|
|
% for use in \parsearg. |
|
|
{\sepspaces% |
|
|
\global\let\obeyedspace= } |
|
|
|
|
4787 |
% This space is always present above and below environments. |
% This space is always present above and below environments. |
4788 |
\newskip\envskipamount \envskipamount = 0pt |
\newskip\envskipamount \envskipamount = 0pt |
4789 |
|
|
4790 |
% Make spacing and below environment symmetrical. We use \parskip here |
% Make spacing and below environment symmetrical. We use \parskip here |
4791 |
% to help in doing that, since in @example-like environments \parskip |
% to help in doing that, since in @example-like environments \parskip |
4792 |
% is reset to zero; thus the \afterenvbreak inserts no space -- but the |
% is reset to zero; thus the \afterenvbreak inserts no space -- but the |
4793 |
% start of the next paragraph will insert \parskip |
% start of the next paragraph will insert \parskip. |
4794 |
% |
% |
4795 |
\def\aboveenvbreak{{\advance\envskipamount by \parskip |
\def\aboveenvbreak{{% |
4796 |
\endgraf \ifdim\lastskip<\envskipamount |
% =10000 instead of <10000 because of a special case in \itemzzz and |
4797 |
\removelastskip \penalty-50 \vskip\envskipamount \fi}} |
% \sectionheading, q.v. |
4798 |
|
\ifnum \lastpenalty=10000 \else |
4799 |
|
\advance\envskipamount by \parskip |
4800 |
|
\endgraf |
4801 |
|
\ifdim\lastskip<\envskipamount |
4802 |
|
\removelastskip |
4803 |
|
% it's not a good place to break if the last penalty was \nobreak |
4804 |
|
% or better ... |
4805 |
|
\ifnum\lastpenalty<10000 \penalty-50 \fi |
4806 |
|
\vskip\envskipamount |
4807 |
|
\fi |
4808 |
|
\fi |
4809 |
|
}} |
4810 |
|
|
4811 |
\let\afterenvbreak = \aboveenvbreak |
\let\afterenvbreak = \aboveenvbreak |
4812 |
|
|
4834 |
% |
% |
4835 |
\newskip\lskip\newskip\rskip |
\newskip\lskip\newskip\rskip |
4836 |
|
|
4837 |
\long\def\cartouche{% |
\envdef\cartouche{% |
4838 |
\begingroup |
\ifhmode\par\fi % can't be in the midst of a paragraph. |
4839 |
\lskip=\leftskip \rskip=\rightskip |
\startsavinginserts |
4840 |
\leftskip=0pt\rightskip=0pt %we want these *outside*. |
\lskip=\leftskip \rskip=\rightskip |
4841 |
\cartinner=\hsize \advance\cartinner by-\lskip |
\leftskip=0pt\rightskip=0pt % we want these *outside*. |
4842 |
\advance\cartinner by-\rskip |
\cartinner=\hsize \advance\cartinner by-\lskip |
4843 |
\cartouter=\hsize |
\advance\cartinner by-\rskip |
4844 |
\advance\cartouter by 18.4pt % allow for 3pt kerns on either |
\cartouter=\hsize |
4845 |
% side, and for 6pt waste from |
\advance\cartouter by 18.4pt % allow for 3pt kerns on either |
4846 |
% each corner char, and rule thickness |
% side, and for 6pt waste from |
4847 |
\normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip |
% each corner char, and rule thickness |
4848 |
% Flag to tell @lisp, etc., not to narrow margin. |
\normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip |
4849 |
\let\nonarrowing=\comment |
% Flag to tell @lisp, etc., not to narrow margin. |
4850 |
\vbox\bgroup |
\let\nonarrowing=\comment |
4851 |
\baselineskip=0pt\parskip=0pt\lineskip=0pt |
\vbox\bgroup |
4852 |
\carttop |
\baselineskip=0pt\parskip=0pt\lineskip=0pt |
4853 |
\hbox\bgroup |
\carttop |
4854 |
\hskip\lskip |
\hbox\bgroup |
4855 |
\vrule\kern3pt |
\hskip\lskip |
4856 |
\vbox\bgroup |
\vrule\kern3pt |
4857 |
\hsize=\cartinner |
\vbox\bgroup |
4858 |
\kern3pt |
\kern3pt |
4859 |
\begingroup |
\hsize=\cartinner |
4860 |
\baselineskip=\normbskip |
\baselineskip=\normbskip |
4861 |
\lineskip=\normlskip |
\lineskip=\normlskip |
4862 |
\parskip=\normpskip |
\parskip=\normpskip |
4863 |
\vskip -\parskip |
\vskip -\parskip |
4864 |
|
\comment % For explanation, see the end of \def\group. |
4865 |
|
} |
4866 |
\def\Ecartouche{% |
\def\Ecartouche{% |
4867 |
\endgroup |
\ifhmode\par\fi |
4868 |
\kern3pt |
\kern3pt |
4869 |
\egroup |
\egroup |
4870 |
\kern3pt\vrule |
\kern3pt\vrule |
4871 |
\hskip\rskip |
\hskip\rskip |
4872 |
\egroup |
\egroup |
4873 |
\cartbot |
\cartbot |
4874 |
\egroup |
\egroup |
4875 |
\endgroup |
\checkinserts |
4876 |
}} |
} |
4877 |
|
|
4878 |
|
|
4879 |
% This macro is called at the beginning of all the @example variants, |
% This macro is called at the beginning of all the @example variants, |
4880 |
% inside a group. |
% inside a group. |
4881 |
\def\nonfillstart{% |
\def\nonfillstart{% |
4882 |
\aboveenvbreak |
\aboveenvbreak |
|
\inENV % This group ends at the end of the body |
|
4883 |
\hfuzz = 12pt % Don't be fussy |
\hfuzz = 12pt % Don't be fussy |
4884 |
\sepspaces % Make spaces be word-separators rather than space tokens. |
\sepspaces % Make spaces be word-separators rather than space tokens. |
|
\singlespace |
|
4885 |
\let\par = \lisppar % don't ignore blank lines |
\let\par = \lisppar % don't ignore blank lines |
4886 |
\obeylines % each line of input is a line of output |
\obeylines % each line of input is a line of output |
4887 |
\parskip = 0pt |
\parskip = 0pt |
4892 |
\ifx\nonarrowing\relax |
\ifx\nonarrowing\relax |
4893 |
\advance \leftskip by \lispnarrowing |
\advance \leftskip by \lispnarrowing |
4894 |
\exdentamount=\lispnarrowing |
\exdentamount=\lispnarrowing |
|
\let\exdent=\nofillexdent |
|
|
\let\nonarrowing=\relax |
|
4895 |
\fi |
\fi |
4896 |
|
\let\exdent=\nofillexdent |
4897 |
|
} |
4898 |
|
|
4899 |
|
% If you want all examples etc. small: @set dispenvsize small. |
4900 |
|
% If you want even small examples the full size: @set dispenvsize nosmall. |
4901 |
|
% This affects the following displayed environments: |
4902 |
|
% @example, @display, @format, @lisp |
4903 |
|
% |
4904 |
|
\def\smallword{small} |
4905 |
|
\def\nosmallword{nosmall} |
4906 |
|
\let\SETdispenvsize\relax |
4907 |
|
\def\setnormaldispenv{% |
4908 |
|
\ifx\SETdispenvsize\smallword |
4909 |
|
\smallexamplefonts \rm |
4910 |
|
\fi |
4911 |
|
} |
4912 |
|
\def\setsmalldispenv{% |
4913 |
|
\ifx\SETdispenvsize\nosmallword |
4914 |
|
\else |
4915 |
|
\smallexamplefonts \rm |
4916 |
|
\fi |
4917 |
|
} |
4918 |
|
|
4919 |
|
% We often define two environments, @foo and @smallfoo. |
4920 |
|
% Let's do it by one command: |
4921 |
|
\def\makedispenv #1#2{ |
4922 |
|
\expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} |
4923 |
|
\expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} |
4924 |
|
\expandafter\let\csname E#1\endcsname \afterenvbreak |
4925 |
|
\expandafter\let\csname Esmall#1\endcsname \afterenvbreak |
4926 |
|
} |
4927 |
|
|
4928 |
|
% Define two synonyms: |
4929 |
|
\def\maketwodispenvs #1#2#3{ |
4930 |
|
\makedispenv{#1}{#3} |
4931 |
|
\makedispenv{#2}{#3} |
4932 |
} |
} |
4933 |
|
|
4934 |
% Define the \E... control sequence only if we are inside the particular |
% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. |
|
% environment, so the error checking in \end will work. |
|
4935 |
% |
% |
4936 |
% To end an @example-like environment, we first end the paragraph (via |
% @smallexample and @smalllisp: use smaller fonts. |
4937 |
% \afterenvbreak's vertical glue), and then the group. That way we keep |
% Originally contributed by Pavel@xerox. |
|
% the zero \parskip that the environments set -- \parskip glue will be |
|
|
% inserted at the beginning of the next paragraph in the document, after |
|
|
% the environment. |
|
4938 |
% |
% |
4939 |
\def\nonfillfinish{\afterenvbreak\endgroup} |
\maketwodispenvs {lisp}{example}{% |
|
|
|
|
% @lisp: indented, narrowed, typewriter font. |
|
|
\def\lisp{\begingroup |
|
4940 |
\nonfillstart |
\nonfillstart |
|
\let\Elisp = \nonfillfinish |
|
4941 |
\tt |
\tt |
4942 |
\let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. |
\let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. |
4943 |
\gobble % eat return |
\gobble % eat return |
4944 |
} |
} |
4945 |
|
|
4946 |
% @example: Same as @lisp. |
% @display/@smalldisplay: same as @lisp except keep current font. |
|
\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} |
|
|
|
|
|
% @small... is usually equivalent to the non-small (@smallbook |
|
|
% redefines). We must call \example (or whatever) last in the |
|
|
% definition, since it reads the return following the @example (or |
|
|
% whatever) command. |
|
|
% |
|
|
% This actually allows (for example) @end display inside an |
|
|
% @smalldisplay. Too bad, but makeinfo will catch the error anyway. |
|
|
% |
|
|
\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display} |
|
|
\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp} |
|
|
\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format} |
|
|
\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp} |
|
|
|
|
|
% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts. |
|
|
% Originally contributed by Pavel@xerox. |
|
|
\def\smalllispx{\begingroup |
|
|
\def\Esmalllisp{\nonfillfinish\endgroup}% |
|
|
\def\Esmallexample{\nonfillfinish\endgroup}% |
|
|
\indexfonts |
|
|
\lisp |
|
|
} |
|
|
|
|
|
% @display: same as @lisp except keep current font. |
|
4947 |
% |
% |
4948 |
\def\display{\begingroup |
\makedispenv {display}{% |
4949 |
\nonfillstart |
\nonfillstart |
|
\let\Edisplay = \nonfillfinish |
|
4950 |
\gobble |
\gobble |
4951 |
} |
} |
4952 |
|
|
4953 |
% @smalldisplay (when @smallbook): @display plus smaller fonts. |
% @format/@smallformat: same as @display except don't narrow margins. |
4954 |
% |
% |
4955 |
\def\smalldisplayx{\begingroup |
\makedispenv{format}{% |
4956 |
\def\Esmalldisplay{\nonfillfinish\endgroup}% |
\let\nonarrowing = t% |
|
\indexfonts \rm |
|
|
\display |
|
|
} |
|
|
|
|
|
% @format: same as @display except don't narrow margins. |
|
|
% |
|
|
\def\format{\begingroup |
|
|
\let\nonarrowing = t |
|
4957 |
\nonfillstart |
\nonfillstart |
|
\let\Eformat = \nonfillfinish |
|
4958 |
\gobble |
\gobble |
4959 |
} |
} |
4960 |
|
|
4961 |
% @smallformat (when @smallbook): @format plus smaller fonts. |
% @flushleft: same as @format, but doesn't obey \SETdispenvsize. |
4962 |
% |
\envdef\flushleft{% |
4963 |
\def\smallformatx{\begingroup |
\let\nonarrowing = t% |
4964 |
\def\Esmallformat{\nonfillfinish\endgroup}% |
\nonfillstart |
4965 |
\indexfonts \rm |
\gobble |
|
\format |
|
4966 |
} |
} |
4967 |
|
\let\Eflushleft = \afterenvbreak |
|
% @flushleft (same as @format). |
|
|
% |
|
|
\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format} |
|
4968 |
|
|
4969 |
% @flushright. |
% @flushright. |
4970 |
% |
% |
4971 |
\def\flushright{\begingroup |
\envdef\flushright{% |
4972 |
\let\nonarrowing = t |
\let\nonarrowing = t% |
4973 |
\nonfillstart |
\nonfillstart |
|
\let\Eflushright = \nonfillfinish |
|
4974 |
\advance\leftskip by 0pt plus 1fill |
\advance\leftskip by 0pt plus 1fill |
4975 |
\gobble |
\gobble |
4976 |
} |
} |
4977 |
|
\let\Eflushright = \afterenvbreak |
4978 |
|
|
4979 |
|
|
4980 |
% @quotation does normal linebreaking (hence we can't use \nonfillstart) |
% @quotation does normal linebreaking (hence we can't use \nonfillstart) |
4981 |
% and narrows the margins. |
% and narrows the margins. We keep \parskip nonzero in general, since |
4982 |
|
% we're doing normal filling. So, when using \aboveenvbreak and |
4983 |
|
% \afterenvbreak, temporarily make \parskip 0. |
4984 |
% |
% |
4985 |
\def\quotation{% |
\envdef\quotation{% |
|
\begingroup\inENV %This group ends at the end of the @quotation body |
|
4986 |
{\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip |
{\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip |
|
\singlespace |
|
4987 |
\parindent=0pt |
\parindent=0pt |
|
% We have retained a nonzero parskip for the environment, since we're |
|
|
% doing normal filling. So to avoid extra space below the environment... |
|
|
\def\Equotation{\parskip = 0pt \nonfillfinish}% |
|
4988 |
% |
% |
4989 |
% @cartouche defines \nonarrowing to inhibit narrowing at next level down. |
% @cartouche defines \nonarrowing to inhibit narrowing at next level down. |
4990 |
\ifx\nonarrowing\relax |
\ifx\nonarrowing\relax |
4993 |
\exdentamount = \lispnarrowing |
\exdentamount = \lispnarrowing |
4994 |
\let\nonarrowing = \relax |
\let\nonarrowing = \relax |
4995 |
\fi |
\fi |
4996 |
|
\parsearg\quotationlabel |
4997 |
} |
} |
4998 |
|
|
4999 |
|
% We have retained a nonzero parskip for the environment, since we're |
5000 |
|
% doing normal filling. |
5001 |
|
% |
5002 |
|
\def\Equotation{% |
5003 |
|
\par |
5004 |
|
\ifx\quotationauthor\undefined\else |
5005 |
|
% indent a bit. |
5006 |
|
\leftline{\kern 2\leftskip \sl ---\quotationauthor}% |
5007 |
|
\fi |
5008 |
|
{\parskip=0pt \afterenvbreak}% |
5009 |
|
} |
5010 |
|
|
5011 |
\message{defuns,} |
% If we're given an argument, typeset it in bold with a colon after. |
5012 |
% Define formatter for defuns |
\def\quotationlabel#1{% |
5013 |
% First, allow user to change definition object font (\df) internally |
\def\temp{#1}% |
5014 |
\def\setdeffont #1 {\csname DEF#1\endcsname} |
\ifx\temp\empty \else |
5015 |
|
{\bf #1: }% |
5016 |
\newskip\defbodyindent \defbodyindent=.4in |
\fi |
5017 |
\newskip\defargsindent \defargsindent=50pt |
} |
|
\newskip\deftypemargin \deftypemargin=12pt |
|
|
\newskip\deflastargmargin \deflastargmargin=18pt |
|
|
|
|
|
\newcount\parencount |
|
|
% define \functionparens, which makes ( and ) and & do special things. |
|
|
% \functionparens affects the group it is contained in. |
|
|
\def\activeparens{% |
|
|
\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active |
|
|
\catcode`\[=\active \catcode`\]=\active} |
|
|
|
|
|
% Make control sequences which act like normal parenthesis chars. |
|
|
\let\lparen = ( \let\rparen = ) |
|
|
|
|
|
{\activeparens % Now, smart parens don't turn on until &foo (see \amprm) |
|
5018 |
|
|
|
% Be sure that we always have a definition for `(', etc. For example, |
|
|
% if the fn name has parens in it, \boldbrax will not be in effect yet, |
|
|
% so TeX would otherwise complain about undefined control sequence. |
|
|
\global\let(=\lparen \global\let)=\rparen |
|
|
\global\let[=\lbrack \global\let]=\rbrack |
|
5019 |
|
|
5020 |
\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } |
% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>} |
5021 |
\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} |
% If we want to allow any <char> as delimiter, |
5022 |
% This is used to turn on special parens |
% we need the curly braces so that makeinfo sees the @verb command, eg: |
5023 |
% but make & act ordinary (given that it's active). |
% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org |
5024 |
\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} |
% |
5025 |
|
% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. |
5026 |
% Definitions of (, ) and & used in args for functions. |
% |
5027 |
% This is the definition of ( outside of all parentheses. |
% [Knuth] p.344; only we need to do the other characters Texinfo sets |
5028 |
\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested |
% active too. Otherwise, they get lost as the first character on a |
5029 |
\global\advance\parencount by 1 |
% verbatim line. |
5030 |
} |
\def\dospecials{% |
5031 |
|
\do\ \do\\\do\{\do\}\do\$\do\&% |
5032 |
|
\do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% |
5033 |
|
\do\<\do\>\do\|\do\@\do+\do\"% |
5034 |
|
} |
5035 |
|
% |
5036 |
|
% [Knuth] p. 380 |
5037 |
|
\def\uncatcodespecials{% |
5038 |
|
\def\do##1{\catcode`##1=\other}\dospecials} |
5039 |
% |
% |
5040 |
% This is the definition of ( when already inside a level of parens. |
% [Knuth] pp. 380,381,391 |
5041 |
\gdef\opnested{\char`\(\global\advance\parencount by 1 } |
% Disable Spanish ligatures ?` and !` of \tt font |
5042 |
|
\begingroup |
5043 |
|
\catcode`\`=\active\gdef`{\relax\lq} |
5044 |
|
\endgroup |
5045 |
% |
% |
5046 |
\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. |
% Setup for the @verb command. |
|
% also in that case restore the outer-level definition of (. |
|
|
\ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi |
|
|
\global\advance \parencount by -1 } |
|
|
% If we encounter &foo, then turn on ()-hacking afterwards |
|
|
\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } |
|
5047 |
% |
% |
5048 |
\gdef\normalparens{\boldbrax\let&=\ampnr} |
% Eight spaces for a tab |
5049 |
} % End of definition inside \activeparens |
\begingroup |
5050 |
%% These parens (in \boldbrax) actually are a little bolder than the |
\catcode`\^^I=\active |
5051 |
%% contained text. This is especially needed for [ and ] |
\gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} |
5052 |
\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } |
\endgroup |
5053 |
\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } |
% |
5054 |
\let\ampnr = \& |
\def\setupverb{% |
5055 |
\def\lbrb{{\bf\char`\[}} |
\tt % easiest (and conventionally used) font for verbatim |
5056 |
\def\rbrb{{\bf\char`\]}} |
\def\par{\leavevmode\endgraf}% |
5057 |
|
\catcode`\`=\active |
5058 |
% Active &'s sneak into the index arguments, so make sure it's defined. |
\tabeightspaces |
5059 |
{ |
% Respect line breaks, |
5060 |
\catcode`& = 13 |
% print special symbols as themselves, and |
5061 |
\global\let& = \ampnr |
% make each space count |
5062 |
|
% must do in this order: |
5063 |
|
\obeylines \uncatcodespecials \sepspaces |
5064 |
} |
} |
5065 |
|
|
5066 |
% First, defname, which formats the header line itself. |
% Setup for the @verbatim environment |
5067 |
% #1 should be the function name. |
% |
5068 |
% #2 should be the type of definition, such as "Function". |
% Real tab expansion |
5069 |
|
\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount |
5070 |
\def\defname #1#2{% |
% |
5071 |
% Get the values of \leftskip and \rightskip as they were |
\def\starttabbox{\setbox0=\hbox\bgroup} |
5072 |
% outside the @def... |
\begingroup |
5073 |
\dimen2=\leftskip |
\catcode`\^^I=\active |
5074 |
\advance\dimen2 by -\defbodyindent |
\gdef\tabexpand{% |
5075 |
\noindent |
\catcode`\^^I=\active |
5076 |
\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% |
\def^^I{\leavevmode\egroup |
5077 |
\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line |
\dimen0=\wd0 % the width so far, or since the previous tab |
5078 |
\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations |
\divide\dimen0 by\tabw |
5079 |
\parshape 2 0in \dimen0 \defargsindent \dimen1 |
\multiply\dimen0 by\tabw % compute previous multiple of \tabw |
5080 |
% Now output arg 2 ("Function" or some such) |
\advance\dimen0 by\tabw % advance to next multiple of \tabw |
5081 |
% ending at \deftypemargin from the right margin, |
\wd0=\dimen0 \box0 \starttabbox |
5082 |
% but stuck inside a box of width 0 so it does not interfere with linebreaking |
}% |
5083 |
{% Adjust \hsize to exclude the ambient margins, |
} |
5084 |
% so that \rightline will obey them. |
\endgroup |
5085 |
\advance \hsize by -\dimen2 |
\def\setupverbatim{% |
5086 |
\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}% |
\nonfillstart |
5087 |
% Make all lines underfull and no complaints: |
\advance\leftskip by -\defbodyindent |
5088 |
\tolerance=10000 \hbadness=10000 |
% Easiest (and conventionally used) font for verbatim |
5089 |
\advance\leftskip by -\defbodyindent |
\tt |
5090 |
\exdentamount=\defbodyindent |
\def\par{\leavevmode\egroup\box0\endgraf}% |
5091 |
{\df #1}\enskip % Generate function name |
\catcode`\`=\active |
5092 |
} |
\tabexpand |
5093 |
|
% Respect line breaks, |
5094 |
% Actually process the body of a definition |
% print special symbols as themselves, and |
5095 |
% #1 should be the terminating control sequence, such as \Edefun. |
% make each space count |
5096 |
% #2 should be the "another name" control sequence, such as \defunx. |
% must do in this order: |
5097 |
% #3 should be the control sequence that actually processes the header, |
\obeylines \uncatcodespecials \sepspaces |
5098 |
% such as \defunheader. |
\everypar{\starttabbox}% |
5099 |
|
} |
5100 |
\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody |
|
5101 |
\medbreak % |
% Do the @verb magic: verbatim text is quoted by unique |
5102 |
% Define the end token that this defining construct specifies |
% delimiter characters. Before first delimiter expect a |
5103 |
% so that it will exit this group. |
% right brace, after last delimiter expect closing brace: |
5104 |
\def#1{\endgraf\endgroup\medbreak}% |
% |
5105 |
\def#2{\begingroup\obeylines\activeparens\spacesplit#3}% |
% \def\doverb'{'<char>#1<char>'}'{#1} |
5106 |
\parindent=0in |
% |
5107 |
\advance\leftskip by \defbodyindent |
% [Knuth] p. 382; only eat outer {} |
5108 |
\exdentamount=\defbodyindent |
\begingroup |
5109 |
\begingroup % |
\catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other |
5110 |
\catcode 61=\active % 61 is `=' |
\gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] |
5111 |
\obeylines\activeparens\spacesplit#3} |
\endgroup |
5112 |
|
% |
5113 |
% #1 is the \E... control sequence to end the definition (which we define). |
\def\verb{\begingroup\setupverb\doverb} |
5114 |
% #2 is the \...x control sequence for consecutive fns (which we define). |
% |
5115 |
% #3 is the control sequence to call to resume processing. |
% |
5116 |
% #4, delimited by the space, is the class name. |
% Do the @verbatim magic: define the macro \doverbatim so that |
5117 |
% |
% the (first) argument ends when '@end verbatim' is reached, ie: |
5118 |
\def\defmethparsebody#1#2#3#4 {\begingroup\inENV % |
% |
5119 |
\medbreak % |
% \def\doverbatim#1@end verbatim{#1} |
5120 |
% Define the end token that this defining construct specifies |
% |
5121 |
% so that it will exit this group. |
% For Texinfo it's a lot easier than for LaTeX, |
5122 |
\def#1{\endgraf\endgroup\medbreak}% |
% because texinfo's \verbatim doesn't stop at '\end{verbatim}': |
5123 |
\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% |
% we need not redefine '\', '{' and '}'. |
5124 |
\parindent=0in |
% |
5125 |
\advance\leftskip by \defbodyindent |
% Inspired by LaTeX's verbatim command set [latex.ltx] |
5126 |
\exdentamount=\defbodyindent |
% |
5127 |
\begingroup\obeylines\activeparens\spacesplit{#3{#4}}} |
\begingroup |
5128 |
|
\catcode`\ =\active |
5129 |
% @deftypemethod has an extra argument that nothing else does. Sigh. |
\obeylines % |
5130 |
% #1 is the \E... control sequence to end the definition (which we define). |
% ignore everything up to the first ^^M, that's the newline at the end |
5131 |
% #2 is the \...x control sequence for consecutive fns (which we define). |
% of the @verbatim input line itself. Otherwise we get an extra blank |
5132 |
% #3 is the control sequence to call to resume processing. |
% line in the output. |
5133 |
% #4, delimited by the space, is the class name. |
\xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% |
5134 |
% #5 is the method's return type. |
% We really want {...\end verbatim} in the body of the macro, but |
5135 |
% |
% without the active space; thus we have to use \xdef and \gobble. |
5136 |
\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV % |
\endgroup |
5137 |
\medbreak % |
% |
5138 |
% Define the end token that this defining construct specifies |
\envdef\verbatim{% |
5139 |
% so that it will exit this group. |
\setupverbatim\doverbatim |
|
\def#1{\endgraf\endgroup\medbreak}% |
|
|
\def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% |
|
|
\parindent=0in |
|
|
\advance\leftskip by \defbodyindent |
|
|
\exdentamount=\defbodyindent |
|
|
\begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} |
|
|
|
|
|
\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % |
|
|
\medbreak % |
|
|
% Define the end token that this defining construct specifies |
|
|
% so that it will exit this group. |
|
|
\def#1{\endgraf\endgroup\medbreak}% |
|
|
\def#2##1 ##2 {\def#4{##1}% |
|
|
\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% |
|
|
\parindent=0in |
|
|
\advance\leftskip by \defbodyindent |
|
|
\exdentamount=\defbodyindent |
|
|
\begingroup\obeylines\activeparens\spacesplit{#3{#5}}} |
|
|
|
|
|
% These parsing functions are similar to the preceding ones |
|
|
% except that they do not make parens into active characters. |
|
|
% These are used for "variables" since they have no arguments. |
|
|
|
|
|
\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody |
|
|
\medbreak % |
|
|
% Define the end token that this defining construct specifies |
|
|
% so that it will exit this group. |
|
|
\def#1{\endgraf\endgroup\medbreak}% |
|
|
\def#2{\begingroup\obeylines\spacesplit#3}% |
|
|
\parindent=0in |
|
|
\advance\leftskip by \defbodyindent |
|
|
\exdentamount=\defbodyindent |
|
|
\begingroup % |
|
|
\catcode 61=\active % |
|
|
\obeylines\spacesplit#3} |
|
|
|
|
|
% This is used for \def{tp,vr}parsebody. It could probably be used for |
|
|
% some of the others, too, with some judicious conditionals. |
|
|
% |
|
|
\def\parsebodycommon#1#2#3{% |
|
|
\begingroup\inENV % |
|
|
\medbreak % |
|
|
% Define the end token that this defining construct specifies |
|
|
% so that it will exit this group. |
|
|
\def#1{\endgraf\endgroup\medbreak}% |
|
|
\def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% |
|
|
\parindent=0in |
|
|
\advance\leftskip by \defbodyindent |
|
|
\exdentamount=\defbodyindent |
|
|
\begingroup\obeylines |
|
5140 |
} |
} |
5141 |
|
\let\Everbatim = \afterenvbreak |
5142 |
|
|
|
\def\defvrparsebody#1#2#3#4 {% |
|
|
\parsebodycommon{#1}{#2}{#3}% |
|
|
\spacesplit{#3{#4}}% |
|
|
} |
|
5143 |
|
|
5144 |
% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the |
% @verbatiminclude FILE - insert text of file in verbatim environment. |
|
% type is just `struct', because we lose the braces in `{struct |
|
|
% termios}' when \spacesplit reads its undelimited argument. Sigh. |
|
|
% \let\deftpparsebody=\defvrparsebody |
|
5145 |
% |
% |
5146 |
% So, to get around this, we put \empty in with the type name. That |
\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} |
|
% way, TeX won't find exactly `{...}' as an undelimited argument, and |
|
|
% won't strip off the braces. |
|
5147 |
% |
% |
5148 |
\def\deftpparsebody #1#2#3#4 {% |
\def\doverbatiminclude#1{% |
5149 |
\parsebodycommon{#1}{#2}{#3}% |
{% |
5150 |
\spacesplit{\parsetpheaderline{#3{#4}}}\empty |
\makevalueexpandable |
5151 |
|
\setupverbatim |
5152 |
|
\input #1 |
5153 |
|
\afterenvbreak |
5154 |
|
}% |
5155 |
} |
} |
5156 |
|
|
5157 |
% Fine, but then we have to eventually remove the \empty *and* the |
% @copying ... @end copying. |
5158 |
% braces (if any). That's what this does. |
% Save the text away for @insertcopying later. |
5159 |
% |
% |
5160 |
\def\removeemptybraces\empty#1\relax{#1} |
% We save the uninterpreted tokens, rather than creating a box. |
5161 |
|
% Saving the text in a box would be much easier, but then all the |
5162 |
% After \spacesplit has done its work, this is called -- #1 is the final |
% typesetting commands (@smallbook, font changes, etc.) have to be done |
5163 |
% thing to call, #2 the type name (which starts with \empty), and #3 |
% beforehand -- and a) we want @copying to be done first in the source |
5164 |
% (which might be empty) the arguments. |
% file; b) letting users define the frontmatter in as flexible order as |
5165 |
|
% possible is very desirable. |
5166 |
% |
% |
5167 |
\def\parsetpheaderline#1#2#3{% |
\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} |
5168 |
#1{\removeemptybraces#2\relax}{#3}% |
\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} |
5169 |
}% |
% |
5170 |
|
\def\insertcopying{% |
5171 |
|
\begingroup |
5172 |
|
\parindent = 0pt % paragraph indentation looks wrong on title page |
5173 |
|
\scanexp\copyingtext |
5174 |
|
\endgroup |
5175 |
|
} |
5176 |
|
|
5177 |
\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV % |
\message{defuns,} |
5178 |
\medbreak % |
% @defun etc. |
|
% Define the end token that this defining construct specifies |
|
|
% so that it will exit this group. |
|
|
\def#1{\endgraf\endgroup\medbreak}% |
|
|
\def#2##1 ##2 {\def#4{##1}% |
|
|
\begingroup\obeylines\spacesplit{#3{##2}}}% |
|
|
\parindent=0in |
|
|
\advance\leftskip by \defbodyindent |
|
|
\exdentamount=\defbodyindent |
|
|
\begingroup\obeylines\spacesplit{#3{#5}}} |
|
5179 |
|
|
5180 |
% Split up #2 at the first space token. |
\newskip\defbodyindent \defbodyindent=.4in |
5181 |
% call #1 with two arguments: |
\newskip\defargsindent \defargsindent=50pt |
5182 |
% the first is all of #2 before the space token, |
\newskip\deflastargmargin \deflastargmargin=18pt |
|
% the second is all of #2 after that space token. |
|
|
% If #2 contains no space token, all of it is passed as the first arg |
|
|
% and the second is passed as empty. |
|
5183 |
|
|
5184 |
{\obeylines |
% Start the processing of @deffn: |
5185 |
\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% |
\def\startdefun{% |
5186 |
\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% |
\ifnum\lastpenalty<10000 |
5187 |
\ifx\relax #3% |
\medbreak |
5188 |
#1{#2}{}\else #1{#2}{#3#4}\fi}} |
\else |
5189 |
|
% If there are two @def commands in a row, we'll have a \nobreak, |
5190 |
|
% which is there to keep the function description together with its |
5191 |
|
% header. But if there's nothing but headers, we need to allow a |
5192 |
|
% break somewhere. Check specifically for penalty 10002, inserted |
5193 |
|
% by \defargscommonending, instead of 10000, since the sectioning |
5194 |
|
% commands also insert a nobreak penalty, and we don't want to allow |
5195 |
|
% a break between a section heading and a defun. |
5196 |
|
% |
5197 |
|
\ifnum\lastpenalty=10002 \penalty2000 \fi |
5198 |
|
% |
5199 |
|
% Similarly, after a section heading, do not allow a break. |
5200 |
|
% But do insert the glue. |
5201 |
|
\medskip % preceded by discardable penalty, so not a breakpoint |
5202 |
|
\fi |
5203 |
|
% |
5204 |
|
\parindent=0in |
5205 |
|
\advance\leftskip by \defbodyindent |
5206 |
|
\exdentamount=\defbodyindent |
5207 |
|
} |
5208 |
|
|
5209 |
% So much for the things common to all kinds of definitions. |
\def\dodefunx#1{% |
5210 |
|
% First, check whether we are in the right environment: |
5211 |
|
\checkenv#1% |
5212 |
|
% |
5213 |
|
% As above, allow line break if we have multiple x headers in a row. |
5214 |
|
% It's not a great place, though. |
5215 |
|
\ifnum\lastpenalty=10002 \penalty3000 \fi |
5216 |
|
% |
5217 |
|
% And now, it's time to reuse the body of the original defun: |
5218 |
|
\expandafter\gobbledefun#1% |
5219 |
|
} |
5220 |
|
\def\gobbledefun#1\startdefun{} |
5221 |
|
|
5222 |
% Define @defun. |
% \printdefunline \deffnheader{text} |
5223 |
|
% |
5224 |
|
\def\printdefunline#1#2{% |
5225 |
|
\begingroup |
5226 |
|
% call \deffnheader: |
5227 |
|
#1#2 \endheader |
5228 |
|
% common ending: |
5229 |
|
\interlinepenalty = 10000 |
5230 |
|
\advance\rightskip by 0pt plus 1fil |
5231 |
|
\endgraf |
5232 |
|
\nobreak\vskip -\parskip |
5233 |
|
\penalty 10002 % signal to \startdefun and \dodefunx |
5234 |
|
% Some of the @defun-type tags do not enable magic parentheses, |
5235 |
|
% rendering the following check redundant. But we don't optimize. |
5236 |
|
\checkparencounts |
5237 |
|
\endgroup |
5238 |
|
} |
5239 |
|
|
5240 |
% First, define the processing that is wanted for arguments of \defun |
\def\Edefun{\endgraf\medbreak} |
|
% Use this to expand the args and terminate the paragraph they make up |
|
5241 |
|
|
5242 |
\def\defunargs #1{\functionparens \sl |
% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; |
5243 |
% Expand, preventing hyphenation at `-' chars. |
% the only thing remainnig is to define \deffnheader. |
5244 |
% Note that groups don't affect changes in \hyphenchar. |
% |
5245 |
\hyphenchar\tensl=0 |
\def\makedefun#1{% |
5246 |
#1% |
\expandafter\let\csname E#1\endcsname = \Edefun |
5247 |
\hyphenchar\tensl=45 |
\edef\temp{\noexpand\domakedefun |
5248 |
\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% |
\makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% |
5249 |
\interlinepenalty=10000 |
\temp |
|
\advance\rightskip by 0pt plus 1fil |
|
|
\endgraf\nobreak\vskip -\parskip\nobreak |
|
5250 |
} |
} |
5251 |
|
|
5252 |
\def\deftypefunargs #1{% |
% \domakedefun \deffn \deffnx \deffnheader |
5253 |
% Expand, preventing hyphenation at `-' chars. |
% |
5254 |
% Note that groups don't affect changes in \hyphenchar. |
% Define \deffn and \deffnx, without parameters. |
5255 |
% Use \boldbraxnoamp, not \functionparens, so that & is not special. |
% \deffnheader has to be defined explicitly. |
5256 |
\boldbraxnoamp |
% |
5257 |
\tclose{#1}% avoid \code because of side effects on active chars |
\def\domakedefun#1#2#3{% |
5258 |
\interlinepenalty=10000 |
\envdef#1{% |
5259 |
\advance\rightskip by 0pt plus 1fil |
\startdefun |
5260 |
\endgraf\nobreak\vskip -\parskip\nobreak |
\parseargusing\activeparens{\printdefunline#3}% |
5261 |
|
}% |
5262 |
|
\def#2{\dodefunx#1}% |
5263 |
|
\def#3% |
5264 |
} |
} |
5265 |
|
|
5266 |
% Do complete processing of one @defun or @defunx line already parsed. |
%%% Untyped functions: |
5267 |
|
|
5268 |
% @deffn Command forward-char nchars |
% @deffn category name args |
5269 |
|
\makedefun{deffn}{\deffngeneral{}} |
5270 |
|
|
5271 |
\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} |
% @deffn category class name args |
5272 |
|
\makedefun{defop}#1 {\defopon{#1\ \putwordon}} |
5273 |
|
|
5274 |
\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% |
% \defopon {category on}class name args |
5275 |
\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % |
\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } |
5276 |
\catcode 61=\other % Turn off change made in \defparsebody |
|
5277 |
|
% \deffngeneral {subind}category name args |
5278 |
|
% |
5279 |
|
\def\deffngeneral#1#2 #3 #4\endheader{% |
5280 |
|
% Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. |
5281 |
|
\dosubind{fn}{\code{#3}}{#1}% |
5282 |
|
\defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% |
5283 |
} |
} |
5284 |
|
|
5285 |
% @defun == @deffn Function |
%%% Typed functions: |
5286 |
|
|
5287 |
\def\defun{\defparsebody\Edefun\defunx\defunheader} |
% @deftypefn category type name args |
5288 |
|
\makedefun{deftypefn}{\deftypefngeneral{}} |
5289 |
|
|
5290 |
\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index |
% @deftypeop category class type name args |
5291 |
\begingroup\defname {#1}{\putwordDeffunc}% |
\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} |
|
\defunargs {#2}\endgroup % |
|
|
\catcode 61=\other % Turn off change made in \defparsebody |
|
|
} |
|
5292 |
|
|
5293 |
% @deftypefun int foobar (int @var{foo}, float @var{bar}) |
% \deftypeopon {category on}class type name args |
5294 |
|
\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } |
5295 |
|
|
5296 |
\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} |
% \deftypefngeneral {subind}category type name args |
5297 |
|
% |
5298 |
% #1 is the data type. #2 is the name and args. |
\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% |
5299 |
\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} |
\dosubind{fn}{\code{#4}}{#1}% |
5300 |
% #1 is the data type, #2 the name, #3 the args. |
\defname{#2}{#3}{#4}\defunargs{#5\unskip}% |
|
\def\deftypefunheaderx #1#2 #3\relax{% |
|
|
\doind {fn}{\code{#2}}% Make entry in function index |
|
|
\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}% |
|
|
\deftypefunargs {#3}\endgroup % |
|
|
\catcode 61=\other % Turn off change made in \defparsebody |
|
5301 |
} |
} |
5302 |
|
|
5303 |
% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) |
%%% Typed variables: |
5304 |
|
|
5305 |
\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} |
% @deftypevr category type var args |
5306 |
|
\makedefun{deftypevr}{\deftypecvgeneral{}} |
5307 |
|
|
5308 |
% \defheaderxcond#1\relax$$$ |
% @deftypecv category class type var args |
5309 |
% puts #1 in @code, followed by a space, but does nothing if #1 is null. |
\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} |
|
\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi} |
|
5310 |
|
|
5311 |
% #1 is the classification. #2 is the data type. #3 is the name and args. |
% \deftypecvof {category of}class type var args |
5312 |
\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} |
\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } |
|
% #1 is the classification, #2 the data type, #3 the name, #4 the args. |
|
|
\def\deftypefnheaderx #1#2#3 #4\relax{% |
|
|
\doind {fn}{\code{#3}}% Make entry in function index |
|
|
\begingroup |
|
|
\normalparens % notably, turn off `&' magic, which prevents |
|
|
% at least some C++ text from working |
|
|
\defname {\defheaderxcond#2\relax$$$#3}{#1}% |
|
|
\deftypefunargs {#4}\endgroup % |
|
|
\catcode 61=\other % Turn off change made in \defparsebody |
|
|
} |
|
5313 |
|
|
5314 |
% @defmac == @deffn Macro |
% \deftypecvgeneral {subind}category type var args |
5315 |
|
% |
5316 |
|
\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% |
5317 |
|
\dosubind{vr}{\code{#4}}{#1}% |
5318 |
|
\defname{#2}{#3}{#4}\defunargs{#5\unskip}% |
5319 |
|
} |
5320 |
|
|
5321 |
\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} |
%%% Untyped variables: |
5322 |
|
|
5323 |
\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index |
% @defvr category var args |
5324 |
\begingroup\defname {#1}{\putwordDefmac}% |
\makedefun{defvr}#1 {\deftypevrheader{#1} {} } |
|
\defunargs {#2}\endgroup % |
|
|
\catcode 61=\other % Turn off change made in \defparsebody |
|
|
} |
|
5325 |
|
|
5326 |
% @defspec == @deffn Special Form |
% @defcv category class var args |
5327 |
|
\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} |
5328 |
|
|
5329 |
\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} |
% \defcvof {category of}class var args |
5330 |
|
\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } |
5331 |
|
|
5332 |
\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index |
%%% Type: |
5333 |
\begingroup\defname {#1}{\putwordDefspec}% |
% @deftp category name args |
5334 |
\defunargs {#2}\endgroup % |
\makedefun{deftp}#1 #2 #3\endheader{% |
5335 |
\catcode 61=\other % Turn off change made in \defparsebody |
\doind{tp}{\code{#2}}% |
5336 |
|
\defname{#1}{}{#2}\defunargs{#3\unskip}% |
5337 |
} |
} |
5338 |
|
|
5339 |
% @defop CATEGORY CLASS OPERATION ARG... |
% Remaining @defun-like shortcuts: |
5340 |
% |
\makedefun{defun}{\deffnheader{\putwordDeffunc} } |
5341 |
\def\defop #1 {\def\defoptype{#1}% |
\makedefun{defmac}{\deffnheader{\putwordDefmac} } |
5342 |
\defopparsebody\Edefop\defopx\defopheader\defoptype} |
\makedefun{defspec}{\deffnheader{\putwordDefspec} } |
5343 |
% |
\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } |
5344 |
\def\defopheader #1#2#3{% |
\makedefun{defvar}{\defvrheader{\putwordDefvar} } |
5345 |
\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index |
\makedefun{defopt}{\defvrheader{\putwordDefopt} } |
5346 |
\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}% |
\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } |
5347 |
\defunargs {#3}\endgroup % |
\makedefun{defmethod}{\defopon\putwordMethodon} |
5348 |
} |
\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} |
5349 |
|
\makedefun{defivar}{\defcvof\putwordInstanceVariableof} |
5350 |
|
\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} |
5351 |
|
|
5352 |
% @deftypemethod CLASS RETURN-TYPE METHOD ARG... |
% \defname, which formats the name of the @def (not the args). |
5353 |
|
% #1 is the category, such as "Function". |
5354 |
|
% #2 is the return type, if any. |
5355 |
|
% #3 is the function name. |
5356 |
% |
% |
5357 |
\def\deftypemethod{% |
% We are followed by (but not passed) the arguments, if any. |
|
\deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} |
|
5358 |
% |
% |
5359 |
% #1 is the class name, #2 the data type, #3 the method name, #4 the args. |
\def\defname#1#2#3{% |
5360 |
\def\deftypemethodheader#1#2#3#4{% |
% Get the values of \leftskip and \rightskip as they were outside the @def... |
5361 |
\dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index |
\advance\leftskip by -\defbodyindent |
5362 |
\begingroup |
% |
5363 |
\defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}% |
% How we'll format the type name. Putting it in brackets helps |
5364 |
\deftypefunargs{#4}% |
% distinguish it from the body text that may end up on the next line |
5365 |
\endgroup |
% just below it. |
5366 |
|
\def\temp{#1}% |
5367 |
|
\setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} |
5368 |
|
% |
5369 |
|
% Figure out line sizes for the paragraph shape. |
5370 |
|
% The first line needs space for \box0; but if \rightskip is nonzero, |
5371 |
|
% we need only space for the part of \box0 which exceeds it: |
5372 |
|
\dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip |
5373 |
|
% The continuations: |
5374 |
|
\dimen2=\hsize \advance\dimen2 by -\defargsindent |
5375 |
|
% (plain.tex says that \dimen1 should be used only as global.) |
5376 |
|
\parshape 2 0in \dimen0 \defargsindent \dimen2 |
5377 |
|
% |
5378 |
|
% Put the type name to the right margin. |
5379 |
|
\noindent |
5380 |
|
\hbox to 0pt{% |
5381 |
|
\hfil\box0 \kern-\hsize |
5382 |
|
% \hsize has to be shortened this way: |
5383 |
|
\kern\leftskip |
5384 |
|
% Intentionally do not respect \rightskip, since we need the space. |
5385 |
|
}% |
5386 |
|
% |
5387 |
|
% Allow all lines to be underfull without complaint: |
5388 |
|
\tolerance=10000 \hbadness=10000 |
5389 |
|
\exdentamount=\defbodyindent |
5390 |
|
{% |
5391 |
|
% defun fonts. We use typewriter by default (used to be bold) because: |
5392 |
|
% . we're printing identifiers, they should be in tt in principle. |
5393 |
|
% . in languages with many accents, such as Czech or French, it's |
5394 |
|
% common to leave accents off identifiers. The result looks ok in |
5395 |
|
% tt, but exceedingly strange in rm. |
5396 |
|
% . we don't want -- and --- to be treated as ligatures. |
5397 |
|
% . this still does not fix the ?` and !` ligatures, but so far no |
5398 |
|
% one has made identifiers using them :). |
5399 |
|
\df \tt |
5400 |
|
\def\temp{#2}% return value type |
5401 |
|
\ifx\temp\empty\else \tclose{\temp} \fi |
5402 |
|
#3% output function name |
5403 |
|
}% |
5404 |
|
{\rm\enskip}% hskip 0.5 em of \tenrm |
5405 |
|
% |
5406 |
|
\boldbrax |
5407 |
|
% arguments will be output next, if any. |
5408 |
} |
} |
5409 |
|
|
5410 |
% @deftypeivar CLASS TYPE VARNAME |
% Print arguments in slanted roman (not ttsl), inconsistently with using |
5411 |
|
% tt for the name. This is because literal text is sometimes needed in |
5412 |
|
% the argument list (groff manual), and ttsl and tt are not very |
5413 |
|
% distinguishable. Prevent hyphenation at `-' chars. |
5414 |
% |
% |
5415 |
\def\deftypeivar{% |
\def\defunargs#1{% |
5416 |
\deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader} |
% use sl by default (not ttsl), |
5417 |
% |
% tt for the names. |
5418 |
% #1 is the class name, #2 the data type, #3 the variable name. |
\df \sl \hyphenchar\font=0 |
5419 |
\def\deftypeivarheader#1#2#3{% |
% |
5420 |
\dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index |
% On the other hand, if an argument has two dashes (for instance), we |
5421 |
\begingroup |
% want a way to get ttsl. Let's try @var for that. |
5422 |
\defname{#3}{\putwordInstanceVariableof\ \code{#1}}% |
\let\var=\ttslanted |
5423 |
\defvarargs{#3}% |
#1% |
5424 |
\endgroup |
\sl\hyphenchar\font=45 |
5425 |
} |
} |
5426 |
|
|
5427 |
% @defmethod == @defop Method |
% We want ()&[] to print specially on the defun line. |
|
% |
|
|
\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} |
|
5428 |
% |
% |
5429 |
% #1 is the class name, #2 the method name, #3 the args. |
\def\activeparens{% |
5430 |
\def\defmethodheader#1#2#3{% |
\catcode`\(=\active \catcode`\)=\active |
5431 |
\dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index |
\catcode`\[=\active \catcode`\]=\active |
5432 |
\begingroup |
\catcode`\&=\active |
|
\defname{#2}{\putwordMethodon\ \code{#1}}% |
|
|
\defunargs{#3}% |
|
|
\endgroup |
|
5433 |
} |
} |
5434 |
|
|
5435 |
% @defcv {Class Option} foo-class foo-flag |
% Make control sequences which act like normal parenthesis chars. |
5436 |
|
\let\lparen = ( \let\rparen = ) |
|
\def\defcv #1 {\def\defcvtype{#1}% |
|
|
\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} |
|
5437 |
|
|
5438 |
\def\defcvarheader #1#2#3{% |
% Be sure that we always have a definition for `(', etc. For example, |
5439 |
\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index |
% if the fn name has parens in it, \boldbrax will not be in effect yet, |
5440 |
\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}% |
% so TeX would otherwise complain about undefined control sequence. |
5441 |
\defvarargs {#3}\endgroup % |
{ |
5442 |
} |
\activeparens |
5443 |
|
\global\let(=\lparen \global\let)=\rparen |
5444 |
|
\global\let[=\lbrack \global\let]=\rbrack |
5445 |
|
\global\let& = \& |
5446 |
|
|
5447 |
% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME |
\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} |
5448 |
% |
\gdef\magicamp{\let&=\amprm} |
|
\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} |
|
|
% |
|
|
\def\defivarheader#1#2#3{% |
|
|
\dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index |
|
|
\begingroup |
|
|
\defname{#2}{\putwordInstanceVariableof\ #1}% |
|
|
\defvarargs{#3}% |
|
|
\endgroup |
|
5449 |
} |
} |
5450 |
|
|
5451 |
% @defvar |
\newcount\parencount |
|
% First, define the processing that is wanted for arguments of @defvar. |
|
|
% This is actually simple: just print them in roman. |
|
|
% This must expand the args and terminate the paragraph they make up |
|
|
\def\defvarargs #1{\normalparens #1% |
|
|
\interlinepenalty=10000 |
|
|
\endgraf\nobreak\vskip -\parskip\nobreak} |
|
|
|
|
|
% @defvr Counter foo-count |
|
|
|
|
|
\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} |
|
|
|
|
|
\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% |
|
|
\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} |
|
|
|
|
|
% @defvar == @defvr Variable |
|
5452 |
|
|
5453 |
\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} |
% If we encounter &foo, then turn on ()-hacking afterwards |
5454 |
|
\newif\ifampseen |
5455 |
|
\def\amprm#1 {\ampseentrue{\bf\ }} |
5456 |
|
|
5457 |
\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index |
\def\parenfont{% |
5458 |
\begingroup\defname {#1}{\putwordDefvar}% |
\ifampseen |
5459 |
\defvarargs {#2}\endgroup % |
% At the first level, print parens in roman, |
5460 |
|
% otherwise use the default font. |
5461 |
|
\ifnum \parencount=1 \rm \fi |
5462 |
|
\else |
5463 |
|
% The \sf parens (in \boldbrax) actually are a little bolder than |
5464 |
|
% the contained text. This is especially needed for [ and ] . |
5465 |
|
\sf |
5466 |
|
\fi |
5467 |
} |
} |
5468 |
|
\def\infirstlevel#1{% |
5469 |
% @defopt == @defvr {User Option} |
\ifampseen |
5470 |
|
\ifnum\parencount=1 |
5471 |
\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} |
#1% |
5472 |
|
\fi |
5473 |
\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index |
\fi |
|
\begingroup\defname {#1}{\putwordDefopt}% |
|
|
\defvarargs {#2}\endgroup % |
|
5474 |
} |
} |
5475 |
|
\def\bfafterword#1 {#1 \bf} |
5476 |
|
|
5477 |
% @deftypevar int foobar |
\def\opnr{% |
5478 |
|
\global\advance\parencount by 1 |
5479 |
\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} |
{\parenfont(}% |
5480 |
|
\infirstlevel \bfafterword |
5481 |
% #1 is the data type. #2 is the name, perhaps followed by text that |
} |
5482 |
% is actually part of the data type, which should not be put into the index. |
\def\clnr{% |
5483 |
\def\deftypevarheader #1#2{% |
{\parenfont)}% |
5484 |
\dovarind#2 \relax% Make entry in variables index |
\infirstlevel \sl |
5485 |
\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}% |
\global\advance\parencount by -1 |
5486 |
\interlinepenalty=10000 |
} |
|
\endgraf\nobreak\vskip -\parskip\nobreak |
|
|
\endgroup} |
|
|
\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} |
|
|
|
|
|
% @deftypevr {Global Flag} int enable |
|
|
|
|
|
\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} |
|
|
|
|
|
\def\deftypevrheader #1#2#3{\dovarind#3 \relax% |
|
|
\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1} |
|
|
\interlinepenalty=10000 |
|
|
\endgraf\nobreak\vskip -\parskip\nobreak |
|
|
\endgroup} |
|
|
|
|
|
% Now define @deftp |
|
|
% Args are printed in bold, a slight difference from @defvar. |
|
|
|
|
|
\def\deftpargs #1{\bf \defvarargs{#1}} |
|
|
|
|
|
% @deftp Class window height width ... |
|
|
|
|
|
\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} |
|
5487 |
|
|
5488 |
\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% |
\newcount\brackcount |
5489 |
\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} |
\def\lbrb{% |
5490 |
|
\global\advance\brackcount by 1 |
5491 |
|
{\bf[}% |
5492 |
|
} |
5493 |
|
\def\rbrb{% |
5494 |
|
{\bf]}% |
5495 |
|
\global\advance\brackcount by -1 |
5496 |
|
} |
5497 |
|
|
5498 |
% These definitions are used if you use @defunx (etc.) |
\def\checkparencounts{% |
5499 |
% anywhere other than immediately after a @defun or @defunx. |
\ifnum\parencount=0 \else \badparencount \fi |
5500 |
% |
\ifnum\brackcount=0 \else \badbrackcount \fi |
5501 |
\def\defcvx#1 {\errmessage{@defcvx in invalid context}} |
} |
5502 |
\def\deffnx#1 {\errmessage{@deffnx in invalid context}} |
\def\badparencount{% |
5503 |
\def\defivarx#1 {\errmessage{@defivarx in invalid context}} |
\errmessage{Unbalanced parentheses in @def}% |
5504 |
\def\defmacx#1 {\errmessage{@defmacx in invalid context}} |
\global\parencount=0 |
5505 |
\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}} |
} |
5506 |
\def\defoptx #1 {\errmessage{@defoptx in invalid context}} |
\def\badbrackcount{% |
5507 |
\def\defopx#1 {\errmessage{@defopx in invalid context}} |
\errmessage{Unbalanced square braces in @def}% |
5508 |
\def\defspecx#1 {\errmessage{@defspecx in invalid context}} |
\global\brackcount=0 |
5509 |
\def\deftpx#1 {\errmessage{@deftpx in invalid context}} |
} |
|
\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}} |
|
|
\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}} |
|
|
\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}} |
|
|
\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}} |
|
|
\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}} |
|
|
\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}} |
|
|
\def\defunx#1 {\errmessage{@defunx in invalid context}} |
|
|
\def\defvarx#1 {\errmessage{@defvarx in invalid context}} |
|
|
\def\defvrx#1 {\errmessage{@defvrx in invalid context}} |
|
5510 |
|
|
5511 |
|
|
5512 |
\message{macros,} |
\message{macros,} |
5515 |
% To do this right we need a feature of e-TeX, \scantokens, |
% To do this right we need a feature of e-TeX, \scantokens, |
5516 |
% which we arrange to emulate with a temporary file in ordinary TeX. |
% which we arrange to emulate with a temporary file in ordinary TeX. |
5517 |
\ifx\eTeXversion\undefined |
\ifx\eTeXversion\undefined |
5518 |
\newwrite\macscribble |
\newwrite\macscribble |
5519 |
\def\scanmacro#1{% |
\def\scantokens#1{% |
5520 |
\begingroup \newlinechar`\^^M |
\toks0={#1}% |
5521 |
% Undo catcode changes of \startcontents and \doprintindex |
\immediate\openout\macscribble=\jobname.tmp |
5522 |
\catcode`\@=0 \catcode`\\=12 \escapechar=`\@ |
\immediate\write\macscribble{\the\toks0}% |
5523 |
% Append \endinput to make sure that TeX does not see the ending newline. |
\immediate\closeout\macscribble |
5524 |
\toks0={#1\endinput}% |
\input \jobname.tmp |
5525 |
\immediate\openout\macscribble=\jobname.tmp |
} |
|
\immediate\write\macscribble{\the\toks0}% |
|
|
\immediate\closeout\macscribble |
|
|
\let\xeatspaces\eatspaces |
|
|
\input \jobname.tmp |
|
|
\endgroup |
|
|
} |
|
|
\else |
|
|
\def\scanmacro#1{% |
|
|
\begingroup \newlinechar`\^^M |
|
|
% Undo catcode changes of \startcontents and \doprintindex |
|
|
\catcode`\@=0 \catcode`\\=12 \escapechar=`\@ |
|
|
\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} |
|
5526 |
\fi |
\fi |
5527 |
|
|
5528 |
|
\def\scanmacro#1{% |
5529 |
|
\begingroup |
5530 |
|
\newlinechar`\^^M |
5531 |
|
\let\xeatspaces\eatspaces |
5532 |
|
% Undo catcode changes of \startcontents and \doprintindex |
5533 |
|
% When called from @insertcopying or (short)caption, we need active |
5534 |
|
% backslash to get it printed correctly. Previously, we had |
5535 |
|
% \catcode`\\=\other instead. We'll see whether a problem appears |
5536 |
|
% with macro expansion. --kasal, 19aug04 |
5537 |
|
\catcode`\@=0 \catcode`\\=\active \escapechar=`\@ |
5538 |
|
% ... and \example |
5539 |
|
\spaceisspace |
5540 |
|
% |
5541 |
|
% Append \endinput to make sure that TeX does not see the ending newline. |
5542 |
|
% |
5543 |
|
% I've verified that it is necessary both for e-TeX and for ordinary TeX |
5544 |
|
% --kasal, 29nov03 |
5545 |
|
\scantokens{#1\endinput}% |
5546 |
|
\endgroup |
5547 |
|
} |
5548 |
|
|
5549 |
|
\def\scanexp#1{% |
5550 |
|
\edef\temp{\noexpand\scanmacro{#1}}% |
5551 |
|
\temp |
5552 |
|
} |
5553 |
|
|
5554 |
\newcount\paramno % Count of parameters |
\newcount\paramno % Count of parameters |
5555 |
\newtoks\macname % Macro name |
\newtoks\macname % Macro name |
5556 |
\newif\ifrecursive % Is it recursive? |
\newif\ifrecursive % Is it recursive? |
5558 |
% \do\macro1\do\macro2... |
% \do\macro1\do\macro2... |
5559 |
|
|
5560 |
% Utility routines. |
% Utility routines. |
5561 |
% Thisdoes \let #1 = #2, except with \csnames. |
% This does \let #1 = #2, with \csnames; that is, |
5562 |
|
% \let \csname#1\endcsname = \csname#2\endcsname |
5563 |
|
% (except of course we have to play expansion games). |
5564 |
|
% |
5565 |
\def\cslet#1#2{% |
\def\cslet#1#2{% |
5566 |
\expandafter\expandafter |
\expandafter\let |
5567 |
\expandafter\let |
\csname#1\expandafter\endcsname |
5568 |
\expandafter\expandafter |
\csname#2\endcsname |
5569 |
\csname#1\endcsname |
} |
|
\csname#2\endcsname} |
|
5570 |
|
|
5571 |
% Trim leading and trailing spaces off a string. |
% Trim leading and trailing spaces off a string. |
5572 |
% Concepts from aro-bend problem 15 (see CTAN). |
% Concepts from aro-bend problem 15 (see CTAN). |
5579 |
} |
} |
5580 |
|
|
5581 |
% Trim a single trailing ^^M off a string. |
% Trim a single trailing ^^M off a string. |
5582 |
{\catcode`\^^M=12\catcode`\Q=3% |
{\catcode`\^^M=\other \catcode`\Q=3% |
5583 |
\gdef\eatcr #1{\eatcra #1Q^^MQ}% |
\gdef\eatcr #1{\eatcra #1Q^^MQ}% |
5584 |
\gdef\eatcra#1^^MQ{\eatcrb#1Q}% |
\gdef\eatcra#1^^MQ{\eatcrb#1Q}% |
5585 |
\gdef\eatcrb#1Q#2Q{#1}% |
\gdef\eatcrb#1Q#2Q{#1}% |
5593 |
% done by making ^^M (\endlinechar) catcode 12 when reading the macro |
% done by making ^^M (\endlinechar) catcode 12 when reading the macro |
5594 |
% body, and then making it the \newlinechar in \scanmacro. |
% body, and then making it the \newlinechar in \scanmacro. |
5595 |
|
|
5596 |
|
\def\scanctxt{% |
5597 |
|
\catcode`\"=\other |
5598 |
|
\catcode`\+=\other |
5599 |
|
\catcode`\<=\other |
5600 |
|
\catcode`\>=\other |
5601 |
|
\catcode`\@=\other |
5602 |
|
\catcode`\^=\other |
5603 |
|
\catcode`\_=\other |
5604 |
|
\catcode`\|=\other |
5605 |
|
\catcode`\~=\other |
5606 |
|
} |
5607 |
|
|
5608 |
|
\def\scanargctxt{% |
5609 |
|
\scanctxt |
5610 |
|
\catcode`\\=\other |
5611 |
|
\catcode`\^^M=\other |
5612 |
|
} |
5613 |
|
|
5614 |
\def\macrobodyctxt{% |
\def\macrobodyctxt{% |
5615 |
\catcode`\~=12 |
\scanctxt |
5616 |
\catcode`\^=12 |
\catcode`\{=\other |
5617 |
\catcode`\_=12 |
\catcode`\}=\other |
5618 |
\catcode`\|=12 |
\catcode`\^^M=\other |
5619 |
\catcode`\<=12 |
\usembodybackslash |
5620 |
\catcode`\>=12 |
} |
|
\catcode`\+=12 |
|
|
\catcode`\{=12 |
|
|
\catcode`\}=12 |
|
|
\catcode`\@=12 |
|
|
\catcode`\^^M=12 |
|
|
\usembodybackslash} |
|
5621 |
|
|
5622 |
\def\macroargctxt{% |
\def\macroargctxt{% |
5623 |
\catcode`\~=12 |
\scanctxt |
5624 |
\catcode`\^=12 |
\catcode`\\=\other |
5625 |
\catcode`\_=12 |
} |
|
\catcode`\|=12 |
|
|
\catcode`\<=12 |
|
|
\catcode`\>=12 |
|
|
\catcode`\+=12 |
|
|
\catcode`\@=12 |
|
|
\catcode`\\=12} |
|
5626 |
|
|
5627 |
% \mbodybackslash is the definition of \ in @macro bodies. |
% \mbodybackslash is the definition of \ in @macro bodies. |
5628 |
% It maps \foo\ => \csname macarg.foo\endcsname => #N |
% It maps \foo\ => \csname macarg.foo\endcsname => #N |
5650 |
\message{Warning: redefining \the\macname}% |
\message{Warning: redefining \the\macname}% |
5651 |
\else |
\else |
5652 |
\expandafter\ifx\csname \the\macname\endcsname \relax |
\expandafter\ifx\csname \the\macname\endcsname \relax |
5653 |
\else \errmessage{The name \the\macname\space is reserved}\fi |
\else \errmessage{Macro name \the\macname\space already defined}\fi |
5654 |
\global\cslet{macsave.\the\macname}{\the\macname}% |
\global\cslet{macsave.\the\macname}{\the\macname}% |
5655 |
\global\expandafter\let\csname ismacro.\the\macname\endcsname=1% |
\global\expandafter\let\csname ismacro.\the\macname\endcsname=1% |
5656 |
% Add the macroname to \macrolist |
% Add the macroname to \macrolist |
5663 |
\else \expandafter\parsemacbody |
\else \expandafter\parsemacbody |
5664 |
\fi} |
\fi} |
5665 |
|
|
5666 |
\def\unmacro{\parsearg\unmacroxxx} |
\parseargdef\unmacro{% |
|
\def\unmacroxxx#1{% |
|
5667 |
\if1\csname ismacro.#1\endcsname |
\if1\csname ismacro.#1\endcsname |
5668 |
\global\cslet{#1}{macsave.#1}% |
\global\cslet{#1}{macsave.#1}% |
5669 |
\global\expandafter\let \csname ismacro.#1\endcsname=0% |
\global\expandafter\let \csname ismacro.#1\endcsname=0% |
5670 |
% Remove the macro name from \macrolist |
% Remove the macro name from \macrolist: |
5671 |
\begingroup |
\begingroup |
5672 |
\edef\tempa{\expandafter\noexpand\csname#1\endcsname}% |
\expandafter\let\csname#1\endcsname \relax |
5673 |
\def\do##1{% |
\let\do\unmacrodo |
5674 |
\def\tempb{##1}% |
\xdef\macrolist{\macrolist}% |
|
\ifx\tempa\tempb |
|
|
% remove this |
|
|
\else |
|
|
\toks0 = \expandafter{\newmacrolist\do}% |
|
|
\edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}% |
|
|
\fi}% |
|
|
\def\newmacrolist{}% |
|
|
% Execute macro list to define \newmacrolist |
|
|
\macrolist |
|
|
\global\let\macrolist\newmacrolist |
|
5675 |
\endgroup |
\endgroup |
5676 |
\else |
\else |
5677 |
\errmessage{Macro #1 not defined}% |
\errmessage{Macro #1 not defined}% |
5678 |
\fi |
\fi |
5679 |
} |
} |
5680 |
|
|
5681 |
|
% Called by \do from \dounmacro on each macro. The idea is to omit any |
5682 |
|
% macro definitions that have been changed to \relax. |
5683 |
|
% |
5684 |
|
\def\unmacrodo#1{% |
5685 |
|
\ifx#1\relax |
5686 |
|
% remove this |
5687 |
|
\else |
5688 |
|
\noexpand\do \noexpand #1% |
5689 |
|
\fi |
5690 |
|
} |
5691 |
|
|
5692 |
% This makes use of the obscure feature that if the last token of a |
% This makes use of the obscure feature that if the last token of a |
5693 |
% <parameter list> is #, then the preceding argument is delimited by |
% <parameter list> is #, then the preceding argument is delimited by |
5694 |
% an opening brace, and that opening brace is not consumed. |
% an opening brace, and that opening brace is not consumed. |
5804 |
\expandafter\parsearg |
\expandafter\parsearg |
5805 |
\fi \next} |
\fi \next} |
5806 |
|
|
5807 |
% We mant to disable all macros during \shipout so that they are not |
% We want to disable all macros during \shipout so that they are not |
5808 |
% expanded by \write. |
% expanded by \write. |
5809 |
\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% |
\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% |
5810 |
\edef\next{\macrolist}\expandafter\endgroup\next} |
\edef\next{\macrolist}\expandafter\endgroup\next} |
5811 |
|
|
5812 |
|
% For \indexnofonts, we need to get rid of all macros, leaving only the |
5813 |
|
% arguments (if present). Of course this is not nearly correct, but it |
5814 |
|
% is the best we can do for now. makeinfo does not expand macros in the |
5815 |
|
% argument to @deffn, which ends up writing an index entry, and texindex |
5816 |
|
% isn't prepared for an index sort entry that starts with \. |
5817 |
|
% |
5818 |
|
% Since macro invocations are followed by braces, we can just redefine them |
5819 |
|
% to take a single TeX argument. The case of a macro invocation that |
5820 |
|
% goes to end-of-line is not handled. |
5821 |
|
% |
5822 |
|
\def\emptyusermacros{\begingroup |
5823 |
|
\def\do##1{\let\noexpand##1=\noexpand\asis}% |
5824 |
|
\edef\next{\macrolist}\expandafter\endgroup\next} |
5825 |
|
|
5826 |
|
|
5827 |
% @alias. |
% @alias. |
5828 |
\def\alias#1=#2{\gdef#1{#2}} |
% We need some trickery to remove the optional spaces around the equal |
5829 |
|
% sign. Just make them active and then expand them all to nothing. |
5830 |
|
\def\alias{\parseargusing\obeyspaces\aliasxxx} |
5831 |
|
\def\aliasxxx #1{\aliasyyy#1\relax} |
5832 |
|
\def\aliasyyy #1=#2\relax{% |
5833 |
|
{% |
5834 |
|
\expandafter\let\obeyedspace=\empty |
5835 |
|
\xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% |
5836 |
|
}% |
5837 |
|
\next |
5838 |
|
} |
5839 |
|
|
5840 |
|
|
5841 |
\message{cross references,} |
\message{cross references,} |
5842 |
|
|
5843 |
\newwrite\auxfile |
\newwrite\auxfile |
5844 |
|
|
5845 |
\newif\ifhavexrefs % True if xref values are known. |
\newif\ifhavexrefs % True if xref values are known. |
5850 |
\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, |
\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, |
5851 |
node \samp{\ignorespaces#1{}}} |
node \samp{\ignorespaces#1{}}} |
5852 |
|
|
5853 |
% @node's job is to define \lastnode. |
% @node's only job in TeX is to define \lastnode, which is used in |
5854 |
\def\node{\ENVcheck\parsearg\nodezzz} |
% cross-references. The @node line might or might not have commas, and |
5855 |
\def\nodezzz#1{\nodexxx [#1,]} |
% might or might not have spaces before the first comma, like: |
5856 |
\def\nodexxx[#1,#2]{\gdef\lastnode{#1}} |
% @node foo , bar , ... |
5857 |
|
% We don't want such trailing spaces in the node name. |
5858 |
|
% |
5859 |
|
\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} |
5860 |
|
% |
5861 |
|
% also remove a trailing comma, in case of something like this: |
5862 |
|
% @node Help-Cross, , , Cross-refs |
5863 |
|
\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} |
5864 |
|
\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} |
5865 |
|
|
5866 |
\let\nwnode=\node |
\let\nwnode=\node |
5867 |
\let\lastnode=\relax |
\let\lastnode=\empty |
5868 |
|
|
5869 |
% The sectioning commands (@chapter, etc.) call these. |
% Write a cross-reference definition for the current node. #1 is the |
5870 |
\def\donoderef{% |
% type (Ynumbered, Yappendix, Ynothing). |
5871 |
\ifx\lastnode\relax\else |
% |
5872 |
\expandafter\expandafter\expandafter\setref{\lastnode}% |
\def\donoderef#1{% |
5873 |
{Ysectionnumberandtype}% |
\ifx\lastnode\empty\else |
5874 |
\global\let\lastnode=\relax |
\setref{\lastnode}{#1}% |
5875 |
\fi |
\global\let\lastnode=\empty |
|
} |
|
|
\def\unnumbnoderef{% |
|
|
\ifx\lastnode\relax\else |
|
|
\expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}% |
|
|
\global\let\lastnode=\relax |
|
|
\fi |
|
|
} |
|
|
\def\appendixnoderef{% |
|
|
\ifx\lastnode\relax\else |
|
|
\expandafter\expandafter\expandafter\setref{\lastnode}% |
|
|
{Yappendixletterandtype}% |
|
|
\global\let\lastnode=\relax |
|
5876 |
\fi |
\fi |
5877 |
} |
} |
5878 |
|
|
|
|
|
5879 |
% @anchor{NAME} -- define xref target at arbitrary point. |
% @anchor{NAME} -- define xref target at arbitrary point. |
5880 |
% |
% |
5881 |
{ \catcode`\@ = 11 |
\newcount\savesfregister |
5882 |
% From latex.ltx, to make @anchor truely invisible. |
% |
5883 |
\newdimen\@savsk |
\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} |
5884 |
\newcount\@savsf |
\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} |
5885 |
\gdef\@bsphack{\relax |
\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} |
5886 |
\ifhmode \@savsk\lastskip \@savsf\spacefactor \fi |
|
5887 |
} |
% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an |
5888 |
\gdef\@esphack{\relax |
% anchor), which consists of three parts: |
5889 |
\ifhmode \spacefactor\@savsf |
% 1) NAME-title - the current sectioning name taken from \thissection, |
5890 |
\ifdim\@savsk>\z@ \ignorespaces \fi |
% or the anchor name. |
5891 |
\fi |
% 2) NAME-snt - section number and type, passed as the SNT arg, or |
5892 |
} |
% empty for anchors. |
5893 |
\gdef\anchor#1{\@bsphack \setref{#1}{Ynothing}\@esphack} |
% 3) NAME-pg - the page number. |
5894 |
} |
% |
5895 |
|
% This is called from \donoderef, \anchor, and \dofloat. In the case of |
5896 |
% \setref{NAME}{SNT} defines a cross-reference point NAME, namely |
% floats, there is an additional part, which is not written here: |
5897 |
% NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have |
% 4) NAME-lof - the text as it should appear in a @listoffloats. |
5898 |
% to set \indexdummies so commands such as @code in a section title |
% |
5899 |
% aren't expanded. It would be nicer not to expand the titles in the |
\def\setref#1#2{% |
5900 |
% first place, but there's so many layers that that is hard to do. |
\pdfmkdest{#1}% |
5901 |
% |
\iflinks |
5902 |
\def\setref#1#2{{% |
{% |
5903 |
\indexdummies |
\atdummies % preserve commands, but don't expand them |
5904 |
\dosetq{#1-title}{Ytitle}% |
\turnoffactive |
5905 |
\dosetq{#1-pg}{Ypagenumber}% |
\otherbackslash |
5906 |
\dosetq{#1-snt}{#2}% |
\edef\writexrdef##1##2{% |
5907 |
}} |
\write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef |
5908 |
|
##1}{##2}}% these are parameters of \writexrdef |
5909 |
|
}% |
5910 |
|
\toks0 = \expandafter{\thissection}% |
5911 |
|
\immediate \writexrdef{title}{\the\toks0 }% |
5912 |
|
\immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. |
5913 |
|
\writexrdef{pg}{\folio}% will be written later, during \shipout |
5914 |
|
}% |
5915 |
|
\fi |
5916 |
|
} |
5917 |
|
|
5918 |
% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is |
% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is |
5919 |
% the node name, #2 the name of the Info cross-reference, #3 the printed |
% the node name, #2 the name of the Info cross-reference, #3 the printed |
5924 |
\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} |
\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} |
5925 |
\def\ref#1{\xrefX[#1,,,,,,,]} |
\def\ref#1{\xrefX[#1,,,,,,,]} |
5926 |
\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup |
\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup |
5927 |
|
\unsepspaces |
5928 |
\def\printedmanual{\ignorespaces #5}% |
\def\printedmanual{\ignorespaces #5}% |
5929 |
\def\printednodename{\ignorespaces #3}% |
\def\printedrefname{\ignorespaces #3}% |
5930 |
\setbox1=\hbox{\printedmanual}% |
\setbox1=\hbox{\printedmanual\unskip}% |
5931 |
\setbox0=\hbox{\printednodename}% |
\setbox0=\hbox{\printedrefname\unskip}% |
5932 |
\ifdim \wd0 = 0pt |
\ifdim \wd0 = 0pt |
5933 |
% No printed node name was explicitly given. |
% No printed node name was explicitly given. |
5934 |
\expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax |
\expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax |
5935 |
% Use the node name inside the square brackets. |
% Use the node name inside the square brackets. |
5936 |
\def\printednodename{\ignorespaces #1}% |
\def\printedrefname{\ignorespaces #1}% |
5937 |
\else |
\else |
5938 |
% Use the actual chapter/section title appear inside |
% Use the actual chapter/section title appear inside |
5939 |
% the square brackets. Use the real section title if we have it. |
% the square brackets. Use the real section title if we have it. |
5940 |
\ifdim \wd1 > 0pt |
\ifdim \wd1 > 0pt |
5941 |
% It is in another manual, so we don't have it. |
% It is in another manual, so we don't have it. |
5942 |
\def\printednodename{\ignorespaces #1}% |
\def\printedrefname{\ignorespaces #1}% |
5943 |
\else |
\else |
5944 |
\ifhavexrefs |
\ifhavexrefs |
5945 |
% We know the real title if we have the xref values. |
% We know the real title if we have the xref values. |
5946 |
\def\printednodename{\refx{#1-title}{}}% |
\def\printedrefname{\refx{#1-title}{}}% |
5947 |
\else |
\else |
5948 |
% Otherwise just copy the Info node name. |
% Otherwise just copy the Info node name. |
5949 |
\def\printednodename{\ignorespaces #1}% |
\def\printedrefname{\ignorespaces #1}% |
5950 |
\fi% |
\fi% |
5951 |
\fi |
\fi |
5952 |
\fi |
\fi |
5953 |
\fi |
\fi |
5954 |
% |
% |
5955 |
% If we use \unhbox0 and \unhbox1 to print the node names, TeX does not |
% Make link in pdf output. |
5956 |
% insert empty discretionaries after hyphens, which means that it will |
\ifpdf |
5957 |
% not find a line break at a hyphen in a node names. Since some manuals |
\leavevmode |
5958 |
% are best written with fairly long node names, containing hyphens, this |
\getfilename{#4}% |
5959 |
% is a loss. Therefore, we give the text of the node name again, so it |
{\turnoffactive \otherbackslash |
5960 |
% is as if TeX is seeing it for the first time. |
\ifnum\filenamelength>0 |
5961 |
\ifdim \wd1 > 0pt |
\startlink attr{/Border [0 0 0]}% |
5962 |
\putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}% |
goto file{\the\filename.pdf} name{#1}% |
5963 |
\else |
\else |
5964 |
% _ (for example) has to be the character _ for the purposes of the |
\startlink attr{/Border [0 0 0]}% |
5965 |
% control sequence corresponding to the node, but it has to expand |
goto name{\pdfmkpgn{#1}}% |
5966 |
% into the usual \leavevmode...\vrule stuff for purposes of |
\fi |
|
% printing. So we \turnoffactive for the \refx-snt, back on for the |
|
|
% printing, back off for the \refx-pg. |
|
|
{\normalturnoffactive |
|
|
% Only output a following space if the -snt ref is nonempty; for |
|
|
% @unnumbered and @anchor, it won't be. |
|
|
\setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% |
|
|
\ifdim \wd2 > 0pt \refx{#1-snt}\space\fi |
|
5967 |
}% |
}% |
5968 |
% [mynode], |
\linkcolor |
|
[\printednodename],\space |
|
|
% page 3 |
|
|
\turnoffactive \putwordpage\tie\refx{#1-pg}{}% |
|
5969 |
\fi |
\fi |
5970 |
\endgroup} |
% |
5971 |
|
% Float references are printed completely differently: "Figure 1.2" |
5972 |
% \dosetq is the interface for calls from other macros |
% instead of "[somenode], p.3". We distinguish them by the |
5973 |
|
% LABEL-title being set to a magic string. |
5974 |
% Use \normalturnoffactive so that punctuation chars such as underscore |
{% |
5975 |
% and backslash work in node names. (\turnoffactive doesn't do \.) |
% Have to otherify everything special to allow the \csname to |
5976 |
\def\dosetq#1#2{% |
% include an _ in the xref name, etc. |
5977 |
{\let\folio=0% |
\indexnofonts |
5978 |
\normalturnoffactive |
\turnoffactive |
5979 |
\edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% |
\otherbackslash |
5980 |
\iflinks |
\expandafter\global\expandafter\let\expandafter\Xthisreftitle |
5981 |
\next |
\csname XR#1-title\endcsname |
|
\fi |
|
5982 |
}% |
}% |
5983 |
} |
\iffloat\Xthisreftitle |
5984 |
|
% If the user specified the print name (third arg) to the ref, |
5985 |
% \internalsetq {foo}{page} expands into |
% print it instead of our usual "Figure 1.2". |
5986 |
% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} |
\ifdim\wd0 = 0pt |
5987 |
% When the aux file is read, ' is the escape character |
\refx{#1-snt}% |
5988 |
|
\else |
5989 |
\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} |
\printedrefname |
5990 |
|
\fi |
5991 |
% Things to be expanded by \internalsetq |
% |
5992 |
|
% if the user also gave the printed manual name (fifth arg), append |
5993 |
\def\Ypagenumber{\folio} |
% "in MANUALNAME". |
5994 |
|
\ifdim \wd1 > 0pt |
5995 |
\def\Ytitle{\thissection} |
\space \putwordin{} \cite{\printedmanual}% |
5996 |
|
\fi |
5997 |
\def\Ynothing{} |
\else |
5998 |
|
% node/anchor (non-float) references. |
5999 |
\def\Ysectionnumberandtype{% |
% |
6000 |
\ifnum\secno=0 \putwordChapter\xreftie\the\chapno % |
% If we use \unhbox0 and \unhbox1 to print the node names, TeX does not |
6001 |
\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % |
% insert empty discretionaries after hyphens, which means that it will |
6002 |
\else \ifnum \subsubsecno=0 % |
% not find a line break at a hyphen in a node names. Since some manuals |
6003 |
\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % |
% are best written with fairly long node names, containing hyphens, this |
6004 |
\else % |
% is a loss. Therefore, we give the text of the node name again, so it |
6005 |
\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % |
% is as if TeX is seeing it for the first time. |
6006 |
\fi \fi \fi } |
\ifdim \wd1 > 0pt |
6007 |
|
\putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% |
6008 |
\def\Yappendixletterandtype{% |
\else |
6009 |
\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% |
% _ (for example) has to be the character _ for the purposes of the |
6010 |
\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % |
% control sequence corresponding to the node, but it has to expand |
6011 |
\else \ifnum \subsubsecno=0 % |
% into the usual \leavevmode...\vrule stuff for purposes of |
6012 |
\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % |
% printing. So we \turnoffactive for the \refx-snt, back on for the |
6013 |
\else % |
% printing, back off for the \refx-pg. |
6014 |
\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % |
{\turnoffactive \otherbackslash |
6015 |
\fi \fi \fi } |
% Only output a following space if the -snt ref is nonempty; for |
6016 |
|
% @unnumbered and @anchor, it won't be. |
6017 |
|
\setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% |
6018 |
|
\ifdim \wd2 > 0pt \refx{#1-snt}\space\fi |
6019 |
|
}% |
6020 |
|
% output the `[mynode]' via a macro so it can be overridden. |
6021 |
|
\xrefprintnodename\printedrefname |
6022 |
|
% |
6023 |
|
% But we always want a comma and a space: |
6024 |
|
,\space |
6025 |
|
% |
6026 |
|
% output the `page 3'. |
6027 |
|
\turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}% |
6028 |
|
\fi |
6029 |
|
\fi |
6030 |
|
\endlink |
6031 |
|
\endgroup} |
6032 |
|
|
6033 |
\gdef\xreftie{'tie} |
% This macro is called from \xrefX for the `[nodename]' part of xref |
6034 |
|
% output. It's a separate macro only so it can be changed more easily, |
6035 |
|
% since square brackets don't work well in some documents. Particularly |
6036 |
|
% one that Bob is working on :). |
6037 |
|
% |
6038 |
|
\def\xrefprintnodename#1{[#1]} |
6039 |
|
|
6040 |
% Use TeX 3.0's \inputlineno to get the line number, for better error |
% Things referred to by \setref. |
|
% messages, but if we're using an old version of TeX, don't do anything. |
|
6041 |
% |
% |
6042 |
\ifx\inputlineno\thisisundefined |
\def\Ynothing{} |
6043 |
\let\linenumber = \empty % Non-3.0. |
\def\Yomitfromtoc{} |
6044 |
\else |
\def\Ynumbered{% |
6045 |
\def\linenumber{\the\inputlineno:\space} |
\ifnum\secno=0 |
6046 |
\fi |
\putwordChapter@tie \the\chapno |
6047 |
|
\else \ifnum\subsecno=0 |
6048 |
|
\putwordSection@tie \the\chapno.\the\secno |
6049 |
|
\else \ifnum\subsubsecno=0 |
6050 |
|
\putwordSection@tie \the\chapno.\the\secno.\the\subsecno |
6051 |
|
\else |
6052 |
|
\putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno |
6053 |
|
\fi\fi\fi |
6054 |
|
} |
6055 |
|
\def\Yappendix{% |
6056 |
|
\ifnum\secno=0 |
6057 |
|
\putwordAppendix@tie @char\the\appendixno{}% |
6058 |
|
\else \ifnum\subsecno=0 |
6059 |
|
\putwordSection@tie @char\the\appendixno.\the\secno |
6060 |
|
\else \ifnum\subsubsecno=0 |
6061 |
|
\putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno |
6062 |
|
\else |
6063 |
|
\putwordSection@tie |
6064 |
|
@char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno |
6065 |
|
\fi\fi\fi |
6066 |
|
} |
6067 |
|
|
6068 |
% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. |
% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. |
6069 |
% If its value is nonempty, SUFFIX is output afterward. |
% If its value is nonempty, SUFFIX is output afterward. |
6070 |
|
% |
6071 |
\def\refx#1#2{% |
\def\refx#1#2{% |
6072 |
\expandafter\ifx\csname X#1\endcsname\relax |
{% |
6073 |
|
\indexnofonts |
6074 |
|
\otherbackslash |
6075 |
|
\expandafter\global\expandafter\let\expandafter\thisrefX |
6076 |
|
\csname XR#1\endcsname |
6077 |
|
}% |
6078 |
|
\ifx\thisrefX\relax |
6079 |
% If not defined, say something at least. |
% If not defined, say something at least. |
6080 |
\angleleft un\-de\-fined\angleright |
\angleleft un\-de\-fined\angleright |
6081 |
\iflinks |
\iflinks |
6090 |
\fi |
\fi |
6091 |
\else |
\else |
6092 |
% It's defined, so just use it. |
% It's defined, so just use it. |
6093 |
\csname X#1\endcsname |
\thisrefX |
6094 |
\fi |
\fi |
6095 |
#2% Output the suffix in any case. |
#2% Output the suffix in any case. |
6096 |
} |
} |
6097 |
|
|
6098 |
% This is the macro invoked by entries in the aux file. |
% This is the macro invoked by entries in the aux file. Usually it's |
6099 |
% |
% just a \def (we prepend XR to the control sequence name to avoid |
6100 |
\def\xrdef#1{\begingroup |
% collisions). But if this is a float type, we have more work to do. |
6101 |
% Reenable \ as an escape while reading the second argument. |
% |
6102 |
\catcode`\\ = 0 |
\def\xrdef#1#2{% |
6103 |
\afterassignment\endgroup |
\expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. |
6104 |
\expandafter\gdef\csname X#1\endcsname |
% |
6105 |
|
% Was that xref control sequence that we just defined for a float? |
6106 |
|
\expandafter\iffloat\csname XR#1\endcsname |
6107 |
|
% it was a float, and we have the (safe) float type in \iffloattype. |
6108 |
|
\expandafter\let\expandafter\floatlist |
6109 |
|
\csname floatlist\iffloattype\endcsname |
6110 |
|
% |
6111 |
|
% Is this the first time we've seen this float type? |
6112 |
|
\expandafter\ifx\floatlist\relax |
6113 |
|
\toks0 = {\do}% yes, so just \do |
6114 |
|
\else |
6115 |
|
% had it before, so preserve previous elements in list. |
6116 |
|
\toks0 = \expandafter{\floatlist\do}% |
6117 |
|
\fi |
6118 |
|
% |
6119 |
|
% Remember this xref in the control sequence \floatlistFLOATTYPE, |
6120 |
|
% for later use in \listoffloats. |
6121 |
|
\expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% |
6122 |
|
\fi |
6123 |
} |
} |
6124 |
|
|
6125 |
% Read the last existing aux file, if any. No error if none exists. |
% Read the last existing aux file, if any. No error if none exists. |
6126 |
|
% |
6127 |
|
\def\tryauxfile{% |
6128 |
|
\openin 1 \jobname.aux |
6129 |
|
\ifeof 1 \else |
6130 |
|
\readauxfile |
6131 |
|
\global\havexrefstrue |
6132 |
|
\fi |
6133 |
|
\closein 1 |
6134 |
|
} |
6135 |
|
|
6136 |
\def\readauxfile{\begingroup |
\def\readauxfile{\begingroup |
6137 |
\catcode`\^^@=\other |
\catcode`\^^@=\other |
6138 |
\catcode`\^^A=\other |
\catcode`\^^A=\other |
6161 |
\catcode`\^^]=\other |
\catcode`\^^]=\other |
6162 |
\catcode`\^^^=\other |
\catcode`\^^^=\other |
6163 |
\catcode`\^^_=\other |
\catcode`\^^_=\other |
6164 |
\catcode`\@=\other |
% It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. |
|
\catcode`\^=\other |
|
|
% It was suggested to define this as 7, which would allow ^^e4 etc. |
|
6165 |
% in xref tags, i.e., node names. But since ^^e4 notation isn't |
% in xref tags, i.e., node names. But since ^^e4 notation isn't |
6166 |
% supported in the main text, it doesn't seem desirable. Furthermore, |
% supported in the main text, it doesn't seem desirable. Furthermore, |
6167 |
% that is not enough: for node names that actually contain a ^ |
% that is not enough: for node names that actually contain a ^ |
6174 |
% \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter |
% \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter |
6175 |
% and then to call \auxhat in \setq. |
% and then to call \auxhat in \setq. |
6176 |
% |
% |
6177 |
|
\catcode`\^=\other |
6178 |
|
% |
6179 |
|
% Special characters. Should be turned off anyway, but... |
6180 |
\catcode`\~=\other |
\catcode`\~=\other |
6181 |
\catcode`\[=\other |
\catcode`\[=\other |
6182 |
\catcode`\]=\other |
\catcode`\]=\other |
6188 |
\catcode`\$=\other |
\catcode`\$=\other |
6189 |
\catcode`\#=\other |
\catcode`\#=\other |
6190 |
\catcode`\&=\other |
\catcode`\&=\other |
6191 |
|
\catcode`\%=\other |
6192 |
\catcode`+=\other % avoid \+ for paranoia even though we've turned it off |
\catcode`+=\other % avoid \+ for paranoia even though we've turned it off |
6193 |
% Make the characters 128-255 be printing characters |
% |
6194 |
|
% This is to support \ in node names and titles, since the \ |
6195 |
|
% characters end up in a \csname. It's easier than |
6196 |
|
% leaving it active and making its active definition an actual \ |
6197 |
|
% character. What I don't understand is why it works in the *value* |
6198 |
|
% of the xrdef. Seems like it should be a catcode12 \, and that |
6199 |
|
% should not typeset properly. But it works, so I'm moving on for |
6200 |
|
% now. --karl, 15jan04. |
6201 |
|
\catcode`\\=\other |
6202 |
|
% |
6203 |
|
% Make the characters 128-255 be printing characters. |
6204 |
{% |
{% |
6205 |
\count 1=128 |
\count 1=128 |
6206 |
\def\loop{% |
\def\loop{% |
6209 |
\ifnum \count 1<256 \loop \fi |
\ifnum \count 1<256 \loop \fi |
6210 |
}% |
}% |
6211 |
}% |
}% |
6212 |
% The aux file uses ' as the escape (for now). |
% |
6213 |
% Turn off \ as an escape so we do not lose on |
% @ is our escape character in .aux files, and we need braces. |
|
% entries which were dumped with control sequences in their names. |
|
|
% For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ |
|
|
% Reference to such entries still does not work the way one would wish, |
|
|
% but at least they do not bomb out when the aux file is read in. |
|
6214 |
\catcode`\{=1 |
\catcode`\{=1 |
6215 |
\catcode`\}=2 |
\catcode`\}=2 |
6216 |
\catcode`\%=\other |
\catcode`\@=0 |
|
\catcode`\'=0 |
|
|
\catcode`\\=\other |
|
6217 |
% |
% |
6218 |
\openin 1 \jobname.aux |
\input \jobname.aux |
|
\ifeof 1 \else |
|
|
\closein 1 |
|
|
\input \jobname.aux |
|
|
\global\havexrefstrue |
|
|
\global\warnedobstrue |
|
|
\fi |
|
|
% Open the new aux file. TeX will close it automatically at exit. |
|
|
\openout\auxfile=\jobname.aux |
|
6219 |
\endgroup} |
\endgroup} |
6220 |
|
|
6221 |
|
|
6222 |
% Footnotes. |
\message{insertions,} |
6223 |
|
% including footnotes. |
6224 |
|
|
6225 |
\newcount \footnoteno |
\newcount \footnoteno |
6226 |
|
|
6234 |
% @footnotestyle is meaningful for info output only. |
% @footnotestyle is meaningful for info output only. |
6235 |
\let\footnotestyle=\comment |
\let\footnotestyle=\comment |
6236 |
|
|
|
\let\ptexfootnote=\footnote |
|
|
|
|
6237 |
{\catcode `\@=11 |
{\catcode `\@=11 |
6238 |
% |
% |
6239 |
% Auto-number footnotes. Otherwise like plain. |
% Auto-number footnotes. Otherwise like plain. |
6240 |
\gdef\footnote{% |
\gdef\footnote{% |
6241 |
|
\let\indent=\ptexindent |
6242 |
|
\let\noindent=\ptexnoindent |
6243 |
\global\advance\footnoteno by \@ne |
\global\advance\footnoteno by \@ne |
6244 |
\edef\thisfootno{$^{\the\footnoteno}$}% |
\edef\thisfootno{$^{\the\footnoteno}$}% |
6245 |
% |
% |
6246 |
% In case the footnote comes at the end of a sentence, preserve the |
% In case the footnote comes at the end of a sentence, preserve the |
6247 |
% extra spacing after we do the footnote number. |
% extra spacing after we do the footnote number. |
6248 |
\let\@sf\empty |
\let\@sf\empty |
6249 |
\ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi |
\ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi |
6250 |
% |
% |
6251 |
% Remove inadvertent blank space before typesetting the footnote number. |
% Remove inadvertent blank space before typesetting the footnote number. |
6252 |
\unskip |
\unskip |
6253 |
\thisfootno\@sf |
\thisfootno\@sf |
6254 |
\footnotezzz |
\dofootnote |
6255 |
}% |
}% |
6256 |
|
|
6257 |
% Don't bother with the trickery in plain.tex to not require the |
% Don't bother with the trickery in plain.tex to not require the |
6258 |
% footnote text as a parameter. Our footnotes don't need to be so general. |
% footnote text as a parameter. Our footnotes don't need to be so general. |
6259 |
% |
% |
6260 |
% Oh yes, they do; otherwise, @ifset and anything else that uses |
% Oh yes, they do; otherwise, @ifset (and anything else that uses |
6261 |
% \parseargline fail inside footnotes because the tokens are fixed when |
% \parseargline) fails inside footnotes because the tokens are fixed when |
6262 |
% the footnote is read. --karl, 16nov96. |
% the footnote is read. --karl, 16nov96. |
6263 |
% |
% |
6264 |
\long\gdef\footnotezzz{\insert\footins\bgroup |
\gdef\dofootnote{% |
6265 |
|
\insert\footins\bgroup |
6266 |
% We want to typeset this text as a normal paragraph, even if the |
% We want to typeset this text as a normal paragraph, even if the |
6267 |
% footnote reference occurs in (for example) a display environment. |
% footnote reference occurs in (for example) a display environment. |
6268 |
% So reset some parameters. |
% So reset some parameters. |
6269 |
|
\hsize=\pagewidth |
6270 |
\interlinepenalty\interfootnotelinepenalty |
\interlinepenalty\interfootnotelinepenalty |
6271 |
\splittopskip\ht\strutbox % top baseline for broken footnotes |
\splittopskip\ht\strutbox % top baseline for broken footnotes |
6272 |
\splitmaxdepth\dp\strutbox |
\splitmaxdepth\dp\strutbox |
6277 |
\xspaceskip\z@skip |
\xspaceskip\z@skip |
6278 |
\parindent\defaultparindent |
\parindent\defaultparindent |
6279 |
% |
% |
6280 |
% Hang the footnote text off the number. |
\smallfonts \rm |
6281 |
\hang |
% |
6282 |
|
% Because we use hanging indentation in footnotes, a @noindent appears |
6283 |
|
% to exdent this text, so make it be a no-op. makeinfo does not use |
6284 |
|
% hanging indentation so @noindent can still be needed within footnote |
6285 |
|
% text after an @example or the like (not that this is good style). |
6286 |
|
\let\noindent = \relax |
6287 |
|
% |
6288 |
|
% Hang the footnote text off the number. Use \everypar in case the |
6289 |
|
% footnote extends for more than one paragraph. |
6290 |
|
\everypar = {\hang}% |
6291 |
\textindent{\thisfootno}% |
\textindent{\thisfootno}% |
6292 |
% |
% |
6293 |
% Don't crash into the line above the footnote text. Since this |
% Don't crash into the line above the footnote text. Since this |
6296 |
\footstrut |
\footstrut |
6297 |
\futurelet\next\fo@t |
\futurelet\next\fo@t |
6298 |
} |
} |
|
\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t |
|
|
\else\let\next\f@t\fi \next} |
|
|
\def\f@@t{\bgroup\aftergroup\@foot\let\next} |
|
|
\def\f@t#1{#1\@foot} |
|
|
\def\@foot{\strut\egroup} |
|
|
|
|
6299 |
}%end \catcode `\@=11 |
}%end \catcode `\@=11 |
6300 |
|
|
6301 |
% Set the baselineskip to #1, and the lineskip and strut size |
% In case a @footnote appears in a vbox, save the footnote text and create |
6302 |
% correspondingly. There is no deep meaning behind these magic numbers |
% the real \insert just after the vbox finished. Otherwise, the insertion |
6303 |
% used as factors; they just match (closely enough) what Knuth defined. |
% would be lost. |
6304 |
% |
% Similarily, if a @footnote appears inside an alignment, save the footnote |
6305 |
\def\lineskipfactor{.08333} |
% text to a box and make the \insert when a row of the table is finished. |
6306 |
\def\strutheightpercent{.70833} |
% And the same can be done for other insert classes. --kasal, 16nov03. |
6307 |
\def\strutdepthpercent {.29167} |
|
6308 |
% |
% Replace the \insert primitive by a cheating macro. |
6309 |
\def\setleading#1{% |
% Deeper inside, just make sure that the saved insertions are not spilled |
6310 |
\normalbaselineskip = #1\relax |
% out prematurely. |
6311 |
\normallineskip = \lineskipfactor\normalbaselineskip |
% |
6312 |
\normalbaselines |
\def\startsavinginserts{% |
6313 |
\setbox\strutbox =\hbox{% |
\ifx \insert\ptexinsert |
6314 |
\vrule width0pt height\strutheightpercent\baselineskip |
\let\insert\saveinsert |
6315 |
depth \strutdepthpercent \baselineskip |
\else |
6316 |
}% |
\let\checkinserts\relax |
6317 |
|
\fi |
6318 |
} |
} |
6319 |
|
|
6320 |
% @| inserts a changebar to the left of the current line. It should |
% This \insert replacement works for both \insert\footins{foo} and |
6321 |
% surround any changed text. This approach does *not* work if the |
% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. |
|
% change spans more than two lines of output. To handle that, we would |
|
|
% have adopt a much more difficult approach (putting marks into the main |
|
|
% vertical list for the beginning and end of each change). |
|
6322 |
% |
% |
6323 |
\def\|{% |
\def\saveinsert#1{% |
6324 |
% \vadjust can only be used in horizontal mode. |
\edef\next{\noexpand\savetobox \makeSAVEname#1}% |
6325 |
\leavevmode |
\afterassignment\next |
6326 |
% |
% swallow the left brace |
6327 |
% Append this vertical mode material after the current line in the output. |
\let\temp = |
|
\vadjust{% |
|
|
% We want to insert a rule with the height and depth of the current |
|
|
% leading; that is exactly what \strutbox is supposed to record. |
|
|
\vskip-\baselineskip |
|
|
% |
|
|
% \vadjust-items are inserted at the left edge of the type. So |
|
|
% the \llap here moves out into the left-hand margin. |
|
|
\llap{% |
|
|
% |
|
|
% For a thicker or thinner bar, change the `1pt'. |
|
|
\vrule height\baselineskip width1pt |
|
|
% |
|
|
% This is the space between the bar and the text. |
|
|
\hskip 12pt |
|
|
}% |
|
|
}% |
|
6328 |
} |
} |
6329 |
|
\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} |
6330 |
|
\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} |
6331 |
|
|
6332 |
|
\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} |
6333 |
|
|
6334 |
|
\def\placesaveins#1{% |
6335 |
|
\ptexinsert \csname\expandafter\gobblesave\string#1\endcsname |
6336 |
|
{\box#1}% |
6337 |
|
} |
6338 |
|
|
6339 |
|
% eat @SAVE -- beware, all of them have catcode \other: |
6340 |
|
{ |
6341 |
|
\def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) |
6342 |
|
\gdef\gobblesave @SAVE{} |
6343 |
|
} |
6344 |
|
|
6345 |
|
% initialization: |
6346 |
|
\def\newsaveins #1{% |
6347 |
|
\edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% |
6348 |
|
\next |
6349 |
|
} |
6350 |
|
\def\newsaveinsX #1{% |
6351 |
|
\csname newbox\endcsname #1% |
6352 |
|
\expandafter\def\expandafter\checkinserts\expandafter{\checkinserts |
6353 |
|
\checksaveins #1}% |
6354 |
|
} |
6355 |
|
|
6356 |
|
% initialize: |
6357 |
|
\let\checkinserts\empty |
6358 |
|
\newsaveins\footins |
6359 |
|
\newsaveins\margin |
6360 |
|
|
|
% For a final copy, take out the rectangles |
|
|
% that mark overfull boxes (in case you have decided |
|
|
% that the text looks ok even though it passes the margin). |
|
|
% |
|
|
\def\finalout{\overfullrule=0pt} |
|
6361 |
|
|
6362 |
% @image. We use the macros from epsf.tex to support this. |
% @image. We use the macros from epsf.tex to support this. |
6363 |
% If epsf.tex is not installed and @image is used, we complain. |
% If epsf.tex is not installed and @image is used, we complain. |
6367 |
% undone and the next image would fail. |
% undone and the next image would fail. |
6368 |
\openin 1 = epsf.tex |
\openin 1 = epsf.tex |
6369 |
\ifeof 1 \else |
\ifeof 1 \else |
6370 |
\closein 1 |
% Do not bother showing banner with epsf.tex v2.7k (available in |
6371 |
% Do not bother showing banner with post-v2.7 epsf.tex (available in |
% doc/epsf.tex and on ctan). |
|
% doc/epsf.tex until it shows up on ctan). |
|
6372 |
\def\epsfannounce{\toks0 = }% |
\def\epsfannounce{\toks0 = }% |
6373 |
\input epsf.tex |
\input epsf.tex |
6374 |
\fi |
\fi |
6375 |
|
\closein 1 |
6376 |
% |
% |
6377 |
% We will only complain once about lack of epsf.tex. |
% We will only complain once about lack of epsf.tex. |
6378 |
\newif\ifwarnednoepsf |
\newif\ifwarnednoepsf |
6388 |
\global\warnednoepsftrue |
\global\warnednoepsftrue |
6389 |
\fi |
\fi |
6390 |
\else |
\else |
6391 |
\imagexxx #1,,,\finish |
\imagexxx #1,,,,,\finish |
6392 |
\fi |
\fi |
6393 |
} |
} |
6394 |
% |
% |
6395 |
% Arguments to @image: |
% Arguments to @image: |
6396 |
% #1 is (mandatory) image filename; we tack on .eps extension. |
% #1 is (mandatory) image filename; we tack on .eps extension. |
6397 |
% #2 is (optional) width, #3 is (optional) height. |
% #2 is (optional) width, #3 is (optional) height. |
6398 |
% #4 is just the usual extra ignored arg for parsing this stuff. |
% #4 is (ignored optional) html alt text. |
6399 |
\def\imagexxx#1,#2,#3,#4\finish{% |
% #5 is (ignored optional) extension. |
6400 |
\ifx\pdfoutput\undefined |
% #6 is just the usual extra ignored arg for parsing this stuff. |
6401 |
|
\newif\ifimagevmode |
6402 |
|
\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup |
6403 |
|
\catcode`\^^M = 5 % in case we're inside an example |
6404 |
|
\normalturnoffactive % allow _ et al. in names |
6405 |
|
% If the image is by itself, center it. |
6406 |
|
\ifvmode |
6407 |
|
\imagevmodetrue |
6408 |
|
\nobreak\bigskip |
6409 |
|
% Usually we'll have text after the image which will insert |
6410 |
|
% \parskip glue, so insert it here too to equalize the space |
6411 |
|
% above and below. |
6412 |
|
\nobreak\vskip\parskip |
6413 |
|
\nobreak |
6414 |
|
\line\bgroup\hss |
6415 |
|
\fi |
6416 |
|
% |
6417 |
|
% Output the image. |
6418 |
|
\ifpdf |
6419 |
|
\dopdfimage{#1}{#2}{#3}% |
6420 |
|
\else |
6421 |
% \epsfbox itself resets \epsf?size at each figure. |
% \epsfbox itself resets \epsf?size at each figure. |
6422 |
\setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi |
\setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi |
6423 |
\setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi |
\setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi |
6424 |
\begingroup |
\epsfbox{#1.eps}% |
6425 |
\catcode`\^^M = 5 % in case we're inside an example |
\fi |
6426 |
% If the image is by itself, center it. |
% |
6427 |
\ifvmode |
\ifimagevmode \hss \egroup \bigbreak \fi % space after the image |
6428 |
\nobreak\bigskip |
\endgroup} |
6429 |
% Usually we'll have text after the image which will insert |
|
6430 |
% \parskip glue, so insert it here too to equalize the space |
|
6431 |
% above and below. |
% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, |
6432 |
\nobreak\vskip\parskip |
% etc. We don't actually implement floating yet, we always include the |
6433 |
\nobreak |
% float "here". But it seemed the best name for the future. |
6434 |
\centerline{\epsfbox{#1.eps}}% |
% |
6435 |
\bigbreak |
\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} |
6436 |
\else |
|
6437 |
% In the middle of a paragraph, no extra space. |
% There may be a space before second and/or third parameter; delete it. |
6438 |
\epsfbox{#1.eps}% |
\def\eatcommaspace#1, {#1,} |
6439 |
|
|
6440 |
|
% #1 is the optional FLOATTYPE, the text label for this float, typically |
6441 |
|
% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, |
6442 |
|
% this float will not be numbered and cannot be referred to. |
6443 |
|
% |
6444 |
|
% #2 is the optional xref label. Also must be present for the float to |
6445 |
|
% be referable. |
6446 |
|
% |
6447 |
|
% #3 is the optional positioning argument; for now, it is ignored. It |
6448 |
|
% will somehow specify the positions allowed to float to (here, top, bottom). |
6449 |
|
% |
6450 |
|
% We keep a separate counter for each FLOATTYPE, which we reset at each |
6451 |
|
% chapter-level command. |
6452 |
|
\let\resetallfloatnos=\empty |
6453 |
|
% |
6454 |
|
\def\dofloat#1,#2,#3,#4\finish{% |
6455 |
|
\let\thiscaption=\empty |
6456 |
|
\let\thisshortcaption=\empty |
6457 |
|
% |
6458 |
|
% don't lose footnotes inside @float. |
6459 |
|
% |
6460 |
|
% BEWARE: when the floats start float, we have to issue warning whenever an |
6461 |
|
% insert appears inside a float which could possibly float. --kasal, 26may04 |
6462 |
|
% |
6463 |
|
\startsavinginserts |
6464 |
|
% |
6465 |
|
% We can't be used inside a paragraph. |
6466 |
|
\par |
6467 |
|
% |
6468 |
|
\vtop\bgroup |
6469 |
|
\def\floattype{#1}% |
6470 |
|
\def\floatlabel{#2}% |
6471 |
|
\def\floatloc{#3}% we do nothing with this yet. |
6472 |
|
% |
6473 |
|
\ifx\floattype\empty |
6474 |
|
\let\safefloattype=\empty |
6475 |
|
\else |
6476 |
|
{% |
6477 |
|
% the floattype might have accents or other special characters, |
6478 |
|
% but we need to use it in a control sequence name. |
6479 |
|
\indexnofonts |
6480 |
|
\turnoffactive |
6481 |
|
\xdef\safefloattype{\floattype}% |
6482 |
|
}% |
6483 |
|
\fi |
6484 |
|
% |
6485 |
|
% If label is given but no type, we handle that as the empty type. |
6486 |
|
\ifx\floatlabel\empty \else |
6487 |
|
% We want each FLOATTYPE to be numbered separately (Figure 1, |
6488 |
|
% Table 1, Figure 2, ...). (And if no label, no number.) |
6489 |
|
% |
6490 |
|
\expandafter\getfloatno\csname\safefloattype floatno\endcsname |
6491 |
|
\global\advance\floatno by 1 |
6492 |
|
% |
6493 |
|
{% |
6494 |
|
% This magic value for \thissection is output by \setref as the |
6495 |
|
% XREFLABEL-title value. \xrefX uses it to distinguish float |
6496 |
|
% labels (which have a completely different output format) from |
6497 |
|
% node and anchor labels. And \xrdef uses it to construct the |
6498 |
|
% lists of floats. |
6499 |
|
% |
6500 |
|
\edef\thissection{\floatmagic=\safefloattype}% |
6501 |
|
\setref{\floatlabel}{Yfloat}% |
6502 |
|
}% |
6503 |
|
\fi |
6504 |
|
% |
6505 |
|
% start with \parskip glue, I guess. |
6506 |
|
\vskip\parskip |
6507 |
|
% |
6508 |
|
% Don't suppress indentation if a float happens to start a section. |
6509 |
|
\restorefirstparagraphindent |
6510 |
|
} |
6511 |
|
|
6512 |
|
% we have these possibilities: |
6513 |
|
% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap |
6514 |
|
% @float Foo,lbl & no caption: Foo 1.1 |
6515 |
|
% @float Foo & @caption{Cap}: Foo: Cap |
6516 |
|
% @float Foo & no caption: Foo |
6517 |
|
% @float ,lbl & Caption{Cap}: 1.1: Cap |
6518 |
|
% @float ,lbl & no caption: 1.1 |
6519 |
|
% @float & @caption{Cap}: Cap |
6520 |
|
% @float & no caption: |
6521 |
|
% |
6522 |
|
\def\Efloat{% |
6523 |
|
\let\floatident = \empty |
6524 |
|
% |
6525 |
|
% In all cases, if we have a float type, it comes first. |
6526 |
|
\ifx\floattype\empty \else \def\floatident{\floattype}\fi |
6527 |
|
% |
6528 |
|
% If we have an xref label, the number comes next. |
6529 |
|
\ifx\floatlabel\empty \else |
6530 |
|
\ifx\floattype\empty \else % if also had float type, need tie first. |
6531 |
|
\appendtomacro\floatident{\tie}% |
6532 |
\fi |
\fi |
6533 |
\endgroup |
% the number. |
6534 |
|
\appendtomacro\floatident{\chaplevelprefix\the\floatno}% |
6535 |
|
\fi |
6536 |
|
% |
6537 |
|
% Start the printed caption with what we've constructed in |
6538 |
|
% \floatident, but keep it separate; we need \floatident again. |
6539 |
|
\let\captionline = \floatident |
6540 |
|
% |
6541 |
|
\ifx\thiscaption\empty \else |
6542 |
|
\ifx\floatident\empty \else |
6543 |
|
\appendtomacro\captionline{: }% had ident, so need a colon between |
6544 |
|
\fi |
6545 |
|
% |
6546 |
|
% caption text. |
6547 |
|
\appendtomacro\captionline{\scanexp\thiscaption}% |
6548 |
|
\fi |
6549 |
|
% |
6550 |
|
% If we have anything to print, print it, with space before. |
6551 |
|
% Eventually this needs to become an \insert. |
6552 |
|
\ifx\captionline\empty \else |
6553 |
|
\vskip.5\parskip |
6554 |
|
\captionline |
6555 |
|
% |
6556 |
|
% Space below caption. |
6557 |
|
\vskip\parskip |
6558 |
|
\fi |
6559 |
|
% |
6560 |
|
% If have an xref label, write the list of floats info. Do this |
6561 |
|
% after the caption, to avoid chance of it being a breakpoint. |
6562 |
|
\ifx\floatlabel\empty \else |
6563 |
|
% Write the text that goes in the lof to the aux file as |
6564 |
|
% \floatlabel-lof. Besides \floatident, we include the short |
6565 |
|
% caption if specified, else the full caption if specified, else nothing. |
6566 |
|
{% |
6567 |
|
\atdummies \turnoffactive \otherbackslash |
6568 |
|
% since we read the caption text in the macro world, where ^^M |
6569 |
|
% is turned into a normal character, we have to scan it back, so |
6570 |
|
% we don't write the literal three characters "^^M" into the aux file. |
6571 |
|
\scanexp{% |
6572 |
|
\xdef\noexpand\gtemp{% |
6573 |
|
\ifx\thisshortcaption\empty |
6574 |
|
\thiscaption |
6575 |
|
\else |
6576 |
|
\thisshortcaption |
6577 |
|
\fi |
6578 |
|
}% |
6579 |
|
}% |
6580 |
|
\immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident |
6581 |
|
\ifx\gtemp\empty \else : \gtemp \fi}}% |
6582 |
|
}% |
6583 |
|
\fi |
6584 |
|
\egroup % end of \vtop |
6585 |
|
% |
6586 |
|
% place the captured inserts |
6587 |
|
% |
6588 |
|
% BEWARE: when the floats start float, we have to issue warning whenever an |
6589 |
|
% insert appears inside a float which could possibly float. --kasal, 26may04 |
6590 |
|
% |
6591 |
|
\checkinserts |
6592 |
|
} |
6593 |
|
|
6594 |
|
% Append the tokens #2 to the definition of macro #1, not expanding either. |
6595 |
|
% |
6596 |
|
\def\appendtomacro#1#2{% |
6597 |
|
\expandafter\def\expandafter#1\expandafter{#1#2}% |
6598 |
|
} |
6599 |
|
|
6600 |
|
% @caption, @shortcaption |
6601 |
|
% |
6602 |
|
\def\caption{\docaption\thiscaption} |
6603 |
|
\def\shortcaption{\docaption\thisshortcaption} |
6604 |
|
\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} |
6605 |
|
\def\defcaption#1#2{\egroup \def#1{#2}} |
6606 |
|
|
6607 |
|
% The parameter is the control sequence identifying the counter we are |
6608 |
|
% going to use. Create it if it doesn't exist and assign it to \floatno. |
6609 |
|
\def\getfloatno#1{% |
6610 |
|
\ifx#1\relax |
6611 |
|
% Haven't seen this figure type before. |
6612 |
|
\csname newcount\endcsname #1% |
6613 |
|
% |
6614 |
|
% Remember to reset this floatno at the next chap. |
6615 |
|
\expandafter\gdef\expandafter\resetallfloatnos |
6616 |
|
\expandafter{\resetallfloatnos #1=0 }% |
6617 |
|
\fi |
6618 |
|
\let\floatno#1% |
6619 |
|
} |
6620 |
|
|
6621 |
|
% \setref calls this to get the XREFLABEL-snt value. We want an @xref |
6622 |
|
% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we |
6623 |
|
% first read the @float command. |
6624 |
|
% |
6625 |
|
\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% |
6626 |
|
|
6627 |
|
% Magic string used for the XREFLABEL-title value, so \xrefX can |
6628 |
|
% distinguish floats from other xref types. |
6629 |
|
\def\floatmagic{!!float!!} |
6630 |
|
|
6631 |
|
% #1 is the control sequence we are passed; we expand into a conditional |
6632 |
|
% which is true if #1 represents a float ref. That is, the magic |
6633 |
|
% \thissection value which we \setref above. |
6634 |
|
% |
6635 |
|
\def\iffloat#1{\expandafter\doiffloat#1==\finish} |
6636 |
|
% |
6637 |
|
% #1 is (maybe) the \floatmagic string. If so, #2 will be the |
6638 |
|
% (safe) float type for this float. We set \iffloattype to #2. |
6639 |
|
% |
6640 |
|
\def\doiffloat#1=#2=#3\finish{% |
6641 |
|
\def\temp{#1}% |
6642 |
|
\def\iffloattype{#2}% |
6643 |
|
\ifx\temp\floatmagic |
6644 |
|
} |
6645 |
|
|
6646 |
|
% @listoffloats FLOATTYPE - print a list of floats like a table of contents. |
6647 |
|
% |
6648 |
|
\parseargdef\listoffloats{% |
6649 |
|
\def\floattype{#1}% floattype |
6650 |
|
{% |
6651 |
|
% the floattype might have accents or other special characters, |
6652 |
|
% but we need to use it in a control sequence name. |
6653 |
|
\indexnofonts |
6654 |
|
\turnoffactive |
6655 |
|
\xdef\safefloattype{\floattype}% |
6656 |
|
}% |
6657 |
|
% |
6658 |
|
% \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. |
6659 |
|
\expandafter\ifx\csname floatlist\safefloattype\endcsname \relax |
6660 |
|
\ifhavexrefs |
6661 |
|
% if the user said @listoffloats foo but never @float foo. |
6662 |
|
\message{\linenumber No `\safefloattype' floats to list.}% |
6663 |
|
\fi |
6664 |
\else |
\else |
6665 |
\centerline{\pdfimage #1.pdf}% |
\begingroup |
6666 |
|
\leftskip=\tocindent % indent these entries like a toc |
6667 |
|
\let\do=\listoffloatsdo |
6668 |
|
\csname floatlist\safefloattype\endcsname |
6669 |
|
\endgroup |
6670 |
\fi |
\fi |
6671 |
} |
} |
6672 |
|
|
6673 |
|
% This is called on each entry in a list of floats. We're passed the |
6674 |
|
% xref label, in the form LABEL-title, which is how we save it in the |
6675 |
|
% aux file. We strip off the -title and look up \XRLABEL-lof, which |
6676 |
|
% has the text we're supposed to typeset here. |
6677 |
|
% |
6678 |
|
% Figures without xref labels will not be included in the list (since |
6679 |
|
% they won't appear in the aux file). |
6680 |
|
% |
6681 |
|
\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} |
6682 |
|
\def\listoffloatsdoentry#1-title\finish{{% |
6683 |
|
% Can't fully expand XR#1-lof because it can contain anything. Just |
6684 |
|
% pass the control sequence. On the other hand, XR#1-pg is just the |
6685 |
|
% page number, and we want to fully expand that so we can get a link |
6686 |
|
% in pdf output. |
6687 |
|
\toksA = \expandafter{\csname XR#1-lof\endcsname}% |
6688 |
|
% |
6689 |
|
% use the same \entry macro we use to generate the TOC and index. |
6690 |
|
\edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% |
6691 |
|
\writeentry |
6692 |
|
}} |
6693 |
|
|
6694 |
\message{localization,} |
\message{localization,} |
6695 |
|
% and i18n. |
6696 |
|
|
6697 |
% @documentlanguage is usually given very early, just after |
% @documentlanguage is usually given very early, just after |
6698 |
% @setfilename. If done too late, it may not override everything |
% @setfilename. If done too late, it may not override everything |
6699 |
% properly. Single argument is the language abbreviation. |
% properly. Single argument is the language abbreviation. |
6700 |
% It would be nice if we could set up a hyphenation file here. |
% It would be nice if we could set up a hyphenation file here. |
6701 |
% |
% |
6702 |
\def\documentlanguage{\parsearg\dodocumentlanguage} |
\parseargdef\documentlanguage{% |
|
\def\dodocumentlanguage#1{% |
|
6703 |
\tex % read txi-??.tex file in plain TeX. |
\tex % read txi-??.tex file in plain TeX. |
6704 |
% Read the file if it exists. |
% Read the file if it exists. |
6705 |
\openin 1 txi-#1.tex |
\openin 1 txi-#1.tex |
6706 |
\ifeof1 |
\ifeof 1 |
6707 |
\errhelp = \nolanghelp |
\errhelp = \nolanghelp |
6708 |
\errmessage{Cannot read language file txi-#1.tex}% |
\errmessage{Cannot read language file txi-#1.tex}% |
6709 |
\let\temp = \relax |
\else |
6710 |
\else |
\input txi-#1.tex |
6711 |
\def\temp{\input txi-#1.tex }% |
\fi |
6712 |
\fi |
\closein 1 |
|
\temp |
|
6713 |
\endgroup |
\endgroup |
6714 |
} |
} |
6715 |
\newhelp\nolanghelp{The given language definition file cannot be found or |
\newhelp\nolanghelp{The given language definition file cannot be found or |
6750 |
% Allow us to assign to \emergencystretch anyway. |
% Allow us to assign to \emergencystretch anyway. |
6751 |
\def\emergencystretch{\dimen0}% |
\def\emergencystretch{\dimen0}% |
6752 |
\else |
\else |
6753 |
\emergencystretch = \hsize |
\emergencystretch = .15\hsize |
|
\divide\emergencystretch by 40 |
|
6754 |
\fi |
\fi |
6755 |
} |
} |
6756 |
|
|
6757 |
% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; |
% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; |
6758 |
% 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can |
% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8) |
6759 |
% set \parskip and call \setleading for \baselineskip. |
% physical page width. |
6760 |
% |
% |
6761 |
\def\internalpagesizes#1#2#3#4#5#6{% |
% We also call \setleading{\textleading}, so the caller should define |
6762 |
|
% \textleading. The caller should also set \parskip. |
6763 |
|
% |
6764 |
|
\def\internalpagesizes#1#2#3#4#5#6#7#8{% |
6765 |
\voffset = #3\relax |
\voffset = #3\relax |
6766 |
\topskip = #6\relax |
\topskip = #6\relax |
6767 |
\splittopskip = \topskip |
\splittopskip = \topskip |
6780 |
\normaloffset = #4\relax |
\normaloffset = #4\relax |
6781 |
\bindingoffset = #5\relax |
\bindingoffset = #5\relax |
6782 |
% |
% |
6783 |
|
\ifpdf |
6784 |
|
\pdfpageheight #7\relax |
6785 |
|
\pdfpagewidth #8\relax |
6786 |
|
\fi |
6787 |
|
% |
6788 |
|
\setleading{\textleading} |
6789 |
|
% |
6790 |
\parindent = \defaultparindent |
\parindent = \defaultparindent |
6791 |
\setemergencystretch |
\setemergencystretch |
6792 |
} |
} |
6794 |
% @letterpaper (the default). |
% @letterpaper (the default). |
6795 |
\def\letterpaper{{\globaldefs = 1 |
\def\letterpaper{{\globaldefs = 1 |
6796 |
\parskip = 3pt plus 2pt minus 1pt |
\parskip = 3pt plus 2pt minus 1pt |
6797 |
\setleading{13.2pt}% |
\textleading = 13.2pt |
6798 |
% |
% |
6799 |
% If page is nothing but text, make it come out even. |
% If page is nothing but text, make it come out even. |
6800 |
\internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}% |
\internalpagesizes{46\baselineskip}{6in}% |
6801 |
|
{\voffset}{.25in}% |
6802 |
|
{\bindingoffset}{36pt}% |
6803 |
|
{11in}{8.5in}% |
6804 |
}} |
}} |
6805 |
|
|
6806 |
% Use @smallbook to reset parameters for 7x9.5 (or so) format. |
% Use @smallbook to reset parameters for 7x9.5 (or so) format. |
6807 |
\def\smallbook{{\globaldefs = 1 |
\def\smallbook{{\globaldefs = 1 |
6808 |
\parskip = 2pt plus 1pt |
\parskip = 2pt plus 1pt |
6809 |
\setleading{12pt}% |
\textleading = 12pt |
6810 |
% |
% |
6811 |
\internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}% |
\internalpagesizes{7.5in}{5in}% |
6812 |
|
{\voffset}{.25in}% |
6813 |
|
{\bindingoffset}{16pt}% |
6814 |
|
{9.25in}{7in}% |
6815 |
% |
% |
6816 |
\lispnarrowing = 0.3in |
\lispnarrowing = 0.3in |
6817 |
\tolerance = 700 |
\tolerance = 700 |
6818 |
\hfuzz = 1pt |
\hfuzz = 1pt |
6819 |
\contentsrightmargin = 0pt |
\contentsrightmargin = 0pt |
|
\deftypemargin = 0pt |
|
6820 |
\defbodyindent = .5cm |
\defbodyindent = .5cm |
|
% |
|
|
\let\smalldisplay = \smalldisplayx |
|
|
\let\smallexample = \smalllispx |
|
|
\let\smallformat = \smallformatx |
|
|
\let\smalllisp = \smalllispx |
|
6821 |
}} |
}} |
6822 |
|
|
6823 |
% Use @afourpaper to print on European A4 paper. |
% Use @afourpaper to print on European A4 paper. |
6824 |
\def\afourpaper{{\globaldefs = 1 |
\def\afourpaper{{\globaldefs = 1 |
|
\setleading{12pt}% |
|
6825 |
\parskip = 3pt plus 2pt minus 1pt |
\parskip = 3pt plus 2pt minus 1pt |
6826 |
|
\textleading = 13.2pt |
6827 |
% |
% |
6828 |
\internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}% |
% Double-side printing via postscript on Laserjet 4050 |
6829 |
|
% prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. |
6830 |
|
% To change the settings for a different printer or situation, adjust |
6831 |
|
% \normaloffset until the front-side and back-side texts align. Then |
6832 |
|
% do the same for \bindingoffset. You can set these for testing in |
6833 |
|
% your texinfo source file like this: |
6834 |
|
% @tex |
6835 |
|
% \global\normaloffset = -6mm |
6836 |
|
% \global\bindingoffset = 10mm |
6837 |
|
% @end tex |
6838 |
|
\internalpagesizes{51\baselineskip}{160mm} |
6839 |
|
{\voffset}{\hoffset}% |
6840 |
|
{\bindingoffset}{44pt}% |
6841 |
|
{297mm}{210mm}% |
6842 |
% |
% |
6843 |
\tolerance = 700 |
\tolerance = 700 |
6844 |
\hfuzz = 1pt |
\hfuzz = 1pt |
6845 |
|
\contentsrightmargin = 0pt |
6846 |
|
\defbodyindent = 5mm |
6847 |
}} |
}} |
6848 |
|
|
6849 |
% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin |
% Use @afivepaper to print on European A5 paper. |
6850 |
% 29mm, hence bottom margin 28mm, nominal side margin 3cm. |
% From romildo@urano.iceb.ufop.br, 2 July 2000. |
6851 |
|
% He also recommends making @example and @lisp be small. |
6852 |
|
\def\afivepaper{{\globaldefs = 1 |
6853 |
|
\parskip = 2pt plus 1pt minus 0.1pt |
6854 |
|
\textleading = 12.5pt |
6855 |
|
% |
6856 |
|
\internalpagesizes{160mm}{120mm}% |
6857 |
|
{\voffset}{\hoffset}% |
6858 |
|
{\bindingoffset}{8pt}% |
6859 |
|
{210mm}{148mm}% |
6860 |
|
% |
6861 |
|
\lispnarrowing = 0.2in |
6862 |
|
\tolerance = 800 |
6863 |
|
\hfuzz = 1.2pt |
6864 |
|
\contentsrightmargin = 0pt |
6865 |
|
\defbodyindent = 2mm |
6866 |
|
\tableindent = 12mm |
6867 |
|
}} |
6868 |
|
|
6869 |
|
% A specific text layout, 24x15cm overall, intended for A4 paper. |
6870 |
\def\afourlatex{{\globaldefs = 1 |
\def\afourlatex{{\globaldefs = 1 |
|
\setleading{13.6pt}% |
|
|
% |
|
6871 |
\afourpaper |
\afourpaper |
6872 |
\internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}% |
\internalpagesizes{237mm}{150mm}% |
6873 |
|
{\voffset}{4.6mm}% |
6874 |
|
{\bindingoffset}{7mm}% |
6875 |
|
{297mm}{210mm}% |
6876 |
% |
% |
6877 |
|
% Must explicitly reset to 0 because we call \afourpaper. |
6878 |
\globaldefs = 0 |
\globaldefs = 0 |
6879 |
}} |
}} |
6880 |
|
|
6881 |
% Use @afourwide to print on European A4 paper in wide format. |
% Use @afourwide to print on A4 paper in landscape format. |
6882 |
\def\afourwide{% |
\def\afourwide{{\globaldefs = 1 |
6883 |
\afourpaper |
\afourpaper |
6884 |
\internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}% |
\internalpagesizes{241mm}{165mm}% |
6885 |
% |
{\voffset}{-2.95mm}% |
6886 |
|
{\bindingoffset}{7mm}% |
6887 |
|
{297mm}{210mm}% |
6888 |
\globaldefs = 0 |
\globaldefs = 0 |
6889 |
} |
}} |
6890 |
|
|
6891 |
% @pagesizes TEXTHEIGHT[,TEXTWIDTH] |
% @pagesizes TEXTHEIGHT[,TEXTWIDTH] |
6892 |
% Perhaps we should allow setting the margins, \topskip, \parskip, |
% Perhaps we should allow setting the margins, \topskip, \parskip, |
6893 |
% and/or leading, also. Or perhaps we should compute them somehow. |
% and/or leading, also. Or perhaps we should compute them somehow. |
6894 |
% |
% |
6895 |
\def\pagesizes{\parsearg\pagesizesxxx} |
\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} |
|
\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish} |
|
6896 |
\def\pagesizesyyy#1,#2,#3\finish{{% |
\def\pagesizesyyy#1,#2,#3\finish{{% |
6897 |
\setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi |
\setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi |
6898 |
\globaldefs = 1 |
\globaldefs = 1 |
6899 |
% |
% |
6900 |
\parskip = 3pt plus 2pt minus 1pt |
\parskip = 3pt plus 2pt minus 1pt |
6901 |
\setleading{13.2pt}% |
\setleading{\textleading}% |
6902 |
|
% |
6903 |
|
\dimen0 = #1 |
6904 |
|
\advance\dimen0 by \voffset |
6905 |
|
% |
6906 |
|
\dimen2 = \hsize |
6907 |
|
\advance\dimen2 by \normaloffset |
6908 |
% |
% |
6909 |
\internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}% |
\internalpagesizes{#1}{\hsize}% |
6910 |
|
{\voffset}{\normaloffset}% |
6911 |
|
{\bindingoffset}{44pt}% |
6912 |
|
{\dimen0}{\dimen2}% |
6913 |
}} |
}} |
6914 |
|
|
6915 |
% Set default to letter. |
% Set default to letter. |
6916 |
% |
% |
6917 |
\letterpaper |
\letterpaper |
6918 |
|
|
6919 |
|
|
6920 |
\message{and turning on texinfo input format.} |
\message{and turning on texinfo input format.} |
6921 |
|
|
6922 |
% Define macros to output various characters with catcode for normal text. |
% Define macros to output various characters with catcode for normal text. |
6937 |
\def\normalless{<} |
\def\normalless{<} |
6938 |
\def\normalgreater{>} |
\def\normalgreater{>} |
6939 |
\def\normalplus{+} |
\def\normalplus{+} |
6940 |
\def\normaldollar{$} |
\def\normaldollar{$}%$ font-lock fix |
6941 |
|
|
6942 |
% This macro is used to make a character print one way in ttfont |
% This macro is used to make a character print one way in \tt |
6943 |
% where it can probably just be output, and another way in other fonts, |
% (where it can probably be output as-is), and another way in other fonts, |
6944 |
% where something hairier probably needs to be done. |
% where something hairier probably needs to be done. |
6945 |
% |
% |
6946 |
% #1 is what to print if we are indeed using \tt; #2 is what to print |
% #1 is what to print if we are indeed using \tt; #2 is what to print |
6973 |
\catcode`\_=\active |
\catcode`\_=\active |
6974 |
\def_{\ifusingtt\normalunderscore\_} |
\def_{\ifusingtt\normalunderscore\_} |
6975 |
% Subroutine for the previous macro. |
% Subroutine for the previous macro. |
6976 |
\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} |
\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } |
6977 |
|
|
6978 |
\catcode`\|=\active |
\catcode`\|=\active |
6979 |
\def|{{\tt\char124}} |
\def|{{\tt\char124}} |
6986 |
\catcode`\+=\active |
\catcode`\+=\active |
6987 |
\def+{{\tt \char 43}} |
\def+{{\tt \char 43}} |
6988 |
\catcode`\$=\active |
\catcode`\$=\active |
6989 |
\def${\ifusingit{{\sl\$}}\normaldollar} |
\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix |
|
%\catcode 27=\active |
|
|
%\def^^[{$\diamondsuit$} |
|
|
|
|
|
% Set up an active definition for =, but don't enable it most of the time. |
|
|
{\catcode`\==\active |
|
|
\global\def={{\tt \char 61}}} |
|
|
|
|
|
\catcode`+=\active |
|
|
\catcode`\_=\active |
|
6990 |
|
|
6991 |
% If a .fmt file is being used, characters that might appear in a file |
% If a .fmt file is being used, characters that might appear in a file |
6992 |
% name cannot be active until we have parsed the command line. |
% name cannot be active until we have parsed the command line. |
6996 |
|
|
6997 |
\catcode`\@=0 |
\catcode`\@=0 |
6998 |
|
|
6999 |
% \rawbackslashxx output one backslash character in current font |
% \backslashcurfont outputs one backslash character in current font, |
7000 |
\global\chardef\rawbackslashxx=`\\ |
% as in \char`\\. |
7001 |
%{\catcode`\\=\other |
\global\chardef\backslashcurfont=`\\ |
7002 |
%@gdef@rawbackslashxx{\}} |
\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work |
7003 |
|
|
7004 |
% \rawbackslash redefines \ as input to do \rawbackslashxx. |
% \rawbackslash defines an active \ to do \backslashcurfont. |
7005 |
|
% \otherbackslash defines an active \ to be a literal `\' character with |
7006 |
|
% catcode other. |
7007 |
{\catcode`\\=\active |
{\catcode`\\=\active |
7008 |
@gdef@rawbackslash{@let\=@rawbackslashxx }} |
@gdef@rawbackslash{@let\=@backslashcurfont} |
7009 |
|
@gdef@otherbackslash{@let\=@realbackslash} |
7010 |
|
} |
7011 |
|
|
7012 |
|
% \realbackslash is an actual character `\' with catcode other. |
7013 |
|
{\catcode`\\=\other @gdef@realbackslash{\}} |
7014 |
|
|
7015 |
% \normalbackslash outputs one backslash in fixed width font. |
% \normalbackslash outputs one backslash in fixed width font. |
7016 |
\def\normalbackslash{{\tt\rawbackslashxx}} |
\def\normalbackslash{{\tt\backslashcurfont}} |
7017 |
|
|
|
% \catcode 17=0 % Define control-q |
|
7018 |
\catcode`\\=\active |
\catcode`\\=\active |
7019 |
|
|
7020 |
% Used sometimes to turn off (effectively) the active characters |
% Used sometimes to turn off (effectively) the active characters |
7021 |
% even after parsing them. |
% even after parsing them. |
7022 |
@def@turnoffactive{@let"=@normaldoublequote |
@def@turnoffactive{% |
7023 |
@let\=@realbackslash |
@let"=@normaldoublequote |
7024 |
@let~=@normaltilde |
@let\=@realbackslash |
7025 |
@let^=@normalcaret |
@let~=@normaltilde |
7026 |
@let_=@normalunderscore |
@let^=@normalcaret |
7027 |
@let|=@normalverticalbar |
@let_=@normalunderscore |
7028 |
@let<=@normalless |
@let|=@normalverticalbar |
7029 |
@let>=@normalgreater |
@let<=@normalless |
7030 |
@let+=@normalplus |
@let>=@normalgreater |
7031 |
@let$=@normaldollar} |
@let+=@normalplus |
7032 |
|
@let$=@normaldollar %$ font-lock fix |
7033 |
@def@normalturnoffactive{@let"=@normaldoublequote |
@unsepspaces |
7034 |
@let\=@normalbackslash |
} |
7035 |
@let~=@normaltilde |
|
7036 |
@let^=@normalcaret |
% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of |
7037 |
@let_=@normalunderscore |
% the literal character `\'. (Thus, \ is not expandable when this is in |
7038 |
@let|=@normalverticalbar |
% effect.) |
7039 |
@let<=@normalless |
% |
7040 |
@let>=@normalgreater |
@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} |
|
@let+=@normalplus |
|
|
@let$=@normaldollar} |
|
7041 |
|
|
7042 |
% Make _ and + \other characters, temporarily. |
% Make _ and + \other characters, temporarily. |
7043 |
% This is canceled by @fixbackslash. |
% This is canceled by @fixbackslash. |
7065 |
% Say @foo, not \foo, in error messages. |
% Say @foo, not \foo, in error messages. |
7066 |
@escapechar = `@@ |
@escapechar = `@@ |
7067 |
|
|
7068 |
% These look ok in all fonts, so just make them not special. |
% These look ok in all fonts, so just make them not special. |
7069 |
@catcode`@& = @other |
@catcode`@& = @other |
7070 |
@catcode`@# = @other |
@catcode`@# = @other |
7071 |
@catcode`@% = @other |
@catcode`@% = @other |
7072 |
|
|
|
@c Set initial fonts. |
|
|
@textfonts |
|
|
@rm |
|
|
|
|
7073 |
|
|
7074 |
@c Local variables: |
@c Local variables: |
7075 |
@c eval: (add-hook 'write-file-hooks 'time-stamp) |
@c eval: (add-hook 'write-file-hooks 'time-stamp) |
7076 |
@c page-delimiter: "^\\\\message" |
@c page-delimiter: "^\\\\message" |
7077 |
@c time-stamp-start: "def\\\\texinfoversion{" |
@c time-stamp-start: "def\\\\texinfoversion{" |
7078 |
@c time-stamp-format: "%:y-%02m-%02d.%H" |
@c time-stamp-format: "%:y-%02m-%02d.%02H" |
7079 |
@c time-stamp-end: "}" |
@c time-stamp-end: "}" |
7080 |
@c End: |
@c End: |
7081 |
|
|
7082 |
|
@c vim:sw=2: |
7083 |
|
|
7084 |
|
@ignore |
7085 |
|
arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 |
7086 |
|
@end ignore |