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