home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / unixtex-6.1b-src.tgz / tar.out / contrib / unixtex / texinfo.tex < prev   
Encoding:
Text File  |  1996-09-28  |  141.0 KB  |  4,382 lines

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