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