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