home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / t / trmcap11.zip / termcap-1.1 / texinfo.tex (.txt) < prev    next >
LaTeX Document  |  1992-10-11  |  120KB  |  2,913 lines

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