home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gnudiff.zip / texinfo.tex (.txt) < prev    next >
LaTeX Document  |  1994-11-13  |  144KB  |  3,515 lines

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