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