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