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