diff options
| author | Robert J. Chassell | 2006-08-21 14:22:22 +0000 |
|---|---|---|
| committer | Robert J. Chassell | 2006-08-21 14:22:22 +0000 |
| commit | b22e5ea8ef609577dd48502897aa5d4fb49655fe (patch) | |
| tree | 64df6158188c5e537ed4d76a1237bfc422b91edd | |
| parent | f73858ce4d4658fed5130a9d748f695e1b25c727 (diff) | |
| download | emacs-b22e5ea8ef609577dd48502897aa5d4fb49655fe.tar.gz emacs-b22e5ea8ef609577dd48502897aa5d4fb49655fe.zip | |
* lispintro/texinfo.tex: changed to version 2006-02-13.16
to enable a DVI build using the more recent versions of TeX.
| -rw-r--r-- | lispintro/texinfo.tex | 6159 |
1 files changed, 3304 insertions, 2855 deletions
diff --git a/lispintro/texinfo.tex b/lispintro/texinfo.tex index e960fb32992..dddd0140ff0 100644 --- a/lispintro/texinfo.tex +++ b/lispintro/texinfo.tex | |||
| @@ -3,10 +3,11 @@ | |||
| 3 | % Load plain if necessary, i.e., if running under initex. | 3 | % Load plain if necessary, i.e., if running under initex. |
| 4 | \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi | 4 | \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi |
| 5 | % | 5 | % |
| 6 | \def\texinfoversion{2003-12-30.09} | 6 | \def\texinfoversion{2006-02-13.16} |
| 7 | % | 7 | % |
| 8 | % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, | 8 | % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, |
| 9 | % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. | 9 | % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free |
| 10 | % Software Foundation, Inc. | ||
| 10 | % | 11 | % |
| 11 | % This texinfo.tex file is free software; you can redistribute it and/or | 12 | % This texinfo.tex file is free software; you can redistribute it and/or |
| 12 | % modify it under the terms of the GNU General Public License as | 13 | % modify it under the terms of the GNU General Public License as |
| @@ -23,21 +24,16 @@ | |||
| 23 | % to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 24 | % to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 24 | % Boston, MA 02110-1301, USA. | 25 | % Boston, MA 02110-1301, USA. |
| 25 | % | 26 | % |
| 26 | % In other words, you are welcome to use, share and improve this program. | 27 | % As a special exception, when this file is read by TeX when processing |
| 27 | % You are forbidden to forbid anyone else to use, share and improve | 28 | % a Texinfo source document, you may use the result without |
| 28 | % what you give them. Help stamp out software-hoarding! | 29 | % restriction. (This has been our intent since Texinfo was invented.) |
| 29 | % | 30 | % |
| 30 | % Please try the latest version of texinfo.tex before submitting bug | 31 | % Please try the latest version of texinfo.tex before submitting bug |
| 31 | % reports; you can get the latest version from: | 32 | % reports; you can get the latest version from: |
| 32 | % ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex | 33 | % http://www.gnu.org/software/texinfo/ (the Texinfo home page), or |
| 33 | % (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) | ||
| 34 | % ftp://tug.org/tex/texinfo.tex | 34 | % ftp://tug.org/tex/texinfo.tex |
| 35 | % (and all CTAN mirrors, see http://www.ctan.org), | 35 | % (and all CTAN mirrors, see http://www.ctan.org). |
| 36 | % and /home/gd/gnu/doc/texinfo.tex on the GNU machines. | 36 | % The texinfo.tex in any given distribution could well be out |
| 37 | % | ||
| 38 | % The GNU Texinfo home page is http://www.gnu.org/software/texinfo. | ||
| 39 | % | ||
| 40 | % The texinfo.tex in any given Texinfo distribution could well be out | ||
| 41 | % of date, so if that's what you're using, please check. | 37 | % of date, so if that's what you're using, please check. |
| 42 | % | 38 | % |
| 43 | % Send bug reports to bug-texinfo@gnu.org. Please include including a | 39 | % Send bug reports to bug-texinfo@gnu.org. Please include including a |
| @@ -59,6 +55,9 @@ | |||
| 59 | % It is possible to adapt texinfo.tex for other languages, to some | 55 | % It is possible to adapt texinfo.tex for other languages, to some |
| 60 | % extent. You can get the existing language-specific files from the | 56 | % extent. You can get the existing language-specific files from the |
| 61 | % full Texinfo distribution. | 57 | % full Texinfo distribution. |
| 58 | % | ||
| 59 | % The GNU Texinfo home page is http://www.gnu.org/software/texinfo. | ||
| 60 | |||
| 62 | 61 | ||
| 63 | \message{Loading texinfo [version \texinfoversion]:} | 62 | \message{Loading texinfo [version \texinfoversion]:} |
| 64 | 63 | ||
| @@ -85,12 +84,16 @@ | |||
| 85 | \let\ptexend=\end | 84 | \let\ptexend=\end |
| 86 | \let\ptexequiv=\equiv | 85 | \let\ptexequiv=\equiv |
| 87 | \let\ptexexclam=\! | 86 | \let\ptexexclam=\! |
| 87 | \let\ptexfootnote=\footnote | ||
| 88 | \let\ptexgtr=> | 88 | \let\ptexgtr=> |
| 89 | \let\ptexhat=^ | 89 | \let\ptexhat=^ |
| 90 | \let\ptexi=\i | 90 | \let\ptexi=\i |
| 91 | \let\ptexindent=\indent | 91 | \let\ptexindent=\indent |
| 92 | \let\ptexinsert=\insert | ||
| 92 | \let\ptexlbrace=\{ | 93 | \let\ptexlbrace=\{ |
| 93 | \let\ptexless=< | 94 | \let\ptexless=< |
| 95 | \let\ptexnewwrite\newwrite | ||
| 96 | \let\ptexnoindent=\noindent | ||
| 94 | \let\ptexplus=+ | 97 | \let\ptexplus=+ |
| 95 | \let\ptexrbrace=\} | 98 | \let\ptexrbrace=\} |
| 96 | \let\ptexslash=\/ | 99 | \let\ptexslash=\/ |
| @@ -101,6 +104,15 @@ | |||
| 101 | % starts a new line in the output. | 104 | % starts a new line in the output. |
| 102 | \newlinechar = `^^J | 105 | \newlinechar = `^^J |
| 103 | 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 | |||
| 104 | % Set up fixed words for English if not already set. | 116 | % Set up fixed words for English if not already set. |
| 105 | \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi | 117 | \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi |
| 106 | \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi | 118 | \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi |
| @@ -139,43 +151,71 @@ | |||
| 139 | \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi | 151 | \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi |
| 140 | \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi | 152 | \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi |
| 141 | \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi | 153 | \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi |
| 142 | \ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi | ||
| 143 | \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi | 154 | \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi |
| 144 | \ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi | ||
| 145 | 155 | ||
| 146 | % In some macros, we cannot use the `\? notation---the left quote is | 156 | % Since the category of space is not known, we have to be careful. |
| 147 | % in some cases the escape char. | 157 | \chardef\spacecat = 10 |
| 148 | \chardef\colonChar = `\: | 158 | \def\spaceisspace{\catcode`\ =\spacecat} |
| 149 | \chardef\commaChar = `\, | ||
| 150 | \chardef\dotChar = `\. | ||
| 151 | \chardef\equalChar = `\= | ||
| 152 | \chardef\exclamChar= `\! | ||
| 153 | \chardef\questChar = `\? | ||
| 154 | \chardef\semiChar = `\; | ||
| 155 | \chardef\spaceChar = `\ % | ||
| 156 | \chardef\underChar = `\_ | ||
| 157 | 159 | ||
| 158 | % Ignore a token. | 160 | % Ignore a token. |
| 159 | % | 161 | % |
| 160 | \def\gobble#1{} | 162 | \def\gobble#1{} |
| 161 | 163 | ||
| 162 | % True if #1 is the empty string, i.e., called like `\ifempty{}'. | 164 | % The following is used inside several \edef's. |
| 163 | % | 165 | \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} |
| 164 | \def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}% | ||
| 165 | \def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}% | ||
| 166 | 166 | ||
| 167 | % Hyphenation fixes. | 167 | % Hyphenation fixes. |
| 168 | \hyphenation{ap-pen-dix} | 168 | \hyphenation{ |
| 169 | \hyphenation{eshell} | 169 | Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script |
| 170 | \hyphenation{mini-buf-fer mini-buf-fers} | 170 | ap-pen-dix bit-map bit-maps |
| 171 | \hyphenation{time-stamp} | 171 | data-base data-bases eshell fall-ing half-way long-est man-u-script |
| 172 | \hyphenation{white-space} | 172 | man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm |
| 173 | par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces | ||
| 174 | spell-ing spell-ings | ||
| 175 | stand-alone strong-est time-stamp time-stamps which-ever white-space | ||
| 176 | wide-spread wrap-around | ||
| 177 | } | ||
| 173 | 178 | ||
| 174 | % Margin to add to right of even pages, to left of odd pages. | 179 | % Margin to add to right of even pages, to left of odd pages. |
| 175 | \newdimen\bindingoffset | 180 | \newdimen\bindingoffset |
| 176 | \newdimen\normaloffset | 181 | \newdimen\normaloffset |
| 177 | \newdimen\pagewidth \newdimen\pageheight | 182 | \newdimen\pagewidth \newdimen\pageheight |
| 178 | 183 | ||
| 184 | % For a final copy, take out the rectangles | ||
| 185 | % that mark overfull boxes (in case you have decided | ||
| 186 | % that the text looks ok even though it passes the margin). | ||
| 187 | % | ||
| 188 | \def\finalout{\overfullrule=0pt} | ||
| 189 | |||
| 190 | % @| inserts a changebar to the left of the current line. It should | ||
| 191 | % surround any changed text. This approach does *not* work if the | ||
| 192 | % change spans more than two lines of output. To handle that, we would | ||
| 193 | % have adopt a much more difficult approach (putting marks into the main | ||
| 194 | % vertical list for the beginning and end of each change). | ||
| 195 | % | ||
| 196 | \def\|{% | ||
| 197 | % \vadjust can only be used in horizontal mode. | ||
| 198 | \leavevmode | ||
| 199 | % | ||
| 200 | % Append this vertical mode material after the current line in the output. | ||
| 201 | \vadjust{% | ||
| 202 | % We want to insert a rule with the height and depth of the current | ||
| 203 | % leading; that is exactly what \strutbox is supposed to record. | ||
| 204 | \vskip-\baselineskip | ||
| 205 | % | ||
| 206 | % \vadjust-items are inserted at the left edge of the type. So | ||
| 207 | % the \llap here moves out into the left-hand margin. | ||
| 208 | \llap{% | ||
| 209 | % | ||
| 210 | % For a thicker or thinner bar, change the `1pt'. | ||
| 211 | \vrule height\baselineskip width1pt | ||
| 212 | % | ||
| 213 | % This is the space between the bar and the text. | ||
| 214 | \hskip 12pt | ||
| 215 | }% | ||
| 216 | }% | ||
| 217 | } | ||
| 218 | |||
| 179 | % Sometimes it is convenient to have everything in the transcript file | 219 | % Sometimes it is convenient to have everything in the transcript file |
| 180 | % and nothing on the terminal. We don't just call \tracingall here, | 220 | % and nothing on the terminal. We don't just call \tracingall here, |
| 181 | % since that produces some useless output on the terminal. We also make | 221 | % since that produces some useless output on the terminal. We also make |
| @@ -200,7 +240,7 @@ | |||
| 200 | \tracingassigns1 | 240 | \tracingassigns1 |
| 201 | \fi | 241 | \fi |
| 202 | \tracingcommands3 % 3 gives us more in etex | 242 | \tracingcommands3 % 3 gives us more in etex |
| 203 | \errorcontextlines\maxdimen | 243 | \errorcontextlines16 |
| 204 | }% | 244 | }% |
| 205 | 245 | ||
| 206 | % add check for \lastpenalty to plain's definitions. If the last thing | 246 | % add check for \lastpenalty to plain's definitions. If the last thing |
| @@ -252,13 +292,17 @@ | |||
| 252 | % take effect in \write's, yet the group defined by the \vbox ends | 292 | % take effect in \write's, yet the group defined by the \vbox ends |
| 253 | % before the \shipout runs. | 293 | % before the \shipout runs. |
| 254 | % | 294 | % |
| 255 | \escapechar = `\\ % use backslash in output files. | ||
| 256 | \indexdummies % don't expand commands in the output. | 295 | \indexdummies % don't expand commands in the output. |
| 257 | \normalturnoffactive % \ in index entries must not stay \, e.g., if | 296 | \normalturnoffactive % \ in index entries must not stay \, e.g., if |
| 258 | % the page break happens to be in the middle of an example. | 297 | % the page break happens to be in the middle of an example. |
| 298 | % We don't want .vr (or whatever) entries like this: | ||
| 299 | % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} | ||
| 300 | % "\acronym" won't work when it's read back in; | ||
| 301 | % it needs to be | ||
| 302 | % {\code {{\tt \backslashcurfont }acronym} | ||
| 259 | \shipout\vbox{% | 303 | \shipout\vbox{% |
| 260 | % Do this early so pdf references go to the beginning of the page. | 304 | % Do this early so pdf references go to the beginning of the page. |
| 261 | \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi | 305 | \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi |
| 262 | % | 306 | % |
| 263 | \ifcropmarks \vbox to \outervsize\bgroup | 307 | \ifcropmarks \vbox to \outervsize\bgroup |
| 264 | \hsize = \outerhsize | 308 | \hsize = \outerhsize |
| @@ -306,7 +350,7 @@ | |||
| 306 | \egroup % \vbox from first cropmarks clause | 350 | \egroup % \vbox from first cropmarks clause |
| 307 | \fi | 351 | \fi |
| 308 | }% end of \shipout\vbox | 352 | }% end of \shipout\vbox |
| 309 | }% end of group with \normalturnoffactive | 353 | }% end of group with \indexdummies |
| 310 | \advancepageno | 354 | \advancepageno |
| 311 | \ifnum\outputpenalty>-20000 \else\dosupereject\fi | 355 | \ifnum\outputpenalty>-20000 \else\dosupereject\fi |
| 312 | } | 356 | } |
| @@ -339,132 +383,162 @@ | |||
| 339 | % the input line (except we remove a trailing comment). #1 should be a | 383 | % the input line (except we remove a trailing comment). #1 should be a |
| 340 | % macro which expects an ordinary undelimited TeX argument. | 384 | % macro which expects an ordinary undelimited TeX argument. |
| 341 | % | 385 | % |
| 342 | \def\parsearg#1{% | 386 | \def\parsearg{\parseargusing{}} |
| 343 | \let\next = #1% | 387 | \def\parseargusing#1#2{% |
| 388 | \def\next{#2}% | ||
| 344 | \begingroup | 389 | \begingroup |
| 345 | \obeylines | 390 | \obeylines |
| 346 | \futurelet\temp\parseargx | 391 | \spaceisspace |
| 347 | } | 392 | #1% |
| 348 | 393 | \parseargline\empty% Insert the \empty token, see \finishparsearg below. | |
| 349 | % If the next token is an obeyed space (from an @example environment or | ||
| 350 | % the like), remove it and recurse. Otherwise, we're done. | ||
| 351 | \def\parseargx{% | ||
| 352 | % \obeyedspace is defined far below, after the definition of \sepspaces. | ||
| 353 | \ifx\obeyedspace\temp | ||
| 354 | \expandafter\parseargdiscardspace | ||
| 355 | \else | ||
| 356 | \expandafter\parseargline | ||
| 357 | \fi | ||
| 358 | } | 394 | } |
| 359 | 395 | ||
| 360 | % Remove a single space (as the delimiter token to the macro call). | ||
| 361 | {\obeyspaces % | ||
| 362 | \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} | ||
| 363 | |||
| 364 | {\obeylines % | 396 | {\obeylines % |
| 365 | \gdef\parseargline#1^^M{% | 397 | \gdef\parseargline#1^^M{% |
| 366 | \endgroup % End of the group started in \parsearg. | 398 | \endgroup % End of the group started in \parsearg. |
| 367 | % | 399 | \argremovecomment #1\comment\ArgTerm% |
| 368 | % First remove any @c comment, then any @comment. | ||
| 369 | % Result of each macro is put in \toks0. | ||
| 370 | \argremovec #1\c\relax % | ||
| 371 | \expandafter\argremovecomment \the\toks0 \comment\relax % | ||
| 372 | % | ||
| 373 | % Call the caller's macro, saved as \next in \parsearg. | ||
| 374 | \expandafter\next\expandafter{\the\toks0}% | ||
| 375 | }% | 400 | }% |
| 376 | } | 401 | } |
| 377 | 402 | ||
| 378 | % Since all \c{,omment} does is throw away the argument, we can let TeX | 403 | % First remove any @comment, then any @c comment. |
| 379 | % do that for us. The \relax here is matched by the \relax in the call | 404 | \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} |
| 380 | % in \parseargline; it could be more or less anything, its purpose is | 405 | \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} |
| 381 | % just to delimit the argument to the \c. | ||
| 382 | \def\argremovec#1\c#2\relax{\toks0 = {#1}} | ||
| 383 | \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} | ||
| 384 | 406 | ||
| 385 | % \argremovec{,omment} might leave us with trailing spaces, though; e.g., | 407 | % Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space. |
| 408 | % | ||
| 409 | % \argremovec might leave us with trailing space, e.g., | ||
| 386 | % @end itemize @c foo | 410 | % @end itemize @c foo |
| 387 | % will have two active spaces as part of the argument with the | 411 | % This space token undergoes the same procedure and is eventually removed |
| 388 | % `itemize'. Here we remove all active spaces from #1, and assign the | 412 | % by \finishparsearg. |
| 389 | % result to \toks0. | 413 | % |
| 390 | % | 414 | \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} |
| 391 | % This loses if there are any *other* active characters besides spaces | 415 | \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} |
| 392 | % in the argument -- _ ^ +, for example -- since they get expanded. | 416 | \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% |
| 393 | % Fortunately, Texinfo does not define any such commands. (If it ever | 417 | \def\temp{#3}% |
| 394 | % does, the catcode of the characters in questionwill have to be changed | 418 | \ifx\temp\empty |
| 395 | % here.) But this means we cannot call \removeactivespaces as part of | 419 | % We cannot use \next here, as it holds the macro to run; |
| 396 | % \argremovec{,omment}, since @c uses \parsearg, and thus the argument | 420 | % thus we reuse \temp. |
| 397 | % that \parsearg gets might well have any character at all in it. | 421 | \let\temp\finishparsearg |
| 398 | % | 422 | \else |
| 399 | \def\removeactivespaces#1{% | 423 | \let\temp\argcheckspaces |
| 400 | \begingroup | 424 | \fi |
| 401 | \ignoreactivespaces | 425 | % Put the space token in: |
| 402 | \edef\temp{#1}% | 426 | \temp#1 #3\ArgTerm |
| 403 | \global\toks0 = \expandafter{\temp}% | ||
| 404 | \endgroup | ||
| 405 | } | 427 | } |
| 406 | 428 | ||
| 407 | % Change the active space to expand to nothing. | 429 | % If a _delimited_ argument is enclosed in braces, they get stripped; so |
| 430 | % to get _exactly_ the rest of the line, we had to prevent such situation. | ||
| 431 | % We prepended an \empty token at the very beginning and we expand it now, | ||
| 432 | % just before passing the control to \next. | ||
| 433 | % (Similarily, we have to think about #3 of \argcheckspacesY above: it is | ||
| 434 | % either the null string, or it ends with \^^M---thus there is no danger | ||
| 435 | % that a pair of braces would be stripped. | ||
| 408 | % | 436 | % |
| 409 | \begingroup | 437 | % But first, we have to remove the trailing space token. |
| 438 | % | ||
| 439 | \def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} | ||
| 440 | |||
| 441 | % \parseargdef\foo{...} | ||
| 442 | % is roughly equivalent to | ||
| 443 | % \def\foo{\parsearg\Xfoo} | ||
| 444 | % \def\Xfoo#1{...} | ||
| 445 | % | ||
| 446 | % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my | ||
| 447 | % favourite TeX trick. --kasal, 16nov03 | ||
| 448 | |||
| 449 | \def\parseargdef#1{% | ||
| 450 | \expandafter \doparseargdef \csname\string#1\endcsname #1% | ||
| 451 | } | ||
| 452 | \def\doparseargdef#1#2{% | ||
| 453 | \def#2{\parsearg#1}% | ||
| 454 | \def#1##1% | ||
| 455 | } | ||
| 456 | |||
| 457 | % Several utility definitions with active space: | ||
| 458 | { | ||
| 410 | \obeyspaces | 459 | \obeyspaces |
| 411 | \gdef\ignoreactivespaces{\obeyspaces\let =\empty} | 460 | \gdef\obeyedspace{ } |
| 412 | \endgroup | 461 | |
| 462 | % Make each space character in the input produce a normal interword | ||
| 463 | % space in the output. Don't allow a line break at this space, as this | ||
| 464 | % is used only in environments like @example, where each line of input | ||
| 465 | % should produce a line of output anyway. | ||
| 466 | % | ||
| 467 | \gdef\sepspaces{\obeyspaces\let =\tie} | ||
| 468 | |||
| 469 | % If an index command is used in an @example environment, any spaces | ||
| 470 | % therein should become regular spaces in the raw index file, not the | ||
| 471 | % expansion of \tie (\leavevmode \penalty \@M \ ). | ||
| 472 | \gdef\unsepspaces{\let =\space} | ||
| 473 | } | ||
| 413 | 474 | ||
| 414 | 475 | ||
| 415 | \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} | 476 | \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} |
| 416 | 477 | ||
| 417 | %% These are used to keep @begin/@end levels from running away | 478 | % Define the framework for environments in texinfo.tex. It's used like this: |
| 418 | %% Call \inENV within environments (after a \begingroup) | 479 | % |
| 419 | \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} | 480 | % \envdef\foo{...} |
| 420 | \def\ENVcheck{% | 481 | % \def\Efoo{...} |
| 421 | \ifENV\errmessage{Still within an environment; press RETURN to continue} | 482 | % |
| 422 | \endgroup\fi} % This is not perfect, but it should reduce lossage | 483 | % It's the responsibility of \envdef to insert \begingroup before the |
| 484 | % actual body; @end closes the group after calling \Efoo. \envdef also | ||
| 485 | % defines \thisenv, so the current environment is known; @end checks | ||
| 486 | % whether the environment name matches. The \checkenv macro can also be | ||
| 487 | % used to check whether the current environment is the one expected. | ||
| 488 | % | ||
| 489 | % Non-false conditionals (@iftex, @ifset) don't fit into this, so they | ||
| 490 | % are not treated as enviroments; they don't open a group. (The | ||
| 491 | % implementation of @end takes care not to call \endgroup in this | ||
| 492 | % special case.) | ||
| 423 | 493 | ||
| 424 | % @begin foo is the same as @foo, for now. | ||
| 425 | \newhelp\EMsimple{Press RETURN to continue.} | ||
| 426 | 494 | ||
| 427 | \outer\def\begin{\parsearg\beginxxx} | 495 | % At runtime, environments start with this: |
| 496 | \def\startenvironment#1{\begingroup\def\thisenv{#1}} | ||
| 497 | % initialize | ||
| 498 | \let\thisenv\empty | ||
| 428 | 499 | ||
| 429 | \def\beginxxx #1{% | 500 | % ... but they get defined via ``\envdef\foo{...}'': |
| 430 | \expandafter\ifx\csname #1\endcsname\relax | 501 | \long\def\envdef#1#2{\def#1{\startenvironment#1#2}} |
| 431 | {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else | 502 | \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} |
| 432 | \csname #1\endcsname\fi} | ||
| 433 | 503 | ||
| 434 | % @end foo executes the definition of \Efoo. | 504 | % Check whether we're in the right environment: |
| 435 | % | 505 | \def\checkenv#1{% |
| 436 | \def\end{\parsearg\endxxx} | 506 | \def\temp{#1}% |
| 437 | \def\endxxx #1{% | 507 | \ifx\thisenv\temp |
| 438 | \removeactivespaces{#1}% | ||
| 439 | \edef\endthing{\the\toks0}% | ||
| 440 | % | ||
| 441 | \expandafter\ifx\csname E\endthing\endcsname\relax | ||
| 442 | \expandafter\ifx\csname \endthing\endcsname\relax | ||
| 443 | % There's no \foo, i.e., no ``environment'' foo. | ||
| 444 | \errhelp = \EMsimple | ||
| 445 | \errmessage{Undefined command `@end \endthing'}% | ||
| 446 | \else | ||
| 447 | \unmatchedenderror\endthing | ||
| 448 | \fi | ||
| 449 | \else | 508 | \else |
| 450 | % Everything's ok; the right environment has been started. | 509 | \badenverr |
| 451 | \csname E\endthing\endcsname | ||
| 452 | \fi | 510 | \fi |
| 453 | } | 511 | } |
| 454 | 512 | ||
| 455 | % There is an environment #1, but it hasn't been started. Give an error. | 513 | % Evironment mismatch, #1 expected: |
| 456 | % | 514 | \def\badenverr{% |
| 457 | \def\unmatchedenderror#1{% | ||
| 458 | \errhelp = \EMsimple | 515 | \errhelp = \EMsimple |
| 459 | \errmessage{This `@end #1' doesn't have a matching `@#1'}% | 516 | \errmessage{This command can appear only \inenvironment\temp, |
| 517 | not \inenvironment\thisenv}% | ||
| 518 | } | ||
| 519 | \def\inenvironment#1{% | ||
| 520 | \ifx#1\empty | ||
| 521 | out of any environment% | ||
| 522 | \else | ||
| 523 | in environment \expandafter\string#1% | ||
| 524 | \fi | ||
| 460 | } | 525 | } |
| 461 | 526 | ||
| 462 | % Define the control sequence \E#1 to give an unmatched @end error. | 527 | % @end foo executes the definition of \Efoo. |
| 528 | % But first, it executes a specialized version of \checkenv | ||
| 463 | % | 529 | % |
| 464 | \def\defineunmatchedend#1{% | 530 | \parseargdef\end{% |
| 465 | \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% | 531 | \if 1\csname iscond.#1\endcsname |
| 532 | \else | ||
| 533 | % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 | ||
| 534 | \expandafter\checkenv\csname#1\endcsname | ||
| 535 | \csname E#1\endcsname | ||
| 536 | \endgroup | ||
| 537 | \fi | ||
| 466 | } | 538 | } |
| 467 | 539 | ||
| 540 | \newhelp\EMsimple{Press RETURN to continue.} | ||
| 541 | |||
| 468 | 542 | ||
| 469 | %% Simple single-character @ commands | 543 | %% Simple single-character @ commands |
| 470 | 544 | ||
| @@ -486,7 +560,7 @@ | |||
| 486 | \let\}=\myrbrace | 560 | \let\}=\myrbrace |
| 487 | \begingroup | 561 | \begingroup |
| 488 | % Definitions to produce \{ and \} commands for indices, | 562 | % Definitions to produce \{ and \} commands for indices, |
| 489 | % and @{ and @} for the aux file. | 563 | % and @{ and @} for the aux/toc files. |
| 490 | \catcode`\{ = \other \catcode`\} = \other | 564 | \catcode`\{ = \other \catcode`\} = \other |
| 491 | \catcode`\[ = 1 \catcode`\] = 2 | 565 | \catcode`\[ = 1 \catcode`\] = 2 |
| 492 | \catcode`\! = 0 \catcode`\\ = \other | 566 | \catcode`\! = 0 \catcode`\\ = \other |
| @@ -496,6 +570,9 @@ | |||
| 496 | !gdef!rbraceatcmd[@}]% | 570 | !gdef!rbraceatcmd[@}]% |
| 497 | !endgroup | 571 | !endgroup |
| 498 | 572 | ||
| 573 | % @comma{} to avoid , parsing problems. | ||
| 574 | \let\comma = , | ||
| 575 | |||
| 499 | % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent | 576 | % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent |
| 500 | % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. | 577 | % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. |
| 501 | \let\, = \c | 578 | \let\, = \c |
| @@ -505,10 +582,12 @@ | |||
| 505 | \let\ubaraccent = \b | 582 | \let\ubaraccent = \b |
| 506 | \let\udotaccent = \d | 583 | \let\udotaccent = \d |
| 507 | 584 | ||
| 508 | % Other special characters: @questiondown @exclamdown | 585 | % Other special characters: @questiondown @exclamdown @ordf @ordm |
| 509 | % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. | 586 | % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. |
| 510 | \def\questiondown{?`} | 587 | \def\questiondown{?`} |
| 511 | \def\exclamdown{!`} | 588 | \def\exclamdown{!`} |
| 589 | \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} | ||
| 590 | \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} | ||
| 512 | 591 | ||
| 513 | % Dotless i and dotless j, used for accents. | 592 | % Dotless i and dotless j, used for accents. |
| 514 | \def\imacro{i} | 593 | \def\imacro{i} |
| @@ -521,6 +600,25 @@ | |||
| 521 | \fi\fi | 600 | \fi\fi |
| 522 | } | 601 | } |
| 523 | 602 | ||
| 603 | % The \TeX{} logo, as in plain, but resetting the spacing so that a | ||
| 604 | % period following counts as ending a sentence. (Idea found in latex.) | ||
| 605 | % | ||
| 606 | \edef\TeX{\TeX \spacefactor=1000 } | ||
| 607 | |||
| 608 | % @LaTeX{} logo. Not quite the same results as the definition in | ||
| 609 | % latex.ltx, since we use a different font for the raised A; it's most | ||
| 610 | % convenient for us to use an explicitly smaller font, rather than using | ||
| 611 | % the \scriptstyle font (since we don't reset \scriptstyle and | ||
| 612 | % \scriptscriptstyle). | ||
| 613 | % | ||
| 614 | \def\LaTeX{% | ||
| 615 | L\kern-.36em | ||
| 616 | {\setbox0=\hbox{T}% | ||
| 617 | \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% | ||
| 618 | \kern-.15em | ||
| 619 | \TeX | ||
| 620 | } | ||
| 621 | |||
| 524 | % Be sure we're in horizontal mode when doing a tie, since we make space | 622 | % Be sure we're in horizontal mode when doing a tie, since we make space |
| 525 | % equivalent to this in @example-like environments. Otherwise, a space | 623 | % equivalent to this in @example-like environments. Otherwise, a space |
| 526 | % at the beginning of a line will start with \penalty -- and | 624 | % at the beginning of a line will start with \penalty -- and |
| @@ -543,13 +641,28 @@ | |||
| 543 | \let\/=\allowbreak | 641 | \let\/=\allowbreak |
| 544 | 642 | ||
| 545 | % @. is an end-of-sentence period. | 643 | % @. is an end-of-sentence period. |
| 546 | \def\.{.\spacefactor=3000 } | 644 | \def\.{.\spacefactor=\endofsentencespacefactor\space} |
| 547 | 645 | ||
| 548 | % @! is an end-of-sentence bang. | 646 | % @! is an end-of-sentence bang. |
| 549 | \def\!{!\spacefactor=3000 } | 647 | \def\!{!\spacefactor=\endofsentencespacefactor\space} |
| 550 | 648 | ||
| 551 | % @? is an end-of-sentence query. | 649 | % @? is an end-of-sentence query. |
| 552 | \def\?{?\spacefactor=3000 } | 650 | \def\?{?\spacefactor=\endofsentencespacefactor\space} |
| 651 | |||
| 652 | % @frenchspacing on|off says whether to put extra space after punctuation. | ||
| 653 | % | ||
| 654 | \def\onword{on} | ||
| 655 | \def\offword{off} | ||
| 656 | % | ||
| 657 | \parseargdef\frenchspacing{% | ||
| 658 | \def\temp{#1}% | ||
| 659 | \ifx\temp\onword \plainfrenchspacing | ||
| 660 | \else\ifx\temp\offword \plainnonfrenchspacing | ||
| 661 | \else | ||
| 662 | \errhelp = \EMsimple | ||
| 663 | \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% | ||
| 664 | \fi\fi | ||
| 665 | } | ||
| 553 | 666 | ||
| 554 | % @w prevents a word break. Without the \leavevmode, @w at the | 667 | % @w prevents a word break. Without the \leavevmode, @w at the |
| 555 | % beginning of a paragraph, when TeX is still in vertical mode, would | 668 | % beginning of a paragraph, when TeX is still in vertical mode, would |
| @@ -574,59 +687,14 @@ | |||
| 574 | \newbox\groupbox | 687 | \newbox\groupbox |
| 575 | \def\vfilllimit{0.7} | 688 | \def\vfilllimit{0.7} |
| 576 | % | 689 | % |
| 577 | \def\group{\begingroup | 690 | \envdef\group{% |
| 578 | \ifnum\catcode13=\active \else | 691 | \ifnum\catcode`\^^M=\active \else |
| 579 | \errhelp = \groupinvalidhelp | 692 | \errhelp = \groupinvalidhelp |
| 580 | \errmessage{@group invalid in context where filling is enabled}% | 693 | \errmessage{@group invalid in context where filling is enabled}% |
| 581 | \fi | 694 | \fi |
| 582 | % | 695 | \startsavinginserts |
| 583 | % The \vtop we start below produces a box with normal height and large | ||
| 584 | % depth; thus, TeX puts \baselineskip glue before it, and (when the | ||
| 585 | % next line of text is done) \lineskip glue after it. (See p.82 of | ||
| 586 | % the TeXbook.) Thus, space below is not quite equal to space | ||
| 587 | % above. But it's pretty close. | ||
| 588 | \def\Egroup{% | ||
| 589 | \egroup % End the \vtop. | ||
| 590 | % \dimen0 is the vertical size of the group's box. | ||
| 591 | \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox | ||
| 592 | % \dimen2 is how much space is left on the page (more or less). | ||
| 593 | \dimen2 = \pageheight \advance\dimen2 by -\pagetotal | ||
| 594 | % if the group doesn't fit on the current page, and it's a big big | ||
| 595 | % group, force a page break. | ||
| 596 | \ifdim \dimen0 > \dimen2 | ||
| 597 | \ifdim \pagetotal < \vfilllimit\pageheight | ||
| 598 | \page | ||
| 599 | \fi | ||
| 600 | \fi | ||
| 601 | \copy\groupbox | ||
| 602 | \endgroup % End the \group. | ||
| 603 | }% | ||
| 604 | % | 696 | % |
| 605 | \setbox\groupbox = \vtop\bgroup | 697 | \setbox\groupbox = \vtop\bgroup |
| 606 | % We have to put a strut on the last line in case the @group is in | ||
| 607 | % the midst of an example, rather than completely enclosing it. | ||
| 608 | % Otherwise, the interline space between the last line of the group | ||
| 609 | % and the first line afterwards is too small. But we can't put the | ||
| 610 | % strut in \Egroup, since there it would be on a line by itself. | ||
| 611 | % Hence this just inserts a strut at the beginning of each line. | ||
| 612 | \everypar = {\strut}% | ||
| 613 | % | ||
| 614 | % Since we have a strut on every line, we don't need any of TeX's | ||
| 615 | % normal interline spacing. | ||
| 616 | \offinterlineskip | ||
| 617 | % | ||
| 618 | % OK, but now we have to do something about blank | ||
| 619 | % lines in the input in @example-like environments, which normally | ||
| 620 | % just turn into \lisppar, which will insert no space now that we've | ||
| 621 | % turned off the interline space. Simplest is to make them be an | ||
| 622 | % empty paragraph. | ||
| 623 | \ifx\par\lisppar | ||
| 624 | \edef\par{\leavevmode \par}% | ||
| 625 | % | ||
| 626 | % Reset ^^M's definition to new definition of \par. | ||
| 627 | \obeylines | ||
| 628 | \fi | ||
| 629 | % | ||
| 630 | % Do @comment since we are called inside an environment such as | 698 | % Do @comment since we are called inside an environment such as |
| 631 | % @example, where each end-of-line in the input causes an | 699 | % @example, where each end-of-line in the input causes an |
| 632 | % end-of-line in the output. We don't want the end-of-line after | 700 | % end-of-line in the output. We don't want the end-of-line after |
| @@ -636,6 +704,32 @@ | |||
| 636 | \comment | 704 | \comment |
| 637 | } | 705 | } |
| 638 | % | 706 | % |
| 707 | % The \vtop produces a box with normal height and large depth; thus, TeX puts | ||
| 708 | % \baselineskip glue before it, and (when the next line of text is done) | ||
| 709 | % \lineskip glue after it. Thus, space below is not quite equal to space | ||
| 710 | % above. But it's pretty close. | ||
| 711 | \def\Egroup{% | ||
| 712 | % To get correct interline space between the last line of the group | ||
| 713 | % and the first line afterwards, we have to propagate \prevdepth. | ||
| 714 | \endgraf % Not \par, as it may have been set to \lisppar. | ||
| 715 | \global\dimen1 = \prevdepth | ||
| 716 | \egroup % End the \vtop. | ||
| 717 | % \dimen0 is the vertical size of the group's box. | ||
| 718 | \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox | ||
| 719 | % \dimen2 is how much space is left on the page (more or less). | ||
| 720 | \dimen2 = \pageheight \advance\dimen2 by -\pagetotal | ||
| 721 | % if the group doesn't fit on the current page, and it's a big big | ||
| 722 | % group, force a page break. | ||
| 723 | \ifdim \dimen0 > \dimen2 | ||
| 724 | \ifdim \pagetotal < \vfilllimit\pageheight | ||
| 725 | \page | ||
| 726 | \fi | ||
| 727 | \fi | ||
| 728 | \box\groupbox | ||
| 729 | \prevdepth = \dimen1 | ||
| 730 | \checkinserts | ||
| 731 | } | ||
| 732 | % | ||
| 639 | % TeX puts in an \escapechar (i.e., `@') at the beginning of the help | 733 | % TeX puts in an \escapechar (i.e., `@') at the beginning of the help |
| 640 | % message, so this ends up printing `@group can only ...'. | 734 | % message, so this ends up printing `@group can only ...'. |
| 641 | % | 735 | % |
| @@ -648,10 +742,8 @@ where each line of input produces a line of output.} | |||
| 648 | 742 | ||
| 649 | \newdimen\mil \mil=0.001in | 743 | \newdimen\mil \mil=0.001in |
| 650 | 744 | ||
| 651 | \def\need{\parsearg\needx} | ||
| 652 | |||
| 653 | % Old definition--didn't work. | 745 | % Old definition--didn't work. |
| 654 | %\def\needx #1{\par % | 746 | %\parseargdef\need{\par % |
| 655 | %% This method tries to make TeX break the page naturally | 747 | %% This method tries to make TeX break the page naturally |
| 656 | %% if the depth of the box does not fit. | 748 | %% if the depth of the box does not fit. |
| 657 | %{\baselineskip=0pt% | 749 | %{\baselineskip=0pt% |
| @@ -659,7 +751,7 @@ where each line of input produces a line of output.} | |||
| 659 | %\prevdepth=-1000pt | 751 | %\prevdepth=-1000pt |
| 660 | %}} | 752 | %}} |
| 661 | 753 | ||
| 662 | \def\needx#1{% | 754 | \parseargdef\need{% |
| 663 | % Ensure vertical mode, so we don't make a big box in the middle of a | 755 | % Ensure vertical mode, so we don't make a big box in the middle of a |
| 664 | % paragraph. | 756 | % paragraph. |
| 665 | \par | 757 | \par |
| @@ -698,35 +790,10 @@ where each line of input produces a line of output.} | |||
| 698 | \fi | 790 | \fi |
| 699 | } | 791 | } |
| 700 | 792 | ||
| 701 | % @br forces paragraph break | 793 | % @br forces paragraph break (and is undocumented). |
| 702 | 794 | ||
| 703 | \let\br = \par | 795 | \let\br = \par |
| 704 | 796 | ||
| 705 | % @dots{} output an ellipsis using the current font. | ||
| 706 | % We do .5em per period so that it has the same spacing in a typewriter | ||
| 707 | % font as three actual period characters. | ||
| 708 | % | ||
| 709 | \def\dots{% | ||
| 710 | \leavevmode | ||
| 711 | \hbox to 1.5em{% | ||
| 712 | \hskip 0pt plus 0.25fil minus 0.25fil | ||
| 713 | .\hss.\hss.% | ||
| 714 | \hskip 0pt plus 0.5fil minus 0.5fil | ||
| 715 | }% | ||
| 716 | } | ||
| 717 | |||
| 718 | % @enddots{} is an end-of-sentence ellipsis. | ||
| 719 | % | ||
| 720 | \def\enddots{% | ||
| 721 | \leavevmode | ||
| 722 | \hbox to 2em{% | ||
| 723 | \hskip 0pt plus 0.25fil minus 0.25fil | ||
| 724 | .\hss.\hss.\hss.% | ||
| 725 | \hskip 0pt plus 0.5fil minus 0.5fil | ||
| 726 | }% | ||
| 727 | \spacefactor=3000 | ||
| 728 | } | ||
| 729 | |||
| 730 | % @page forces the start of a new page. | 797 | % @page forces the start of a new page. |
| 731 | % | 798 | % |
| 732 | \def\page{\par\vfill\supereject} | 799 | \def\page{\par\vfill\supereject} |
| @@ -739,13 +806,11 @@ where each line of input produces a line of output.} | |||
| 739 | \newskip\exdentamount | 806 | \newskip\exdentamount |
| 740 | 807 | ||
| 741 | % This defn is used inside fill environments such as @defun. | 808 | % This defn is used inside fill environments such as @defun. |
| 742 | \def\exdent{\parsearg\exdentyyy} | 809 | \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} |
| 743 | \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} | ||
| 744 | 810 | ||
| 745 | % This defn is used inside nofill environments such as @example. | 811 | % This defn is used inside nofill environments such as @example. |
| 746 | \def\nofillexdent{\parsearg\nofillexdentyyy} | 812 | \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount |
| 747 | \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount | 813 | \leftline{\hskip\leftskip{\rm#1}}}} |
| 748 | \leftline{\hskip\leftskip{\rm#1}}}} | ||
| 749 | 814 | ||
| 750 | % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current | 815 | % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current |
| 751 | % paragraph. For more general purposes, use the \margin insertion | 816 | % paragraph. For more general purposes, use the \margin insertion |
| @@ -797,8 +862,19 @@ where each line of input produces a line of output.} | |||
| 797 | } | 862 | } |
| 798 | 863 | ||
| 799 | % @include file insert text of that file as input. | 864 | % @include file insert text of that file as input. |
| 800 | % Allow normal characters that we make active in the argument (a file name). | 865 | % |
| 801 | \def\include{\begingroup | 866 | \def\include{\parseargusing\filenamecatcodes\includezzz} |
| 867 | \def\includezzz#1{% | ||
| 868 | \pushthisfilestack | ||
| 869 | \def\thisfile{#1}% | ||
| 870 | {% | ||
| 871 | \makevalueexpandable | ||
| 872 | \def\temp{\input #1 }% | ||
| 873 | \expandafter | ||
| 874 | }\temp | ||
| 875 | \popthisfilestack | ||
| 876 | } | ||
| 877 | \def\filenamecatcodes{% | ||
| 802 | \catcode`\\=\other | 878 | \catcode`\\=\other |
| 803 | \catcode`~=\other | 879 | \catcode`~=\other |
| 804 | \catcode`^=\other | 880 | \catcode`^=\other |
| @@ -807,33 +883,50 @@ where each line of input produces a line of output.} | |||
| 807 | \catcode`<=\other | 883 | \catcode`<=\other |
| 808 | \catcode`>=\other | 884 | \catcode`>=\other |
| 809 | \catcode`+=\other | 885 | \catcode`+=\other |
| 810 | \parsearg\includezzz} | 886 | \catcode`-=\other |
| 811 | % Restore active chars for included file. | 887 | } |
| 812 | \def\includezzz#1{\endgroup\begingroup | 888 | |
| 813 | % Read the included file in a group so nested @include's work. | 889 | \def\pushthisfilestack{% |
| 814 | \def\thisfile{#1}% | 890 | \expandafter\pushthisfilestackX\popthisfilestack\StackTerm |
| 815 | \let\value=\expandablevalue | 891 | } |
| 816 | \input\thisfile | 892 | \def\pushthisfilestackX{% |
| 817 | \endgroup} | 893 | \expandafter\pushthisfilestackY\thisfile\StackTerm |
| 894 | } | ||
| 895 | \def\pushthisfilestackY #1\StackTerm #2\StackTerm {% | ||
| 896 | \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% | ||
| 897 | } | ||
| 898 | |||
| 899 | \def\popthisfilestack{\errthisfilestackempty} | ||
| 900 | \def\errthisfilestackempty{\errmessage{Internal error: | ||
| 901 | the stack of filenames is empty.}} | ||
| 818 | 902 | ||
| 819 | \def\thisfile{} | 903 | \def\thisfile{} |
| 820 | 904 | ||
| 821 | % @center line | 905 | % @center line |
| 822 | % outputs that line, centered. | 906 | % outputs that line, centered. |
| 823 | % | 907 | % |
| 824 | \def\center{\parsearg\docenter} | 908 | \parseargdef\center{% |
| 825 | \def\docenter#1{{% | 909 | \ifhmode |
| 826 | \ifhmode \hfil\break \fi | 910 | \let\next\centerH |
| 827 | \advance\hsize by -\leftskip | 911 | \else |
| 828 | \advance\hsize by -\rightskip | 912 | \let\next\centerV |
| 829 | \line{\hfil \ignorespaces#1\unskip \hfil}% | 913 | \fi |
| 830 | \ifhmode \break \fi | 914 | \next{\hfil \ignorespaces#1\unskip \hfil}% |
| 831 | }} | 915 | } |
| 916 | \def\centerH#1{% | ||
| 917 | {% | ||
| 918 | \hfil\break | ||
| 919 | \advance\hsize by -\leftskip | ||
| 920 | \advance\hsize by -\rightskip | ||
| 921 | \line{#1}% | ||
| 922 | \break | ||
| 923 | }% | ||
| 924 | } | ||
| 925 | \def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} | ||
| 832 | 926 | ||
| 833 | % @sp n outputs n lines of vertical space | 927 | % @sp n outputs n lines of vertical space |
| 834 | 928 | ||
| 835 | \def\sp{\parsearg\spxxx} | 929 | \parseargdef\sp{\vskip #1\baselineskip} |
| 836 | \def\spxxx #1{\vskip #1\baselineskip} | ||
| 837 | 930 | ||
| 838 | % @comment ...line which is ignored... | 931 | % @comment ...line which is ignored... |
| 839 | % @c is the same as @comment | 932 | % @c is the same as @comment |
| @@ -854,8 +947,7 @@ where each line of input produces a line of output.} | |||
| 854 | \def\asisword{asis} % no translation, these are keywords | 947 | \def\asisword{asis} % no translation, these are keywords |
| 855 | \def\noneword{none} | 948 | \def\noneword{none} |
| 856 | % | 949 | % |
| 857 | \def\paragraphindent{\parsearg\doparagraphindent} | 950 | \parseargdef\paragraphindent{% |
| 858 | \def\doparagraphindent#1{% | ||
| 859 | \def\temp{#1}% | 951 | \def\temp{#1}% |
| 860 | \ifx\temp\asisword | 952 | \ifx\temp\asisword |
| 861 | \else | 953 | \else |
| @@ -872,8 +964,7 @@ where each line of input produces a line of output.} | |||
| 872 | % We'll use ems for NCHARS like @paragraphindent. | 964 | % We'll use ems for NCHARS like @paragraphindent. |
| 873 | % It seems @exampleindent asis isn't necessary, but | 965 | % It seems @exampleindent asis isn't necessary, but |
| 874 | % I preserve it to make it similar to @paragraphindent. | 966 | % I preserve it to make it similar to @paragraphindent. |
| 875 | \def\exampleindent{\parsearg\doexampleindent} | 967 | \parseargdef\exampleindent{% |
| 876 | \def\doexampleindent#1{% | ||
| 877 | \def\temp{#1}% | 968 | \def\temp{#1}% |
| 878 | \ifx\temp\asisword | 969 | \ifx\temp\asisword |
| 879 | \else | 970 | \else |
| @@ -887,21 +978,18 @@ where each line of input produces a line of output.} | |||
| 887 | 978 | ||
| 888 | % @firstparagraphindent WORD | 979 | % @firstparagraphindent WORD |
| 889 | % If WORD is `none', then suppress indentation of the first paragraph | 980 | % If WORD is `none', then suppress indentation of the first paragraph |
| 890 | % after a section heading. If WORD is `insert', then do indentat such | 981 | % after a section heading. If WORD is `insert', then do indent at such |
| 891 | % paragraphs. | 982 | % paragraphs. |
| 892 | % | 983 | % |
| 893 | % The paragraph indentation is suppressed or not by calling | 984 | % The paragraph indentation is suppressed or not by calling |
| 894 | % \suppressfirstparagraphindent, which the sectioning commands do. We | 985 | % \suppressfirstparagraphindent, which the sectioning commands do. |
| 895 | % switch the definition of this back and forth according to WORD. By | 986 | % We switch the definition of this back and forth according to WORD. |
| 896 | % default, we suppress indentation. | 987 | % By default, we suppress indentation. |
| 897 | % | 988 | % |
| 898 | \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} | 989 | \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} |
| 899 | \newdimen\currentparindent | ||
| 900 | % | ||
| 901 | \def\insertword{insert} | 990 | \def\insertword{insert} |
| 902 | % | 991 | % |
| 903 | \def\firstparagraphindent{\parsearg\dofirstparagraphindent} | 992 | \parseargdef\firstparagraphindent{% |
| 904 | \def\dofirstparagraphindent#1{% | ||
| 905 | \def\temp{#1}% | 993 | \def\temp{#1}% |
| 906 | \ifx\temp\noneword | 994 | \ifx\temp\noneword |
| 907 | \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent | 995 | \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent |
| @@ -921,15 +1009,24 @@ where each line of input produces a line of output.} | |||
| 921 | % | 1009 | % |
| 922 | \gdef\dosuppressfirstparagraphindent{% | 1010 | \gdef\dosuppressfirstparagraphindent{% |
| 923 | \gdef\indent{% | 1011 | \gdef\indent{% |
| 924 | \global\let\indent=\ptexindent | 1012 | \restorefirstparagraphindent |
| 925 | \global\everypar = {}% | 1013 | \indent |
| 1014 | }% | ||
| 1015 | \gdef\noindent{% | ||
| 1016 | \restorefirstparagraphindent | ||
| 1017 | \noindent | ||
| 926 | }% | 1018 | }% |
| 927 | \global\everypar = {% | 1019 | \global\everypar = {% |
| 928 | \kern-\parindent | 1020 | \kern -\parindent |
| 929 | \global\let\indent=\ptexindent | 1021 | \restorefirstparagraphindent |
| 930 | \global\everypar = {}% | ||
| 931 | }% | 1022 | }% |
| 932 | }% | 1023 | } |
| 1024 | |||
| 1025 | \gdef\restorefirstparagraphindent{% | ||
| 1026 | \global \let \indent = \ptexindent | ||
| 1027 | \global \let \noindent = \ptexnoindent | ||
| 1028 | \global \everypar = {}% | ||
| 1029 | } | ||
| 933 | 1030 | ||
| 934 | 1031 | ||
| 935 | % @asis just yields its argument. Used with @table, for example. | 1032 | % @asis just yields its argument. Used with @table, for example. |
| @@ -937,23 +1034,18 @@ where each line of input produces a line of output.} | |||
| 937 | \def\asis#1{#1} | 1034 | \def\asis#1{#1} |
| 938 | 1035 | ||
| 939 | % @math outputs its argument in math mode. | 1036 | % @math outputs its argument in math mode. |
| 940 | % We don't use $'s directly in the definition of \math because we need | ||
| 941 | % to set catcodes according to plain TeX first, to allow for subscripts, | ||
| 942 | % superscripts, special math chars, etc. | ||
| 943 | % | ||
| 944 | \let\implicitmath = $%$ font-lock fix | ||
| 945 | % | 1037 | % |
| 946 | % One complication: _ usually means subscripts, but it could also mean | 1038 | % One complication: _ usually means subscripts, but it could also mean |
| 947 | % an actual _ character, as in @math{@var{some_variable} + 1}. So make | 1039 | % an actual _ character, as in @math{@var{some_variable} + 1}. So make |
| 948 | % _ within @math be active (mathcode "8000), and distinguish by seeing | 1040 | % _ active, and distinguish by seeing if the current family is \slfam, |
| 949 | % if the current family is \slfam, which is what @var uses. | 1041 | % which is what @var uses. |
| 950 | % | 1042 | { |
| 951 | {\catcode\underChar = \active | 1043 | \catcode`\_ = \active |
| 952 | \gdef\mathunderscore{% | 1044 | \gdef\mathunderscore{% |
| 953 | \catcode\underChar=\active | 1045 | \catcode`\_=\active |
| 954 | \def_{\ifnum\fam=\slfam \_\else\sb\fi}% | 1046 | \def_{\ifnum\fam=\slfam \_\else\sb\fi}% |
| 955 | }} | 1047 | } |
| 956 | % | 1048 | } |
| 957 | % Another complication: we want \\ (and @\) to output a \ character. | 1049 | % Another complication: we want \\ (and @\) to output a \ character. |
| 958 | % FYI, plain.tex uses \\ as a temporary control sequence (why?), but | 1050 | % FYI, plain.tex uses \\ as a temporary control sequence (why?), but |
| 959 | % this is not advertised and we don't care. Texinfo does not | 1051 | % this is not advertised and we don't care. Texinfo does not |
| @@ -964,15 +1056,16 @@ where each line of input produces a line of output.} | |||
| 964 | % | 1056 | % |
| 965 | \def\math{% | 1057 | \def\math{% |
| 966 | \tex | 1058 | \tex |
| 967 | \mathcode`\_="8000 \mathunderscore | 1059 | \mathunderscore |
| 968 | \let\\ = \mathbackslash | 1060 | \let\\ = \mathbackslash |
| 969 | \mathactive | 1061 | \mathactive |
| 970 | \implicitmath\finishmath} | 1062 | $\finishmath |
| 971 | \def\finishmath#1{#1\implicitmath\Etex} | 1063 | } |
| 1064 | \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. | ||
| 972 | 1065 | ||
| 973 | % Some active characters (such as <) are spaced differently in math. | 1066 | % Some active characters (such as <) are spaced differently in math. |
| 974 | % We have to reset their definitions in case the @math was an | 1067 | % We have to reset their definitions in case the @math was an argument |
| 975 | % argument to a command which set the catcodes (such as @item or @section). | 1068 | % to a command which sets the catcodes (such as @item or @section). |
| 976 | % | 1069 | % |
| 977 | { | 1070 | { |
| 978 | \catcode`^ = \active | 1071 | \catcode`^ = \active |
| @@ -988,8 +1081,33 @@ where each line of input produces a line of output.} | |||
| 988 | } | 1081 | } |
| 989 | 1082 | ||
| 990 | % @bullet and @minus need the same treatment as @math, just above. | 1083 | % @bullet and @minus need the same treatment as @math, just above. |
| 991 | \def\bullet{\implicitmath\ptexbullet\implicitmath} | 1084 | \def\bullet{$\ptexbullet$} |
| 992 | \def\minus{\implicitmath-\implicitmath} | 1085 | \def\minus{$-$} |
| 1086 | |||
| 1087 | % @dots{} outputs an ellipsis using the current font. | ||
| 1088 | % We do .5em per period so that it has the same spacing in a typewriter | ||
| 1089 | % font as three actual period characters. | ||
| 1090 | % | ||
| 1091 | \def\dots{% | ||
| 1092 | \leavevmode | ||
| 1093 | \hbox to 1.5em{% | ||
| 1094 | \hskip 0pt plus 0.25fil | ||
| 1095 | .\hfil.\hfil.% | ||
| 1096 | \hskip 0pt plus 0.5fil | ||
| 1097 | }% | ||
| 1098 | } | ||
| 1099 | |||
| 1100 | % @enddots{} is an end-of-sentence ellipsis. | ||
| 1101 | % | ||
| 1102 | \def\enddots{% | ||
| 1103 | \dots | ||
| 1104 | \spacefactor=\endofsentencespacefactor | ||
| 1105 | } | ||
| 1106 | |||
| 1107 | % @comma{} is so commas can be inserted into text without messing up | ||
| 1108 | % Texinfo's parsing. | ||
| 1109 | % | ||
| 1110 | \let\comma = , | ||
| 993 | 1111 | ||
| 994 | % @refill is a no-op. | 1112 | % @refill is a no-op. |
| 995 | \let\refill=\relax | 1113 | \let\refill=\relax |
| @@ -1005,20 +1123,20 @@ where each line of input produces a line of output.} | |||
| 1005 | % So open here the files we need to have open while reading the input. | 1123 | % So open here the files we need to have open while reading the input. |
| 1006 | % This makes it possible to make a .fmt file for texinfo. | 1124 | % This makes it possible to make a .fmt file for texinfo. |
| 1007 | \def\setfilename{% | 1125 | \def\setfilename{% |
| 1126 | \fixbackslash % Turn off hack to swallow `\input texinfo'. | ||
| 1008 | \iflinks | 1127 | \iflinks |
| 1009 | \readauxfile | 1128 | \tryauxfile |
| 1129 | % Open the new aux file. TeX will close it automatically at exit. | ||
| 1130 | \immediate\openout\auxfile=\jobname.aux | ||
| 1010 | \fi % \openindices needs to do some work in any case. | 1131 | \fi % \openindices needs to do some work in any case. |
| 1011 | \openindices | 1132 | \openindices |
| 1012 | \fixbackslash % Turn off hack to swallow `\input texinfo'. | 1133 | \let\setfilename=\comment % Ignore extra @setfilename cmds. |
| 1013 | \global\let\setfilename=\comment % Ignore extra @setfilename cmds. | ||
| 1014 | % | 1134 | % |
| 1015 | % If texinfo.cnf is present on the system, read it. | 1135 | % If texinfo.cnf is present on the system, read it. |
| 1016 | % Useful for site-wide @afourpaper, etc. | 1136 | % Useful for site-wide @afourpaper, etc. |
| 1017 | % Just to be on the safe side, close the input stream before the \input. | ||
| 1018 | \openin 1 texinfo.cnf | 1137 | \openin 1 texinfo.cnf |
| 1019 | \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi | 1138 | \ifeof 1 \else \input texinfo.cnf \fi |
| 1020 | \closein1 | 1139 | \closein 1 |
| 1021 | \temp | ||
| 1022 | % | 1140 | % |
| 1023 | \comment % Ignore the actual filename. | 1141 | \comment % Ignore the actual filename. |
| 1024 | } | 1142 | } |
| @@ -1054,17 +1172,72 @@ where each line of input produces a line of output.} | |||
| 1054 | \newif\ifpdf | 1172 | \newif\ifpdf |
| 1055 | \newif\ifpdfmakepagedest | 1173 | \newif\ifpdfmakepagedest |
| 1056 | 1174 | ||
| 1175 | % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 | ||
| 1176 | % can be set). So we test for \relax and 0 as well as \undefined, | ||
| 1177 | % borrowed from ifpdf.sty. | ||
| 1057 | \ifx\pdfoutput\undefined | 1178 | \ifx\pdfoutput\undefined |
| 1058 | \pdffalse | ||
| 1059 | \let\pdfmkdest = \gobble | ||
| 1060 | \let\pdfurl = \gobble | ||
| 1061 | \let\endlink = \relax | ||
| 1062 | \let\linkcolor = \relax | ||
| 1063 | \let\pdfmakeoutlines = \relax | ||
| 1064 | \else | 1179 | \else |
| 1065 | \pdftrue | 1180 | \ifx\pdfoutput\relax |
| 1066 | \pdfoutput = 1 | 1181 | \else |
| 1182 | \ifcase\pdfoutput | ||
| 1183 | \else | ||
| 1184 | \pdftrue | ||
| 1185 | \fi | ||
| 1186 | \fi | ||
| 1187 | \fi | ||
| 1188 | |||
| 1189 | % PDF uses PostScript string constants for the names of xref targets, | ||
| 1190 | % for display in the outlines, and in other places. Thus, we have to | ||
| 1191 | % double any backslashes. Otherwise, a name like "\node" will be | ||
| 1192 | % interpreted as a newline (\n), followed by o, d, e. Not good. | ||
| 1193 | % http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html | ||
| 1194 | % (and related messages, the final outcome is that it is up to the TeX | ||
| 1195 | % user to double the backslashes and otherwise make the string valid, so | ||
| 1196 | % that's what we do). | ||
| 1197 | |||
| 1198 | % double active backslashes. | ||
| 1199 | % | ||
| 1200 | {\catcode`\@=0 \catcode`\\=\active | ||
| 1201 | @gdef@activebackslashdouble{% | ||
| 1202 | @catcode`@\=@active | ||
| 1203 | @let\=@doublebackslash} | ||
| 1204 | } | ||
| 1205 | |||
| 1206 | % To handle parens, we must adopt a different approach, since parens are | ||
| 1207 | % not active characters. hyperref.dtx (which has the same problem as | ||
| 1208 | % us) handles it with this amazing macro to replace tokens. I've | ||
| 1209 | % tinkered with it a little for texinfo, but it's definitely from there. | ||
| 1210 | % | ||
| 1211 | % #1 is the tokens to replace. | ||
| 1212 | % #2 is the replacement. | ||
| 1213 | % #3 is the control sequence with the string. | ||
| 1214 | % | ||
| 1215 | \def\HyPsdSubst#1#2#3{% | ||
| 1216 | \def\HyPsdReplace##1#1##2\END{% | ||
| 1217 | ##1% | ||
| 1218 | \ifx\\##2\\% | ||
| 1219 | \else | ||
| 1220 | #2% | ||
| 1221 | \HyReturnAfterFi{% | ||
| 1222 | \HyPsdReplace##2\END | ||
| 1223 | }% | ||
| 1224 | \fi | ||
| 1225 | }% | ||
| 1226 | \xdef#3{\expandafter\HyPsdReplace#3#1\END}% | ||
| 1227 | } | ||
| 1228 | \long\def\HyReturnAfterFi#1\fi{\fi#1} | ||
| 1229 | |||
| 1230 | % #1 is a control sequence in which to do the replacements. | ||
| 1231 | \def\backslashparens#1{% | ||
| 1232 | \xdef#1{#1}% redefine it as its expansion; the definition is simply | ||
| 1233 | % \lastnode when called from \setref -> \pdfmkdest. | ||
| 1234 | \HyPsdSubst{(}{\realbackslash(}{#1}% | ||
| 1235 | \HyPsdSubst{)}{\realbackslash)}{#1}% | ||
| 1236 | } | ||
| 1237 | |||
| 1238 | \ifpdf | ||
| 1067 | \input pdfcolor | 1239 | \input pdfcolor |
| 1240 | \pdfcatalog{/PageMode /UseOutlines}% | ||
| 1068 | \def\dopdfimage#1#2#3{% | 1241 | \def\dopdfimage#1#2#3{% |
| 1069 | \def\imagewidth{#2}% | 1242 | \def\imagewidth{#2}% |
| 1070 | \def\imageheight{#3}% | 1243 | \def\imageheight{#3}% |
| @@ -1085,8 +1258,19 @@ where each line of input produces a line of output.} | |||
| 1085 | \ifnum\pdftexversion < 14 \else | 1258 | \ifnum\pdftexversion < 14 \else |
| 1086 | \pdfrefximage \pdflastximage | 1259 | \pdfrefximage \pdflastximage |
| 1087 | \fi} | 1260 | \fi} |
| 1088 | \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}} | 1261 | \def\pdfmkdest#1{{% |
| 1089 | \def\pdfmkpgn#1{#1} | 1262 | % We have to set dummies so commands such as @code, and characters |
| 1263 | % such as \, aren't expanded when present in a section title. | ||
| 1264 | \atdummies | ||
| 1265 | \activebackslashdouble | ||
| 1266 | \def\pdfdestname{#1}% | ||
| 1267 | \backslashparens\pdfdestname | ||
| 1268 | \pdfdest name{\pdfdestname} xyz% | ||
| 1269 | }}% | ||
| 1270 | % | ||
| 1271 | % used to mark target names; must be expandable. | ||
| 1272 | \def\pdfmkpgn#1{#1}% | ||
| 1273 | % | ||
| 1090 | \let\linkcolor = \Blue % was Cyan, but that seems light? | 1274 | \let\linkcolor = \Blue % was Cyan, but that seems light? |
| 1091 | \def\endlink{\Black\pdfendlink} | 1275 | \def\endlink{\Black\pdfendlink} |
| 1092 | % Adding outlines to PDF; macros for calculating structure of outlines | 1276 | % Adding outlines to PDF; macros for calculating structure of outlines |
| @@ -1094,79 +1278,106 @@ where each line of input produces a line of output.} | |||
| 1094 | \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% | 1278 | \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% |
| 1095 | \else \csname#1\endcsname \fi} | 1279 | \else \csname#1\endcsname \fi} |
| 1096 | \def\advancenumber#1{\tempnum=\expnumber{#1}\relax | 1280 | \def\advancenumber#1{\tempnum=\expnumber{#1}\relax |
| 1097 | \advance\tempnum by1 | 1281 | \advance\tempnum by 1 |
| 1098 | \expandafter\xdef\csname#1\endcsname{\the\tempnum}} | 1282 | \expandafter\xdef\csname#1\endcsname{\the\tempnum}} |
| 1099 | \def\pdfmakeoutlines{{% | 1283 | % |
| 1100 | \openin 1 \jobname.toc | 1284 | % #1 is the section text, which is what will be displayed in the |
| 1101 | \ifeof 1\else\begingroup | 1285 | % outline by the pdf viewer. #2 is the pdf expression for the number |
| 1102 | \closein 1 | 1286 | % of subentries (or empty, for subsubsections). #3 is the node text, |
| 1287 | % which might be empty if this toc entry had no corresponding node. | ||
| 1288 | % #4 is the page number | ||
| 1289 | % | ||
| 1290 | \def\dopdfoutline#1#2#3#4{% | ||
| 1291 | % Generate a link to the node text if that exists; else, use the | ||
| 1292 | % page number. We could generate a destination for the section | ||
| 1293 | % text in the case where a section has no node, but it doesn't | ||
| 1294 | % seem worth the trouble, since most documents are normally structured. | ||
| 1295 | \def\pdfoutlinedest{#3}% | ||
| 1296 | \ifx\pdfoutlinedest\empty | ||
| 1297 | \def\pdfoutlinedest{#4}% | ||
| 1298 | \else | ||
| 1299 | % Doubled backslashes in the name. | ||
| 1300 | {\activebackslashdouble \xdef\pdfoutlinedest{#3}% | ||
| 1301 | \backslashparens\pdfoutlinedest}% | ||
| 1302 | \fi | ||
| 1303 | % | ||
| 1304 | % Also double the backslashes in the display string. | ||
| 1305 | {\activebackslashdouble \xdef\pdfoutlinetext{#1}% | ||
| 1306 | \backslashparens\pdfoutlinetext}% | ||
| 1307 | % | ||
| 1308 | \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% | ||
| 1309 | } | ||
| 1310 | % | ||
| 1311 | \def\pdfmakeoutlines{% | ||
| 1312 | \begingroup | ||
| 1103 | % Thanh's hack / proper braces in bookmarks | 1313 | % Thanh's hack / proper braces in bookmarks |
| 1104 | \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace | 1314 | \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace |
| 1105 | \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace | 1315 | \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace |
| 1106 | % | 1316 | % |
| 1107 | \def\chapentry ##1##2##3{} | 1317 | % Read toc silently, to get counts of subentries for \pdfoutline. |
| 1108 | \def\secentry ##1##2##3##4{\advancenumber{chap##2}} | 1318 | \def\numchapentry##1##2##3##4{% |
| 1109 | \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}} | 1319 | \def\thischapnum{##2}% |
| 1110 | \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}} | 1320 | \def\thissecnum{0}% |
| 1111 | \let\appendixentry = \chapentry | 1321 | \def\thissubsecnum{0}% |
| 1112 | \let\unnumbchapentry = \chapentry | 1322 | }% |
| 1113 | \let\unnumbsecentry = \secentry | 1323 | \def\numsecentry##1##2##3##4{% |
| 1114 | \let\unnumbsubsecentry = \subsecentry | 1324 | \advancenumber{chap\thischapnum}% |
| 1115 | \let\unnumbsubsubsecentry = \subsubsecentry | 1325 | \def\thissecnum{##2}% |
| 1116 | \input \jobname.toc | 1326 | \def\thissubsecnum{0}% |
| 1117 | \def\chapentry ##1##2##3{% | 1327 | }% |
| 1118 | \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}} | 1328 | \def\numsubsecentry##1##2##3##4{% |
| 1119 | \def\secentry ##1##2##3##4{% | 1329 | \advancenumber{sec\thissecnum}% |
| 1120 | \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}} | 1330 | \def\thissubsecnum{##2}% |
| 1121 | \def\subsecentry ##1##2##3##4##5{% | 1331 | }% |
| 1122 | \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}} | 1332 | \def\numsubsubsecentry##1##2##3##4{% |
| 1123 | \def\subsubsecentry ##1##2##3##4##5##6{% | 1333 | \advancenumber{subsec\thissubsecnum}% |
| 1124 | \pdfoutline goto name{\pdfmkpgn{##6}}{##1}} | 1334 | }% |
| 1125 | \let\appendixentry = \chapentry | 1335 | \def\thischapnum{0}% |
| 1126 | \let\unnumbchapentry = \chapentry | 1336 | \def\thissecnum{0}% |
| 1127 | \let\unnumbsecentry = \secentry | 1337 | \def\thissubsecnum{0}% |
| 1128 | \let\unnumbsubsecentry = \subsecentry | ||
| 1129 | \let\unnumbsubsubsecentry = \subsubsecentry | ||
| 1130 | % | 1338 | % |
| 1131 | % Make special characters normal for writing to the pdf file. | 1339 | % use \def rather than \let here because we redefine \chapentry et |
| 1340 | % al. a second time, below. | ||
| 1341 | \def\appentry{\numchapentry}% | ||
| 1342 | \def\appsecentry{\numsecentry}% | ||
| 1343 | \def\appsubsecentry{\numsubsecentry}% | ||
| 1344 | \def\appsubsubsecentry{\numsubsubsecentry}% | ||
| 1345 | \def\unnchapentry{\numchapentry}% | ||
| 1346 | \def\unnsecentry{\numsecentry}% | ||
| 1347 | \def\unnsubsecentry{\numsubsecentry}% | ||
| 1348 | \def\unnsubsubsecentry{\numsubsubsecentry}% | ||
| 1349 | \readdatafile{toc}% | ||
| 1132 | % | 1350 | % |
| 1351 | % Read toc second time, this time actually producing the outlines. | ||
| 1352 | % The `-' means take the \expnumber as the absolute number of | ||
| 1353 | % subentries, which we calculated on our first read of the .toc above. | ||
| 1354 | % | ||
| 1355 | % We use the node names as the destinations. | ||
| 1356 | \def\numchapentry##1##2##3##4{% | ||
| 1357 | \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% | ||
| 1358 | \def\numsecentry##1##2##3##4{% | ||
| 1359 | \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% | ||
| 1360 | \def\numsubsecentry##1##2##3##4{% | ||
| 1361 | \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% | ||
| 1362 | \def\numsubsubsecentry##1##2##3##4{% count is always zero | ||
| 1363 | \dopdfoutline{##1}{}{##3}{##4}}% | ||
| 1364 | % | ||
| 1365 | % PDF outlines are displayed using system fonts, instead of | ||
| 1366 | % document fonts. Therefore we cannot use special characters, | ||
| 1367 | % since the encoding is unknown. For example, the eogonek from | ||
| 1368 | % Latin 2 (0xea) gets translated to a | character. Info from | ||
| 1369 | % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. | ||
| 1370 | % | ||
| 1371 | % xx to do this right, we have to translate 8-bit characters to | ||
| 1372 | % their "best" equivalent, based on the @documentencoding. Right | ||
| 1373 | % now, I guess we'll just let the pdf reader have its way. | ||
| 1133 | \indexnofonts | 1374 | \indexnofonts |
| 1134 | \let\tt=\relax | 1375 | \setupdatafile |
| 1135 | \turnoffactive | 1376 | \catcode`\\=\active \otherbackslash |
| 1136 | \input \jobname.toc | 1377 | \input \jobname.toc |
| 1137 | \endgroup\fi | 1378 | \endgroup |
| 1138 | }} | ||
| 1139 | \def\makelinks #1,{% | ||
| 1140 | \def\params{#1}\def\E{END}% | ||
| 1141 | \ifx\params\E | ||
| 1142 | \let\nextmakelinks=\relax | ||
| 1143 | \else | ||
| 1144 | \let\nextmakelinks=\makelinks | ||
| 1145 | \ifnum\lnkcount>0,\fi | ||
| 1146 | \picknum{#1}% | ||
| 1147 | \startlink attr{/Border [0 0 0]} | ||
| 1148 | goto name{\pdfmkpgn{\the\pgn}}% | ||
| 1149 | \linkcolor #1% | ||
| 1150 | \advance\lnkcount by 1% | ||
| 1151 | \endlink | ||
| 1152 | \fi | ||
| 1153 | \nextmakelinks | ||
| 1154 | } | ||
| 1155 | \def\picknum#1{\expandafter\pn#1} | ||
| 1156 | \def\pn#1{% | ||
| 1157 | \def\p{#1}% | ||
| 1158 | \ifx\p\lbrace | ||
| 1159 | \let\nextpn=\ppn | ||
| 1160 | \else | ||
| 1161 | \let\nextpn=\ppnn | ||
| 1162 | \def\first{#1} | ||
| 1163 | \fi | ||
| 1164 | \nextpn | ||
| 1165 | } | 1379 | } |
| 1166 | \def\ppn#1{\pgn=#1\gobble} | 1380 | % |
| 1167 | \def\ppnn{\pgn=\first} | ||
| 1168 | \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} | ||
| 1169 | \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} | ||
| 1170 | \def\skipspaces#1{\def\PP{#1}\def\D{|}% | 1381 | \def\skipspaces#1{\def\PP{#1}\def\D{|}% |
| 1171 | \ifx\PP\D\let\nextsp\relax | 1382 | \ifx\PP\D\let\nextsp\relax |
| 1172 | \else\let\nextsp\skipspaces | 1383 | \else\let\nextsp\skipspaces |
| @@ -1181,21 +1392,28 @@ where each line of input produces a line of output.} | |||
| 1181 | \else | 1392 | \else |
| 1182 | \let \startlink \pdfstartlink | 1393 | \let \startlink \pdfstartlink |
| 1183 | \fi | 1394 | \fi |
| 1395 | % make a live url in pdf output. | ||
| 1184 | \def\pdfurl#1{% | 1396 | \def\pdfurl#1{% |
| 1185 | \begingroup | 1397 | \begingroup |
| 1186 | \normalturnoffactive\def\@{@}% | 1398 | % it seems we really need yet another set of dummies; have not |
| 1187 | \let\value=\expandablevalue | 1399 | % tried to figure out what each command should do in the context |
| 1400 | % of @url. for now, just make @/ a no-op, that's the only one | ||
| 1401 | % people have actually reported a problem with. | ||
| 1402 | % | ||
| 1403 | \normalturnoffactive | ||
| 1404 | \def\@{@}% | ||
| 1405 | \let\/=\empty | ||
| 1406 | \makevalueexpandable | ||
| 1188 | \leavevmode\Red | 1407 | \leavevmode\Red |
| 1189 | \startlink attr{/Border [0 0 0]}% | 1408 | \startlink attr{/Border [0 0 0]}% |
| 1190 | user{/Subtype /Link /A << /S /URI /URI (#1) >>}% | 1409 | user{/Subtype /Link /A << /S /URI /URI (#1) >>}% |
| 1191 | % #1 | ||
| 1192 | \endgroup} | 1410 | \endgroup} |
| 1193 | \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} | 1411 | \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} |
| 1194 | \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} | 1412 | \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} |
| 1195 | \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} | 1413 | \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} |
| 1196 | \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} | 1414 | \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} |
| 1197 | \def\maketoks{% | 1415 | \def\maketoks{% |
| 1198 | \expandafter\poptoks\the\toksA|ENDTOKS| | 1416 | \expandafter\poptoks\the\toksA|ENDTOKS|\relax |
| 1199 | \ifx\first0\adn0 | 1417 | \ifx\first0\adn0 |
| 1200 | \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 | 1418 | \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 |
| 1201 | \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 | 1419 | \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 |
| @@ -1215,20 +1433,44 @@ where each line of input produces a line of output.} | |||
| 1215 | \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} | 1433 | \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} |
| 1216 | \linkcolor #1\endlink} | 1434 | \linkcolor #1\endlink} |
| 1217 | \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} | 1435 | \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} |
| 1218 | \fi % \ifx\pdfoutput | 1436 | \else |
| 1437 | \let\pdfmkdest = \gobble | ||
| 1438 | \let\pdfurl = \gobble | ||
| 1439 | \let\endlink = \relax | ||
| 1440 | \let\linkcolor = \relax | ||
| 1441 | \let\pdfmakeoutlines = \relax | ||
| 1442 | \fi % \ifx\pdfoutput | ||
| 1219 | 1443 | ||
| 1220 | 1444 | ||
| 1221 | \message{fonts,} | 1445 | \message{fonts,} |
| 1222 | % Font-change commands. | 1446 | |
| 1447 | % Change the current font style to #1, remembering it in \curfontstyle. | ||
| 1448 | % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in | ||
| 1449 | % italics, not bold italics. | ||
| 1450 | % | ||
| 1451 | \def\setfontstyle#1{% | ||
| 1452 | \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. | ||
| 1453 | \csname ten#1\endcsname % change the current font | ||
| 1454 | } | ||
| 1455 | |||
| 1456 | % Select #1 fonts with the current style. | ||
| 1457 | % | ||
| 1458 | \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} | ||
| 1459 | |||
| 1460 | \def\rm{\fam=0 \setfontstyle{rm}} | ||
| 1461 | \def\it{\fam=\itfam \setfontstyle{it}} | ||
| 1462 | \def\sl{\fam=\slfam \setfontstyle{sl}} | ||
| 1463 | \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} | ||
| 1464 | \def\tt{\fam=\ttfam \setfontstyle{tt}} | ||
| 1223 | 1465 | ||
| 1224 | % Texinfo sort of supports the sans serif font style, which plain TeX does not. | 1466 | % Texinfo sort of supports the sans serif font style, which plain TeX does not. |
| 1225 | % So we set up a \sf analogous to plain's \rm, etc. | 1467 | % So we set up a \sf. |
| 1226 | \newfam\sffam | 1468 | \newfam\sffam |
| 1227 | \def\sf{\fam=\sffam \tensf} | 1469 | \def\sf{\fam=\sffam \setfontstyle{sf}} |
| 1228 | \let\li = \sf % Sometimes we call it \li, not \sf. | 1470 | \let\li = \sf % Sometimes we call it \li, not \sf. |
| 1229 | 1471 | ||
| 1230 | % We don't need math for this one. | 1472 | % We don't need math for this font style. |
| 1231 | \def\ttsl{\tenttsl} | 1473 | \def\ttsl{\setfontstyle{ttsl}} |
| 1232 | 1474 | ||
| 1233 | % Default leading. | 1475 | % Default leading. |
| 1234 | \newdimen\textleading \textleading = 13.2pt | 1476 | \newdimen\textleading \textleading = 13.2pt |
| @@ -1279,21 +1521,11 @@ where each line of input produces a line of output.} | |||
| 1279 | \def\scshape{csc} | 1521 | \def\scshape{csc} |
| 1280 | \def\scbshape{csc} | 1522 | \def\scbshape{csc} |
| 1281 | 1523 | ||
| 1282 | \newcount\mainmagstep | 1524 | % Text fonts (11.2pt, magstep1). |
| 1283 | \ifx\bigger\relax | 1525 | \def\textnominalsize{11pt} |
| 1284 | % not really supported. | 1526 | \edef\mainmagstep{\magstephalf} |
| 1285 | \mainmagstep=\magstep1 | 1527 | \setfont\textrm\rmshape{10}{\mainmagstep} |
| 1286 | \setfont\textrm\rmshape{12}{1000} | 1528 | \setfont\texttt\ttshape{10}{\mainmagstep} |
| 1287 | \setfont\texttt\ttshape{12}{1000} | ||
| 1288 | \else | ||
| 1289 | \mainmagstep=\magstephalf | ||
| 1290 | \setfont\textrm\rmshape{10}{\mainmagstep} | ||
| 1291 | \setfont\texttt\ttshape{10}{\mainmagstep} | ||
| 1292 | \fi | ||
| 1293 | % Instead of cmb10, you may want to use cmbx10. | ||
| 1294 | % cmbx10 is a prettier font on its own, but cmb10 | ||
| 1295 | % looks better when embedded in a line with cmr10 | ||
| 1296 | % (in Bob's opinion). | ||
| 1297 | \setfont\textbf\bfshape{10}{\mainmagstep} | 1529 | \setfont\textbf\bfshape{10}{\mainmagstep} |
| 1298 | \setfont\textit\itshape{10}{\mainmagstep} | 1530 | \setfont\textit\itshape{10}{\mainmagstep} |
| 1299 | \setfont\textsl\slshape{10}{\mainmagstep} | 1531 | \setfont\textsl\slshape{10}{\mainmagstep} |
| @@ -1303,12 +1535,14 @@ where each line of input produces a line of output.} | |||
| 1303 | \font\texti=cmmi10 scaled \mainmagstep | 1535 | \font\texti=cmmi10 scaled \mainmagstep |
| 1304 | \font\textsy=cmsy10 scaled \mainmagstep | 1536 | \font\textsy=cmsy10 scaled \mainmagstep |
| 1305 | 1537 | ||
| 1306 | % A few fonts for @defun, etc. | 1538 | % A few fonts for @defun names and args. |
| 1307 | \setfont\defbf\bxshape{10}{\magstep1} %was 1314 | 1539 | \setfont\defbf\bfshape{10}{\magstep1} |
| 1308 | \setfont\deftt\ttshape{10}{\magstep1} | 1540 | \setfont\deftt\ttshape{10}{\magstep1} |
| 1309 | \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} | 1541 | \setfont\defttsl\ttslshape{10}{\magstep1} |
| 1542 | \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} | ||
| 1310 | 1543 | ||
| 1311 | % Fonts for indices, footnotes, small examples (9pt). | 1544 | % Fonts for indices, footnotes, small examples (9pt). |
| 1545 | \def\smallnominalsize{9pt} | ||
| 1312 | \setfont\smallrm\rmshape{9}{1000} | 1546 | \setfont\smallrm\rmshape{9}{1000} |
| 1313 | \setfont\smalltt\ttshape{9}{1000} | 1547 | \setfont\smalltt\ttshape{9}{1000} |
| 1314 | \setfont\smallbf\bfshape{10}{900} | 1548 | \setfont\smallbf\bfshape{10}{900} |
| @@ -1321,6 +1555,7 @@ where each line of input produces a line of output.} | |||
| 1321 | \font\smallsy=cmsy9 | 1555 | \font\smallsy=cmsy9 |
| 1322 | 1556 | ||
| 1323 | % Fonts for small examples (8pt). | 1557 | % Fonts for small examples (8pt). |
| 1558 | \def\smallernominalsize{8pt} | ||
| 1324 | \setfont\smallerrm\rmshape{8}{1000} | 1559 | \setfont\smallerrm\rmshape{8}{1000} |
| 1325 | \setfont\smallertt\ttshape{8}{1000} | 1560 | \setfont\smallertt\ttshape{8}{1000} |
| 1326 | \setfont\smallerbf\bfshape{10}{800} | 1561 | \setfont\smallerbf\bfshape{10}{800} |
| @@ -1332,7 +1567,8 @@ where each line of input produces a line of output.} | |||
| 1332 | \font\smalleri=cmmi8 | 1567 | \font\smalleri=cmmi8 |
| 1333 | \font\smallersy=cmsy8 | 1568 | \font\smallersy=cmsy8 |
| 1334 | 1569 | ||
| 1335 | % Fonts for title page: | 1570 | % Fonts for title page (20.4pt): |
| 1571 | \def\titlenominalsize{20pt} | ||
| 1336 | \setfont\titlerm\rmbshape{12}{\magstep3} | 1572 | \setfont\titlerm\rmbshape{12}{\magstep3} |
| 1337 | \setfont\titleit\itbshape{10}{\magstep4} | 1573 | \setfont\titleit\itbshape{10}{\magstep4} |
| 1338 | \setfont\titlesl\slbshape{10}{\magstep4} | 1574 | \setfont\titlesl\slbshape{10}{\magstep4} |
| @@ -1347,6 +1583,7 @@ where each line of input produces a line of output.} | |||
| 1347 | \def\authortt{\sectt} | 1583 | \def\authortt{\sectt} |
| 1348 | 1584 | ||
| 1349 | % Chapter (and unnumbered) fonts (17.28pt). | 1585 | % Chapter (and unnumbered) fonts (17.28pt). |
| 1586 | \def\chapnominalsize{17pt} | ||
| 1350 | \setfont\chaprm\rmbshape{12}{\magstep2} | 1587 | \setfont\chaprm\rmbshape{12}{\magstep2} |
| 1351 | \setfont\chapit\itbshape{10}{\magstep3} | 1588 | \setfont\chapit\itbshape{10}{\magstep3} |
| 1352 | \setfont\chapsl\slbshape{10}{\magstep3} | 1589 | \setfont\chapsl\slbshape{10}{\magstep3} |
| @@ -1359,6 +1596,7 @@ where each line of input produces a line of output.} | |||
| 1359 | \font\chapsy=cmsy10 scaled \magstep3 | 1596 | \font\chapsy=cmsy10 scaled \magstep3 |
| 1360 | 1597 | ||
| 1361 | % Section fonts (14.4pt). | 1598 | % Section fonts (14.4pt). |
| 1599 | \def\secnominalsize{14pt} | ||
| 1362 | \setfont\secrm\rmbshape{12}{\magstep1} | 1600 | \setfont\secrm\rmbshape{12}{\magstep1} |
| 1363 | \setfont\secit\itbshape{10}{\magstep2} | 1601 | \setfont\secit\itbshape{10}{\magstep2} |
| 1364 | \setfont\secsl\slbshape{10}{\magstep2} | 1602 | \setfont\secsl\slbshape{10}{\magstep2} |
| @@ -1371,6 +1609,7 @@ where each line of input produces a line of output.} | |||
| 1371 | \font\secsy=cmsy10 scaled \magstep2 | 1609 | \font\secsy=cmsy10 scaled \magstep2 |
| 1372 | 1610 | ||
| 1373 | % Subsection fonts (13.15pt). | 1611 | % Subsection fonts (13.15pt). |
| 1612 | \def\ssecnominalsize{13pt} | ||
| 1374 | \setfont\ssecrm\rmbshape{12}{\magstephalf} | 1613 | \setfont\ssecrm\rmbshape{12}{\magstephalf} |
| 1375 | \setfont\ssecit\itbshape{10}{1315} | 1614 | \setfont\ssecit\itbshape{10}{1315} |
| 1376 | \setfont\ssecsl\slbshape{10}{1315} | 1615 | \setfont\ssecsl\slbshape{10}{1315} |
| @@ -1378,11 +1617,22 @@ where each line of input produces a line of output.} | |||
| 1378 | \setfont\ssecttsl\ttslshape{10}{1315} | 1617 | \setfont\ssecttsl\ttslshape{10}{1315} |
| 1379 | \setfont\ssecsf\sfbshape{12}{\magstephalf} | 1618 | \setfont\ssecsf\sfbshape{12}{\magstephalf} |
| 1380 | \let\ssecbf\ssecrm | 1619 | \let\ssecbf\ssecrm |
| 1381 | \setfont\ssecsc\scbshape{10}{\magstep1} | 1620 | \setfont\ssecsc\scbshape{10}{1315} |
| 1382 | \font\sseci=cmmi12 scaled \magstephalf | 1621 | \font\sseci=cmmi12 scaled \magstephalf |
| 1383 | \font\ssecsy=cmsy10 scaled 1315 | 1622 | \font\ssecsy=cmsy10 scaled 1315 |
| 1384 | % The smallcaps and symbol fonts should actually be scaled \magstep1.5, | 1623 | |
| 1385 | % but that is not a standard magnification. | 1624 | % Reduced fonts for @acro in text (10pt). |
| 1625 | \def\reducednominalsize{10pt} | ||
| 1626 | \setfont\reducedrm\rmshape{10}{1000} | ||
| 1627 | \setfont\reducedtt\ttshape{10}{1000} | ||
| 1628 | \setfont\reducedbf\bfshape{10}{1000} | ||
| 1629 | \setfont\reducedit\itshape{10}{1000} | ||
| 1630 | \setfont\reducedsl\slshape{10}{1000} | ||
| 1631 | \setfont\reducedsf\sfshape{10}{1000} | ||
| 1632 | \setfont\reducedsc\scshape{10}{1000} | ||
| 1633 | \setfont\reducedttsl\ttslshape{10}{1000} | ||
| 1634 | \font\reducedi=cmmi10 | ||
| 1635 | \font\reducedsy=cmsy10 | ||
| 1386 | 1636 | ||
| 1387 | % In order for the font changes to affect most math symbols and letters, | 1637 | % In order for the font changes to affect most math symbols and letters, |
| 1388 | % we have to define the \textfont of the standard families. Since | 1638 | % we have to define the \textfont of the standard families. Since |
| @@ -1397,50 +1647,81 @@ where each line of input produces a line of output.} | |||
| 1397 | } | 1647 | } |
| 1398 | 1648 | ||
| 1399 | % The font-changing commands redefine the meanings of \tenSTYLE, instead | 1649 | % The font-changing commands redefine the meanings of \tenSTYLE, instead |
| 1400 | % of just \STYLE. We do this so that font changes will continue to work | 1650 | % of just \STYLE. We do this because \STYLE needs to also set the |
| 1401 | % in math mode, where it is the current \fam that is relevant in most | 1651 | % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire |
| 1402 | % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam | 1652 | % \tenSTYLE to set the current font. |
| 1403 | % \tenbf}, for example. By redefining \tenbf, we obviate the need to | 1653 | % |
| 1404 | % redefine \bf itself. | 1654 | % Each font-changing command also sets the names \lsize (one size lower) |
| 1655 | % and \lllsize (three sizes lower). These relative commands are used in | ||
| 1656 | % the LaTeX logo and acronyms. | ||
| 1657 | % | ||
| 1658 | % This all needs generalizing, badly. | ||
| 1659 | % | ||
| 1405 | \def\textfonts{% | 1660 | \def\textfonts{% |
| 1406 | \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl | 1661 | \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl |
| 1407 | \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc | 1662 | \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc |
| 1408 | \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl | 1663 | \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy |
| 1664 | \let\tenttsl=\textttsl | ||
| 1665 | \def\curfontsize{text}% | ||
| 1666 | \def\lsize{reduced}\def\lllsize{smaller}% | ||
| 1409 | \resetmathfonts \setleading{\textleading}} | 1667 | \resetmathfonts \setleading{\textleading}} |
| 1410 | \def\titlefonts{% | 1668 | \def\titlefonts{% |
| 1411 | \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl | 1669 | \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl |
| 1412 | \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc | 1670 | \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc |
| 1413 | \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy | 1671 | \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy |
| 1414 | \let\tenttsl=\titlettsl | 1672 | \let\tenttsl=\titlettsl |
| 1673 | \def\curfontsize{title}% | ||
| 1674 | \def\lsize{chap}\def\lllsize{subsec}% | ||
| 1415 | \resetmathfonts \setleading{25pt}} | 1675 | \resetmathfonts \setleading{25pt}} |
| 1416 | \def\titlefont#1{{\titlefonts\rm #1}} | 1676 | \def\titlefont#1{{\titlefonts\rm #1}} |
| 1417 | \def\chapfonts{% | 1677 | \def\chapfonts{% |
| 1418 | \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl | 1678 | \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl |
| 1419 | \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc | 1679 | \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc |
| 1420 | \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl | 1680 | \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy |
| 1681 | \let\tenttsl=\chapttsl | ||
| 1682 | \def\curfontsize{chap}% | ||
| 1683 | \def\lsize{sec}\def\lllsize{text}% | ||
| 1421 | \resetmathfonts \setleading{19pt}} | 1684 | \resetmathfonts \setleading{19pt}} |
| 1422 | \def\secfonts{% | 1685 | \def\secfonts{% |
| 1423 | \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl | 1686 | \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl |
| 1424 | \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc | 1687 | \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc |
| 1425 | \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl | 1688 | \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy |
| 1689 | \let\tenttsl=\secttsl | ||
| 1690 | \def\curfontsize{sec}% | ||
| 1691 | \def\lsize{subsec}\def\lllsize{reduced}% | ||
| 1426 | \resetmathfonts \setleading{16pt}} | 1692 | \resetmathfonts \setleading{16pt}} |
| 1427 | \def\subsecfonts{% | 1693 | \def\subsecfonts{% |
| 1428 | \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl | 1694 | \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl |
| 1429 | \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc | 1695 | \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc |
| 1430 | \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl | 1696 | \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy |
| 1697 | \let\tenttsl=\ssecttsl | ||
| 1698 | \def\curfontsize{ssec}% | ||
| 1699 | \def\lsize{text}\def\lllsize{small}% | ||
| 1431 | \resetmathfonts \setleading{15pt}} | 1700 | \resetmathfonts \setleading{15pt}} |
| 1432 | \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? | 1701 | \let\subsubsecfonts = \subsecfonts |
| 1702 | \def\reducedfonts{% | ||
| 1703 | \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl | ||
| 1704 | \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc | ||
| 1705 | \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy | ||
| 1706 | \let\tenttsl=\reducedttsl | ||
| 1707 | \def\curfontsize{reduced}% | ||
| 1708 | \def\lsize{small}\def\lllsize{smaller}% | ||
| 1709 | \resetmathfonts \setleading{10.5pt}} | ||
| 1433 | \def\smallfonts{% | 1710 | \def\smallfonts{% |
| 1434 | \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl | 1711 | \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl |
| 1435 | \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc | 1712 | \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc |
| 1436 | \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy | 1713 | \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy |
| 1437 | \let\tenttsl=\smallttsl | 1714 | \let\tenttsl=\smallttsl |
| 1715 | \def\curfontsize{small}% | ||
| 1716 | \def\lsize{smaller}\def\lllsize{smaller}% | ||
| 1438 | \resetmathfonts \setleading{10.5pt}} | 1717 | \resetmathfonts \setleading{10.5pt}} |
| 1439 | \def\smallerfonts{% | 1718 | \def\smallerfonts{% |
| 1440 | \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl | 1719 | \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl |
| 1441 | \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc | 1720 | \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc |
| 1442 | \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy | 1721 | \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy |
| 1443 | \let\tenttsl=\smallerttsl | 1722 | \let\tenttsl=\smallerttsl |
| 1723 | \def\curfontsize{smaller}% | ||
| 1724 | \def\lsize{smaller}\def\lllsize{smaller}% | ||
| 1444 | \resetmathfonts \setleading{9.5pt}} | 1725 | \resetmathfonts \setleading{9.5pt}} |
| 1445 | 1726 | ||
| 1446 | % Set the fonts to use with the @small... environments. | 1727 | % Set the fonts to use with the @small... environments. |
| @@ -1449,7 +1730,7 @@ where each line of input produces a line of output.} | |||
| 1449 | % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample | 1730 | % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample |
| 1450 | % can fit this many characters: | 1731 | % can fit this many characters: |
| 1451 | % 8.5x11=86 smallbook=72 a4=90 a5=69 | 1732 | % 8.5x11=86 smallbook=72 a4=90 a5=69 |
| 1452 | % If we use \smallerfonts (8pt), then we can fit this many characters: | 1733 | % If we use \scriptfonts (8pt), then we can fit this many characters: |
| 1453 | % 8.5x11=90+ smallbook=80 a4=90+ a5=77 | 1734 | % 8.5x11=90+ smallbook=80 a4=90+ a5=77 |
| 1454 | % For me, subjectively, the few extra characters that fit aren't worth | 1735 | % For me, subjectively, the few extra characters that fit aren't worth |
| 1455 | % the additional smallness of 8pt. So I'm making the default 9pt. | 1736 | % the additional smallness of 8pt. So I'm making the default 9pt. |
| @@ -1457,14 +1738,13 @@ where each line of input produces a line of output.} | |||
| 1457 | % By the way, for comparison, here's what fits with @example (10pt): | 1738 | % By the way, for comparison, here's what fits with @example (10pt): |
| 1458 | % 8.5x11=71 smallbook=60 a4=75 a5=58 | 1739 | % 8.5x11=71 smallbook=60 a4=75 a5=58 |
| 1459 | % | 1740 | % |
| 1460 | % I wish we used A4 paper on this side of the Atlantic. | 1741 | % I wish the USA used A4 paper. |
| 1461 | % | ||
| 1462 | % --karl, 24jan03. | 1742 | % --karl, 24jan03. |
| 1463 | 1743 | ||
| 1464 | 1744 | ||
| 1465 | % Set up the default fonts, so we can use them for creating boxes. | 1745 | % Set up the default fonts, so we can use them for creating boxes. |
| 1466 | % | 1746 | % |
| 1467 | \textfonts | 1747 | \textfonts \rm |
| 1468 | 1748 | ||
| 1469 | % Define these so they can be easily changed for other fonts. | 1749 | % Define these so they can be easily changed for other fonts. |
| 1470 | \def\angleleft{$\langle$} | 1750 | \def\angleleft{$\langle$} |
| @@ -1475,7 +1755,7 @@ where each line of input produces a line of output.} | |||
| 1475 | 1755 | ||
| 1476 | % Fonts for short table of contents. | 1756 | % Fonts for short table of contents. |
| 1477 | \setfont\shortcontrm\rmshape{12}{1000} | 1757 | \setfont\shortcontrm\rmshape{12}{1000} |
| 1478 | \setfont\shortcontbf\bxshape{12}{1000} | 1758 | \setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 |
| 1479 | \setfont\shortcontsl\slshape{12}{1000} | 1759 | \setfont\shortcontsl\slshape{12}{1000} |
| 1480 | \setfont\shortconttt\ttshape{12}{1000} | 1760 | \setfont\shortconttt\ttshape{12}{1000} |
| 1481 | 1761 | ||
| @@ -1489,15 +1769,27 @@ where each line of input produces a line of output.} | |||
| 1489 | \def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} | 1769 | \def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} |
| 1490 | \def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} | 1770 | \def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} |
| 1491 | 1771 | ||
| 1772 | % like \smartslanted except unconditionally uses \ttsl. | ||
| 1773 | % @var is set to this for defun arguments. | ||
| 1774 | \def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} | ||
| 1775 | |||
| 1776 | % like \smartslanted except unconditionally use \sl. We never want | ||
| 1777 | % ttsl for book titles, do we? | ||
| 1778 | \def\cite#1{{\sl #1}\futurelet\next\smartitalicx} | ||
| 1779 | |||
| 1492 | \let\i=\smartitalic | 1780 | \let\i=\smartitalic |
| 1781 | \let\slanted=\smartslanted | ||
| 1493 | \let\var=\smartslanted | 1782 | \let\var=\smartslanted |
| 1494 | \let\dfn=\smartslanted | 1783 | \let\dfn=\smartslanted |
| 1495 | \let\emph=\smartitalic | 1784 | \let\emph=\smartitalic |
| 1496 | \let\cite=\smartslanted | ||
| 1497 | 1785 | ||
| 1786 | % @b, explicit bold. | ||
| 1498 | \def\b#1{{\bf #1}} | 1787 | \def\b#1{{\bf #1}} |
| 1499 | \let\strong=\b | 1788 | \let\strong=\b |
| 1500 | 1789 | ||
| 1790 | % @sansserif, explicit sans. | ||
| 1791 | \def\sansserif#1{{\sf #1}} | ||
| 1792 | |||
| 1501 | % We can't just use \exhyphenpenalty, because that only has effect at | 1793 | % We can't just use \exhyphenpenalty, because that only has effect at |
| 1502 | % the end of a paragraph. Restore normal hyphenation at the end of the | 1794 | % the end of a paragraph. Restore normal hyphenation at the end of the |
| 1503 | % group within which \nohyphenation is presumably called. | 1795 | % group within which \nohyphenation is presumably called. |
| @@ -1509,18 +1801,31 @@ where each line of input produces a line of output.} | |||
| 1509 | % Can't use plain's \frenchspacing because it uses the `\x notation, and | 1801 | % Can't use plain's \frenchspacing because it uses the `\x notation, and |
| 1510 | % sometimes \x has an active definition that messes things up. | 1802 | % sometimes \x has an active definition that messes things up. |
| 1511 | % | 1803 | % |
| 1804 | \chardef\colonChar = `\: | ||
| 1805 | \chardef\commaChar = `\, | ||
| 1806 | \chardef\dotChar = `\. | ||
| 1807 | \chardef\exclamChar= `\! | ||
| 1808 | \chardef\questChar = `\? | ||
| 1809 | \chardef\semiChar = `\; | ||
| 1810 | % | ||
| 1512 | \catcode`@=11 | 1811 | \catcode`@=11 |
| 1513 | \def\frenchspacing{% | 1812 | \def\plainfrenchspacing{% |
| 1514 | \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m | 1813 | \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m |
| 1515 | \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m | 1814 | \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m |
| 1815 | \def\endofsentencespacefactor{1000}% for @. and friends | ||
| 1816 | } | ||
| 1817 | \def\plainnonfrenchspacing{% | ||
| 1818 | \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 | ||
| 1819 | \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 | ||
| 1820 | \def\endofsentencespacefactor{3000}% for @. and friends | ||
| 1516 | } | 1821 | } |
| 1517 | \catcode`@=\other | 1822 | \catcode`@=\other |
| 1823 | \def\endofsentencespacefactor{3000}% default | ||
| 1518 | 1824 | ||
| 1519 | \def\t#1{% | 1825 | \def\t#1{% |
| 1520 | {\tt \rawbackslash \frenchspacing #1}% | 1826 | {\tt \rawbackslash \plainfrenchspacing #1}% |
| 1521 | \null | 1827 | \null |
| 1522 | } | 1828 | } |
| 1523 | \let\ttfont=\t | ||
| 1524 | \def\samp#1{`\tclose{#1}'\null} | 1829 | \def\samp#1{`\tclose{#1}'\null} |
| 1525 | \setfont\keyrm\rmshape{8}{1000} | 1830 | \setfont\keyrm\rmshape{8}{1000} |
| 1526 | \font\keysy=cmsy9 | 1831 | \font\keysy=cmsy9 |
| @@ -1555,13 +1860,13 @@ where each line of input produces a line of output.} | |||
| 1555 | \nohyphenation | 1860 | \nohyphenation |
| 1556 | % | 1861 | % |
| 1557 | \rawbackslash | 1862 | \rawbackslash |
| 1558 | \frenchspacing | 1863 | \plainfrenchspacing |
| 1559 | #1% | 1864 | #1% |
| 1560 | }% | 1865 | }% |
| 1561 | \null | 1866 | \null |
| 1562 | } | 1867 | } |
| 1563 | 1868 | ||
| 1564 | % We *must* turn on hyphenation at `-' and `_' in \code. | 1869 | % We *must* turn on hyphenation at `-' and `_' in @code. |
| 1565 | % Otherwise, it is too hard to avoid overfull hboxes | 1870 | % Otherwise, it is too hard to avoid overfull hboxes |
| 1566 | % in the Emacs manual, the Library manual, etc. | 1871 | % in the Emacs manual, the Library manual, etc. |
| 1567 | 1872 | ||
| @@ -1575,14 +1880,16 @@ where each line of input produces a line of output.} | |||
| 1575 | \catcode`\_=\active | 1880 | \catcode`\_=\active |
| 1576 | % | 1881 | % |
| 1577 | \global\def\code{\begingroup | 1882 | \global\def\code{\begingroup |
| 1578 | \catcode`\-=\active \let-\codedash | 1883 | \catcode`\-=\active \catcode`\_=\active |
| 1579 | \catcode`\_=\active \let_\codeunder | 1884 | \ifallowcodebreaks |
| 1885 | \let-\codedash | ||
| 1886 | \let_\codeunder | ||
| 1887 | \else | ||
| 1888 | \let-\realdash | ||
| 1889 | \let_\realunder | ||
| 1890 | \fi | ||
| 1580 | \codex | 1891 | \codex |
| 1581 | } | 1892 | } |
| 1582 | % | ||
| 1583 | % If we end up with any active - characters when handling the index, | ||
| 1584 | % just treat them as a normal -. | ||
| 1585 | \global\def\indexbreaks{\catcode`\-=\active \let-\realdash} | ||
| 1586 | } | 1893 | } |
| 1587 | 1894 | ||
| 1588 | \def\realdash{-} | 1895 | \def\realdash{-} |
| @@ -1600,24 +1907,45 @@ where each line of input produces a line of output.} | |||
| 1600 | } | 1907 | } |
| 1601 | \def\codex #1{\tclose{#1}\endgroup} | 1908 | \def\codex #1{\tclose{#1}\endgroup} |
| 1602 | 1909 | ||
| 1910 | % An additional complication: the above will allow breaks after, e.g., | ||
| 1911 | % each of the four underscores in __typeof__. This is undesirable in | ||
| 1912 | % some manuals, especially if they don't have long identifiers in | ||
| 1913 | % general. @allowcodebreaks provides a way to control this. | ||
| 1914 | % | ||
| 1915 | \newif\ifallowcodebreaks \allowcodebreakstrue | ||
| 1916 | |||
| 1917 | \def\keywordtrue{true} | ||
| 1918 | \def\keywordfalse{false} | ||
| 1919 | |||
| 1920 | \parseargdef\allowcodebreaks{% | ||
| 1921 | \def\txiarg{#1}% | ||
| 1922 | \ifx\txiarg\keywordtrue | ||
| 1923 | \allowcodebreakstrue | ||
| 1924 | \else\ifx\txiarg\keywordfalse | ||
| 1925 | \allowcodebreaksfalse | ||
| 1926 | \else | ||
| 1927 | \errhelp = \EMsimple | ||
| 1928 | \errmessage{Unknown @allowcodebreaks option `\txiarg'}% | ||
| 1929 | \fi\fi | ||
| 1930 | } | ||
| 1931 | |||
| 1603 | % @kbd is like @code, except that if the argument is just one @key command, | 1932 | % @kbd is like @code, except that if the argument is just one @key command, |
| 1604 | % then @kbd has no effect. | 1933 | % then @kbd has no effect. |
| 1605 | 1934 | ||
| 1606 | % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), | 1935 | % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), |
| 1607 | % `example' (@kbd uses ttsl only inside of @example and friends), | 1936 | % `example' (@kbd uses ttsl only inside of @example and friends), |
| 1608 | % or `code' (@kbd uses normal tty font always). | 1937 | % or `code' (@kbd uses normal tty font always). |
| 1609 | \def\kbdinputstyle{\parsearg\kbdinputstylexxx} | 1938 | \parseargdef\kbdinputstyle{% |
| 1610 | \def\kbdinputstylexxx#1{% | 1939 | \def\txiarg{#1}% |
| 1611 | \def\arg{#1}% | 1940 | \ifx\txiarg\worddistinct |
| 1612 | \ifx\arg\worddistinct | ||
| 1613 | \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% | 1941 | \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% |
| 1614 | \else\ifx\arg\wordexample | 1942 | \else\ifx\txiarg\wordexample |
| 1615 | \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% | 1943 | \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% |
| 1616 | \else\ifx\arg\wordcode | 1944 | \else\ifx\txiarg\wordcode |
| 1617 | \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% | 1945 | \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% |
| 1618 | \else | 1946 | \else |
| 1619 | \errhelp = \EMsimple | 1947 | \errhelp = \EMsimple |
| 1620 | \errmessage{Unknown @kbdinputstyle option `\arg'}% | 1948 | \errmessage{Unknown @kbdinputstyle option `\txiarg'}% |
| 1621 | \fi\fi\fi | 1949 | \fi\fi\fi |
| 1622 | } | 1950 | } |
| 1623 | \def\worddistinct{distinct} | 1951 | \def\worddistinct{distinct} |
| @@ -1633,8 +1961,8 @@ where each line of input produces a line of output.} | |||
| 1633 | \else{\tclose{\kbdfont\look}}\fi | 1961 | \else{\tclose{\kbdfont\look}}\fi |
| 1634 | \else{\tclose{\kbdfont\look}}\fi} | 1962 | \else{\tclose{\kbdfont\look}}\fi} |
| 1635 | 1963 | ||
| 1636 | % For @url, @env, @command quotes seem unnecessary, so use \code. | 1964 | % For @indicateurl, @env, @command quotes seem unnecessary, so use \code. |
| 1637 | \let\url=\code | 1965 | \let\indicateurl=\code |
| 1638 | \let\env=\code | 1966 | \let\env=\code |
| 1639 | \let\command=\code | 1967 | \let\command=\code |
| 1640 | 1968 | ||
| @@ -1666,6 +1994,10 @@ where each line of input produces a line of output.} | |||
| 1666 | \endlink | 1994 | \endlink |
| 1667 | \endgroup} | 1995 | \endgroup} |
| 1668 | 1996 | ||
| 1997 | % @url synonym for @uref, since that's how everyone uses it. | ||
| 1998 | % | ||
| 1999 | \let\url=\uref | ||
| 2000 | |||
| 1669 | % rms does not like angle brackets --karl, 17may97. | 2001 | % rms does not like angle brackets --karl, 17may97. |
| 1670 | % So now @email is just like @uref, unless we are pdf. | 2002 | % So now @email is just like @uref, unless we are pdf. |
| 1671 | % | 2003 | % |
| @@ -1707,22 +2039,101 @@ where each line of input produces a line of output.} | |||
| 1707 | \def\sc#1{{\smallcaps#1}} % smallcaps font | 2039 | \def\sc#1{{\smallcaps#1}} % smallcaps font |
| 1708 | \def\ii#1{{\it #1}} % italic font | 2040 | \def\ii#1{{\it #1}} % italic font |
| 1709 | 2041 | ||
| 1710 | % @acronym downcases the argument and prints in smallcaps. | 2042 | % @acronym for "FBI", "NATO", and the like. |
| 1711 | \def\acronym#1{{\smallcaps \lowercase{#1}}} | 2043 | % We print this one point size smaller, since it's intended for |
| 2044 | % all-uppercase. | ||
| 2045 | % | ||
| 2046 | \def\acronym#1{\doacronym #1,,\finish} | ||
| 2047 | \def\doacronym#1,#2,#3\finish{% | ||
| 2048 | {\selectfonts\lsize #1}% | ||
| 2049 | \def\temp{#2}% | ||
| 2050 | \ifx\temp\empty \else | ||
| 2051 | \space ({\unsepspaces \ignorespaces \temp \unskip})% | ||
| 2052 | \fi | ||
| 2053 | } | ||
| 1712 | 2054 | ||
| 1713 | % @pounds{} is a sterling sign. | 2055 | % @abbr for "Comput. J." and the like. |
| 2056 | % No font change, but don't do end-of-sentence spacing. | ||
| 2057 | % | ||
| 2058 | \def\abbr#1{\doabbr #1,,\finish} | ||
| 2059 | \def\doabbr#1,#2,#3\finish{% | ||
| 2060 | {\plainfrenchspacing #1}% | ||
| 2061 | \def\temp{#2}% | ||
| 2062 | \ifx\temp\empty \else | ||
| 2063 | \space ({\unsepspaces \ignorespaces \temp \unskip})% | ||
| 2064 | \fi | ||
| 2065 | } | ||
| 2066 | |||
| 2067 | % @pounds{} is a sterling sign, which Knuth put in the CM italic font. | ||
| 2068 | % | ||
| 1714 | \def\pounds{{\it\$}} | 2069 | \def\pounds{{\it\$}} |
| 1715 | 2070 | ||
| 1716 | % @registeredsymbol - R in a circle. For now, only works in text size; | 2071 | % @euro{} comes from a separate font, depending on the current style. |
| 1717 | % we'd have to redo the font mechanism to change the \scriptstyle and | 2072 | % We use the free feym* fonts from the eurosym package by Henrik |
| 1718 | % \scriptscriptstyle font sizes to make it look right in headings. | 2073 | % Theiling, which support regular, slanted, bold and bold slanted (and |
| 2074 | % "outlined" (blackboard board, sort of) versions, which we don't need). | ||
| 2075 | % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. | ||
| 2076 | % | ||
| 2077 | % Although only regular is the truly official Euro symbol, we ignore | ||
| 2078 | % that. The Euro is designed to be slightly taller than the regular | ||
| 2079 | % font height. | ||
| 2080 | % | ||
| 2081 | % feymr - regular | ||
| 2082 | % feymo - slanted | ||
| 2083 | % feybr - bold | ||
| 2084 | % feybo - bold slanted | ||
| 2085 | % | ||
| 2086 | % There is no good (free) typewriter version, to my knowledge. | ||
| 2087 | % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. | ||
| 2088 | % Hmm. | ||
| 2089 | % | ||
| 2090 | % Also doesn't work in math. Do we need to do math with euro symbols? | ||
| 2091 | % Hope not. | ||
| 2092 | % | ||
| 2093 | % | ||
| 2094 | \def\euro{{\eurofont e}} | ||
| 2095 | \def\eurofont{% | ||
| 2096 | % We set the font at each command, rather than predefining it in | ||
| 2097 | % \textfonts and the other font-switching commands, so that | ||
| 2098 | % installations which never need the symbol don't have to have the | ||
| 2099 | % font installed. | ||
| 2100 | % | ||
| 2101 | % There is only one designed size (nominal 10pt), so we always scale | ||
| 2102 | % that to the current nominal size. | ||
| 2103 | % | ||
| 2104 | % By the way, simply using "at 1em" works for cmr10 and the like, but | ||
| 2105 | % does not work for cmbx10 and other extended/shrunken fonts. | ||
| 2106 | % | ||
| 2107 | \def\eurosize{\csname\curfontsize nominalsize\endcsname}% | ||
| 2108 | % | ||
| 2109 | \ifx\curfontstyle\bfstylename | ||
| 2110 | % bold: | ||
| 2111 | \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize | ||
| 2112 | \else | ||
| 2113 | % regular: | ||
| 2114 | \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize | ||
| 2115 | \fi | ||
| 2116 | \thiseurofont | ||
| 2117 | } | ||
| 2118 | |||
| 2119 | % @registeredsymbol - R in a circle. The font for the R should really | ||
| 2120 | % be smaller yet, but lllsize is the best we can do for now. | ||
| 1719 | % Adapted from the plain.tex definition of \copyright. | 2121 | % Adapted from the plain.tex definition of \copyright. |
| 1720 | % | 2122 | % |
| 1721 | \def\registeredsymbol{% | 2123 | \def\registeredsymbol{% |
| 1722 | $^{{\ooalign{\hfil\raise.07ex\hbox{$\scriptstyle\rm R$}\hfil\crcr\Orb}}% | 2124 | $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% |
| 2125 | \hfil\crcr\Orb}}% | ||
| 1723 | }$% | 2126 | }$% |
| 1724 | } | 2127 | } |
| 1725 | 2128 | ||
| 2129 | % Laurent Siebenmann reports \Orb undefined with: | ||
| 2130 | % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 | ||
| 2131 | % so we'll define it if necessary. | ||
| 2132 | % | ||
| 2133 | \ifx\Orb\undefined | ||
| 2134 | \def\Orb{\mathhexbox20D} | ||
| 2135 | \fi | ||
| 2136 | |||
| 1726 | 2137 | ||
| 1727 | \message{page headings,} | 2138 | \message{page headings,} |
| 1728 | 2139 | ||
| @@ -1741,87 +2152,103 @@ where each line of input produces a line of output.} | |||
| 1741 | \newif\ifsetshortcontentsaftertitlepage | 2152 | \newif\ifsetshortcontentsaftertitlepage |
| 1742 | \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue | 2153 | \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue |
| 1743 | 2154 | ||
| 1744 | \def\shorttitlepage{\parsearg\shorttitlepagezzz} | 2155 | \parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% |
| 1745 | \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% | ||
| 1746 | \endgroup\page\hbox{}\page} | 2156 | \endgroup\page\hbox{}\page} |
| 1747 | 2157 | ||
| 1748 | \def\titlepage{\begingroup \parindent=0pt \textfonts | 2158 | \envdef\titlepage{% |
| 1749 | \let\subtitlerm=\tenrm | 2159 | % Open one extra group, as we want to close it in the middle of \Etitlepage. |
| 1750 | \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% | 2160 | \begingroup |
| 1751 | % | 2161 | \parindent=0pt \textfonts |
| 1752 | \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines | 2162 | % Leave some space at the very top of the page. |
| 1753 | \let\tt=\authortt}% | 2163 | \vglue\titlepagetopglue |
| 1754 | % | 2164 | % No rule at page bottom unless we print one at the top with @title. |
| 1755 | % Leave some space at the very top of the page. | 2165 | \finishedtitlepagetrue |
| 1756 | \vglue\titlepagetopglue | 2166 | % |
| 1757 | % | 2167 | % Most title ``pages'' are actually two pages long, with space |
| 1758 | % Now you can print the title using @title. | 2168 | % at the top of the second. We don't want the ragged left on the second. |
| 1759 | \def\title{\parsearg\titlezzz}% | 2169 | \let\oldpage = \page |
| 1760 | \def\titlezzz##1{\leftline{\titlefonts\rm ##1} | 2170 | \def\page{% |
| 1761 | % print a rule at the page bottom also. | ||
| 1762 | \finishedtitlepagefalse | ||
| 1763 | \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% | ||
| 1764 | % No rule at page bottom unless we print one at the top with @title. | ||
| 1765 | \finishedtitlepagetrue | ||
| 1766 | % | ||
| 1767 | % Now you can put text using @subtitle. | ||
| 1768 | \def\subtitle{\parsearg\subtitlezzz}% | ||
| 1769 | \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% | ||
| 1770 | % | ||
| 1771 | % @author should come last, but may come many times. | ||
| 1772 | \def\author{\parsearg\authorzzz}% | ||
| 1773 | \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi | ||
| 1774 | {\authorfont \leftline{##1}}}% | ||
| 1775 | % | ||
| 1776 | % Most title ``pages'' are actually two pages long, with space | ||
| 1777 | % at the top of the second. We don't want the ragged left on the second. | ||
| 1778 | \let\oldpage = \page | ||
| 1779 | \def\page{% | ||
| 1780 | \iffinishedtitlepage\else | 2171 | \iffinishedtitlepage\else |
| 1781 | \finishtitlepage | 2172 | \finishtitlepage |
| 1782 | \fi | 2173 | \fi |
| 1783 | \oldpage | ||
| 1784 | \let\page = \oldpage | 2174 | \let\page = \oldpage |
| 1785 | \hbox{}}% | 2175 | \page |
| 1786 | % \def\page{\oldpage \hbox{}} | 2176 | \null |
| 2177 | }% | ||
| 1787 | } | 2178 | } |
| 1788 | 2179 | ||
| 1789 | \def\Etitlepage{% | 2180 | \def\Etitlepage{% |
| 1790 | \iffinishedtitlepage\else | 2181 | \iffinishedtitlepage\else |
| 1791 | \finishtitlepage | 2182 | \finishtitlepage |
| 1792 | \fi | 2183 | \fi |
| 1793 | % It is important to do the page break before ending the group, | 2184 | % It is important to do the page break before ending the group, |
| 1794 | % because the headline and footline are only empty inside the group. | 2185 | % because the headline and footline are only empty inside the group. |
| 1795 | % If we use the new definition of \page, we always get a blank page | 2186 | % If we use the new definition of \page, we always get a blank page |
| 1796 | % after the title page, which we certainly don't want. | 2187 | % after the title page, which we certainly don't want. |
| 1797 | \oldpage | 2188 | \oldpage |
| 1798 | \endgroup | 2189 | \endgroup |
| 1799 | % | 2190 | % |
| 1800 | % Need this before the \...aftertitlepage checks so that if they are | 2191 | % Need this before the \...aftertitlepage checks so that if they are |
| 1801 | % in effect the toc pages will come out with page numbers. | 2192 | % in effect the toc pages will come out with page numbers. |
| 1802 | \HEADINGSon | 2193 | \HEADINGSon |
| 1803 | % | 2194 | % |
| 1804 | % If they want short, they certainly want long too. | 2195 | % If they want short, they certainly want long too. |
| 1805 | \ifsetshortcontentsaftertitlepage | 2196 | \ifsetshortcontentsaftertitlepage |
| 1806 | \shortcontents | 2197 | \shortcontents |
| 1807 | \contents | 2198 | \contents |
| 1808 | \global\let\shortcontents = \relax | 2199 | \global\let\shortcontents = \relax |
| 1809 | \global\let\contents = \relax | 2200 | \global\let\contents = \relax |
| 1810 | \fi | 2201 | \fi |
| 1811 | % | 2202 | % |
| 1812 | \ifsetcontentsaftertitlepage | 2203 | \ifsetcontentsaftertitlepage |
| 1813 | \contents | 2204 | \contents |
| 1814 | \global\let\contents = \relax | 2205 | \global\let\contents = \relax |
| 1815 | \global\let\shortcontents = \relax | 2206 | \global\let\shortcontents = \relax |
| 1816 | \fi | 2207 | \fi |
| 1817 | } | 2208 | } |
| 1818 | 2209 | ||
| 1819 | \def\finishtitlepage{% | 2210 | \def\finishtitlepage{% |
| 1820 | \vskip4pt \hrule height 2pt width \hsize | 2211 | \vskip4pt \hrule height 2pt width \hsize |
| 1821 | \vskip\titlepagebottomglue | 2212 | \vskip\titlepagebottomglue |
| 1822 | \finishedtitlepagetrue | 2213 | \finishedtitlepagetrue |
| 2214 | } | ||
| 2215 | |||
| 2216 | %%% Macros to be used within @titlepage: | ||
| 2217 | |||
| 2218 | \let\subtitlerm=\tenrm | ||
| 2219 | \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} | ||
| 2220 | |||
| 2221 | \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines | ||
| 2222 | \let\tt=\authortt} | ||
| 2223 | |||
| 2224 | \parseargdef\title{% | ||
| 2225 | \checkenv\titlepage | ||
| 2226 | \leftline{\titlefonts\rm #1} | ||
| 2227 | % print a rule at the page bottom also. | ||
| 2228 | \finishedtitlepagefalse | ||
| 2229 | \vskip4pt \hrule height 4pt width \hsize \vskip4pt | ||
| 2230 | } | ||
| 2231 | |||
| 2232 | \parseargdef\subtitle{% | ||
| 2233 | \checkenv\titlepage | ||
| 2234 | {\subtitlefont \rightline{#1}}% | ||
| 1823 | } | 2235 | } |
| 1824 | 2236 | ||
| 2237 | % @author should come last, but may come many times. | ||
| 2238 | % It can also be used inside @quotation. | ||
| 2239 | % | ||
| 2240 | \parseargdef\author{% | ||
| 2241 | \def\temp{\quotation}% | ||
| 2242 | \ifx\thisenv\temp | ||
| 2243 | \def\quotationauthor{#1}% printed in \Equotation. | ||
| 2244 | \else | ||
| 2245 | \checkenv\titlepage | ||
| 2246 | \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi | ||
| 2247 | {\authorfont \leftline{#1}}% | ||
| 2248 | \fi | ||
| 2249 | } | ||
| 2250 | |||
| 2251 | |||
| 1825 | %%% Set up page headings and footings. | 2252 | %%% Set up page headings and footings. |
| 1826 | 2253 | ||
| 1827 | \let\thispage=\folio | 2254 | \let\thispage=\folio |
| @@ -1831,7 +2258,7 @@ where each line of input produces a line of output.} | |||
| 1831 | \newtoks\evenfootline % footline on even pages | 2258 | \newtoks\evenfootline % footline on even pages |
| 1832 | \newtoks\oddfootline % footline on odd pages | 2259 | \newtoks\oddfootline % footline on odd pages |
| 1833 | 2260 | ||
| 1834 | % Now make Tex use those variables | 2261 | % Now make TeX use those variables |
| 1835 | \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline | 2262 | \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline |
| 1836 | \else \the\evenheadline \fi}} | 2263 | \else \the\evenheadline \fi}} |
| 1837 | \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline | 2264 | \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline |
| @@ -1845,32 +2272,27 @@ where each line of input produces a line of output.} | |||
| 1845 | % @evenfooting @thisfile|| | 2272 | % @evenfooting @thisfile|| |
| 1846 | % @oddfooting ||@thisfile | 2273 | % @oddfooting ||@thisfile |
| 1847 | 2274 | ||
| 1848 | \def\evenheading{\parsearg\evenheadingxxx} | ||
| 1849 | \def\oddheading{\parsearg\oddheadingxxx} | ||
| 1850 | \def\everyheading{\parsearg\everyheadingxxx} | ||
| 1851 | |||
| 1852 | \def\evenfooting{\parsearg\evenfootingxxx} | ||
| 1853 | \def\oddfooting{\parsearg\oddfootingxxx} | ||
| 1854 | \def\everyfooting{\parsearg\everyfootingxxx} | ||
| 1855 | 2275 | ||
| 1856 | {\catcode`\@=0 % | 2276 | \def\evenheading{\parsearg\evenheadingxxx} |
| 1857 | 2277 | \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} | |
| 1858 | \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} | 2278 | \def\evenheadingyyy #1\|#2\|#3\|#4\finish{% |
| 1859 | \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% | ||
| 1860 | \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} | 2279 | \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} |
| 1861 | 2280 | ||
| 1862 | \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} | 2281 | \def\oddheading{\parsearg\oddheadingxxx} |
| 1863 | \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% | 2282 | \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} |
| 2283 | \def\oddheadingyyy #1\|#2\|#3\|#4\finish{% | ||
| 1864 | \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} | 2284 | \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} |
| 1865 | 2285 | ||
| 1866 | \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% | 2286 | \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% |
| 1867 | 2287 | ||
| 1868 | \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} | 2288 | \def\evenfooting{\parsearg\evenfootingxxx} |
| 1869 | \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% | 2289 | \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} |
| 2290 | \def\evenfootingyyy #1\|#2\|#3\|#4\finish{% | ||
| 1870 | \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} | 2291 | \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} |
| 1871 | 2292 | ||
| 1872 | \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} | 2293 | \def\oddfooting{\parsearg\oddfootingxxx} |
| 1873 | \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% | 2294 | \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} |
| 2295 | \def\oddfootingyyy #1\|#2\|#3\|#4\finish{% | ||
| 1874 | \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% | 2296 | \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% |
| 1875 | % | 2297 | % |
| 1876 | % Leave some space for the footline. Hopefully ok to assume | 2298 | % Leave some space for the footline. Hopefully ok to assume |
| @@ -1879,9 +2301,8 @@ where each line of input produces a line of output.} | |||
| 1879 | \global\advance\vsize by -\baselineskip | 2301 | \global\advance\vsize by -\baselineskip |
| 1880 | } | 2302 | } |
| 1881 | 2303 | ||
| 1882 | \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} | 2304 | \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} |
| 1883 | % | 2305 | |
| 1884 | }% unbind the catcode of @. | ||
| 1885 | 2306 | ||
| 1886 | % @headings double turns headings on for double-sided printing. | 2307 | % @headings double turns headings on for double-sided printing. |
| 1887 | % @headings single turns headings on for single-sided printing. | 2308 | % @headings single turns headings on for single-sided printing. |
| @@ -1895,7 +2316,7 @@ where each line of input produces a line of output.} | |||
| 1895 | 2316 | ||
| 1896 | \def\headings #1 {\csname HEADINGS#1\endcsname} | 2317 | \def\headings #1 {\csname HEADINGS#1\endcsname} |
| 1897 | 2318 | ||
| 1898 | \def\HEADINGSoff{ | 2319 | \def\HEADINGSoff{% |
| 1899 | \global\evenheadline={\hfil} \global\evenfootline={\hfil} | 2320 | \global\evenheadline={\hfil} \global\evenfootline={\hfil} |
| 1900 | \global\oddheadline={\hfil} \global\oddfootline={\hfil}} | 2321 | \global\oddheadline={\hfil} \global\oddfootline={\hfil}} |
| 1901 | \HEADINGSoff | 2322 | \HEADINGSoff |
| @@ -1904,7 +2325,7 @@ where each line of input produces a line of output.} | |||
| 1904 | % chapter name on inside top of right hand pages, document | 2325 | % chapter name on inside top of right hand pages, document |
| 1905 | % title on inside top of left hand pages, and page numbers on outside top | 2326 | % title on inside top of left hand pages, and page numbers on outside top |
| 1906 | % edge of all pages. | 2327 | % edge of all pages. |
| 1907 | \def\HEADINGSdouble{ | 2328 | \def\HEADINGSdouble{% |
| 1908 | \global\pageno=1 | 2329 | \global\pageno=1 |
| 1909 | \global\evenfootline={\hfil} | 2330 | \global\evenfootline={\hfil} |
| 1910 | \global\oddfootline={\hfil} | 2331 | \global\oddfootline={\hfil} |
| @@ -1916,7 +2337,7 @@ where each line of input produces a line of output.} | |||
| 1916 | 2337 | ||
| 1917 | % For single-sided printing, chapter title goes across top left of page, | 2338 | % For single-sided printing, chapter title goes across top left of page, |
| 1918 | % page number on top right. | 2339 | % page number on top right. |
| 1919 | \def\HEADINGSsingle{ | 2340 | \def\HEADINGSsingle{% |
| 1920 | \global\pageno=1 | 2341 | \global\pageno=1 |
| 1921 | \global\evenfootline={\hfil} | 2342 | \global\evenfootline={\hfil} |
| 1922 | \global\oddfootline={\hfil} | 2343 | \global\oddfootline={\hfil} |
| @@ -1963,12 +2384,11 @@ where each line of input produces a line of output.} | |||
| 1963 | % @settitle line... specifies the title of the document, for headings. | 2384 | % @settitle line... specifies the title of the document, for headings. |
| 1964 | % It generates no output of its own. | 2385 | % It generates no output of its own. |
| 1965 | \def\thistitle{\putwordNoTitle} | 2386 | \def\thistitle{\putwordNoTitle} |
| 1966 | \def\settitle{\parsearg\settitlezzz} | 2387 | \def\settitle{\parsearg{\gdef\thistitle}} |
| 1967 | \def\settitlezzz #1{\gdef\thistitle{#1}} | ||
| 1968 | 2388 | ||
| 1969 | 2389 | ||
| 1970 | \message{tables,} | 2390 | \message{tables,} |
| 1971 | % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). | 2391 | % Tables -- @table, @ftable, @vtable, @item(x). |
| 1972 | 2392 | ||
| 1973 | % default indentation of table text | 2393 | % default indentation of table text |
| 1974 | \newdimen\tableindent \tableindent=.8in | 2394 | \newdimen\tableindent \tableindent=.8in |
| @@ -1980,7 +2400,7 @@ where each line of input produces a line of output.} | |||
| 1980 | % used internally for \itemindent minus \itemmargin | 2400 | % used internally for \itemindent minus \itemmargin |
| 1981 | \newdimen\itemmax | 2401 | \newdimen\itemmax |
| 1982 | 2402 | ||
| 1983 | % Note @table, @vtable, and @vtable define @item, @itemx, etc., with | 2403 | % Note @table, @ftable, and @vtable define @item, @itemx, etc., with |
| 1984 | % these defs. | 2404 | % these defs. |
| 1985 | % They also define \itemindex | 2405 | % They also define \itemindex |
| 1986 | % to index the item name in whatever manner is desired (perhaps none). | 2406 | % to index the item name in whatever manner is desired (perhaps none). |
| @@ -1992,22 +2412,10 @@ where each line of input produces a line of output.} | |||
| 1992 | \def\internalBitem{\smallbreak \parsearg\itemzzz} | 2412 | \def\internalBitem{\smallbreak \parsearg\itemzzz} |
| 1993 | \def\internalBitemx{\itemxpar \parsearg\itemzzz} | 2413 | \def\internalBitemx{\itemxpar \parsearg\itemzzz} |
| 1994 | 2414 | ||
| 1995 | \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} | ||
| 1996 | \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} | ||
| 1997 | |||
| 1998 | \def\internalBkitem{\smallbreak \parsearg\kitemzzz} | ||
| 1999 | \def\internalBkitemx{\itemxpar \parsearg\kitemzzz} | ||
| 2000 | |||
| 2001 | \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% | ||
| 2002 | \itemzzz {#1}} | ||
| 2003 | |||
| 2004 | \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% | ||
| 2005 | \itemzzz {#1}} | ||
| 2006 | |||
| 2007 | \def\itemzzz #1{\begingroup % | 2415 | \def\itemzzz #1{\begingroup % |
| 2008 | \advance\hsize by -\rightskip | 2416 | \advance\hsize by -\rightskip |
| 2009 | \advance\hsize by -\tableindent | 2417 | \advance\hsize by -\tableindent |
| 2010 | \setbox0=\hbox{\itemfont{#1}}% | 2418 | \setbox0=\hbox{\itemindicate{#1}}% |
| 2011 | \itemindex{#1}% | 2419 | \itemindex{#1}% |
| 2012 | \nobreak % This prevents a break before @itemx. | 2420 | \nobreak % This prevents a break before @itemx. |
| 2013 | % | 2421 | % |
| @@ -2031,17 +2439,13 @@ where each line of input produces a line of output.} | |||
| 2031 | % \parskip glue -- logically it's part of the @item we just started. | 2439 | % \parskip glue -- logically it's part of the @item we just started. |
| 2032 | \nobreak \vskip-\parskip | 2440 | \nobreak \vskip-\parskip |
| 2033 | % | 2441 | % |
| 2034 | % Stop a page break at the \parskip glue coming up. (Unfortunately | 2442 | % Stop a page break at the \parskip glue coming up. However, if |
| 2035 | % we can't prevent a possible page break at the following | 2443 | % what follows is an environment such as @example, there will be no |
| 2036 | % \baselineskip glue.) However, if what follows is an environment | 2444 | % \parskip glue; then the negative vskip we just inserted would |
| 2037 | % such as @example, there will be no \parskip glue; then | 2445 | % cause the example and the item to crash together. So we use this |
| 2038 | % the negative vskip we just would cause the example and the item to | 2446 | % bizarre value of 10001 as a signal to \aboveenvbreak to insert |
| 2039 | % crash together. So we use this bizarre value of 10001 as a signal | 2447 | % \parskip glue after all. Section titles are handled this way also. |
| 2040 | % to \aboveenvbreak to insert \parskip glue after all. | 2448 | % |
| 2041 | % (Possibly there are other commands that could be followed by | ||
| 2042 | % @example which need the same treatment, but not section titles; or | ||
| 2043 | % maybe section titles are the only special case and they should be | ||
| 2044 | % penalty 10001...) | ||
| 2045 | \penalty 10001 | 2449 | \penalty 10001 |
| 2046 | \endgroup | 2450 | \endgroup |
| 2047 | \itemxneedsnegativevskipfalse | 2451 | \itemxneedsnegativevskipfalse |
| @@ -2061,81 +2465,72 @@ where each line of input produces a line of output.} | |||
| 2061 | \fi | 2465 | \fi |
| 2062 | } | 2466 | } |
| 2063 | 2467 | ||
| 2064 | \def\item{\errmessage{@item while not in a table}} | 2468 | \def\item{\errmessage{@item while not in a list environment}} |
| 2065 | \def\itemx{\errmessage{@itemx while not in a table}} | 2469 | \def\itemx{\errmessage{@itemx while not in a list environment}} |
| 2066 | \def\kitem{\errmessage{@kitem while not in a table}} | ||
| 2067 | \def\kitemx{\errmessage{@kitemx while not in a table}} | ||
| 2068 | \def\xitem{\errmessage{@xitem while not in a table}} | ||
| 2069 | \def\xitemx{\errmessage{@xitemx while not in a table}} | ||
| 2070 | |||
| 2071 | % Contains a kludge to get @end[description] to work. | ||
| 2072 | \def\description{\tablez{\dontindex}{1}{}{}{}{}} | ||
| 2073 | 2470 | ||
| 2074 | % @table, @ftable, @vtable. | 2471 | % @table, @ftable, @vtable. |
| 2075 | \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} | 2472 | \envdef\table{% |
| 2076 | {\obeylines\obeyspaces% | 2473 | \let\itemindex\gobble |
| 2077 | \gdef\tablex #1^^M{% | 2474 | \tablecheck{table}% |
| 2078 | \tabley\dontindex#1 \endtabley}} | 2475 | } |
| 2079 | 2476 | \envdef\ftable{% | |
| 2080 | \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} | 2477 | \def\itemindex ##1{\doind {fn}{\code{##1}}}% |
| 2081 | {\obeylines\obeyspaces% | 2478 | \tablecheck{ftable}% |
| 2082 | \gdef\ftablex #1^^M{% | ||
| 2083 | \tabley\fnitemindex#1 \endtabley | ||
| 2084 | \def\Eftable{\endgraf\afterenvbreak\endgroup}% | ||
| 2085 | \let\Etable=\relax}} | ||
| 2086 | |||
| 2087 | \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} | ||
| 2088 | {\obeylines\obeyspaces% | ||
| 2089 | \gdef\vtablex #1^^M{% | ||
| 2090 | \tabley\vritemindex#1 \endtabley | ||
| 2091 | \def\Evtable{\endgraf\afterenvbreak\endgroup}% | ||
| 2092 | \let\Etable=\relax}} | ||
| 2093 | |||
| 2094 | \def\dontindex #1{} | ||
| 2095 | \def\fnitemindex #1{\doind {fn}{\code{#1}}}% | ||
| 2096 | \def\vritemindex #1{\doind {vr}{\code{#1}}}% | ||
| 2097 | |||
| 2098 | {\obeyspaces % | ||
| 2099 | \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% | ||
| 2100 | \tablez{#1}{#2}{#3}{#4}{#5}{#6}}} | ||
| 2101 | |||
| 2102 | \def\tablez #1#2#3#4#5#6{% | ||
| 2103 | \aboveenvbreak % | ||
| 2104 | \begingroup % | ||
| 2105 | \def\Edescription{\Etable}% Necessary kludge. | ||
| 2106 | \let\itemindex=#1% | ||
| 2107 | \ifnum 0#3>0 \advance \leftskip by #3\mil \fi % | ||
| 2108 | \ifnum 0#4>0 \tableindent=#4\mil \fi % | ||
| 2109 | \ifnum 0#5>0 \advance \rightskip by #5\mil \fi % | ||
| 2110 | \def\itemfont{#2}% | ||
| 2111 | \itemmax=\tableindent % | ||
| 2112 | \advance \itemmax by -\itemmargin % | ||
| 2113 | \advance \leftskip by \tableindent % | ||
| 2114 | \exdentamount=\tableindent | ||
| 2115 | \parindent = 0pt | ||
| 2116 | \parskip = \smallskipamount | ||
| 2117 | \ifdim \parskip=0pt \parskip=2pt \fi% | ||
| 2118 | \def\Etable{\endgraf\afterenvbreak\endgroup}% | ||
| 2119 | \let\item = \internalBitem % | ||
| 2120 | \let\itemx = \internalBitemx % | ||
| 2121 | \let\kitem = \internalBkitem % | ||
| 2122 | \let\kitemx = \internalBkitemx % | ||
| 2123 | \let\xitem = \internalBxitem % | ||
| 2124 | \let\xitemx = \internalBxitemx % | ||
| 2125 | } | 2479 | } |
| 2480 | \envdef\vtable{% | ||
| 2481 | \def\itemindex ##1{\doind {vr}{\code{##1}}}% | ||
| 2482 | \tablecheck{vtable}% | ||
| 2483 | } | ||
| 2484 | \def\tablecheck#1{% | ||
| 2485 | \ifnum \the\catcode`\^^M=\active | ||
| 2486 | \endgroup | ||
| 2487 | \errmessage{This command won't work in this context; perhaps the problem is | ||
| 2488 | that we are \inenvironment\thisenv}% | ||
| 2489 | \def\next{\doignore{#1}}% | ||
| 2490 | \else | ||
| 2491 | \let\next\tablex | ||
| 2492 | \fi | ||
| 2493 | \next | ||
| 2494 | } | ||
| 2495 | \def\tablex#1{% | ||
| 2496 | \def\itemindicate{#1}% | ||
| 2497 | \parsearg\tabley | ||
| 2498 | } | ||
| 2499 | \def\tabley#1{% | ||
| 2500 | {% | ||
| 2501 | \makevalueexpandable | ||
| 2502 | \edef\temp{\noexpand\tablez #1\space\space\space}% | ||
| 2503 | \expandafter | ||
| 2504 | }\temp \endtablez | ||
| 2505 | } | ||
| 2506 | \def\tablez #1 #2 #3 #4\endtablez{% | ||
| 2507 | \aboveenvbreak | ||
| 2508 | \ifnum 0#1>0 \advance \leftskip by #1\mil \fi | ||
| 2509 | \ifnum 0#2>0 \tableindent=#2\mil \fi | ||
| 2510 | \ifnum 0#3>0 \advance \rightskip by #3\mil \fi | ||
| 2511 | \itemmax=\tableindent | ||
| 2512 | \advance \itemmax by -\itemmargin | ||
| 2513 | \advance \leftskip by \tableindent | ||
| 2514 | \exdentamount=\tableindent | ||
| 2515 | \parindent = 0pt | ||
| 2516 | \parskip = \smallskipamount | ||
| 2517 | \ifdim \parskip=0pt \parskip=2pt \fi | ||
| 2518 | \let\item = \internalBitem | ||
| 2519 | \let\itemx = \internalBitemx | ||
| 2520 | } | ||
| 2521 | \def\Etable{\endgraf\afterenvbreak} | ||
| 2522 | \let\Eftable\Etable | ||
| 2523 | \let\Evtable\Etable | ||
| 2524 | \let\Eitemize\Etable | ||
| 2525 | \let\Eenumerate\Etable | ||
| 2126 | 2526 | ||
| 2127 | % This is the counter used by @enumerate, which is really @itemize | 2527 | % This is the counter used by @enumerate, which is really @itemize |
| 2128 | 2528 | ||
| 2129 | \newcount \itemno | 2529 | \newcount \itemno |
| 2130 | 2530 | ||
| 2131 | \def\itemize{\parsearg\itemizezzz} | 2531 | \envdef\itemize{\parsearg\doitemize} |
| 2132 | |||
| 2133 | \def\itemizezzz #1{% | ||
| 2134 | \begingroup % ended by the @end itemize | ||
| 2135 | \itemizey {#1}{\Eitemize} | ||
| 2136 | } | ||
| 2137 | 2532 | ||
| 2138 | \def\itemizey#1#2{% | 2533 | \def\doitemize#1{% |
| 2139 | \aboveenvbreak | 2534 | \aboveenvbreak |
| 2140 | \itemmax=\itemindent | 2535 | \itemmax=\itemindent |
| 2141 | \advance\itemmax by -\itemmargin | 2536 | \advance\itemmax by -\itemmargin |
| @@ -2144,13 +2539,33 @@ where each line of input produces a line of output.} | |||
| 2144 | \parindent=0pt | 2539 | \parindent=0pt |
| 2145 | \parskip=\smallskipamount | 2540 | \parskip=\smallskipamount |
| 2146 | \ifdim\parskip=0pt \parskip=2pt \fi | 2541 | \ifdim\parskip=0pt \parskip=2pt \fi |
| 2147 | \def#2{\endgraf\afterenvbreak\endgroup}% | ||
| 2148 | \def\itemcontents{#1}% | 2542 | \def\itemcontents{#1}% |
| 2149 | % @itemize with no arg is equivalent to @itemize @bullet. | 2543 | % @itemize with no arg is equivalent to @itemize @bullet. |
| 2150 | \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi | 2544 | \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi |
| 2151 | \let\item=\itemizeitem | 2545 | \let\item=\itemizeitem |
| 2152 | } | 2546 | } |
| 2153 | 2547 | ||
| 2548 | % Definition of @item while inside @itemize and @enumerate. | ||
| 2549 | % | ||
| 2550 | \def\itemizeitem{% | ||
| 2551 | \advance\itemno by 1 % for enumerations | ||
| 2552 | {\let\par=\endgraf \smallbreak}% reasonable place to break | ||
| 2553 | {% | ||
| 2554 | % If the document has an @itemize directly after a section title, a | ||
| 2555 | % \nobreak will be last on the list, and \sectionheading will have | ||
| 2556 | % done a \vskip-\parskip. In that case, we don't want to zero | ||
| 2557 | % parskip, or the item text will crash with the heading. On the | ||
| 2558 | % other hand, when there is normal text preceding the item (as there | ||
| 2559 | % usually is), we do want to zero parskip, or there would be too much | ||
| 2560 | % space. In that case, we won't have a \nobreak before. At least | ||
| 2561 | % that's the theory. | ||
| 2562 | \ifnum\lastpenalty<10000 \parskip=0in \fi | ||
| 2563 | \noindent | ||
| 2564 | \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% | ||
| 2565 | \vadjust{\penalty 1200}}% not good to break after first line of item. | ||
| 2566 | \flushcr | ||
| 2567 | } | ||
| 2568 | |||
| 2154 | % \splitoff TOKENS\endmark defines \first to be the first token in | 2569 | % \splitoff TOKENS\endmark defines \first to be the first token in |
| 2155 | % TOKENS, and \rest to be the remainder. | 2570 | % TOKENS, and \rest to be the remainder. |
| 2156 | % | 2571 | % |
| @@ -2160,11 +2575,8 @@ where each line of input produces a line of output.} | |||
| 2160 | % or number, to specify the first label in the enumerated list. No | 2575 | % or number, to specify the first label in the enumerated list. No |
| 2161 | % argument is the same as `1'. | 2576 | % argument is the same as `1'. |
| 2162 | % | 2577 | % |
| 2163 | \def\enumerate{\parsearg\enumeratezzz} | 2578 | \envparseargdef\enumerate{\enumeratey #1 \endenumeratey} |
| 2164 | \def\enumeratezzz #1{\enumeratey #1 \endenumeratey} | ||
| 2165 | \def\enumeratey #1 #2\endenumeratey{% | 2579 | \def\enumeratey #1 #2\endenumeratey{% |
| 2166 | \begingroup % ended by the @end enumerate | ||
| 2167 | % | ||
| 2168 | % If we were given no argument, pretend we were given `1'. | 2580 | % If we were given no argument, pretend we were given `1'. |
| 2169 | \def\thearg{#1}% | 2581 | \def\thearg{#1}% |
| 2170 | \ifx\thearg\empty \def\thearg{1}\fi | 2582 | \ifx\thearg\empty \def\thearg{1}\fi |
| @@ -2235,13 +2647,13 @@ where each line of input produces a line of output.} | |||
| 2235 | }% | 2647 | }% |
| 2236 | } | 2648 | } |
| 2237 | 2649 | ||
| 2238 | % Call itemizey, adding a period to the first argument and supplying the | 2650 | % Call \doitemize, adding a period to the first argument and supplying the |
| 2239 | % common last two arguments. Also subtract one from the initial value in | 2651 | % common last two arguments. Also subtract one from the initial value in |
| 2240 | % \itemno, since @item increments \itemno. | 2652 | % \itemno, since @item increments \itemno. |
| 2241 | % | 2653 | % |
| 2242 | \def\startenumeration#1{% | 2654 | \def\startenumeration#1{% |
| 2243 | \advance\itemno by -1 | 2655 | \advance\itemno by -1 |
| 2244 | \itemizey{#1.}\Eenumerate\flushcr | 2656 | \doitemize{#1.}\flushcr |
| 2245 | } | 2657 | } |
| 2246 | 2658 | ||
| 2247 | % @alphaenumerate and @capsenumerate are abbreviations for giving an arg | 2659 | % @alphaenumerate and @capsenumerate are abbreviations for giving an arg |
| @@ -2252,16 +2664,6 @@ where each line of input produces a line of output.} | |||
| 2252 | \def\Ealphaenumerate{\Eenumerate} | 2664 | \def\Ealphaenumerate{\Eenumerate} |
| 2253 | \def\Ecapsenumerate{\Eenumerate} | 2665 | \def\Ecapsenumerate{\Eenumerate} |
| 2254 | 2666 | ||
| 2255 | % Definition of @item while inside @itemize. | ||
| 2256 | |||
| 2257 | \def\itemizeitem{% | ||
| 2258 | \advance\itemno by 1 | ||
| 2259 | {\let\par=\endgraf \smallbreak}% | ||
| 2260 | \ifhmode \errmessage{In hmode at itemizeitem}\fi | ||
| 2261 | {\parskip=0in \hskip 0pt | ||
| 2262 | \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% | ||
| 2263 | \vadjust{\penalty 1200}}% | ||
| 2264 | \flushcr} | ||
| 2265 | 2667 | ||
| 2266 | % @multitable macros | 2668 | % @multitable macros |
| 2267 | % Amy Hendrickson, 8/18/94, 3/6/96 | 2669 | % Amy Hendrickson, 8/18/94, 3/6/96 |
| @@ -2288,24 +2690,14 @@ where each line of input produces a line of output.} | |||
| 2288 | % @multitable {Column 1 template} {Column 2 template} {Column 3 template} | 2690 | % @multitable {Column 1 template} {Column 2 template} {Column 3 template} |
| 2289 | % @item ... | 2691 | % @item ... |
| 2290 | % using the widest term desired in each column. | 2692 | % using the widest term desired in each column. |
| 2291 | % | ||
| 2292 | % For those who want to use more than one line's worth of words in | ||
| 2293 | % the preamble, break the line within one argument and it | ||
| 2294 | % will parse correctly, i.e., | ||
| 2295 | % | ||
| 2296 | % @multitable {Column 1 template} {Column 2 template} {Column 3 | ||
| 2297 | % template} | ||
| 2298 | % Not: | ||
| 2299 | % @multitable {Column 1 template} {Column 2 template} | ||
| 2300 | % {Column 3 template} | ||
| 2301 | 2693 | ||
| 2302 | % Each new table line starts with @item, each subsequent new column | 2694 | % Each new table line starts with @item, each subsequent new column |
| 2303 | % starts with @tab. Empty columns may be produced by supplying @tab's | 2695 | % starts with @tab. Empty columns may be produced by supplying @tab's |
| 2304 | % with nothing between them for as many times as empty columns are needed, | 2696 | % with nothing between them for as many times as empty columns are needed, |
| 2305 | % ie, @tab@tab@tab will produce two empty columns. | 2697 | % ie, @tab@tab@tab will produce two empty columns. |
| 2306 | 2698 | ||
| 2307 | % @item, @tab, @multitable or @end multitable do not need to be on their | 2699 | % @item, @tab do not need to be on their own lines, but it will not hurt |
| 2308 | % own lines, but it will not hurt if they are. | 2700 | % if they are. |
| 2309 | 2701 | ||
| 2310 | % Sample multitable: | 2702 | % Sample multitable: |
| 2311 | 2703 | ||
| @@ -2349,13 +2741,12 @@ where each line of input produces a line of output.} | |||
| 2349 | \def\xcolumnfractions{\columnfractions} | 2741 | \def\xcolumnfractions{\columnfractions} |
| 2350 | \newif\ifsetpercent | 2742 | \newif\ifsetpercent |
| 2351 | 2743 | ||
| 2352 | % #1 is the part of the @columnfraction before the decimal point, which | 2744 | % #1 is the @columnfraction, usually a decimal number like .5, but might |
| 2353 | % is presumably either 0 or the empty string (but we don't check, we | 2745 | % be just 1. We just use it, whatever it is. |
| 2354 | % just throw it away). #2 is the decimal part, which we use as the | 2746 | % |
| 2355 | % percent of \hsize for this column. | 2747 | \def\pickupwholefraction#1 {% |
| 2356 | \def\pickupwholefraction#1.#2 {% | ||
| 2357 | \global\advance\colcount by 1 | 2748 | \global\advance\colcount by 1 |
| 2358 | \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}% | 2749 | \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% |
| 2359 | \setuptable | 2750 | \setuptable |
| 2360 | } | 2751 | } |
| 2361 | 2752 | ||
| @@ -2388,18 +2779,33 @@ where each line of input produces a line of output.} | |||
| 2388 | \go | 2779 | \go |
| 2389 | } | 2780 | } |
| 2390 | 2781 | ||
| 2782 | % multitable-only commands. | ||
| 2783 | % | ||
| 2784 | % @headitem starts a heading row, which we typeset in bold. | ||
| 2785 | % Assignments have to be global since we are inside the implicit group | ||
| 2786 | % of an alignment entry. Note that \everycr resets \everytab. | ||
| 2787 | \def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% | ||
| 2788 | % | ||
| 2789 | % A \tab used to include \hskip1sp. But then the space in a template | ||
| 2790 | % line is not enough. That is bad. So let's go back to just `&' until | ||
| 2791 | % we encounter the problem it was intended to solve again. | ||
| 2792 | % --karl, nathan@acm.org, 20apr99. | ||
| 2793 | \def\tab{\checkenv\multitable &\the\everytab}% | ||
| 2794 | |||
| 2391 | % @multitable ... @end multitable definitions: | 2795 | % @multitable ... @end multitable definitions: |
| 2392 | % | 2796 | % |
| 2393 | \def\multitable{\parsearg\dotable} | 2797 | \newtoks\everytab % insert after every tab. |
| 2394 | \def\dotable#1{\bgroup | 2798 | % |
| 2799 | \envdef\multitable{% | ||
| 2395 | \vskip\parskip | 2800 | \vskip\parskip |
| 2396 | \let\item=\crcrwithfootnotes | 2801 | \startsavinginserts |
| 2397 | % A \tab used to include \hskip1sp. But then the space in a template | 2802 | % |
| 2398 | % line is not enough. That is bad. So let's go back to just & until | 2803 | % @item within a multitable starts a normal row. |
| 2399 | % we encounter the problem it was intended to solve again. --karl, | 2804 | % We use \def instead of \let so that if one of the multitable entries |
| 2400 | % nathan@acm.org, 20apr99. | 2805 | % contains an @itemize, we don't choke on the \item (seen as \crcr aka |
| 2401 | \let\tab=&% | 2806 | % \endtemplate) expanding \doitemize. |
| 2402 | \let\startfootins=\startsavedfootnote | 2807 | \def\item{\crcr}% |
| 2808 | % | ||
| 2403 | \tolerance=9500 | 2809 | \tolerance=9500 |
| 2404 | \hbadness=9500 | 2810 | \hbadness=9500 |
| 2405 | \setmultitablespacing | 2811 | \setmultitablespacing |
| @@ -2407,85 +2813,93 @@ where each line of input produces a line of output.} | |||
| 2407 | \parindent=\multitableparindent | 2813 | \parindent=\multitableparindent |
| 2408 | \overfullrule=0pt | 2814 | \overfullrule=0pt |
| 2409 | \global\colcount=0 | 2815 | \global\colcount=0 |
| 2410 | \def\Emultitable{% | 2816 | % |
| 2411 | \global\setpercentfalse | 2817 | \everycr = {% |
| 2412 | \crcrwithfootnotes\crcr | 2818 | \noalign{% |
| 2413 | \egroup\egroup | 2819 | \global\everytab={}% |
| 2820 | \global\colcount=0 % Reset the column counter. | ||
| 2821 | % Check for saved footnotes, etc. | ||
| 2822 | \checkinserts | ||
| 2823 | % Keeps underfull box messages off when table breaks over pages. | ||
| 2824 | %\filbreak | ||
| 2825 | % Maybe so, but it also creates really weird page breaks when the | ||
| 2826 | % table breaks over pages. Wouldn't \vfil be better? Wait until the | ||
| 2827 | % problem manifests itself, so it can be fixed for real --karl. | ||
| 2828 | }% | ||
| 2414 | }% | 2829 | }% |
| 2415 | % | 2830 | % |
| 2831 | \parsearg\domultitable | ||
| 2832 | } | ||
| 2833 | \def\domultitable#1{% | ||
| 2416 | % To parse everything between @multitable and @item: | 2834 | % To parse everything between @multitable and @item: |
| 2417 | \setuptable#1 \endsetuptable | 2835 | \setuptable#1 \endsetuptable |
| 2418 | % | 2836 | % |
| 2419 | % \everycr will reset column counter, \colcount, at the end of | ||
| 2420 | % each line. Every column entry will cause \colcount to advance by one. | ||
| 2421 | % The table preamble | ||
| 2422 | % looks at the current \colcount to find the correct column width. | ||
| 2423 | \everycr{\noalign{% | ||
| 2424 | % | ||
| 2425 | % \filbreak%% keeps underfull box messages off when table breaks over pages. | ||
| 2426 | % Maybe so, but it also creates really weird page breaks when the table | ||
| 2427 | % breaks over pages. Wouldn't \vfil be better? Wait until the problem | ||
| 2428 | % manifests itself, so it can be fixed for real --karl. | ||
| 2429 | \global\colcount=0\relax}}% | ||
| 2430 | % | ||
| 2431 | % This preamble sets up a generic column definition, which will | 2837 | % This preamble sets up a generic column definition, which will |
| 2432 | % be used as many times as user calls for columns. | 2838 | % be used as many times as user calls for columns. |
| 2433 | % \vtop will set a single line and will also let text wrap and | 2839 | % \vtop will set a single line and will also let text wrap and |
| 2434 | % continue for many paragraphs if desired. | 2840 | % continue for many paragraphs if desired. |
| 2435 | \halign\bgroup&\global\advance\colcount by 1\relax | 2841 | \halign\bgroup &% |
| 2436 | \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname | 2842 | \global\advance\colcount by 1 |
| 2437 | % | 2843 | \multistrut |
| 2438 | % In order to keep entries from bumping into each other | 2844 | \vtop{% |
| 2439 | % we will add a \leftskip of \multitablecolspace to all columns after | 2845 | % Use the current \colcount to find the correct column width: |
| 2440 | % the first one. | 2846 | \hsize=\expandafter\csname col\the\colcount\endcsname |
| 2441 | % | 2847 | % |
| 2442 | % If a template has been used, we will add \multitablecolspace | 2848 | % In order to keep entries from bumping into each other |
| 2443 | % to the width of each template entry. | 2849 | % we will add a \leftskip of \multitablecolspace to all columns after |
| 2444 | % | 2850 | % the first one. |
| 2445 | % If the user has set preamble in terms of percent of \hsize we will | 2851 | % |
| 2446 | % use that dimension as the width of the column, and the \leftskip | 2852 | % If a template has been used, we will add \multitablecolspace |
| 2447 | % will keep entries from bumping into each other. Table will start at | 2853 | % to the width of each template entry. |
| 2448 | % left margin and final column will justify at right margin. | 2854 | % |
| 2449 | % | 2855 | % If the user has set preamble in terms of percent of \hsize we will |
| 2450 | % Make sure we don't inherit \rightskip from the outer environment. | 2856 | % use that dimension as the width of the column, and the \leftskip |
| 2451 | \rightskip=0pt | 2857 | % will keep entries from bumping into each other. Table will start at |
| 2452 | \ifnum\colcount=1 | 2858 | % left margin and final column will justify at right margin. |
| 2453 | % The first column will be indented with the surrounding text. | 2859 | % |
| 2454 | \advance\hsize by\leftskip | 2860 | % Make sure we don't inherit \rightskip from the outer environment. |
| 2455 | \else | 2861 | \rightskip=0pt |
| 2456 | \ifsetpercent \else | 2862 | \ifnum\colcount=1 |
| 2457 | % If user has not set preamble in terms of percent of \hsize | 2863 | % The first column will be indented with the surrounding text. |
| 2458 | % we will advance \hsize by \multitablecolspace. | 2864 | \advance\hsize by\leftskip |
| 2459 | \advance\hsize by \multitablecolspace | 2865 | \else |
| 2460 | \fi | 2866 | \ifsetpercent \else |
| 2461 | % In either case we will make \leftskip=\multitablecolspace: | 2867 | % If user has not set preamble in terms of percent of \hsize |
| 2462 | \leftskip=\multitablecolspace | 2868 | % we will advance \hsize by \multitablecolspace. |
| 2463 | \fi | 2869 | \advance\hsize by \multitablecolspace |
| 2464 | % Ignoring space at the beginning and end avoids an occasional spurious | 2870 | \fi |
| 2465 | % blank line, when TeX decides to break the line at the space before the | 2871 | % In either case we will make \leftskip=\multitablecolspace: |
| 2466 | % box from the multistrut, so the strut ends up on a line by itself. | 2872 | \leftskip=\multitablecolspace |
| 2467 | % For example: | 2873 | \fi |
| 2468 | % @multitable @columnfractions .11 .89 | 2874 | % Ignoring space at the beginning and end avoids an occasional spurious |
| 2469 | % @item @code{#} | 2875 | % blank line, when TeX decides to break the line at the space before the |
| 2470 | % @tab Legal holiday which is valid in major parts of the whole country. | 2876 | % box from the multistrut, so the strut ends up on a line by itself. |
| 2471 | % Is automatically provided with highlighting sequences respectively marking | 2877 | % For example: |
| 2472 | % characters. | 2878 | % @multitable @columnfractions .11 .89 |
| 2473 | \noindent\ignorespaces##\unskip\multistrut}\cr | 2879 | % @item @code{#} |
| 2474 | } | 2880 | % @tab Legal holiday which is valid in major parts of the whole country. |
| 2475 | 2881 | % Is automatically provided with highlighting sequences respectively | |
| 2476 | \def\setmultitablespacing{% test to see if user has set \multitablelinespace. | 2882 | % marking characters. |
| 2477 | % If so, do nothing. If not, give it an appropriate dimension based on | 2883 | \noindent\ignorespaces##\unskip\multistrut |
| 2478 | % current baselineskip. | 2884 | }\cr |
| 2885 | } | ||
| 2886 | \def\Emultitable{% | ||
| 2887 | \crcr | ||
| 2888 | \egroup % end the \halign | ||
| 2889 | \global\setpercentfalse | ||
| 2890 | } | ||
| 2891 | |||
| 2892 | \def\setmultitablespacing{% | ||
| 2893 | \def\multistrut{\strut}% just use the standard line spacing | ||
| 2894 | % | ||
| 2895 | % Compute \multitablelinespace (if not defined by user) for use in | ||
| 2896 | % \multitableparskip calculation. We used define \multistrut based on | ||
| 2897 | % this, but (ironically) that caused the spacing to be off. | ||
| 2898 | % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. | ||
| 2479 | \ifdim\multitablelinespace=0pt | 2899 | \ifdim\multitablelinespace=0pt |
| 2480 | \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip | 2900 | \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip |
| 2481 | \global\advance\multitablelinespace by-\ht0 | 2901 | \global\advance\multitablelinespace by-\ht0 |
| 2482 | %% strut to put in table in case some entry doesn't have descenders, | 2902 | \fi |
| 2483 | %% to keep lines equally spaced | ||
| 2484 | \let\multistrut = \strut | ||
| 2485 | \else | ||
| 2486 | %% FIXME: what is \box0 supposed to be? | ||
| 2487 | \gdef\multistrut{\vrule height\multitablelinespace depth\dp0 | ||
| 2488 | width0pt\relax} \fi | ||
| 2489 | %% Test to see if parskip is larger than space between lines of | 2903 | %% Test to see if parskip is larger than space between lines of |
| 2490 | %% table. If not, do nothing. | 2904 | %% table. If not, do nothing. |
| 2491 | %% If so, set to same dimension as multitablelinespace. | 2905 | %% If so, set to same dimension as multitablelinespace. |
| @@ -2500,364 +2914,175 @@ width0pt\relax} \fi | |||
| 2500 | %% than skip between lines in the table. | 2914 | %% than skip between lines in the table. |
| 2501 | \fi} | 2915 | \fi} |
| 2502 | 2916 | ||
| 2503 | % In case a @footnote appears inside an alignment, save the footnote | ||
| 2504 | % text to a box and make the \insert when a row of the table is | ||
| 2505 | % finished. Otherwise, the insertion is lost, it never migrates to the | ||
| 2506 | % main vertical list. --kasal, 22jan03. | ||
| 2507 | % | ||
| 2508 | \newbox\savedfootnotes | ||
| 2509 | % | ||
| 2510 | % \dotable \let's \startfootins to this, so that \dofootnote will call | ||
| 2511 | % it instead of starting the insertion right away. | ||
| 2512 | \def\startsavedfootnote{% | ||
| 2513 | \global\setbox\savedfootnotes = \vbox\bgroup | ||
| 2514 | \unvbox\savedfootnotes | ||
| 2515 | } | ||
| 2516 | \def\crcrwithfootnotes{% | ||
| 2517 | \crcr | ||
| 2518 | \ifvoid\savedfootnotes \else | ||
| 2519 | \noalign{\insert\footins{\box\savedfootnotes}}% | ||
| 2520 | \fi | ||
| 2521 | } | ||
| 2522 | 2917 | ||
| 2523 | \message{conditionals,} | 2918 | \message{conditionals,} |
| 2524 | % Prevent errors for section commands. | 2919 | |
| 2525 | % Used in @ignore and in failing conditionals. | 2920 | % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, |
| 2526 | \def\ignoresections{% | 2921 | % @ifnotxml always succeed. They currently do nothing; we don't |
| 2527 | \let\chapter=\relax | 2922 | % attempt to check whether the conditionals are properly nested. But we |
| 2528 | \let\unnumbered=\relax | 2923 | % have to remember that they are conditionals, so that @end doesn't |
| 2529 | \let\top=\relax | 2924 | % attempt to close an environment group. |
| 2530 | \let\unnumberedsec=\relax | 2925 | % |
| 2531 | \let\unnumberedsection=\relax | 2926 | \def\makecond#1{% |
| 2532 | \let\unnumberedsubsec=\relax | 2927 | \expandafter\let\csname #1\endcsname = \relax |
| 2533 | \let\unnumberedsubsection=\relax | 2928 | \expandafter\let\csname iscond.#1\endcsname = 1 |
| 2534 | \let\unnumberedsubsubsec=\relax | ||
| 2535 | \let\unnumberedsubsubsection=\relax | ||
| 2536 | \let\section=\relax | ||
| 2537 | \let\subsec=\relax | ||
| 2538 | \let\subsubsec=\relax | ||
| 2539 | \let\subsection=\relax | ||
| 2540 | \let\subsubsection=\relax | ||
| 2541 | \let\appendix=\relax | ||
| 2542 | \let\appendixsec=\relax | ||
| 2543 | \let\appendixsection=\relax | ||
| 2544 | \let\appendixsubsec=\relax | ||
| 2545 | \let\appendixsubsection=\relax | ||
| 2546 | \let\appendixsubsubsec=\relax | ||
| 2547 | \let\appendixsubsubsection=\relax | ||
| 2548 | \let\contents=\relax | ||
| 2549 | \let\smallbook=\relax | ||
| 2550 | \let\titlepage=\relax | ||
| 2551 | } | ||
| 2552 | |||
| 2553 | % Used in nested conditionals, where we have to parse the Texinfo source | ||
| 2554 | % and so want to turn off most commands, in case they are used | ||
| 2555 | % incorrectly. | ||
| 2556 | % | ||
| 2557 | % We use \empty instead of \relax for the @def... commands, so that \end | ||
| 2558 | % doesn't throw an error. For instance: | ||
| 2559 | % @ignore | ||
| 2560 | % @deffn ... | ||
| 2561 | % @end deffn | ||
| 2562 | % @end ignore | ||
| 2563 | % | ||
| 2564 | % The @end deffn is going to get expanded, because we're trying to allow | ||
| 2565 | % nested conditionals. But we don't want to expand the actual @deffn, | ||
| 2566 | % since it might be syntactically correct and intended to be ignored. | ||
| 2567 | % Since \end checks for \relax, using \empty does not cause an error. | ||
| 2568 | % | ||
| 2569 | \def\ignoremorecommands{% | ||
| 2570 | \let\defcodeindex = \relax | ||
| 2571 | \let\defcv = \empty | ||
| 2572 | \let\defcvx = \empty | ||
| 2573 | \let\Edefcv = \empty | ||
| 2574 | \let\deffn = \empty | ||
| 2575 | \let\deffnx = \empty | ||
| 2576 | \let\Edeffn = \empty | ||
| 2577 | \let\defindex = \relax | ||
| 2578 | \let\defivar = \empty | ||
| 2579 | \let\defivarx = \empty | ||
| 2580 | \let\Edefivar = \empty | ||
| 2581 | \let\defmac = \empty | ||
| 2582 | \let\defmacx = \empty | ||
| 2583 | \let\Edefmac = \empty | ||
| 2584 | \let\defmethod = \empty | ||
| 2585 | \let\defmethodx = \empty | ||
| 2586 | \let\Edefmethod = \empty | ||
| 2587 | \let\defop = \empty | ||
| 2588 | \let\defopx = \empty | ||
| 2589 | \let\Edefop = \empty | ||
| 2590 | \let\defopt = \empty | ||
| 2591 | \let\defoptx = \empty | ||
| 2592 | \let\Edefopt = \empty | ||
| 2593 | \let\defspec = \empty | ||
| 2594 | \let\defspecx = \empty | ||
| 2595 | \let\Edefspec = \empty | ||
| 2596 | \let\deftp = \empty | ||
| 2597 | \let\deftpx = \empty | ||
| 2598 | \let\Edeftp = \empty | ||
| 2599 | \let\deftypefn = \empty | ||
| 2600 | \let\deftypefnx = \empty | ||
| 2601 | \let\Edeftypefn = \empty | ||
| 2602 | \let\deftypefun = \empty | ||
| 2603 | \let\deftypefunx = \empty | ||
| 2604 | \let\Edeftypefun = \empty | ||
| 2605 | \let\deftypeivar = \empty | ||
| 2606 | \let\deftypeivarx = \empty | ||
| 2607 | \let\Edeftypeivar = \empty | ||
| 2608 | \let\deftypemethod = \empty | ||
| 2609 | \let\deftypemethodx = \empty | ||
| 2610 | \let\Edeftypemethod = \empty | ||
| 2611 | \let\deftypeop = \empty | ||
| 2612 | \let\deftypeopx = \empty | ||
| 2613 | \let\Edeftypeop = \empty | ||
| 2614 | \let\deftypevar = \empty | ||
| 2615 | \let\deftypevarx = \empty | ||
| 2616 | \let\Edeftypevar = \empty | ||
| 2617 | \let\deftypevr = \empty | ||
| 2618 | \let\deftypevrx = \empty | ||
| 2619 | \let\Edeftypevr = \empty | ||
| 2620 | \let\defun = \empty | ||
| 2621 | \let\defunx = \empty | ||
| 2622 | \let\Edefun = \empty | ||
| 2623 | \let\defvar = \empty | ||
| 2624 | \let\defvarx = \empty | ||
| 2625 | \let\Edefvar = \empty | ||
| 2626 | \let\defvr = \empty | ||
| 2627 | \let\defvrx = \empty | ||
| 2628 | \let\Edefvr = \empty | ||
| 2629 | \let\clear = \relax | ||
| 2630 | \let\down = \relax | ||
| 2631 | \let\evenfooting = \relax | ||
| 2632 | \let\evenheading = \relax | ||
| 2633 | \let\everyfooting = \relax | ||
| 2634 | \let\everyheading = \relax | ||
| 2635 | \let\headings = \relax | ||
| 2636 | \let\include = \relax | ||
| 2637 | \let\item = \relax | ||
| 2638 | \let\lowersections = \relax | ||
| 2639 | \let\oddfooting = \relax | ||
| 2640 | \let\oddheading = \relax | ||
| 2641 | \let\printindex = \relax | ||
| 2642 | \let\pxref = \relax | ||
| 2643 | \let\raisesections = \relax | ||
| 2644 | \let\ref = \relax | ||
| 2645 | \let\set = \relax | ||
| 2646 | \let\setchapternewpage = \relax | ||
| 2647 | \let\setchapterstyle = \relax | ||
| 2648 | \let\settitle = \relax | ||
| 2649 | \let\up = \relax | ||
| 2650 | \let\verbatiminclude = \relax | ||
| 2651 | \let\xref = \relax | ||
| 2652 | } | 2929 | } |
| 2930 | \makecond{iftex} | ||
| 2931 | \makecond{ifnotdocbook} | ||
| 2932 | \makecond{ifnothtml} | ||
| 2933 | \makecond{ifnotinfo} | ||
| 2934 | \makecond{ifnotplaintext} | ||
| 2935 | \makecond{ifnotxml} | ||
| 2653 | 2936 | ||
| 2654 | % Ignore @ignore, @ifhtml, @ifinfo, and the like. | 2937 | % Ignore @ignore, @ifhtml, @ifinfo, and the like. |
| 2655 | % | 2938 | % |
| 2656 | \def\direntry{\doignore{direntry}} | 2939 | \def\direntry{\doignore{direntry}} |
| 2657 | \def\documentdescriptionword{documentdescription} | ||
| 2658 | \def\documentdescription{\doignore{documentdescription}} | 2940 | \def\documentdescription{\doignore{documentdescription}} |
| 2941 | \def\docbook{\doignore{docbook}} | ||
| 2659 | \def\html{\doignore{html}} | 2942 | \def\html{\doignore{html}} |
| 2943 | \def\ifdocbook{\doignore{ifdocbook}} | ||
| 2660 | \def\ifhtml{\doignore{ifhtml}} | 2944 | \def\ifhtml{\doignore{ifhtml}} |
| 2661 | \def\ifinfo{\doignore{ifinfo}} | 2945 | \def\ifinfo{\doignore{ifinfo}} |
| 2662 | \def\ifnottex{\nestedignore{ifnottex}} | 2946 | \def\ifnottex{\doignore{ifnottex}} |
| 2663 | \def\ifplaintext{\doignore{ifplaintext}} | 2947 | \def\ifplaintext{\doignore{ifplaintext}} |
| 2664 | \def\ifxml{\doignore{ifxml}} | 2948 | \def\ifxml{\doignore{ifxml}} |
| 2665 | \def\ignore{\doignore{ignore}} | 2949 | \def\ignore{\doignore{ignore}} |
| 2666 | \def\menu{\doignore{menu}} | 2950 | \def\menu{\doignore{menu}} |
| 2667 | \def\xml{\doignore{xml}} | 2951 | \def\xml{\doignore{xml}} |
| 2668 | 2952 | ||
| 2669 | % @dircategory CATEGORY -- specify a category of the dir file | 2953 | % Ignore text until a line `@end #1', keeping track of nested conditionals. |
| 2670 | % which this file should belong to. Ignore this in TeX. | ||
| 2671 | \let\dircategory = \comment | ||
| 2672 | |||
| 2673 | % Ignore text until a line `@end #1'. | ||
| 2674 | % | 2954 | % |
| 2955 | % A count to remember the depth of nesting. | ||
| 2956 | \newcount\doignorecount | ||
| 2957 | |||
| 2675 | \def\doignore#1{\begingroup | 2958 | \def\doignore#1{\begingroup |
| 2676 | % Don't complain about control sequences we have declared \outer. | 2959 | % Scan in ``verbatim'' mode: |
| 2677 | \ignoresections | 2960 | \obeylines |
| 2678 | % | 2961 | \catcode`\@ = \other |
| 2679 | % Define a command to swallow text until we reach `@end #1'. | 2962 | \catcode`\{ = \other |
| 2680 | % This @ is a catcode 12 token (that is the normal catcode of @ in | 2963 | \catcode`\} = \other |
| 2681 | % this texinfo.tex file). We change the catcode of @ below to match. | ||
| 2682 | \long\def\doignoretext##1@end #1{\enddoignore}% | ||
| 2683 | % | 2964 | % |
| 2684 | % Make sure that spaces turn into tokens that match what \doignoretext wants. | 2965 | % Make sure that spaces turn into tokens that match what \doignoretext wants. |
| 2685 | \catcode\spaceChar = 10 | 2966 | \spaceisspace |
| 2686 | % | ||
| 2687 | % Ignore braces, too, so mismatched braces don't cause trouble. | ||
| 2688 | \catcode`\{ = 9 | ||
| 2689 | \catcode`\} = 9 | ||
| 2690 | % | 2967 | % |
| 2691 | % We must not have @c interpreted as a control sequence. | 2968 | % Count number of #1's that we've seen. |
| 2692 | \catcode`\@ = 12 | 2969 | \doignorecount = 0 |
| 2693 | % | 2970 | % |
| 2694 | \def\ignoreword{#1}% | 2971 | % Swallow text until we reach the matching `@end #1'. |
| 2695 | \ifx\ignoreword\documentdescriptionword | 2972 | \dodoignore{#1}% |
| 2696 | % The c kludge breaks documentdescription, since | ||
| 2697 | % `documentdescription' contains a `c'. Means not everything will | ||
| 2698 | % be ignored inside @documentdescription, but oh well... | ||
| 2699 | \else | ||
| 2700 | % Make the letter c a comment character so that the rest of the line | ||
| 2701 | % will be ignored. This way, the document can have (for example) | ||
| 2702 | % @c @end ifinfo | ||
| 2703 | % and the @end ifinfo will be properly ignored. | ||
| 2704 | % (We've just changed @ to catcode 12.) | ||
| 2705 | \catcode`\c = 14 | ||
| 2706 | \fi | ||
| 2707 | % | ||
| 2708 | % And now expand the command defined above. | ||
| 2709 | \doignoretext | ||
| 2710 | } | ||
| 2711 | |||
| 2712 | % What we do to finish off ignored text. | ||
| 2713 | % | ||
| 2714 | \def\enddoignore{\endgroup\ignorespaces}% | ||
| 2715 | |||
| 2716 | \newif\ifwarnedobs\warnedobsfalse | ||
| 2717 | \def\obstexwarn{% | ||
| 2718 | \ifwarnedobs\relax\else | ||
| 2719 | % We need to warn folks that they may have trouble with TeX 3.0. | ||
| 2720 | % This uses \immediate\write16 rather than \message to get newlines. | ||
| 2721 | \immediate\write16{} | ||
| 2722 | \immediate\write16{WARNING: for users of Unix TeX 3.0!} | ||
| 2723 | \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} | ||
| 2724 | \immediate\write16{If you are running another version of TeX, relax.} | ||
| 2725 | \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} | ||
| 2726 | \immediate\write16{ Then upgrade your TeX installation if you can.} | ||
| 2727 | \immediate\write16{ (See ftp://ftp.gnu.org/non-gnu/TeX.README.)} | ||
| 2728 | \immediate\write16{If you are stuck with version 3.0, run the} | ||
| 2729 | \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} | ||
| 2730 | \immediate\write16{ to use a workaround.} | ||
| 2731 | \immediate\write16{} | ||
| 2732 | \global\warnedobstrue | ||
| 2733 | \fi | ||
| 2734 | } | 2973 | } |
| 2735 | 2974 | ||
| 2736 | % **In TeX 3.0, setting text in \nullfont hangs tex. For a | 2975 | { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. |
| 2737 | % workaround (which requires the file ``dummy.tfm'' to be installed), | 2976 | \obeylines % |
| 2738 | % uncomment the following line: | ||
| 2739 | %%%%%\font\nullfont=dummy\let\obstexwarn=\relax | ||
| 2740 | |||
| 2741 | % Ignore text, except that we keep track of conditional commands for | ||
| 2742 | % purposes of nesting, up to an `@end #1' command. | ||
| 2743 | % | ||
| 2744 | \def\nestedignore#1{% | ||
| 2745 | \obstexwarn | ||
| 2746 | % We must actually expand the ignored text to look for the @end | ||
| 2747 | % command, so that nested ignore constructs work. Thus, we put the | ||
| 2748 | % text into a \vbox and then do nothing with the result. To minimize | ||
| 2749 | % the chance of memory overflow, we follow the approach outlined on | ||
| 2750 | % page 401 of the TeXbook. | ||
| 2751 | % | 2977 | % |
| 2752 | \setbox0 = \vbox\bgroup | 2978 | \gdef\dodoignore#1{% |
| 2753 | % Don't complain about control sequences we have declared \outer. | 2979 | % #1 contains the command name as a string, e.g., `ifinfo'. |
| 2754 | \ignoresections | ||
| 2755 | % | ||
| 2756 | % Define `@end #1' to end the box, which will in turn undefine the | ||
| 2757 | % @end command again. | ||
| 2758 | \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% | ||
| 2759 | % | ||
| 2760 | % We are going to be parsing Texinfo commands. Most cause no | ||
| 2761 | % trouble when they are used incorrectly, but some commands do | ||
| 2762 | % complicated argument parsing or otherwise get confused, so we | ||
| 2763 | % undefine them. | ||
| 2764 | % | ||
| 2765 | % We can't do anything about stray @-signs, unfortunately; | ||
| 2766 | % they'll produce `undefined control sequence' errors. | ||
| 2767 | \ignoremorecommands | ||
| 2768 | % | 2980 | % |
| 2769 | % Set the current font to be \nullfont, a TeX primitive, and define | 2981 | % Define a command to find the next `@end #1'. |
| 2770 | % all the font commands to also use \nullfont. We don't use | 2982 | \long\def\doignoretext##1^^M@end #1{% |
| 2771 | % dummy.tfm, as suggested in the TeXbook, because some sites | 2983 | \doignoretextyyy##1^^M@#1\_STOP_}% |
| 2772 | % might not have that installed. Therefore, math mode will still | ||
| 2773 | % produce output, but that should be an extremely small amount of | ||
| 2774 | % stuff compared to the main input. | ||
| 2775 | % | 2984 | % |
| 2776 | \nullfont | 2985 | % And this command to find another #1 command, at the beginning of a |
| 2777 | \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont | 2986 | % line. (Otherwise, we would consider a line `@c @ifset', for |
| 2778 | \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont | 2987 | % example, to count as an @ifset for nesting.) |
| 2779 | \let\tensf=\nullfont | 2988 | \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% |
| 2780 | % Similarly for index fonts. | ||
| 2781 | \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont | ||
| 2782 | \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont | ||
| 2783 | \let\smallsf=\nullfont | ||
| 2784 | % Similarly for smallexample fonts. | ||
| 2785 | \let\smallerrm=\nullfont \let\smallerit=\nullfont \let\smallersl=\nullfont | ||
| 2786 | \let\smallerbf=\nullfont \let\smallertt=\nullfont \let\smallersc=\nullfont | ||
| 2787 | \let\smallersf=\nullfont | ||
| 2788 | % | 2989 | % |
| 2789 | % Don't complain when characters are missing from the fonts. | 2990 | % And now expand that command. |
| 2790 | \tracinglostchars = 0 | 2991 | \doignoretext ^^M% |
| 2791 | % | 2992 | }% |
| 2792 | % Don't bother to do space factor calculations. | ||
| 2793 | \frenchspacing | ||
| 2794 | % | ||
| 2795 | % Don't report underfull hboxes. | ||
| 2796 | \hbadness = 10000 | ||
| 2797 | % | ||
| 2798 | % Do minimal line-breaking. | ||
| 2799 | \pretolerance = 10000 | ||
| 2800 | % | ||
| 2801 | % Do not execute instructions in @tex. | ||
| 2802 | \def\tex{\doignore{tex}}% | ||
| 2803 | % Do not execute macro definitions. | ||
| 2804 | % `c' is a comment character, so the word `macro' will get cut off. | ||
| 2805 | \def\macro{\doignore{ma}}% | ||
| 2806 | } | 2993 | } |
| 2807 | 2994 | ||
| 2995 | \def\doignoreyyy#1{% | ||
| 2996 | \def\temp{#1}% | ||
| 2997 | \ifx\temp\empty % Nothing found. | ||
| 2998 | \let\next\doignoretextzzz | ||
| 2999 | \else % Found a nested condition, ... | ||
| 3000 | \advance\doignorecount by 1 | ||
| 3001 | \let\next\doignoretextyyy % ..., look for another. | ||
| 3002 | % If we're here, #1 ends with ^^M\ifinfo (for example). | ||
| 3003 | \fi | ||
| 3004 | \next #1% the token \_STOP_ is present just after this macro. | ||
| 3005 | } | ||
| 3006 | |||
| 3007 | % We have to swallow the remaining "\_STOP_". | ||
| 3008 | % | ||
| 3009 | \def\doignoretextzzz#1{% | ||
| 3010 | \ifnum\doignorecount = 0 % We have just found the outermost @end. | ||
| 3011 | \let\next\enddoignore | ||
| 3012 | \else % Still inside a nested condition. | ||
| 3013 | \advance\doignorecount by -1 | ||
| 3014 | \let\next\doignoretext % Look for the next @end. | ||
| 3015 | \fi | ||
| 3016 | \next | ||
| 3017 | } | ||
| 3018 | |||
| 3019 | % Finish off ignored text. | ||
| 3020 | { \obeylines% | ||
| 3021 | % Ignore anything after the last `@end #1'; this matters in verbatim | ||
| 3022 | % environments, where otherwise the newline after an ignored conditional | ||
| 3023 | % would result in a blank line in the output. | ||
| 3024 | \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% | ||
| 3025 | } | ||
| 3026 | |||
| 3027 | |||
| 2808 | % @set VAR sets the variable VAR to an empty value. | 3028 | % @set VAR sets the variable VAR to an empty value. |
| 2809 | % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. | 3029 | % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. |
| 2810 | % | 3030 | % |
| 2811 | % Since we want to separate VAR from REST-OF-LINE (which might be | 3031 | % Since we want to separate VAR from REST-OF-LINE (which might be |
| 2812 | % empty), we can't just use \parsearg; we have to insert a space of our | 3032 | % empty), we can't just use \parsearg; we have to insert a space of our |
| 2813 | % own to delimit the rest of the line, and then take it out again if we | 3033 | % own to delimit the rest of the line, and then take it out again if we |
| 2814 | % didn't need it. Make sure the catcode of space is correct to avoid | 3034 | % didn't need it. |
| 2815 | % losing inside @example, for instance. | 3035 | % We rely on the fact that \parsearg sets \catcode`\ =10. |
| 2816 | % | 3036 | % |
| 2817 | \def\set{\begingroup\catcode` =10 | 3037 | \parseargdef\set{\setyyy#1 \endsetyyy} |
| 2818 | \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. | ||
| 2819 | \parsearg\setxxx} | ||
| 2820 | \def\setxxx#1{\setyyy#1 \endsetyyy} | ||
| 2821 | \def\setyyy#1 #2\endsetyyy{% | 3038 | \def\setyyy#1 #2\endsetyyy{% |
| 2822 | \def\temp{#2}% | 3039 | {% |
| 2823 | \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty | 3040 | \makevalueexpandable |
| 2824 | \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. | 3041 | \def\temp{#2}% |
| 2825 | \fi | 3042 | \edef\next{\gdef\makecsname{SET#1}}% |
| 2826 | \endgroup | 3043 | \ifx\temp\empty |
| 3044 | \next{}% | ||
| 3045 | \else | ||
| 3046 | \setzzz#2\endsetzzz | ||
| 3047 | \fi | ||
| 3048 | }% | ||
| 2827 | } | 3049 | } |
| 2828 | % Can't use \xdef to pre-expand #2 and save some time, since \temp or | 3050 | % Remove the trailing space \setxxx inserted. |
| 2829 | % \next or other control sequences that we've defined might get us into | 3051 | \def\setzzz#1 \endsetzzz{\next{#1}} |
| 2830 | % an infinite loop. Consider `@set foo @cite{bar}'. | ||
| 2831 | \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} | ||
| 2832 | 3052 | ||
| 2833 | % @clear VAR clears (i.e., unsets) the variable VAR. | 3053 | % @clear VAR clears (i.e., unsets) the variable VAR. |
| 2834 | % | 3054 | % |
| 2835 | \def\clear{\parsearg\clearxxx} | 3055 | \parseargdef\clear{% |
| 2836 | \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} | 3056 | {% |
| 3057 | \makevalueexpandable | ||
| 3058 | \global\expandafter\let\csname SET#1\endcsname=\relax | ||
| 3059 | }% | ||
| 3060 | } | ||
| 2837 | 3061 | ||
| 2838 | % @value{foo} gets the text saved in variable foo. | 3062 | % @value{foo} gets the text saved in variable foo. |
| 3063 | \def\value{\begingroup\makevalueexpandable\valuexxx} | ||
| 3064 | \def\valuexxx#1{\expandablevalue{#1}\endgroup} | ||
| 2839 | { | 3065 | { |
| 2840 | \catcode`\_ = \active | 3066 | \catcode`\- = \active \catcode`\_ = \active |
| 2841 | % | 3067 | % |
| 2842 | % We might end up with active _ or - characters in the argument if | 3068 | \gdef\makevalueexpandable{% |
| 2843 | % we're called from @code, as @code{@value{foo-bar_}}. So \let any | 3069 | \let\value = \expandablevalue |
| 2844 | % such active characters to their normal equivalents. | 3070 | % We don't want these characters active, ... |
| 2845 | \gdef\value{\begingroup | ||
| 2846 | \catcode`\-=\other \catcode`\_=\other | 3071 | \catcode`\-=\other \catcode`\_=\other |
| 2847 | \indexbreaks \let_\normalunderscore | 3072 | % ..., but we might end up with active ones in the argument if |
| 2848 | \valuexxx} | 3073 | % we're called from @code, as @code{@value{foo-bar_}}, though. |
| 3074 | % So \let them to their normal equivalents. | ||
| 3075 | \let-\realdash \let_\normalunderscore | ||
| 3076 | } | ||
| 2849 | } | 3077 | } |
| 2850 | \def\valuexxx#1{\expandablevalue{#1}\endgroup} | ||
| 2851 | 3078 | ||
| 2852 | % We have this subroutine so that we can handle at least some @value's | 3079 | % We have this subroutine so that we can handle at least some @value's |
| 2853 | % properly in indexes (we \let\value to this in \indexdummies). Ones | 3080 | % properly in indexes (we call \makevalueexpandable in \indexdummies). |
| 2854 | % whose names contain - or _ still won't work, but we can't do anything | 3081 | % The command has to be fully expandable (if the variable is set), since |
| 2855 | % about that. The command has to be fully expandable (if the variable | 3082 | % the result winds up in the index file. This means that if the |
| 2856 | % is set), since the result winds up in the index file. This means that | 3083 | % variable's value contains other Texinfo commands, it's almost certain |
| 2857 | % if the variable's value contains other Texinfo commands, it's almost | 3084 | % it will fail (although perhaps we could fix that with sufficient work |
| 2858 | % certain it will fail (although perhaps we could fix that with | 3085 | % to do a one-level expansion on the result, instead of complete). |
| 2859 | % sufficient work to do a one-level expansion on the result, instead of | ||
| 2860 | % complete). | ||
| 2861 | % | 3086 | % |
| 2862 | \def\expandablevalue#1{% | 3087 | \def\expandablevalue#1{% |
| 2863 | \expandafter\ifx\csname SET#1\endcsname\relax | 3088 | \expandafter\ifx\csname SET#1\endcsname\relax |
| @@ -2871,55 +3096,36 @@ width0pt\relax} \fi | |||
| 2871 | % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined | 3096 | % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined |
| 2872 | % with @set. | 3097 | % with @set. |
| 2873 | % | 3098 | % |
| 2874 | \def\ifset{\parsearg\doifset} | 3099 | % To get special treatment of `@end ifset,' call \makeond and the redefine. |
| 2875 | \def\doifset#1{% | 3100 | % |
| 2876 | \expandafter\ifx\csname SET#1\endcsname\relax | 3101 | \makecond{ifset} |
| 2877 | \let\next=\ifsetfail | 3102 | \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} |
| 2878 | \else | 3103 | \def\doifset#1#2{% |
| 2879 | \let\next=\ifsetsucceed | 3104 | {% |
| 2880 | \fi | 3105 | \makevalueexpandable |
| 2881 | \next | 3106 | \let\next=\empty |
| 3107 | \expandafter\ifx\csname SET#2\endcsname\relax | ||
| 3108 | #1% If not set, redefine \next. | ||
| 3109 | \fi | ||
| 3110 | \expandafter | ||
| 3111 | }\next | ||
| 2882 | } | 3112 | } |
| 2883 | \def\ifsetsucceed{\conditionalsucceed{ifset}} | 3113 | \def\ifsetfail{\doignore{ifset}} |
| 2884 | \def\ifsetfail{\nestedignore{ifset}} | ||
| 2885 | \defineunmatchedend{ifset} | ||
| 2886 | 3114 | ||
| 2887 | % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been | 3115 | % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been |
| 2888 | % defined with @set, or has been undefined with @clear. | 3116 | % defined with @set, or has been undefined with @clear. |
| 2889 | % | 3117 | % |
| 2890 | \def\ifclear{\parsearg\doifclear} | 3118 | % The `\else' inside the `\doifset' parameter is a trick to reuse the |
| 2891 | \def\doifclear#1{% | 3119 | % above code: if the variable is not set, do nothing, if it is set, |
| 2892 | \expandafter\ifx\csname SET#1\endcsname\relax | 3120 | % then redefine \next to \ifclearfail. |
| 2893 | \let\next=\ifclearsucceed | ||
| 2894 | \else | ||
| 2895 | \let\next=\ifclearfail | ||
| 2896 | \fi | ||
| 2897 | \next | ||
| 2898 | } | ||
| 2899 | \def\ifclearsucceed{\conditionalsucceed{ifclear}} | ||
| 2900 | \def\ifclearfail{\nestedignore{ifclear}} | ||
| 2901 | \defineunmatchedend{ifclear} | ||
| 2902 | |||
| 2903 | % @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we | ||
| 2904 | % read the text following, through the first @end iftex (etc.). Make | ||
| 2905 | % `@end iftex' (etc.) valid only after an @iftex. | ||
| 2906 | % | 3121 | % |
| 2907 | \def\iftex{\conditionalsucceed{iftex}} | 3122 | \makecond{ifclear} |
| 2908 | \def\ifnothtml{\conditionalsucceed{ifnothtml}} | 3123 | \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} |
| 2909 | \def\ifnotinfo{\conditionalsucceed{ifnotinfo}} | 3124 | \def\ifclearfail{\doignore{ifclear}} |
| 2910 | \def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}} | ||
| 2911 | \defineunmatchedend{iftex} | ||
| 2912 | \defineunmatchedend{ifnothtml} | ||
| 2913 | \defineunmatchedend{ifnotinfo} | ||
| 2914 | \defineunmatchedend{ifnotplaintext} | ||
| 2915 | 3125 | ||
| 2916 | % True conditional. Since \set globally defines its variables, we can | 3126 | % @dircategory CATEGORY -- specify a category of the dir file |
| 2917 | % just start and end a group (to keep the @end definition undefined at | 3127 | % which this file should belong to. Ignore this in TeX. |
| 2918 | % the outer level). | 3128 | \let\dircategory=\comment |
| 2919 | % | ||
| 2920 | \def\conditionalsucceed#1{\begingroup | ||
| 2921 | \expandafter\def\csname E#1\endcsname{\endgroup}% | ||
| 2922 | } | ||
| 2923 | 3129 | ||
| 2924 | % @defininfoenclose. | 3130 | % @defininfoenclose. |
| 2925 | \let\definfoenclose=\comment | 3131 | \let\definfoenclose=\comment |
| @@ -2929,9 +3135,8 @@ width0pt\relax} \fi | |||
| 2929 | % Index generation facilities | 3135 | % Index generation facilities |
| 2930 | 3136 | ||
| 2931 | % Define \newwrite to be identical to plain tex's \newwrite | 3137 | % Define \newwrite to be identical to plain tex's \newwrite |
| 2932 | % except not \outer, so it can be used within \newindex. | 3138 | % except not \outer, so it can be used within macros and \if's. |
| 2933 | {\catcode`\@=11 | 3139 | \edef\newwrite{\makecsname{ptexnewwrite}} |
| 2934 | \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} | ||
| 2935 | 3140 | ||
| 2936 | % \newindex {foo} defines an index named foo. | 3141 | % \newindex {foo} defines an index named foo. |
| 2937 | % It automatically defines \fooindex such that | 3142 | % It automatically defines \fooindex such that |
| @@ -3017,6 +3222,7 @@ width0pt\relax} \fi | |||
| 3017 | % we have to laboriously prevent expansion for those that we don't. | 3222 | % we have to laboriously prevent expansion for those that we don't. |
| 3018 | % | 3223 | % |
| 3019 | \def\indexdummies{% | 3224 | \def\indexdummies{% |
| 3225 | \escapechar = `\\ % use backslash in output files. | ||
| 3020 | \def\@{@}% change to @@ when we switch to @ as escape char in index files. | 3226 | \def\@{@}% change to @@ when we switch to @ as escape char in index files. |
| 3021 | \def\ {\realbackslash\space }% | 3227 | \def\ {\realbackslash\space }% |
| 3022 | % Need these in case \tex is in effect and \{ is a \delimiter again. | 3228 | % Need these in case \tex is in effect and \{ is a \delimiter again. |
| @@ -3025,33 +3231,14 @@ width0pt\relax} \fi | |||
| 3025 | \let\{ = \mylbrace | 3231 | \let\{ = \mylbrace |
| 3026 | \let\} = \myrbrace | 3232 | \let\} = \myrbrace |
| 3027 | % | 3233 | % |
| 3028 | % \definedummyword defines \#1 as \realbackslash #1\space, thus | ||
| 3029 | % effectively preventing its expansion. This is used only for control | ||
| 3030 | % words, not control letters, because the \space would be incorrect | ||
| 3031 | % for control characters, but is needed to separate the control word | ||
| 3032 | % from whatever follows. | ||
| 3033 | % | ||
| 3034 | % For control letters, we have \definedummyletter, which omits the | ||
| 3035 | % space. | ||
| 3036 | % | ||
| 3037 | % These can be used both for control words that take an argument and | ||
| 3038 | % those that do not. If it is followed by {arg} in the input, then | ||
| 3039 | % that will dutifully get written to the index (or wherever). | ||
| 3040 | % | ||
| 3041 | \def\definedummyword##1{% | ||
| 3042 | \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}% | ||
| 3043 | }% | ||
| 3044 | \def\definedummyletter##1{% | ||
| 3045 | \expandafter\def\csname ##1\endcsname{\realbackslash ##1}% | ||
| 3046 | }% | ||
| 3047 | % | ||
| 3048 | % Do the redefinitions. | 3234 | % Do the redefinitions. |
| 3049 | \commondummies | 3235 | \commondummies |
| 3050 | } | 3236 | } |
| 3051 | 3237 | ||
| 3052 | % For the aux file, @ is the escape character. So we want to redefine | 3238 | % For the aux and toc files, @ is the escape character. So we want to |
| 3053 | % everything using @ instead of \realbackslash. When everything uses | 3239 | % redefine everything using @ as the escape character (instead of |
| 3054 | % @, this will be simpler. | 3240 | % \realbackslash, still used for index files). When everything uses @, |
| 3241 | % this will be simpler. | ||
| 3055 | % | 3242 | % |
| 3056 | \def\atdummies{% | 3243 | \def\atdummies{% |
| 3057 | \def\@{@@}% | 3244 | \def\@{@@}% |
| @@ -3059,160 +3246,179 @@ width0pt\relax} \fi | |||
| 3059 | \let\{ = \lbraceatcmd | 3246 | \let\{ = \lbraceatcmd |
| 3060 | \let\} = \rbraceatcmd | 3247 | \let\} = \rbraceatcmd |
| 3061 | % | 3248 | % |
| 3062 | % (See comments in \indexdummies.) | ||
| 3063 | \def\definedummyword##1{% | ||
| 3064 | \expandafter\def\csname ##1\endcsname{@##1\space}% | ||
| 3065 | }% | ||
| 3066 | \def\definedummyletter##1{% | ||
| 3067 | \expandafter\def\csname ##1\endcsname{@##1}% | ||
| 3068 | }% | ||
| 3069 | % | ||
| 3070 | % Do the redefinitions. | 3249 | % Do the redefinitions. |
| 3071 | \commondummies | 3250 | \commondummies |
| 3251 | \otherbackslash | ||
| 3072 | } | 3252 | } |
| 3073 | 3253 | ||
| 3074 | % Called from \indexdummies and \atdummies. \definedummyword and | 3254 | % Called from \indexdummies and \atdummies. |
| 3075 | % \definedummyletter must be defined first. | ||
| 3076 | % | 3255 | % |
| 3077 | \def\commondummies{% | 3256 | \def\commondummies{% |
| 3078 | % | 3257 | % |
| 3079 | \normalturnoffactive | 3258 | % \definedummyword defines \#1 as \string\#1\space, thus effectively |
| 3259 | % preventing its expansion. This is used only for control% words, | ||
| 3260 | % not control letters, because the \space would be incorrect for | ||
| 3261 | % control characters, but is needed to separate the control word | ||
| 3262 | % from whatever follows. | ||
| 3080 | % | 3263 | % |
| 3081 | % Control letters and accents. | 3264 | % For control letters, we have \definedummyletter, which omits the |
| 3082 | \definedummyletter{_}% | 3265 | % space. |
| 3083 | \definedummyletter{,}% | ||
| 3084 | \definedummyletter{"}% | ||
| 3085 | \definedummyletter{`}% | ||
| 3086 | \definedummyletter{'}% | ||
| 3087 | \definedummyletter{^}% | ||
| 3088 | \definedummyletter{~}% | ||
| 3089 | \definedummyletter{=}% | ||
| 3090 | \definedummyword{u}% | ||
| 3091 | \definedummyword{v}% | ||
| 3092 | \definedummyword{H}% | ||
| 3093 | \definedummyword{dotaccent}% | ||
| 3094 | \definedummyword{ringaccent}% | ||
| 3095 | \definedummyword{tieaccent}% | ||
| 3096 | \definedummyword{ubaraccent}% | ||
| 3097 | \definedummyword{udotaccent}% | ||
| 3098 | \definedummyword{dotless}% | ||
| 3099 | % | ||
| 3100 | % Other non-English letters. | ||
| 3101 | \definedummyword{AA}% | ||
| 3102 | \definedummyword{AE}% | ||
| 3103 | \definedummyword{L}% | ||
| 3104 | \definedummyword{OE}% | ||
| 3105 | \definedummyword{O}% | ||
| 3106 | \definedummyword{aa}% | ||
| 3107 | \definedummyword{ae}% | ||
| 3108 | \definedummyword{l}% | ||
| 3109 | \definedummyword{oe}% | ||
| 3110 | \definedummyword{o}% | ||
| 3111 | \definedummyword{ss}% | ||
| 3112 | % | 3266 | % |
| 3113 | % Although these internal commands shouldn't show up, sometimes they do. | 3267 | % These can be used both for control words that take an argument and |
| 3114 | \definedummyword{bf}% | 3268 | % those that do not. If it is followed by {arg} in the input, then |
| 3115 | \definedummyword{gtr}% | 3269 | % that will dutifully get written to the index (or wherever). |
| 3116 | \definedummyword{hat}% | ||
| 3117 | \definedummyword{less}% | ||
| 3118 | \definedummyword{sf}% | ||
| 3119 | \definedummyword{sl}% | ||
| 3120 | \definedummyword{tclose}% | ||
| 3121 | \definedummyword{tt}% | ||
| 3122 | % | 3270 | % |
| 3123 | % Texinfo font commands. | 3271 | \def\definedummyword ##1{\def##1{\string##1\space}}% |
| 3124 | \definedummyword{b}% | 3272 | \def\definedummyletter##1{\def##1{\string##1}}% |
| 3125 | \definedummyword{i}% | 3273 | \let\definedummyaccent\definedummyletter |
| 3126 | \definedummyword{r}% | 3274 | % |
| 3127 | \definedummyword{sc}% | 3275 | \commondummiesnofonts |
| 3128 | \definedummyword{t}% | 3276 | % |
| 3129 | % | 3277 | \definedummyletter\_% |
| 3130 | \definedummyword{TeX}% | 3278 | % |
| 3131 | \definedummyword{acronym}% | 3279 | % Non-English letters. |
| 3132 | \definedummyword{cite}% | 3280 | \definedummyword\AA |
| 3133 | \definedummyword{code}% | 3281 | \definedummyword\AE |
| 3134 | \definedummyword{command}% | 3282 | \definedummyword\L |
| 3135 | \definedummyword{dfn}% | 3283 | \definedummyword\OE |
| 3136 | \definedummyword{dots}% | 3284 | \definedummyword\O |
| 3137 | \definedummyword{emph}% | 3285 | \definedummyword\aa |
| 3138 | \definedummyword{env}% | 3286 | \definedummyword\ae |
| 3139 | \definedummyword{file}% | 3287 | \definedummyword\l |
| 3140 | \definedummyword{kbd}% | 3288 | \definedummyword\oe |
| 3141 | \definedummyword{key}% | 3289 | \definedummyword\o |
| 3142 | \definedummyword{math}% | 3290 | \definedummyword\ss |
| 3143 | \definedummyword{option}% | 3291 | \definedummyword\exclamdown |
| 3144 | \definedummyword{samp}% | 3292 | \definedummyword\questiondown |
| 3145 | \definedummyword{strong}% | 3293 | \definedummyword\ordf |
| 3146 | \definedummyword{uref}% | 3294 | \definedummyword\ordm |
| 3147 | \definedummyword{url}% | 3295 | % |
| 3148 | \definedummyword{var}% | 3296 | % Although these internal commands shouldn't show up, sometimes they do. |
| 3149 | \definedummyword{w}% | 3297 | \definedummyword\bf |
| 3298 | \definedummyword\gtr | ||
| 3299 | \definedummyword\hat | ||
| 3300 | \definedummyword\less | ||
| 3301 | \definedummyword\sf | ||
| 3302 | \definedummyword\sl | ||
| 3303 | \definedummyword\tclose | ||
| 3304 | \definedummyword\tt | ||
| 3305 | % | ||
| 3306 | \definedummyword\LaTeX | ||
| 3307 | \definedummyword\TeX | ||
| 3150 | % | 3308 | % |
| 3151 | % Assorted special characters. | 3309 | % Assorted special characters. |
| 3152 | \definedummyword{bullet}% | 3310 | \definedummyword\bullet |
| 3153 | \definedummyword{copyright}% | 3311 | \definedummyword\comma |
| 3154 | \definedummyword{dots}% | 3312 | \definedummyword\copyright |
| 3155 | \definedummyword{enddots}% | 3313 | \definedummyword\registeredsymbol |
| 3156 | \definedummyword{equiv}% | 3314 | \definedummyword\dots |
| 3157 | \definedummyword{error}% | 3315 | \definedummyword\enddots |
| 3158 | \definedummyword{expansion}% | 3316 | \definedummyword\equiv |
| 3159 | \definedummyword{minus}% | 3317 | \definedummyword\error |
| 3160 | \definedummyword{pounds}% | 3318 | \definedummyword\euro |
| 3161 | \definedummyword{point}% | 3319 | \definedummyword\expansion |
| 3162 | \definedummyword{print}% | 3320 | \definedummyword\minus |
| 3163 | \definedummyword{result}% | 3321 | \definedummyword\pounds |
| 3164 | % | 3322 | \definedummyword\point |
| 3165 | % Handle some cases of @value -- where the variable name does not | 3323 | \definedummyword\print |
| 3166 | % contain - or _, and the value does not contain any | 3324 | \definedummyword\result |
| 3167 | % (non-fully-expandable) commands. | 3325 | % |
| 3168 | \let\value = \expandablevalue | 3326 | % We want to disable all macros so that they are not expanded by \write. |
| 3327 | \macrolist | ||
| 3169 | % | 3328 | % |
| 3170 | % Normal spaces, not active ones. | 3329 | \normalturnoffactive |
| 3171 | \unsepspaces | ||
| 3172 | % | 3330 | % |
| 3173 | % No macro expansion. | 3331 | % Handle some cases of @value -- where it does not contain any |
| 3174 | \turnoffmacros | 3332 | % (non-fully-expandable) commands. |
| 3333 | \makevalueexpandable | ||
| 3175 | } | 3334 | } |
| 3176 | 3335 | ||
| 3177 | % If an index command is used in an @example environment, any spaces | 3336 | % \commondummiesnofonts: common to \commondummies and \indexnofonts. |
| 3178 | % therein should become regular spaces in the raw index file, not the | 3337 | % |
| 3179 | % expansion of \tie (\leavevmode \penalty \@M \ ). | 3338 | \def\commondummiesnofonts{% |
| 3180 | {\obeyspaces | 3339 | % Control letters and accents. |
| 3181 | \gdef\unsepspaces{\obeyspaces\let =\space}} | 3340 | \definedummyletter\!% |
| 3182 | 3341 | \definedummyaccent\"% | |
| 3342 | \definedummyaccent\'% | ||
| 3343 | \definedummyletter\*% | ||
| 3344 | \definedummyaccent\,% | ||
| 3345 | \definedummyletter\.% | ||
| 3346 | \definedummyletter\/% | ||
| 3347 | \definedummyletter\:% | ||
| 3348 | \definedummyaccent\=% | ||
| 3349 | \definedummyletter\?% | ||
| 3350 | \definedummyaccent\^% | ||
| 3351 | \definedummyaccent\`% | ||
| 3352 | \definedummyaccent\~% | ||
| 3353 | \definedummyword\u | ||
| 3354 | \definedummyword\v | ||
| 3355 | \definedummyword\H | ||
| 3356 | \definedummyword\dotaccent | ||
| 3357 | \definedummyword\ringaccent | ||
| 3358 | \definedummyword\tieaccent | ||
| 3359 | \definedummyword\ubaraccent | ||
| 3360 | \definedummyword\udotaccent | ||
| 3361 | \definedummyword\dotless | ||
| 3362 | % | ||
| 3363 | % Texinfo font commands. | ||
| 3364 | \definedummyword\b | ||
| 3365 | \definedummyword\i | ||
| 3366 | \definedummyword\r | ||
| 3367 | \definedummyword\sc | ||
| 3368 | \definedummyword\t | ||
| 3369 | % | ||
| 3370 | % Commands that take arguments. | ||
| 3371 | \definedummyword\acronym | ||
| 3372 | \definedummyword\cite | ||
| 3373 | \definedummyword\code | ||
| 3374 | \definedummyword\command | ||
| 3375 | \definedummyword\dfn | ||
| 3376 | \definedummyword\emph | ||
| 3377 | \definedummyword\env | ||
| 3378 | \definedummyword\file | ||
| 3379 | \definedummyword\kbd | ||
| 3380 | \definedummyword\key | ||
| 3381 | \definedummyword\math | ||
| 3382 | \definedummyword\option | ||
| 3383 | \definedummyword\pxref | ||
| 3384 | \definedummyword\ref | ||
| 3385 | \definedummyword\samp | ||
| 3386 | \definedummyword\strong | ||
| 3387 | \definedummyword\tie | ||
| 3388 | \definedummyword\uref | ||
| 3389 | \definedummyword\url | ||
| 3390 | \definedummyword\var | ||
| 3391 | \definedummyword\verb | ||
| 3392 | \definedummyword\w | ||
| 3393 | \definedummyword\xref | ||
| 3394 | } | ||
| 3183 | 3395 | ||
| 3184 | % \indexnofonts is used when outputting the strings to sort the index | 3396 | % \indexnofonts is used when outputting the strings to sort the index |
| 3185 | % by, and when constructing control sequence names. It eliminates all | 3397 | % by, and when constructing control sequence names. It eliminates all |
| 3186 | % control sequences and just writes whatever the best ASCII sort string | 3398 | % control sequences and just writes whatever the best ASCII sort string |
| 3187 | % would be for a given command (usually its argument). | 3399 | % would be for a given command (usually its argument). |
| 3188 | % | 3400 | % |
| 3189 | \def\indexdummytex{TeX} | ||
| 3190 | \def\indexdummydots{...} | ||
| 3191 | % | ||
| 3192 | \def\indexnofonts{% | 3401 | \def\indexnofonts{% |
| 3402 | % Accent commands should become @asis. | ||
| 3403 | \def\definedummyaccent##1{\let##1\asis}% | ||
| 3404 | % We can just ignore other control letters. | ||
| 3405 | \def\definedummyletter##1{\let##1\empty}% | ||
| 3406 | % Hopefully, all control words can become @asis. | ||
| 3407 | \let\definedummyword\definedummyaccent | ||
| 3408 | % | ||
| 3409 | \commondummiesnofonts | ||
| 3410 | % | ||
| 3411 | % Don't no-op \tt, since it isn't a user-level command | ||
| 3412 | % and is used in the definitions of the active chars like <, >, |, etc. | ||
| 3413 | % Likewise with the other plain tex font commands. | ||
| 3414 | %\let\tt=\asis | ||
| 3415 | % | ||
| 3193 | \def\ { }% | 3416 | \def\ { }% |
| 3194 | \def\@{@}% | 3417 | \def\@{@}% |
| 3195 | % how to handle braces? | 3418 | % how to handle braces? |
| 3196 | \def\_{\normalunderscore}% | 3419 | \def\_{\normalunderscore}% |
| 3197 | % | 3420 | % |
| 3198 | \let\,=\asis | 3421 | % Non-English letters. |
| 3199 | \let\"=\asis | ||
| 3200 | \let\`=\asis | ||
| 3201 | \let\'=\asis | ||
| 3202 | \let\^=\asis | ||
| 3203 | \let\~=\asis | ||
| 3204 | \let\==\asis | ||
| 3205 | \let\u=\asis | ||
| 3206 | \let\v=\asis | ||
| 3207 | \let\H=\asis | ||
| 3208 | \let\dotaccent=\asis | ||
| 3209 | \let\ringaccent=\asis | ||
| 3210 | \let\tieaccent=\asis | ||
| 3211 | \let\ubaraccent=\asis | ||
| 3212 | \let\udotaccent=\asis | ||
| 3213 | \let\dotless=\asis | ||
| 3214 | % | ||
| 3215 | % Other non-English letters. | ||
| 3216 | \def\AA{AA}% | 3422 | \def\AA{AA}% |
| 3217 | \def\AE{AE}% | 3423 | \def\AE{AE}% |
| 3218 | \def\L{L}% | 3424 | \def\L{L}% |
| @@ -3226,130 +3432,178 @@ width0pt\relax} \fi | |||
| 3226 | \def\ss{ss}% | 3432 | \def\ss{ss}% |
| 3227 | \def\exclamdown{!}% | 3433 | \def\exclamdown{!}% |
| 3228 | \def\questiondown{?}% | 3434 | \def\questiondown{?}% |
| 3435 | \def\ordf{a}% | ||
| 3436 | \def\ordm{o}% | ||
| 3229 | % | 3437 | % |
| 3230 | % Don't no-op \tt, since it isn't a user-level command | 3438 | \def\LaTeX{LaTeX}% |
| 3231 | % and is used in the definitions of the active chars like <, >, |, etc. | 3439 | \def\TeX{TeX}% |
| 3232 | % Likewise with the other plain tex font commands. | ||
| 3233 | %\let\tt=\asis | ||
| 3234 | % | 3440 | % |
| 3235 | % Texinfo font commands. | 3441 | % Assorted special characters. |
| 3236 | \let\b=\asis | 3442 | % (The following {} will end up in the sort string, but that's ok.) |
| 3237 | \let\i=\asis | 3443 | \def\bullet{bullet}% |
| 3238 | \let\r=\asis | 3444 | \def\comma{,}% |
| 3239 | \let\sc=\asis | 3445 | \def\copyright{copyright}% |
| 3240 | \let\t=\asis | 3446 | \def\registeredsymbol{R}% |
| 3241 | % | 3447 | \def\dots{...}% |
| 3242 | \let\TeX=\indexdummytex | 3448 | \def\enddots{...}% |
| 3243 | \let\acronym=\asis | 3449 | \def\equiv{==}% |
| 3244 | \let\cite=\asis | 3450 | \def\error{error}% |
| 3245 | \let\code=\asis | 3451 | \def\euro{euro}% |
| 3246 | \let\command=\asis | 3452 | \def\expansion{==>}% |
| 3247 | \let\dfn=\asis | 3453 | \def\minus{-}% |
| 3248 | \let\dots=\indexdummydots | 3454 | \def\pounds{pounds}% |
| 3249 | \let\emph=\asis | 3455 | \def\point{.}% |
| 3250 | \let\env=\asis | 3456 | \def\print{-|}% |
| 3251 | \let\file=\asis | 3457 | \def\result{=>}% |
| 3252 | \let\kbd=\asis | 3458 | % |
| 3253 | \let\key=\asis | 3459 | % We need to get rid of all macros, leaving only the arguments (if present). |
| 3254 | \let\math=\asis | 3460 | % Of course this is not nearly correct, but it is the best we can do for now. |
| 3255 | \let\option=\asis | 3461 | % makeinfo does not expand macros in the argument to @deffn, which ends up |
| 3256 | \let\samp=\asis | 3462 | % writing an index entry, and texindex isn't prepared for an index sort entry |
| 3257 | \let\strong=\asis | 3463 | % that starts with \. |
| 3258 | \let\uref=\asis | 3464 | % |
| 3259 | \let\url=\asis | 3465 | % Since macro invocations are followed by braces, we can just redefine them |
| 3260 | \let\var=\asis | 3466 | % to take a single TeX argument. The case of a macro invocation that |
| 3261 | \let\w=\asis | 3467 | % goes to end-of-line is not handled. |
| 3468 | % | ||
| 3469 | \macrolist | ||
| 3262 | } | 3470 | } |
| 3263 | 3471 | ||
| 3264 | \let\indexbackslash=0 %overridden during \printindex. | 3472 | \let\indexbackslash=0 %overridden during \printindex. |
| 3265 | \let\SETmarginindex=\relax % put index entries in margin (undocumented)? | 3473 | \let\SETmarginindex=\relax % put index entries in margin (undocumented)? |
| 3266 | 3474 | ||
| 3267 | % For \ifx comparisons. | ||
| 3268 | \def\emptymacro{\empty} | ||
| 3269 | |||
| 3270 | % Most index entries go through here, but \dosubind is the general case. | 3475 | % Most index entries go through here, but \dosubind is the general case. |
| 3271 | % | 3476 | % #1 is the index name, #2 is the entry text. |
| 3272 | \def\doind#1#2{\dosubind{#1}{#2}\empty} | 3477 | \def\doind#1#2{\dosubind{#1}{#2}{}} |
| 3273 | 3478 | ||
| 3274 | % Workhorse for all \fooindexes. | 3479 | % Workhorse for all \fooindexes. |
| 3275 | % #1 is name of index, #2 is stuff to put there, #3 is subentry -- | 3480 | % #1 is name of index, #2 is stuff to put there, #3 is subentry -- |
| 3276 | % \empty if called from \doind, as we usually are. The main exception | 3481 | % empty if called from \doind, as we usually are (the main exception |
| 3277 | % is with defuns, which call us directly. | 3482 | % is with most defuns, which call us directly). |
| 3278 | % | 3483 | % |
| 3279 | \def\dosubind#1#2#3{% | 3484 | \def\dosubind#1#2#3{% |
| 3485 | \iflinks | ||
| 3486 | {% | ||
| 3487 | % Store the main index entry text (including the third arg). | ||
| 3488 | \toks0 = {#2}% | ||
| 3489 | % If third arg is present, precede it with a space. | ||
| 3490 | \def\thirdarg{#3}% | ||
| 3491 | \ifx\thirdarg\empty \else | ||
| 3492 | \toks0 = \expandafter{\the\toks0 \space #3}% | ||
| 3493 | \fi | ||
| 3494 | % | ||
| 3495 | \edef\writeto{\csname#1indfile\endcsname}% | ||
| 3496 | % | ||
| 3497 | \ifvmode | ||
| 3498 | \dosubindsanitize | ||
| 3499 | \else | ||
| 3500 | \dosubindwrite | ||
| 3501 | \fi | ||
| 3502 | }% | ||
| 3503 | \fi | ||
| 3504 | } | ||
| 3505 | |||
| 3506 | % Write the entry in \toks0 to the index file: | ||
| 3507 | % | ||
| 3508 | \def\dosubindwrite{% | ||
| 3280 | % Put the index entry in the margin if desired. | 3509 | % Put the index entry in the margin if desired. |
| 3281 | \ifx\SETmarginindex\relax\else | 3510 | \ifx\SETmarginindex\relax\else |
| 3282 | \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% | 3511 | \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% |
| 3283 | \fi | 3512 | \fi |
| 3284 | {% | 3513 | % |
| 3285 | \count255=\lastpenalty | 3514 | % Remember, we are within a group. |
| 3286 | {% | 3515 | \indexdummies % Must do this here, since \bf, etc expand at this stage |
| 3287 | \indexdummies % Must do this here, since \bf, etc expand at this stage | 3516 | \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now |
| 3288 | \escapechar=`\\ | 3517 | % so it will be output as is; and it will print as backslash. |
| 3289 | {% | 3518 | % |
| 3290 | \let\folio = 0% We will expand all macros now EXCEPT \folio. | 3519 | % Process the index entry with all font commands turned off, to |
| 3291 | \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now | 3520 | % get the string to sort by. |
| 3292 | % so it will be output as is; and it will print as backslash. | 3521 | {\indexnofonts |
| 3293 | % | 3522 | \edef\temp{\the\toks0}% need full expansion |
| 3294 | % The main index entry text. | 3523 | \xdef\indexsorttmp{\temp}% |
| 3295 | \toks0 = {#2}% | ||
| 3296 | % | ||
| 3297 | % If third arg is present, precede it with space in sort key. | ||
| 3298 | \def\thirdarg{#3}% | ||
| 3299 | \ifx\thirdarg\emptymacro \else | ||
| 3300 | % If the third (subentry) arg is present, add it to the index | ||
| 3301 | % line to write. | ||
| 3302 | \toks0 = \expandafter{\the\toks0 \space #3}% | ||
| 3303 | \fi | ||
| 3304 | % | ||
| 3305 | % Process the index entry with all font commands turned off, to | ||
| 3306 | % get the string to sort by. | ||
| 3307 | {\indexnofonts | ||
| 3308 | \edef\temp{\the\toks0}% need full expansion | ||
| 3309 | \xdef\indexsorttmp{\temp}% | ||
| 3310 | }% | ||
| 3311 | % | ||
| 3312 | % Set up the complete index entry, with both the sort key and | ||
| 3313 | % the original text, including any font commands. We write | ||
| 3314 | % three arguments to \entry to the .?? file (four in the | ||
| 3315 | % subentry case), texindex reduces to two when writing the .??s | ||
| 3316 | % sorted result. | ||
| 3317 | \edef\temp{% | ||
| 3318 | \write\csname#1indfile\endcsname{% | ||
| 3319 | \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% | ||
| 3320 | }% | ||
| 3321 | % | ||
| 3322 | % If a skip is the last thing on the list now, preserve it | ||
| 3323 | % by backing up by \lastskip, doing the \write, then inserting | ||
| 3324 | % the skip again. Otherwise, the whatsit generated by the | ||
| 3325 | % \write will make \lastskip zero. The result is that sequences | ||
| 3326 | % like this: | ||
| 3327 | % @end defun | ||
| 3328 | % @tindex whatever | ||
| 3329 | % @defun ... | ||
| 3330 | % will have extra space inserted, because the \medbreak in the | ||
| 3331 | % start of the @defun won't see the skip inserted by the @end of | ||
| 3332 | % the previous defun. | ||
| 3333 | % | ||
| 3334 | % But don't do any of this if we're not in vertical mode. We | ||
| 3335 | % don't want to do a \vskip and prematurely end a paragraph. | ||
| 3336 | % | ||
| 3337 | % Avoid page breaks due to these extra skips, too. | ||
| 3338 | % | ||
| 3339 | \iflinks | ||
| 3340 | \ifvmode | ||
| 3341 | \skip0 = \lastskip | ||
| 3342 | \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi | ||
| 3343 | \fi | ||
| 3344 | % | ||
| 3345 | \temp % do the write | ||
| 3346 | % | ||
| 3347 | \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi | ||
| 3348 | \fi | ||
| 3349 | }% | ||
| 3350 | }% | ||
| 3351 | \penalty\count255 | ||
| 3352 | }% | 3524 | }% |
| 3525 | % | ||
| 3526 | % Set up the complete index entry, with both the sort key and | ||
| 3527 | % the original text, including any font commands. We write | ||
| 3528 | % three arguments to \entry to the .?? file (four in the | ||
| 3529 | % subentry case), texindex reduces to two when writing the .??s | ||
| 3530 | % sorted result. | ||
| 3531 | \edef\temp{% | ||
| 3532 | \write\writeto{% | ||
| 3533 | \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% | ||
| 3534 | }% | ||
| 3535 | \temp | ||
| 3536 | } | ||
| 3537 | |||
| 3538 | % Take care of unwanted page breaks: | ||
| 3539 | % | ||
| 3540 | % If a skip is the last thing on the list now, preserve it | ||
| 3541 | % by backing up by \lastskip, doing the \write, then inserting | ||
| 3542 | % the skip again. Otherwise, the whatsit generated by the | ||
| 3543 | % \write will make \lastskip zero. The result is that sequences | ||
| 3544 | % like this: | ||
| 3545 | % @end defun | ||
| 3546 | % @tindex whatever | ||
| 3547 | % @defun ... | ||
| 3548 | % will have extra space inserted, because the \medbreak in the | ||
| 3549 | % start of the @defun won't see the skip inserted by the @end of | ||
| 3550 | % the previous defun. | ||
| 3551 | % | ||
| 3552 | % But don't do any of this if we're not in vertical mode. We | ||
| 3553 | % don't want to do a \vskip and prematurely end a paragraph. | ||
| 3554 | % | ||
| 3555 | % Avoid page breaks due to these extra skips, too. | ||
| 3556 | % | ||
| 3557 | % But wait, there is a catch there: | ||
| 3558 | % We'll have to check whether \lastskip is zero skip. \ifdim is not | ||
| 3559 | % sufficient for this purpose, as it ignores stretch and shrink parts | ||
| 3560 | % of the skip. The only way seems to be to check the textual | ||
| 3561 | % representation of the skip. | ||
| 3562 | % | ||
| 3563 | % The following is almost like \def\zeroskipmacro{0.0pt} except that | ||
| 3564 | % the ``p'' and ``t'' characters have catcode \other, not 11 (letter). | ||
| 3565 | % | ||
| 3566 | \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} | ||
| 3567 | % | ||
| 3568 | % ..., ready, GO: | ||
| 3569 | % | ||
| 3570 | \def\dosubindsanitize{% | ||
| 3571 | % \lastskip and \lastpenalty cannot both be nonzero simultaneously. | ||
| 3572 | \skip0 = \lastskip | ||
| 3573 | \edef\lastskipmacro{\the\lastskip}% | ||
| 3574 | \count255 = \lastpenalty | ||
| 3575 | % | ||
| 3576 | % If \lastskip is nonzero, that means the last item was a | ||
| 3577 | % skip. And since a skip is discardable, that means this | ||
| 3578 | % -\skip0 glue we're inserting is preceded by a | ||
| 3579 | % non-discardable item, therefore it is not a potential | ||
| 3580 | % breakpoint, therefore no \nobreak needed. | ||
| 3581 | \ifx\lastskipmacro\zeroskipmacro | ||
| 3582 | \else | ||
| 3583 | \vskip-\skip0 | ||
| 3584 | \fi | ||
| 3585 | % | ||
| 3586 | \dosubindwrite | ||
| 3587 | % | ||
| 3588 | \ifx\lastskipmacro\zeroskipmacro | ||
| 3589 | % If \lastskip was zero, perhaps the last item was a penalty, and | ||
| 3590 | % perhaps it was >=10000, e.g., a \nobreak. In that case, we want | ||
| 3591 | % to re-insert the same penalty (values >10000 are used for various | ||
| 3592 | % signals); since we just inserted a non-discardable item, any | ||
| 3593 | % following glue (such as a \parskip) would be a breakpoint. For example: | ||
| 3594 | % | ||
| 3595 | % @deffn deffn-whatever | ||
| 3596 | % @vindex index-whatever | ||
| 3597 | % Description. | ||
| 3598 | % would allow a break between the index-whatever whatsit | ||
| 3599 | % and the "Description." paragraph. | ||
| 3600 | \ifnum\count255>9999 \penalty\count255 \fi | ||
| 3601 | \else | ||
| 3602 | % On the other hand, if we had a nonzero \lastskip, | ||
| 3603 | % this make-up glue would be preceded by a non-discardable item | ||
| 3604 | % (the whatsit from the \write), so we must insert a \nobreak. | ||
| 3605 | \nobreak\vskip\skip0 | ||
| 3606 | \fi | ||
| 3353 | } | 3607 | } |
| 3354 | 3608 | ||
| 3355 | % The index entry written in the file actually looks like | 3609 | % The index entry written in the file actually looks like |
| @@ -3387,14 +3641,12 @@ width0pt\relax} \fi | |||
| 3387 | % @printindex causes a particular index (the ??s file) to get printed. | 3641 | % @printindex causes a particular index (the ??s file) to get printed. |
| 3388 | % It does not print any chapter heading (usually an @unnumbered). | 3642 | % It does not print any chapter heading (usually an @unnumbered). |
| 3389 | % | 3643 | % |
| 3390 | \def\printindex{\parsearg\doprintindex} | 3644 | \parseargdef\printindex{\begingroup |
| 3391 | \def\doprintindex#1{\begingroup | ||
| 3392 | \dobreak \chapheadingskip{10000}% | 3645 | \dobreak \chapheadingskip{10000}% |
| 3393 | % | 3646 | % |
| 3394 | \smallfonts \rm | 3647 | \smallfonts \rm |
| 3395 | \tolerance = 9500 | 3648 | \tolerance = 9500 |
| 3396 | \everypar = {}% don't want the \kern\-parindent from indentation suppression. | 3649 | \everypar = {}% don't want the \kern\-parindent from indentation suppression. |
| 3397 | \indexbreaks | ||
| 3398 | % | 3650 | % |
| 3399 | % See if the index file exists and is nonempty. | 3651 | % See if the index file exists and is nonempty. |
| 3400 | % Change catcode of @ here so that if the index file contains | 3652 | % Change catcode of @ here so that if the index file contains |
| @@ -3421,7 +3673,7 @@ width0pt\relax} \fi | |||
| 3421 | % Index files are almost Texinfo source, but we use \ as the escape | 3673 | % Index files are almost Texinfo source, but we use \ as the escape |
| 3422 | % character. It would be better to use @, but that's too big a change | 3674 | % character. It would be better to use @, but that's too big a change |
| 3423 | % to make right now. | 3675 | % to make right now. |
| 3424 | \def\indexbackslash{\rawbackslashxx}% | 3676 | \def\indexbackslash{\backslashcurfont}% |
| 3425 | \catcode`\\ = 0 | 3677 | \catcode`\\ = 0 |
| 3426 | \escapechar = `\\ | 3678 | \escapechar = `\\ |
| 3427 | \begindoublecolumns | 3679 | \begindoublecolumns |
| @@ -3443,7 +3695,10 @@ width0pt\relax} \fi | |||
| 3443 | \removelastskip | 3695 | \removelastskip |
| 3444 | % | 3696 | % |
| 3445 | % We like breaks before the index initials, so insert a bonus. | 3697 | % We like breaks before the index initials, so insert a bonus. |
| 3446 | \penalty -300 | 3698 | \nobreak |
| 3699 | \vskip 0pt plus 3\baselineskip | ||
| 3700 | \penalty 0 | ||
| 3701 | \vskip 0pt plus -3\baselineskip | ||
| 3447 | % | 3702 | % |
| 3448 | % Typeset the initial. Making this add up to a whole number of | 3703 | % Typeset the initial. Making this add up to a whole number of |
| 3449 | % baselineskips increases the chance of the dots lining up from column | 3704 | % baselineskips increases the chance of the dots lining up from column |
| @@ -3453,80 +3708,100 @@ width0pt\relax} \fi | |||
| 3453 | % No shrink because it confuses \balancecolumns. | 3708 | % No shrink because it confuses \balancecolumns. |
| 3454 | \vskip 1.67\baselineskip plus .5\baselineskip | 3709 | \vskip 1.67\baselineskip plus .5\baselineskip |
| 3455 | \leftline{\secbf #1}% | 3710 | \leftline{\secbf #1}% |
| 3456 | \vskip .33\baselineskip plus .1\baselineskip | ||
| 3457 | % | ||
| 3458 | % Do our best not to break after the initial. | 3711 | % Do our best not to break after the initial. |
| 3459 | \nobreak | 3712 | \nobreak |
| 3713 | \vskip .33\baselineskip plus .1\baselineskip | ||
| 3460 | }} | 3714 | }} |
| 3461 | 3715 | ||
| 3462 | % This typesets a paragraph consisting of #1, dot leaders, and then #2 | 3716 | % \entry typesets a paragraph consisting of the text (#1), dot leaders, and |
| 3463 | % flush to the right margin. It is used for index and table of contents | 3717 | % then page number (#2) flushed to the right margin. It is used for index |
| 3464 | % entries. The paragraph is indented by \leftskip. | 3718 | % and table of contents entries. The paragraph is indented by \leftskip. |
| 3465 | % | 3719 | % |
| 3466 | \def\entry#1#2{\begingroup | 3720 | % A straightforward implementation would start like this: |
| 3467 | % | 3721 | % \def\entry#1#2{... |
| 3468 | % Start a new paragraph if necessary, so our assignments below can't | 3722 | % But this frozes the catcodes in the argument, and can cause problems to |
| 3469 | % affect previous text. | 3723 | % @code, which sets - active. This problem was fixed by a kludge--- |
| 3470 | \par | 3724 | % ``-'' was active throughout whole index, but this isn't really right. |
| 3471 | % | 3725 | % |
| 3472 | % Do not fill out the last line with white space. | 3726 | % The right solution is to prevent \entry from swallowing the whole text. |
| 3473 | \parfillskip = 0in | 3727 | % --kasal, 21nov03 |
| 3474 | % | 3728 | \def\entry{% |
| 3475 | % No extra space above this paragraph. | 3729 | \begingroup |
| 3476 | \parskip = 0in | 3730 | % |
| 3477 | % | 3731 | % Start a new paragraph if necessary, so our assignments below can't |
| 3478 | % Do not prefer a separate line ending with a hyphen to fewer lines. | 3732 | % affect previous text. |
| 3479 | \finalhyphendemerits = 0 | 3733 | \par |
| 3480 | % | 3734 | % |
| 3481 | % \hangindent is only relevant when the entry text and page number | 3735 | % Do not fill out the last line with white space. |
| 3482 | % don't both fit on one line. In that case, bob suggests starting the | 3736 | \parfillskip = 0in |
| 3483 | % dots pretty far over on the line. Unfortunately, a large | 3737 | % |
| 3484 | % indentation looks wrong when the entry text itself is broken across | 3738 | % No extra space above this paragraph. |
| 3485 | % lines. So we use a small indentation and put up with long leaders. | 3739 | \parskip = 0in |
| 3486 | % | 3740 | % |
| 3487 | % \hangafter is reset to 1 (which is the value we want) at the start | 3741 | % Do not prefer a separate line ending with a hyphen to fewer lines. |
| 3488 | % of each paragraph, so we need not do anything with that. | 3742 | \finalhyphendemerits = 0 |
| 3489 | \hangindent = 2em | 3743 | % |
| 3490 | % | 3744 | % \hangindent is only relevant when the entry text and page number |
| 3491 | % When the entry text needs to be broken, just fill out the first line | 3745 | % don't both fit on one line. In that case, bob suggests starting the |
| 3492 | % with blank space. | 3746 | % dots pretty far over on the line. Unfortunately, a large |
| 3493 | \rightskip = 0pt plus1fil | 3747 | % indentation looks wrong when the entry text itself is broken across |
| 3494 | % | 3748 | % lines. So we use a small indentation and put up with long leaders. |
| 3495 | % A bit of stretch before each entry for the benefit of balancing columns. | 3749 | % |
| 3496 | \vskip 0pt plus1pt | 3750 | % \hangafter is reset to 1 (which is the value we want) at the start |
| 3497 | % | 3751 | % of each paragraph, so we need not do anything with that. |
| 3498 | % Start a ``paragraph'' for the index entry so the line breaking | 3752 | \hangindent = 2em |
| 3499 | % parameters we've set above will have an effect. | 3753 | % |
| 3500 | \noindent | 3754 | % When the entry text needs to be broken, just fill out the first line |
| 3501 | % | 3755 | % with blank space. |
| 3502 | % Insert the text of the index entry. TeX will do line-breaking on it. | 3756 | \rightskip = 0pt plus1fil |
| 3503 | #1% | 3757 | % |
| 3504 | % The following is kludged to not output a line of dots in the index if | 3758 | % A bit of stretch before each entry for the benefit of balancing |
| 3505 | % there are no page numbers. The next person who breaks this will be | 3759 | % columns. |
| 3506 | % cursed by a Unix daemon. | 3760 | \vskip 0pt plus1pt |
| 3507 | \def\tempa{{\rm }}% | ||
| 3508 | \def\tempb{#2}% | ||
| 3509 | \edef\tempc{\tempa}% | ||
| 3510 | \edef\tempd{\tempb}% | ||
| 3511 | \ifx\tempc\tempd\ \else% | ||
| 3512 | % | 3761 | % |
| 3513 | % If we must, put the page number on a line of its own, and fill out | 3762 | % Swallow the left brace of the text (first parameter): |
| 3514 | % this line with blank space. (The \hfil is overwhelmed with the | 3763 | \afterassignment\doentry |
| 3515 | % fill leaders glue in \indexdotfill if the page number does fit.) | 3764 | \let\temp = |
| 3516 | \hfil\penalty50 | 3765 | } |
| 3517 | \null\nobreak\indexdotfill % Have leaders before the page number. | 3766 | \def\doentry{% |
| 3767 | \bgroup % Instead of the swallowed brace. | ||
| 3768 | \noindent | ||
| 3769 | \aftergroup\finishentry | ||
| 3770 | % And now comes the text of the entry. | ||
| 3771 | } | ||
| 3772 | \def\finishentry#1{% | ||
| 3773 | % #1 is the page number. | ||
| 3518 | % | 3774 | % |
| 3519 | % The `\ ' here is removed by the implicit \unskip that TeX does as | 3775 | % The following is kludged to not output a line of dots in the index if |
| 3520 | % part of (the primitive) \par. Without it, a spurious underfull | 3776 | % there are no page numbers. The next person who breaks this will be |
| 3521 | % \hbox ensues. | 3777 | % cursed by a Unix daemon. |
| 3522 | \ifpdf | 3778 | \def\tempa{{\rm }}% |
| 3523 | \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. | 3779 | \def\tempb{#1}% |
| 3780 | \edef\tempc{\tempa}% | ||
| 3781 | \edef\tempd{\tempb}% | ||
| 3782 | \ifx\tempc\tempd | ||
| 3783 | \ % | ||
| 3524 | \else | 3784 | \else |
| 3525 | \ #2% The page number ends the paragraph. | 3785 | % |
| 3786 | % If we must, put the page number on a line of its own, and fill out | ||
| 3787 | % this line with blank space. (The \hfil is overwhelmed with the | ||
| 3788 | % fill leaders glue in \indexdotfill if the page number does fit.) | ||
| 3789 | \hfil\penalty50 | ||
| 3790 | \null\nobreak\indexdotfill % Have leaders before the page number. | ||
| 3791 | % | ||
| 3792 | % The `\ ' here is removed by the implicit \unskip that TeX does as | ||
| 3793 | % part of (the primitive) \par. Without it, a spurious underfull | ||
| 3794 | % \hbox ensues. | ||
| 3795 | \ifpdf | ||
| 3796 | \pdfgettoks#1.% | ||
| 3797 | \ \the\toksA | ||
| 3798 | \else | ||
| 3799 | \ #1% | ||
| 3800 | \fi | ||
| 3526 | \fi | 3801 | \fi |
| 3527 | \fi% | 3802 | \par |
| 3528 | \par | 3803 | \endgroup |
| 3529 | \endgroup} | 3804 | } |
| 3530 | 3805 | ||
| 3531 | % Like \dotfill except takes at least 1 em. | 3806 | % Like \dotfill except takes at least 1 em. |
| 3532 | \def\indexdotfill{\cleaders | 3807 | \def\indexdotfill{\cleaders |
| @@ -3695,6 +3970,12 @@ width0pt\relax} \fi | |||
| 3695 | \message{sectioning,} | 3970 | \message{sectioning,} |
| 3696 | % Chapters, sections, etc. | 3971 | % Chapters, sections, etc. |
| 3697 | 3972 | ||
| 3973 | % \unnumberedno is an oxymoron, of course. But we count the unnumbered | ||
| 3974 | % sections so that we can refer to them unambiguously in the pdf | ||
| 3975 | % outlines by their "section number". We avoid collisions with chapter | ||
| 3976 | % numbers by starting them at 10000. (If a document ever has 10000 | ||
| 3977 | % chapters, we're in trouble anyway, I'm sure.) | ||
| 3978 | \newcount\unnumberedno \unnumberedno = 10000 | ||
| 3698 | \newcount\chapno | 3979 | \newcount\chapno |
| 3699 | \newcount\secno \secno=0 | 3980 | \newcount\secno \secno=0 |
| 3700 | \newcount\subsecno \subsecno=0 | 3981 | \newcount\subsecno \subsecno=0 |
| @@ -3702,9 +3983,12 @@ width0pt\relax} \fi | |||
| 3702 | 3983 | ||
| 3703 | % This counter is funny since it counts through charcodes of letters A, B, ... | 3984 | % This counter is funny since it counts through charcodes of letters A, B, ... |
| 3704 | \newcount\appendixno \appendixno = `\@ | 3985 | \newcount\appendixno \appendixno = `\@ |
| 3986 | % | ||
| 3705 | % \def\appendixletter{\char\the\appendixno} | 3987 | % \def\appendixletter{\char\the\appendixno} |
| 3706 | % We do the following for the sake of pdftex, which needs the actual | 3988 | % We do the following ugly conditional instead of the above simple |
| 3989 | % construct for the sake of pdftex, which needs the actual | ||
| 3707 | % letter in the expansion, not just typeset. | 3990 | % letter in the expansion, not just typeset. |
| 3991 | % | ||
| 3708 | \def\appendixletter{% | 3992 | \def\appendixletter{% |
| 3709 | \ifnum\appendixno=`A A% | 3993 | \ifnum\appendixno=`A A% |
| 3710 | \else\ifnum\appendixno=`B B% | 3994 | \else\ifnum\appendixno=`B B% |
| @@ -3742,11 +4026,12 @@ width0pt\relax} \fi | |||
| 3742 | 4026 | ||
| 3743 | % Each @chapter defines this as the name of the chapter. | 4027 | % Each @chapter defines this as the name of the chapter. |
| 3744 | % page headings and footings can use it. @section does likewise. | 4028 | % page headings and footings can use it. @section does likewise. |
| 4029 | % However, they are not reliable, because we don't use marks. | ||
| 3745 | \def\thischapter{} | 4030 | \def\thischapter{} |
| 3746 | \def\thissection{} | 4031 | \def\thissection{} |
| 3747 | 4032 | ||
| 3748 | \newcount\absseclevel % used to calculate proper heading level | 4033 | \newcount\absseclevel % used to calculate proper heading level |
| 3749 | \newcount\secbase\secbase=0 % @raise/lowersections modify this count | 4034 | \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count |
| 3750 | 4035 | ||
| 3751 | % @raisesections: treat @section as chapter, @subsection as section, etc. | 4036 | % @raisesections: treat @section as chapter, @subsection as section, etc. |
| 3752 | \def\raisesections{\global\advance\secbase by -1} | 4037 | \def\raisesections{\global\advance\secbase by -1} |
| @@ -3756,121 +4041,142 @@ width0pt\relax} \fi | |||
| 3756 | \def\lowersections{\global\advance\secbase by 1} | 4041 | \def\lowersections{\global\advance\secbase by 1} |
| 3757 | \let\down=\lowersections % original BFox name | 4042 | \let\down=\lowersections % original BFox name |
| 3758 | 4043 | ||
| 3759 | % Choose a numbered-heading macro | 4044 | % we only have subsub. |
| 3760 | % #1 is heading level if unmodified by @raisesections or @lowersections | 4045 | \chardef\maxseclevel = 3 |
| 3761 | % #2 is text for heading | 4046 | % |
| 3762 | \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 | 4047 | % A numbered section within an unnumbered changes to unnumbered too. |
| 3763 | \ifcase\absseclevel | 4048 | % To achive this, remember the "biggest" unnum. sec. we are currently in: |
| 3764 | \chapterzzz{#2} | 4049 | \chardef\unmlevel = \maxseclevel |
| 3765 | \or | 4050 | % |
| 3766 | \seczzz{#2} | 4051 | % Trace whether the current chapter is an appendix or not: |
| 3767 | \or | 4052 | % \chapheadtype is "N" or "A", unnumbered chapters are ignored. |
| 3768 | \numberedsubseczzz{#2} | 4053 | \def\chapheadtype{N} |
| 3769 | \or | 4054 | |
| 3770 | \numberedsubsubseczzz{#2} | 4055 | % Choose a heading macro |
| 3771 | \else | 4056 | % #1 is heading type |
| 3772 | \ifnum \absseclevel<0 | 4057 | % #2 is heading level |
| 3773 | \chapterzzz{#2} | 4058 | % #3 is text for heading |
| 4059 | \def\genhead#1#2#3{% | ||
| 4060 | % Compute the abs. sec. level: | ||
| 4061 | \absseclevel=#2 | ||
| 4062 | \advance\absseclevel by \secbase | ||
| 4063 | % Make sure \absseclevel doesn't fall outside the range: | ||
| 4064 | \ifnum \absseclevel < 0 | ||
| 4065 | \absseclevel = 0 | ||
| 3774 | \else | 4066 | \else |
| 3775 | \numberedsubsubseczzz{#2} | 4067 | \ifnum \absseclevel > 3 |
| 4068 | \absseclevel = 3 | ||
| 4069 | \fi | ||
| 3776 | \fi | 4070 | \fi |
| 3777 | \fi | 4071 | % The heading type: |
| 3778 | \suppressfirstparagraphindent | 4072 | \def\headtype{#1}% |
| 3779 | } | 4073 | \if \headtype U% |
| 3780 | 4074 | \ifnum \absseclevel < \unmlevel | |
| 3781 | % like \numhead, but chooses appendix heading levels | 4075 | \chardef\unmlevel = \absseclevel |
| 3782 | \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 | 4076 | \fi |
| 3783 | \ifcase\absseclevel | ||
| 3784 | \appendixzzz{#2} | ||
| 3785 | \or | ||
| 3786 | \appendixsectionzzz{#2} | ||
| 3787 | \or | ||
| 3788 | \appendixsubseczzz{#2} | ||
| 3789 | \or | ||
| 3790 | \appendixsubsubseczzz{#2} | ||
| 3791 | \else | ||
| 3792 | \ifnum \absseclevel<0 | ||
| 3793 | \appendixzzz{#2} | ||
| 3794 | \else | 4077 | \else |
| 3795 | \appendixsubsubseczzz{#2} | 4078 | % Check for appendix sections: |
| 4079 | \ifnum \absseclevel = 0 | ||
| 4080 | \edef\chapheadtype{\headtype}% | ||
| 4081 | \else | ||
| 4082 | \if \headtype A\if \chapheadtype N% | ||
| 4083 | \errmessage{@appendix... within a non-appendix chapter}% | ||
| 4084 | \fi\fi | ||
| 4085 | \fi | ||
| 4086 | % Check for numbered within unnumbered: | ||
| 4087 | \ifnum \absseclevel > \unmlevel | ||
| 4088 | \def\headtype{U}% | ||
| 4089 | \else | ||
| 4090 | \chardef\unmlevel = 3 | ||
| 4091 | \fi | ||
| 3796 | \fi | 4092 | \fi |
| 3797 | \fi | 4093 | % Now print the heading: |
| 3798 | \suppressfirstparagraphindent | 4094 | \if \headtype U% |
| 3799 | } | 4095 | \ifcase\absseclevel |
| 3800 | 4096 | \unnumberedzzz{#3}% | |
| 3801 | % like \numhead, but chooses numberless heading levels | 4097 | \or \unnumberedseczzz{#3}% |
| 3802 | \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 | 4098 | \or \unnumberedsubseczzz{#3}% |
| 3803 | \ifcase\absseclevel | 4099 | \or \unnumberedsubsubseczzz{#3}% |
| 3804 | \unnumberedzzz{#2} | 4100 | \fi |
| 3805 | \or | ||
| 3806 | \unnumberedseczzz{#2} | ||
| 3807 | \or | ||
| 3808 | \unnumberedsubseczzz{#2} | ||
| 3809 | \or | ||
| 3810 | \unnumberedsubsubseczzz{#2} | ||
| 3811 | \else | ||
| 3812 | \ifnum \absseclevel<0 | ||
| 3813 | \unnumberedzzz{#2} | ||
| 3814 | \else | 4101 | \else |
| 3815 | \unnumberedsubsubseczzz{#2} | 4102 | \if \headtype A% |
| 4103 | \ifcase\absseclevel | ||
| 4104 | \appendixzzz{#3}% | ||
| 4105 | \or \appendixsectionzzz{#3}% | ||
| 4106 | \or \appendixsubseczzz{#3}% | ||
| 4107 | \or \appendixsubsubseczzz{#3}% | ||
| 4108 | \fi | ||
| 4109 | \else | ||
| 4110 | \ifcase\absseclevel | ||
| 4111 | \chapterzzz{#3}% | ||
| 4112 | \or \seczzz{#3}% | ||
| 4113 | \or \numberedsubseczzz{#3}% | ||
| 4114 | \or \numberedsubsubseczzz{#3}% | ||
| 4115 | \fi | ||
| 4116 | \fi | ||
| 3816 | \fi | 4117 | \fi |
| 3817 | \fi | 4118 | \suppressfirstparagraphindent |
| 3818 | \suppressfirstparagraphindent | 4119 | } |
| 3819 | } | 4120 | |
| 3820 | 4121 | % an interface: | |
| 3821 | % @chapter, @appendix, @unnumbered. | 4122 | \def\numhead{\genhead N} |
| 3822 | \def\thischaptername{No Chapter Title} | 4123 | \def\apphead{\genhead A} |
| 3823 | \outer\def\chapter{\parsearg\chapteryyy} | 4124 | \def\unnmhead{\genhead U} |
| 3824 | \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz | 4125 | |
| 3825 | \def\chapterzzz #1{% | 4126 | % @chapter, @appendix, @unnumbered. Increment top-level counter, reset |
| 3826 | \secno=0 \subsecno=0 \subsubsecno=0 | 4127 | % all lower-level sectioning counters to zero. |
| 3827 | \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% | 4128 | % |
| 3828 | \chapmacro {#1}{\the\chapno}% | 4129 | % Also set \chaplevelprefix, which we prepend to @float sequence numbers |
| 3829 | \gdef\thissection{#1}% | 4130 | % (e.g., figures), q.v. By default (before any chapter), that is empty. |
| 3830 | \gdef\thischaptername{#1}% | 4131 | \let\chaplevelprefix = \empty |
| 3831 | % We don't substitute the actual chapter name into \thischapter | 4132 | % |
| 3832 | % because we don't want its macros evaluated now. | 4133 | \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz |
| 3833 | \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% | 4134 | \def\chapterzzz#1{% |
| 3834 | \writetocentry{chap}{#1}{{\the\chapno}} | 4135 | % section resetting is \global in case the chapter is in a group, such |
| 3835 | \donoderef | 4136 | % as an @include file. |
| 4137 | \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 | ||
| 4138 | \global\advance\chapno by 1 | ||
| 4139 | % | ||
| 4140 | % Used for \float. | ||
| 4141 | \gdef\chaplevelprefix{\the\chapno.}% | ||
| 4142 | \resetallfloatnos | ||
| 4143 | % | ||
| 4144 | \message{\putwordChapter\space \the\chapno}% | ||
| 4145 | % | ||
| 4146 | % Write the actual heading. | ||
| 4147 | \chapmacro{#1}{Ynumbered}{\the\chapno}% | ||
| 4148 | % | ||
| 4149 | % So @section and the like are numbered underneath this chapter. | ||
| 3836 | \global\let\section = \numberedsec | 4150 | \global\let\section = \numberedsec |
| 3837 | \global\let\subsection = \numberedsubsec | 4151 | \global\let\subsection = \numberedsubsec |
| 3838 | \global\let\subsubsection = \numberedsubsubsec | 4152 | \global\let\subsubsection = \numberedsubsubsec |
| 3839 | } | 4153 | } |
| 3840 | 4154 | ||
| 3841 | % we use \chapno to avoid indenting back | 4155 | \outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz |
| 3842 | \def\appendixbox#1{% | 4156 | \def\appendixzzz#1{% |
| 3843 | \setbox0 = \hbox{\putwordAppendix{} \the\chapno}% | 4157 | \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 |
| 3844 | \hbox to \wd0{#1\hss}} | 4158 | \global\advance\appendixno by 1 |
| 3845 | 4159 | \gdef\chaplevelprefix{\appendixletter.}% | |
| 3846 | \outer\def\appendix{\parsearg\appendixyyy} | 4160 | \resetallfloatnos |
| 3847 | \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz | 4161 | % |
| 3848 | \def\appendixzzz #1{% | 4162 | \def\appendixnum{\putwordAppendix\space \appendixletter}% |
| 3849 | \secno=0 \subsecno=0 \subsubsecno=0 | 4163 | \message{\appendixnum}% |
| 3850 | \global\advance \appendixno by 1 | 4164 | % |
| 3851 | \message{\putwordAppendix\space \appendixletter}% | 4165 | \chapmacro{#1}{Yappendix}{\appendixletter}% |
| 3852 | \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}% | 4166 | % |
| 3853 | \gdef\thissection{#1}% | ||
| 3854 | \gdef\thischaptername{#1}% | ||
| 3855 | \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% | ||
| 3856 | \writetocentry{appendix}{#1}{{\appendixletter}} | ||
| 3857 | \appendixnoderef | ||
| 3858 | \global\let\section = \appendixsec | 4167 | \global\let\section = \appendixsec |
| 3859 | \global\let\subsection = \appendixsubsec | 4168 | \global\let\subsection = \appendixsubsec |
| 3860 | \global\let\subsubsection = \appendixsubsubsec | 4169 | \global\let\subsubsection = \appendixsubsubsec |
| 3861 | } | 4170 | } |
| 3862 | 4171 | ||
| 3863 | % @centerchap is like @unnumbered, but the heading is centered. | 4172 | \outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz |
| 3864 | \outer\def\centerchap{\parsearg\centerchapyyy} | 4173 | \def\unnumberedzzz#1{% |
| 3865 | \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} | 4174 | \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 |
| 3866 | 4175 | \global\advance\unnumberedno by 1 | |
| 3867 | % @top is like @unnumbered. | 4176 | % |
| 3868 | \outer\def\top{\parsearg\unnumberedyyy} | 4177 | % Since an unnumbered has no number, no prefix for figures. |
| 3869 | 4178 | \global\let\chaplevelprefix = \empty | |
| 3870 | \outer\def\unnumbered{\parsearg\unnumberedyyy} | 4179 | \resetallfloatnos |
| 3871 | \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz | ||
| 3872 | \def\unnumberedzzz #1{% | ||
| 3873 | \secno=0 \subsecno=0 \subsubsecno=0 | ||
| 3874 | % | 4180 | % |
| 3875 | % This used to be simply \message{#1}, but TeX fully expands the | 4181 | % This used to be simply \message{#1}, but TeX fully expands the |
| 3876 | % argument to \message. Therefore, if #1 contained @-commands, TeX | 4182 | % argument to \message. Therefore, if #1 contained @-commands, TeX |
| @@ -3883,134 +4189,98 @@ width0pt\relax} \fi | |||
| 3883 | % \the<toks register> to achieve this: TeX expands \the<toks> only once, | 4189 | % \the<toks register> to achieve this: TeX expands \the<toks> only once, |
| 3884 | % simply yielding the contents of <toks register>. (We also do this for | 4190 | % simply yielding the contents of <toks register>. (We also do this for |
| 3885 | % the toc entries.) | 4191 | % the toc entries.) |
| 3886 | \toks0 = {#1}\message{(\the\toks0)}% | 4192 | \toks0 = {#1}% |
| 4193 | \message{(\the\toks0)}% | ||
| 4194 | % | ||
| 4195 | \chapmacro{#1}{Ynothing}{\the\unnumberedno}% | ||
| 3887 | % | 4196 | % |
| 3888 | \unnumbchapmacro {#1}% | ||
| 3889 | \gdef\thischapter{#1}\gdef\thissection{#1}% | ||
| 3890 | \writetocentry{unnumbchap}{#1}{{\the\chapno}} | ||
| 3891 | \unnumbnoderef | ||
| 3892 | \global\let\section = \unnumberedsec | 4197 | \global\let\section = \unnumberedsec |
| 3893 | \global\let\subsection = \unnumberedsubsec | 4198 | \global\let\subsection = \unnumberedsubsec |
| 3894 | \global\let\subsubsection = \unnumberedsubsubsec | 4199 | \global\let\subsubsection = \unnumberedsubsubsec |
| 3895 | } | 4200 | } |
| 3896 | 4201 | ||
| 4202 | % @centerchap is like @unnumbered, but the heading is centered. | ||
| 4203 | \outer\parseargdef\centerchap{% | ||
| 4204 | % Well, we could do the following in a group, but that would break | ||
| 4205 | % an assumption that \chapmacro is called at the outermost level. | ||
| 4206 | % Thus we are safer this way: --kasal, 24feb04 | ||
| 4207 | \let\centerparametersmaybe = \centerparameters | ||
| 4208 | \unnmhead0{#1}% | ||
| 4209 | \let\centerparametersmaybe = \relax | ||
| 4210 | } | ||
| 4211 | |||
| 4212 | % @top is like @unnumbered. | ||
| 4213 | \let\top\unnumbered | ||
| 4214 | |||
| 3897 | % Sections. | 4215 | % Sections. |
| 3898 | \outer\def\numberedsec{\parsearg\secyyy} | 4216 | \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz |
| 3899 | \def\secyyy #1{\numhead1{#1}} % normally calls seczzz | 4217 | \def\seczzz#1{% |
| 3900 | \def\seczzz #1{% | 4218 | \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 |
| 3901 | \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % | 4219 | \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% |
| 3902 | \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% | ||
| 3903 | \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}} | ||
| 3904 | \donoderef | ||
| 3905 | \nobreak | ||
| 3906 | } | 4220 | } |
| 3907 | 4221 | ||
| 3908 | \outer\def\appendixsection{\parsearg\appendixsecyyy} | 4222 | \outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz |
| 3909 | \outer\def\appendixsec{\parsearg\appendixsecyyy} | 4223 | \def\appendixsectionzzz#1{% |
| 3910 | \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz | 4224 | \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 |
| 3911 | \def\appendixsectionzzz #1{% | 4225 | \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% |
| 3912 | \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % | ||
| 3913 | \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% | ||
| 3914 | \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}} | ||
| 3915 | \appendixnoderef | ||
| 3916 | \nobreak | ||
| 3917 | } | 4226 | } |
| 4227 | \let\appendixsec\appendixsection | ||
| 3918 | 4228 | ||
| 3919 | \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} | 4229 | \outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz |
| 3920 | \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz | 4230 | \def\unnumberedseczzz#1{% |
| 3921 | \def\unnumberedseczzz #1{% | 4231 | \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 |
| 3922 | \plainsecheading {#1}\gdef\thissection{#1}% | 4232 | \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% |
| 3923 | \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}} | ||
| 3924 | \unnumbnoderef | ||
| 3925 | \nobreak | ||
| 3926 | } | 4233 | } |
| 3927 | 4234 | ||
| 3928 | % Subsections. | 4235 | % Subsections. |
| 3929 | \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} | 4236 | \outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz |
| 3930 | \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz | 4237 | \def\numberedsubseczzz#1{% |
| 3931 | \def\numberedsubseczzz #1{% | 4238 | \global\subsubsecno=0 \global\advance\subsecno by 1 |
| 3932 | \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % | 4239 | \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% |
| 3933 | \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% | ||
| 3934 | \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}} | ||
| 3935 | \donoderef | ||
| 3936 | \nobreak | ||
| 3937 | } | 4240 | } |
| 3938 | 4241 | ||
| 3939 | \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} | 4242 | \outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz |
| 3940 | \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz | 4243 | \def\appendixsubseczzz#1{% |
| 3941 | \def\appendixsubseczzz #1{% | 4244 | \global\subsubsecno=0 \global\advance\subsecno by 1 |
| 3942 | \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % | 4245 | \sectionheading{#1}{subsec}{Yappendix}% |
| 3943 | \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% | 4246 | {\appendixletter.\the\secno.\the\subsecno}% |
| 3944 | \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}} | ||
| 3945 | \appendixnoderef | ||
| 3946 | \nobreak | ||
| 3947 | } | 4247 | } |
| 3948 | 4248 | ||
| 3949 | \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} | 4249 | \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz |
| 3950 | \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz | 4250 | \def\unnumberedsubseczzz#1{% |
| 3951 | \def\unnumberedsubseczzz #1{% | 4251 | \global\subsubsecno=0 \global\advance\subsecno by 1 |
| 3952 | \plainsubsecheading {#1}\gdef\thissection{#1}% | 4252 | \sectionheading{#1}{subsec}{Ynothing}% |
| 3953 | \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}} | 4253 | {\the\unnumberedno.\the\secno.\the\subsecno}% |
| 3954 | \unnumbnoderef | ||
| 3955 | \nobreak | ||
| 3956 | } | 4254 | } |
| 3957 | 4255 | ||
| 3958 | % Subsubsections. | 4256 | % Subsubsections. |
| 3959 | \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} | 4257 | \outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz |
| 3960 | \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz | 4258 | \def\numberedsubsubseczzz#1{% |
| 3961 | \def\numberedsubsubseczzz #1{% | 4259 | \global\advance\subsubsecno by 1 |
| 3962 | \gdef\thissection{#1}\global\advance \subsubsecno by 1 % | 4260 | \sectionheading{#1}{subsubsec}{Ynumbered}% |
| 3963 | \subsubsecheading {#1} | 4261 | {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% |
| 3964 | {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% | ||
| 3965 | \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}} | ||
| 3966 | \donoderef | ||
| 3967 | \nobreak | ||
| 3968 | } | 4262 | } |
| 3969 | 4263 | ||
| 3970 | \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} | 4264 | \outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz |
| 3971 | \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz | 4265 | \def\appendixsubsubseczzz#1{% |
| 3972 | \def\appendixsubsubseczzz #1{% | 4266 | \global\advance\subsubsecno by 1 |
| 3973 | \gdef\thissection{#1}\global\advance \subsubsecno by 1 % | 4267 | \sectionheading{#1}{subsubsec}{Yappendix}% |
| 3974 | \subsubsecheading {#1} | 4268 | {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% |
| 3975 | {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% | ||
| 3976 | \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}} | ||
| 3977 | \appendixnoderef | ||
| 3978 | \nobreak | ||
| 3979 | } | 4269 | } |
| 3980 | 4270 | ||
| 3981 | \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} | 4271 | \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz |
| 3982 | \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz | 4272 | \def\unnumberedsubsubseczzz#1{% |
| 3983 | \def\unnumberedsubsubseczzz #1{% | 4273 | \global\advance\subsubsecno by 1 |
| 3984 | \plainsubsubsecheading {#1}\gdef\thissection{#1}% | 4274 | \sectionheading{#1}{subsubsec}{Ynothing}% |
| 3985 | \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}} | 4275 | {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% |
| 3986 | \unnumbnoderef | ||
| 3987 | \nobreak | ||
| 3988 | } | 4276 | } |
| 3989 | 4277 | ||
| 3990 | % These are variants which are not "outer", so they can appear in @ifinfo. | ||
| 3991 | % Actually, they should now be obsolete; ordinary section commands should work. | ||
| 3992 | \def\infotop{\parsearg\unnumberedzzz} | ||
| 3993 | \def\infounnumbered{\parsearg\unnumberedzzz} | ||
| 3994 | \def\infounnumberedsec{\parsearg\unnumberedseczzz} | ||
| 3995 | \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} | ||
| 3996 | \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} | ||
| 3997 | |||
| 3998 | \def\infoappendix{\parsearg\appendixzzz} | ||
| 3999 | \def\infoappendixsec{\parsearg\appendixseczzz} | ||
| 4000 | \def\infoappendixsubsec{\parsearg\appendixsubseczzz} | ||
| 4001 | \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} | ||
| 4002 | |||
| 4003 | \def\infochapter{\parsearg\chapterzzz} | ||
| 4004 | \def\infosection{\parsearg\sectionzzz} | ||
| 4005 | \def\infosubsection{\parsearg\subsectionzzz} | ||
| 4006 | \def\infosubsubsection{\parsearg\subsubsectionzzz} | ||
| 4007 | |||
| 4008 | % These macros control what the section commands do, according | 4278 | % These macros control what the section commands do, according |
| 4009 | % to what kind of chapter we are in (ordinary, appendix, or unnumbered). | 4279 | % to what kind of chapter we are in (ordinary, appendix, or unnumbered). |
| 4010 | % Define them by default for a numbered chapter. | 4280 | % Define them by default for a numbered chapter. |
| 4011 | \global\let\section = \numberedsec | 4281 | \let\section = \numberedsec |
| 4012 | \global\let\subsection = \numberedsubsec | 4282 | \let\subsection = \numberedsubsec |
| 4013 | \global\let\subsubsection = \numberedsubsubsec | 4283 | \let\subsubsection = \numberedsubsubsec |
| 4014 | 4284 | ||
| 4015 | % Define @majorheading, @heading and @subheading | 4285 | % Define @majorheading, @heading and @subheading |
| 4016 | 4286 | ||
| @@ -4023,23 +4293,27 @@ width0pt\relax} \fi | |||
| 4023 | % if justification is not attempted. Hence \raggedright. | 4293 | % if justification is not attempted. Hence \raggedright. |
| 4024 | 4294 | ||
| 4025 | 4295 | ||
| 4026 | \def\majorheading{\parsearg\majorheadingzzz} | 4296 | \def\majorheading{% |
| 4027 | \def\majorheadingzzz #1{% | ||
| 4028 | {\advance\chapheadingskip by 10pt \chapbreak }% | 4297 | {\advance\chapheadingskip by 10pt \chapbreak }% |
| 4029 | {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 | 4298 | \parsearg\chapheadingzzz |
| 4030 | \parindent=0pt\raggedright | 4299 | } |
| 4031 | \rm #1\hfill}}\bigskip \par\penalty 200} | ||
| 4032 | 4300 | ||
| 4033 | \def\chapheading{\parsearg\chapheadingzzz} | 4301 | \def\chapheading{\chapbreak \parsearg\chapheadingzzz} |
| 4034 | \def\chapheadingzzz #1{\chapbreak % | 4302 | \def\chapheadingzzz#1{% |
| 4035 | {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 | 4303 | {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 |
| 4036 | \parindent=0pt\raggedright | 4304 | \parindent=0pt\raggedright |
| 4037 | \rm #1\hfill}}\bigskip \par\penalty 200} | 4305 | \rm #1\hfill}}% |
| 4306 | \bigskip \par\penalty 200\relax | ||
| 4307 | \suppressfirstparagraphindent | ||
| 4308 | } | ||
| 4038 | 4309 | ||
| 4039 | % @heading, @subheading, @subsubheading. | 4310 | % @heading, @subheading, @subsubheading. |
| 4040 | \def\heading{\parsearg\plainsecheading} | 4311 | \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} |
| 4041 | \def\subheading{\parsearg\plainsubsecheading} | 4312 | \suppressfirstparagraphindent} |
| 4042 | \def\subsubheading{\parsearg\plainsubsubsecheading} | 4313 | \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} |
| 4314 | \suppressfirstparagraphindent} | ||
| 4315 | \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} | ||
| 4316 | \suppressfirstparagraphindent} | ||
| 4043 | 4317 | ||
| 4044 | % These macros generate a chapter, section, etc. heading only | 4318 | % These macros generate a chapter, section, etc. heading only |
| 4045 | % (including whitespace, linebreaking, etc. around it), | 4319 | % (including whitespace, linebreaking, etc. around it), |
| @@ -4048,8 +4322,6 @@ width0pt\relax} \fi | |||
| 4048 | %%% Args are the skip and penalty (usually negative) | 4322 | %%% Args are the skip and penalty (usually negative) |
| 4049 | \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} | 4323 | \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} |
| 4050 | 4324 | ||
| 4051 | \def\setchapterstyle #1 {\csname CHAPF#1\endcsname} | ||
| 4052 | |||
| 4053 | %%% Define plain chapter starts, and page on/off switching for it | 4325 | %%% Define plain chapter starts, and page on/off switching for it |
| 4054 | % Parameter controlling skip before chapter headings (if needed) | 4326 | % Parameter controlling skip before chapter headings (if needed) |
| 4055 | 4327 | ||
| @@ -4072,7 +4344,7 @@ width0pt\relax} \fi | |||
| 4072 | \global\let\pagealignmacro=\chappager | 4344 | \global\let\pagealignmacro=\chappager |
| 4073 | \global\def\HEADINGSon{\HEADINGSsingle}} | 4345 | \global\def\HEADINGSon{\HEADINGSsingle}} |
| 4074 | 4346 | ||
| 4075 | \def\CHAPPAGodd{ | 4347 | \def\CHAPPAGodd{% |
| 4076 | \global\let\contentsalignmacro = \chapoddpage | 4348 | \global\let\contentsalignmacro = \chapoddpage |
| 4077 | \global\let\pchapsepmacro=\chapoddpage | 4349 | \global\let\pchapsepmacro=\chapoddpage |
| 4078 | \global\let\pagealignmacro=\chapoddpage | 4350 | \global\let\pagealignmacro=\chapoddpage |
| @@ -4080,116 +4352,201 @@ width0pt\relax} \fi | |||
| 4080 | 4352 | ||
| 4081 | \CHAPPAGon | 4353 | \CHAPPAGon |
| 4082 | 4354 | ||
| 4083 | \def\CHAPFplain{ | 4355 | % Chapter opening. |
| 4084 | \global\let\chapmacro=\chfplain | 4356 | % |
| 4085 | \global\let\unnumbchapmacro=\unnchfplain | 4357 | % #1 is the text, #2 is the section type (Ynumbered, Ynothing, |
| 4086 | \global\let\centerchapmacro=\centerchfplain} | 4358 | % Yappendix, Yomitfromtoc), #3 the chapter number. |
| 4087 | 4359 | % | |
| 4088 | % Plain chapter opening. | 4360 | % To test against our argument. |
| 4089 | % #1 is the text, #2 the chapter number or empty if unnumbered. | 4361 | \def\Ynothingkeyword{Ynothing} |
| 4090 | \def\chfplain#1#2{% | 4362 | \def\Yomitfromtockeyword{Yomitfromtoc} |
| 4363 | \def\Yappendixkeyword{Yappendix} | ||
| 4364 | % | ||
| 4365 | \def\chapmacro#1#2#3{% | ||
| 4091 | \pchapsepmacro | 4366 | \pchapsepmacro |
| 4092 | {% | 4367 | {% |
| 4093 | \chapfonts \rm | 4368 | \chapfonts \rm |
| 4094 | \def\chapnum{#2}% | 4369 | % |
| 4095 | \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% | 4370 | % Have to define \thissection before calling \donoderef, because the |
| 4371 | % xref code eventually uses it. On the other hand, it has to be called | ||
| 4372 | % after \pchapsepmacro, or the headline will change too soon. | ||
| 4373 | \gdef\thissection{#1}% | ||
| 4374 | \gdef\thischaptername{#1}% | ||
| 4375 | % | ||
| 4376 | % Only insert the separating space if we have a chapter/appendix | ||
| 4377 | % number, and don't print the unnumbered ``number''. | ||
| 4378 | \def\temptype{#2}% | ||
| 4379 | \ifx\temptype\Ynothingkeyword | ||
| 4380 | \setbox0 = \hbox{}% | ||
| 4381 | \def\toctype{unnchap}% | ||
| 4382 | \gdef\thischapter{#1}% | ||
| 4383 | \else\ifx\temptype\Yomitfromtockeyword | ||
| 4384 | \setbox0 = \hbox{}% contents like unnumbered, but no toc entry | ||
| 4385 | \def\toctype{omit}% | ||
| 4386 | \gdef\thischapter{}% | ||
| 4387 | \else\ifx\temptype\Yappendixkeyword | ||
| 4388 | \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% | ||
| 4389 | \def\toctype{app}% | ||
| 4390 | % We don't substitute the actual chapter name into \thischapter | ||
| 4391 | % because we don't want its macros evaluated now. And we don't | ||
| 4392 | % use \thissection because that changes with each section. | ||
| 4393 | % | ||
| 4394 | \xdef\thischapter{\putwordAppendix{} \appendixletter: | ||
| 4395 | \noexpand\thischaptername}% | ||
| 4396 | \else | ||
| 4397 | \setbox0 = \hbox{#3\enspace}% | ||
| 4398 | \def\toctype{numchap}% | ||
| 4399 | \xdef\thischapter{\putwordChapter{} \the\chapno: | ||
| 4400 | \noexpand\thischaptername}% | ||
| 4401 | \fi\fi\fi | ||
| 4402 | % | ||
| 4403 | % Write the toc entry for this chapter. Must come before the | ||
| 4404 | % \donoderef, because we include the current node name in the toc | ||
| 4405 | % entry, and \donoderef resets it to empty. | ||
| 4406 | \writetocentry{\toctype}{#1}{#3}% | ||
| 4407 | % | ||
| 4408 | % For pdftex, we have to write out the node definition (aka, make | ||
| 4409 | % the pdfdest) after any page break, but before the actual text has | ||
| 4410 | % been typeset. If the destination for the pdf outline is after the | ||
| 4411 | % text, then jumping from the outline may wind up with the text not | ||
| 4412 | % being visible, for instance under high magnification. | ||
| 4413 | \donoderef{#2}% | ||
| 4414 | % | ||
| 4415 | % Typeset the actual heading. | ||
| 4096 | \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright | 4416 | \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright |
| 4097 | \hangindent = \wd0 \centerparametersmaybe | 4417 | \hangindent=\wd0 \centerparametersmaybe |
| 4098 | \unhbox0 #1\par}% | 4418 | \unhbox0 #1\par}% |
| 4099 | }% | 4419 | }% |
| 4100 | \nobreak\bigskip % no page break after a chapter title | 4420 | \nobreak\bigskip % no page break after a chapter title |
| 4101 | \nobreak | 4421 | \nobreak |
| 4102 | } | 4422 | } |
| 4103 | 4423 | ||
| 4104 | % Plain opening for unnumbered. | ||
| 4105 | \def\unnchfplain#1{\chfplain{#1}{}} | ||
| 4106 | |||
| 4107 | % @centerchap -- centered and unnumbered. | 4424 | % @centerchap -- centered and unnumbered. |
| 4108 | \let\centerparametersmaybe = \relax | 4425 | \let\centerparametersmaybe = \relax |
| 4109 | \def\centerchfplain#1{{% | 4426 | \def\centerparameters{% |
| 4110 | \def\centerparametersmaybe{% | 4427 | \advance\rightskip by 3\rightskip |
| 4111 | \advance\rightskip by 3\rightskip | 4428 | \leftskip = \rightskip |
| 4112 | \leftskip = \rightskip | 4429 | \parfillskip = 0pt |
| 4113 | \parfillskip = 0pt | 4430 | } |
| 4114 | }% | ||
| 4115 | \chfplain{#1}{}% | ||
| 4116 | }} | ||
| 4117 | 4431 | ||
| 4118 | \CHAPFplain % The default | ||
| 4119 | 4432 | ||
| 4433 | % I don't think this chapter style is supported any more, so I'm not | ||
| 4434 | % updating it with the new noderef stuff. We'll see. --karl, 11aug03. | ||
| 4435 | % | ||
| 4436 | \def\setchapterstyle #1 {\csname CHAPF#1\endcsname} | ||
| 4437 | % | ||
| 4120 | \def\unnchfopen #1{% | 4438 | \def\unnchfopen #1{% |
| 4121 | \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 | 4439 | \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 |
| 4122 | \parindent=0pt\raggedright | 4440 | \parindent=0pt\raggedright |
| 4123 | \rm #1\hfill}}\bigskip \par\nobreak | 4441 | \rm #1\hfill}}\bigskip \par\nobreak |
| 4124 | } | 4442 | } |
| 4125 | |||
| 4126 | \def\chfopen #1#2{\chapoddpage {\chapfonts | 4443 | \def\chfopen #1#2{\chapoddpage {\chapfonts |
| 4127 | \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% | 4444 | \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% |
| 4128 | \par\penalty 5000 % | 4445 | \par\penalty 5000 % |
| 4129 | } | 4446 | } |
| 4130 | |||
| 4131 | \def\centerchfopen #1{% | 4447 | \def\centerchfopen #1{% |
| 4132 | \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 | 4448 | \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 |
| 4133 | \parindent=0pt | 4449 | \parindent=0pt |
| 4134 | \hfill {\rm #1}\hfill}}\bigskip \par\nobreak | 4450 | \hfill {\rm #1}\hfill}}\bigskip \par\nobreak |
| 4135 | } | 4451 | } |
| 4136 | 4452 | \def\CHAPFopen{% | |
| 4137 | \def\CHAPFopen{ | 4453 | \global\let\chapmacro=\chfopen |
| 4138 | \global\let\chapmacro=\chfopen | 4454 | \global\let\centerchapmacro=\centerchfopen} |
| 4139 | \global\let\unnumbchapmacro=\unnchfopen | ||
| 4140 | \global\let\centerchapmacro=\centerchfopen} | ||
| 4141 | 4455 | ||
| 4142 | 4456 | ||
| 4143 | % Section titles. | 4457 | % Section titles. These macros combine the section number parts and |
| 4458 | % call the generic \sectionheading to do the printing. | ||
| 4459 | % | ||
| 4144 | \newskip\secheadingskip | 4460 | \newskip\secheadingskip |
| 4145 | \def\secheadingbreak{\dobreak \secheadingskip {-1000}} | 4461 | \def\secheadingbreak{\dobreak \secheadingskip{-1000}} |
| 4146 | \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} | ||
| 4147 | \def\plainsecheading#1{\sectionheading{sec}{}{#1}} | ||
| 4148 | 4462 | ||
| 4149 | % Subsection titles. | 4463 | % Subsection titles. |
| 4150 | \newskip \subsecheadingskip | 4464 | \newskip\subsecheadingskip |
| 4151 | \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} | 4465 | \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} |
| 4152 | \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} | ||
| 4153 | \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} | ||
| 4154 | 4466 | ||
| 4155 | % Subsubsection titles. | 4467 | % Subsubsection titles. |
| 4156 | \let\subsubsecheadingskip = \subsecheadingskip | 4468 | \def\subsubsecheadingskip{\subsecheadingskip} |
| 4157 | \let\subsubsecheadingbreak = \subsecheadingbreak | 4469 | \def\subsubsecheadingbreak{\subsecheadingbreak} |
| 4158 | \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} | ||
| 4159 | \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} | ||
| 4160 | 4470 | ||
| 4161 | 4471 | ||
| 4162 | % Print any size section title. | 4472 | % Print any size, any type, section title. |
| 4163 | % | 4473 | % |
| 4164 | % #1 is the section type (sec/subsec/subsubsec), #2 is the section | 4474 | % #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is |
| 4165 | % number (maybe empty), #3 the text. | 4475 | % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the |
| 4166 | \def\sectionheading#1#2#3{% | 4476 | % section number. |
| 4167 | {% | 4477 | % |
| 4168 | \expandafter\advance\csname #1headingskip\endcsname by \parskip | 4478 | \def\sectionheading#1#2#3#4{% |
| 4169 | \csname #1headingbreak\endcsname | ||
| 4170 | }% | ||
| 4171 | {% | 4479 | {% |
| 4172 | % Switch to the right set of fonts. | 4480 | % Switch to the right set of fonts. |
| 4173 | \csname #1fonts\endcsname \rm | 4481 | \csname #2fonts\endcsname \rm |
| 4482 | % | ||
| 4483 | % Insert space above the heading. | ||
| 4484 | \csname #2headingbreak\endcsname | ||
| 4485 | % | ||
| 4486 | % Only insert the space after the number if we have a section number. | ||
| 4487 | \def\sectionlevel{#2}% | ||
| 4488 | \def\temptype{#3}% | ||
| 4489 | % | ||
| 4490 | \ifx\temptype\Ynothingkeyword | ||
| 4491 | \setbox0 = \hbox{}% | ||
| 4492 | \def\toctype{unn}% | ||
| 4493 | \gdef\thissection{#1}% | ||
| 4494 | \else\ifx\temptype\Yomitfromtockeyword | ||
| 4495 | % for @headings -- no section number, don't include in toc, | ||
| 4496 | % and don't redefine \thissection. | ||
| 4497 | \setbox0 = \hbox{}% | ||
| 4498 | \def\toctype{omit}% | ||
| 4499 | \let\sectionlevel=\empty | ||
| 4500 | \else\ifx\temptype\Yappendixkeyword | ||
| 4501 | \setbox0 = \hbox{#4\enspace}% | ||
| 4502 | \def\toctype{app}% | ||
| 4503 | \gdef\thissection{#1}% | ||
| 4504 | \else | ||
| 4505 | \setbox0 = \hbox{#4\enspace}% | ||
| 4506 | \def\toctype{num}% | ||
| 4507 | \gdef\thissection{#1}% | ||
| 4508 | \fi\fi\fi | ||
| 4174 | % | 4509 | % |
| 4175 | % Only insert the separating space if we have a section number. | 4510 | % Write the toc entry (before \donoderef). See comments in \chapmacro. |
| 4176 | \def\secnum{#2}% | 4511 | \writetocentry{\toctype\sectionlevel}{#1}{#4}% |
| 4177 | \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% | ||
| 4178 | % | 4512 | % |
| 4513 | % Write the node reference (= pdf destination for pdftex). | ||
| 4514 | % Again, see comments in \chapmacro. | ||
| 4515 | \donoderef{#3}% | ||
| 4516 | % | ||
| 4517 | % Interline glue will be inserted when the vbox is completed. | ||
| 4518 | % That glue will be a valid breakpoint for the page, since it'll be | ||
| 4519 | % preceded by a whatsit (usually from the \donoderef, or from the | ||
| 4520 | % \writetocentry if there was no node). We don't want to allow that | ||
| 4521 | % break, since then the whatsits could end up on page n while the | ||
| 4522 | % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. | ||
| 4523 | \nobreak | ||
| 4524 | % | ||
| 4525 | % Output the actual section heading. | ||
| 4179 | \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright | 4526 | \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright |
| 4180 | \hangindent = \wd0 % zero if no section number | 4527 | \hangindent=\wd0 % zero if no section number |
| 4181 | \unhbox0 #3}% | 4528 | \unhbox0 #1}% |
| 4182 | }% | 4529 | }% |
| 4183 | % Add extra space after the heading -- either a line space or a | 4530 | % Add extra space after the heading -- half of whatever came above it. |
| 4184 | % paragraph space, whichever is more. (Some people like to set | 4531 | % Don't allow stretch, though. |
| 4185 | % \parskip to large values for some reason.) Don't allow stretch, though. | 4532 | \kern .5 \csname #2headingskip\endcsname |
| 4186 | \nobreak | 4533 | % |
| 4187 | \ifdim\parskip>\normalbaselineskip | 4534 | % Do not let the kern be a potential breakpoint, as it would be if it |
| 4188 | \kern\parskip | 4535 | % was followed by glue. |
| 4189 | \else | ||
| 4190 | \kern\normalbaselineskip | ||
| 4191 | \fi | ||
| 4192 | \nobreak | 4536 | \nobreak |
| 4537 | % | ||
| 4538 | % We'll almost certainly start a paragraph next, so don't let that | ||
| 4539 | % glue accumulate. (Not a breakpoint because it's preceded by a | ||
| 4540 | % discardable item.) | ||
| 4541 | \vskip-\parskip | ||
| 4542 | % | ||
| 4543 | % This is purely so the last item on the list is a known \penalty > | ||
| 4544 | % 10000. This is so \startdefun can avoid allowing breakpoints after | ||
| 4545 | % section headings. Otherwise, it would insert a valid breakpoint between: | ||
| 4546 | % | ||
| 4547 | % @section sec-whatever | ||
| 4548 | % @deffn def-whatever | ||
| 4549 | \penalty 10001 | ||
| 4193 | } | 4550 | } |
| 4194 | 4551 | ||
| 4195 | 4552 | ||
| @@ -4198,119 +4555,173 @@ width0pt\relax} \fi | |||
| 4198 | \newwrite\tocfile | 4555 | \newwrite\tocfile |
| 4199 | 4556 | ||
| 4200 | % Write an entry to the toc file, opening it if necessary. | 4557 | % Write an entry to the toc file, opening it if necessary. |
| 4201 | % Called from @chapter, etc. We supply {\folio} at the end of the | 4558 | % Called from @chapter, etc. |
| 4202 | % argument, which will end up as the last argument to the \...entry macro. | 4559 | % |
| 4560 | % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} | ||
| 4561 | % We append the current node name (if any) and page number as additional | ||
| 4562 | % arguments for the \{chap,sec,...}entry macros which will eventually | ||
| 4563 | % read this. The node name is used in the pdf outlines as the | ||
| 4564 | % destination to jump to. | ||
| 4203 | % | 4565 | % |
| 4204 | % Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}} | ||
| 4205 | % We open the .toc file for writing here instead of at @setfilename (or | 4566 | % We open the .toc file for writing here instead of at @setfilename (or |
| 4206 | % any other fixed time) so that @contents can be anywhere in the document. | 4567 | % any other fixed time) so that @contents can be anywhere in the document. |
| 4568 | % But if #1 is `omit', then we don't do anything. This is used for the | ||
| 4569 | % table of contents chapter openings themselves. | ||
| 4207 | % | 4570 | % |
| 4208 | \newif\iftocfileopened | 4571 | \newif\iftocfileopened |
| 4572 | \def\omitkeyword{omit}% | ||
| 4573 | % | ||
| 4209 | \def\writetocentry#1#2#3{% | 4574 | \def\writetocentry#1#2#3{% |
| 4210 | \iftocfileopened\else | 4575 | \edef\writetoctype{#1}% |
| 4211 | \immediate\openout\tocfile = \jobname.toc | 4576 | \ifx\writetoctype\omitkeyword \else |
| 4212 | \global\tocfileopenedtrue | 4577 | \iftocfileopened\else |
| 4213 | \fi | 4578 | \immediate\openout\tocfile = \jobname.toc |
| 4214 | % | 4579 | \global\tocfileopenedtrue |
| 4215 | \iflinks | 4580 | \fi |
| 4216 | \toks0 = {#2}% | 4581 | % |
| 4217 | \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}% | 4582 | \iflinks |
| 4218 | \temp | 4583 | {\atdummies |
| 4584 | \edef\temp{% | ||
| 4585 | \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% | ||
| 4586 | \temp | ||
| 4587 | }% | ||
| 4588 | \fi | ||
| 4219 | \fi | 4589 | \fi |
| 4220 | % | 4590 | % |
| 4221 | % Tell \shipout to create a page destination if we're doing pdf, which | 4591 | % Tell \shipout to create a pdf destination on each page, if we're |
| 4222 | % will be the target of the links in the table of contents. We can't | 4592 | % writing pdf. These are used in the table of contents. We can't |
| 4223 | % just do it on every page because the title pages are numbered 1 and | 4593 | % just write one on every page because the title pages are numbered |
| 4224 | % 2 (the page numbers aren't printed), and so are the first two pages | 4594 | % 1 and 2 (the page numbers aren't printed), and so are the first |
| 4225 | % of the document. Thus, we'd have two destinations named `1', and | 4595 | % two pages of the document. Thus, we'd have two destinations named |
| 4226 | % two named `2'. | 4596 | % `1', and two named `2'. |
| 4227 | \ifpdf \pdfmakepagedesttrue \fi | 4597 | \ifpdf \global\pdfmakepagedesttrue \fi |
| 4598 | } | ||
| 4599 | |||
| 4600 | |||
| 4601 | % These characters do not print properly in the Computer Modern roman | ||
| 4602 | % fonts, so we must take special care. This is more or less redundant | ||
| 4603 | % with the Texinfo input format setup at the end of this file. | ||
| 4604 | % | ||
| 4605 | \def\activecatcodes{% | ||
| 4606 | \catcode`\"=\active | ||
| 4607 | \catcode`\$=\active | ||
| 4608 | \catcode`\<=\active | ||
| 4609 | \catcode`\>=\active | ||
| 4610 | \catcode`\\=\active | ||
| 4611 | \catcode`\^=\active | ||
| 4612 | \catcode`\_=\active | ||
| 4613 | \catcode`\|=\active | ||
| 4614 | \catcode`\~=\active | ||
| 4615 | } | ||
| 4616 | |||
| 4617 | |||
| 4618 | % Read the toc file, which is essentially Texinfo input. | ||
| 4619 | \def\readtocfile{% | ||
| 4620 | \setupdatafile | ||
| 4621 | \activecatcodes | ||
| 4622 | \input \jobname.toc | ||
| 4228 | } | 4623 | } |
| 4229 | 4624 | ||
| 4230 | \newskip\contentsrightmargin \contentsrightmargin=1in | 4625 | \newskip\contentsrightmargin \contentsrightmargin=1in |
| 4231 | \newcount\savepageno | 4626 | \newcount\savepageno |
| 4232 | \newcount\lastnegativepageno \lastnegativepageno = -1 | 4627 | \newcount\lastnegativepageno \lastnegativepageno = -1 |
| 4233 | 4628 | ||
| 4234 | % Finish up the main text and prepare to read what we've written | 4629 | % Prepare to read what we've written to \tocfile. |
| 4235 | % to \tocfile. | ||
| 4236 | % | 4630 | % |
| 4237 | \def\startcontents#1{% | 4631 | \def\startcontents#1{% |
| 4238 | % If @setchapternewpage on, and @headings double, the contents should | 4632 | % If @setchapternewpage on, and @headings double, the contents should |
| 4239 | % start on an odd page, unlike chapters. Thus, we maintain | 4633 | % start on an odd page, unlike chapters. Thus, we maintain |
| 4240 | % \contentsalignmacro in parallel with \pagealignmacro. | 4634 | % \contentsalignmacro in parallel with \pagealignmacro. |
| 4241 | % From: Torbjorn Granlund <tege@matematik.su.se> | 4635 | % From: Torbjorn Granlund <tege@matematik.su.se> |
| 4242 | \contentsalignmacro | 4636 | \contentsalignmacro |
| 4243 | \immediate\closeout\tocfile | 4637 | \immediate\closeout\tocfile |
| 4244 | % | 4638 | % |
| 4245 | % Don't need to put `Contents' or `Short Contents' in the headline. | 4639 | % Don't need to put `Contents' or `Short Contents' in the headline. |
| 4246 | % It is abundantly clear what they are. | 4640 | % It is abundantly clear what they are. |
| 4247 | \unnumbchapmacro{#1}\def\thischapter{}% | 4641 | \def\thischapter{}% |
| 4248 | \savepageno = \pageno | 4642 | \chapmacro{#1}{Yomitfromtoc}{}% |
| 4249 | \begingroup % Set up to handle contents files properly. | 4643 | % |
| 4250 | \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 | 4644 | \savepageno = \pageno |
| 4251 | % We can't do this, because then an actual ^ in a section | 4645 | \begingroup % Set up to handle contents files properly. |
| 4252 | % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. | 4646 | \raggedbottom % Worry more about breakpoints than the bottom. |
| 4253 | %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi | 4647 | \advance\hsize by -\contentsrightmargin % Don't use the full line length. |
| 4254 | \raggedbottom % Worry more about breakpoints than the bottom. | 4648 | % |
| 4255 | \advance\hsize by -\contentsrightmargin % Don't use the full line length. | 4649 | % Roman numerals for page numbers. |
| 4256 | % | 4650 | \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi |
| 4257 | % Roman numerals for page numbers. | ||
| 4258 | \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi | ||
| 4259 | } | 4651 | } |
| 4260 | 4652 | ||
| 4261 | 4653 | ||
| 4262 | % Normal (long) toc. | 4654 | % Normal (long) toc. |
| 4263 | \def\contents{% | 4655 | \def\contents{% |
| 4264 | \startcontents{\putwordTOC}% | 4656 | \startcontents{\putwordTOC}% |
| 4265 | \openin 1 \jobname.toc | 4657 | \openin 1 \jobname.toc |
| 4266 | \ifeof 1 \else | 4658 | \ifeof 1 \else |
| 4267 | \closein 1 | 4659 | \readtocfile |
| 4268 | \input \jobname.toc | 4660 | \fi |
| 4269 | \fi | 4661 | \vfill \eject |
| 4270 | \vfill \eject | 4662 | \contentsalignmacro % in case @setchapternewpage odd is in effect |
| 4271 | \contentsalignmacro % in case @setchapternewpage odd is in effect | 4663 | \ifeof 1 \else |
| 4272 | \pdfmakeoutlines | 4664 | \pdfmakeoutlines |
| 4273 | \endgroup | 4665 | \fi |
| 4274 | \lastnegativepageno = \pageno | 4666 | \closein 1 |
| 4275 | \global\pageno = \savepageno | 4667 | \endgroup |
| 4668 | \lastnegativepageno = \pageno | ||
| 4669 | \global\pageno = \savepageno | ||
| 4276 | } | 4670 | } |
| 4277 | 4671 | ||
| 4278 | % And just the chapters. | 4672 | % And just the chapters. |
| 4279 | \def\summarycontents{% | 4673 | \def\summarycontents{% |
| 4280 | \startcontents{\putwordShortTOC}% | 4674 | \startcontents{\putwordShortTOC}% |
| 4281 | % | 4675 | % |
| 4282 | \let\chapentry = \shortchapentry | 4676 | \let\numchapentry = \shortchapentry |
| 4283 | \let\appendixentry = \shortappendixentry | 4677 | \let\appentry = \shortchapentry |
| 4284 | \let\unnumbchapentry = \shortunnumberedentry | 4678 | \let\unnchapentry = \shortunnchapentry |
| 4285 | % We want a true roman here for the page numbers. | 4679 | % We want a true roman here for the page numbers. |
| 4286 | \secfonts | 4680 | \secfonts |
| 4287 | \let\rm=\shortcontrm \let\bf=\shortcontbf | 4681 | \let\rm=\shortcontrm \let\bf=\shortcontbf |
| 4288 | \let\sl=\shortcontsl \let\tt=\shortconttt | 4682 | \let\sl=\shortcontsl \let\tt=\shortconttt |
| 4289 | \rm | 4683 | \rm |
| 4290 | \hyphenpenalty = 10000 | 4684 | \hyphenpenalty = 10000 |
| 4291 | \advance\baselineskip by 1pt % Open it up a little. | 4685 | \advance\baselineskip by 1pt % Open it up a little. |
| 4292 | \def\secentry ##1##2##3##4{} | 4686 | \def\numsecentry##1##2##3##4{} |
| 4293 | \def\subsecentry ##1##2##3##4##5{} | 4687 | \let\appsecentry = \numsecentry |
| 4294 | \def\subsubsecentry ##1##2##3##4##5##6{} | 4688 | \let\unnsecentry = \numsecentry |
| 4295 | \let\unnumbsecentry = \secentry | 4689 | \let\numsubsecentry = \numsecentry |
| 4296 | \let\unnumbsubsecentry = \subsecentry | 4690 | \let\appsubsecentry = \numsecentry |
| 4297 | \let\unnumbsubsubsecentry = \subsubsecentry | 4691 | \let\unnsubsecentry = \numsecentry |
| 4298 | \openin 1 \jobname.toc | 4692 | \let\numsubsubsecentry = \numsecentry |
| 4299 | \ifeof 1 \else | 4693 | \let\appsubsubsecentry = \numsecentry |
| 4300 | \closein 1 | 4694 | \let\unnsubsubsecentry = \numsecentry |
| 4301 | \input \jobname.toc | 4695 | \openin 1 \jobname.toc |
| 4302 | \fi | 4696 | \ifeof 1 \else |
| 4303 | \vfill \eject | 4697 | \readtocfile |
| 4304 | \contentsalignmacro % in case @setchapternewpage odd is in effect | 4698 | \fi |
| 4305 | \endgroup | 4699 | \closein 1 |
| 4306 | \lastnegativepageno = \pageno | 4700 | \vfill \eject |
| 4307 | \global\pageno = \savepageno | 4701 | \contentsalignmacro % in case @setchapternewpage odd is in effect |
| 4702 | \endgroup | ||
| 4703 | \lastnegativepageno = \pageno | ||
| 4704 | \global\pageno = \savepageno | ||
| 4308 | } | 4705 | } |
| 4309 | \let\shortcontents = \summarycontents | 4706 | \let\shortcontents = \summarycontents |
| 4310 | 4707 | ||
| 4311 | \ifpdf | 4708 | % Typeset the label for a chapter or appendix for the short contents. |
| 4312 | \pdfcatalog{/PageMode /UseOutlines}% | 4709 | % The arg is, e.g., `A' for an appendix, or `3' for a chapter. |
| 4313 | \fi | 4710 | % |
| 4711 | \def\shortchaplabel#1{% | ||
| 4712 | % This space should be enough, since a single number is .5em, and the | ||
| 4713 | % widest letter (M) is 1em, at least in the Computer Modern fonts. | ||
| 4714 | % But use \hss just in case. | ||
| 4715 | % (This space doesn't include the extra space that gets added after | ||
| 4716 | % the label; that gets put in by \shortchapentry above.) | ||
| 4717 | % | ||
| 4718 | % We'd like to right-justify chapter numbers, but that looks strange | ||
| 4719 | % with appendix letters. And right-justifying numbers and | ||
| 4720 | % left-justifying letters looks strange when there is less than 10 | ||
| 4721 | % chapters. Have to read the whole toc once to know how many chapters | ||
| 4722 | % there are before deciding ... | ||
| 4723 | \hbox to 1em{#1\hss}% | ||
| 4724 | } | ||
| 4314 | 4725 | ||
| 4315 | % These macros generate individual entries in the table of contents. | 4726 | % These macros generate individual entries in the table of contents. |
| 4316 | % The first argument is the chapter or section name. | 4727 | % The first argument is the chapter or section name. |
| @@ -4318,58 +4729,46 @@ width0pt\relax} \fi | |||
| 4318 | % The arguments in between are the chapter number, section number, ... | 4729 | % The arguments in between are the chapter number, section number, ... |
| 4319 | 4730 | ||
| 4320 | % Chapters, in the main contents. | 4731 | % Chapters, in the main contents. |
| 4321 | \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} | 4732 | \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} |
| 4322 | % | 4733 | % |
| 4323 | % Chapters, in the short toc. | 4734 | % Chapters, in the short toc. |
| 4324 | % See comments in \dochapentry re vbox and related settings. | 4735 | % See comments in \dochapentry re vbox and related settings. |
| 4325 | \def\shortchapentry#1#2#3{% | 4736 | \def\shortchapentry#1#2#3#4{% |
| 4326 | \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}% | 4737 | \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% |
| 4327 | } | 4738 | } |
| 4328 | 4739 | ||
| 4329 | % Appendices, in the main contents. | 4740 | % Appendices, in the main contents. |
| 4330 | \def\appendixentry#1#2#3{% | 4741 | % Need the word Appendix, and a fixed-size box. |
| 4331 | \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}} | ||
| 4332 | % | 4742 | % |
| 4333 | % Appendices, in the short toc. | 4743 | \def\appendixbox#1{% |
| 4334 | \let\shortappendixentry = \shortchapentry | 4744 | % We use M since it's probably the widest letter. |
| 4335 | 4745 | \setbox0 = \hbox{\putwordAppendix{} M}% | |
| 4336 | % Typeset the label for a chapter or appendix for the short contents. | 4746 | \hbox to \wd0{\putwordAppendix{} #1\hss}} |
| 4337 | % The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter. | ||
| 4338 | % We could simplify the code here by writing out an \appendixentry | ||
| 4339 | % command in the toc file for appendices, instead of using \chapentry | ||
| 4340 | % for both, but it doesn't seem worth it. | ||
| 4341 | % | ||
| 4342 | \newdimen\shortappendixwidth | ||
| 4343 | % | 4747 | % |
| 4344 | \def\shortchaplabel#1{% | 4748 | \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} |
| 4345 | % This space should be enough, since a single number is .5em, and the | ||
| 4346 | % widest letter (M) is 1em, at least in the Computer Modern fonts. | ||
| 4347 | % But use \hss just in case. | ||
| 4348 | % (This space doesn't include the extra space that gets added after | ||
| 4349 | % the label; that gets put in by \shortchapentry above.) | ||
| 4350 | \dimen0 = 1em | ||
| 4351 | \hbox to \dimen0{#1\hss}% | ||
| 4352 | } | ||
| 4353 | 4749 | ||
| 4354 | % Unnumbered chapters. | 4750 | % Unnumbered chapters. |
| 4355 | \def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}} | 4751 | \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} |
| 4356 | \def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}} | 4752 | \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} |
| 4357 | 4753 | ||
| 4358 | % Sections. | 4754 | % Sections. |
| 4359 | \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} | 4755 | \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} |
| 4360 | \def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}} | 4756 | \let\appsecentry=\numsecentry |
| 4757 | \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} | ||
| 4361 | 4758 | ||
| 4362 | % Subsections. | 4759 | % Subsections. |
| 4363 | \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} | 4760 | \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} |
| 4364 | \def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}} | 4761 | \let\appsubsecentry=\numsubsecentry |
| 4762 | \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} | ||
| 4365 | 4763 | ||
| 4366 | % And subsubsections. | 4764 | % And subsubsections. |
| 4367 | \def\subsubsecentry#1#2#3#4#5#6{% | 4765 | \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} |
| 4368 | \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} | 4766 | \let\appsubsubsecentry=\numsubsubsecentry |
| 4369 | \def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}} | 4767 | \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} |
| 4370 | 4768 | ||
| 4371 | % This parameter controls the indentation of the various levels. | 4769 | % This parameter controls the indentation of the various levels. |
| 4372 | \newdimen\tocindent \tocindent = 3pc | 4770 | % Same as \defaultparindent. |
| 4771 | \newdimen\tocindent \tocindent = 15pt | ||
| 4373 | 4772 | ||
| 4374 | % Now for the actual typesetting. In all these, #1 is the text and #2 is the | 4773 | % Now for the actual typesetting. In all these, #1 is the text and #2 is the |
| 4375 | % page number. | 4774 | % page number. |
| @@ -4400,17 +4799,8 @@ width0pt\relax} \fi | |||
| 4400 | \tocentry{#1}{\dopageno\bgroup#2\egroup}% | 4799 | \tocentry{#1}{\dopageno\bgroup#2\egroup}% |
| 4401 | \endgroup} | 4800 | \endgroup} |
| 4402 | 4801 | ||
| 4403 | % Final typesetting of a toc entry; we use the same \entry macro as for | 4802 | % We use the same \entry macro as for the index entries. |
| 4404 | % the index entries, but we want to suppress hyphenation here. (We | 4803 | \let\tocentry = \entry |
| 4405 | % can't do that in the \entry macro, since index entries might consist | ||
| 4406 | % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) | ||
| 4407 | \def\tocentry#1#2{\begingroup | ||
| 4408 | \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks | ||
| 4409 | % Do not use \turnoffactive in these arguments. Since the toc is | ||
| 4410 | % typeset in cmr, characters such as _ would come out wrong; we | ||
| 4411 | % have to do the usual translation tricks. | ||
| 4412 | \entry{#1}{#2}% | ||
| 4413 | \endgroup} | ||
| 4414 | 4804 | ||
| 4415 | % Space between chapter (or whatever) number and the title. | 4805 | % Space between chapter (or whatever) number and the title. |
| 4416 | \def\labelspace{\hskip1em \relax} | 4806 | \def\labelspace{\hskip1em \relax} |
| @@ -4420,8 +4810,8 @@ width0pt\relax} \fi | |||
| 4420 | 4810 | ||
| 4421 | \def\chapentryfonts{\secfonts \rm} | 4811 | \def\chapentryfonts{\secfonts \rm} |
| 4422 | \def\secentryfonts{\textfonts} | 4812 | \def\secentryfonts{\textfonts} |
| 4423 | \let\subsecentryfonts = \textfonts | 4813 | \def\subsecentryfonts{\textfonts} |
| 4424 | \let\subsubsecentryfonts = \textfonts | 4814 | \def\subsubsecentryfonts{\textfonts} |
| 4425 | 4815 | ||
| 4426 | 4816 | ||
| 4427 | \message{environments,} | 4817 | \message{environments,} |
| @@ -4448,10 +4838,10 @@ width0pt\relax} \fi | |||
| 4448 | % The text. (`r' is open on the right, `e' somewhat less so on the left.) | 4838 | % The text. (`r' is open on the right, `e' somewhat less so on the left.) |
| 4449 | \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} | 4839 | \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} |
| 4450 | % | 4840 | % |
| 4451 | \global\setbox\errorbox=\hbox to \dimen0{\hfil | 4841 | \setbox\errorbox=\hbox to \dimen0{\hfil |
| 4452 | \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. | 4842 | \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. |
| 4453 | \advance\hsize by -2\dimen2 % Rules. | 4843 | \advance\hsize by -2\dimen2 % Rules. |
| 4454 | \vbox{ | 4844 | \vbox{% |
| 4455 | \hrule height\dimen2 | 4845 | \hrule height\dimen2 |
| 4456 | \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. | 4846 | \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. |
| 4457 | \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. | 4847 | \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. |
| @@ -4465,14 +4855,13 @@ width0pt\relax} \fi | |||
| 4465 | % One exception: @ is still an escape character, so that @end tex works. | 4855 | % One exception: @ is still an escape character, so that @end tex works. |
| 4466 | % But \@ or @@ will get a plain tex @ character. | 4856 | % But \@ or @@ will get a plain tex @ character. |
| 4467 | 4857 | ||
| 4468 | \def\tex{\begingroup | 4858 | \envdef\tex{% |
| 4469 | \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 | 4859 | \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 |
| 4470 | \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 | 4860 | \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 |
| 4471 | \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie | 4861 | \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie |
| 4472 | \catcode `\%=14 | 4862 | \catcode `\%=14 |
| 4473 | \catcode `\+=\other | 4863 | \catcode `\+=\other |
| 4474 | \catcode `\"=\other | 4864 | \catcode `\"=\other |
| 4475 | \catcode `\==\other | ||
| 4476 | \catcode `\|=\other | 4865 | \catcode `\|=\other |
| 4477 | \catcode `\<=\other | 4866 | \catcode `\<=\other |
| 4478 | \catcode `\>=\other | 4867 | \catcode `\>=\other |
| @@ -4488,20 +4877,23 @@ width0pt\relax} \fi | |||
| 4488 | \let\!=\ptexexclam | 4877 | \let\!=\ptexexclam |
| 4489 | \let\i=\ptexi | 4878 | \let\i=\ptexi |
| 4490 | \let\indent=\ptexindent | 4879 | \let\indent=\ptexindent |
| 4880 | \let\noindent=\ptexnoindent | ||
| 4491 | \let\{=\ptexlbrace | 4881 | \let\{=\ptexlbrace |
| 4492 | \let\+=\tabalign | 4882 | \let\+=\tabalign |
| 4493 | \let\}=\ptexrbrace | 4883 | \let\}=\ptexrbrace |
| 4494 | \let\/=\ptexslash | 4884 | \let\/=\ptexslash |
| 4495 | \let\*=\ptexstar | 4885 | \let\*=\ptexstar |
| 4496 | \let\t=\ptext | 4886 | \let\t=\ptext |
| 4887 | \let\frenchspacing=\plainfrenchspacing | ||
| 4497 | % | 4888 | % |
| 4498 | \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% | 4889 | \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% |
| 4499 | \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% | 4890 | \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% |
| 4500 | \def\@{@}% | 4891 | \def\@{@}% |
| 4501 | \let\Etex=\endgroup} | 4892 | } |
| 4893 | % There is no need to define \Etex. | ||
| 4502 | 4894 | ||
| 4503 | % Define @lisp ... @end lisp. | 4895 | % Define @lisp ... @end lisp. |
| 4504 | % @lisp does a \begingroup so it can rebind things, | 4896 | % @lisp environment forms a group so it can rebind things, |
| 4505 | % including the definition of @end lisp (which normally is erroneous). | 4897 | % including the definition of @end lisp (which normally is erroneous). |
| 4506 | 4898 | ||
| 4507 | % Amount to narrow the margins by for @lisp. | 4899 | % Amount to narrow the margins by for @lisp. |
| @@ -4512,19 +4904,6 @@ width0pt\relax} \fi | |||
| 4512 | % have any width. | 4904 | % have any width. |
| 4513 | \def\lisppar{\null\endgraf} | 4905 | \def\lisppar{\null\endgraf} |
| 4514 | 4906 | ||
| 4515 | % Make each space character in the input produce a normal interword | ||
| 4516 | % space in the output. Don't allow a line break at this space, as this | ||
| 4517 | % is used only in environments like @example, where each line of input | ||
| 4518 | % should produce a line of output anyway. | ||
| 4519 | % | ||
| 4520 | {\obeyspaces % | ||
| 4521 | \gdef\sepspaces{\obeyspaces\let =\tie}} | ||
| 4522 | |||
| 4523 | % Define \obeyedspace to be our active space, whatever it is. This is | ||
| 4524 | % for use in \parsearg. | ||
| 4525 | {\sepspaces% | ||
| 4526 | \global\let\obeyedspace= } | ||
| 4527 | |||
| 4528 | % This space is always present above and below environments. | 4907 | % This space is always present above and below environments. |
| 4529 | \newskip\envskipamount \envskipamount = 0pt | 4908 | \newskip\envskipamount \envskipamount = 0pt |
| 4530 | 4909 | ||
| @@ -4534,7 +4913,8 @@ width0pt\relax} \fi | |||
| 4534 | % start of the next paragraph will insert \parskip. | 4913 | % start of the next paragraph will insert \parskip. |
| 4535 | % | 4914 | % |
| 4536 | \def\aboveenvbreak{{% | 4915 | \def\aboveenvbreak{{% |
| 4537 | % =10000 instead of <10000 because of a special case in \itemzzz, q.v. | 4916 | % =10000 instead of <10000 because of a special case in \itemzzz and |
| 4917 | % \sectionheading, q.v. | ||
| 4538 | \ifnum \lastpenalty=10000 \else | 4918 | \ifnum \lastpenalty=10000 \else |
| 4539 | \advance\envskipamount by \parskip | 4919 | \advance\envskipamount by \parskip |
| 4540 | \endgraf | 4920 | \endgraf |
| @@ -4542,7 +4922,7 @@ width0pt\relax} \fi | |||
| 4542 | \removelastskip | 4922 | \removelastskip |
| 4543 | % it's not a good place to break if the last penalty was \nobreak | 4923 | % it's not a good place to break if the last penalty was \nobreak |
| 4544 | % or better ... | 4924 | % or better ... |
| 4545 | \ifnum\lastpenalty>10000 \else \penalty-50 \fi | 4925 | \ifnum\lastpenalty<10000 \penalty-50 \fi |
| 4546 | \vskip\envskipamount | 4926 | \vskip\envskipamount |
| 4547 | \fi | 4927 | \fi |
| 4548 | \fi | 4928 | \fi |
| @@ -4550,7 +4930,8 @@ width0pt\relax} \fi | |||
| 4550 | 4930 | ||
| 4551 | \let\afterenvbreak = \aboveenvbreak | 4931 | \let\afterenvbreak = \aboveenvbreak |
| 4552 | 4932 | ||
| 4553 | % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. | 4933 | % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will |
| 4934 | % also clear it, so that its embedded environments do the narrowing again. | ||
| 4554 | \let\nonarrowing=\relax | 4935 | \let\nonarrowing=\relax |
| 4555 | 4936 | ||
| 4556 | % @cartouche ... @end cartouche: draw rectangle w/rounded corners around | 4937 | % @cartouche ... @end cartouche: draw rectangle w/rounded corners around |
| @@ -4574,52 +4955,52 @@ width0pt\relax} \fi | |||
| 4574 | % | 4955 | % |
| 4575 | \newskip\lskip\newskip\rskip | 4956 | \newskip\lskip\newskip\rskip |
| 4576 | 4957 | ||
| 4577 | \def\cartouche{% | 4958 | \envdef\cartouche{% |
| 4578 | \par % can't be in the midst of a paragraph. | 4959 | \ifhmode\par\fi % can't be in the midst of a paragraph. |
| 4579 | \begingroup | 4960 | \startsavinginserts |
| 4580 | \lskip=\leftskip \rskip=\rightskip | 4961 | \lskip=\leftskip \rskip=\rightskip |
| 4581 | \leftskip=0pt\rightskip=0pt %we want these *outside*. | 4962 | \leftskip=0pt\rightskip=0pt % we want these *outside*. |
| 4582 | \cartinner=\hsize \advance\cartinner by-\lskip | 4963 | \cartinner=\hsize \advance\cartinner by-\lskip |
| 4583 | \advance\cartinner by-\rskip | 4964 | \advance\cartinner by-\rskip |
| 4584 | \cartouter=\hsize | 4965 | \cartouter=\hsize |
| 4585 | \advance\cartouter by 18.4pt % allow for 3pt kerns on either | 4966 | \advance\cartouter by 18.4pt % allow for 3pt kerns on either |
| 4586 | % side, and for 6pt waste from | 4967 | % side, and for 6pt waste from |
| 4587 | % each corner char, and rule thickness | 4968 | % each corner char, and rule thickness |
| 4588 | \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip | 4969 | \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip |
| 4589 | % Flag to tell @lisp, etc., not to narrow margin. | 4970 | % Flag to tell @lisp, etc., not to narrow margin. |
| 4590 | \let\nonarrowing=\comment | 4971 | \let\nonarrowing = t% |
| 4591 | \vbox\bgroup | 4972 | \vbox\bgroup |
| 4592 | \baselineskip=0pt\parskip=0pt\lineskip=0pt | 4973 | \baselineskip=0pt\parskip=0pt\lineskip=0pt |
| 4593 | \carttop | 4974 | \carttop |
| 4594 | \hbox\bgroup | 4975 | \hbox\bgroup |
| 4595 | \hskip\lskip | 4976 | \hskip\lskip |
| 4596 | \vrule\kern3pt | 4977 | \vrule\kern3pt |
| 4597 | \vbox\bgroup | 4978 | \vbox\bgroup |
| 4598 | \hsize=\cartinner | 4979 | \kern3pt |
| 4599 | \kern3pt | 4980 | \hsize=\cartinner |
| 4600 | \begingroup | 4981 | \baselineskip=\normbskip |
| 4601 | \baselineskip=\normbskip | 4982 | \lineskip=\normlskip |
| 4602 | \lineskip=\normlskip | 4983 | \parskip=\normpskip |
| 4603 | \parskip=\normpskip | 4984 | \vskip -\parskip |
| 4604 | \vskip -\parskip | 4985 | \comment % For explanation, see the end of \def\group. |
| 4986 | } | ||
| 4605 | \def\Ecartouche{% | 4987 | \def\Ecartouche{% |
| 4606 | \endgroup | 4988 | \ifhmode\par\fi |
| 4607 | \kern3pt | 4989 | \kern3pt |
| 4608 | \egroup | 4990 | \egroup |
| 4609 | \kern3pt\vrule | 4991 | \kern3pt\vrule |
| 4610 | \hskip\rskip | 4992 | \hskip\rskip |
| 4611 | \egroup | 4993 | \egroup |
| 4612 | \cartbot | 4994 | \cartbot |
| 4613 | \egroup | 4995 | \egroup |
| 4614 | \endgroup | 4996 | \checkinserts |
| 4615 | }} | 4997 | } |
| 4616 | 4998 | ||
| 4617 | 4999 | ||
| 4618 | % This macro is called at the beginning of all the @example variants, | 5000 | % This macro is called at the beginning of all the @example variants, |
| 4619 | % inside a group. | 5001 | % inside a group. |
| 4620 | \def\nonfillstart{% | 5002 | \def\nonfillstart{% |
| 4621 | \aboveenvbreak | 5003 | \aboveenvbreak |
| 4622 | \inENV % This group ends at the end of the body | ||
| 4623 | \hfuzz = 12pt % Don't be fussy | 5004 | \hfuzz = 12pt % Don't be fussy |
| 4624 | \sepspaces % Make spaces be word-separators rather than space tokens. | 5005 | \sepspaces % Make spaces be word-separators rather than space tokens. |
| 4625 | \let\par = \lisppar % don't ignore blank lines | 5006 | \let\par = \lisppar % don't ignore blank lines |
| @@ -4627,116 +5008,134 @@ width0pt\relax} \fi | |||
| 4627 | \parskip = 0pt | 5008 | \parskip = 0pt |
| 4628 | \parindent = 0pt | 5009 | \parindent = 0pt |
| 4629 | \emergencystretch = 0pt % don't try to avoid overfull boxes | 5010 | \emergencystretch = 0pt % don't try to avoid overfull boxes |
| 4630 | % @cartouche defines \nonarrowing to inhibit narrowing | ||
| 4631 | % at next level down. | ||
| 4632 | \ifx\nonarrowing\relax | 5011 | \ifx\nonarrowing\relax |
| 4633 | \advance \leftskip by \lispnarrowing | 5012 | \advance \leftskip by \lispnarrowing |
| 4634 | \exdentamount=\lispnarrowing | 5013 | \exdentamount=\lispnarrowing |
| 4635 | \let\exdent=\nofillexdent | 5014 | \else |
| 4636 | \let\nonarrowing=\relax | 5015 | \let\nonarrowing = \relax |
| 4637 | \fi | 5016 | \fi |
| 5017 | \let\exdent=\nofillexdent | ||
| 4638 | } | 5018 | } |
| 4639 | 5019 | ||
| 4640 | % Define the \E... control sequence only if we are inside the particular | 5020 | % If you want all examples etc. small: @set dispenvsize small. |
| 4641 | % environment, so the error checking in \end will work. | 5021 | % If you want even small examples the full size: @set dispenvsize nosmall. |
| 4642 | % | 5022 | % This affects the following displayed environments: |
| 4643 | % To end an @example-like environment, we first end the paragraph (via | 5023 | % @example, @display, @format, @lisp |
| 4644 | % \afterenvbreak's vertical glue), and then the group. That way we keep | ||
| 4645 | % the zero \parskip that the environments set -- \parskip glue will be | ||
| 4646 | % inserted at the beginning of the next paragraph in the document, after | ||
| 4647 | % the environment. | ||
| 4648 | % | 5024 | % |
| 4649 | \def\nonfillfinish{\afterenvbreak\endgroup} | 5025 | \def\smallword{small} |
| 5026 | \def\nosmallword{nosmall} | ||
| 5027 | \let\SETdispenvsize\relax | ||
| 5028 | \def\setnormaldispenv{% | ||
| 5029 | \ifx\SETdispenvsize\smallword | ||
| 5030 | \smallexamplefonts \rm | ||
| 5031 | \fi | ||
| 5032 | } | ||
| 5033 | \def\setsmalldispenv{% | ||
| 5034 | \ifx\SETdispenvsize\nosmallword | ||
| 5035 | \else | ||
| 5036 | \smallexamplefonts \rm | ||
| 5037 | \fi | ||
| 5038 | } | ||
| 4650 | 5039 | ||
| 4651 | % @lisp: indented, narrowed, typewriter font. | 5040 | % We often define two environments, @foo and @smallfoo. |
| 4652 | \def\lisp{\begingroup | 5041 | % Let's do it by one command: |
| 4653 | \nonfillstart | 5042 | \def\makedispenv #1#2{ |
| 4654 | \let\Elisp = \nonfillfinish | 5043 | \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} |
| 4655 | \tt | 5044 | \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} |
| 4656 | \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. | 5045 | \expandafter\let\csname E#1\endcsname \afterenvbreak |
| 4657 | \gobble % eat return | 5046 | \expandafter\let\csname Esmall#1\endcsname \afterenvbreak |
| 4658 | } | 5047 | } |
| 4659 | 5048 | ||
| 4660 | % @example: Same as @lisp. | 5049 | % Define two synonyms: |
| 4661 | \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} | 5050 | \def\maketwodispenvs #1#2#3{ |
| 5051 | \makedispenv{#1}{#3} | ||
| 5052 | \makedispenv{#2}{#3} | ||
| 5053 | } | ||
| 4662 | 5054 | ||
| 5055 | % @lisp: indented, narrowed, typewriter font; @example: same as @lisp. | ||
| 5056 | % | ||
| 4663 | % @smallexample and @smalllisp: use smaller fonts. | 5057 | % @smallexample and @smalllisp: use smaller fonts. |
| 4664 | % Originally contributed by Pavel@xerox. | 5058 | % Originally contributed by Pavel@xerox. |
| 4665 | \def\smalllisp{\begingroup | 5059 | % |
| 4666 | \def\Esmalllisp{\nonfillfinish\endgroup}% | 5060 | \maketwodispenvs {lisp}{example}{% |
| 4667 | \def\Esmallexample{\nonfillfinish\endgroup}% | 5061 | \nonfillstart |
| 4668 | \smallexamplefonts | 5062 | \tt |
| 4669 | \lisp | 5063 | \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. |
| 5064 | \gobble % eat return | ||
| 4670 | } | 5065 | } |
| 4671 | \let\smallexample = \smalllisp | ||
| 4672 | 5066 | ||
| 4673 | 5067 | % @display/@smalldisplay: same as @lisp except keep current font. | |
| 4674 | % @display: same as @lisp except keep current font. | ||
| 4675 | % | 5068 | % |
| 4676 | \def\display{\begingroup | 5069 | \makedispenv {display}{% |
| 4677 | \nonfillstart | 5070 | \nonfillstart |
| 4678 | \let\Edisplay = \nonfillfinish | ||
| 4679 | \gobble | 5071 | \gobble |
| 4680 | } | 5072 | } |
| 4681 | % | ||
| 4682 | % @smalldisplay: @display plus smaller fonts. | ||
| 4683 | % | ||
| 4684 | \def\smalldisplay{\begingroup | ||
| 4685 | \def\Esmalldisplay{\nonfillfinish\endgroup}% | ||
| 4686 | \smallexamplefonts \rm | ||
| 4687 | \display | ||
| 4688 | } | ||
| 4689 | 5073 | ||
| 4690 | % @format: same as @display except don't narrow margins. | 5074 | % @format/@smallformat: same as @display except don't narrow margins. |
| 4691 | % | 5075 | % |
| 4692 | \def\format{\begingroup | 5076 | \makedispenv{format}{% |
| 4693 | \let\nonarrowing = t | 5077 | \let\nonarrowing = t% |
| 4694 | \nonfillstart | 5078 | \nonfillstart |
| 4695 | \let\Eformat = \nonfillfinish | ||
| 4696 | \gobble | 5079 | \gobble |
| 4697 | } | 5080 | } |
| 4698 | % | ||
| 4699 | % @smallformat: @format plus smaller fonts. | ||
| 4700 | % | ||
| 4701 | \def\smallformat{\begingroup | ||
| 4702 | \def\Esmallformat{\nonfillfinish\endgroup}% | ||
| 4703 | \smallexamplefonts \rm | ||
| 4704 | \format | ||
| 4705 | } | ||
| 4706 | 5081 | ||
| 4707 | % @flushleft (same as @format). | 5082 | % @flushleft: same as @format, but doesn't obey \SETdispenvsize. |
| 4708 | % | 5083 | \envdef\flushleft{% |
| 4709 | \def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format} | 5084 | \let\nonarrowing = t% |
| 5085 | \nonfillstart | ||
| 5086 | \gobble | ||
| 5087 | } | ||
| 5088 | \let\Eflushleft = \afterenvbreak | ||
| 4710 | 5089 | ||
| 4711 | % @flushright. | 5090 | % @flushright. |
| 4712 | % | 5091 | % |
| 4713 | \def\flushright{\begingroup | 5092 | \envdef\flushright{% |
| 4714 | \let\nonarrowing = t | 5093 | \let\nonarrowing = t% |
| 4715 | \nonfillstart | 5094 | \nonfillstart |
| 4716 | \let\Eflushright = \nonfillfinish | ||
| 4717 | \advance\leftskip by 0pt plus 1fill | 5095 | \advance\leftskip by 0pt plus 1fill |
| 4718 | \gobble | 5096 | \gobble |
| 4719 | } | 5097 | } |
| 5098 | \let\Eflushright = \afterenvbreak | ||
| 4720 | 5099 | ||
| 4721 | 5100 | ||
| 4722 | % @quotation does normal linebreaking (hence we can't use \nonfillstart) | 5101 | % @quotation does normal linebreaking (hence we can't use \nonfillstart) |
| 4723 | % and narrows the margins. | 5102 | % and narrows the margins. We keep \parskip nonzero in general, since |
| 5103 | % we're doing normal filling. So, when using \aboveenvbreak and | ||
| 5104 | % \afterenvbreak, temporarily make \parskip 0. | ||
| 4724 | % | 5105 | % |
| 4725 | \def\quotation{% | 5106 | \envdef\quotation{% |
| 4726 | \begingroup\inENV %This group ends at the end of the @quotation body | ||
| 4727 | {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip | 5107 | {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip |
| 4728 | \parindent=0pt | 5108 | \parindent=0pt |
| 4729 | % We have retained a nonzero parskip for the environment, since we're | ||
| 4730 | % doing normal filling. So to avoid extra space below the environment... | ||
| 4731 | \def\Equotation{\parskip = 0pt \nonfillfinish}% | ||
| 4732 | % | 5109 | % |
| 4733 | % @cartouche defines \nonarrowing to inhibit narrowing at next level down. | 5110 | % @cartouche defines \nonarrowing to inhibit narrowing at next level down. |
| 4734 | \ifx\nonarrowing\relax | 5111 | \ifx\nonarrowing\relax |
| 4735 | \advance\leftskip by \lispnarrowing | 5112 | \advance\leftskip by \lispnarrowing |
| 4736 | \advance\rightskip by \lispnarrowing | 5113 | \advance\rightskip by \lispnarrowing |
| 4737 | \exdentamount = \lispnarrowing | 5114 | \exdentamount = \lispnarrowing |
| 5115 | \else | ||
| 4738 | \let\nonarrowing = \relax | 5116 | \let\nonarrowing = \relax |
| 4739 | \fi | 5117 | \fi |
| 5118 | \parsearg\quotationlabel | ||
| 5119 | } | ||
| 5120 | |||
| 5121 | % We have retained a nonzero parskip for the environment, since we're | ||
| 5122 | % doing normal filling. | ||
| 5123 | % | ||
| 5124 | \def\Equotation{% | ||
| 5125 | \par | ||
| 5126 | \ifx\quotationauthor\undefined\else | ||
| 5127 | % indent a bit. | ||
| 5128 | \leftline{\kern 2\leftskip \sl ---\quotationauthor}% | ||
| 5129 | \fi | ||
| 5130 | {\parskip=0pt \afterenvbreak}% | ||
| 5131 | } | ||
| 5132 | |||
| 5133 | % If we're given an argument, typeset it in bold with a colon after. | ||
| 5134 | \def\quotationlabel#1{% | ||
| 5135 | \def\temp{#1}% | ||
| 5136 | \ifx\temp\empty \else | ||
| 5137 | {\bf #1: }% | ||
| 5138 | \fi | ||
| 4740 | } | 5139 | } |
| 4741 | 5140 | ||
| 4742 | 5141 | ||
| @@ -4758,7 +5157,7 @@ width0pt\relax} \fi | |||
| 4758 | % | 5157 | % |
| 4759 | % [Knuth] p. 380 | 5158 | % [Knuth] p. 380 |
| 4760 | \def\uncatcodespecials{% | 5159 | \def\uncatcodespecials{% |
| 4761 | \def\do##1{\catcode`##1=12}\dospecials} | 5160 | \def\do##1{\catcode`##1=\other}\dospecials} |
| 4762 | % | 5161 | % |
| 4763 | % [Knuth] pp. 380,381,391 | 5162 | % [Knuth] pp. 380,381,391 |
| 4764 | % Disable Spanish ligatures ?` and !` of \tt font | 5163 | % Disable Spanish ligatures ?` and !` of \tt font |
| @@ -4806,6 +5205,8 @@ width0pt\relax} \fi | |||
| 4806 | } | 5205 | } |
| 4807 | \endgroup | 5206 | \endgroup |
| 4808 | \def\setupverbatim{% | 5207 | \def\setupverbatim{% |
| 5208 | \let\nonarrowing = t% | ||
| 5209 | \nonfillstart | ||
| 4809 | % Easiest (and conventionally used) font for verbatim | 5210 | % Easiest (and conventionally used) font for verbatim |
| 4810 | \tt | 5211 | \tt |
| 4811 | \def\par{\leavevmode\egroup\box0\endgraf}% | 5212 | \def\par{\leavevmode\egroup\box0\endgraf}% |
| @@ -4827,7 +5228,7 @@ width0pt\relax} \fi | |||
| 4827 | % | 5228 | % |
| 4828 | % [Knuth] p. 382; only eat outer {} | 5229 | % [Knuth] p. 382; only eat outer {} |
| 4829 | \begingroup | 5230 | \begingroup |
| 4830 | \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12 | 5231 | \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other |
| 4831 | \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] | 5232 | \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] |
| 4832 | \endgroup | 5233 | \endgroup |
| 4833 | % | 5234 | % |
| @@ -4844,13 +5245,6 @@ width0pt\relax} \fi | |||
| 4844 | % we need not redefine '\', '{' and '}'. | 5245 | % we need not redefine '\', '{' and '}'. |
| 4845 | % | 5246 | % |
| 4846 | % Inspired by LaTeX's verbatim command set [latex.ltx] | 5247 | % Inspired by LaTeX's verbatim command set [latex.ltx] |
| 4847 | %% Include LaTeX hack for completeness -- never know | ||
| 4848 | %% \begingroup | ||
| 4849 | %% \catcode`|=0 \catcode`[=1 | ||
| 4850 | %% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active | ||
| 4851 | %% \catcode`\\=12|gdef|doverbatim#1@end verbatim[ | ||
| 4852 | %% #1|endgroup|def|Everbatim[]|end[verbatim]] | ||
| 4853 | %% |endgroup | ||
| 4854 | % | 5248 | % |
| 4855 | \begingroup | 5249 | \begingroup |
| 4856 | \catcode`\ =\active | 5250 | \catcode`\ =\active |
| @@ -4858,54 +5252,32 @@ width0pt\relax} \fi | |||
| 4858 | % ignore everything up to the first ^^M, that's the newline at the end | 5252 | % ignore everything up to the first ^^M, that's the newline at the end |
| 4859 | % of the @verbatim input line itself. Otherwise we get an extra blank | 5253 | % of the @verbatim input line itself. Otherwise we get an extra blank |
| 4860 | % line in the output. | 5254 | % line in the output. |
| 4861 | \gdef\doverbatim#1^^M#2@end verbatim{#2\end{verbatim}}% | 5255 | \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% |
| 5256 | % We really want {...\end verbatim} in the body of the macro, but | ||
| 5257 | % without the active space; thus we have to use \xdef and \gobble. | ||
| 4862 | \endgroup | 5258 | \endgroup |
| 4863 | % | 5259 | % |
| 4864 | \def\verbatim{% | 5260 | \envdef\verbatim{% |
| 4865 | \def\Everbatim{\nonfillfinish\endgroup}% | 5261 | \setupverbatim\doverbatim |
| 4866 | \begingroup | ||
| 4867 | \nonfillstart | ||
| 4868 | \advance\leftskip by -\defbodyindent | ||
| 4869 | \begingroup\setupverbatim\doverbatim | ||
| 4870 | } | 5262 | } |
| 5263 | \let\Everbatim = \afterenvbreak | ||
| 5264 | |||
| 4871 | 5265 | ||
| 4872 | % @verbatiminclude FILE - insert text of file in verbatim environment. | 5266 | % @verbatiminclude FILE - insert text of file in verbatim environment. |
| 4873 | % | 5267 | % |
| 4874 | % Allow normal characters that we make active in the argument (a file name). | 5268 | \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} |
| 4875 | \def\verbatiminclude{% | ||
| 4876 | \begingroup | ||
| 4877 | \catcode`\\=\other | ||
| 4878 | \catcode`~=\other | ||
| 4879 | \catcode`^=\other | ||
| 4880 | \catcode`_=\other | ||
| 4881 | \catcode`|=\other | ||
| 4882 | \catcode`<=\other | ||
| 4883 | \catcode`>=\other | ||
| 4884 | \catcode`+=\other | ||
| 4885 | \parsearg\doverbatiminclude | ||
| 4886 | } | ||
| 4887 | \def\setupverbatiminclude{% | ||
| 4888 | \begingroup | ||
| 4889 | \nonfillstart | ||
| 4890 | \advance\leftskip by -\defbodyindent | ||
| 4891 | \begingroup\setupverbatim | ||
| 4892 | } | ||
| 4893 | % | 5269 | % |
| 4894 | \def\doverbatiminclude#1{% | 5270 | \def\doverbatiminclude#1{% |
| 4895 | % Restore active chars for included file. | 5271 | {% |
| 4896 | \endgroup | 5272 | \makevalueexpandable |
| 4897 | \begingroup | 5273 | \setupverbatim |
| 4898 | \let\value=\expandablevalue | 5274 | \input #1 |
| 4899 | \def\thisfile{#1}% | 5275 | \afterenvbreak |
| 4900 | \expandafter\expandafter\setupverbatiminclude\input\thisfile | 5276 | }% |
| 4901 | \endgroup | ||
| 4902 | \nonfillfinish | ||
| 4903 | \endgroup | ||
| 4904 | } | 5277 | } |
| 4905 | 5278 | ||
| 4906 | % @copying ... @end copying. | 5279 | % @copying ... @end copying. |
| 4907 | % Save the text away for @insertcopying later. Many commands won't be | 5280 | % Save the text away for @insertcopying later. |
| 4908 | % allowed in this context, but that's ok. | ||
| 4909 | % | 5281 | % |
| 4910 | % We save the uninterpreted tokens, rather than creating a box. | 5282 | % We save the uninterpreted tokens, rather than creating a box. |
| 4911 | % Saving the text in a box would be much easier, but then all the | 5283 | % Saving the text in a box would be much easier, but then all the |
| @@ -4914,641 +5286,349 @@ width0pt\relax} \fi | |||
| 4914 | % file; b) letting users define the frontmatter in as flexible order as | 5286 | % file; b) letting users define the frontmatter in as flexible order as |
| 4915 | % possible is very desirable. | 5287 | % possible is very desirable. |
| 4916 | % | 5288 | % |
| 4917 | \def\copying{\begingroup | 5289 | \def\copying{\checkenv{}\begingroup\scanargctxt\docopying} |
| 4918 | % Define a command to swallow text until we reach `@end copying'. | 5290 | \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} |
| 4919 | % \ is the escape char in this texinfo.tex file, so it is the | 5291 | % |
| 4920 | % delimiter for the command; @ will be the escape char when we read | 5292 | \def\insertcopying{% |
| 4921 | % it, but that doesn't matter. | 5293 | \begingroup |
| 4922 | \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}% | 5294 | \parindent = 0pt % paragraph indentation looks wrong on title page |
| 4923 | % | 5295 | \scanexp\copyingtext |
| 4924 | % We must preserve ^^M's in the input file; see \insertcopying below. | 5296 | \endgroup |
| 4925 | \catcode`\^^M = \active | ||
| 4926 | \docopying | ||
| 4927 | } | ||
| 4928 | |||
| 4929 | % What we do to finish off the copying text. | ||
| 4930 | % | ||
| 4931 | \def\enddocopying{\endgroup\ignorespaces} | ||
| 4932 | |||
| 4933 | % @insertcopying. Here we must play games with ^^M's. On the one hand, | ||
| 4934 | % we need them to delimit commands such as `@end quotation', so they | ||
| 4935 | % must be active. On the other hand, we certainly don't want every | ||
| 4936 | % end-of-line to be a \par, as would happen with the normal active | ||
| 4937 | % definition of ^^M. On the third hand, two ^^M's in a row should still | ||
| 4938 | % generate a \par. | ||
| 4939 | % | ||
| 4940 | % Our approach is to make ^^M insert a space and a penalty1 normally; | ||
| 4941 | % then it can also check if \lastpenalty=1. If it does, then manually | ||
| 4942 | % do \par. | ||
| 4943 | % | ||
| 4944 | % This messes up the normal definitions of @c[omment], so we redefine | ||
| 4945 | % it. Similarly for @ignore. (These commands are used in the gcc | ||
| 4946 | % manual for man page generation.) | ||
| 4947 | % | ||
| 4948 | % Seems pretty fragile, most line-oriented commands will presumably | ||
| 4949 | % fail, but for the limited use of getting the copying text (which | ||
| 4950 | % should be quite simple) inserted, we can hope it's ok. | ||
| 4951 | % | ||
| 4952 | {\catcode`\^^M=\active % | ||
| 4953 | \gdef\insertcopying{\begingroup % | ||
| 4954 | \parindent = 0pt % looks wrong on title page | ||
| 4955 | \def^^M{% | ||
| 4956 | \ifnum \lastpenalty=1 % | ||
| 4957 | \par % | ||
| 4958 | \else % | ||
| 4959 | \space \penalty 1 % | ||
| 4960 | \fi % | ||
| 4961 | }% | ||
| 4962 | % | ||
| 4963 | % Fix @c[omment] for catcode 13 ^^M's. | ||
| 4964 | \def\c##1^^M{\ignorespaces}% | ||
| 4965 | \let\comment = \c % | ||
| 4966 | % | ||
| 4967 | % Don't bother jumping through all the hoops that \doignore does, it | ||
| 4968 | % would be very hard since the catcodes are already set. | ||
| 4969 | \long\def\ignore##1\end ignore{\ignorespaces}% | ||
| 4970 | % | ||
| 4971 | \copyingtext % | ||
| 4972 | \endgroup}% | ||
| 4973 | } | 5297 | } |
| 4974 | 5298 | ||
| 4975 | \message{defuns,} | 5299 | \message{defuns,} |
| 4976 | % @defun etc. | 5300 | % @defun etc. |
| 4977 | 5301 | ||
| 4978 | % Allow user to change definition object font (\df) internally | ||
| 4979 | \def\setdeffont#1 {\csname DEF#1\endcsname} | ||
| 4980 | |||
| 4981 | \newskip\defbodyindent \defbodyindent=.4in | 5302 | \newskip\defbodyindent \defbodyindent=.4in |
| 4982 | \newskip\defargsindent \defargsindent=50pt | 5303 | \newskip\defargsindent \defargsindent=50pt |
| 4983 | \newskip\deflastargmargin \deflastargmargin=18pt | 5304 | \newskip\deflastargmargin \deflastargmargin=18pt |
| 4984 | 5305 | ||
| 4985 | \newcount\parencount | 5306 | % Start the processing of @deffn: |
| 4986 | 5307 | \def\startdefun{% | |
| 4987 | % We want ()&[] to print specially on the defun line. | 5308 | \ifnum\lastpenalty<10000 |
| 4988 | % | 5309 | \medbreak |
| 4989 | \def\activeparens{% | ||
| 4990 | \catcode`\(=\active \catcode`\)=\active | ||
| 4991 | \catcode`\&=\active | ||
| 4992 | \catcode`\[=\active \catcode`\]=\active | ||
| 4993 | } | ||
| 4994 | |||
| 4995 | % Make control sequences which act like normal parenthesis chars. | ||
| 4996 | \let\lparen = ( \let\rparen = ) | ||
| 4997 | |||
| 4998 | {\activeparens % Now, smart parens don't turn on until &foo (see \amprm) | ||
| 4999 | |||
| 5000 | % Be sure that we always have a definition for `(', etc. For example, | ||
| 5001 | % if the fn name has parens in it, \boldbrax will not be in effect yet, | ||
| 5002 | % so TeX would otherwise complain about undefined control sequence. | ||
| 5003 | \global\let(=\lparen \global\let)=\rparen | ||
| 5004 | \global\let[=\lbrack \global\let]=\rbrack | ||
| 5005 | |||
| 5006 | \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } | ||
| 5007 | \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} | ||
| 5008 | % This is used to turn on special parens | ||
| 5009 | % but make & act ordinary (given that it's active). | ||
| 5010 | \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} | ||
| 5011 | |||
| 5012 | % Definitions of (, ) and & used in args for functions. | ||
| 5013 | % This is the definition of ( outside of all parentheses. | ||
| 5014 | \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested | ||
| 5015 | \global\advance\parencount by 1 | ||
| 5016 | } | ||
| 5017 | % | ||
| 5018 | % This is the definition of ( when already inside a level of parens. | ||
| 5019 | \gdef\opnested{\char`\(\global\advance\parencount by 1 } | ||
| 5020 | % | ||
| 5021 | \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. | ||
| 5022 | % also in that case restore the outer-level definition of (. | ||
| 5023 | \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi | ||
| 5024 | \global\advance \parencount by -1 } | ||
| 5025 | % If we encounter &foo, then turn on ()-hacking afterwards | ||
| 5026 | \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } | ||
| 5027 | % | ||
| 5028 | \gdef\normalparens{\boldbrax\let&=\ampnr} | ||
| 5029 | } % End of definition inside \activeparens | ||
| 5030 | %% These parens (in \boldbrax) actually are a little bolder than the | ||
| 5031 | %% contained text. This is especially needed for [ and ] | ||
| 5032 | \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } | ||
| 5033 | \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } | ||
| 5034 | \let\ampnr = \& | ||
| 5035 | \def\lbrb{{\bf\char`\[}} | ||
| 5036 | \def\rbrb{{\bf\char`\]}} | ||
| 5037 | |||
| 5038 | % Active &'s sneak into the index arguments, so make sure it's defined. | ||
| 5039 | { | ||
| 5040 | \catcode`& = \active | ||
| 5041 | \global\let& = \ampnr | ||
| 5042 | } | ||
| 5043 | |||
| 5044 | % \defname, which formats the name of the @def (not the args). | ||
| 5045 | % #1 is the function name. | ||
| 5046 | % #2 is the type of definition, such as "Function". | ||
| 5047 | % | ||
| 5048 | \def\defname#1#2{% | ||
| 5049 | % How we'll output the type name. Putting it in brackets helps | ||
| 5050 | % distinguish it from the body text that may end up on the next line | ||
| 5051 | % just below it. | ||
| 5052 | \ifempty{#2}% | ||
| 5053 | \def\defnametype{}% | ||
| 5054 | \else | 5310 | \else |
| 5055 | \def\defnametype{[\rm #2]}% | 5311 | % If there are two @def commands in a row, we'll have a \nobreak, |
| 5312 | % which is there to keep the function description together with its | ||
| 5313 | % header. But if there's nothing but headers, we need to allow a | ||
| 5314 | % break somewhere. Check specifically for penalty 10002, inserted | ||
| 5315 | % by \defargscommonending, instead of 10000, since the sectioning | ||
| 5316 | % commands also insert a nobreak penalty, and we don't want to allow | ||
| 5317 | % a break between a section heading and a defun. | ||
| 5318 | % | ||
| 5319 | \ifnum\lastpenalty=10002 \penalty2000 \fi | ||
| 5320 | % | ||
| 5321 | % Similarly, after a section heading, do not allow a break. | ||
| 5322 | % But do insert the glue. | ||
| 5323 | \medskip % preceded by discardable penalty, so not a breakpoint | ||
| 5056 | \fi | 5324 | \fi |
| 5057 | % | 5325 | % |
| 5058 | % Get the values of \leftskip and \rightskip as they were outside the @def... | ||
| 5059 | \dimen2=\leftskip | ||
| 5060 | \advance\dimen2 by -\defbodyindent | ||
| 5061 | % | ||
| 5062 | % Figure out values for the paragraph shape. | ||
| 5063 | \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}% | ||
| 5064 | \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line | ||
| 5065 | \dimen1=\hsize \advance \dimen1 by -\defargsindent % size for continuations | ||
| 5066 | \parshape 2 0in \dimen0 \defargsindent \dimen1 | ||
| 5067 | % | ||
| 5068 | % Output arg 2 ("Function" or some such) but stuck inside a box of | ||
| 5069 | % width 0 so it does not interfere with linebreaking. | ||
| 5070 | \noindent | ||
| 5071 | % | ||
| 5072 | {% Adjust \hsize to exclude the ambient margins, | ||
| 5073 | % so that \rightline will obey them. | ||
| 5074 | \advance \hsize by -\dimen2 | ||
| 5075 | \dimen3 = 0pt % was -1.25pc | ||
| 5076 | \rlap{\rightline{\defnametype\kern\dimen3}}% | ||
| 5077 | }% | ||
| 5078 | % | ||
| 5079 | % Allow all lines to be underfull without complaint: | ||
| 5080 | \tolerance=10000 \hbadness=10000 | ||
| 5081 | \advance\leftskip by -\defbodyindent | ||
| 5082 | \exdentamount=\defbodyindent | ||
| 5083 | {\df #1}\enskip % output function name | ||
| 5084 | % \defunargs will be called next to output the arguments, if any. | ||
| 5085 | } | ||
| 5086 | |||
| 5087 | % Common pieces to start any @def... | ||
| 5088 | % #1 is the \E... control sequence to end the definition (which we define). | ||
| 5089 | % #2 is the \...x control sequence (which our caller defines). | ||
| 5090 | % #3 is the control sequence to process the header, such as \defunheader. | ||
| 5091 | % | ||
| 5092 | \def\parsebodycommon#1#2#3{% | ||
| 5093 | \begingroup\inENV | ||
| 5094 | % If there are two @def commands in a row, we'll have a \nobreak, | ||
| 5095 | % which is there to keep the function description together with its | ||
| 5096 | % header. But if there's nothing but headers, we want to allow a | ||
| 5097 | % break after all. Check for penalty 10002 (inserted by | ||
| 5098 | % \defargscommonending) instead of 10000, since the sectioning | ||
| 5099 | % commands insert a \penalty10000, and we don't want to allow a break | ||
| 5100 | % between a section heading and a defun. | ||
| 5101 | \ifnum\lastpenalty=10002 \penalty0 \fi | ||
| 5102 | \medbreak | ||
| 5103 | % | ||
| 5104 | % Define the \E... end token that this defining construct specifies | ||
| 5105 | % so that it will exit this group. | ||
| 5106 | \def#1{\endgraf\endgroup\medbreak}% | ||
| 5107 | % | ||
| 5108 | \parindent=0in | 5326 | \parindent=0in |
| 5109 | \advance\leftskip by \defbodyindent | 5327 | \advance\leftskip by \defbodyindent |
| 5110 | \exdentamount=\defbodyindent | 5328 | \exdentamount=\defbodyindent |
| 5111 | } | 5329 | } |
| 5112 | 5330 | ||
| 5113 | % Common part of the \...x definitions. | 5331 | \def\dodefunx#1{% |
| 5114 | % | 5332 | % First, check whether we are in the right environment: |
| 5115 | \def\defxbodycommon{% | 5333 | \checkenv#1% |
| 5116 | % As with \parsebodycommon above, allow line break if we have multiple | 5334 | % |
| 5117 | % x headers in a row. It's not a great place, though. | 5335 | % As above, allow line break if we have multiple x headers in a row. |
| 5118 | \ifnum\lastpenalty=10000 \penalty1000 \fi | 5336 | % It's not a great place, though. |
| 5337 | \ifnum\lastpenalty=10002 \penalty3000 \fi | ||
| 5119 | % | 5338 | % |
| 5120 | \begingroup\obeylines | 5339 | % And now, it's time to reuse the body of the original defun: |
| 5340 | \expandafter\gobbledefun#1% | ||
| 5121 | } | 5341 | } |
| 5342 | \def\gobbledefun#1\startdefun{} | ||
| 5122 | 5343 | ||
| 5123 | % Process body of @defun, @deffn, @defmac, etc. | 5344 | % \printdefunline \deffnheader{text} |
| 5124 | % | 5345 | % |
| 5125 | \def\defparsebody#1#2#3{% | 5346 | \def\printdefunline#1#2{% |
| 5126 | \parsebodycommon{#1}{#2}{#3}% | 5347 | \begingroup |
| 5127 | \def#2{\defxbodycommon \activeparens \spacesplit#3}% | 5348 | % call \deffnheader: |
| 5128 | \catcode\equalChar=\active | 5349 | #1#2 \endheader |
| 5129 | \begingroup\obeylines\activeparens | 5350 | % common ending: |
| 5130 | \spacesplit#3% | 5351 | \interlinepenalty = 10000 |
| 5352 | \advance\rightskip by 0pt plus 1fil | ||
| 5353 | \endgraf | ||
| 5354 | \nobreak\vskip -\parskip | ||
| 5355 | \penalty 10002 % signal to \startdefun and \dodefunx | ||
| 5356 | % Some of the @defun-type tags do not enable magic parentheses, | ||
| 5357 | % rendering the following check redundant. But we don't optimize. | ||
| 5358 | \checkparencounts | ||
| 5359 | \endgroup | ||
| 5131 | } | 5360 | } |
| 5132 | 5361 | ||
| 5133 | % #1, #2, #3 are the common arguments (see \parsebodycommon above). | 5362 | \def\Edefun{\endgraf\medbreak} |
| 5134 | % #4, delimited by the space, is the class name. | ||
| 5135 | % | ||
| 5136 | \def\defmethparsebody#1#2#3#4 {% | ||
| 5137 | \parsebodycommon{#1}{#2}{#3}% | ||
| 5138 | \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}% | ||
| 5139 | \begingroup\obeylines\activeparens | ||
| 5140 | % The \empty here prevents misinterpretation of a construct such as | ||
| 5141 | % @deffn {whatever} {Enharmonic comma} | ||
| 5142 | % See comments at \deftpparsebody, although in our case we don't have | ||
| 5143 | % to remove the \empty afterwards, since it is empty. | ||
| 5144 | \spacesplit{#3{#4}}\empty | ||
| 5145 | } | ||
| 5146 | 5363 | ||
| 5147 | % Used for @deftypemethod and @deftypeivar. | 5364 | % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; |
| 5148 | % #1, #2, #3 are the common arguments (see \defparsebody). | 5365 | % the only thing remainnig is to define \deffnheader. |
| 5149 | % #4, delimited by a space, is the class name. | ||
| 5150 | % #5 is the method's return type. | ||
| 5151 | % | 5366 | % |
| 5152 | \def\deftypemethparsebody#1#2#3#4 #5 {% | 5367 | \def\makedefun#1{% |
| 5153 | \parsebodycommon{#1}{#2}{#3}% | 5368 | \expandafter\let\csname E#1\endcsname = \Edefun |
| 5154 | \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}% | 5369 | \edef\temp{\noexpand\domakedefun |
| 5155 | \begingroup\obeylines\activeparens | 5370 | \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% |
| 5156 | \spacesplit{#3{#4}{#5}}% | 5371 | \temp |
| 5157 | } | 5372 | } |
| 5158 | 5373 | ||
| 5159 | % Used for @deftypeop. The change from \deftypemethparsebody is an | 5374 | % \domakedefun \deffn \deffnx \deffnheader |
| 5160 | % extra argument at the beginning which is the `category', instead of it | ||
| 5161 | % being the hardwired string `Method' or `Instance Variable'. We have | ||
| 5162 | % to account for this both in the \...x definition and in parsing the | ||
| 5163 | % input at hand. Thus also need a control sequence (passed as #5) for | ||
| 5164 | % the \E... definition to assign the category name to. | ||
| 5165 | % | 5375 | % |
| 5166 | \def\deftypeopparsebody#1#2#3#4#5 #6 {% | 5376 | % Define \deffn and \deffnx, without parameters. |
| 5167 | \parsebodycommon{#1}{#2}{#3}% | 5377 | % \deffnheader has to be defined explicitly. |
| 5168 | \def#2##1 ##2 ##3 {\def#4{##1}% | ||
| 5169 | \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}% | ||
| 5170 | \begingroup\obeylines\activeparens | ||
| 5171 | \spacesplit{#3{#5}{#6}}% | ||
| 5172 | } | ||
| 5173 | |||
| 5174 | % For @defop. | ||
| 5175 | \def\defopparsebody #1#2#3#4#5 {% | ||
| 5176 | \parsebodycommon{#1}{#2}{#3}% | ||
| 5177 | \def#2##1 ##2 {\def#4{##1}% | ||
| 5178 | \defxbodycommon \activeparens \spacesplit{#3{##2}}}% | ||
| 5179 | \begingroup\obeylines\activeparens | ||
| 5180 | \spacesplit{#3{#5}}% | ||
| 5181 | } | ||
| 5182 | |||
| 5183 | % These parsing functions are similar to the preceding ones | ||
| 5184 | % except that they do not make parens into active characters. | ||
| 5185 | % These are used for "variables" since they have no arguments. | ||
| 5186 | % | 5378 | % |
| 5187 | \def\defvarparsebody #1#2#3{% | 5379 | \def\domakedefun#1#2#3{% |
| 5188 | \parsebodycommon{#1}{#2}{#3}% | 5380 | \envdef#1{% |
| 5189 | \def#2{\defxbodycommon \spacesplit#3}% | 5381 | \startdefun |
| 5190 | \catcode\equalChar=\active | 5382 | \parseargusing\activeparens{\printdefunline#3}% |
| 5191 | \begingroup\obeylines | 5383 | }% |
| 5192 | \spacesplit#3% | 5384 | \def#2{\dodefunx#1}% |
| 5385 | \def#3% | ||
| 5193 | } | 5386 | } |
| 5194 | 5387 | ||
| 5195 | % @defopvar. | 5388 | %%% Untyped functions: |
| 5196 | \def\defopvarparsebody #1#2#3#4#5 {% | ||
| 5197 | \parsebodycommon{#1}{#2}{#3}% | ||
| 5198 | \def#2##1 ##2 {\def#4{##1}% | ||
| 5199 | \defxbodycommon \spacesplit{#3{##2}}}% | ||
| 5200 | \begingroup\obeylines | ||
| 5201 | \spacesplit{#3{#5}}% | ||
| 5202 | } | ||
| 5203 | 5389 | ||
| 5204 | \def\defvrparsebody#1#2#3#4 {% | 5390 | % @deffn category name args |
| 5205 | \parsebodycommon{#1}{#2}{#3}% | 5391 | \makedefun{deffn}{\deffngeneral{}} |
| 5206 | \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}% | ||
| 5207 | \begingroup\obeylines | ||
| 5208 | \spacesplit{#3{#4}}% | ||
| 5209 | } | ||
| 5210 | 5392 | ||
| 5211 | % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the | 5393 | % @deffn category class name args |
| 5212 | % type is just `struct', because we lose the braces in `{struct | 5394 | \makedefun{defop}#1 {\defopon{#1\ \putwordon}} |
| 5213 | % termios}' when \spacesplit reads its undelimited argument. Sigh. | ||
| 5214 | % \let\deftpparsebody=\defvrparsebody | ||
| 5215 | % | ||
| 5216 | % So, to get around this, we put \empty in with the type name. That | ||
| 5217 | % way, TeX won't find exactly `{...}' as an undelimited argument, and | ||
| 5218 | % won't strip off the braces. | ||
| 5219 | % | ||
| 5220 | \def\deftpparsebody #1#2#3#4 {% | ||
| 5221 | \parsebodycommon{#1}{#2}{#3}% | ||
| 5222 | \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}% | ||
| 5223 | \begingroup\obeylines | ||
| 5224 | \spacesplit{\parsetpheaderline{#3{#4}}}\empty | ||
| 5225 | } | ||
| 5226 | |||
| 5227 | % Fine, but then we have to eventually remove the \empty *and* the | ||
| 5228 | % braces (if any). That's what this does. | ||
| 5229 | % | ||
| 5230 | \def\removeemptybraces\empty#1\relax{#1} | ||
| 5231 | 5395 | ||
| 5232 | % After \spacesplit has done its work, this is called -- #1 is the final | 5396 | % \defopon {category on}class name args |
| 5233 | % thing to call, #2 the type name (which starts with \empty), and #3 | 5397 | \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } |
| 5234 | % (which might be empty) the arguments. | ||
| 5235 | % | ||
| 5236 | \def\parsetpheaderline#1#2#3{% | ||
| 5237 | #1{\removeemptybraces#2\relax}{#3}% | ||
| 5238 | }% | ||
| 5239 | 5398 | ||
| 5240 | % Split up #2 (the rest of the input line) at the first space token. | 5399 | % \deffngeneral {subind}category name args |
| 5241 | % call #1 with two arguments: | ||
| 5242 | % the first is all of #2 before the space token, | ||
| 5243 | % the second is all of #2 after that space token. | ||
| 5244 | % If #2 contains no space token, all of it is passed as the first arg | ||
| 5245 | % and the second is passed as empty. | ||
| 5246 | % | 5400 | % |
| 5247 | {\obeylines % | 5401 | \def\deffngeneral#1#2 #3 #4\endheader{% |
| 5248 | \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}% | 5402 | % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. |
| 5249 | \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{% | 5403 | \dosubind{fn}{\code{#3}}{#1}% |
| 5250 | \ifx\relax #3% | 5404 | \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% |
| 5251 | #1{#2}{}% | ||
| 5252 | \else % | ||
| 5253 | #1{#2}{#3#4}% | ||
| 5254 | \fi}% | ||
| 5255 | } | 5405 | } |
| 5256 | 5406 | ||
| 5257 | % Define @defun. | 5407 | %%% Typed functions: |
| 5258 | 5408 | ||
| 5259 | % This is called to end the arguments processing for all the @def... commands. | 5409 | % @deftypefn category type name args |
| 5260 | % | 5410 | \makedefun{deftypefn}{\deftypefngeneral{}} |
| 5261 | \def\defargscommonending{% | ||
| 5262 | \interlinepenalty = 10000 | ||
| 5263 | \advance\rightskip by 0pt plus 1fil | ||
| 5264 | \endgraf | ||
| 5265 | \nobreak\vskip -\parskip | ||
| 5266 | \penalty 10002 % signal to \parsebodycommon. | ||
| 5267 | } | ||
| 5268 | |||
| 5269 | % This expands the args and terminates the paragraph they comprise. | ||
| 5270 | % | ||
| 5271 | \def\defunargs#1{\functionparens \sl | ||
| 5272 | % Expand, preventing hyphenation at `-' chars. | ||
| 5273 | % Note that groups don't affect changes in \hyphenchar. | ||
| 5274 | % Set the font temporarily and use \font in case \setfont made \tensl a macro. | ||
| 5275 | {\tensl\hyphenchar\font=0}% | ||
| 5276 | #1% | ||
| 5277 | {\tensl\hyphenchar\font=45}% | ||
| 5278 | \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% | ||
| 5279 | \defargscommonending | ||
| 5280 | } | ||
| 5281 | |||
| 5282 | \def\deftypefunargs #1{% | ||
| 5283 | % Expand, preventing hyphenation at `-' chars. | ||
| 5284 | % Note that groups don't affect changes in \hyphenchar. | ||
| 5285 | % Use \boldbraxnoamp, not \functionparens, so that & is not special. | ||
| 5286 | \boldbraxnoamp | ||
| 5287 | \tclose{#1}% avoid \code because of side effects on active chars | ||
| 5288 | \defargscommonending | ||
| 5289 | } | ||
| 5290 | 5411 | ||
| 5291 | % Do complete processing of one @defun or @defunx line already parsed. | 5412 | % @deftypeop category class type name args |
| 5413 | \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} | ||
| 5292 | 5414 | ||
| 5293 | % @deffn Command forward-char nchars | 5415 | % \deftypeopon {category on}class type name args |
| 5416 | \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } | ||
| 5294 | 5417 | ||
| 5295 | \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} | 5418 | % \deftypefngeneral {subind}category type name args |
| 5296 | 5419 | % | |
| 5297 | \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% | 5420 | \def\deftypefngeneral#1#2 #3 #4 #5\endheader{% |
| 5298 | \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % | 5421 | \dosubind{fn}{\code{#4}}{#1}% |
| 5299 | \catcode\equalChar=\other % Turn off change made in \defparsebody | 5422 | \defname{#2}{#3}{#4}\defunargs{#5\unskip}% |
| 5300 | } | 5423 | } |
| 5301 | 5424 | ||
| 5302 | % @defun == @deffn Function | 5425 | %%% Typed variables: |
| 5303 | 5426 | ||
| 5304 | \def\defun{\defparsebody\Edefun\defunx\defunheader} | 5427 | % @deftypevr category type var args |
| 5428 | \makedefun{deftypevr}{\deftypecvgeneral{}} | ||
| 5305 | 5429 | ||
| 5306 | \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index | 5430 | % @deftypecv category class type var args |
| 5307 | \begingroup\defname {#1}{\putwordDeffunc}% | 5431 | \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} |
| 5308 | \defunargs {#2}\endgroup % | ||
| 5309 | \catcode\equalChar=\other % Turn off change made in \defparsebody | ||
| 5310 | } | ||
| 5311 | 5432 | ||
| 5312 | % @deftypefun int foobar (int @var{foo}, float @var{bar}) | 5433 | % \deftypecvof {category of}class type var args |
| 5434 | \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } | ||
| 5313 | 5435 | ||
| 5314 | \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} | 5436 | % \deftypecvgeneral {subind}category type var args |
| 5315 | 5437 | % | |
| 5316 | % #1 is the data type. #2 is the name and args. | 5438 | \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% |
| 5317 | \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} | 5439 | \dosubind{vr}{\code{#4}}{#1}% |
| 5318 | % #1 is the data type, #2 the name, #3 the args. | 5440 | \defname{#2}{#3}{#4}\defunargs{#5\unskip}% |
| 5319 | \def\deftypefunheaderx #1#2 #3\relax{% | ||
| 5320 | \doind {fn}{\code{#2}}% Make entry in function index | ||
| 5321 | \begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}% | ||
| 5322 | \deftypefunargs {#3}\endgroup % | ||
| 5323 | \catcode\equalChar=\other % Turn off change made in \defparsebody | ||
| 5324 | } | 5441 | } |
| 5325 | 5442 | ||
| 5326 | % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) | 5443 | %%% Untyped variables: |
| 5327 | 5444 | ||
| 5328 | \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} | 5445 | % @defvr category var args |
| 5446 | \makedefun{defvr}#1 {\deftypevrheader{#1} {} } | ||
| 5329 | 5447 | ||
| 5330 | % \defheaderxcond#1\relax$.$ | 5448 | % @defcv category class var args |
| 5331 | % puts #1 in @code, followed by a space, but does nothing if #1 is null. | 5449 | \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} |
| 5332 | \def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi} | ||
| 5333 | 5450 | ||
| 5334 | % #1 is the classification. #2 is the data type. #3 is the name and args. | 5451 | % \defcvof {category of}class var args |
| 5335 | \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} | 5452 | \def\defcvof#1#2 {\deftypecvof{#1}#2 {} } |
| 5336 | % #1 is the classification, #2 the data type, #3 the name, #4 the args. | ||
| 5337 | \def\deftypefnheaderx #1#2#3 #4\relax{% | ||
| 5338 | \doind {fn}{\code{#3}}% Make entry in function index | ||
| 5339 | \begingroup | ||
| 5340 | \normalparens % notably, turn off `&' magic, which prevents | ||
| 5341 | % at least some C++ text from working | ||
| 5342 | \defname {\defheaderxcond#2\relax$.$#3}{#1}% | ||
| 5343 | \deftypefunargs {#4}\endgroup % | ||
| 5344 | \catcode\equalChar=\other % Turn off change made in \defparsebody | ||
| 5345 | } | ||
| 5346 | |||
| 5347 | % @defmac == @deffn Macro | ||
| 5348 | 5453 | ||
| 5349 | \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} | 5454 | %%% Type: |
| 5350 | 5455 | % @deftp category name args | |
| 5351 | \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index | 5456 | \makedefun{deftp}#1 #2 #3\endheader{% |
| 5352 | \begingroup\defname {#1}{\putwordDefmac}% | 5457 | \doind{tp}{\code{#2}}% |
| 5353 | \defunargs {#2}\endgroup % | 5458 | \defname{#1}{}{#2}\defunargs{#3\unskip}% |
| 5354 | \catcode\equalChar=\other % Turn off change made in \defparsebody | ||
| 5355 | } | 5459 | } |
| 5356 | 5460 | ||
| 5357 | % @defspec == @deffn Special Form | 5461 | % Remaining @defun-like shortcuts: |
| 5358 | 5462 | \makedefun{defun}{\deffnheader{\putwordDeffunc} } | |
| 5359 | \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} | 5463 | \makedefun{defmac}{\deffnheader{\putwordDefmac} } |
| 5464 | \makedefun{defspec}{\deffnheader{\putwordDefspec} } | ||
| 5465 | \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } | ||
| 5466 | \makedefun{defvar}{\defvrheader{\putwordDefvar} } | ||
| 5467 | \makedefun{defopt}{\defvrheader{\putwordDefopt} } | ||
| 5468 | \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } | ||
| 5469 | \makedefun{defmethod}{\defopon\putwordMethodon} | ||
| 5470 | \makedefun{deftypemethod}{\deftypeopon\putwordMethodon} | ||
| 5471 | \makedefun{defivar}{\defcvof\putwordInstanceVariableof} | ||
| 5472 | \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} | ||
| 5360 | 5473 | ||
| 5361 | \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index | 5474 | % \defname, which formats the name of the @def (not the args). |
| 5362 | \begingroup\defname {#1}{\putwordDefspec}% | 5475 | % #1 is the category, such as "Function". |
| 5363 | \defunargs {#2}\endgroup % | 5476 | % #2 is the return type, if any. |
| 5364 | \catcode\equalChar=\other % Turn off change made in \defparsebody | 5477 | % #3 is the function name. |
| 5365 | } | ||
| 5366 | |||
| 5367 | % @defop CATEGORY CLASS OPERATION ARG... | ||
| 5368 | % | 5478 | % |
| 5369 | \def\defop #1 {\def\defoptype{#1}% | 5479 | % We are followed by (but not passed) the arguments, if any. |
| 5370 | \defopparsebody\Edefop\defopx\defopheader\defoptype} | ||
| 5371 | % | 5480 | % |
| 5372 | \def\defopheader#1#2#3{% | 5481 | \def\defname#1#2#3{% |
| 5373 | \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry | 5482 | % Get the values of \leftskip and \rightskip as they were outside the @def... |
| 5374 | \begingroup | 5483 | \advance\leftskip by -\defbodyindent |
| 5375 | \defname{#2}{\defoptype\ \putwordon\ #1}% | 5484 | % |
| 5376 | \defunargs{#3}% | 5485 | % How we'll format the type name. Putting it in brackets helps |
| 5377 | \endgroup | 5486 | % distinguish it from the body text that may end up on the next line |
| 5487 | % just below it. | ||
| 5488 | \def\temp{#1}% | ||
| 5489 | \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} | ||
| 5490 | % | ||
| 5491 | % Figure out line sizes for the paragraph shape. | ||
| 5492 | % The first line needs space for \box0; but if \rightskip is nonzero, | ||
| 5493 | % we need only space for the part of \box0 which exceeds it: | ||
| 5494 | \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip | ||
| 5495 | % The continuations: | ||
| 5496 | \dimen2=\hsize \advance\dimen2 by -\defargsindent | ||
| 5497 | % (plain.tex says that \dimen1 should be used only as global.) | ||
| 5498 | \parshape 2 0in \dimen0 \defargsindent \dimen2 | ||
| 5499 | % | ||
| 5500 | % Put the type name to the right margin. | ||
| 5501 | \noindent | ||
| 5502 | \hbox to 0pt{% | ||
| 5503 | \hfil\box0 \kern-\hsize | ||
| 5504 | % \hsize has to be shortened this way: | ||
| 5505 | \kern\leftskip | ||
| 5506 | % Intentionally do not respect \rightskip, since we need the space. | ||
| 5507 | }% | ||
| 5508 | % | ||
| 5509 | % Allow all lines to be underfull without complaint: | ||
| 5510 | \tolerance=10000 \hbadness=10000 | ||
| 5511 | \exdentamount=\defbodyindent | ||
| 5512 | {% | ||
| 5513 | % defun fonts. We use typewriter by default (used to be bold) because: | ||
| 5514 | % . we're printing identifiers, they should be in tt in principle. | ||
| 5515 | % . in languages with many accents, such as Czech or French, it's | ||
| 5516 | % common to leave accents off identifiers. The result looks ok in | ||
| 5517 | % tt, but exceedingly strange in rm. | ||
| 5518 | % . we don't want -- and --- to be treated as ligatures. | ||
| 5519 | % . this still does not fix the ?` and !` ligatures, but so far no | ||
| 5520 | % one has made identifiers using them :). | ||
| 5521 | \df \tt | ||
| 5522 | \def\temp{#2}% return value type | ||
| 5523 | \ifx\temp\empty\else \tclose{\temp} \fi | ||
| 5524 | #3% output function name | ||
| 5525 | }% | ||
| 5526 | {\rm\enskip}% hskip 0.5 em of \tenrm | ||
| 5527 | % | ||
| 5528 | \boldbrax | ||
| 5529 | % arguments will be output next, if any. | ||
| 5378 | } | 5530 | } |
| 5379 | 5531 | ||
| 5380 | % @deftypeop CATEGORY CLASS TYPE OPERATION ARG... | 5532 | % Print arguments in slanted roman (not ttsl), inconsistently with using |
| 5533 | % tt for the name. This is because literal text is sometimes needed in | ||
| 5534 | % the argument list (groff manual), and ttsl and tt are not very | ||
| 5535 | % distinguishable. Prevent hyphenation at `-' chars. | ||
| 5381 | % | 5536 | % |
| 5382 | \def\deftypeop #1 {\def\deftypeopcategory{#1}% | 5537 | \def\defunargs#1{% |
| 5383 | \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader | 5538 | % use sl by default (not ttsl), |
| 5384 | \deftypeopcategory} | 5539 | % tt for the names. |
| 5385 | % | 5540 | \df \sl \hyphenchar\font=0 |
| 5386 | % #1 is the class name, #2 the data type, #3 the operation name, #4 the args. | 5541 | % |
| 5387 | \def\deftypeopheader#1#2#3#4{% | 5542 | % On the other hand, if an argument has two dashes (for instance), we |
| 5388 | \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index | 5543 | % want a way to get ttsl. Let's try @var for that. |
| 5389 | \begingroup | 5544 | \let\var=\ttslanted |
| 5390 | \defname{\defheaderxcond#2\relax$.$#3} | 5545 | #1% |
| 5391 | {\deftypeopcategory\ \putwordon\ \code{#1}}% | 5546 | \sl\hyphenchar\font=45 |
| 5392 | \deftypefunargs{#4}% | ||
| 5393 | \endgroup | ||
| 5394 | } | 5547 | } |
| 5395 | 5548 | ||
| 5396 | % @deftypemethod CLASS TYPE METHOD ARG... | 5549 | % We want ()&[] to print specially on the defun line. |
| 5397 | % | ||
| 5398 | \def\deftypemethod{% | ||
| 5399 | \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} | ||
| 5400 | % | 5550 | % |
| 5401 | % #1 is the class name, #2 the data type, #3 the method name, #4 the args. | 5551 | \def\activeparens{% |
| 5402 | \def\deftypemethodheader#1#2#3#4{% | 5552 | \catcode`\(=\active \catcode`\)=\active |
| 5403 | \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index | 5553 | \catcode`\[=\active \catcode`\]=\active |
| 5404 | \begingroup | 5554 | \catcode`\&=\active |
| 5405 | \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}% | ||
| 5406 | \deftypefunargs{#4}% | ||
| 5407 | \endgroup | ||
| 5408 | } | 5555 | } |
| 5409 | 5556 | ||
| 5410 | % @deftypeivar CLASS TYPE VARNAME | 5557 | % Make control sequences which act like normal parenthesis chars. |
| 5411 | % | 5558 | \let\lparen = ( \let\rparen = ) |
| 5412 | \def\deftypeivar{% | ||
| 5413 | \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader} | ||
| 5414 | % | ||
| 5415 | % #1 is the class name, #2 the data type, #3 the variable name. | ||
| 5416 | \def\deftypeivarheader#1#2#3{% | ||
| 5417 | \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index | ||
| 5418 | \begingroup | ||
| 5419 | \defname{\defheaderxcond#2\relax$.$#3} | ||
| 5420 | {\putwordInstanceVariableof\ \code{#1}}% | ||
| 5421 | \defvarargs{#3}% | ||
| 5422 | \endgroup | ||
| 5423 | } | ||
| 5424 | 5559 | ||
| 5425 | % @defmethod == @defop Method | 5560 | % Be sure that we always have a definition for `(', etc. For example, |
| 5426 | % | 5561 | % if the fn name has parens in it, \boldbrax will not be in effect yet, |
| 5427 | \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} | 5562 | % so TeX would otherwise complain about undefined control sequence. |
| 5428 | % | 5563 | { |
| 5429 | % #1 is the class name, #2 the method name, #3 the args. | 5564 | \activeparens |
| 5430 | \def\defmethodheader#1#2#3{% | 5565 | \global\let(=\lparen \global\let)=\rparen |
| 5431 | \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index | 5566 | \global\let[=\lbrack \global\let]=\rbrack |
| 5432 | \begingroup | 5567 | \global\let& = \& |
| 5433 | \defname{#2}{\putwordMethodon\ \code{#1}}% | ||
| 5434 | \defunargs{#3}% | ||
| 5435 | \endgroup | ||
| 5436 | } | ||
| 5437 | 5568 | ||
| 5438 | % @defcv {Class Option} foo-class foo-flag | 5569 | \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} |
| 5570 | \gdef\magicamp{\let&=\amprm} | ||
| 5571 | } | ||
| 5439 | 5572 | ||
| 5440 | \def\defcv #1 {\def\defcvtype{#1}% | 5573 | \newcount\parencount |
| 5441 | \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} | ||
| 5442 | 5574 | ||
| 5443 | \def\defcvarheader #1#2#3{% | 5575 | % If we encounter &foo, then turn on ()-hacking afterwards |
| 5444 | \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry | 5576 | \newif\ifampseen |
| 5445 | \begingroup | 5577 | \def\amprm#1 {\ampseentrue{\bf\ }} |
| 5446 | \defname{#2}{\defcvtype\ \putwordof\ #1}% | 5578 | |
| 5447 | \defvarargs{#3}% | 5579 | \def\parenfont{% |
| 5448 | \endgroup | 5580 | \ifampseen |
| 5581 | % At the first level, print parens in roman, | ||
| 5582 | % otherwise use the default font. | ||
| 5583 | \ifnum \parencount=1 \rm \fi | ||
| 5584 | \else | ||
| 5585 | % The \sf parens (in \boldbrax) actually are a little bolder than | ||
| 5586 | % the contained text. This is especially needed for [ and ] . | ||
| 5587 | \sf | ||
| 5588 | \fi | ||
| 5449 | } | 5589 | } |
| 5450 | 5590 | \def\infirstlevel#1{% | |
| 5451 | % @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME | 5591 | \ifampseen |
| 5452 | % | 5592 | \ifnum\parencount=1 |
| 5453 | \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} | 5593 | #1% |
| 5454 | % | 5594 | \fi |
| 5455 | \def\defivarheader#1#2#3{% | 5595 | \fi |
| 5456 | \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index | ||
| 5457 | \begingroup | ||
| 5458 | \defname{#2}{\putwordInstanceVariableof\ #1}% | ||
| 5459 | \defvarargs{#3}% | ||
| 5460 | \endgroup | ||
| 5461 | } | 5596 | } |
| 5597 | \def\bfafterword#1 {#1 \bf} | ||
| 5462 | 5598 | ||
| 5463 | % @defvar | 5599 | \def\opnr{% |
| 5464 | % First, define the processing that is wanted for arguments of @defvar. | 5600 | \global\advance\parencount by 1 |
| 5465 | % This is actually simple: just print them in roman. | 5601 | {\parenfont(}% |
| 5466 | % This must expand the args and terminate the paragraph they make up | 5602 | \infirstlevel \bfafterword |
| 5467 | \def\defvarargs #1{\normalparens #1% | ||
| 5468 | \defargscommonending | ||
| 5469 | } | 5603 | } |
| 5470 | 5604 | \def\clnr{% | |
| 5471 | % @defvr Counter foo-count | 5605 | {\parenfont)}% |
| 5472 | 5606 | \infirstlevel \sl | |
| 5473 | \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} | 5607 | \global\advance\parencount by -1 |
| 5474 | |||
| 5475 | \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% | ||
| 5476 | \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} | ||
| 5477 | |||
| 5478 | % @defvar == @defvr Variable | ||
| 5479 | |||
| 5480 | \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} | ||
| 5481 | |||
| 5482 | \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index | ||
| 5483 | \begingroup\defname {#1}{\putwordDefvar}% | ||
| 5484 | \defvarargs {#2}\endgroup % | ||
| 5485 | } | 5608 | } |
| 5486 | 5609 | ||
| 5487 | % @defopt == @defvr {User Option} | 5610 | \newcount\brackcount |
| 5488 | 5611 | \def\lbrb{% | |
| 5489 | \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} | 5612 | \global\advance\brackcount by 1 |
| 5490 | 5613 | {\bf[}% | |
| 5491 | \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index | 5614 | } |
| 5492 | \begingroup\defname {#1}{\putwordDefopt}% | 5615 | \def\rbrb{% |
| 5493 | \defvarargs {#2}\endgroup % | 5616 | {\bf]}% |
| 5617 | \global\advance\brackcount by -1 | ||
| 5494 | } | 5618 | } |
| 5495 | 5619 | ||
| 5496 | % @deftypevar int foobar | 5620 | \def\checkparencounts{% |
| 5497 | 5621 | \ifnum\parencount=0 \else \badparencount \fi | |
| 5498 | \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} | 5622 | \ifnum\brackcount=0 \else \badbrackcount \fi |
| 5499 | 5623 | } | |
| 5500 | % #1 is the data type. #2 is the name, perhaps followed by text that | 5624 | \def\badparencount{% |
| 5501 | % is actually part of the data type, which should not be put into the index. | 5625 | \errmessage{Unbalanced parentheses in @def}% |
| 5502 | \def\deftypevarheader #1#2{% | 5626 | \global\parencount=0 |
| 5503 | \dovarind#2 \relax% Make entry in variables index | 5627 | } |
| 5504 | \begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}% | 5628 | \def\badbrackcount{% |
| 5505 | \defargscommonending | 5629 | \errmessage{Unbalanced square braces in @def}% |
| 5506 | \endgroup} | 5630 | \global\brackcount=0 |
| 5507 | \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} | 5631 | } |
| 5508 | |||
| 5509 | % @deftypevr {Global Flag} int enable | ||
| 5510 | |||
| 5511 | \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} | ||
| 5512 | |||
| 5513 | \def\deftypevrheader #1#2#3{\dovarind#3 \relax% | ||
| 5514 | \begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1} | ||
| 5515 | \defargscommonending | ||
| 5516 | \endgroup} | ||
| 5517 | |||
| 5518 | % Now define @deftp | ||
| 5519 | % Args are printed in bold, a slight difference from @defvar. | ||
| 5520 | |||
| 5521 | \def\deftpargs #1{\bf \defvarargs{#1}} | ||
| 5522 | |||
| 5523 | % @deftp Class window height width ... | ||
| 5524 | |||
| 5525 | \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} | ||
| 5526 | |||
| 5527 | \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% | ||
| 5528 | \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} | ||
| 5529 | |||
| 5530 | % These definitions are used if you use @defunx (etc.) | ||
| 5531 | % anywhere other than immediately after a @defun or @defunx. | ||
| 5532 | % | ||
| 5533 | \def\defcvx#1 {\errmessage{@defcvx in invalid context}} | ||
| 5534 | \def\deffnx#1 {\errmessage{@deffnx in invalid context}} | ||
| 5535 | \def\defivarx#1 {\errmessage{@defivarx in invalid context}} | ||
| 5536 | \def\defmacx#1 {\errmessage{@defmacx in invalid context}} | ||
| 5537 | \def\defmethodx#1 {\errmessage{@defmethodx in invalid context}} | ||
| 5538 | \def\defoptx #1 {\errmessage{@defoptx in invalid context}} | ||
| 5539 | \def\defopx#1 {\errmessage{@defopx in invalid context}} | ||
| 5540 | \def\defspecx#1 {\errmessage{@defspecx in invalid context}} | ||
| 5541 | \def\deftpx#1 {\errmessage{@deftpx in invalid context}} | ||
| 5542 | \def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}} | ||
| 5543 | \def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}} | ||
| 5544 | \def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}} | ||
| 5545 | \def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}} | ||
| 5546 | \def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}} | ||
| 5547 | \def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}} | ||
| 5548 | \def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}} | ||
| 5549 | \def\defunx#1 {\errmessage{@defunx in invalid context}} | ||
| 5550 | \def\defvarx#1 {\errmessage{@defvarx in invalid context}} | ||
| 5551 | \def\defvrx#1 {\errmessage{@defvrx in invalid context}} | ||
| 5552 | 5632 | ||
| 5553 | 5633 | ||
| 5554 | \message{macros,} | 5634 | \message{macros,} |
| @@ -5557,42 +5637,69 @@ width0pt\relax} \fi | |||
| 5557 | % To do this right we need a feature of e-TeX, \scantokens, | 5637 | % To do this right we need a feature of e-TeX, \scantokens, |
| 5558 | % which we arrange to emulate with a temporary file in ordinary TeX. | 5638 | % which we arrange to emulate with a temporary file in ordinary TeX. |
| 5559 | \ifx\eTeXversion\undefined | 5639 | \ifx\eTeXversion\undefined |
| 5560 | \newwrite\macscribble | 5640 | \newwrite\macscribble |
| 5561 | \def\scanmacro#1{% | 5641 | \def\scantokens#1{% |
| 5562 | \begingroup \newlinechar`\^^M | 5642 | \toks0={#1}% |
| 5563 | % Undo catcode changes of \startcontents and \doprintindex | 5643 | \immediate\openout\macscribble=\jobname.tmp |
| 5564 | \catcode`\@=0 \catcode`\\=\other \escapechar=`\@ | 5644 | \immediate\write\macscribble{\the\toks0}% |
| 5565 | % Append \endinput to make sure that TeX does not see the ending newline. | 5645 | \immediate\closeout\macscribble |
| 5566 | \toks0={#1\endinput}% | 5646 | \input \jobname.tmp |
| 5567 | \immediate\openout\macscribble=\jobname.tmp | 5647 | } |
| 5568 | \immediate\write\macscribble{\the\toks0}% | ||
| 5569 | \immediate\closeout\macscribble | ||
| 5570 | \let\xeatspaces\eatspaces | ||
| 5571 | \input \jobname.tmp | ||
| 5572 | \endgroup | ||
| 5573 | } | ||
| 5574 | \else | ||
| 5575 | \def\scanmacro#1{% | ||
| 5576 | \begingroup \newlinechar`\^^M | ||
| 5577 | % Undo catcode changes of \startcontents and \doprintindex | ||
| 5578 | \catcode`\@=0 \catcode`\\=\other \escapechar=`\@ | ||
| 5579 | \let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} | ||
| 5580 | \fi | 5648 | \fi |
| 5581 | 5649 | ||
| 5650 | \def\scanmacro#1{% | ||
| 5651 | \begingroup | ||
| 5652 | \newlinechar`\^^M | ||
| 5653 | \let\xeatspaces\eatspaces | ||
| 5654 | % Undo catcode changes of \startcontents and \doprintindex | ||
| 5655 | % When called from @insertcopying or (short)caption, we need active | ||
| 5656 | % backslash to get it printed correctly. Previously, we had | ||
| 5657 | % \catcode`\\=\other instead. We'll see whether a problem appears | ||
| 5658 | % with macro expansion. --kasal, 19aug04 | ||
| 5659 | \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ | ||
| 5660 | % ... and \example | ||
| 5661 | \spaceisspace | ||
| 5662 | % | ||
| 5663 | % Append \endinput to make sure that TeX does not see the ending newline. | ||
| 5664 | % | ||
| 5665 | % I've verified that it is necessary both for e-TeX and for ordinary TeX | ||
| 5666 | % --kasal, 29nov03 | ||
| 5667 | \scantokens{#1\endinput}% | ||
| 5668 | \endgroup | ||
| 5669 | } | ||
| 5670 | |||
| 5671 | \def\scanexp#1{% | ||
| 5672 | \edef\temp{\noexpand\scanmacro{#1}}% | ||
| 5673 | \temp | ||
| 5674 | } | ||
| 5675 | |||
| 5582 | \newcount\paramno % Count of parameters | 5676 | \newcount\paramno % Count of parameters |
| 5583 | \newtoks\macname % Macro name | 5677 | \newtoks\macname % Macro name |
| 5584 | \newif\ifrecursive % Is it recursive? | 5678 | \newif\ifrecursive % Is it recursive? |
| 5585 | \def\macrolist{} % List of all defined macros in the form | 5679 | |
| 5586 | % \do\macro1\do\macro2... | 5680 | % List of all defined macros in the form |
| 5681 | % \definedummyword\macro1\definedummyword\macro2... | ||
| 5682 | % Currently is also contains all @aliases; the list can be split | ||
| 5683 | % if there is a need. | ||
| 5684 | \def\macrolist{} | ||
| 5685 | |||
| 5686 | % Add the macro to \macrolist | ||
| 5687 | \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} | ||
| 5688 | \def\addtomacrolistxxx#1{% | ||
| 5689 | \toks0 = \expandafter{\macrolist\definedummyword#1}% | ||
| 5690 | \xdef\macrolist{\the\toks0}% | ||
| 5691 | } | ||
| 5587 | 5692 | ||
| 5588 | % Utility routines. | 5693 | % Utility routines. |
| 5589 | % Thisdoes \let #1 = #2, except with \csnames. | 5694 | % This does \let #1 = #2, with \csnames; that is, |
| 5695 | % \let \csname#1\endcsname = \csname#2\endcsname | ||
| 5696 | % (except of course we have to play expansion games). | ||
| 5697 | % | ||
| 5590 | \def\cslet#1#2{% | 5698 | \def\cslet#1#2{% |
| 5591 | \expandafter\expandafter | 5699 | \expandafter\let |
| 5592 | \expandafter\let | 5700 | \csname#1\expandafter\endcsname |
| 5593 | \expandafter\expandafter | 5701 | \csname#2\endcsname |
| 5594 | \csname#1\endcsname | 5702 | } |
| 5595 | \csname#2\endcsname} | ||
| 5596 | 5703 | ||
| 5597 | % Trim leading and trailing spaces off a string. | 5704 | % Trim leading and trailing spaces off a string. |
| 5598 | % Concepts from aro-bend problem 15 (see CTAN). | 5705 | % Concepts from aro-bend problem 15 (see CTAN). |
| @@ -5619,30 +5726,36 @@ width0pt\relax} \fi | |||
| 5619 | % done by making ^^M (\endlinechar) catcode 12 when reading the macro | 5726 | % done by making ^^M (\endlinechar) catcode 12 when reading the macro |
| 5620 | % body, and then making it the \newlinechar in \scanmacro. | 5727 | % body, and then making it the \newlinechar in \scanmacro. |
| 5621 | 5728 | ||
| 5622 | \def\macrobodyctxt{% | 5729 | \def\scanctxt{% |
| 5623 | \catcode`\~=\other | 5730 | \catcode`\"=\other |
| 5731 | \catcode`\+=\other | ||
| 5732 | \catcode`\<=\other | ||
| 5733 | \catcode`\>=\other | ||
| 5734 | \catcode`\@=\other | ||
| 5624 | \catcode`\^=\other | 5735 | \catcode`\^=\other |
| 5625 | \catcode`\_=\other | 5736 | \catcode`\_=\other |
| 5626 | \catcode`\|=\other | 5737 | \catcode`\|=\other |
| 5627 | \catcode`\<=\other | 5738 | \catcode`\~=\other |
| 5628 | \catcode`\>=\other | 5739 | } |
| 5629 | \catcode`\+=\other | 5740 | |
| 5741 | \def\scanargctxt{% | ||
| 5742 | \scanctxt | ||
| 5743 | \catcode`\\=\other | ||
| 5744 | \catcode`\^^M=\other | ||
| 5745 | } | ||
| 5746 | |||
| 5747 | \def\macrobodyctxt{% | ||
| 5748 | \scanctxt | ||
| 5630 | \catcode`\{=\other | 5749 | \catcode`\{=\other |
| 5631 | \catcode`\}=\other | 5750 | \catcode`\}=\other |
| 5632 | \catcode`\@=\other | ||
| 5633 | \catcode`\^^M=\other | 5751 | \catcode`\^^M=\other |
| 5634 | \usembodybackslash} | 5752 | \usembodybackslash |
| 5753 | } | ||
| 5635 | 5754 | ||
| 5636 | \def\macroargctxt{% | 5755 | \def\macroargctxt{% |
| 5637 | \catcode`\~=\other | 5756 | \scanctxt |
| 5638 | \catcode`\^=\other | 5757 | \catcode`\\=\other |
| 5639 | \catcode`\_=\other | 5758 | } |
| 5640 | \catcode`\|=\other | ||
| 5641 | \catcode`\<=\other | ||
| 5642 | \catcode`\>=\other | ||
| 5643 | \catcode`\+=\other | ||
| 5644 | \catcode`\@=\other | ||
| 5645 | \catcode`\\=\other} | ||
| 5646 | 5759 | ||
| 5647 | % \mbodybackslash is the definition of \ in @macro bodies. | 5760 | % \mbodybackslash is the definition of \ in @macro bodies. |
| 5648 | % It maps \foo\ => \csname macarg.foo\endcsname => #N | 5761 | % It maps \foo\ => \csname macarg.foo\endcsname => #N |
| @@ -5673,25 +5786,21 @@ width0pt\relax} \fi | |||
| 5673 | \else \errmessage{Macro name \the\macname\space already defined}\fi | 5786 | \else \errmessage{Macro name \the\macname\space already defined}\fi |
| 5674 | \global\cslet{macsave.\the\macname}{\the\macname}% | 5787 | \global\cslet{macsave.\the\macname}{\the\macname}% |
| 5675 | \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% | 5788 | \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% |
| 5676 | % Add the macroname to \macrolist | 5789 | \addtomacrolist{\the\macname}% |
| 5677 | \toks0 = \expandafter{\macrolist\do}% | ||
| 5678 | \xdef\macrolist{\the\toks0 | ||
| 5679 | \expandafter\noexpand\csname\the\macname\endcsname}% | ||
| 5680 | \fi | 5790 | \fi |
| 5681 | \begingroup \macrobodyctxt | 5791 | \begingroup \macrobodyctxt |
| 5682 | \ifrecursive \expandafter\parsermacbody | 5792 | \ifrecursive \expandafter\parsermacbody |
| 5683 | \else \expandafter\parsemacbody | 5793 | \else \expandafter\parsemacbody |
| 5684 | \fi} | 5794 | \fi} |
| 5685 | 5795 | ||
| 5686 | \def\unmacro{\parsearg\dounmacro} | 5796 | \parseargdef\unmacro{% |
| 5687 | \def\dounmacro#1{% | ||
| 5688 | \if1\csname ismacro.#1\endcsname | 5797 | \if1\csname ismacro.#1\endcsname |
| 5689 | \global\cslet{#1}{macsave.#1}% | 5798 | \global\cslet{#1}{macsave.#1}% |
| 5690 | \global\expandafter\let \csname ismacro.#1\endcsname=0% | 5799 | \global\expandafter\let \csname ismacro.#1\endcsname=0% |
| 5691 | % Remove the macro name from \macrolist: | 5800 | % Remove the macro name from \macrolist: |
| 5692 | \begingroup | 5801 | \begingroup |
| 5693 | \expandafter\let\csname#1\endcsname \relax | 5802 | \expandafter\let\csname#1\endcsname \relax |
| 5694 | \let\do\unmacrodo | 5803 | \let\definedummyword\unmacrodo |
| 5695 | \xdef\macrolist{\macrolist}% | 5804 | \xdef\macrolist{\macrolist}% |
| 5696 | \endgroup | 5805 | \endgroup |
| 5697 | \else | 5806 | \else |
| @@ -5703,10 +5812,10 @@ width0pt\relax} \fi | |||
| 5703 | % macro definitions that have been changed to \relax. | 5812 | % macro definitions that have been changed to \relax. |
| 5704 | % | 5813 | % |
| 5705 | \def\unmacrodo#1{% | 5814 | \def\unmacrodo#1{% |
| 5706 | \ifx#1\relax | 5815 | \ifx #1\relax |
| 5707 | % remove this | 5816 | % remove this |
| 5708 | \else | 5817 | \else |
| 5709 | \noexpand\do \noexpand #1% | 5818 | \noexpand\definedummyword \noexpand#1% |
| 5710 | \fi | 5819 | \fi |
| 5711 | } | 5820 | } |
| 5712 | 5821 | ||
| @@ -5825,25 +5934,23 @@ width0pt\relax} \fi | |||
| 5825 | \expandafter\parsearg | 5934 | \expandafter\parsearg |
| 5826 | \fi \next} | 5935 | \fi \next} |
| 5827 | 5936 | ||
| 5828 | % We mant to disable all macros during \shipout so that they are not | ||
| 5829 | % expanded by \write. | ||
| 5830 | \def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% | ||
| 5831 | \edef\next{\macrolist}\expandafter\endgroup\next} | ||
| 5832 | |||
| 5833 | 5937 | ||
| 5834 | % @alias. | 5938 | % @alias. |
| 5835 | % We need some trickery to remove the optional spaces around the equal | 5939 | % We need some trickery to remove the optional spaces around the equal |
| 5836 | % sign. Just make them active and then expand them all to nothing. | 5940 | % sign. Just make them active and then expand them all to nothing. |
| 5837 | \def\alias{\begingroup\obeyspaces\parsearg\aliasxxx} | 5941 | \def\alias{\parseargusing\obeyspaces\aliasxxx} |
| 5838 | \def\aliasxxx #1{\aliasyyy#1\relax} | 5942 | \def\aliasxxx #1{\aliasyyy#1\relax} |
| 5839 | \def\aliasyyy #1=#2\relax{\ignoreactivespaces | 5943 | \def\aliasyyy #1=#2\relax{% |
| 5840 | \edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=% | 5944 | {% |
| 5841 | \expandafter\noexpand\csname#2\endcsname}% | 5945 | \expandafter\let\obeyedspace=\empty |
| 5842 | \expandafter\endgroup\next} | 5946 | \addtomacrolist{#1}% |
| 5947 | \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% | ||
| 5948 | }% | ||
| 5949 | \next | ||
| 5950 | } | ||
| 5843 | 5951 | ||
| 5844 | 5952 | ||
| 5845 | \message{cross references,} | 5953 | \message{cross references,} |
| 5846 | % @xref etc. | ||
| 5847 | 5954 | ||
| 5848 | \newwrite\auxfile | 5955 | \newwrite\auxfile |
| 5849 | 5956 | ||
| @@ -5855,64 +5962,68 @@ width0pt\relax} \fi | |||
| 5855 | \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, | 5962 | \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, |
| 5856 | node \samp{\ignorespaces#1{}}} | 5963 | node \samp{\ignorespaces#1{}}} |
| 5857 | 5964 | ||
| 5858 | % @node's job is to define \lastnode. | 5965 | % @node's only job in TeX is to define \lastnode, which is used in |
| 5859 | \def\node{\ENVcheck\parsearg\nodezzz} | 5966 | % cross-references. The @node line might or might not have commas, and |
| 5860 | \def\nodezzz#1{\nodexxx #1,\finishnodeparse} | 5967 | % might or might not have spaces before the first comma, like: |
| 5861 | \def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#1}} | 5968 | % @node foo , bar , ... |
| 5969 | % We don't want such trailing spaces in the node name. | ||
| 5970 | % | ||
| 5971 | \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} | ||
| 5972 | % | ||
| 5973 | % also remove a trailing comma, in case of something like this: | ||
| 5974 | % @node Help-Cross, , , Cross-refs | ||
| 5975 | \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} | ||
| 5976 | \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} | ||
| 5977 | |||
| 5862 | \let\nwnode=\node | 5978 | \let\nwnode=\node |
| 5863 | \let\lastnode=\relax | 5979 | \let\lastnode=\empty |
| 5864 | 5980 | ||
| 5865 | % The sectioning commands (@chapter, etc.) call these. | 5981 | % Write a cross-reference definition for the current node. #1 is the |
| 5866 | \def\donoderef{% | 5982 | % type (Ynumbered, Yappendix, Ynothing). |
| 5867 | \ifx\lastnode\relax\else | 5983 | % |
| 5868 | \expandafter\expandafter\expandafter\setref{\lastnode}% | 5984 | \def\donoderef#1{% |
| 5869 | {Ysectionnumberandtype}% | 5985 | \ifx\lastnode\empty\else |
| 5870 | \global\let\lastnode=\relax | 5986 | \setref{\lastnode}{#1}% |
| 5871 | \fi | 5987 | \global\let\lastnode=\empty |
| 5872 | } | ||
| 5873 | \def\unnumbnoderef{% | ||
| 5874 | \ifx\lastnode\relax\else | ||
| 5875 | \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}% | ||
| 5876 | \global\let\lastnode=\relax | ||
| 5877 | \fi | ||
| 5878 | } | ||
| 5879 | \def\appendixnoderef{% | ||
| 5880 | \ifx\lastnode\relax\else | ||
| 5881 | \expandafter\expandafter\expandafter\setref{\lastnode}% | ||
| 5882 | {Yappendixletterandtype}% | ||
| 5883 | \global\let\lastnode=\relax | ||
| 5884 | \fi | 5988 | \fi |
| 5885 | } | 5989 | } |
| 5886 | 5990 | ||
| 5887 | |||
| 5888 | % @anchor{NAME} -- define xref target at arbitrary point. | 5991 | % @anchor{NAME} -- define xref target at arbitrary point. |
| 5889 | % | 5992 | % |
| 5890 | \newcount\savesfregister | 5993 | \newcount\savesfregister |
| 5891 | \gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} | 5994 | % |
| 5892 | \gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} | 5995 | \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} |
| 5893 | \gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} | 5996 | \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} |
| 5997 | \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} | ||
| 5894 | 5998 | ||
| 5895 | % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an | 5999 | % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an |
| 5896 | % anchor), namely NAME-title (the corresponding @chapter/etc. name), | 6000 | % anchor), which consists of three parts: |
| 5897 | % NAME-pg (the page number), and NAME-snt (section number and type). | 6001 | % 1) NAME-title - the current sectioning name taken from \thissection, |
| 5898 | % Called from \foonoderef. | 6002 | % or the anchor name. |
| 5899 | % | 6003 | % 2) NAME-snt - section number and type, passed as the SNT arg, or |
| 5900 | % We have to set \indexdummies so commands such as @code in a section | 6004 | % empty for anchors. |
| 5901 | % title aren't expanded. It would be nicer not to expand the titles in | 6005 | % 3) NAME-pg - the page number. |
| 5902 | % the first place, but there's so many layers that that is hard to do. | 6006 | % |
| 5903 | % | 6007 | % This is called from \donoderef, \anchor, and \dofloat. In the case of |
| 5904 | % Likewise, use \turnoffactive so that punctuation chars such as underscore | 6008 | % floats, there is an additional part, which is not written here: |
| 5905 | % and backslash work in node names. | 6009 | % 4) NAME-lof - the text as it should appear in a @listoffloats. |
| 5906 | % | 6010 | % |
| 5907 | \def\setref#1#2{{% | 6011 | \def\setref#1#2{% |
| 5908 | \atdummies | ||
| 5909 | \pdfmkdest{#1}% | 6012 | \pdfmkdest{#1}% |
| 5910 | % | 6013 | \iflinks |
| 5911 | \turnoffactive | 6014 | {% |
| 5912 | \dosetq{#1-title}{Ytitle}% | 6015 | \atdummies % preserve commands, but don't expand them |
| 5913 | \dosetq{#1-pg}{Ypagenumber}% | 6016 | \edef\writexrdef##1##2{% |
| 5914 | \dosetq{#1-snt}{#2}% | 6017 | \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef |
| 5915 | }} | 6018 | ##1}{##2}}% these are parameters of \writexrdef |
| 6019 | }% | ||
| 6020 | \toks0 = \expandafter{\thissection}% | ||
| 6021 | \immediate \writexrdef{title}{\the\toks0 }% | ||
| 6022 | \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. | ||
| 6023 | \writexrdef{pg}{\folio}% will be written later, during \shipout | ||
| 6024 | }% | ||
| 6025 | \fi | ||
| 6026 | } | ||
| 5916 | 6027 | ||
| 5917 | % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is | 6028 | % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is |
| 5918 | % the node name, #2 the name of the Info cross-reference, #3 the printed | 6029 | % the node name, #2 the name of the Info cross-reference, #3 the printed |
| @@ -5925,105 +6036,125 @@ width0pt\relax} \fi | |||
| 5925 | \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup | 6036 | \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup |
| 5926 | \unsepspaces | 6037 | \unsepspaces |
| 5927 | \def\printedmanual{\ignorespaces #5}% | 6038 | \def\printedmanual{\ignorespaces #5}% |
| 5928 | \def\printednodename{\ignorespaces #3}% | 6039 | \def\printedrefname{\ignorespaces #3}% |
| 5929 | \setbox1=\hbox{\printedmanual}% | 6040 | \setbox1=\hbox{\printedmanual\unskip}% |
| 5930 | \setbox0=\hbox{\printednodename}% | 6041 | \setbox0=\hbox{\printedrefname\unskip}% |
| 5931 | \ifdim \wd0 = 0pt | 6042 | \ifdim \wd0 = 0pt |
| 5932 | % No printed node name was explicitly given. | 6043 | % No printed node name was explicitly given. |
| 5933 | \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax | 6044 | \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax |
| 5934 | % Use the node name inside the square brackets. | 6045 | % Use the node name inside the square brackets. |
| 5935 | \def\printednodename{\ignorespaces #1}% | 6046 | \def\printedrefname{\ignorespaces #1}% |
| 5936 | \else | 6047 | \else |
| 5937 | % Use the actual chapter/section title appear inside | 6048 | % Use the actual chapter/section title appear inside |
| 5938 | % the square brackets. Use the real section title if we have it. | 6049 | % the square brackets. Use the real section title if we have it. |
| 5939 | \ifdim \wd1 > 0pt | 6050 | \ifdim \wd1 > 0pt |
| 5940 | % It is in another manual, so we don't have it. | 6051 | % It is in another manual, so we don't have it. |
| 5941 | \def\printednodename{\ignorespaces #1}% | 6052 | \def\printedrefname{\ignorespaces #1}% |
| 5942 | \else | 6053 | \else |
| 5943 | \ifhavexrefs | 6054 | \ifhavexrefs |
| 5944 | % We know the real title if we have the xref values. | 6055 | % We know the real title if we have the xref values. |
| 5945 | \def\printednodename{\refx{#1-title}{}}% | 6056 | \def\printedrefname{\refx{#1-title}{}}% |
| 5946 | \else | 6057 | \else |
| 5947 | % Otherwise just copy the Info node name. | 6058 | % Otherwise just copy the Info node name. |
| 5948 | \def\printednodename{\ignorespaces #1}% | 6059 | \def\printedrefname{\ignorespaces #1}% |
| 5949 | \fi% | 6060 | \fi% |
| 5950 | \fi | 6061 | \fi |
| 5951 | \fi | 6062 | \fi |
| 5952 | \fi | 6063 | \fi |
| 5953 | % | 6064 | % |
| 5954 | % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not | 6065 | % Make link in pdf output. |
| 5955 | % insert empty discretionaries after hyphens, which means that it will | ||
| 5956 | % not find a line break at a hyphen in a node names. Since some manuals | ||
| 5957 | % are best written with fairly long node names, containing hyphens, this | ||
| 5958 | % is a loss. Therefore, we give the text of the node name again, so it | ||
| 5959 | % is as if TeX is seeing it for the first time. | ||
| 5960 | \ifpdf | 6066 | \ifpdf |
| 5961 | \leavevmode | 6067 | \leavevmode |
| 5962 | \getfilename{#4}% | 6068 | \getfilename{#4}% |
| 5963 | {\turnoffactive \otherbackslash | 6069 | {\turnoffactive |
| 6070 | % See comments at \activebackslashdouble. | ||
| 6071 | {\activebackslashdouble \xdef\pdfxrefdest{#1}% | ||
| 6072 | \backslashparens\pdfxrefdest}% | ||
| 6073 | % | ||
| 5964 | \ifnum\filenamelength>0 | 6074 | \ifnum\filenamelength>0 |
| 5965 | \startlink attr{/Border [0 0 0]}% | 6075 | \startlink attr{/Border [0 0 0]}% |
| 5966 | goto file{\the\filename.pdf} name{#1}% | 6076 | goto file{\the\filename.pdf} name{\pdfxrefdest}% |
| 5967 | \else | 6077 | \else |
| 5968 | \startlink attr{/Border [0 0 0]}% | 6078 | \startlink attr{/Border [0 0 0]}% |
| 5969 | goto name{#1}% | 6079 | goto name{\pdfmkpgn{\pdfxrefdest}}% |
| 5970 | \fi | 6080 | \fi |
| 5971 | }% | 6081 | }% |
| 5972 | \linkcolor | 6082 | \linkcolor |
| 5973 | \fi | 6083 | \fi |
| 5974 | % | 6084 | % |
| 5975 | \ifdim \wd1 > 0pt | 6085 | % Float references are printed completely differently: "Figure 1.2" |
| 5976 | \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}% | 6086 | % instead of "[somenode], p.3". We distinguish them by the |
| 5977 | \else | 6087 | % LABEL-title being set to a magic string. |
| 5978 | % _ (for example) has to be the character _ for the purposes of the | 6088 | {% |
| 5979 | % control sequence corresponding to the node, but it has to expand | 6089 | % Have to otherify everything special to allow the \csname to |
| 5980 | % into the usual \leavevmode...\vrule stuff for purposes of | 6090 | % include an _ in the xref name, etc. |
| 5981 | % printing. So we \turnoffactive for the \refx-snt, back on for the | 6091 | \indexnofonts |
| 5982 | % printing, back off for the \refx-pg. | 6092 | \turnoffactive |
| 5983 | {\turnoffactive \otherbackslash | 6093 | \expandafter\global\expandafter\let\expandafter\Xthisreftitle |
| 5984 | % Only output a following space if the -snt ref is nonempty; for | 6094 | \csname XR#1-title\endcsname |
| 5985 | % @unnumbered and @anchor, it won't be. | 6095 | }% |
| 5986 | \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% | 6096 | \iffloat\Xthisreftitle |
| 5987 | \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi | 6097 | % If the user specified the print name (third arg) to the ref, |
| 5988 | }% | 6098 | % print it instead of our usual "Figure 1.2". |
| 5989 | % output the `[mynode]' via a macro. | 6099 | \ifdim\wd0 = 0pt |
| 5990 | \xrefprintnodename\printednodename | 6100 | \refx{#1-snt}{}% |
| 6101 | \else | ||
| 6102 | \printedrefname | ||
| 6103 | \fi | ||
| 5991 | % | 6104 | % |
| 5992 | % But we always want a comma and a space: | 6105 | % if the user also gave the printed manual name (fifth arg), append |
| 5993 | ,\space | 6106 | % "in MANUALNAME". |
| 6107 | \ifdim \wd1 > 0pt | ||
| 6108 | \space \putwordin{} \cite{\printedmanual}% | ||
| 6109 | \fi | ||
| 6110 | \else | ||
| 6111 | % node/anchor (non-float) references. | ||
| 5994 | % | 6112 | % |
| 5995 | % output the `page 3'. | 6113 | % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not |
| 5996 | \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}% | 6114 | % insert empty discretionaries after hyphens, which means that it will |
| 6115 | % not find a line break at a hyphen in a node names. Since some manuals | ||
| 6116 | % are best written with fairly long node names, containing hyphens, this | ||
| 6117 | % is a loss. Therefore, we give the text of the node name again, so it | ||
| 6118 | % is as if TeX is seeing it for the first time. | ||
| 6119 | \ifdim \wd1 > 0pt | ||
| 6120 | \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% | ||
| 6121 | \else | ||
| 6122 | % _ (for example) has to be the character _ for the purposes of the | ||
| 6123 | % control sequence corresponding to the node, but it has to expand | ||
| 6124 | % into the usual \leavevmode...\vrule stuff for purposes of | ||
| 6125 | % printing. So we \turnoffactive for the \refx-snt, back on for the | ||
| 6126 | % printing, back off for the \refx-pg. | ||
| 6127 | {\turnoffactive | ||
| 6128 | % Only output a following space if the -snt ref is nonempty; for | ||
| 6129 | % @unnumbered and @anchor, it won't be. | ||
| 6130 | \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% | ||
| 6131 | \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi | ||
| 6132 | }% | ||
| 6133 | % output the `[mynode]' via a macro so it can be overridden. | ||
| 6134 | \xrefprintnodename\printedrefname | ||
| 6135 | % | ||
| 6136 | % But we always want a comma and a space: | ||
| 6137 | ,\space | ||
| 6138 | % | ||
| 6139 | % output the `page 3'. | ||
| 6140 | \turnoffactive \putwordpage\tie\refx{#1-pg}{}% | ||
| 6141 | \fi | ||
| 5997 | \fi | 6142 | \fi |
| 5998 | \endlink | 6143 | \endlink |
| 5999 | \endgroup} | 6144 | \endgroup} |
| 6000 | 6145 | ||
| 6001 | % This macro is called from \xrefX for the `[nodename]' part of xref | 6146 | % This macro is called from \xrefX for the `[nodename]' part of xref |
| 6002 | % output. It's a separate macro only so it can be changed more easily, | 6147 | % output. It's a separate macro only so it can be changed more easily, |
| 6003 | % since not square brackets don't work in some documents. Particularly | 6148 | % since square brackets don't work well in some documents. Particularly |
| 6004 | % one that Bob is working on :). | 6149 | % one that Bob is working on :). |
| 6005 | % | 6150 | % |
| 6006 | \def\xrefprintnodename#1{[#1]} | 6151 | \def\xrefprintnodename#1{[#1]} |
| 6007 | 6152 | ||
| 6008 | % \dosetq is called from \setref to do the actual \write (\iflinks). | 6153 | % Things referred to by \setref. |
| 6009 | % | ||
| 6010 | \def\dosetq#1#2{% | ||
| 6011 | {\let\folio=0% | ||
| 6012 | \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% | ||
| 6013 | \iflinks \next \fi | ||
| 6014 | }% | ||
| 6015 | } | ||
| 6016 | |||
| 6017 | % \internalsetq{foo}{page} expands into | ||
| 6018 | % CHARACTERS @xrdef{foo}{...expansion of \page...} | ||
| 6019 | \def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}} | ||
| 6020 | |||
| 6021 | % Things to be expanded by \internalsetq. | ||
| 6022 | % | 6154 | % |
| 6023 | \def\Ypagenumber{\folio} | ||
| 6024 | \def\Ytitle{\thissection} | ||
| 6025 | \def\Ynothing{} | 6155 | \def\Ynothing{} |
| 6026 | \def\Ysectionnumberandtype{% | 6156 | \def\Yomitfromtoc{} |
| 6157 | \def\Ynumbered{% | ||
| 6027 | \ifnum\secno=0 | 6158 | \ifnum\secno=0 |
| 6028 | \putwordChapter@tie \the\chapno | 6159 | \putwordChapter@tie \the\chapno |
| 6029 | \else \ifnum\subsecno=0 | 6160 | \else \ifnum\subsecno=0 |
| @@ -6034,8 +6165,7 @@ width0pt\relax} \fi | |||
| 6034 | \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno | 6165 | \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno |
| 6035 | \fi\fi\fi | 6166 | \fi\fi\fi |
| 6036 | } | 6167 | } |
| 6037 | 6168 | \def\Yappendix{% | |
| 6038 | \def\Yappendixletterandtype{% | ||
| 6039 | \ifnum\secno=0 | 6169 | \ifnum\secno=0 |
| 6040 | \putwordAppendix@tie @char\the\appendixno{}% | 6170 | \putwordAppendix@tie @char\the\appendixno{}% |
| 6041 | \else \ifnum\subsecno=0 | 6171 | \else \ifnum\subsecno=0 |
| @@ -6048,15 +6178,6 @@ width0pt\relax} \fi | |||
| 6048 | \fi\fi\fi | 6178 | \fi\fi\fi |
| 6049 | } | 6179 | } |
| 6050 | 6180 | ||
| 6051 | % Use TeX 3.0's \inputlineno to get the line number, for better error | ||
| 6052 | % messages, but if we're using an old version of TeX, don't do anything. | ||
| 6053 | % | ||
| 6054 | \ifx\inputlineno\thisisundefined | ||
| 6055 | \let\linenumber = \empty % Pre-3.0. | ||
| 6056 | \else | ||
| 6057 | \def\linenumber{\the\inputlineno:\space} | ||
| 6058 | \fi | ||
| 6059 | |||
| 6060 | % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. | 6181 | % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. |
| 6061 | % If its value is nonempty, SUFFIX is output afterward. | 6182 | % If its value is nonempty, SUFFIX is output afterward. |
| 6062 | % | 6183 | % |
| @@ -6065,7 +6186,7 @@ width0pt\relax} \fi | |||
| 6065 | \indexnofonts | 6186 | \indexnofonts |
| 6066 | \otherbackslash | 6187 | \otherbackslash |
| 6067 | \expandafter\global\expandafter\let\expandafter\thisrefX | 6188 | \expandafter\global\expandafter\let\expandafter\thisrefX |
| 6068 | \csname X#1\endcsname | 6189 | \csname XR#1\endcsname |
| 6069 | }% | 6190 | }% |
| 6070 | \ifx\thisrefX\relax | 6191 | \ifx\thisrefX\relax |
| 6071 | % If not defined, say something at least. | 6192 | % If not defined, say something at least. |
| @@ -6087,12 +6208,45 @@ width0pt\relax} \fi | |||
| 6087 | #2% Output the suffix in any case. | 6208 | #2% Output the suffix in any case. |
| 6088 | } | 6209 | } |
| 6089 | 6210 | ||
| 6090 | % This is the macro invoked by entries in the aux file. | 6211 | % This is the macro invoked by entries in the aux file. Usually it's |
| 6212 | % just a \def (we prepend XR to the control sequence name to avoid | ||
| 6213 | % collisions). But if this is a float type, we have more work to do. | ||
| 6091 | % | 6214 | % |
| 6092 | \def\xrdef#1{\expandafter\gdef\csname X#1\endcsname} | 6215 | \def\xrdef#1#2{% |
| 6216 | \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. | ||
| 6217 | % | ||
| 6218 | % Was that xref control sequence that we just defined for a float? | ||
| 6219 | \expandafter\iffloat\csname XR#1\endcsname | ||
| 6220 | % it was a float, and we have the (safe) float type in \iffloattype. | ||
| 6221 | \expandafter\let\expandafter\floatlist | ||
| 6222 | \csname floatlist\iffloattype\endcsname | ||
| 6223 | % | ||
| 6224 | % Is this the first time we've seen this float type? | ||
| 6225 | \expandafter\ifx\floatlist\relax | ||
| 6226 | \toks0 = {\do}% yes, so just \do | ||
| 6227 | \else | ||
| 6228 | % had it before, so preserve previous elements in list. | ||
| 6229 | \toks0 = \expandafter{\floatlist\do}% | ||
| 6230 | \fi | ||
| 6231 | % | ||
| 6232 | % Remember this xref in the control sequence \floatlistFLOATTYPE, | ||
| 6233 | % for later use in \listoffloats. | ||
| 6234 | \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% | ||
| 6235 | \fi | ||
| 6236 | } | ||
| 6093 | 6237 | ||
| 6094 | % Read the last existing aux file, if any. No error if none exists. | 6238 | % Read the last existing aux file, if any. No error if none exists. |
| 6095 | \def\readauxfile{\begingroup | 6239 | % |
| 6240 | \def\tryauxfile{% | ||
| 6241 | \openin 1 \jobname.aux | ||
| 6242 | \ifeof 1 \else | ||
| 6243 | \readdatafile{aux}% | ||
| 6244 | \global\havexrefstrue | ||
| 6245 | \fi | ||
| 6246 | \closein 1 | ||
| 6247 | } | ||
| 6248 | |||
| 6249 | \def\setupdatafile{% | ||
| 6096 | \catcode`\^^@=\other | 6250 | \catcode`\^^@=\other |
| 6097 | \catcode`\^^A=\other | 6251 | \catcode`\^^A=\other |
| 6098 | \catcode`\^^B=\other | 6252 | \catcode`\^^B=\other |
| @@ -6150,41 +6304,39 @@ width0pt\relax} \fi | |||
| 6150 | \catcode`\%=\other | 6304 | \catcode`\%=\other |
| 6151 | \catcode`+=\other % avoid \+ for paranoia even though we've turned it off | 6305 | \catcode`+=\other % avoid \+ for paranoia even though we've turned it off |
| 6152 | % | 6306 | % |
| 6153 | % Make the characters 128-255 be printing characters | 6307 | % This is to support \ in node names and titles, since the \ |
| 6308 | % characters end up in a \csname. It's easier than | ||
| 6309 | % leaving it active and making its active definition an actual \ | ||
| 6310 | % character. What I don't understand is why it works in the *value* | ||
| 6311 | % of the xrdef. Seems like it should be a catcode12 \, and that | ||
| 6312 | % should not typeset properly. But it works, so I'm moving on for | ||
| 6313 | % now. --karl, 15jan04. | ||
| 6314 | \catcode`\\=\other | ||
| 6315 | % | ||
| 6316 | % Make the characters 128-255 be printing characters. | ||
| 6154 | {% | 6317 | {% |
| 6155 | \count 1=128 | 6318 | \count1=128 |
| 6156 | \def\loop{% | 6319 | \def\loop{% |
| 6157 | \catcode\count 1=\other | 6320 | \catcode\count1=\other |
| 6158 | \advance\count 1 by 1 | 6321 | \advance\count1 by 1 |
| 6159 | \ifnum \count 1<256 \loop \fi | 6322 | \ifnum \count1<256 \loop \fi |
| 6160 | }% | 6323 | }% |
| 6161 | }% | 6324 | }% |
| 6162 | % | 6325 | % |
| 6163 | % Turn off \ as an escape so we do not lose on | 6326 | % @ is our escape character in .aux files, and we need braces. |
| 6164 | % entries which were dumped with control sequences in their names. | ||
| 6165 | % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^ | ||
| 6166 | % Reference to such entries still does not work the way one would wish, | ||
| 6167 | % but at least they do not bomb out when the aux file is read in. | ||
| 6168 | \catcode`\\=\other | ||
| 6169 | % | ||
| 6170 | % @ is our escape character in .aux files. | ||
| 6171 | \catcode`\{=1 | 6327 | \catcode`\{=1 |
| 6172 | \catcode`\}=2 | 6328 | \catcode`\}=2 |
| 6173 | \catcode`\@=0 | 6329 | \catcode`\@=0 |
| 6174 | % | 6330 | } |
| 6175 | \openin 1 \jobname.aux | ||
| 6176 | \ifeof 1 \else | ||
| 6177 | \closein 1 | ||
| 6178 | \input \jobname.aux | ||
| 6179 | \global\havexrefstrue | ||
| 6180 | \global\warnedobstrue | ||
| 6181 | \fi | ||
| 6182 | % Open the new aux file. TeX will close it automatically at exit. | ||
| 6183 | \openout\auxfile=\jobname.aux | ||
| 6184 | \endgroup} | ||
| 6185 | 6331 | ||
| 6332 | \def\readdatafile#1{% | ||
| 6333 | \begingroup | ||
| 6334 | \setupdatafile | ||
| 6335 | \input\jobname.#1 | ||
| 6336 | \endgroup} | ||
| 6186 | 6337 | ||
| 6187 | % Footnotes. | 6338 | \message{insertions,} |
| 6339 | % including footnotes. | ||
| 6188 | 6340 | ||
| 6189 | \newcount \footnoteno | 6341 | \newcount \footnoteno |
| 6190 | 6342 | ||
| @@ -6198,13 +6350,12 @@ width0pt\relax} \fi | |||
| 6198 | % @footnotestyle is meaningful for info output only. | 6350 | % @footnotestyle is meaningful for info output only. |
| 6199 | \let\footnotestyle=\comment | 6351 | \let\footnotestyle=\comment |
| 6200 | 6352 | ||
| 6201 | \let\ptexfootnote=\footnote | ||
| 6202 | |||
| 6203 | {\catcode `\@=11 | 6353 | {\catcode `\@=11 |
| 6204 | % | 6354 | % |
| 6205 | % Auto-number footnotes. Otherwise like plain. | 6355 | % Auto-number footnotes. Otherwise like plain. |
| 6206 | \gdef\footnote{% | 6356 | \gdef\footnote{% |
| 6207 | \let\indent=\ptexindent | 6357 | \let\indent=\ptexindent |
| 6358 | \let\noindent=\ptexnoindent | ||
| 6208 | \global\advance\footnoteno by \@ne | 6359 | \global\advance\footnoteno by \@ne |
| 6209 | \edef\thisfootno{$^{\the\footnoteno}$}% | 6360 | \edef\thisfootno{$^{\the\footnoteno}$}% |
| 6210 | % | 6361 | % |
| @@ -6222,17 +6373,12 @@ width0pt\relax} \fi | |||
| 6222 | % Don't bother with the trickery in plain.tex to not require the | 6373 | % Don't bother with the trickery in plain.tex to not require the |
| 6223 | % footnote text as a parameter. Our footnotes don't need to be so general. | 6374 | % footnote text as a parameter. Our footnotes don't need to be so general. |
| 6224 | % | 6375 | % |
| 6225 | % Oh yes, they do; otherwise, @ifset and anything else that uses | 6376 | % Oh yes, they do; otherwise, @ifset (and anything else that uses |
| 6226 | % \parseargline fail inside footnotes because the tokens are fixed when | 6377 | % \parseargline) fails inside footnotes because the tokens are fixed when |
| 6227 | % the footnote is read. --karl, 16nov96. | 6378 | % the footnote is read. --karl, 16nov96. |
| 6228 | % | 6379 | % |
| 6229 | % The start of the footnote looks usually like this: | ||
| 6230 | \gdef\startfootins{\insert\footins\bgroup} | ||
| 6231 | % | ||
| 6232 | % ... but this macro is redefined inside @multitable. | ||
| 6233 | % | ||
| 6234 | \gdef\dofootnote{% | 6380 | \gdef\dofootnote{% |
| 6235 | \startfootins | 6381 | \insert\footins\bgroup |
| 6236 | % We want to typeset this text as a normal paragraph, even if the | 6382 | % We want to typeset this text as a normal paragraph, even if the |
| 6237 | % footnote reference occurs in (for example) a display environment. | 6383 | % footnote reference occurs in (for example) a display environment. |
| 6238 | % So reset some parameters. | 6384 | % So reset some parameters. |
| @@ -6268,40 +6414,66 @@ width0pt\relax} \fi | |||
| 6268 | } | 6414 | } |
| 6269 | }%end \catcode `\@=11 | 6415 | }%end \catcode `\@=11 |
| 6270 | 6416 | ||
| 6271 | % @| inserts a changebar to the left of the current line. It should | 6417 | % In case a @footnote appears in a vbox, save the footnote text and create |
| 6272 | % surround any changed text. This approach does *not* work if the | 6418 | % the real \insert just after the vbox finished. Otherwise, the insertion |
| 6273 | % change spans more than two lines of output. To handle that, we would | 6419 | % would be lost. |
| 6274 | % have adopt a much more difficult approach (putting marks into the main | 6420 | % Similarily, if a @footnote appears inside an alignment, save the footnote |
| 6275 | % vertical list for the beginning and end of each change). | 6421 | % text to a box and make the \insert when a row of the table is finished. |
| 6422 | % And the same can be done for other insert classes. --kasal, 16nov03. | ||
| 6423 | |||
| 6424 | % Replace the \insert primitive by a cheating macro. | ||
| 6425 | % Deeper inside, just make sure that the saved insertions are not spilled | ||
| 6426 | % out prematurely. | ||
| 6276 | % | 6427 | % |
| 6277 | \def\|{% | 6428 | \def\startsavinginserts{% |
| 6278 | % \vadjust can only be used in horizontal mode. | 6429 | \ifx \insert\ptexinsert |
| 6279 | \leavevmode | 6430 | \let\insert\saveinsert |
| 6280 | % | 6431 | \else |
| 6281 | % Append this vertical mode material after the current line in the output. | 6432 | \let\checkinserts\relax |
| 6282 | \vadjust{% | 6433 | \fi |
| 6283 | % We want to insert a rule with the height and depth of the current | ||
| 6284 | % leading; that is exactly what \strutbox is supposed to record. | ||
| 6285 | \vskip-\baselineskip | ||
| 6286 | % | ||
| 6287 | % \vadjust-items are inserted at the left edge of the type. So | ||
| 6288 | % the \llap here moves out into the left-hand margin. | ||
| 6289 | \llap{% | ||
| 6290 | % | ||
| 6291 | % For a thicker or thinner bar, change the `1pt'. | ||
| 6292 | \vrule height\baselineskip width1pt | ||
| 6293 | % | ||
| 6294 | % This is the space between the bar and the text. | ||
| 6295 | \hskip 12pt | ||
| 6296 | }% | ||
| 6297 | }% | ||
| 6298 | } | 6434 | } |
| 6299 | 6435 | ||
| 6300 | % For a final copy, take out the rectangles | 6436 | % This \insert replacement works for both \insert\footins{foo} and |
| 6301 | % that mark overfull boxes (in case you have decided | 6437 | % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. |
| 6302 | % that the text looks ok even though it passes the margin). | ||
| 6303 | % | 6438 | % |
| 6304 | \def\finalout{\overfullrule=0pt} | 6439 | \def\saveinsert#1{% |
| 6440 | \edef\next{\noexpand\savetobox \makeSAVEname#1}% | ||
| 6441 | \afterassignment\next | ||
| 6442 | % swallow the left brace | ||
| 6443 | \let\temp = | ||
| 6444 | } | ||
| 6445 | \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} | ||
| 6446 | \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} | ||
| 6447 | |||
| 6448 | \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} | ||
| 6449 | |||
| 6450 | \def\placesaveins#1{% | ||
| 6451 | \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname | ||
| 6452 | {\box#1}% | ||
| 6453 | } | ||
| 6454 | |||
| 6455 | % eat @SAVE -- beware, all of them have catcode \other: | ||
| 6456 | { | ||
| 6457 | \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) | ||
| 6458 | \gdef\gobblesave @SAVE{} | ||
| 6459 | } | ||
| 6460 | |||
| 6461 | % initialization: | ||
| 6462 | \def\newsaveins #1{% | ||
| 6463 | \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% | ||
| 6464 | \next | ||
| 6465 | } | ||
| 6466 | \def\newsaveinsX #1{% | ||
| 6467 | \csname newbox\endcsname #1% | ||
| 6468 | \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts | ||
| 6469 | \checksaveins #1}% | ||
| 6470 | } | ||
| 6471 | |||
| 6472 | % initialize: | ||
| 6473 | \let\checkinserts\empty | ||
| 6474 | \newsaveins\footins | ||
| 6475 | \newsaveins\margin | ||
| 6476 | |||
| 6305 | 6477 | ||
| 6306 | % @image. We use the macros from epsf.tex to support this. | 6478 | % @image. We use the macros from epsf.tex to support this. |
| 6307 | % If epsf.tex is not installed and @image is used, we complain. | 6479 | % If epsf.tex is not installed and @image is used, we complain. |
| @@ -6311,12 +6483,12 @@ width0pt\relax} \fi | |||
| 6311 | % undone and the next image would fail. | 6483 | % undone and the next image would fail. |
| 6312 | \openin 1 = epsf.tex | 6484 | \openin 1 = epsf.tex |
| 6313 | \ifeof 1 \else | 6485 | \ifeof 1 \else |
| 6314 | \closein 1 | ||
| 6315 | % Do not bother showing banner with epsf.tex v2.7k (available in | 6486 | % Do not bother showing banner with epsf.tex v2.7k (available in |
| 6316 | % doc/epsf.tex and on ctan). | 6487 | % doc/epsf.tex and on ctan). |
| 6317 | \def\epsfannounce{\toks0 = }% | 6488 | \def\epsfannounce{\toks0 = }% |
| 6318 | \input epsf.tex | 6489 | \input epsf.tex |
| 6319 | \fi | 6490 | \fi |
| 6491 | \closein 1 | ||
| 6320 | % | 6492 | % |
| 6321 | % We will only complain once about lack of epsf.tex. | 6493 | % We will only complain once about lack of epsf.tex. |
| 6322 | \newif\ifwarnednoepsf | 6494 | \newif\ifwarnednoepsf |
| @@ -6355,7 +6527,7 @@ width0pt\relax} \fi | |||
| 6355 | % above and below. | 6527 | % above and below. |
| 6356 | \nobreak\vskip\parskip | 6528 | \nobreak\vskip\parskip |
| 6357 | \nobreak | 6529 | \nobreak |
| 6358 | \line\bgroup\hss | 6530 | \line\bgroup |
| 6359 | \fi | 6531 | \fi |
| 6360 | % | 6532 | % |
| 6361 | % Output the image. | 6533 | % Output the image. |
| @@ -6368,10 +6540,275 @@ width0pt\relax} \fi | |||
| 6368 | \epsfbox{#1.eps}% | 6540 | \epsfbox{#1.eps}% |
| 6369 | \fi | 6541 | \fi |
| 6370 | % | 6542 | % |
| 6371 | \ifimagevmode \hss \egroup \bigbreak \fi % space after the image | 6543 | \ifimagevmode \egroup \bigbreak \fi % space after the image |
| 6372 | \endgroup} | 6544 | \endgroup} |
| 6373 | 6545 | ||
| 6374 | 6546 | ||
| 6547 | % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, | ||
| 6548 | % etc. We don't actually implement floating yet, we always include the | ||
| 6549 | % float "here". But it seemed the best name for the future. | ||
| 6550 | % | ||
| 6551 | \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} | ||
| 6552 | |||
| 6553 | % There may be a space before second and/or third parameter; delete it. | ||
| 6554 | \def\eatcommaspace#1, {#1,} | ||
| 6555 | |||
| 6556 | % #1 is the optional FLOATTYPE, the text label for this float, typically | ||
| 6557 | % "Figure", "Table", "Example", etc. Can't contain commas. If omitted, | ||
| 6558 | % this float will not be numbered and cannot be referred to. | ||
| 6559 | % | ||
| 6560 | % #2 is the optional xref label. Also must be present for the float to | ||
| 6561 | % be referable. | ||
| 6562 | % | ||
| 6563 | % #3 is the optional positioning argument; for now, it is ignored. It | ||
| 6564 | % will somehow specify the positions allowed to float to (here, top, bottom). | ||
| 6565 | % | ||
| 6566 | % We keep a separate counter for each FLOATTYPE, which we reset at each | ||
| 6567 | % chapter-level command. | ||
| 6568 | \let\resetallfloatnos=\empty | ||
| 6569 | % | ||
| 6570 | \def\dofloat#1,#2,#3,#4\finish{% | ||
| 6571 | \let\thiscaption=\empty | ||
| 6572 | \let\thisshortcaption=\empty | ||
| 6573 | % | ||
| 6574 | % don't lose footnotes inside @float. | ||
| 6575 | % | ||
| 6576 | % BEWARE: when the floats start float, we have to issue warning whenever an | ||
| 6577 | % insert appears inside a float which could possibly float. --kasal, 26may04 | ||
| 6578 | % | ||
| 6579 | \startsavinginserts | ||
| 6580 | % | ||
| 6581 | % We can't be used inside a paragraph. | ||
| 6582 | \par | ||
| 6583 | % | ||
| 6584 | \vtop\bgroup | ||
| 6585 | \def\floattype{#1}% | ||
| 6586 | \def\floatlabel{#2}% | ||
| 6587 | \def\floatloc{#3}% we do nothing with this yet. | ||
| 6588 | % | ||
| 6589 | \ifx\floattype\empty | ||
| 6590 | \let\safefloattype=\empty | ||
| 6591 | \else | ||
| 6592 | {% | ||
| 6593 | % the floattype might have accents or other special characters, | ||
| 6594 | % but we need to use it in a control sequence name. | ||
| 6595 | \indexnofonts | ||
| 6596 | \turnoffactive | ||
| 6597 | \xdef\safefloattype{\floattype}% | ||
| 6598 | }% | ||
| 6599 | \fi | ||
| 6600 | % | ||
| 6601 | % If label is given but no type, we handle that as the empty type. | ||
| 6602 | \ifx\floatlabel\empty \else | ||
| 6603 | % We want each FLOATTYPE to be numbered separately (Figure 1, | ||
| 6604 | % Table 1, Figure 2, ...). (And if no label, no number.) | ||
| 6605 | % | ||
| 6606 | \expandafter\getfloatno\csname\safefloattype floatno\endcsname | ||
| 6607 | \global\advance\floatno by 1 | ||
| 6608 | % | ||
| 6609 | {% | ||
| 6610 | % This magic value for \thissection is output by \setref as the | ||
| 6611 | % XREFLABEL-title value. \xrefX uses it to distinguish float | ||
| 6612 | % labels (which have a completely different output format) from | ||
| 6613 | % node and anchor labels. And \xrdef uses it to construct the | ||
| 6614 | % lists of floats. | ||
| 6615 | % | ||
| 6616 | \edef\thissection{\floatmagic=\safefloattype}% | ||
| 6617 | \setref{\floatlabel}{Yfloat}% | ||
| 6618 | }% | ||
| 6619 | \fi | ||
| 6620 | % | ||
| 6621 | % start with \parskip glue, I guess. | ||
| 6622 | \vskip\parskip | ||
| 6623 | % | ||
| 6624 | % Don't suppress indentation if a float happens to start a section. | ||
| 6625 | \restorefirstparagraphindent | ||
| 6626 | } | ||
| 6627 | |||
| 6628 | % we have these possibilities: | ||
| 6629 | % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap | ||
| 6630 | % @float Foo,lbl & no caption: Foo 1.1 | ||
| 6631 | % @float Foo & @caption{Cap}: Foo: Cap | ||
| 6632 | % @float Foo & no caption: Foo | ||
| 6633 | % @float ,lbl & Caption{Cap}: 1.1: Cap | ||
| 6634 | % @float ,lbl & no caption: 1.1 | ||
| 6635 | % @float & @caption{Cap}: Cap | ||
| 6636 | % @float & no caption: | ||
| 6637 | % | ||
| 6638 | \def\Efloat{% | ||
| 6639 | \let\floatident = \empty | ||
| 6640 | % | ||
| 6641 | % In all cases, if we have a float type, it comes first. | ||
| 6642 | \ifx\floattype\empty \else \def\floatident{\floattype}\fi | ||
| 6643 | % | ||
| 6644 | % If we have an xref label, the number comes next. | ||
| 6645 | \ifx\floatlabel\empty \else | ||
| 6646 | \ifx\floattype\empty \else % if also had float type, need tie first. | ||
| 6647 | \appendtomacro\floatident{\tie}% | ||
| 6648 | \fi | ||
| 6649 | % the number. | ||
| 6650 | \appendtomacro\floatident{\chaplevelprefix\the\floatno}% | ||
| 6651 | \fi | ||
| 6652 | % | ||
| 6653 | % Start the printed caption with what we've constructed in | ||
| 6654 | % \floatident, but keep it separate; we need \floatident again. | ||
| 6655 | \let\captionline = \floatident | ||
| 6656 | % | ||
| 6657 | \ifx\thiscaption\empty \else | ||
| 6658 | \ifx\floatident\empty \else | ||
| 6659 | \appendtomacro\captionline{: }% had ident, so need a colon between | ||
| 6660 | \fi | ||
| 6661 | % | ||
| 6662 | % caption text. | ||
| 6663 | \appendtomacro\captionline{\scanexp\thiscaption}% | ||
| 6664 | \fi | ||
| 6665 | % | ||
| 6666 | % If we have anything to print, print it, with space before. | ||
| 6667 | % Eventually this needs to become an \insert. | ||
| 6668 | \ifx\captionline\empty \else | ||
| 6669 | \vskip.5\parskip | ||
| 6670 | \captionline | ||
| 6671 | % | ||
| 6672 | % Space below caption. | ||
| 6673 | \vskip\parskip | ||
| 6674 | \fi | ||
| 6675 | % | ||
| 6676 | % If have an xref label, write the list of floats info. Do this | ||
| 6677 | % after the caption, to avoid chance of it being a breakpoint. | ||
| 6678 | \ifx\floatlabel\empty \else | ||
| 6679 | % Write the text that goes in the lof to the aux file as | ||
| 6680 | % \floatlabel-lof. Besides \floatident, we include the short | ||
| 6681 | % caption if specified, else the full caption if specified, else nothing. | ||
| 6682 | {% | ||
| 6683 | \atdummies | ||
| 6684 | % | ||
| 6685 | % since we read the caption text in the macro world, where ^^M | ||
| 6686 | % is turned into a normal character, we have to scan it back, so | ||
| 6687 | % we don't write the literal three characters "^^M" into the aux file. | ||
| 6688 | \scanexp{% | ||
| 6689 | \xdef\noexpand\gtemp{% | ||
| 6690 | \ifx\thisshortcaption\empty | ||
| 6691 | \thiscaption | ||
| 6692 | \else | ||
| 6693 | \thisshortcaption | ||
| 6694 | \fi | ||
| 6695 | }% | ||
| 6696 | }% | ||
| 6697 | \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident | ||
| 6698 | \ifx\gtemp\empty \else : \gtemp \fi}}% | ||
| 6699 | }% | ||
| 6700 | \fi | ||
| 6701 | \egroup % end of \vtop | ||
| 6702 | % | ||
| 6703 | % place the captured inserts | ||
| 6704 | % | ||
| 6705 | % BEWARE: when the floats start floating, we have to issue warning | ||
| 6706 | % whenever an insert appears inside a float which could possibly | ||
| 6707 | % float. --kasal, 26may04 | ||
| 6708 | % | ||
| 6709 | \checkinserts | ||
| 6710 | } | ||
| 6711 | |||
| 6712 | % Append the tokens #2 to the definition of macro #1, not expanding either. | ||
| 6713 | % | ||
| 6714 | \def\appendtomacro#1#2{% | ||
| 6715 | \expandafter\def\expandafter#1\expandafter{#1#2}% | ||
| 6716 | } | ||
| 6717 | |||
| 6718 | % @caption, @shortcaption | ||
| 6719 | % | ||
| 6720 | \def\caption{\docaption\thiscaption} | ||
| 6721 | \def\shortcaption{\docaption\thisshortcaption} | ||
| 6722 | \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} | ||
| 6723 | \def\defcaption#1#2{\egroup \def#1{#2}} | ||
| 6724 | |||
| 6725 | % The parameter is the control sequence identifying the counter we are | ||
| 6726 | % going to use. Create it if it doesn't exist and assign it to \floatno. | ||
| 6727 | \def\getfloatno#1{% | ||
| 6728 | \ifx#1\relax | ||
| 6729 | % Haven't seen this figure type before. | ||
| 6730 | \csname newcount\endcsname #1% | ||
| 6731 | % | ||
| 6732 | % Remember to reset this floatno at the next chap. | ||
| 6733 | \expandafter\gdef\expandafter\resetallfloatnos | ||
| 6734 | \expandafter{\resetallfloatnos #1=0 }% | ||
| 6735 | \fi | ||
| 6736 | \let\floatno#1% | ||
| 6737 | } | ||
| 6738 | |||
| 6739 | % \setref calls this to get the XREFLABEL-snt value. We want an @xref | ||
| 6740 | % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we | ||
| 6741 | % first read the @float command. | ||
| 6742 | % | ||
| 6743 | \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% | ||
| 6744 | |||
| 6745 | % Magic string used for the XREFLABEL-title value, so \xrefX can | ||
| 6746 | % distinguish floats from other xref types. | ||
| 6747 | \def\floatmagic{!!float!!} | ||
| 6748 | |||
| 6749 | % #1 is the control sequence we are passed; we expand into a conditional | ||
| 6750 | % which is true if #1 represents a float ref. That is, the magic | ||
| 6751 | % \thissection value which we \setref above. | ||
| 6752 | % | ||
| 6753 | \def\iffloat#1{\expandafter\doiffloat#1==\finish} | ||
| 6754 | % | ||
| 6755 | % #1 is (maybe) the \floatmagic string. If so, #2 will be the | ||
| 6756 | % (safe) float type for this float. We set \iffloattype to #2. | ||
| 6757 | % | ||
| 6758 | \def\doiffloat#1=#2=#3\finish{% | ||
| 6759 | \def\temp{#1}% | ||
| 6760 | \def\iffloattype{#2}% | ||
| 6761 | \ifx\temp\floatmagic | ||
| 6762 | } | ||
| 6763 | |||
| 6764 | % @listoffloats FLOATTYPE - print a list of floats like a table of contents. | ||
| 6765 | % | ||
| 6766 | \parseargdef\listoffloats{% | ||
| 6767 | \def\floattype{#1}% floattype | ||
| 6768 | {% | ||
| 6769 | % the floattype might have accents or other special characters, | ||
| 6770 | % but we need to use it in a control sequence name. | ||
| 6771 | \indexnofonts | ||
| 6772 | \turnoffactive | ||
| 6773 | \xdef\safefloattype{\floattype}% | ||
| 6774 | }% | ||
| 6775 | % | ||
| 6776 | % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. | ||
| 6777 | \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax | ||
| 6778 | \ifhavexrefs | ||
| 6779 | % if the user said @listoffloats foo but never @float foo. | ||
| 6780 | \message{\linenumber No `\safefloattype' floats to list.}% | ||
| 6781 | \fi | ||
| 6782 | \else | ||
| 6783 | \begingroup | ||
| 6784 | \leftskip=\tocindent % indent these entries like a toc | ||
| 6785 | \let\do=\listoffloatsdo | ||
| 6786 | \csname floatlist\safefloattype\endcsname | ||
| 6787 | \endgroup | ||
| 6788 | \fi | ||
| 6789 | } | ||
| 6790 | |||
| 6791 | % This is called on each entry in a list of floats. We're passed the | ||
| 6792 | % xref label, in the form LABEL-title, which is how we save it in the | ||
| 6793 | % aux file. We strip off the -title and look up \XRLABEL-lof, which | ||
| 6794 | % has the text we're supposed to typeset here. | ||
| 6795 | % | ||
| 6796 | % Figures without xref labels will not be included in the list (since | ||
| 6797 | % they won't appear in the aux file). | ||
| 6798 | % | ||
| 6799 | \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} | ||
| 6800 | \def\listoffloatsdoentry#1-title\finish{{% | ||
| 6801 | % Can't fully expand XR#1-lof because it can contain anything. Just | ||
| 6802 | % pass the control sequence. On the other hand, XR#1-pg is just the | ||
| 6803 | % page number, and we want to fully expand that so we can get a link | ||
| 6804 | % in pdf output. | ||
| 6805 | \toksA = \expandafter{\csname XR#1-lof\endcsname}% | ||
| 6806 | % | ||
| 6807 | % use the same \entry macro we use to generate the TOC and index. | ||
| 6808 | \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% | ||
| 6809 | \writeentry | ||
| 6810 | }} | ||
| 6811 | |||
| 6375 | \message{localization,} | 6812 | \message{localization,} |
| 6376 | % and i18n. | 6813 | % and i18n. |
| 6377 | 6814 | ||
| @@ -6380,19 +6817,17 @@ width0pt\relax} \fi | |||
| 6380 | % properly. Single argument is the language abbreviation. | 6817 | % properly. Single argument is the language abbreviation. |
| 6381 | % It would be nice if we could set up a hyphenation file here. | 6818 | % It would be nice if we could set up a hyphenation file here. |
| 6382 | % | 6819 | % |
| 6383 | \def\documentlanguage{\parsearg\dodocumentlanguage} | 6820 | \parseargdef\documentlanguage{% |
| 6384 | \def\dodocumentlanguage#1{% | ||
| 6385 | \tex % read txi-??.tex file in plain TeX. | 6821 | \tex % read txi-??.tex file in plain TeX. |
| 6386 | % Read the file if it exists. | 6822 | % Read the file if it exists. |
| 6387 | \openin 1 txi-#1.tex | 6823 | \openin 1 txi-#1.tex |
| 6388 | \ifeof1 | 6824 | \ifeof 1 |
| 6389 | \errhelp = \nolanghelp | 6825 | \errhelp = \nolanghelp |
| 6390 | \errmessage{Cannot read language file txi-#1.tex}% | 6826 | \errmessage{Cannot read language file txi-#1.tex}% |
| 6391 | \let\temp = \relax | 6827 | \else |
| 6392 | \else | 6828 | \input txi-#1.tex |
| 6393 | \def\temp{\input txi-#1.tex }% | 6829 | \fi |
| 6394 | \fi | 6830 | \closein 1 |
| 6395 | \temp | ||
| 6396 | \endgroup | 6831 | \endgroup |
| 6397 | } | 6832 | } |
| 6398 | \newhelp\nolanghelp{The given language definition file cannot be found or | 6833 | \newhelp\nolanghelp{The given language definition file cannot be found or |
| @@ -6437,9 +6872,9 @@ should work if nowhere else does.} | |||
| 6437 | \fi | 6872 | \fi |
| 6438 | } | 6873 | } |
| 6439 | 6874 | ||
| 6440 | % Parameters in order: 1) textheight; 2) textwidth; 3) voffset; | 6875 | % Parameters in order: 1) textheight; 2) textwidth; |
| 6441 | % 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8) | 6876 | % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; |
| 6442 | % physical page width. | 6877 | % 7) physical page height; 8) physical page width. |
| 6443 | % | 6878 | % |
| 6444 | % We also call \setleading{\textleading}, so the caller should define | 6879 | % We also call \setleading{\textleading}, so the caller should define |
| 6445 | % \textleading. The caller should also set \parskip. | 6880 | % \textleading. The caller should also set \parskip. |
| @@ -6486,7 +6921,7 @@ should work if nowhere else does.} | |||
| 6486 | {11in}{8.5in}% | 6921 | {11in}{8.5in}% |
| 6487 | }} | 6922 | }} |
| 6488 | 6923 | ||
| 6489 | % Use @smallbook to reset parameters for 7x9.5 (or so) format. | 6924 | % Use @smallbook to reset parameters for 7x9.25 trim size. |
| 6490 | \def\smallbook{{\globaldefs = 1 | 6925 | \def\smallbook{{\globaldefs = 1 |
| 6491 | \parskip = 2pt plus 1pt | 6926 | \parskip = 2pt plus 1pt |
| 6492 | \textleading = 12pt | 6927 | \textleading = 12pt |
| @@ -6503,6 +6938,24 @@ should work if nowhere else does.} | |||
| 6503 | \defbodyindent = .5cm | 6938 | \defbodyindent = .5cm |
| 6504 | }} | 6939 | }} |
| 6505 | 6940 | ||
| 6941 | % Use @smallerbook to reset parameters for 6x9 trim size. | ||
| 6942 | % (Just testing, parameters still in flux.) | ||
| 6943 | \def\smallerbook{{\globaldefs = 1 | ||
| 6944 | \parskip = 1.5pt plus 1pt | ||
| 6945 | \textleading = 12pt | ||
| 6946 | % | ||
| 6947 | \internalpagesizes{7.4in}{4.8in}% | ||
| 6948 | {-.2in}{-.4in}% | ||
| 6949 | {0pt}{14pt}% | ||
| 6950 | {9in}{6in}% | ||
| 6951 | % | ||
| 6952 | \lispnarrowing = 0.25in | ||
| 6953 | \tolerance = 700 | ||
| 6954 | \hfuzz = 1pt | ||
| 6955 | \contentsrightmargin = 0pt | ||
| 6956 | \defbodyindent = .4cm | ||
| 6957 | }} | ||
| 6958 | |||
| 6506 | % Use @afourpaper to print on European A4 paper. | 6959 | % Use @afourpaper to print on European A4 paper. |
| 6507 | \def\afourpaper{{\globaldefs = 1 | 6960 | \def\afourpaper{{\globaldefs = 1 |
| 6508 | \parskip = 3pt plus 2pt minus 1pt | 6961 | \parskip = 3pt plus 2pt minus 1pt |
| @@ -6575,8 +7028,7 @@ should work if nowhere else does.} | |||
| 6575 | % Perhaps we should allow setting the margins, \topskip, \parskip, | 7028 | % Perhaps we should allow setting the margins, \topskip, \parskip, |
| 6576 | % and/or leading, also. Or perhaps we should compute them somehow. | 7029 | % and/or leading, also. Or perhaps we should compute them somehow. |
| 6577 | % | 7030 | % |
| 6578 | \def\pagesizes{\parsearg\pagesizesxxx} | 7031 | \parseargdef\pagesizes{\pagesizesyyy #1,,\finish} |
| 6579 | \def\pagesizesxxx#1{\pagesizesyyy #1,,\finish} | ||
| 6580 | \def\pagesizesyyy#1,#2,#3\finish{{% | 7032 | \def\pagesizesyyy#1,#2,#3\finish{{% |
| 6581 | \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi | 7033 | \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi |
| 6582 | \globaldefs = 1 | 7034 | \globaldefs = 1 |
| @@ -6623,8 +7075,8 @@ should work if nowhere else does.} | |||
| 6623 | \def\normalplus{+} | 7075 | \def\normalplus{+} |
| 6624 | \def\normaldollar{$}%$ font-lock fix | 7076 | \def\normaldollar{$}%$ font-lock fix |
| 6625 | 7077 | ||
| 6626 | % This macro is used to make a character print one way in ttfont | 7078 | % This macro is used to make a character print one way in \tt |
| 6627 | % where it can probably just be output, and another way in other fonts, | 7079 | % (where it can probably be output as-is), and another way in other fonts, |
| 6628 | % where something hairier probably needs to be done. | 7080 | % where something hairier probably needs to be done. |
| 6629 | % | 7081 | % |
| 6630 | % #1 is what to print if we are indeed using \tt; #2 is what to print | 7082 | % #1 is what to print if we are indeed using \tt; #2 is what to print |
| @@ -6656,6 +7108,7 @@ should work if nowhere else does.} | |||
| 6656 | 7108 | ||
| 6657 | \catcode`\_=\active | 7109 | \catcode`\_=\active |
| 6658 | \def_{\ifusingtt\normalunderscore\_} | 7110 | \def_{\ifusingtt\normalunderscore\_} |
| 7111 | \let\realunder=_ | ||
| 6659 | % Subroutine for the previous macro. | 7112 | % Subroutine for the previous macro. |
| 6660 | \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } | 7113 | \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } |
| 6661 | 7114 | ||
| @@ -6672,46 +7125,49 @@ should work if nowhere else does.} | |||
| 6672 | \catcode`\$=\active | 7125 | \catcode`\$=\active |
| 6673 | \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix | 7126 | \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix |
| 6674 | 7127 | ||
| 6675 | % Set up an active definition for =, but don't enable it most of the time. | ||
| 6676 | {\catcode`\==\active | ||
| 6677 | \global\def={{\tt \char 61}}} | ||
| 6678 | |||
| 6679 | \catcode`+=\active | ||
| 6680 | \catcode`\_=\active | ||
| 6681 | |||
| 6682 | % If a .fmt file is being used, characters that might appear in a file | 7128 | % If a .fmt file is being used, characters that might appear in a file |
| 6683 | % name cannot be active until we have parsed the command line. | 7129 | % name cannot be active until we have parsed the command line. |
| 6684 | % So turn them off again, and have \everyjob (or @setfilename) turn them on. | 7130 | % So turn them off again, and have \everyjob (or @setfilename) turn them on. |
| 6685 | % \otherifyactive is called near the end of this file. | 7131 | % \otherifyactive is called near the end of this file. |
| 6686 | \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} | 7132 | \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} |
| 6687 | 7133 | ||
| 7134 | % Used sometimes to turn off (effectively) the active characters even after | ||
| 7135 | % parsing them. | ||
| 7136 | \def\turnoffactive{% | ||
| 7137 | \normalturnoffactive | ||
| 7138 | \otherbackslash | ||
| 7139 | } | ||
| 7140 | |||
| 6688 | \catcode`\@=0 | 7141 | \catcode`\@=0 |
| 6689 | 7142 | ||
| 6690 | % \rawbackslashxx outputs one backslash character in current font, | 7143 | % \backslashcurfont outputs one backslash character in current font, |
| 6691 | % as in \char`\\. | 7144 | % as in \char`\\. |
| 6692 | \global\chardef\rawbackslashxx=`\\ | 7145 | \global\chardef\backslashcurfont=`\\ |
| 6693 | 7146 | \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work | |
| 6694 | % \rawbackslash defines an active \ to do \rawbackslashxx. | ||
| 6695 | % \otherbackslash defines an active \ to be a literal `\' character with | ||
| 6696 | % catcode other. | ||
| 6697 | {\catcode`\\=\active | ||
| 6698 | @gdef@rawbackslash{@let\=@rawbackslashxx} | ||
| 6699 | @gdef@otherbackslash{@let\=@realbackslash} | ||
| 6700 | } | ||
| 6701 | 7147 | ||
| 6702 | % \realbackslash is an actual character `\' with catcode other. | 7148 | % \realbackslash is an actual character `\' with catcode other, and |
| 6703 | {\catcode`\\=\other @gdef@realbackslash{\}} | 7149 | % \doublebackslash is two of them (for the pdf outlines). |
| 6704 | 7150 | {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} | |
| 6705 | % \normalbackslash outputs one backslash in fixed width font. | ||
| 6706 | \def\normalbackslash{{\tt\rawbackslashxx}} | ||
| 6707 | 7151 | ||
| 7152 | % In texinfo, backslash is an active character; it prints the backslash | ||
| 7153 | % in fixed width font. | ||
| 6708 | \catcode`\\=\active | 7154 | \catcode`\\=\active |
| 7155 | @def@normalbackslash{{@tt@backslashcurfont}} | ||
| 7156 | % On startup, @fixbackslash assigns: | ||
| 7157 | % @let \ = @normalbackslash | ||
| 6709 | 7158 | ||
| 6710 | % Used sometimes to turn off (effectively) the active characters | 7159 | % \rawbackslash defines an active \ to do \backslashcurfont. |
| 6711 | % even after parsing them. | 7160 | % \otherbackslash defines an active \ to be a literal `\' character with |
| 6712 | @def@turnoffactive{% | 7161 | % catcode other. |
| 7162 | @gdef@rawbackslash{@let\=@backslashcurfont} | ||
| 7163 | @gdef@otherbackslash{@let\=@realbackslash} | ||
| 7164 | |||
| 7165 | % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of | ||
| 7166 | % the literal character `\'. | ||
| 7167 | % | ||
| 7168 | @def@normalturnoffactive{% | ||
| 7169 | @let\=@normalbackslash | ||
| 6713 | @let"=@normaldoublequote | 7170 | @let"=@normaldoublequote |
| 6714 | @let\=@realbackslash | ||
| 6715 | @let~=@normaltilde | 7171 | @let~=@normaltilde |
| 6716 | @let^=@normalcaret | 7172 | @let^=@normalcaret |
| 6717 | @let_=@normalunderscore | 7173 | @let_=@normalunderscore |
| @@ -6720,14 +7176,9 @@ should work if nowhere else does.} | |||
| 6720 | @let>=@normalgreater | 7176 | @let>=@normalgreater |
| 6721 | @let+=@normalplus | 7177 | @let+=@normalplus |
| 6722 | @let$=@normaldollar %$ font-lock fix | 7178 | @let$=@normaldollar %$ font-lock fix |
| 7179 | @unsepspaces | ||
| 6723 | } | 7180 | } |
| 6724 | 7181 | ||
| 6725 | % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of | ||
| 6726 | % the literal character `\'. (Thus, \ is not expandable when this is in | ||
| 6727 | % effect.) | ||
| 6728 | % | ||
| 6729 | @def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} | ||
| 6730 | |||
| 6731 | % Make _ and + \other characters, temporarily. | 7182 | % Make _ and + \other characters, temporarily. |
| 6732 | % This is canceled by @fixbackslash. | 7183 | % This is canceled by @fixbackslash. |
| 6733 | @otherifyactive | 7184 | @otherifyactive |
| @@ -6740,9 +7191,9 @@ should work if nowhere else does.} | |||
| 6740 | @global@let\ = @eatinput | 7191 | @global@let\ = @eatinput |
| 6741 | 7192 | ||
| 6742 | % On the other hand, perhaps the file did not have a `\input texinfo'. Then | 7193 | % On the other hand, perhaps the file did not have a `\input texinfo'. Then |
| 6743 | % the first `\{ in the file would cause an error. This macro tries to fix | 7194 | % the first `\' in the file would cause an error. This macro tries to fix |
| 6744 | % that, assuming it is called before the first `\' could plausibly occur. | 7195 | % that, assuming it is called before the first `\' could plausibly occur. |
| 6745 | % Also back turn on active characters that might appear in the input | 7196 | % Also turn back on active characters that might appear in the input |
| 6746 | % file name, in case not using a pre-dumped format. | 7197 | % file name, in case not using a pre-dumped format. |
| 6747 | % | 7198 | % |
| 6748 | @gdef@fixbackslash{% | 7199 | @gdef@fixbackslash{% |
| @@ -6759,10 +7210,6 @@ should work if nowhere else does.} | |||
| 6759 | @catcode`@# = @other | 7210 | @catcode`@# = @other |
| 6760 | @catcode`@% = @other | 7211 | @catcode`@% = @other |
| 6761 | 7212 | ||
| 6762 | @c Set initial fonts. | ||
| 6763 | @textfonts | ||
| 6764 | @rm | ||
| 6765 | |||
| 6766 | 7213 | ||
| 6767 | @c Local variables: | 7214 | @c Local variables: |
| 6768 | @c eval: (add-hook 'write-file-hooks 'time-stamp) | 7215 | @c eval: (add-hook 'write-file-hooks 'time-stamp) |
| @@ -6772,6 +7219,8 @@ should work if nowhere else does.} | |||
| 6772 | @c time-stamp-end: "}" | 7219 | @c time-stamp-end: "}" |
| 6773 | @c End: | 7220 | @c End: |
| 6774 | 7221 | ||
| 7222 | @c vim:sw=2: | ||
| 7223 | |||
| 6775 | @ignore | 7224 | @ignore |
| 6776 | arch-tag: 53261dd3-7df7-4ec3-9d90-af7a955d3c87 | 7225 | arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 |
| 6777 | @end ignore | 7226 | @end ignore |