home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / packer / gzip / texinfo.tex < prev    next >
Encoding:
Text File  |  1994-02-03  |  120.4 KB  |  3,663 lines

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