home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / sed-3.02 / doc / texinfo.tex (.txt) < prev    next >
Encoding:
Texinfo Document  |  1998-07-21  |  177.8 KB  |  4,380 lines

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