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