home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / autoconf-1.11-src.lha / GNU / src / amiga / autoconf-1.11 / texinfo.tex (.txt) < prev   
LaTeX Document  |  1994-04-18  |  136KB  |  3,312 lines

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